]> git.sesse.net Git - ffmpeg/commitdiff
AAC encoder: Fix rate control on twoloop.
authorClaudio Freire <klaussfreire@gmail.com>
Sat, 4 May 2013 21:36:37 +0000 (18:36 -0300)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 5 May 2013 02:19:34 +0000 (04:19 +0200)
Fixes a case where multichannel bitrate isn't accurately
targetted by psy model alone, never achieving the target bitrate.
Now fixed.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/aaccoder.c

index 994de286c96ce63ac37170fc9647553a4b71c123..45fbc2dedf9d4cceeda2736453262b21cb176d8a 100644 (file)
@@ -710,7 +710,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;