History

aacenc: cosmetics, replace 'rd' with 'bits' in codebook_trellis_rate to make it more clear what is being calculated.

Nathan Caldwell committed 14 years ago

Commit 207bf441 parent 843cd4a1 file · +14 −14Browse files

Unified · Split

libavcodec/aaccoder.c+14−14
@@ -420,7 +420,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, · 419 unmodified lines
420420 const int run_esc = (1 << run_bits) - 1;
421421 int idx, ppos, count;
422422 int stackrun[120], stackcb[120], stack_len;
423− float next_minrd = INFINITY;
423+ float next_minbits = INFINITY;
424424 int next_mincb = 0;
425425
426426 abs_pow34_v(s->scoefs, sce->coeffs, 1024);
@@ -434,7 +434,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, · 7 unmodified lines
434434 size = sce->ics.swb_sizes[swb];
435435 if (sce->zeroes[win*16 + swb]) {
436436 float cost_stay_here = path[swb][0].cost;
437− float cost_get_here = next_minrd + run_bits + 4;
437+ float cost_get_here = next_minbits + run_bits + 4;
438438 if ( run_value_bits[sce->ics.num_windows == 8][path[swb][0].run]
439439 != run_value_bits[sce->ics.num_windows == 8][path[swb][0].run+1])
440440 cost_stay_here += run_bits;
@@ -447,7 +447,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, · 6 unmodified lines
447447 path[swb+1][0].cost = cost_stay_here;
448448 path[swb+1][0].run = path[swb][0].run + 1;
449449 }
450− next_minrd = path[swb+1][0].cost;
450+ next_minbits = path[swb+1][0].cost;
451451 next_mincb = 0;
452452 for (cb = 1; cb < 12; cb++) {
453453 path[swb+1][cb].cost = 61450;
@@ -455,10 +455,10 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, · 1 unmodified line
455455 path[swb+1][cb].run = 0;
456456 }
457457 } else {
458− float minrd = next_minrd;
458+ float minbits = next_minbits;
459459 int mincb = next_mincb;
460460 int startcb = sce->band_type[win*16+swb];
461− next_minrd = INFINITY;
461+ next_minbits = INFINITY;
462462 next_mincb = 0;
463463 for (cb = 0; cb < startcb; cb++) {
464464 path[swb+1][cb].cost = 61450;
@@ -467,15 +467,15 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, · 2 unmodified lines
467467 }
468468 for (cb = startcb; cb < 12; cb++) {
469469 float cost_stay_here, cost_get_here;
470− float rd = 0.0f;
470+ float bits = 0.0f;
471471 for (w = 0; w < group_len; w++) {
472− rd += quantize_band_cost(s, sce->coeffs + start + w*128,
473− s->scoefs + start + w*128, size,
474− sce->sf_idx[(win+w)*16+swb], cb,
475− 0, INFINITY, NULL);
472+ bits += quantize_band_cost(s, sce->coeffs + start + w*128,
473+ s->scoefs + start + w*128, size,
474+ sce->sf_idx[(win+w)*16+swb], cb,
475+ 0, INFINITY, NULL);
476476 }
477− cost_stay_here = path[swb][cb].cost + rd;
478− cost_get_here = minrd + rd + run_bits + 4;
477+ cost_stay_here = path[swb][cb].cost + bits;
478+ cost_get_here = minbits + bits + run_bits + 4;
479479 if ( run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run]
480480 != run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run+1])
481481 cost_stay_here += run_bits;
@@ -488,8 +488,8 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, · 6 unmodified lines
488488 path[swb+1][cb].cost = cost_stay_here;
489489 path[swb+1][cb].run = path[swb][cb].run + 1;
490490 }
491− if (path[swb+1][cb].cost < next_minrd) {
492− next_minrd = path[swb+1][cb].cost;
491+ if (path[swb+1][cb].cost < next_minbits) {
492+ next_minbits = path[swb+1][cb].cost;
493493 next_mincb = cb;
494494 }
495495 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t