Go to the documentation of this file.
37 #ifndef AVCODEC_AACCODER_TRELLIS_H
38 #define AVCODEC_AACCODER_TRELLIS_H
60 int win,
int group_len,
const float lambda)
67 const int run_esc = (1 <<
run_bits) - 1;
69 int stackrun[120], stackcb[120], stack_len;
73 s->abs_pow34(
s->scoefs, sce->
coeffs, 1024);
80 for (swb = 0; swb < max_sfb; swb++) {
83 float cost_stay_here = path[swb][0].
cost;
84 float cost_get_here = next_minbits +
run_bits + 4;
88 if (cost_get_here < cost_stay_here) {
89 path[swb+1][0].
prev_idx = next_mincb;
90 path[swb+1][0].
cost = cost_get_here;
91 path[swb+1][0].
run = 1;
94 path[swb+1][0].
cost = cost_stay_here;
95 path[swb+1][0].
run = path[swb][0].
run + 1;
97 next_minbits = path[swb+1][0].
cost;
100 path[swb+1][
cb].
cost = 61450;
102 path[swb+1][
cb].
run = 0;
105 float minbits = next_minbits;
106 int mincb = next_mincb;
111 for (
cb = 0;
cb < startcb;
cb++) {
112 path[swb+1][
cb].
cost = 61450;
114 path[swb+1][
cb].
run = 0;
117 float cost_stay_here, cost_get_here;
120 path[swb+1][
cb].
cost = 61450;
122 path[swb+1][
cb].
run = 0;
125 for (
w = 0;
w < group_len;
w++) {
127 &
s->scoefs[start +
w*128],
size,
137 if (cost_get_here < cost_stay_here) {
139 path[swb+1][
cb].
cost = cost_get_here;
140 path[swb+1][
cb].
run = 1;
143 path[swb+1][
cb].
cost = cost_stay_here;
146 if (path[swb+1][
cb].cost < next_minbits) {
147 next_minbits = path[swb+1][
cb].
cost;
159 if (path[max_sfb][
cb].cost < path[max_sfb][idx].cost)
165 stackrun[stack_len] = path[ppos][
cb].
run;
166 stackcb [stack_len] =
cb;
168 ppos -= path[ppos][
cb].
run;
173 for (
i = stack_len - 1;
i >= 0;
i--) {
179 for (j = 0; j < count; j++) {
183 while (count >= run_esc) {
static double cb(void *priv, double x, double y)
#define CB_TOT_ALL
Total number of codebooks, including special ones.
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 float win(SuperEqualizerContext *s, float n, int N)
static int quantize_band_cost_bits(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)
IndividualChannelStream ics
INTFLOAT coeffs[1024]
coefficients for IMDCT, maybe processed
const uint8_t * swb_sizes
table of scalefactor band sizes for a particular window
static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, int win, int group_len, const float lambda)
static const uint8_t *const run_value_bits[2]
int sf_idx[128]
scalefactor indices (used by encoder)
static const uint8_t aac_cb_out_map[CB_TOT_ALL]
Map to convert values from BandCodingPath index to a codebook index.
This file contains a template for the codebook_trellis_rate selector function.
static const uint8_t run_bits[7][16]
Single Channel Element - used for both SCE and LFE elements.
#define i(width, name, range_min, range_max)
static const uint8_t aac_cb_in_map[CB_TOT_ALL+1]
Inverse map to convert from codebooks to BandCodingPath indices.
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
int prev_idx
pointer to the previous path point
uint8_t max_sfb
number of scalefactor bands per group
enum BandType band_type[128]
band types