34 int start,
int w,
int g,
float ener0,
35 float ener1,
float ener01,
36 int use_pcoeffs,
int phase)
43 float *L34 = &s->scoefs[256*0], *R34 = &s->scoefs[256*1];
44 float *IS = &s->scoefs[256*2], *I34 = &s->scoefs[256*3];
49 FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+
g];
50 FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+
g];
51 int is_band_type, is_sf_idx =
FFMAX(1, sce0->
sf_idx[(w+w2)*16+
g]-4);
52 float e01_34 =
phase*pow(ener1/ener0, 3.0/4.0);
53 float maxval, dist_spec_err = 0.0f;
56 IS[i] = (L[
start+(w+w2)*128+i] +
phase*R[
start+(w+w2)*128+i])*sqrt(ener0/ener01);
73 is_sf_idx, is_band_type,
76 dist_spec_err += (L34[i] - I34[i])*(L34[i] - I34[i]);
77 dist_spec_err += (R34[i] - I34[i]*e01_34)*(R34[i] - I34[i]*e01_34);
79 dist_spec_err *= s->lambda / minthr;
80 dist2 += dist_spec_err;
108 float ener0 = 0.0f, ener1 = 0.0f, ener01 = 0.0f;
112 float coef0 = sce0->
pcoeffs[start+(w+w2)*128+i];
113 float coef1 = sce1->
pcoeffs[start+(w+w2)*128+i];
114 ener0 += coef0*coef0;
115 ener1 += coef1*coef1;
116 ener01 += (coef0 + coef1)*(coef0 + coef1);
120 ener0, ener1, ener01, 0, -1);
122 ener0, ener1, ener01, 0, +1);
123 erf = ph_err1.
error < ph_err2.
error ? &ph_err1 : &ph_err2;
126 cpe->
ch[0].
is_ener[w*16+
g] = sqrt(ener0/ener01);
static void abs_pow34_v(float *out, const float *in, const int size)
float pcoeffs[1024]
coefficients for IMDCT, pristine
int common_window
Set if channels share a common 'IndividualChannelStream' in bitstream.
Spectral data are scaled white noise not coded in the bitstream.
SingleChannelElement ch[2]
Scalefactor data are intensity stereo positions (in phase).
single band psychoacoustic information
float coeffs[1024]
coefficients for IMDCT, maybe processed
float is_ener[128]
Intensity stereo pos (used by encoder)
int num_swb
number of scalefactor window bands
AAC encoder Intensity Stereo.
void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe)
static int find_min_book(float maxval, int sf)
int sample_rate
samples per second
main external API structure.
IndividualChannelStream ics
const uint8_t * swb_sizes
table of scalefactor band sizes for a particular window
uint8_t zeroes[128]
band is not coded (used by encoder)
int sf_idx[128]
scalefactor indices (used by encoder)
uint8_t is_mode
Set if any bands have been encoded using intensity stereo (used by encoder)
Scalefactor data are intensity stereo positions (out of phase).
Single Channel Element - used for both SCE and LFE elements.
struct AACISError ff_aac_is_encoding_err(AACEncContext *s, ChannelElement *cpe, int start, int w, int g, float ener0, float ener1, float ener01, int use_pcoeffs, int phase)
channel element - generic struct for SCE/CPE/CCE/LFE
enum BandType band_type[128]
band types
#define INT_STEREO_LOW_LIMIT
Frequency in Hz for lower limit of intensity stereo.
static float find_max_val(int group_len, int swb_size, const float *scaled)
uint8_t is_mask[128]
Set if intensity stereo is used (used by encoder)
static float quantize_band_cost(struct AACEncContext *s, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, int rtz)