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;
 
   85         for (filt = 0; filt < tns->
n_filt[i]; filt++) {
 
   88             if (!tns->
order[i][filt])
 
   92                                             tns->
order[i][filt], c_bits);
 
   94             coef_len = c_bits + 3 - coef_compress;
 
  106     int w, 
filt, m, i, top, order, bottom, 
start, 
end, 
size, inc;
 
  112         for (filt = 0; filt < tns->
n_filt[
w]; filt++) {
 
  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]];
 
  170     const int sfb_end   = av_clip(sce->
ics.
num_swb, 0, mmm);
 
  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;
 
  187         for (g = sfb_start; g < sce->
ics.
num_swb && g <= sfb_end; g++) {
 
  189             if (g > sfb_start + (sfb_len/2))
 
  197                                        coef_len, order, coefs);
 
  203         for (g = 0; g < tns->
n_filt[
w]; g++) {
 
  208                             tns->
order[w][g], c_bits);
 
static const uint8_t *const tns_min_sfb[2]
int coef_idx[8][4][TNS_MAX_ORDER]
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit 
FFPsyBand psy_bands[PSY_MAX_BANDS]
channel bands information 
void ff_aac_encode_tns_info(AACEncContext *s, SingleChannelElement *sce)
Encode TNS data. 
static int compress_coeffs(int *coef, int order, int c_bits)
INTFLOAT 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...
LPCContext lpc
used by TNS 
int samplerate_index
MPEG-4 samplerate index. 
static av_cold int end(AVCodecContext *avctx)
single band psychoacoustic information 
int profile
copied from avctx 
void ff_aac_search_for_tns(AACEncContext *s, SingleChannelElement *sce)
void ff_aac_apply_tns(AACEncContext *s, SingleChannelElement *sce)
uint8_t max_sfb
number of scalefactor bands per group 
int num_swb
number of scalefactor window bands 
enum WindowSequence window_sequence[2]
int cur_channel
current channel for coder context 
#define FF_PROFILE_AAC_LOW
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 const INTFLOAT *const tns_tmp2_map[4]
#define TNS_GAIN_THRESHOLD_HIGH
static void quantize_coefs(double *coef, int *idx, float *lpc, int order, int c_bits)
static int quant_array_idx(const float val, const float *arr, const int num)
IndividualChannelStream ics
Replacements for frequently missing libm functions. 
double ff_lpc_calc_ref_coefs_f(LPCContext *s, const float *samples, int len, int order, double *ref)
static const int8_t filt[NUMTAPS]
INTFLOAT coeffs[1024]
coefficients for IMDCT, maybe processed 
INTFLOAT coef[8][4][TNS_MAX_ORDER]
Single Channel Element - used for both SCE and LFE elements. 
Individual Channel Stream. 
FFPsyChannel * ch
single channel information 
AAC encoder temporal noise shaping.