Go to the documentation of this file.
38 #define TNS_Q_BITS_IS8 4
41 #define TNS_ENABLE_COEF_COMPRESSION
44 #define TNS_GAIN_THRESHOLD_LOW 1.4f
45 #define TNS_GAIN_THRESHOLD_HIGH 1.16f*TNS_GAIN_THRESHOLD_LOW
50 const int low_idx = c_bits ? 4 : 2;
51 const int shift_val = c_bits ? 8 : 4;
52 const int high_idx = c_bits ? 11 : 5;
53 #ifndef TNS_ENABLE_COEF_COMPRESSION
56 for (
i = 0;
i < order;
i++)
57 if (coef[
i] >= low_idx && coef[
i] <= high_idx)
59 for (
i = 0;
i < order;
i++)
60 coef[
i] -= (coef[
i] > high_idx) ? shift_val : 0;
72 int i,
w,
filt, coef_compress = 0, coef_len;
93 coef_len = c_bits + 3 - coef_compress;
105 int w,
filt, m,
i, top, order, bottom, start, end,
size, inc;
123 if ((
size = end - start) <= 0)
134 for (m = 0; m <
size; m++, start += inc) {
135 for (
i = 1;
i <=
FFMIN(m, order);
i++) {
151 for (
i = 0;
i < order;
i++) {
153 lpc[
i] = quant_arr[idx[
i]];
173 const int sfb_len = sfb_end - sfb_start;
176 if (coef_len <= 0 || sfb_len <= 0) {
182 float en[2] = {0.0f, 0.0f};
183 int oc_start = 0, os_start = 0;
187 FFPsyBand *band = &
s->psy.ch[
s->cur_channel].psy_bands[
w*16+
g];
188 if (
g > sfb_start + (sfb_len/2))
196 coef_len, order, coefs);
#define TNS_GAIN_THRESHOLD_HIGH
int coef_idx[8][4][TNS_MAX_ORDER]
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
static int AAC_RENAME() compute_lpc_coefs(const LPC_TYPE *autoc, int max_order, LPC_TYPE *lpc, int lpc_stride, int fail, int normalize)
Levinson-Durbin recursion.
static int compress_coeffs(int *coef, int order, int c_bits)
INTFLOAT pcoeffs[1024]
coefficients for IMDCT, pristine
int num_swb
number of scalefactor window bands
IndividualChannelStream ics
INTFLOAT coeffs[1024]
coefficients for IMDCT, maybe processed
Individual Channel Stream.
INTFLOAT coef[8][4][TNS_MAX_ORDER]
const uint16_t * swb_offset
table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular wind...
void ff_aac_apply_tns(AACEncContext *s, SingleChannelElement *sce)
single band psychoacoustic information
void ff_aac_encode_tns_info(AACEncContext *s, SingleChannelElement *sce)
Encode TNS data.
#define FF_PROFILE_AAC_LOW
static int quant_array_idx(const float val, const float *arr, const int num)
double ff_lpc_calc_ref_coefs_f(LPCContext *s, const float *samples, int len, int order, double *ref)
static const uint8_t *const tns_min_sfb[2]
Single Channel Element - used for both SCE and LFE elements.
#define i(width, name, range_min, range_max)
void ff_aac_search_for_tns(AACEncContext *s, SingleChannelElement *sce)
static const int8_t filt[NUMTAPS *2]
enum WindowSequence window_sequence[2]
static void quantize_coefs(double *coef, int *idx, float *lpc, int order, int c_bits)
uint8_t max_sfb
number of scalefactor bands per group
static const INTFLOAT *const tns_tmp2_map[4]