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
420 const int run_esc = (1 << run_bits) - 1;420 const int run_esc = (1 << run_bits) - 1;
421 int idx, ppos, count;421 int idx, ppos, count;
422 int stackrun[120], stackcb[120], stack_len;422 int stackrun[120], stackcb[120], stack_len;
423 float next_minrd = INFINITY;423 float next_minbits = INFINITY;
424 int next_mincb = 0;424 int next_mincb = 0;
425 425
426 abs_pow34_v(s->scoefs, sce->coeffs, 1024);426 abs_pow34_v(s->scoefs, sce->coeffs, 1024);
@@ -434,7 +434,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, · 7 unmodified lines
434 size = sce->ics.swb_sizes[swb];434 size = sce->ics.swb_sizes[swb];
435 if (sce->zeroes[win*16 + swb]) {435 if (sce->zeroes[win*16 + swb]) {
436 float cost_stay_here = path[swb][0].cost;436 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;
438 if ( run_value_bits[sce->ics.num_windows == 8][path[swb][0].run]438 if ( run_value_bits[sce->ics.num_windows == 8][path[swb][0].run]
439 != run_value_bits[sce->ics.num_windows == 8][path[swb][0].run+1])439 != run_value_bits[sce->ics.num_windows == 8][path[swb][0].run+1])
440 cost_stay_here += run_bits;440 cost_stay_here += run_bits;
@@ -447,7 +447,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, · 6 unmodified lines
447 path[swb+1][0].cost = cost_stay_here;447 path[swb+1][0].cost = cost_stay_here;
448 path[swb+1][0].run = path[swb][0].run + 1;448 path[swb+1][0].run = path[swb][0].run + 1;
449 }449 }
450 next_minrd = path[swb+1][0].cost;450 next_minbits = path[swb+1][0].cost;
451 next_mincb = 0;451 next_mincb = 0;
452 for (cb = 1; cb < 12; cb++) {452 for (cb = 1; cb < 12; cb++) {
453 path[swb+1][cb].cost = 61450;453 path[swb+1][cb].cost = 61450;
@@ -455,10 +455,10 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, · 1 unmodified line
455 path[swb+1][cb].run = 0;455 path[swb+1][cb].run = 0;
456 }456 }
457 } else {457 } else {
458 float minrd = next_minrd;458 float minbits = next_minbits;
459 int mincb = next_mincb;459 int mincb = next_mincb;
460 int startcb = sce->band_type[win*16+swb];460 int startcb = sce->band_type[win*16+swb];
461 next_minrd = INFINITY;461 next_minbits = INFINITY;
462 next_mincb = 0;462 next_mincb = 0;
463 for (cb = 0; cb < startcb; cb++) {463 for (cb = 0; cb < startcb; cb++) {
464 path[swb+1][cb].cost = 61450;464 path[swb+1][cb].cost = 61450;
@@ -467,15 +467,15 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, · 2 unmodified lines
467 }467 }
468 for (cb = startcb; cb < 12; cb++) {468 for (cb = startcb; cb < 12; cb++) {
469 float cost_stay_here, cost_get_here;469 float cost_stay_here, cost_get_here;
470 float rd = 0.0f;470 float bits = 0.0f;
471 for (w = 0; w < group_len; w++) {471 for (w = 0; w < group_len; w++) {
472 rd += quantize_band_cost(s, sce->coeffs + start + w*128,472 bits += quantize_band_cost(s, sce->coeffs + start + w*128,
473 s->scoefs + start + w*128, size,473 s->scoefs + start + w*128, size,
474 sce->sf_idx[(win+w)*16+swb], cb,474 sce->sf_idx[(win+w)*16+swb], cb,
475 0, INFINITY, NULL);475 0, INFINITY, NULL);
476 }476 }
477 cost_stay_here = path[swb][cb].cost + rd;477 cost_stay_here = path[swb][cb].cost + bits;
478 cost_get_here = minrd + rd + run_bits + 4;478 cost_get_here = minbits + bits + run_bits + 4;
479 if ( run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run]479 if ( run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run]
480 != run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run+1])480 != run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run+1])
481 cost_stay_here += run_bits;481 cost_stay_here += run_bits;
@@ -488,8 +488,8 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, · 6 unmodified lines
488 path[swb+1][cb].cost = cost_stay_here;488 path[swb+1][cb].cost = cost_stay_here;
489 path[swb+1][cb].run = path[swb][cb].run + 1;489 path[swb+1][cb].run = path[swb][cb].run + 1;
490 }490 }
491 if (path[swb+1][cb].cost < next_minrd) {491 if (path[swb+1][cb].cost < next_minbits) {
492 next_minrd = path[swb+1][cb].cost;492 next_minbits = path[swb+1][cb].cost;
493 next_mincb = cb;493 next_mincb = cb;
494 }494 }
495 }495 }

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