comparison aaccoder.c @ 11763:3fee94a43e64 libavcodec

Remove useless costly inf checks from the trellis scalefactor search.
author alexc
date Tue, 25 May 2010 18:32:59 +0000
parents 91b9bd17e79c
children e9c024d542f4
comparison
equal deleted inserted replaced
11762:91b9bd17e79c 11763:3fee94a43e64
577 } 577 }
578 minrd = FFMIN(minrd, dist); 578 minrd = FFMIN(minrd, dist);
579 579
580 for (i = 0; i < q1 - q0; i++) { 580 for (i = 0; i < q1 - q0; i++) {
581 float cost; 581 float cost;
582 if (isinf(paths[idx - 1][i].cost))
583 continue;
584 cost = paths[idx - 1][i].cost + dist 582 cost = paths[idx - 1][i].cost + dist
585 + ff_aac_scalefactor_bits[q - i + SCALE_DIFF_ZERO]; 583 + ff_aac_scalefactor_bits[q - i + SCALE_DIFF_ZERO];
586 if (cost < paths[idx][q].cost) { 584 if (cost < paths[idx][q].cost) {
587 paths[idx][q].cost = cost; 585 paths[idx][q].cost = cost;
588 paths[idx][q].prev = i; 586 paths[idx][q].prev = i;
589 } 587 }
590 } 588 }
591 } 589 }
592 } else { 590 } else {
593 for (q = 0; q < q1 - q0; q++) { 591 for (q = 0; q < q1 - q0; q++) {
594 if (!isinf(paths[idx - 1][q].cost)) {
595 paths[idx][q].cost = paths[idx - 1][q].cost + 1; 592 paths[idx][q].cost = paths[idx - 1][q].cost + 1;
596 paths[idx][q].prev = q; 593 paths[idx][q].prev = q;
597 continue;
598 }
599 for (i = 0; i < q1 - q0; i++) {
600 float cost;
601 if (isinf(paths[idx - 1][i].cost))
602 continue;
603 cost = paths[idx - 1][i].cost + ff_aac_scalefactor_bits[q - i + SCALE_DIFF_ZERO];
604 if (cost < paths[idx][q].cost) {
605 paths[idx][q].cost = cost;
606 paths[idx][q].prev = i;
607 }
608 }
609 } 594 }
610 } 595 }
611 sce->zeroes[w*16+g] = !nz; 596 sce->zeroes[w*16+g] = !nz;
612 start += sce->ics.swb_sizes[g]; 597 start += sce->ics.swb_sizes[g];
613 idx++; 598 idx++;