Go to the documentation of this file.
39 #define TNS_Q_BITS_IS8 4
42 #define TNS_ENABLE_COEF_COMPRESSION
45 #define TNS_GAIN_THRESHOLD_LOW 1.4f
46 #define TNS_GAIN_THRESHOLD_HIGH 1.16f*TNS_GAIN_THRESHOLD_LOW
51 const int low_idx = c_bits ? 4 : 2;
52 const int shift_val = c_bits ? 8 : 4;
53 const int high_idx = c_bits ? 11 : 5;
54 #ifndef TNS_ENABLE_COEF_COMPRESSION
57 for (
i = 0;
i < order;
i++)
58 if (coef[
i] >= low_idx && coef[
i] <= high_idx)
60 for (
i = 0;
i < order;
i++)
61 coef[
i] -= (coef[
i] > high_idx) ? shift_val : 0;
73 int i,
w,
filt, coef_compress = 0, coef_len;
94 coef_len = c_bits + 3 - coef_compress;
106 int w,
filt, m,
i, top, order, bottom, start, end,
size, inc;
124 if ((
size = end - start) <= 0)
135 for (m = 0; m <
size; m++, start += inc) {
136 for (
i = 1;
i <=
FFMIN(m, order);
i++) {
152 for (
i = 0;
i < order;
i++) {
154 lpc[
i] = quant_arr[idx[
i]];
174 const int sfb_len = sfb_end - sfb_start;
177 if (coef_len <= 0 || sfb_len <= 0) {
183 float en[2] = {0.0f, 0.0f};
184 int oc_start = 0, os_start = 0;
188 FFPsyBand *band = &
s->psy.ch[
s->cur_channel].psy_bands[
w*16+
g];
189 if (
g > sfb_start + (sfb_len/2))
197 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 compress_coeffs(int *coef, int order, int c_bits)
const float *const ff_tns_tmp2_map[4]
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]
static int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order, LPC_TYPE *lpc, int lpc_stride, int fail, int normalize)
Levinson-Durbin recursion.
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.
enum WindowSequence window_sequence[2]
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)
float pcoeffs[1024]
coefficients for IMDCT, pristine
const uint16_t * swb_offset
table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular wind...
static const int8_t filt[NUMTAPS *2]
#define AV_PROFILE_AAC_LOW
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