Browse code

AAC encoder: fix initialization of minsf

In some situations (exactly zeroed DC coeffs) minsf would
be initialized with garbage

Claudio Freire authored on 2016/04/04 03:03:53
Showing 1 changed files
... ...
@@ -302,10 +302,11 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
302 302
             const float *scaled = s->scoefs + start;
303 303
             int minsfidx;
304 304
             maxvals[w*16+g] = find_max_val(sce->ics.group_len[w], sce->ics.swb_sizes[g], scaled);
305
-            if (maxvals[w*16+g] > 0)
305
+            if (maxvals[w*16+g] > 0) {
306 306
                 minsfidx = coef2minsf(maxvals[w*16+g]);
307
-            for (w2 = 0; w2 < sce->ics.group_len[w]; w2++)
308
-                minsf[(w+w2)*16+g] = minsfidx;
307
+                for (w2 = 0; w2 < sce->ics.group_len[w]; w2++)
308
+                    minsf[(w+w2)*16+g] = minsfidx;
309
+            }
309 310
             start += sce->ics.swb_sizes[g];
310 311
         }
311 312
     }