From a5762c9b595b5d5b8f09ffaf2e29ad3ffee2a395 Mon Sep 17 00:00:00 2001
From: Alex Converse <alex.converse@gmail.com>
Date: Thu, 16 Jul 2009 22:20:17 +0000
Subject: [PATCH] When calculating AAC quantized band cost, don't leave garbage
 in the bit count for the 0 codebook.

Originally committed as revision 19444 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavcodec/aaccoder.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index f4ae130b7ea..252b3592a37 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -124,6 +124,8 @@ static float quantize_band_cost(struct AACEncContext *s, const float *in,
     if (!cb) {
         for (i = 0; i < size; i++)
             cost += in[i]*in[i]*lambda;
+        if (bits)
+            *bits = 0;
         return cost;
     }
 #ifndef USE_REALLY_FULL_SEARCH
-- 
GitLab