mirror of https://github.com/mstorsjo/fdk-aac.git
Merge changes Ic767aeb6,I2aef40ef into sc-dev am: 2a3cde8157
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/aac/+/14373117 Change-Id: I1ea355c9e3d4f6cd29111e57da1e0a08a7c7c16c
This commit is contained in:
commit
f092b88a25
|
@ -1,7 +1,7 @@
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
Software License for The Fraunhofer FDK AAC Codec Library for Android
|
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.
|
Forschung e.V. All rights reserved.
|
||||||
|
|
||||||
1. INTRODUCTION
|
1. INTRODUCTION
|
||||||
|
@ -1417,11 +1417,7 @@ static void CAacDecoder_AcceptFlags(HANDLE_AACDECODER self,
|
||||||
const CSAudioSpecificConfig *asc,
|
const CSAudioSpecificConfig *asc,
|
||||||
UINT flags, UINT *elFlags, int streamIndex,
|
UINT flags, UINT *elFlags, int streamIndex,
|
||||||
int elementOffset) {
|
int elementOffset) {
|
||||||
{
|
FDKmemcpy(self->elFlags, elFlags, sizeof(self->elFlags));
|
||||||
FDKmemcpy(
|
|
||||||
self->elFlags, elFlags,
|
|
||||||
sizeof(*elFlags) * (3 * ((8) * 2) + (((8) * 2)) / 2 + 4 * (1) + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
self->flags[streamIndex] = flags;
|
self->flags[streamIndex] = flags;
|
||||||
}
|
}
|
||||||
|
@ -1524,8 +1520,14 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
|
||||||
INT flushChannels = 0;
|
INT flushChannels = 0;
|
||||||
|
|
||||||
UINT flags;
|
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)];
|
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;
|
if (!self) return AAC_DEC_INVALID_HANDLE;
|
||||||
|
|
||||||
UCHAR downscaleFactor = self->downscaleFactor;
|
UCHAR downscaleFactor = self->downscaleFactor;
|
||||||
|
@ -1709,7 +1711,7 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
|
||||||
asc->m_sc.m_usacConfig.m_usacNumElements;
|
asc->m_sc.m_usacConfig.m_usacNumElements;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->mpsEnableCurr = 0;
|
mpsEnableCurr = 0;
|
||||||
for (int _el = 0;
|
for (int _el = 0;
|
||||||
_el < (int)self->pUsacConfig[streamIndex]->m_usacNumElements;
|
_el < (int)self->pUsacConfig[streamIndex]->m_usacNumElements;
|
||||||
_el++) {
|
_el++) {
|
||||||
|
@ -1729,7 +1731,7 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
|
||||||
self->usacStereoConfigIndex[el] =
|
self->usacStereoConfigIndex[el] =
|
||||||
asc->m_sc.m_usacConfig.element[_el].m_stereoConfigIndex;
|
asc->m_sc.m_usacConfig.element[_el].m_stereoConfigIndex;
|
||||||
if (self->elements[el] == ID_USAC_CPE) {
|
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 =
|
self->useLdQmfTimeAlign =
|
||||||
asc->m_sc.m_eldSpecificConfig.m_useLdQmfTimeAlign;
|
asc->m_sc.m_eldSpecificConfig.m_useLdQmfTimeAlign;
|
||||||
}
|
}
|
||||||
if (self->sbrEnabled != asc->m_sbrPresentFlag) {
|
if (sbrEnabled != asc->m_sbrPresentFlag) {
|
||||||
ascChanged = 1;
|
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_sbrPresentFlag) ? AC_SBR_PRESENT : 0;
|
||||||
flags |= (asc->m_psPresentFlag) ? AC_PS_PRESENT : 0;
|
flags |= (asc->m_psPresentFlag) ? AC_PS_PRESENT : 0;
|
||||||
if (asc->m_sbrPresentFlag) {
|
if (asc->m_sbrPresentFlag) {
|
||||||
self->sbrEnabled = 1;
|
sbrEnabled = 1;
|
||||||
self->sbrEnabledPrev = 1;
|
sbrEnabledPrev = 1;
|
||||||
} else {
|
} else {
|
||||||
self->sbrEnabled = 0;
|
sbrEnabled = 0;
|
||||||
self->sbrEnabledPrev = 0;
|
sbrEnabledPrev = 0;
|
||||||
}
|
}
|
||||||
if (self->sbrEnabled && asc->m_extensionSamplingFrequency) {
|
if (sbrEnabled && asc->m_extensionSamplingFrequency) {
|
||||||
if (downscaleFactor != 1 && (downscaleFactor)&1) {
|
if (downscaleFactor != 1 && (downscaleFactor)&1) {
|
||||||
return AAC_DEC_UNSUPPORTED_SAMPLINGRATE; /* SBR needs an even downscale
|
return AAC_DEC_UNSUPPORTED_SAMPLINGRATE; /* SBR needs an even downscale
|
||||||
factor */
|
factor */
|
||||||
|
@ -1914,7 +1916,7 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
|
||||||
flags |= (asc->m_hcrFlag) ? AC_ER_HCR : 0;
|
flags |= (asc->m_hcrFlag) ? AC_ER_HCR : 0;
|
||||||
|
|
||||||
if (asc->m_aot == AOT_ER_AAC_ELD) {
|
if (asc->m_aot == AOT_ER_AAC_ELD) {
|
||||||
self->mpsEnableCurr = 0;
|
mpsEnableCurr = 0;
|
||||||
flags |= AC_ELD;
|
flags |= AC_ELD;
|
||||||
flags |= (asc->m_sbrPresentFlag)
|
flags |= (asc->m_sbrPresentFlag)
|
||||||
? AC_SBR_PRESENT
|
? AC_SBR_PRESENT
|
||||||
|
@ -1925,7 +1927,7 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
|
||||||
? AC_MPS_PRESENT
|
? AC_MPS_PRESENT
|
||||||
: 0;
|
: 0;
|
||||||
if (self->mpsApplicable) {
|
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;
|
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 */
|
/* set AC_USAC_SCFGI3 globally if any usac element uses */
|
||||||
switch (asc->m_aot) {
|
switch (asc->m_aot) {
|
||||||
case AOT_USAC:
|
case AOT_USAC:
|
||||||
if (self->sbrEnabled) {
|
if (sbrEnabled) {
|
||||||
for (int _el = 0;
|
for (int _el = 0;
|
||||||
_el < (int)self->pUsacConfig[streamIndex]->m_usacNumElements;
|
_el < (int)self->pUsacConfig[streamIndex]->m_usacNumElements;
|
||||||
_el++) {
|
_el++) {
|
||||||
|
@ -2043,7 +2045,7 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
|
||||||
*/
|
*/
|
||||||
switch (asc->m_aot) {
|
switch (asc->m_aot) {
|
||||||
case AOT_USAC:
|
case AOT_USAC:
|
||||||
if (self->sbrEnabled) {
|
if (sbrEnabled) {
|
||||||
const UCHAR map_sbrRatio_2_nAnaBands[] = {16, 24, 32};
|
const UCHAR map_sbrRatio_2_nAnaBands[] = {16, 24, 32};
|
||||||
|
|
||||||
FDK_ASSERT(asc->m_sc.m_usacConfig.m_sbrRatioIndex > 0);
|
FDK_ASSERT(asc->m_sc.m_usacConfig.m_sbrRatioIndex > 0);
|
||||||
|
@ -2071,11 +2073,11 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AOT_ER_AAC_ELD:
|
case AOT_ER_AAC_ELD:
|
||||||
if (self->mpsEnableCurr &&
|
if (mpsEnableCurr &&
|
||||||
asc->m_sc.m_eldSpecificConfig.m_useLdQmfTimeAlign) {
|
asc->m_sc.m_eldSpecificConfig.m_useLdQmfTimeAlign) {
|
||||||
SAC_INPUT_CONFIG sac_interface =
|
SAC_INPUT_CONFIG sac_interface = (sbrEnabled && self->hSbrDecoder)
|
||||||
(self->sbrEnabled && self->hSbrDecoder) ? SAC_INTERFACE_QMF
|
? SAC_INTERFACE_QMF
|
||||||
: SAC_INTERFACE_TIME;
|
: SAC_INTERFACE_TIME;
|
||||||
mpegSurroundDecoder_ConfigureQmfDomain(
|
mpegSurroundDecoder_ConfigureQmfDomain(
|
||||||
(CMpegSurroundDecoder *)self->pMpegSurroundDecoder, sac_interface,
|
(CMpegSurroundDecoder *)self->pMpegSurroundDecoder, sac_interface,
|
||||||
(UINT)self->streamInfo.aacSampleRate, asc->m_aot);
|
(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,
|
CAacDecoder_AcceptFlags(self, asc, flags, elFlags, streamIndex,
|
||||||
elementOffset);
|
elementOffset);
|
||||||
|
self->sbrEnabled = sbrEnabled;
|
||||||
|
self->sbrEnabledPrev = sbrEnabledPrev;
|
||||||
|
self->mpsEnableCurr = mpsEnableCurr;
|
||||||
|
|
||||||
/* Update externally visible copy of flags */
|
/* Update externally visible copy of flags */
|
||||||
self->streamInfo.flags = self->flags[0];
|
self->streamInfo.flags = self->flags[0];
|
||||||
|
|
Loading…
Reference in New Issue