34 int start,
int w,
int g,
float ener0,
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];
48 if (
ener01 <= 0 || ener0 <= 0) {
54 FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(
w+w2)*16+
g];
55 FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(
w+w2)*16+
g];
56 int is_band_type, is_sf_idx =
FFMAX(1, sce0->
sf_idx[
w*16+
g]-4);
58 float maxval, dist_spec_err = 0.0f;
78 is_sf_idx, is_band_type,
81 dist_spec_err += (L34[i] - I34[i])*(L34[i] - I34[i]);
82 dist_spec_err += (R34[i] - I34[i]*e01_34)*(R34[i] - I34[i]*e01_34);
84 dist_spec_err *= s->lambda / minthr;
85 dist2 += dist_spec_err;
102 int start = 0,
count = 0,
w, w2,
g, i, prev_sf1 = -1, prev_bt = -1, prev_is = 0;
119 float ener0 = 0.0f, ener1 = 0.0f,
ener01 = 0.0f, ener01p = 0.0f;
123 float coef0 = sce0->
coeffs[start+(
w+w2)*128+i];
124 float coef1 = sce1->
coeffs[start+(
w+w2)*128+i];
125 ener0 += coef0*coef0;
126 ener1 += coef1*coef1;
127 ener01 += (coef0 + coef1)*(coef0 + coef1);
128 ener01p += (coef0 - coef1)*(coef0 - coef1);
132 ener0, ener1, ener01p, 0, -1);
134 ener0, ener1,
ener01, 0, +1);
135 best = (ph_err1.
pass && ph_err1.
error < ph_err2.
error) ? &ph_err1 : &ph_err2;
142 if (prev_is && prev_bt != cpe->
ch[1].
band_type[
w*16+g]) {
Band types following are encoded differently from others.
static int ff_sfdelta_can_remove_band(const SingleChannelElement *sce, const uint8_t *nextband, int prev_sf, int band)
int common_window
Set if channels share a common 'IndividualChannelStream' in bitstream.
uint8_t ms_mask[128]
Set if mid/side stereo is used for each scalefactor window band.
Spectral data are scaled white noise not coded in the bitstream.
INTFLOAT pcoeffs[1024]
coefficients for IMDCT, pristine
SingleChannelElement ch[2]
Scalefactor data are intensity stereo positions (in phase).
single band psychoacoustic information
float is_ener[128]
Intensity stereo pos (used by encoder)
int num_swb
number of scalefactor window bands
static void ff_init_nextband_map(const SingleChannelElement *sce, uint8_t *nextband)
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
static float pos_pow34(float a)
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)
INTFLOAT coeffs[1024]
coefficients for IMDCT, maybe processed
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)
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, float *energy, int rtz)
uint8_t is_mask[128]
Set if intensity stereo is used (used by encoder)