[FFmpeg-cvslog] aacenc_is: take absolute coefficient value upon energy calculations

Rostislav Pehlivanov git at videolan.org
Sun Sep 6 19:40:38 CEST 2015


ffmpeg | branch: master | Rostislav Pehlivanov <atomnuker at gmail.com> | Sun Sep  6 18:36:42 2015 +0100| [1956cfbaedd364b30095e956fc881f7eaa1e21ff] | committer: Rostislav Pehlivanov

aacenc_is: take absolute coefficient value upon energy calculations

This was an oversight when the IS system was being first implemented.
The ener01 part was largely a result of trial and error and the fact
that the sum of coef0 and coef1 could result in a zero was
overlooked. Once ener01 turns to zero it's used to divide the left
channel energy which doesn't turn out so well as it fills IS[]
with -nan's and inf's which in turn confused the quantize_band_cost.

Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>

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

 libavcodec/aacenc_is.c |    4 ++--
 tests/fate/aac.mak     |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/aacenc_is.c b/libavcodec/aacenc_is.c
index 95ba3f8..e983b75 100644
--- a/libavcodec/aacenc_is.c
+++ b/libavcodec/aacenc_is.c
@@ -114,8 +114,8 @@ void ff_aac_search_for_is(AACEncContext *s, AVCodecContext *avctx, ChannelElemen
                 }
                 for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {
                     for (i = 0; i < sce0->ics.swb_sizes[g]; i++) {
-                        float coef0 = sce0->pcoeffs[start+(w+w2)*128+i];
-                        float coef1 = sce1->pcoeffs[start+(w+w2)*128+i];
+                        float coef0 = fabsf(sce0->pcoeffs[start+(w+w2)*128+i]);
+                        float coef1 = fabsf(sce1->pcoeffs[start+(w+w2)*128+i]);
                         ener0  += coef0*coef0;
                         ener1  += coef1*coef1;
                         ener01 += (coef0 + coef1)*(coef0 + coef1);
diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak
index de415c4..910bac0 100644
--- a/tests/fate/aac.mak
+++ b/tests/fate/aac.mak
@@ -181,7 +181,7 @@ fate-aac-is-encode: CMD = enc_dec_pcm adts wav s16le $(TARGET_SAMPLES)/audio-ref
 fate-aac-is-encode: CMP = stddev
 fate-aac-is-encode: REF = $(SAMPLES)/audio-reference/luckynight_2ch_44kHz_s16.wav
 fate-aac-is-encode: CMP_SHIFT = -4096
-fate-aac-is-encode: CMP_TARGET = 619.67
+fate-aac-is-encode: CMP_TARGET = 616.75
 fate-aac-is-encode: SIZE_TOLERANCE = 3560
 fate-aac-is-encode: FUZZ = 35
 



More information about the ffmpeg-cvslog mailing list