Merge changes Ic767aeb6,I2aef40ef into sc-dev am: 2a3cde8157 am: cffde9083d

Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/14373117

Change-Id: I68997798fa469bcec9a146560d0ac57357b4b69e
This commit is contained in:
TreeHugger Robot 2021-05-05 02:09:12 +00:00 committed by Automerger Merge Worker
commit c7facc625a
1 changed files with 27 additions and 22 deletions

View File

@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
© Copyright 1995 - 2021 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@ -1417,11 +1417,7 @@ static void CAacDecoder_AcceptFlags(HANDLE_AACDECODER self,
const CSAudioSpecificConfig *asc,
UINT flags, UINT *elFlags, int streamIndex,
int elementOffset) {
{
FDKmemcpy(
self->elFlags, elFlags,
sizeof(*elFlags) * (3 * ((8) * 2) + (((8) * 2)) / 2 + 4 * (1) + 1));
}
FDKmemcpy(self->elFlags, elFlags, sizeof(self->elFlags));
self->flags[streamIndex] = flags;
}
@ -1524,8 +1520,14 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
INT flushChannels = 0;
UINT flags;
/* elFlags[(3*MAX_CHANNELS + (MAX_CHANNELS)/2 + 4 * (MAX_TRACKS) + 1]
where MAX_CHANNELS is (8*2) and MAX_TRACKS is 1 */
UINT elFlags[(3 * ((8) * 2) + (((8) * 2)) / 2 + 4 * (1) + 1)];
UCHAR sbrEnabled = self->sbrEnabled;
UCHAR sbrEnabledPrev = self->sbrEnabledPrev;
UCHAR mpsEnableCurr = self->mpsEnableCurr;
if (!self) return AAC_DEC_INVALID_HANDLE;
UCHAR downscaleFactor = self->downscaleFactor;
@ -1709,7 +1711,7 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
asc->m_sc.m_usacConfig.m_usacNumElements;
}
self->mpsEnableCurr = 0;
mpsEnableCurr = 0;
for (int _el = 0;
_el < (int)self->pUsacConfig[streamIndex]->m_usacNumElements;
_el++) {
@ -1729,7 +1731,7 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
self->usacStereoConfigIndex[el] =
asc->m_sc.m_usacConfig.element[_el].m_stereoConfigIndex;
if (self->elements[el] == ID_USAC_CPE) {
self->mpsEnableCurr |= self->usacStereoConfigIndex[el] ? 1 : 0;
mpsEnableCurr |= self->usacStereoConfigIndex[el] ? 1 : 0;
}
}
@ -1865,7 +1867,7 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
self->useLdQmfTimeAlign =
asc->m_sc.m_eldSpecificConfig.m_useLdQmfTimeAlign;
}
if (self->sbrEnabled != asc->m_sbrPresentFlag) {
if (sbrEnabled != asc->m_sbrPresentFlag) {
ascChanged = 1;
}
}
@ -1881,13 +1883,13 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
flags |= (asc->m_sbrPresentFlag) ? AC_SBR_PRESENT : 0;
flags |= (asc->m_psPresentFlag) ? AC_PS_PRESENT : 0;
if (asc->m_sbrPresentFlag) {
self->sbrEnabled = 1;
self->sbrEnabledPrev = 1;
sbrEnabled = 1;
sbrEnabledPrev = 1;
} else {
self->sbrEnabled = 0;
self->sbrEnabledPrev = 0;
sbrEnabled = 0;
sbrEnabledPrev = 0;
}
if (self->sbrEnabled && asc->m_extensionSamplingFrequency) {
if (sbrEnabled && asc->m_extensionSamplingFrequency) {
if (downscaleFactor != 1 && (downscaleFactor)&1) {
return AAC_DEC_UNSUPPORTED_SAMPLINGRATE; /* SBR needs an even downscale
factor */
@ -1914,7 +1916,7 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
flags |= (asc->m_hcrFlag) ? AC_ER_HCR : 0;
if (asc->m_aot == AOT_ER_AAC_ELD) {
self->mpsEnableCurr = 0;
mpsEnableCurr = 0;
flags |= AC_ELD;
flags |= (asc->m_sbrPresentFlag)
? AC_SBR_PRESENT
@ -1925,7 +1927,7 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
? AC_MPS_PRESENT
: 0;
if (self->mpsApplicable) {
self->mpsEnableCurr = asc->m_sc.m_eldSpecificConfig.m_useLdQmfTimeAlign;
mpsEnableCurr = asc->m_sc.m_eldSpecificConfig.m_useLdQmfTimeAlign;
}
}
flags |= (asc->m_aot == AOT_ER_AAC_LD) ? AC_LD : 0;
@ -2006,7 +2008,7 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
/* set AC_USAC_SCFGI3 globally if any usac element uses */
switch (asc->m_aot) {
case AOT_USAC:
if (self->sbrEnabled) {
if (sbrEnabled) {
for (int _el = 0;
_el < (int)self->pUsacConfig[streamIndex]->m_usacNumElements;
_el++) {
@ -2043,7 +2045,7 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
*/
switch (asc->m_aot) {
case AOT_USAC:
if (self->sbrEnabled) {
if (sbrEnabled) {
const UCHAR map_sbrRatio_2_nAnaBands[] = {16, 24, 32};
FDK_ASSERT(asc->m_sc.m_usacConfig.m_sbrRatioIndex > 0);
@ -2071,11 +2073,11 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
}
break;
case AOT_ER_AAC_ELD:
if (self->mpsEnableCurr &&
if (mpsEnableCurr &&
asc->m_sc.m_eldSpecificConfig.m_useLdQmfTimeAlign) {
SAC_INPUT_CONFIG sac_interface =
(self->sbrEnabled && self->hSbrDecoder) ? SAC_INTERFACE_QMF
: SAC_INTERFACE_TIME;
SAC_INPUT_CONFIG sac_interface = (sbrEnabled && self->hSbrDecoder)
? SAC_INTERFACE_QMF
: SAC_INTERFACE_TIME;
mpegSurroundDecoder_ConfigureQmfDomain(
(CMpegSurroundDecoder *)self->pMpegSurroundDecoder, sac_interface,
(UINT)self->streamInfo.aacSampleRate, asc->m_aot);
@ -2430,6 +2432,9 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
CAacDecoder_AcceptFlags(self, asc, flags, elFlags, streamIndex,
elementOffset);
self->sbrEnabled = sbrEnabled;
self->sbrEnabledPrev = sbrEnabledPrev;
self->mpsEnableCurr = mpsEnableCurr;
/* Update externally visible copy of flags */
self->streamInfo.flags = self->flags[0];