diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2012-10-02 10:16:04 -0700 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2012-10-02 10:46:47 -0700 |
commit | 6ab36997af5d5acda4f21d33031f4e45c85f96b7 (patch) | |
tree | 4696e6feca7d1243bb9e90da7699b00d8f026441 /libSBRdec/src | |
parent | ed8b5a747e97c9b8b029ba6485e33f3aad081652 (diff) | |
download | fdk-aac-6ab36997af5d5acda4f21d33031f4e45c85f96b7.tar.gz fdk-aac-6ab36997af5d5acda4f21d33031f4e45c85f96b7.tar.bz2 fdk-aac-6ab36997af5d5acda4f21d33031f4e45c85f96b7.zip |
Bug 7170947 Update AAC codec
From Fraunhofer:
* AAC Decoder
- Stick to the written MPEG standard instead of the MPEG reference software
in terms of reference level normalization. Always set the program reference
level equal to the target level. This disables level normalization using a
default level for streams without embedded metadata.
Modified file(s):
libAACdec\src\aacdec_drc.cpp
- Fix downmix channel assignment when using a WAV output channel ordering.
Modified file(s):
libPCMutils\src\pcmutils_lib.cpp
- Retain signal accuracy and prevent LSB alteration when no level correction
needs to be done.
Modified file(s):
libAACdec\src\aacdec_drc.h
libAACdec\src\aacdec_drc.cpp
libSBRdec\src\sbrdecoder.cpp
libSBRdec\src\sbr_dec.cpp
libSBRdec\src\sbrdec_drc.cpp
- Align metadata processing with reference implementation.
Modified file(s):
libAACdec\src\aacdec_drc.h
libAACdec\src\aacdecoder.cpp
* AAC-Encoder
- Prevent potential overflow in energy calculation after TNS processing.
Modified file(s):
libAACenc\src\band_nrg.cpp
- Added saturation for number of relevant lines which are used in pe
calculation.
Modified file(s):
libAACenc\src\line_pe.cpp
- Removed obsolete files.
Deleded file(s):
libAACenc\src\tns_param.h
libAACenc\src\tns_param.cpp
* FDK-Library
- Added x86 Count Leading Zeros intrinsic.
Modified file(s):
libFDK\include\clz.h
Added file(s):
libFDK\include\x86\clz_x86.h
- Fixed compilation for MIPS GCC-4.4 and higher.
Modified file(s):
libFDK\include\mips\cplx_mul.h
libFDK\include\mips\fixmul_mips.h
Change-Id: I4be65f07f88d412224c7fddc3f054e8f451176cc
Diffstat (limited to 'libSBRdec/src')
-rw-r--r-- | libSBRdec/src/sbr_dec.cpp | 18 | ||||
-rw-r--r-- | libSBRdec/src/sbrdec_drc.cpp | 37 | ||||
-rw-r--r-- | libSBRdec/src/sbrdec_drc.h | 1 | ||||
-rw-r--r-- | libSBRdec/src/sbrdecoder.cpp | 19 |
4 files changed, 53 insertions, 22 deletions
diff --git a/libSBRdec/src/sbr_dec.cpp b/libSBRdec/src/sbr_dec.cpp index 5a8b320..bd3cd10 100644 --- a/libSBRdec/src/sbr_dec.cpp +++ b/libSBRdec/src/sbr_dec.cpp @@ -585,14 +585,16 @@ sbr_dec ( HANDLE_SBR_DEC hSbrDec, /*!< handle to Decoder channel */ int maxShift = 0; - if (hSbrDec->sbrDrcChannel.prevFact_exp > maxShift) { - maxShift = hSbrDec->sbrDrcChannel.prevFact_exp; - } - if (hSbrDec->sbrDrcChannel.currFact_exp > maxShift) { - maxShift = hSbrDec->sbrDrcChannel.currFact_exp; - } - if (hSbrDec->sbrDrcChannel.nextFact_exp > maxShift) { - maxShift = hSbrDec->sbrDrcChannel.nextFact_exp; + if (hSbrDec->sbrDrcChannel.enable != 0) { + if (hSbrDec->sbrDrcChannel.prevFact_exp > maxShift) { + maxShift = hSbrDec->sbrDrcChannel.prevFact_exp; + } + if (hSbrDec->sbrDrcChannel.currFact_exp > maxShift) { + maxShift = hSbrDec->sbrDrcChannel.currFact_exp; + } + if (hSbrDec->sbrDrcChannel.nextFact_exp > maxShift) { + maxShift = hSbrDec->sbrDrcChannel.nextFact_exp; + } } /* copy DRC data to right channel (with PS both channels use the same DRC gains) */ diff --git a/libSBRdec/src/sbrdec_drc.cpp b/libSBRdec/src/sbrdec_drc.cpp index ce5247a..7497b66 100644 --- a/libSBRdec/src/sbrdec_drc.cpp +++ b/libSBRdec/src/sbrdec_drc.cpp @@ -115,17 +115,17 @@ void sbrDecoder_drcInitChannel ( } for (band = 0; band < (64); band++) { - hDrcData->prevFact_mag[band] = (FIXP_DBL)MAXVAL_DBL /*FL2FXCONST_DBL(1.0f)*/; + hDrcData->prevFact_mag[band] = FL2FXCONST_DBL(0.5f); } for (band = 0; band < SBRDEC_MAX_DRC_BANDS; band++) { - hDrcData->currFact_mag[band] = (FIXP_DBL)MAXVAL_DBL /*FL2FXCONST_DBL(1.0f)*/; - hDrcData->nextFact_mag[band] = (FIXP_DBL)MAXVAL_DBL /*FL2FXCONST_DBL(1.0f)*/; + hDrcData->currFact_mag[band] = FL2FXCONST_DBL(0.5f); + hDrcData->nextFact_mag[band] = FL2FXCONST_DBL(0.5f); } - hDrcData->prevFact_exp = 0; - hDrcData->currFact_exp = 0; - hDrcData->nextFact_exp = 0; + hDrcData->prevFact_exp = 1; + hDrcData->currFact_exp = 1; + hDrcData->nextFact_exp = 1; hDrcData->numBandsCurr = 0; hDrcData->numBandsNext = 0; @@ -238,7 +238,7 @@ void sbrDecoder_drcApplySlot ( } else { if (j >= offset[hDrcData->drcInterpolationSchemeCurr - 1]) { - alphaValue = FL2FXCONST_DBL(1.0f); + alphaValue = (FIXP_DBL)MAXVAL_DBL; } } } @@ -262,7 +262,7 @@ void sbrDecoder_drcApplySlot ( } else { if (j >= offset[hDrcData->drcInterpolationSchemeNext - 1]) { - alphaValue = FL2FXCONST_DBL(1.0f); + alphaValue = (FIXP_DBL)MAXVAL_DBL; } } @@ -301,7 +301,7 @@ void sbrDecoder_drcApplySlot ( } else { if (j >= offset[hDrcData->drcInterpolationSchemeNext - 1]) { - alphaValue = FL2FXCONST_DBL(1.0f); + alphaValue = (FIXP_DBL)MAXVAL_DBL; } } } @@ -322,7 +322,7 @@ void sbrDecoder_drcApplySlot ( for (band = 0; band < (int)numBands; band++) { int bottomQmf, topQmf; - FIXP_DBL drcFact_mag = FL2FXCONST_DBL(1.0f); + FIXP_DBL drcFact_mag = (FIXP_DBL)MAXVAL_DBL; topMdct = (bandTop[band]+1) << 2; @@ -361,7 +361,13 @@ void sbrDecoder_drcApplySlot ( } /* interpolate */ - drcFact_mag = fMult(alphaValue, drcFact2_mag) + fMult((FL2FXCONST_DBL(1.0f) - alphaValue), drcFact1_mag); + if (alphaValue == (FIXP_DBL)0) { + drcFact_mag = drcFact1_mag; + } else if (alphaValue == (FIXP_DBL)MAXVAL_DBL) { + drcFact_mag = drcFact2_mag; + } else { + drcFact_mag = fMult(alphaValue, drcFact2_mag) + fMult(((FIXP_DBL)MAXVAL_DBL - alphaValue), drcFact1_mag); + } /* apply scaling */ qmfRealSlot[bin] = fMult(qmfRealSlot[bin], drcFact_mag); @@ -481,6 +487,15 @@ void sbrDecoder_drcApply ( int col; int maxShift = 0; + if (hDrcData == NULL) { + return; + } + if ( (hDrcData->enable == 0) + || ((hDrcData->numBandsCurr == 0) && (hDrcData->numBandsNext == 0)) + ) { + return; /* Avoid changing the scaleFactor even though the processing is disabled. */ + } + /* get max scale factor */ if (hDrcData->prevFact_exp > maxShift) { maxShift = hDrcData->prevFact_exp; diff --git a/libSBRdec/src/sbrdec_drc.h b/libSBRdec/src/sbrdec_drc.h index 2577e89..14deff7 100644 --- a/libSBRdec/src/sbrdec_drc.h +++ b/libSBRdec/src/sbrdec_drc.h @@ -94,6 +94,7 @@ amm-info@iis.fraunhofer.de #include "sbrdecoder.h" + #define SBRDEC_MAX_DRC_CHANNELS (6) #define SBRDEC_MAX_DRC_BANDS ( 16 ) diff --git a/libSBRdec/src/sbrdecoder.cpp b/libSBRdec/src/sbrdecoder.cpp index a40e5ba..192bdd2 100644 --- a/libSBRdec/src/sbrdecoder.cpp +++ b/libSBRdec/src/sbrdecoder.cpp @@ -137,7 +137,7 @@ amm-info@iis.fraunhofer.de /* Decoder library info */ #define SBRDECODER_LIB_VL0 2 #define SBRDECODER_LIB_VL1 1 -#define SBRDECODER_LIB_VL2 2 +#define SBRDECODER_LIB_VL2 3 #define SBRDECODER_LIB_TITLE "SBR Decoder" #define SBRDECODER_LIB_BUILD_DATE __DATE__ #define SBRDECODER_LIB_BUILD_TIME __TIME__ @@ -533,7 +533,7 @@ SBR_ERROR sbrDecoder_InitElement ( FDKmemclear(self->pSbrElement[elementIndex]->frameErrorFlag, ((1)+1)*sizeof(UCHAR)); /* Initialize this instance */ - sbrError = sbrDecoder_ResetElement( + sbrError = sbrDecoder_ResetElement( self, sampleRateIn, sampleRateOut, @@ -577,7 +577,7 @@ SBR_ERROR sbrDecoder_HeaderUpdate( ) { SBR_ERROR errorStatus = SBRDEC_OK; - + /* change of control data, reset decoder */ @@ -818,6 +818,7 @@ SBR_ERROR sbrDecoder_drcFeedChannel ( HANDLE_SBRDECODER self, USHORT *pBandTop ) { SBRDEC_DRC_CHANNEL *pSbrDrcChannelData = NULL; + int band, isValidData = 0; if (self == NULL) { return SBRDEC_NOT_INITIALIZED; @@ -826,10 +827,21 @@ SBR_ERROR sbrDecoder_drcFeedChannel ( HANDLE_SBRDECODER self, return SBRDEC_SET_PARAM_FAIL; } + /* Search for gain values different to 1.0f */ + for (band = 0; band < numBands; band += 1) { + if ( !((pNextFact_mag[band] == FL2FXCONST_DBL(0.5)) && (nextFact_exp == 1)) + && !((pNextFact_mag[band] == (FIXP_DBL)MAXVAL_DBL) && (nextFact_exp == 0)) ) { + isValidData = 1; + break; + } + } + /* Find the right SBR channel */ pSbrDrcChannelData = sbrDecoder_drcGetChannel( self, ch ); if ( pSbrDrcChannelData != NULL ) { + if ( pSbrDrcChannelData->enable || isValidData ) + { /* Activate processing only with real and valid data */ int i; pSbrDrcChannelData->enable = 1; @@ -844,6 +856,7 @@ SBR_ERROR sbrDecoder_drcFeedChannel ( HANDLE_SBRDECODER self, pSbrDrcChannelData->nextFact_mag[i] = pNextFact_mag[i]; } } + } return SBRDEC_OK; } |