diff options
author | Dave Burke <daveburke@google.com> | 2012-05-12 13:17:25 -0700 |
---|---|---|
committer | Dave Burke <daveburke@google.com> | 2012-05-12 13:47:46 -0700 |
commit | 698b536f3b34a7cfc41a80e1034cc359456bdd66 (patch) | |
tree | fa3dfa75d535b188725f1b84316cb4b06db79771 /libSBRdec | |
parent | 9bf37cc9712506b2483650c82d3c41152337ef7e (diff) | |
download | fdk-aac-dabplus-698b536f3b34a7cfc41a80e1034cc359456bdd66.tar.gz fdk-aac-dabplus-698b536f3b34a7cfc41a80e1034cc359456bdd66.tar.bz2 fdk-aac-dabplus-698b536f3b34a7cfc41a80e1034cc359456bdd66.zip |
Update to 2012_05_11 version.
Fixes:
- Don't throw error for invalid bitrate but limit to functional value
- More robust ASC parsing
- More robust handling of corrupt bitstreams
- Handle multiple raw access units
Change-Id: Ib49fe2545ff4185fe924126da702fe84ac5c2d87
Diffstat (limited to 'libSBRdec')
-rw-r--r-- | libSBRdec/src/env_extr.cpp | 6 | ||||
-rw-r--r-- | libSBRdec/src/sbr_dec.cpp | 7 | ||||
-rw-r--r-- | libSBRdec/src/sbr_ram.cpp | 2 | ||||
-rw-r--r-- | libSBRdec/src/sbrdecoder.cpp | 31 |
4 files changed, 37 insertions, 9 deletions
diff --git a/libSBRdec/src/env_extr.cpp b/libSBRdec/src/env_extr.cpp index 040b812..1e02975 100644 --- a/libSBRdec/src/env_extr.cpp +++ b/libSBRdec/src/env_extr.cpp @@ -25,7 +25,7 @@ *******************************************************************************/ /*! \file - \brief Envelope extraction $Revision: 36841 $ + \brief Envelope extraction $Revision: 38006 $ The functions provided by this module are mostly called by applySBR(). After it is determined that there is valid SBR data, sbrGetHeaderData() might be called if the current SBR data contains an \ref SBR_HEADER_ELEMENT as opposed to a \ref SBR_STANDARD_ELEMENT. This function @@ -167,6 +167,10 @@ initHeaderData ( /* One SBR timeslot corresponds to the amount of samples equal to the amount of analysis bands, divided by the timestep. */ hHeaderData->numberTimeSlots = (samplesPerFrame/numAnalysisBands) >> (hHeaderData->timeStep - 1); + if (hHeaderData->numberTimeSlots > (16)) { + sbrError = SBRDEC_UNSUPPORTED_CONFIG; + } + hHeaderData->numberOfAnalysisBands = numAnalysisBands; bail: diff --git a/libSBRdec/src/sbr_dec.cpp b/libSBRdec/src/sbr_dec.cpp index a075ca3..6be3c00 100644 --- a/libSBRdec/src/sbr_dec.cpp +++ b/libSBRdec/src/sbr_dec.cpp @@ -25,7 +25,7 @@ *******************************************************************************/ /*! \file - \brief Sbr decoder $Revision: 36841 $ + \brief Sbr decoder $Revision: 37646 $ This module provides the actual decoder implementation. The SBR data (side information) is already decoded. Only three functions are provided: @@ -537,6 +537,9 @@ sbr_dec ( HANDLE_SBR_DEC hSbrDec, /*!< handle to Decoder channel */ maxShift = hSbrDec->sbrDrcChannel.nextFact_exp; } + /* copy DRC data to right channel (with PS both channels use the same DRC gains) */ + FDKmemcpy(&hSbrDecRight->sbrDrcChannel, &hSbrDec->sbrDrcChannel, sizeof(SBRDEC_DRC_CHANNEL)); + for (i = 0; i < synQmf->no_col; i++) { /* ----- no_col loop ----- */ INT outScalefactorR, outScalefactorL; @@ -565,7 +568,7 @@ sbr_dec ( HANDLE_SBR_DEC hSbrDec, /*!< handle to Decoder channel */ sbrDecoder_drcApplySlot ( /* right channel */ - &hSbrDec->sbrDrcChannel, + &hSbrDecRight->sbrDrcChannel, rQmfReal, rQmfImag, i, diff --git a/libSBRdec/src/sbr_ram.cpp b/libSBRdec/src/sbr_ram.cpp index 6fa34a5..883a261 100644 --- a/libSBRdec/src/sbr_ram.cpp +++ b/libSBRdec/src/sbr_ram.cpp @@ -26,7 +26,7 @@ /*! \file \brief Memory layout - $Revision: 36841 $ + $Revision: 38012 $ This module declares all static and dynamic memory spaces */ diff --git a/libSBRdec/src/sbrdecoder.cpp b/libSBRdec/src/sbrdecoder.cpp index dc824cb..2e5e304 100644 --- a/libSBRdec/src/sbrdecoder.cpp +++ b/libSBRdec/src/sbrdecoder.cpp @@ -25,7 +25,7 @@ *******************************************************************************/ /*! \file - \brief SBR decoder frontend $Revision: 36841 $ + \brief SBR decoder frontend $Revision: 38029 $ This module provides a frontend to the SBR decoder. The function openSBR() is called for initialization. The function sbrDecoder_Apply() is called for each frame. sbr_Apply() will call the required functions to decode the raw SBR data (provided by env_extr.cpp), to decode the envelope data and noise floor levels [decodeSbrData()], @@ -79,7 +79,7 @@ /* Decoder library info */ #define SBRDECODER_LIB_VL0 2 #define SBRDECODER_LIB_VL1 1 -#define SBRDECODER_LIB_VL2 0 +#define SBRDECODER_LIB_VL2 1 #define SBRDECODER_LIB_TITLE "SBR Decoder" #define SBRDECODER_LIB_BUILD_DATE __DATE__ #define SBRDECODER_LIB_BUILD_TIME __TIME__ @@ -367,6 +367,7 @@ SBR_ERROR sbrDecoder_InitElement ( { SBR_ERROR sbrError = SBRDEC_OK; int chCnt=0; + int nSbrElementsStart = self->numSbrElements; /* Check core codec AOT */ if (! sbrDecoder_isCoreCodecValid(coreCodec) || elementIndex >= (4)) { @@ -488,8 +489,13 @@ SBR_ERROR sbrDecoder_InitElement ( bail: if (sbrError != SBRDEC_OK) { - /* Free the memory allocated for this element */ - sbrDecoder_DestroyElement( self, elementIndex ); + if (nSbrElementsStart < self->numSbrElements) { + /* Free the memory allocated for this element */ + sbrDecoder_DestroyElement( self, elementIndex ); + } else if (self->pSbrElement[elementIndex] != NULL) { + /* Set error flag to trigger concealment */ + self->pSbrElement[elementIndex]->frameErrorFlag[self->pSbrElement[elementIndex]->useFrameSlot] = 1;; + } } return sbrError; @@ -933,7 +939,8 @@ SBR_ERROR sbrDecoder_Parse( 1); } - if (headerStatus == HEADER_RESET) { + if (headerStatus == HEADER_RESET) + { errorStatus = sbrDecoder_HeaderUpdate( self, hSbrHeader, @@ -1130,6 +1137,10 @@ sbrDecoder_DecodeElement ( self->flags ); + if (errorStatus != SBRDEC_OK) { + return errorStatus; + } + hSbrHeader->syncState = UPSAMPLING; errorStatus = sbrDecoder_HeaderUpdate( @@ -1139,6 +1150,11 @@ sbrDecoder_DecodeElement ( pSbrChannel, hSbrElement->nChannels ); + + if (errorStatus != SBRDEC_OK) { + hSbrHeader->syncState = SBR_NOT_INITIALIZED; + return errorStatus; + } } /* reset */ @@ -1296,6 +1312,11 @@ SBR_ERROR sbrDecoder_Apply ( HANDLE_SBRDECODER self, psPossible = *psDecoded; + if (self->numSbrElements < 1) { + /* exit immediately to avoid access violations */ + return SBRDEC_CREATE_ERROR; + } + /* Sanity check of allocated SBR elements. */ for (sbrElementNum=0; sbrElementNum<self->numSbrElements; sbrElementNum++) { if (self->pSbrElement[sbrElementNum] == NULL) { |