aboutsummaryrefslogtreecommitdiffstats
path: root/libAACenc
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2013-08-08 17:43:20 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2013-08-20 15:03:32 -0700
commit60a27b7fe5bf2c3b07ae7f679ca67c0c5cba3b00 (patch)
tree12a04cd1fdb1b8113eee2836e449fec09d01879e /libAACenc
parented247dfa54234c1115c35a05327955b29b161e8a (diff)
downloadfdk-aac-60a27b7fe5bf2c3b07ae7f679ca67c0c5cba3b00.tar.gz
fdk-aac-60a27b7fe5bf2c3b07ae7f679ca67c0c5cba3b00.tar.bz2
fdk-aac-60a27b7fe5bf2c3b07ae7f679ca67c0c5cba3b00.zip
Encoder intensity fix
AAC encoder: Prevent illegal intensity values delta coding at short blocks. Bug 9428126 Change-Id: Ic287b86f3229022740f2317ea74aabe612de5e6b
Diffstat (limited to 'libAACenc')
-rw-r--r--libAACenc/src/aacenc_lib.cpp2
-rw-r--r--libAACenc/src/intensity.cpp27
-rw-r--r--libAACenc/src/line_pe.cpp2
3 files changed, 20 insertions, 11 deletions
diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp
index e229ed6..dd6767f 100644
--- a/libAACenc/src/aacenc_lib.cpp
+++ b/libAACenc/src/aacenc_lib.cpp
@@ -98,7 +98,7 @@ amm-info@iis.fraunhofer.de
/* Encoder library info */
#define AACENCODER_LIB_VL0 3
#define AACENCODER_LIB_VL1 4
-#define AACENCODER_LIB_VL2 2
+#define AACENCODER_LIB_VL2 3
#define AACENCODER_LIB_TITLE "AAC Encoder"
#define AACENCODER_LIB_BUILD_DATE __DATE__
#define AACENCODER_LIB_BUILD_TIME __TIME__
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);
diff --git a/libAACenc/src/line_pe.cpp b/libAACenc/src/line_pe.cpp
index e4dc957..f3c0dab 100644
--- a/libAACenc/src/line_pe.cpp
+++ b/libAACenc/src/line_pe.cpp
@@ -184,7 +184,7 @@ void FDKaacEnc_calcSfbPe(PE_CHANNEL_DATA *RESTRICT peChanData,
}
peChanData->sfbNActiveLines[sfbGrp+sfb] = nLines;
}
- else if( isBook[sfb] ) {
+ else if( isBook[sfbGrp+sfb] ) {
/* provide for cost of scale factor for Intensity */
INT delta = isScale[sfbGrp+sfb] - lastValIs;
lastValIs = isScale[sfbGrp+sfb];