Fix uninitialized access of minsf in short windows
Fix potential invocation of coef2minsf(0)
... | ... |
@@ -300,8 +300,12 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, |
300 | 300 |
start = w*128; |
301 | 301 |
for (g = 0; g < sce->ics.num_swb; g++) { |
302 | 302 |
const float *scaled = s->scoefs + start; |
303 |
+ int minsfidx; |
|
303 | 304 |
maxvals[w*16+g] = find_max_val(sce->ics.group_len[w], sce->ics.swb_sizes[g], scaled); |
304 |
- minsf[w*16+g] = coef2minsf(maxvals[w*16+g]); |
|
305 |
+ if (maxvals[w*16+g] > 0) |
|
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; |
|
305 | 309 |
start += sce->ics.swb_sizes[g]; |
306 | 310 |
} |
307 | 311 |
} |