Commit 207bf44d authored by Nathan Caldwell's avatar Nathan Caldwell Committed by Alex Converse

aacenc: cosmetics, replace 'rd' with 'bits' in codebook_trellis_rate to make...

aacenc: cosmetics, replace 'rd' with 'bits' in codebook_trellis_rate to make it more clear what is being calculated.
Signed-off-by: 's avatarAlex Converse <alex.converse@gmail.com>
parent 843cd4a3
...@@ -420,7 +420,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, ...@@ -420,7 +420,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
const int run_esc = (1 << run_bits) - 1; const int run_esc = (1 << run_bits) - 1;
int idx, ppos, count; int idx, ppos, count;
int stackrun[120], stackcb[120], stack_len; int stackrun[120], stackcb[120], stack_len;
float next_minrd = INFINITY; float next_minbits = INFINITY;
int next_mincb = 0; int next_mincb = 0;
abs_pow34_v(s->scoefs, sce->coeffs, 1024); abs_pow34_v(s->scoefs, sce->coeffs, 1024);
...@@ -434,7 +434,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, ...@@ -434,7 +434,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
size = sce->ics.swb_sizes[swb]; size = sce->ics.swb_sizes[swb];
if (sce->zeroes[win*16 + swb]) { if (sce->zeroes[win*16 + swb]) {
float cost_stay_here = path[swb][0].cost; float cost_stay_here = path[swb][0].cost;
float cost_get_here = next_minrd + run_bits + 4; float cost_get_here = next_minbits + run_bits + 4;
if ( run_value_bits[sce->ics.num_windows == 8][path[swb][0].run] if ( run_value_bits[sce->ics.num_windows == 8][path[swb][0].run]
!= run_value_bits[sce->ics.num_windows == 8][path[swb][0].run+1]) != run_value_bits[sce->ics.num_windows == 8][path[swb][0].run+1])
cost_stay_here += run_bits; cost_stay_here += run_bits;
...@@ -447,7 +447,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, ...@@ -447,7 +447,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
path[swb+1][0].cost = cost_stay_here; path[swb+1][0].cost = cost_stay_here;
path[swb+1][0].run = path[swb][0].run + 1; path[swb+1][0].run = path[swb][0].run + 1;
} }
next_minrd = path[swb+1][0].cost; next_minbits = path[swb+1][0].cost;
next_mincb = 0; next_mincb = 0;
for (cb = 1; cb < 12; cb++) { for (cb = 1; cb < 12; cb++) {
path[swb+1][cb].cost = 61450; path[swb+1][cb].cost = 61450;
...@@ -455,10 +455,10 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, ...@@ -455,10 +455,10 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
path[swb+1][cb].run = 0; path[swb+1][cb].run = 0;
} }
} else { } else {
float minrd = next_minrd; float minbits = next_minbits;
int mincb = next_mincb; int mincb = next_mincb;
int startcb = sce->band_type[win*16+swb]; int startcb = sce->band_type[win*16+swb];
next_minrd = INFINITY; next_minbits = INFINITY;
next_mincb = 0; next_mincb = 0;
for (cb = 0; cb < startcb; cb++) { for (cb = 0; cb < startcb; cb++) {
path[swb+1][cb].cost = 61450; path[swb+1][cb].cost = 61450;
...@@ -467,15 +467,15 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, ...@@ -467,15 +467,15 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
} }
for (cb = startcb; cb < 12; cb++) { for (cb = startcb; cb < 12; cb++) {
float cost_stay_here, cost_get_here; float cost_stay_here, cost_get_here;
float rd = 0.0f; float bits = 0.0f;
for (w = 0; w < group_len; w++) { for (w = 0; w < group_len; w++) {
rd += quantize_band_cost(s, sce->coeffs + start + w*128, bits += quantize_band_cost(s, sce->coeffs + start + w*128,
s->scoefs + start + w*128, size, s->scoefs + start + w*128, size,
sce->sf_idx[(win+w)*16+swb], cb, sce->sf_idx[(win+w)*16+swb], cb,
0, INFINITY, NULL); 0, INFINITY, NULL);
} }
cost_stay_here = path[swb][cb].cost + rd; cost_stay_here = path[swb][cb].cost + bits;
cost_get_here = minrd + rd + run_bits + 4; cost_get_here = minbits + bits + run_bits + 4;
if ( run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run] if ( run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run]
!= run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run+1]) != run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run+1])
cost_stay_here += run_bits; cost_stay_here += run_bits;
...@@ -488,8 +488,8 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, ...@@ -488,8 +488,8 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
path[swb+1][cb].cost = cost_stay_here; path[swb+1][cb].cost = cost_stay_here;
path[swb+1][cb].run = path[swb][cb].run + 1; path[swb+1][cb].run = path[swb][cb].run + 1;
} }
if (path[swb+1][cb].cost < next_minrd) { if (path[swb+1][cb].cost < next_minbits) {
next_minrd = path[swb+1][cb].cost; next_minbits = path[swb+1][cb].cost;
next_mincb = cb; next_mincb = cb;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment