AAC encoder: Fix rate control on twoloop.
authorClaudio Freire <klaussfreire@gmail.com>
Sat, 4 May 2013 21:36:37 +0000 (18:36 -0300)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Sun, 2 Jun 2013 14:30:15 +0000 (16:30 +0200)
Fixes a case where multichannel bitrate isn't accurately
targetted by psy model alone, never achieving the target bitrate.
Now fixed.

Fixes ticket #2625.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
libavcodec/aaccoder.c

index b48da99..fe3fcce 100644 (file)
@@ -713,7 +713,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
                                           const float lambda)
 {
     int start = 0, i, w, w2, g;
-    int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels;
+    int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f);
     float dists[128] = { 0 }, uplims[128];
     float maxvals[128];
     int fflag, minscaler;