From 60a27b7fe5bf2c3b07ae7f679ca67c0c5cba3b00 Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Thu, 8 Aug 2013 17:43:20 -0700 Subject: Encoder intensity fix AAC encoder: Prevent illegal intensity values delta coding at short blocks. Bug 9428126 Change-Id: Ic287b86f3229022740f2317ea74aabe612de5e6b --- libAACenc/src/intensity.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'libAACenc/src/intensity.cpp') diff --git a/libAACenc/src/intensity.cpp b/libAACenc/src/intensity.cpp index 28e6eed..6d807f7 100644 --- a/libAACenc/src/intensity.cpp +++ b/libAACenc/src/intensity.cpp @@ -450,23 +450,24 @@ FDKaacEnc_finalizeIntensityDecision(const FIXP_DBL *hrrErr, const INT maxSfbPerGroup) { INT sfb,sfboffs, j; - INT startIsSfb = 0; - INT inIsBlock; - INT currentIsSfbCount; - FIXP_DBL overallHrrError; FIXP_DBL isScaleLast = FL2FXCONST_DBL(0.0f); - FIXP_DBL isRegionLoudness; + INT isStartValueFound = 0; for (sfboffs = 0; sfboffs < sfbCnt; sfboffs += sfbPerGroup) { - inIsBlock = 0; - currentIsSfbCount = 0; - overallHrrError = FL2FXCONST_DBL(0.0f); - isRegionLoudness = FL2FXCONST_DBL(0.0f); + INT startIsSfb = 0; + INT inIsBlock = 0; + INT currentIsSfbCount = 0; + FIXP_DBL overallHrrError = FL2FXCONST_DBL(0.0f); + FIXP_DBL isRegionLoudness = FL2FXCONST_DBL(0.0f); + for (sfb = 0; sfb < maxSfbPerGroup; sfb++) { if (isMask[sfboffs + sfb] == 1) { if (currentIsSfbCount == 0) { startIsSfb = sfboffs + sfb; + } + if (isStartValueFound==0) { isScaleLast = realIsScale[sfboffs + sfb]; + isStartValueFound = 1; } inIsBlock = 1; currentIsSfbCount++; @@ -510,6 +511,14 @@ FDKaacEnc_finalizeIntensityDecision(const FIXP_DBL *hrrErr, for(j = startIsSfb; j <= sfboffs + sfb; j++) { isMask[j] = 0; } + isScaleLast = FL2FXCONST_DBL(0.0f); + isStartValueFound = 0; + for (j=0; j < startIsSfb; j++) { + if (isMask[j]!=0) { + isScaleLast = realIsScale[j]; + isStartValueFound = 1; + } + } } currentIsSfbCount = 0; overallHrrError = FL2FXCONST_DBL(0.0f); -- cgit v1.2.3