Reject HE-AAC SBR with a ratio greater than 2:1 and reject USAC streams containing legacy DRC info.

Bug: 146937553
Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc
Change-Id: I1a23d986160c1de07a7159ac026f57d821d3ff1d
This commit is contained in:
Fraunhofer IIS FDK 2019-11-13 16:10:21 +01:00 committed by Jean-Michel Trivi
parent cedcc475f5
commit 7388c0732d
1 changed files with 32 additions and 7 deletions

View File

@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@ -1848,6 +1848,12 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
self->streamInfo.extSamplingRate / self->downscaleFactor;
}
}
if ((asc->m_aot == AOT_AAC_LC) && (asc->m_sbrPresentFlag == 1) &&
(asc->m_extensionSamplingFrequency > (2 * asc->m_samplingFrequency))) {
return AAC_DEC_UNSUPPORTED_SAMPLINGRATE; /* Core decoder supports at most a
1:2 upsampling for HE-AAC and
HE-AACv2 */
}
/* --------- vcb11 ------------ */
self->flags[streamIndex] |= (asc->m_vcb11Flag) ? AC_ER_VCB11 : 0;
@ -2366,6 +2372,13 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
goto bail;
}
if (*configChanged) {
if (asc->m_aot == AOT_USAC) {
self->hDrcInfo->enable = 0;
self->hDrcInfo->progRefLevelPresent = 0;
}
}
if (asc->m_aot == AOT_USAC) {
pcmLimiter_SetAttack(self->hLimiter, (5));
pcmLimiter_SetThreshold(self->hLimiter, FL2FXCONST_DBL(0.89125094f));
@ -3172,9 +3185,15 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame(
self->hDrcInfo, bs, self->pAacDecoderStaticChannelInfo,
pce->ElementInstanceTag, drcChMap, aacChannels);
if (mapped > 0) {
/* If at least one DRC thread has been mapped to a channel threre was DRC
* data in the bitstream. */
self->flags[streamIndex] |= AC_DRC_PRESENT;
if (!(self->flags[streamIndex] & (AC_USAC | AC_RSV603DA))) {
/* If at least one DRC thread has been mapped to a channel there was DRC
* data in the bitstream. */
self->flags[streamIndex] |= AC_DRC_PRESENT;
} else {
self->hDrcInfo->enable = 0;
self->hDrcInfo->progRefLevelPresent = 0;
ErrorStatus = AAC_DEC_UNSUPPORTED_FORMAT;
}
}
/* Create a reverse mapping table */
@ -3419,9 +3438,15 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame(
self->hDrcInfo, bs, self->pAacDecoderStaticChannelInfo,
pce->ElementInstanceTag, drcChMap, aacChannels);
if (mapped > 0) {
/* If at least one DRC thread has been mapped to a channel threre was DRC
* data in the bitstream. */
self->flags[streamIndex] |= AC_DRC_PRESENT;
if (!(self->flags[streamIndex] & (AC_USAC | AC_RSV603DA))) {
/* If at least one DRC thread has been mapped to a channel there was DRC
* data in the bitstream. */
self->flags[streamIndex] |= AC_DRC_PRESENT;
} else {
self->hDrcInfo->enable = 0;
self->hDrcInfo->progRefLevelPresent = 0;
ErrorStatus = AAC_DEC_UNSUPPORTED_FORMAT;
}
}
}