summaryrefslogtreecommitdiff
path: root/libavcodec/aaccoder.c
diff options
context:
space:
mode:
authorClaudio Freire <klaussfreire@gmail.com>2016-01-08 04:39:02 -0300
committerClaudio Freire <klaussfreire@gmail.com>2016-01-13 05:28:34 -0300
commit00d481b2c37552634490443b3af6dc04e6b42239 (patch)
treee0868fa6434bae58c62fc48dbe3d20ec49a81310 /libavcodec/aaccoder.c
parent2a31b076b444d0c096efd4ab0eb4e19cf0ffd2ac (diff)
downloadffmpeg-00d481b2c37552634490443b3af6dc04e6b42239.tar.gz
AAC encoder: avoid assertion failure on PNS
In rare corner cases it could still fail an assert on sf_diff due to failure to update prev_sf in some code paths. Fix that case.
Diffstat (limited to 'libavcodec/aaccoder.c')
-rw-r--r--libavcodec/aaccoder.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 6fcc6a0eab..2c125fd080 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -643,8 +643,11 @@ static void search_for_pns(AACEncContext *s, AVCodecContext *avctx, SingleChanne
const int start = wstart+sce->ics.swb_offset[g];
const float freq = (start-wstart)*freq_mult;
const float freq_boost = FFMAX(0.88f*freq/NOISE_LOW_LIMIT, 1.0f);
- if (freq < NOISE_LOW_LIMIT || (start-wstart) >= cutoff)
+ if (freq < NOISE_LOW_LIMIT || (start-wstart) >= cutoff) {
+ if (!sce->zeroes[w*16+g])
+ prev_sf = sce->sf_idx[w*16+g];
continue;
+ }
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
band = &s->psy.ch[s->cur_channel].psy_bands[(w+w2)*16+g];
sfb_energy += band->energy;