Commit 60a27b7f authored by Jean-Michel Trivi's avatar Jean-Michel Trivi

Encoder intensity fix

AAC encoder: Prevent illegal intensity values delta coding at short blocks.

Bug 9428126

Change-Id: Ic287b86f3229022740f2317ea74aabe612de5e6b
parent ed247dfa
...@@ -98,7 +98,7 @@ amm-info@iis.fraunhofer.de ...@@ -98,7 +98,7 @@ amm-info@iis.fraunhofer.de
/* Encoder library info */ /* Encoder library info */
#define AACENCODER_LIB_VL0 3 #define AACENCODER_LIB_VL0 3
#define AACENCODER_LIB_VL1 4 #define AACENCODER_LIB_VL1 4
#define AACENCODER_LIB_VL2 2 #define AACENCODER_LIB_VL2 3
#define AACENCODER_LIB_TITLE "AAC Encoder" #define AACENCODER_LIB_TITLE "AAC Encoder"
#define AACENCODER_LIB_BUILD_DATE __DATE__ #define AACENCODER_LIB_BUILD_DATE __DATE__
#define AACENCODER_LIB_BUILD_TIME __TIME__ #define AACENCODER_LIB_BUILD_TIME __TIME__
......
...@@ -450,23 +450,24 @@ FDKaacEnc_finalizeIntensityDecision(const FIXP_DBL *hrrErr, ...@@ -450,23 +450,24 @@ FDKaacEnc_finalizeIntensityDecision(const FIXP_DBL *hrrErr,
const INT maxSfbPerGroup) const INT maxSfbPerGroup)
{ {
INT sfb,sfboffs, j; INT sfb,sfboffs, j;
INT startIsSfb = 0;
INT inIsBlock;
INT currentIsSfbCount;
FIXP_DBL overallHrrError;
FIXP_DBL isScaleLast = FL2FXCONST_DBL(0.0f); FIXP_DBL isScaleLast = FL2FXCONST_DBL(0.0f);
FIXP_DBL isRegionLoudness; INT isStartValueFound = 0;
for (sfboffs = 0; sfboffs < sfbCnt; sfboffs += sfbPerGroup) { for (sfboffs = 0; sfboffs < sfbCnt; sfboffs += sfbPerGroup) {
inIsBlock = 0; INT startIsSfb = 0;
currentIsSfbCount = 0; INT inIsBlock = 0;
overallHrrError = FL2FXCONST_DBL(0.0f); INT currentIsSfbCount = 0;
isRegionLoudness = FL2FXCONST_DBL(0.0f); FIXP_DBL overallHrrError = FL2FXCONST_DBL(0.0f);
FIXP_DBL isRegionLoudness = FL2FXCONST_DBL(0.0f);
for (sfb = 0; sfb < maxSfbPerGroup; sfb++) { for (sfb = 0; sfb < maxSfbPerGroup; sfb++) {
if (isMask[sfboffs + sfb] == 1) { if (isMask[sfboffs + sfb] == 1) {
if (currentIsSfbCount == 0) { if (currentIsSfbCount == 0) {
startIsSfb = sfboffs + sfb; startIsSfb = sfboffs + sfb;
}
if (isStartValueFound==0) {
isScaleLast = realIsScale[sfboffs + sfb]; isScaleLast = realIsScale[sfboffs + sfb];
isStartValueFound = 1;
} }
inIsBlock = 1; inIsBlock = 1;
currentIsSfbCount++; currentIsSfbCount++;
...@@ -510,6 +511,14 @@ FDKaacEnc_finalizeIntensityDecision(const FIXP_DBL *hrrErr, ...@@ -510,6 +511,14 @@ FDKaacEnc_finalizeIntensityDecision(const FIXP_DBL *hrrErr,
for(j = startIsSfb; j <= sfboffs + sfb; j++) { for(j = startIsSfb; j <= sfboffs + sfb; j++) {
isMask[j] = 0; 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; currentIsSfbCount = 0;
overallHrrError = FL2FXCONST_DBL(0.0f); overallHrrError = FL2FXCONST_DBL(0.0f);
......
...@@ -184,7 +184,7 @@ void FDKaacEnc_calcSfbPe(PE_CHANNEL_DATA *RESTRICT peChanData, ...@@ -184,7 +184,7 @@ void FDKaacEnc_calcSfbPe(PE_CHANNEL_DATA *RESTRICT peChanData,
} }
peChanData->sfbNActiveLines[sfbGrp+sfb] = nLines; peChanData->sfbNActiveLines[sfbGrp+sfb] = nLines;
} }
else if( isBook[sfb] ) { else if( isBook[sfbGrp+sfb] ) {
/* provide for cost of scale factor for Intensity */ /* provide for cost of scale factor for Intensity */
INT delta = isScale[sfbGrp+sfb] - lastValIs; INT delta = isScale[sfbGrp+sfb] - lastValIs;
lastValIs = isScale[sfbGrp+sfb]; lastValIs = isScale[sfbGrp+sfb];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment