History

aacenc: Fix codebook trellising for zeroed bands.

Choose band type (codebook) zero, count its bits, and mark the other states as unnavigable.

Alex Converse committed 15 years ago

Commit 8dbaa5b1 parent 13a09971 file · +20 −4Browse files

Showing the changes to libavcodec/aaccoder.c (1 of 1 file). Show all

Unified · Split

libavcodec/aaccoder.c+20−4
@@ -432,10 +432,26 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, · 431 unmodified lines
432432 for (swb = 0; swb < max_sfb; swb++) {
433433 size = sce->ics.swb_sizes[swb];
434434 if (sce->zeroes[win*16 + swb]) {
435− for (cb = 0; cb < 12; cb++) {
436− path[swb+1][cb].prev_idx = cb;
437− path[swb+1][cb].cost = path[swb][cb].cost;
438− path[swb+1][cb].run = path[swb][cb].run + 1;
435+ float cost_stay_here = path[swb][0].cost;
436+ float cost_get_here = next_minrd + run_bits + 4;
437+ if ( run_value_bits[sce->ics.num_windows == 8][path[swb][0].run]
438+ != run_value_bits[sce->ics.num_windows == 8][path[swb][0].run+1])
439+ cost_stay_here += run_bits;
440+ if (cost_get_here < cost_stay_here) {
441+ path[swb+1][0].prev_idx = next_mincb;
442+ path[swb+1][0].cost = cost_get_here;
443+ path[swb+1][0].run = 1;
444+ } else {
445+ path[swb+1][0].prev_idx = 0;
446+ path[swb+1][0].cost = cost_stay_here;
447+ path[swb+1][0].run = path[swb][0].run + 1;
448+ }
449+ next_minrd = path[swb+1][0].cost;
450+ next_mincb = 0;
451+ for (cb = 1; cb < 12; cb++) {
452+ path[swb+1][cb].cost = 61450;
453+ path[swb+1][cb].prev_idx = -1;
454+ path[swb+1][cb].run = 0;
439455 }
440456 } else {
441457 float minrd = next_minrd;

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