aacenc: Fix target bitrate for twoloop quantiser search
authorClaudio Freire <klaussfreire@gmail.com>
Sat, 4 May 2013 21:36:37 +0000 (18:36 -0300)
committerMartin Storsjö <martin@martin.st>
Tue, 14 May 2013 09:42:04 +0000 (12:42 +0300)
This fixes a case where multichannel bitrate isn't accurately
targetted by psy model alone, never achieving the target bitrate.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/aaccoder.c

index d65d8d9..35b98a9 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;