Signed-off-by: Alex Converse <alex.converse@gmail.com>
| ... | ... |
@@ -420,7 +420,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, |
| 420 | 420 |
const int run_esc = (1 << run_bits) - 1; |
| 421 | 421 |
int idx, ppos, count; |
| 422 | 422 |
int stackrun[120], stackcb[120], stack_len; |
| 423 |
- float next_minrd = INFINITY; |
|
| 423 |
+ float next_minbits = INFINITY; |
|
| 424 | 424 |
int next_mincb = 0; |
| 425 | 425 |
|
| 426 | 426 |
abs_pow34_v(s->scoefs, sce->coeffs, 1024); |
| ... | ... |
@@ -434,7 +434,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, |
| 434 | 434 |
size = sce->ics.swb_sizes[swb]; |
| 435 | 435 |
if (sce->zeroes[win*16 + swb]) {
|
| 436 | 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 | 438 |
if ( run_value_bits[sce->ics.num_windows == 8][path[swb][0].run] |
| 439 | 439 |
!= run_value_bits[sce->ics.num_windows == 8][path[swb][0].run+1]) |
| 440 | 440 |
cost_stay_here += run_bits; |
| ... | ... |
@@ -447,7 +447,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, |
| 447 | 447 |
path[swb+1][0].cost = cost_stay_here; |
| 448 | 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 | 451 |
next_mincb = 0; |
| 452 | 452 |
for (cb = 1; cb < 12; cb++) {
|
| 453 | 453 |
path[swb+1][cb].cost = 61450; |
| ... | ... |
@@ -455,10 +455,10 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, |
| 455 | 455 |
path[swb+1][cb].run = 0; |
| 456 | 456 |
} |
| 457 | 457 |
} else {
|
| 458 |
- float minrd = next_minrd; |
|
| 458 |
+ float minbits = next_minbits; |
|
| 459 | 459 |
int mincb = next_mincb; |
| 460 | 460 |
int startcb = sce->band_type[win*16+swb]; |
| 461 |
- next_minrd = INFINITY; |
|
| 461 |
+ next_minbits = INFINITY; |
|
| 462 | 462 |
next_mincb = 0; |
| 463 | 463 |
for (cb = 0; cb < startcb; cb++) {
|
| 464 | 464 |
path[swb+1][cb].cost = 61450; |
| ... | ... |
@@ -467,15 +467,15 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, |
| 467 | 467 |
} |
| 468 | 468 |
for (cb = startcb; cb < 12; cb++) {
|
| 469 | 469 |
float cost_stay_here, cost_get_here; |
| 470 |
- float rd = 0.0f; |
|
| 470 |
+ float bits = 0.0f; |
|
| 471 | 471 |
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); |
|
| 476 | 476 |
} |
| 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; |
|
| 479 | 479 |
if ( run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run] |
| 480 | 480 |
!= run_value_bits[sce->ics.num_windows == 8][path[swb][cb].run+1]) |
| 481 | 481 |
cost_stay_here += run_bits; |
| ... | ... |
@@ -488,8 +488,8 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce, |
| 488 | 488 |
path[swb+1][cb].cost = cost_stay_here; |
| 489 | 489 |
path[swb+1][cb].run = path[swb][cb].run + 1; |
| 490 | 490 |
} |
| 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; |
|
| 493 | 493 |
next_mincb = cb; |
| 494 | 494 |
} |
| 495 | 495 |
} |