Originally committed as revision 19379 to svn://svn.ffmpeg.org/ffmpeg/trunk
Showing the changes to libavcodec/aaccoder.c (1 of 2 files). Show all
Unified · Split
| @@ -457,15 +457,6 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce · 456 unmodified lines | ||
| 457 | 457 | } |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | −static void encode_window_bands_info_fixed(AACEncContext *s, | |
| 461 | − SingleChannelElement *sce, | |
| 462 | − int win, int group_len, | |
| 463 | − const float lambda) | |
| 464 | −{ | |
| 465 | − encode_window_bands_info(s, sce, win, group_len, 1.0f); | |
| 466 | −} | |
| 467 | − | |
| 468 | − | |
| 469 | 460 | typedef struct TrellisPath { |
| 470 | 461 | float cost; |
| 471 | 462 | int prev; |
| @@ -700,7 +691,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 228 unmodified lines | ||
| 700 | 691 | sce->ics.swb_sizes[g], |
| 701 | 692 | sce->sf_idx[w*16+g], |
| 702 | 693 | ESC_BT, |
| 703 | − 1.0, | |
| 694 | + lambda, | |
| 704 | 695 | INFINITY, |
| 705 | 696 | &b); |
| 706 | 697 | bb += b; |
| @@ -710,7 +701,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, · 3 unmodified lines | ||
| 710 | 701 | minbits = bb; |
| 711 | 702 | } |
| 712 | 703 | } |
| 713 | − dists[w*16+g] = mindist - minbits; | |
| 704 | + dists[w*16+g] = (mindist - minbits) / lambda; | |
| 714 | 705 | bits = minbits; |
| 715 | 706 | if (prev != -1) { |
| 716 | 707 | bits += ff_aac_scalefactor_bits[sce->sf_idx[w*16+g] - prev + SCALE_DIFF_ZERO]; |
| @@ -870,12 +861,12 @@ static void search_for_quantizers_faac(AVCodecContext *avctx, AACEncContext *s, · 153 unmodified lines | ||
| 870 | 861 | sce->ics.swb_sizes[g], |
| 871 | 862 | scf, |
| 872 | 863 | ESC_BT, |
| 873 | − 1.0, | |
| 864 | + lambda, | |
| 874 | 865 | INFINITY, |
| 875 | 866 | &b); |
| 876 | 867 | dist -= b; |
| 877 | 868 | } |
| 878 | − dist *= 1.0f/512.0f; | |
| 869 | + dist *= 1.0f / 512.0f / lambda; | |
| 879 | 870 | quant_max = quant(maxq[w*16+g], ff_aac_pow2sf_tab[200 - scf + SCALE_ONE_POS - SCALE_DIV_512]); |
| 880 | 871 | if (quant_max >= 8191) { // too much, return to the previous quantizer |
| 881 | 872 | sce->sf_idx[w*16+g] = prev_scf; |
| @@ -1019,7 +1010,7 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe, · 137 unmodified lines | ||
| 1019 | 1010 | AACCoefficientsEncoder ff_aac_coders[] = { |
| 1020 | 1011 | { |
| 1021 | 1012 | search_for_quantizers_faac, |
| 1022 | − encode_window_bands_info_fixed, | |
| 1013 | + encode_window_bands_info, | |
| 1023 | 1014 | quantize_and_encode_band, |
| 1024 | 1015 | // search_for_ms, |
| 1025 | 1016 | }, |