Go to the documentation of this file.
57 #define NOISE_SPREAD_THRESHOLD 0.9f
61 #define NOISE_LAMBDA_REPLACE 1.948f
66 const float *in,
float *
quant,
const float *scaled,
67 int size,
int scale_idx,
int cb,
68 const float lambda,
const float uplim,
69 int *
bits,
float *energy);
79 const float *scaled,
int size,
int scale_idx,
80 int cb,
const float lambda,
const float uplim,
81 int *
bits,
float *energy,
int BT_ZERO,
int BT_UNSIGNED,
82 int BT_PAIR,
int BT_ESC,
int BT_NOISE,
int BT_STEREO,
89 const float CLIPPED_ESCAPE = 165140.0f*IQ;
92 const int dim = BT_PAIR ? 2 : 4;
96 if (BT_ZERO || BT_NOISE || BT_STEREO) {
105 for (
int j = 0; j <
dim; j++)
111 s->abs_pow34(
s->scoefs, in,
size);
122 int *quants =
s->qcoefs +
i;
125 float quantized, rd = 0.0f;
126 for (
int j = 0; j <
dim; j++) {
128 curidx += quants[j] + off;
133 for (
int j = 0; j <
dim; j++) {
136 if (BT_ESC && vec[j] == 64.0
f) {
137 if (t >= CLIPPED_ESCAPE) {
138 quantized = CLIPPED_ESCAPE;
146 quantized = vec[j]*IQ;
150 out[
i+j] = in[
i+j] >= 0 ? quantized : -quantized;
153 qenergy += quantized*quantized;
157 for (
int j = 0; j <
dim; j++) {
158 quantized = vec[j]*IQ;
159 qenergy += quantized*quantized;
161 out[
i+j] = quantized;
162 rd += (in[
i+j] - quantized)*(in[
i+j] - quantized);
165 cost += rd *
lambda + curbits;
172 for (
int j = 0; j <
dim; j++)
176 for (
int j = 0; j < 2; j++) {
197 const float *in,
float *
quant,
const float *scaled,
198 int size,
int scale_idx,
int cb,
199 const float lambda,
const float uplim,
200 int *
bits,
float *energy) {
205 #define QUANTIZE_AND_ENCODE_BAND_COST_FUNC(NAME, BT_ZERO, BT_UNSIGNED, BT_PAIR, BT_ESC, BT_NOISE, BT_STEREO, ROUNDING) \
206 static float quantize_and_encode_band_cost_ ## NAME( \
207 struct AACEncContext *s, \
208 PutBitContext *pb, const float *in, float *quant, \
209 const float *scaled, int size, int scale_idx, \
210 int cb, const float lambda, const float uplim, \
211 int *bits, float *energy) { \
212 return quantize_and_encode_band_cost_template( \
213 s, pb, in, quant, scaled, size, scale_idx, \
214 BT_ESC ? ESC_BT : cb, lambda, uplim, bits, energy, \
215 BT_ZERO, BT_UNSIGNED, BT_PAIR, BT_ESC, BT_NOISE, BT_STEREO, \
231 quantize_and_encode_band_cost_ZERO,
232 quantize_and_encode_band_cost_SQUAD,
233 quantize_and_encode_band_cost_SQUAD,
234 quantize_and_encode_band_cost_UQUAD,
235 quantize_and_encode_band_cost_UQUAD,
236 quantize_and_encode_band_cost_SPAIR,
237 quantize_and_encode_band_cost_SPAIR,
238 quantize_and_encode_band_cost_UPAIR,
239 quantize_and_encode_band_cost_UPAIR,
240 quantize_and_encode_band_cost_UPAIR,
241 quantize_and_encode_band_cost_UPAIR,
242 quantize_and_encode_band_cost_ESC,
244 quantize_and_encode_band_cost_NOISE,
245 quantize_and_encode_band_cost_STEREO,
246 quantize_and_encode_band_cost_STEREO,
251 quantize_and_encode_band_cost_ZERO,
252 quantize_and_encode_band_cost_SQUAD,
253 quantize_and_encode_band_cost_SQUAD,
254 quantize_and_encode_band_cost_UQUAD,
255 quantize_and_encode_band_cost_UQUAD,
256 quantize_and_encode_band_cost_SPAIR,
257 quantize_and_encode_band_cost_SPAIR,
258 quantize_and_encode_band_cost_UPAIR,
259 quantize_and_encode_band_cost_UPAIR,
260 quantize_and_encode_band_cost_UPAIR,
261 quantize_and_encode_band_cost_UPAIR,
262 quantize_and_encode_band_cost_ESC_RTZ,
264 quantize_and_encode_band_cost_NOISE,
265 quantize_and_encode_band_cost_STEREO,
266 quantize_and_encode_band_cost_STEREO,
270 const float *in,
float *
quant,
const float *scaled,
271 int size,
int scale_idx,
int cb,
272 const float lambda,
const float uplim,
273 int *
bits,
float *energy)
281 const float *in,
float *
out,
int size,
int scale_idx,
282 int cb,
const float lambda,
int rtz)
301 int win,
int group_len,
const float lambda)
308 const int run_esc = (1 <<
run_bits) - 1;
309 int idx, ppos, count;
310 int stackrun[120], stackcb[120], stack_len;
314 s->abs_pow34(
s->scoefs, sce->
coeffs, 1024);
321 for (swb = 0; swb < max_sfb; swb++) {
330 float minrd = next_minrd;
331 int mincb = next_mincb;
335 float cost_stay_here, cost_get_here;
344 for (
w = 0;
w < group_len;
w++) {
345 FFPsyBand *band = &
s->psy.ch[
s->cur_channel].psy_bands[(
win+
w)*16+swb];
347 &
s->scoefs[start +
w*128],
size,
351 cost_stay_here = path[swb][
cb].
cost + rd;
352 cost_get_here = minrd + rd +
run_bits + 4;
356 if (cost_get_here < cost_stay_here) {
358 path[swb+1][
cb].
cost = cost_get_here;
359 path[swb+1][
cb].
run = 1;
362 path[swb+1][
cb].
cost = cost_stay_here;
365 if (path[swb+1][
cb].cost < next_minrd) {
366 next_minrd = path[swb+1][
cb].
cost;
378 if (path[max_sfb][
cb].cost < path[max_sfb][idx].cost)
384 stackrun[stack_len] = path[ppos][
cb].
run;
385 stackcb [stack_len] =
cb;
387 ppos -= path[ppos][
cb].
run;
392 for (
i = stack_len - 1;
i >= 0;
i--) {
398 for (j = 0; j < count; j++) {
402 while (count >= run_esc) {
416 #define TRELLIS_STAGES 121
417 #define TRELLIS_STATES (SCALE_MAX_DIFF+1)
422 int prevscaler_n = -255, prevscaler_i = 0;
434 if (prevscaler_n == -255)
462 int q,
w, w2,
g, start = 0;
469 float q0f = FLT_MAX, q1f = 0.0f, qnrgf = 0.0f;
470 int q0,
q1, qcnt = 0;
472 for (
i = 0;
i < 1024;
i++) {
502 }
else if (
q1 > q1high) {
515 paths[0][
i].
cost = 0.0f;
516 paths[0][
i].
prev = -1;
521 paths[j][
i].
prev = -2;
525 s->abs_pow34(
s->scoefs, sce->
coeffs, 1024);
529 const float *coefs = &sce->
coeffs[start];
533 bandaddr[idx] =
w * 16 +
g;
537 FFPsyBand *band = &
s->psy.ch[
s->cur_channel].psy_bands[(
w+w2)*16+
g];
545 float t =
fabsf(coefs[w2*128+
i]);
547 qmin =
FFMIN(qmin, t);
548 qmax =
FFMAX(qmax, t);
552 int minscale, maxscale;
561 if (minscale == maxscale) {
566 for (q = minscale; q < maxscale; q++) {
570 FFPsyBand *band = &
s->psy.ch[
s->cur_channel].psy_bands[(
w+w2)*16+
g];
574 minrd =
FFMIN(minrd, dist);
576 for (
i = 0;
i <
q1 -
q0;
i++) {
578 cost = paths[idx - 1][
i].
cost + dist
580 if (cost < paths[idx][q].cost) {
581 paths[idx][q].
cost = cost;
582 paths[idx][q].
prev =
i;
587 for (q = 0; q <
q1 -
q0; q++) {
588 paths[idx][q].
cost = paths[idx - 1][q].
cost + 1;
589 paths[idx][q].
prev = q;
598 mincost = paths[idx][0].
cost;
601 if (paths[idx][
i].cost < mincost) {
602 mincost = paths[idx][
i].
cost;
607 sce->
sf_idx[bandaddr[idx]] = minq +
q0;
608 minq =
FFMAX(paths[idx][minq].prev, 0);
622 int start = 0,
i,
w, w2,
g;
624 float dists[128] = { 0 }, uplims[128] = { 0 };
626 int fflag, minscaler;
633 destbits =
FFMIN(destbits, 5800);
642 FFPsyBand *band = &
s->psy.ch[
s->cur_channel].psy_bands[(
w+w2)*16+
g];
650 uplims[
w*16+
g] = uplim *512;
654 minthr =
FFMIN(minthr, uplim);
671 s->abs_pow34(
s->scoefs, sce->
coeffs, 1024);
677 const float *scaled =
s->scoefs + start;
687 minscaler = sce->
sf_idx[0];
689 qstep = its ? 1 : 32;
696 const float *coefs = sce->
coeffs + start;
697 const float *scaled =
s->scoefs + start;
719 dists[
w*16+
g] = dist -
bits;
728 if (tbits > destbits) {
729 for (
i = 0;
i < 128;
i++)
730 if (sce->
sf_idx[
i] < 218 - qstep)
733 for (
i = 0;
i < 128;
i++)
734 if (sce->
sf_idx[
i] > 60 - qstep)
738 if (!qstep && tbits > destbits*1.02 && sce->
sf_idx[0] < 217)
748 if (dists[
w*16+
g] > uplims[
w*16+
g] && sce->
sf_idx[
w*16+
g] > 60) {
762 }
while (fflag && its < 10);
770 int bandwidth, cutoff;
771 float *PNS = &
s->scoefs[0*128], *PNS34 = &
s->scoefs[1*128];
772 float *NOR34 = &
s->scoefs[3*128];
773 uint8_t nextband[128];
774 const float lambda =
s->lambda;
775 const float freq_mult = avctx->
sample_rate*0.5f/wlen;
778 const float dist_bias =
av_clipf(4.
f * 120 / lambda, 0.25
f, 4.0
f);
779 const float pns_transient_energy_r =
FFMIN(0.7
f, lambda / 140.
f);
786 float rate_bandwidth_multiplier = 1.5f;
787 int prev = -1000, prev_sf = -1;
789 ? (refbits * rate_bandwidth_multiplier * avctx->
sample_rate / 1024)
792 frame_bit_rate *= 1.15f;
795 bandwidth = avctx->
cutoff;
800 cutoff = bandwidth * 2 * wlen / avctx->
sample_rate;
808 float dist1 = 0.0f, dist2 = 0.0f, noise_amp;
809 float pns_energy = 0.0f, pns_tgt_energy, energy_ratio, dist_thresh;
810 float sfb_energy = 0.0f, threshold = 0.0f, spread = 2.0f;
811 float min_energy = -1.0f, max_energy = 0.0f;
813 const float freq = (start-wstart)*freq_mult;
821 band = &
s->psy.ch[
s->cur_channel].psy_bands[(
w+w2)*16+
g];
822 sfb_energy += band->
energy;
826 min_energy = max_energy = band->
energy;
844 ((sce->
zeroes[
w*16+
g] || !sce->
band_alt[
w*16+
g]) && sfb_energy < threshold*
sqrtf(1.0
f/freq_boost)) || spread < spread_threshold ||
845 (!sce->
zeroes[
w*16+
g] && sce->
band_alt[
w*16+
g] && sfb_energy > threshold*thr_mult*freq_boost) ||
846 min_energy < pns_transient_energy_r * max_energy ) {
853 pns_tgt_energy = sfb_energy*
FFMIN(1.0
f, spread*spread);
865 float band_energy,
scale, pns_senergy;
867 band = &
s->psy.ch[
s->cur_channel].psy_bands[(
w+w2)*16+
g];
870 PNS[
i] =
s->random_state;
872 band_energy =
s->fdsp->scalarproduct_float(PNS, PNS, sce->
ics.
swb_sizes[
g]);
875 pns_senergy =
s->fdsp->scalarproduct_float(PNS, PNS, sce->
ics.
swb_sizes[
g]);
876 pns_energy += pns_senergy;
893 energy_ratio = pns_tgt_energy/pns_energy;
894 sce->
pns_ener[
w*16+
g] = energy_ratio*pns_tgt_energy;
895 if (sce->
zeroes[
w*16+
g] || !sce->
band_alt[
w*16+
g] || (energy_ratio > 0.85f && energy_ratio < 1.25f && dist2 < dist1)) {
912 int bandwidth, cutoff;
913 const float lambda =
s->lambda;
914 const float freq_mult = avctx->
sample_rate*0.5f/wlen;
916 const float pns_transient_energy_r =
FFMIN(0.7
f, lambda / 140.
f);
923 float rate_bandwidth_multiplier = 1.5f;
925 ? (refbits * rate_bandwidth_multiplier * avctx->
sample_rate / 1024)
928 frame_bit_rate *= 1.15f;
931 bandwidth = avctx->
cutoff;
936 cutoff = bandwidth * 2 * wlen / avctx->
sample_rate;
941 float sfb_energy = 0.0f, threshold = 0.0f, spread = 2.0f;
942 float min_energy = -1.0f, max_energy = 0.0f;
944 const float freq = start*freq_mult;
946 if (freq < NOISE_LOW_LIMIT || start >= cutoff) {
951 band = &
s->psy.ch[
s->cur_channel].psy_bands[(
w+w2)*16+
g];
952 sfb_energy += band->
energy;
956 min_energy = max_energy = band->
energy;
969 if (sfb_energy < threshold*
sqrtf(1.5
f/freq_boost) || spread < spread_threshold || min_energy < pns_transient_energy_r * max_energy) {
980 int start = 0,
i,
w, w2,
g, sid_sf_boost, prev_mid, prev_side;
981 uint8_t nextband0[128], nextband1[128];
982 float *
M =
s->scoefs + 128*0, *
S =
s->scoefs + 128*1;
983 float *L34 =
s->scoefs + 128*2, *R34 =
s->scoefs + 128*3;
984 float *M34 =
s->scoefs + 128*4, *S34 =
s->scoefs + 128*5;
985 const float lambda =
s->lambda;
986 const float mslambda =
FFMIN(1.0
f, lambda / 120.
f);
996 prev_mid = sce0->
sf_idx[0];
997 prev_side = sce1->
sf_idx[0];
1005 float Mmax = 0.0f, Smax = 0.0f;
1011 + sce1->
coeffs[start+(
w+w2)*128+
i]) * 0.5;
1013 - sce1->
coeffs[start+(
w+w2)*128+
i];
1018 Mmax =
FFMAX(Mmax, M34[
i]);
1019 Smax =
FFMAX(Smax, S34[
i]);
1023 for (sid_sf_boost = 0; sid_sf_boost < 4; sid_sf_boost++) {
1024 float dist1 = 0.0f, dist2 = 0.0f;
1044 midcb =
FFMAX(1,midcb);
1045 sidcb =
FFMAX(1,sidcb);
1048 FFPsyBand *band0 = &
s->psy.ch[
s->cur_channel+0].psy_bands[(
w+w2)*16+
g];
1049 FFPsyBand *band1 = &
s->psy.ch[
s->cur_channel+1].psy_bands[(
w+w2)*16+
g];
1054 + sce1->
coeffs[start+(
w+w2)*128+
i]) * 0.5;
1056 - sce1->
coeffs[start+(
w+w2)*128+
i];
1086 mslambda / (minthr * bmax + FLT_MIN),
INFINITY, &b4,
NULL);
1104 }
else if (
B1 >
B0) {
enum BandType band_alt[128]
alternative band type (used by encoder)
static const uint8_t q1[256]
static av_always_inline int lcg_random(unsigned previous_val)
linear congruential pseudorandom number generator
uint8_t can_pns[128]
band is allowed to PNS (informative)
static av_always_inline float quantize_and_encode_band_cost_template(struct AACEncContext *s, PutBitContext *pb, const float *in, float *out, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, float *energy, int BT_ZERO, int BT_UNSIGNED, int BT_PAIR, int BT_ESC, int BT_NOISE, int BT_STEREO, const float ROUNDING)
Calculate rate distortion cost for quantizing with given codebook.
int sample_rate
samples per second
static double cb(void *priv, double x, double y)
#define CB_TOT_ALL
Total number of codebooks, including special ones.
void ff_aac_update_ltp(AACEncContext *s, SingleChannelElement *sce)
Process LTP parameters.
#define AV_CODEC_FLAG_QSCALE
Use fixed qscale.
static float quantize_and_encode_band_cost_NONE(struct AACEncContext *s, PutBitContext *pb, const float *in, float *quant, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, float *energy)
static void put_sbits(PutBitContext *pb, int n, int32_t value)
uint8_t zeroes[128]
band is not coded (used by encoder)
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
static av_always_inline float bval2bmax(float b)
approximates exp10f(-3.0f*(0.5f + 0.5f * cosf(FFMIN(b,15.5f) / 15.5f)))
const AACCoefficientsEncoder ff_aac_coders[AAC_CODER_NB]
static const uint8_t aac_cb_maxval[12]
static int ff_sfdelta_can_remove_band(const SingleChannelElement *sce, const uint8_t *nextband, int prev_sf, int band)
static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
int nb_channels
Number of channels in this layout.
static __device__ float ceilf(float a)
static av_always_inline av_const float roundf(float x)
static uint8_t coef2maxsf(float coef)
Return the maximum scalefactor where the quantized coef is not zero.
#define SCALE_MAX_POS
scalefactor index maximum value
static float win(SuperEqualizerContext *s, float n, int N)
int num_swb
number of scalefactor window bands
static double b1(void *priv, double x, double y)
AVChannelLayout ch_layout
Audio channel layout.
#define SCALE_DIV_512
scalefactor difference that corresponds to scale difference in 512 times
static int ff_sfdelta_can_replace(const SingleChannelElement *sce, const uint8_t *nextband, int prev_sf, int new_sf, int band)
int flags
AV_CODEC_FLAG_*.
#define POW_SF2_ZERO
ff_aac_pow2sf_tab index corresponding to pow(2, 0);
static void quantize_and_encode_band(struct AACEncContext *s, PutBitContext *pb, const float *in, float *out, int size, int scale_idx, int cb, const float lambda, int rtz)
static const quantize_and_encode_band_func quantize_and_encode_band_cost_arr[]
static av_always_inline float scale(float x, float s)
static __device__ float fabsf(float a)
IndividualChannelStream ics
static const uint8_t quant[64]
#define QUANTIZE_AND_ENCODE_BAND_COST_FUNC(NAME, BT_ZERO, BT_UNSIGNED, BT_PAIR, BT_ESC, BT_NOISE, BT_STEREO, ROUNDING)
static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce)
@ NOISE_BT
Spectral data are scaled white noise not coded in the bitstream.
static double b3(void *priv, double x, double y)
INTFLOAT coeffs[1024]
coefficients for IMDCT, maybe processed
void ff_aac_apply_main_pred(AACEncContext *s, SingleChannelElement *sce)
float ff_quantize_and_encode_band_cost(struct AACEncContext *s, PutBitContext *pb, const float *in, float *quant, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, float *energy)
const uint8_t * swb_sizes
table of scalefactor band sizes for a particular window
@ INTENSITY_BT2
Scalefactor data are intensity stereo positions (out of phase).
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s, SingleChannelElement *sce, const float lambda)
void ff_aac_encode_ltp_info(AACEncContext *s, SingleChannelElement *sce, int common_window)
Encode LTP data.
static void mark_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelElement *sce)
static const float bands[]
#define SCALE_DIFF_ZERO
codebook index corresponding to zero scalefactor indices difference
const uint16_t * swb_offset
table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular wind...
static const uint8_t q0[256]
static float quantize_band_cost_cached(struct AACEncContext *s, int w, int g, 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)
@ INTENSITY_BT
Scalefactor data are intensity stereo positions (in phase).
uint8_t is_mask[128]
Set if intensity stereo is used (used by encoder)
float is_ener[128]
Intensity stereo pos (used by encoder)
static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, int win, int group_len, const float lambda)
void ff_aac_apply_tns(AACEncContext *s, SingleChannelElement *sce)
int64_t bit_rate
the average bitrate
static const uint8_t aac_cb_range[12]
single band psychoacoustic information
void ff_aac_encode_tns_info(AACEncContext *s, SingleChannelElement *sce)
Encode TNS data.
static __device__ float sqrtf(float a)
static void ff_init_nextband_map(const SingleChannelElement *sce, uint8_t *nextband)
static const uint8_t *const run_value_bits[2]
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int sf_idx[128]
scalefactor indices (used by encoder)
void ff_aac_ltp_insert_new_frame(AACEncContext *s)
const uint8_t ff_aac_scalefactor_bits[121]
static uint8_t coef2minsf(float coef)
Return the minimum scalefactor where the quantized coef does not clip.
static const uint8_t aac_cb_out_map[CB_TOT_ALL]
Map to convert values from BandCodingPath index to a codebook index.
SingleChannelElement ch[2]
void ff_aac_adjust_common_pred(AACEncContext *s, ChannelElement *cpe)
#define NOISE_SPREAD_THRESHOLD
static const uint8_t run_bits[7][16]
const uint16_t *const ff_aac_spectral_codes[11]
static double b2(void *priv, double x, double y)
int common_window
Set if channels share a common 'IndividualChannelStream' in bitstream.
void ff_aac_adjust_common_ltp(AACEncContext *s, ChannelElement *cpe)
static void search_for_quantizers_twoloop(AVCodecContext *avctx, AACEncContext *s, SingleChannelElement *sce, const float lambda)
two-loop quantizers search taken from ISO 13818-7 Appendix C
static const quantize_and_encode_band_func quantize_and_encode_band_cost_rtz_arr[]
uint8_t ms_mask[128]
Set if mid/side stereo is used for each scalefactor window band.
#define SCALE_MAX_DIFF
maximum scalefactor difference allowed by standard
float pns_ener[128]
Noise energy values (used by encoder)
#define AAC_CUTOFF_FROM_BITRATE(bit_rate, channels, sample_rate)
float(* quantize_and_encode_band_func)(struct AACEncContext *s, PutBitContext *pb, const float *in, float *quant, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, float *energy)
static void search_for_quantizers_anmr(AVCodecContext *avctx, AACEncContext *s, SingleChannelElement *sce, const float lambda)
Single Channel Element - used for both SCE and LFE elements.
#define i(width, name, range_min, range_max)
#define SCALE_ONE_POS
scalefactor index that corresponds to scale=1.0
static int find_min_book(float maxval, int sf)
static const uint8_t aac_cb_in_map[CB_TOT_ALL+1]
Inverse map to convert from codebooks to BandCodingPath indices.
void ff_aac_search_for_tns(AACEncContext *s, SingleChannelElement *sce)
channel element - generic struct for SCE/CPE/CCE/LFE
int cutoff
Audio cutoff bandwidth (0 means "automatic")
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
static av_always_inline float cbrtf(float x)
static void set_special_band_scalefactors(AACEncContext *s, SingleChannelElement *sce)
const float *const ff_aac_codebook_vectors[]
#define NOISE_LOW_LIMIT
This file contains a template for the twoloop coder function.
void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElement *cpe)
structure used in optimal codebook search
const uint8_t *const ff_aac_spectral_bits[11]
@ RESERVED_BT
Band types following are encoded differently from others.
main external API structure.
float ff_aac_pow2sf_tab[428]
void ff_aac_encode_main_pred(AACEncContext *s, SingleChannelElement *sce)
Encoder predictors data.
float ff_aac_pow34sf_tab[428]
static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce, int win, int group_len, const float lambda)
Encode band info for single window group bands.
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)
static float find_max_val(int group_len, int swb_size, const float *scaled)
int prev_idx
pointer to the previous path point
void ff_aac_search_for_pred(AACEncContext *s, SingleChannelElement *sce)
uint8_t max_sfb
number of scalefactor bands per group
void ff_aac_search_for_ltp(AACEncContext *s, SingleChannelElement *sce, int common_window)
Mark LTP sfb's.
enum BandType band_type[128]
band types
void ff_quantize_band_cost_cache_init(struct AACEncContext *s)
#define NOISE_LAMBDA_REPLACE