[FFmpeg-cvslog] AAC encoder: avoid assertion failure on PNS

Claudio Freire git at videolan.org
Wed Jan 13 16:26:54 CET 2016


ffmpeg | branch: master | Claudio Freire <klaussfreire at gmail.com> | Fri Jan  8 04:39:02 2016 -0300| [00d481b2c37552634490443b3af6dc04e6b42239] | committer: Claudio Freire

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.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=00d481b2c37552634490443b3af6dc04e6b42239
---

 libavcodec/aaccoder.c |    5 ++++-
 tests/fate/aac.mak    |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 6fcc6a0..2c125fd 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;
diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak
index ae7ebfa..873629d 100644
--- a/tests/fate/aac.mak
+++ b/tests/fate/aac.mak
@@ -173,7 +173,7 @@ fate-aac-pns-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-re
 fate-aac-pns-encode: CMP = stddev
 fate-aac-pns-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
 fate-aac-pns-encode: CMP_SHIFT = -4096
-fate-aac-pns-encode: CMP_TARGET = 616
+fate-aac-pns-encode: CMP_TARGET = 662
 fate-aac-pns-encode: SIZE_TOLERANCE = 3560
 fate-aac-pns-encode: FUZZ = 72
 



More information about the ffmpeg-cvslog mailing list