diff options
author | Fraunhofer IIS FDK <audio-fdk@iis.fraunhofer.de> | 2018-12-20 15:52:46 +0100 |
---|---|---|
committer | Jean-Michel Trivi <jmtrivi@google.com> | 2019-01-03 10:25:40 -0500 |
commit | 5c54fa53876a92d4c7b923c5a6312f427cfc8c86 (patch) | |
tree | 91034718d6eb4b76b7961400707b93e964d95da9 /libMpegTPDec | |
parent | 7884aefc84b56d7f805d8e84d378ab468274d3ff (diff) | |
download | fdk-aac-5c54fa53876a92d4c7b923c5a6312f427cfc8c86.tar.gz fdk-aac-5c54fa53876a92d4c7b923c5a6312f427cfc8c86.tar.bz2 fdk-aac-5c54fa53876a92d4c7b923c5a6312f427cfc8c86.zip |
Add AOT specific number of qmf bands sanity check in SpatialSpecificConfig()
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc
Change-Id: Ic106c4371c5ac17cb832c7d9db042bcc9d1e7a09
Diffstat (limited to 'libMpegTPDec')
-rw-r--r-- | libMpegTPDec/include/tp_data.h | 3 | ||||
-rw-r--r-- | libMpegTPDec/src/tpdec_asc.cpp | 27 |
2 files changed, 24 insertions, 6 deletions
diff --git a/libMpegTPDec/include/tp_data.h b/libMpegTPDec/include/tp_data.h index b4ab802..b015332 100644 --- a/libMpegTPDec/include/tp_data.h +++ b/libMpegTPDec/include/tp_data.h @@ -367,7 +367,8 @@ typedef INT (*cbFreeMem_t)(void *, const CSAudioSpecificConfig *); typedef INT (*cbCtrlCFGChange_t)(void *, const CCtrlCFGChange *); typedef INT (*cbSsc_t)(void *, HANDLE_FDK_BITSTREAM, const AUDIO_OBJECT_TYPE coreCodec, - const INT samplingRate, const INT stereoConfigIndex, + const INT samplingRate, const INT frameSize, + const INT stereoConfigIndex, const INT coreSbrFrameLengthIndex, const INT configBytes, const UCHAR configMode, UCHAR *configChanged); diff --git a/libMpegTPDec/src/tpdec_asc.cpp b/libMpegTPDec/src/tpdec_asc.cpp index 5270f2b..28bc22d 100644 --- a/libMpegTPDec/src/tpdec_asc.cpp +++ b/libMpegTPDec/src/tpdec_asc.cpp @@ -1413,7 +1413,9 @@ static TRANSPORTDEC_ERROR EldSpecificConfig_Parse(CSAudioSpecificConfig *asc, esc->m_useLdQmfTimeAlign = 1; if (cb->cbSsc != NULL) { ErrorStatus = (TRANSPORTDEC_ERROR)cb->cbSsc( - cb->cbSscData, hBs, asc->m_aot, asc->m_extensionSamplingFrequency, + cb->cbSscData, hBs, asc->m_aot, + asc->m_samplingFrequency << esc->m_sbrSamplingRate, + asc->m_samplesPerFrame << esc->m_sbrSamplingRate, 1, /* stereoConfigIndex */ -1, /* nTimeSlots: read from bitstream */ eldExtLen, asc->configMode, &asc->SacConfigChanged); @@ -1812,9 +1814,16 @@ static TRANSPORTDEC_ERROR UsacRsv60DecoderConfig_Parse( if (usc->element[i].m_stereoConfigIndex > 0) { if (cb->cbSsc != NULL) { + int samplesPerFrame = asc->m_samplesPerFrame; + + if (usc->m_sbrRatioIndex == 1) samplesPerFrame <<= 2; + if (usc->m_sbrRatioIndex == 2) + samplesPerFrame = (samplesPerFrame * 8) / 3; + if (usc->m_sbrRatioIndex == 3) samplesPerFrame <<= 1; + /* Mps212Config() ISO/IEC FDIS 23003-3 */ if (cb->cbSsc(cb->cbSscData, hBs, asc->m_aot, - asc->m_extensionSamplingFrequency, + asc->m_extensionSamplingFrequency, samplesPerFrame, usc->element[i].m_stereoConfigIndex, usc->m_coreSbrFrameLengthIndex, 0, /* don't know the length */ @@ -2181,8 +2190,9 @@ TRANSPORTDEC_ERROR AudioSpecificConfig_Parse( case AOT_MPEGS: if (cb->cbSsc != NULL) { if (cb->cbSsc(cb->cbSscData, bs, self->m_aot, self->m_samplingFrequency, - 1, -1, /* nTimeSlots: read from bitstream */ - 0, /* don't know the length */ + self->m_samplesPerFrame, 1, + -1, /* nTimeSlots: read from bitstream */ + 0, /* don't know the length */ self->configMode, &self->SacConfigChanged)) { return TRANSPORTDEC_UNSUPPORTED_FORMAT; } @@ -2365,10 +2375,17 @@ static TRANSPORTDEC_ERROR Drm_xHEAACDecoderConfig( /*usc->element[elemIdx].m_stereoConfigIndex =*/FDKreadBits(hBs, 2); if (usc->element[elemIdx].m_stereoConfigIndex > 0) { if (cb->cbSsc != NULL) { + int samplesPerFrame = asc->m_samplesPerFrame; + + if (usc->m_sbrRatioIndex == 1) samplesPerFrame <<= 2; + if (usc->m_sbrRatioIndex == 2) + samplesPerFrame = (samplesPerFrame * 8) / 3; + if (usc->m_sbrRatioIndex == 3) samplesPerFrame <<= 1; + ErrorStatus = (TRANSPORTDEC_ERROR)cb->cbSsc( cb->cbSscData, hBs, AOT_DRM_USAC, /* syntax differs from MPEG Mps212Config() */ - asc->m_extensionSamplingFrequency, + asc->m_extensionSamplingFrequency, samplesPerFrame, usc->element[elemIdx].m_stereoConfigIndex, usc->m_coreSbrFrameLengthIndex, 0, /* don't know the length */ asc->configMode, &asc->SacConfigChanged); |