diff options
Diffstat (limited to 'libAACdec/src')
-rw-r--r-- | libAACdec/src/aacdecoder_lib.cpp | 21 | ||||
-rw-r--r-- | libAACdec/src/block.cpp | 12 | ||||
-rw-r--r-- | libAACdec/src/ldfiltbank.cpp | 8 | ||||
-rw-r--r-- | libAACdec/src/usacdec_lpd.cpp | 3 |
4 files changed, 32 insertions, 12 deletions
diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp index d98cf5a..b528ef1 100644 --- a/libAACdec/src/aacdecoder_lib.cpp +++ b/libAACdec/src/aacdecoder_lib.cpp @@ -368,6 +368,23 @@ static INT aacDecoder_CtrlCFGChangeCallback( return errTp; } +static INT aacDecoder_SbrCallback( + void *handle, HANDLE_FDK_BITSTREAM hBs, const INT sampleRateIn, + const INT sampleRateOut, const INT samplesPerFrame, + const AUDIO_OBJECT_TYPE coreCodec, const MP4_ELEMENT_ID elementID, + const INT elementIndex, const UCHAR harmonicSBR, + const UCHAR stereoConfigIndex, const UCHAR configMode, UCHAR *configChanged, + const INT downscaleFactor) { + HANDLE_SBRDECODER self = (HANDLE_SBRDECODER)handle; + + INT errTp = sbrDecoder_Header(self, hBs, sampleRateIn, sampleRateOut, + samplesPerFrame, coreCodec, elementID, + elementIndex, harmonicSBR, stereoConfigIndex, + configMode, configChanged, downscaleFactor); + + return errTp; +} + static INT aacDecoder_SscCallback(void *handle, HANDLE_FDK_BITSTREAM hBs, const AUDIO_OBJECT_TYPE coreCodec, const INT samplingRate, @@ -959,7 +976,7 @@ LINKSPEC_CPP HANDLE_AACDECODER aacDecoder_Open(TRANSPORT_TYPE transportFmt, goto bail; } aacDec->qmfModeUser = NOT_DEFINED; - transportDec_RegisterSbrCallback(aacDec->hInput, (cbSbr_t)sbrDecoder_Header, + transportDec_RegisterSbrCallback(aacDec->hInput, aacDecoder_SbrCallback, (void *)aacDec->hSbrDecoder); if (mpegSurroundDecoder_Open( @@ -1865,7 +1882,7 @@ aacDecoder_DecodeFrame(HANDLE_AACDECODER self, INT_PCM *pTimeData_extern, } /* USAC DASH IPF flushing possible end */ if (accessUnit < numPrerollAU) { - FDKpushBack(hBsAu, auStartAnchor - FDKgetValidBits(hBsAu)); + FDKpushBack(hBsAu, auStartAnchor - (INT)FDKgetValidBits(hBsAu)); } else { if ((self->buildUpStatus == AACDEC_RSV60_BUILD_UP_ON) || (self->buildUpStatus == AACDEC_RSV60_BUILD_UP_ON_IN_BAND) || diff --git a/libAACdec/src/block.cpp b/libAACdec/src/block.cpp index 7d2a4b9..b3d09a6 100644 --- a/libAACdec/src/block.cpp +++ b/libAACdec/src/block.cpp @@ -127,9 +127,11 @@ amm-info@iis.fraunhofer.de The function reads the escape sequence from the bitstream, if the absolute value of the quantized coefficient has the value 16. - A limitation is implemented to maximal 31 bits to prevent endless loops. - If it strikes, MAX_QUANTIZED_VALUE + 1 is returned, independent of the sign of - parameter q. + A limitation is implemented to maximal 21 bits according to + ISO/IEC 14496-3:2009(E) 4.6.3.3. + This limits the escape prefix to a maximum of eight 1's. + If more than eight 1's are read, MAX_QUANTIZED_VALUE + 1 is + returned, independent of the sign of parameter q. \return quantized coefficient */ @@ -139,11 +141,11 @@ LONG CBlock_GetEscape(HANDLE_FDK_BITSTREAM bs, /*!< pointer to bitstream */ if (fAbs(q) != 16) return (q); LONG i, off; - for (i = 4; i < 32; i++) { + for (i = 4; i < 13; i++) { if (FDKreadBit(bs) == 0) break; } - if (i == 32) return (MAX_QUANTIZED_VALUE + 1); + if (i == 13) return (MAX_QUANTIZED_VALUE + 1); off = FDKreadBits(bs, i); i = off + (1 << i); diff --git a/libAACdec/src/ldfiltbank.cpp b/libAACdec/src/ldfiltbank.cpp index 66a5914..c7d2928 100644 --- a/libAACdec/src/ldfiltbank.cpp +++ b/libAACdec/src/ldfiltbank.cpp @@ -216,6 +216,7 @@ int InvMdctTransformLowDelay_fdk(FIXP_DBL *mdctData, const int mdctData_e, int scale = mdctData_e + MDCT_OUT_HEADROOM - LDFB_HEADROOM; /* The LDFB_HEADROOM is compensated inside multE2_DinvF_fdk() below */ + int i; /* Select LD window slope */ switch (N) { @@ -261,10 +262,11 @@ int InvMdctTransformLowDelay_fdk(FIXP_DBL *mdctData, const int mdctData_e, } if (gain != (FIXP_DBL)0) { - scaleValuesWithFactor(mdctData, gain, N, scale); - } else { - scaleValues(mdctData, N, scale); + for (i = 0; i < N; i++) { + mdctData[i] = fMult(mdctData[i], gain); + } } + scaleValuesSaturate(mdctData, N, scale); /* Since all exponent and factors have been applied, current exponent is zero. */ diff --git a/libAACdec/src/usacdec_lpd.cpp b/libAACdec/src/usacdec_lpd.cpp index 22069a6..fde34ef 100644 --- a/libAACdec/src/usacdec_lpd.cpp +++ b/libAACdec/src/usacdec_lpd.cpp @@ -1221,8 +1221,7 @@ AAC_DECODER_ERROR CLpdChannelStream_Read( (INT)(samplingRate * PIT_MIN_12k8 + (FSCALE_DENOM / 2)) / FSCALE_DENOM - (INT)PIT_MIN_12k8; - if (pSamplingRateInfo->samplingRate > - FAC_FSCALE_MAX /* maximum allowed core sampling frequency */) { + if ((samplingRate < FAC_FSCALE_MIN) || (samplingRate > FAC_FSCALE_MAX)) { error = AAC_DEC_PARSE_ERROR; goto bail; } |