mirror of
https://github.com/mstorsjo/fdk-aac.git
synced 2025-06-05 22:39:13 +02:00
Snap for 6157842 from f04a8a855c
to rvc-release
Change-Id: Icd800c3d313c30fc67595fc70baaf69b12188cd7
This commit is contained in:
@@ -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 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||||
Forschung e.V. All rights reserved.
|
Forschung e.V. All rights reserved.
|
||||||
|
|
||||||
1. INTRODUCTION
|
1. INTRODUCTION
|
||||||
@@ -1848,6 +1848,12 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
|
|||||||
self->streamInfo.extSamplingRate / self->downscaleFactor;
|
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 ------------ */
|
/* --------- vcb11 ------------ */
|
||||||
self->flags[streamIndex] |= (asc->m_vcb11Flag) ? AC_ER_VCB11 : 0;
|
self->flags[streamIndex] |= (asc->m_vcb11Flag) ? AC_ER_VCB11 : 0;
|
||||||
@@ -2366,6 +2372,13 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
|
|||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*configChanged) {
|
||||||
|
if (asc->m_aot == AOT_USAC) {
|
||||||
|
self->hDrcInfo->enable = 0;
|
||||||
|
self->hDrcInfo->progRefLevelPresent = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (asc->m_aot == AOT_USAC) {
|
if (asc->m_aot == AOT_USAC) {
|
||||||
pcmLimiter_SetAttack(self->hLimiter, (5));
|
pcmLimiter_SetAttack(self->hLimiter, (5));
|
||||||
pcmLimiter_SetThreshold(self->hLimiter, FL2FXCONST_DBL(0.89125094f));
|
pcmLimiter_SetThreshold(self->hLimiter, FL2FXCONST_DBL(0.89125094f));
|
||||||
@@ -3172,9 +3185,15 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame(
|
|||||||
self->hDrcInfo, bs, self->pAacDecoderStaticChannelInfo,
|
self->hDrcInfo, bs, self->pAacDecoderStaticChannelInfo,
|
||||||
pce->ElementInstanceTag, drcChMap, aacChannels);
|
pce->ElementInstanceTag, drcChMap, aacChannels);
|
||||||
if (mapped > 0) {
|
if (mapped > 0) {
|
||||||
/* If at least one DRC thread has been mapped to a channel threre was DRC
|
if (!(self->flags[streamIndex] & (AC_USAC | AC_RSV603DA))) {
|
||||||
* data in the bitstream. */
|
/* If at least one DRC thread has been mapped to a channel there was DRC
|
||||||
self->flags[streamIndex] |= AC_DRC_PRESENT;
|
* 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 */
|
/* Create a reverse mapping table */
|
||||||
@@ -3419,9 +3438,15 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame(
|
|||||||
self->hDrcInfo, bs, self->pAacDecoderStaticChannelInfo,
|
self->hDrcInfo, bs, self->pAacDecoderStaticChannelInfo,
|
||||||
pce->ElementInstanceTag, drcChMap, aacChannels);
|
pce->ElementInstanceTag, drcChMap, aacChannels);
|
||||||
if (mapped > 0) {
|
if (mapped > 0) {
|
||||||
/* If at least one DRC thread has been mapped to a channel threre was DRC
|
if (!(self->flags[streamIndex] & (AC_USAC | AC_RSV603DA))) {
|
||||||
* data in the bitstream. */
|
/* If at least one DRC thread has been mapped to a channel there was DRC
|
||||||
self->flags[streamIndex] |= AC_DRC_PRESENT;
|
* data in the bitstream. */
|
||||||
|
self->flags[streamIndex] |= AC_DRC_PRESENT;
|
||||||
|
} else {
|
||||||
|
self->hDrcInfo->enable = 0;
|
||||||
|
self->hDrcInfo->progRefLevelPresent = 0;
|
||||||
|
ErrorStatus = AAC_DEC_UNSUPPORTED_FORMAT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -145,6 +145,10 @@ struct s_drc_decoder {
|
|||||||
SEL_PROC_OUTPUT selProcOutput;
|
SEL_PROC_OUTPUT selProcOutput;
|
||||||
} DRC_DECODER;
|
} DRC_DECODER;
|
||||||
|
|
||||||
|
static int _getGainStatus(HANDLE_UNI_DRC_GAIN hUniDrcGain) {
|
||||||
|
return hUniDrcGain->status;
|
||||||
|
}
|
||||||
|
|
||||||
static int isResetNeeded(HANDLE_DRC_DECODER hDrcDec,
|
static int isResetNeeded(HANDLE_DRC_DECODER hDrcDec,
|
||||||
const SEL_PROC_OUTPUT oldSelProcOutput) {
|
const SEL_PROC_OUTPUT oldSelProcOutput) {
|
||||||
int i, resetNeeded = 0;
|
int i, resetNeeded = 0;
|
||||||
@@ -729,7 +733,9 @@ FDK_drcDec_ReadUniDrcGain(HANDLE_DRC_DECODER hDrcDec,
|
|||||||
&(hDrcDec->uniDrcGain));
|
&(hDrcDec->uniDrcGain));
|
||||||
if (dErr) return DRC_DEC_NOT_OK;
|
if (dErr) return DRC_DEC_NOT_OK;
|
||||||
|
|
||||||
hDrcDec->status = DRC_DEC_NEW_GAIN_PAYLOAD;
|
if (_getGainStatus(&(hDrcDec->uniDrcGain))) {
|
||||||
|
hDrcDec->status = DRC_DEC_NEW_GAIN_PAYLOAD;
|
||||||
|
}
|
||||||
|
|
||||||
return DRC_DEC_OK;
|
return DRC_DEC_OK;
|
||||||
}
|
}
|
||||||
@@ -751,7 +757,9 @@ FDK_drcDec_ReadUniDrc(HANDLE_DRC_DECODER hDrcDec,
|
|||||||
startSelectionProcess(hDrcDec);
|
startSelectionProcess(hDrcDec);
|
||||||
if (dErr) return DRC_DEC_NOT_OK;
|
if (dErr) return DRC_DEC_NOT_OK;
|
||||||
|
|
||||||
hDrcDec->status = DRC_DEC_NEW_GAIN_PAYLOAD;
|
if (_getGainStatus(&(hDrcDec->uniDrcGain))) {
|
||||||
|
hDrcDec->status = DRC_DEC_NEW_GAIN_PAYLOAD;
|
||||||
|
}
|
||||||
|
|
||||||
return DRC_DEC_OK;
|
return DRC_DEC_OK;
|
||||||
}
|
}
|
||||||
|
@@ -297,9 +297,11 @@ drcDec_GainDecoder_Conceal(HANDLE_DRC_GAIN_DECODER hGainDec,
|
|||||||
int seq, gainSequenceCount;
|
int seq, gainSequenceCount;
|
||||||
DRC_COEFFICIENTS_UNI_DRC* pCoef =
|
DRC_COEFFICIENTS_UNI_DRC* pCoef =
|
||||||
selectDrcCoefficients(hUniDrcConfig, LOCATION_SELECTED);
|
selectDrcCoefficients(hUniDrcConfig, LOCATION_SELECTED);
|
||||||
if (pCoef == NULL) return DE_OK;
|
if (pCoef && pCoef->gainSequenceCount) {
|
||||||
|
gainSequenceCount = fMin(pCoef->gainSequenceCount, (UCHAR)12);
|
||||||
gainSequenceCount = fMin(pCoef->gainSequenceCount, (UCHAR)12);
|
} else {
|
||||||
|
gainSequenceCount = 1;
|
||||||
|
}
|
||||||
|
|
||||||
for (seq = 0; seq < gainSequenceCount; seq++) {
|
for (seq = 0; seq < gainSequenceCount; seq++) {
|
||||||
int lastNodeIndex = 0;
|
int lastNodeIndex = 0;
|
||||||
|
@@ -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 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||||
Forschung e.V. All rights reserved.
|
Forschung e.V. All rights reserved.
|
||||||
|
|
||||||
1. INTRODUCTION
|
1. INTRODUCTION
|
||||||
@@ -199,11 +199,8 @@ drcDec_readUniDrc(HANDLE_FDK_BITSTREAM hBs, HANDLE_UNI_DRC_CONFIG hUniDrcConfig,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hUniDrcGain != NULL) {
|
err = drcDec_readUniDrcGain(hBs, hUniDrcConfig, frameSize, deltaTminDefault,
|
||||||
err = drcDec_readUniDrcGain(hBs, hUniDrcConfig, frameSize, deltaTminDefault,
|
hUniDrcGain);
|
||||||
hUniDrcGain);
|
|
||||||
if (err) return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -487,10 +484,13 @@ drcDec_readUniDrcGain(HANDLE_FDK_BITSTREAM hBs,
|
|||||||
int seq, gainSequenceCount;
|
int seq, gainSequenceCount;
|
||||||
DRC_COEFFICIENTS_UNI_DRC* pCoef =
|
DRC_COEFFICIENTS_UNI_DRC* pCoef =
|
||||||
selectDrcCoefficients(hUniDrcConfig, LOCATION_SELECTED);
|
selectDrcCoefficients(hUniDrcConfig, LOCATION_SELECTED);
|
||||||
if (pCoef == NULL) return DE_OK;
|
if (hUniDrcGain == NULL) return DE_NOT_OK;
|
||||||
if (hUniDrcGain == NULL) return DE_OK; /* hUniDrcGain not initialized yet */
|
hUniDrcGain->status = 0;
|
||||||
|
if (pCoef) {
|
||||||
gainSequenceCount = fMin(pCoef->gainSequenceCount, (UCHAR)12);
|
gainSequenceCount = fMin(pCoef->gainSequenceCount, (UCHAR)12);
|
||||||
|
} else {
|
||||||
|
gainSequenceCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (seq = 0; seq < gainSequenceCount; seq++) {
|
for (seq = 0; seq < gainSequenceCount; seq++) {
|
||||||
UCHAR index = pCoef->gainSetIndexForGainSequence[seq];
|
UCHAR index = pCoef->gainSetIndexForGainSequence[seq];
|
||||||
@@ -518,6 +518,9 @@ drcDec_readUniDrcGain(HANDLE_FDK_BITSTREAM hBs,
|
|||||||
if (err) return err;
|
if (err) return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (err == DE_OK && gainSequenceCount > 0) {
|
||||||
|
hUniDrcGain->status = 1;
|
||||||
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -956,17 +956,31 @@ static DRCDEC_SELECTION_PROCESS_RETURN _preSelectionRequirement4(
|
|||||||
return DRCDEC_SELECTION_PROCESS_NO_ERROR;
|
return DRCDEC_SELECTION_PROCESS_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* #5: The number of DRC bands is supported. */
|
/* #5: The number of DRC bands is supported. Moreover, gainSetIndex and
|
||||||
|
* gainSequenceIndex are within the allowed range. */
|
||||||
static DRCDEC_SELECTION_PROCESS_RETURN _preSelectionRequirement5(
|
static DRCDEC_SELECTION_PROCESS_RETURN _preSelectionRequirement5(
|
||||||
DRC_INSTRUCTIONS_UNI_DRC* pDrcInstructionUniDrc,
|
DRC_INSTRUCTIONS_UNI_DRC* pDrcInstructionUniDrc,
|
||||||
DRC_COEFFICIENTS_UNI_DRC* pCoef, int* pMatchFound) {
|
DRC_COEFFICIENTS_UNI_DRC* pCoef, int* pMatchFound) {
|
||||||
int i;
|
int b, i;
|
||||||
|
|
||||||
*pMatchFound = 1;
|
*pMatchFound = 1;
|
||||||
|
|
||||||
|
if (pDrcInstructionUniDrc->drcSetId < 0) /* virtual DRC sets are okay */
|
||||||
|
{
|
||||||
|
return DRCDEC_SELECTION_PROCESS_NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (pCoef == NULL) /* check for parametricDRC */
|
if (pCoef == NULL) /* check for parametricDRC */
|
||||||
{
|
{
|
||||||
*pMatchFound = 1;
|
*pMatchFound = 0; /* parametricDRC not supported */
|
||||||
|
return DRCDEC_SELECTION_PROCESS_NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pCoef->drcLocation !=
|
||||||
|
pDrcInstructionUniDrc
|
||||||
|
->drcLocation) /* drcLocation must be LOCATION_SELECTED */
|
||||||
|
{
|
||||||
|
*pMatchFound = 0;
|
||||||
return DRCDEC_SELECTION_PROCESS_NO_ERROR;
|
return DRCDEC_SELECTION_PROCESS_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -974,10 +988,14 @@ static DRCDEC_SELECTION_PROCESS_RETURN _preSelectionRequirement5(
|
|||||||
int indexDrcCoeff = pDrcInstructionUniDrc->gainSetIndexForChannelGroup[i];
|
int indexDrcCoeff = pDrcInstructionUniDrc->gainSetIndexForChannelGroup[i];
|
||||||
int bandCount = 0;
|
int bandCount = 0;
|
||||||
|
|
||||||
|
if (indexDrcCoeff >= 12) {
|
||||||
|
*pMatchFound = 0;
|
||||||
|
return DRCDEC_SELECTION_PROCESS_NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (indexDrcCoeff > pCoef->gainSetCount - 1) /* check for parametricDRC */
|
if (indexDrcCoeff > pCoef->gainSetCount - 1) /* check for parametricDRC */
|
||||||
{
|
{
|
||||||
*pMatchFound = 1;
|
continue;
|
||||||
return DRCDEC_SELECTION_PROCESS_NO_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GAIN_SET* gainSet = &(pCoef->gainSet[indexDrcCoeff]);
|
GAIN_SET* gainSet = &(pCoef->gainSet[indexDrcCoeff]);
|
||||||
@@ -986,6 +1004,14 @@ static DRCDEC_SELECTION_PROCESS_RETURN _preSelectionRequirement5(
|
|||||||
if (bandCount > 4) {
|
if (bandCount > 4) {
|
||||||
*pMatchFound = 0;
|
*pMatchFound = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (b = 0; b < bandCount; b++) {
|
||||||
|
if ((gainSet->gainSequenceIndex[b] >= 12) ||
|
||||||
|
(gainSet->gainSequenceIndex[b] >= pCoef->gainSequenceCount)) {
|
||||||
|
*pMatchFound = 0;
|
||||||
|
return DRCDEC_SELECTION_PROCESS_NO_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DRCDEC_SELECTION_PROCESS_NO_ERROR;
|
return DRCDEC_SELECTION_PROCESS_NO_ERROR;
|
||||||
@@ -1078,6 +1104,19 @@ static int _targetLoudnessInRange(
|
|||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int _drcSetIsUsable(HANDLE_UNI_DRC_CONFIG hUniDrcConfig,
|
||||||
|
DRC_INSTRUCTIONS_UNI_DRC* pInst) {
|
||||||
|
int usable = 0;
|
||||||
|
DRC_COEFFICIENTS_UNI_DRC* pCoef =
|
||||||
|
selectDrcCoefficients(hUniDrcConfig, LOCATION_SELECTED);
|
||||||
|
|
||||||
|
/* check if ID is unique */
|
||||||
|
if (selectDrcInstructions(hUniDrcConfig, pInst->drcSetId) != pInst) return 0;
|
||||||
|
/* sanity check on drcInstructions */
|
||||||
|
_preSelectionRequirement5(pInst, pCoef, &usable);
|
||||||
|
return usable;
|
||||||
|
}
|
||||||
|
|
||||||
/* #8: The range of the target loudness specified for a DRC set has to include
|
/* #8: The range of the target loudness specified for a DRC set has to include
|
||||||
* the requested decoder target loudness. */
|
* the requested decoder target loudness. */
|
||||||
static DRCDEC_SELECTION_PROCESS_RETURN _preSelectionRequirement8(
|
static DRCDEC_SELECTION_PROCESS_RETURN _preSelectionRequirement8(
|
||||||
@@ -2051,8 +2090,11 @@ static DRCDEC_SELECTION_PROCESS_RETURN _generateOutputInfo(
|
|||||||
int dependsOnDrcSetID = pSelectionData->pInst->dependsOnDrcSet;
|
int dependsOnDrcSetID = pSelectionData->pInst->dependsOnDrcSet;
|
||||||
|
|
||||||
for (i = 0; i < hUniDrcConfig->drcInstructionsCountInclVirtual; i++) {
|
for (i = 0; i < hUniDrcConfig->drcInstructionsCountInclVirtual; i++) {
|
||||||
if (hUniDrcConfig->drcInstructionsUniDrc[i].drcSetId ==
|
DRC_INSTRUCTIONS_UNI_DRC* pInst =
|
||||||
dependsOnDrcSetID) {
|
&(hUniDrcConfig->drcInstructionsUniDrc[i]);
|
||||||
|
if (!_drcSetIsUsable(hUniDrcConfig, pInst)) continue;
|
||||||
|
|
||||||
|
if (pInst->drcSetId == dependsOnDrcSetID) {
|
||||||
hSelProcOutput->selectedDrcSetIds[hSelProcOutput->numSelectedDrcSets] =
|
hSelProcOutput->selectedDrcSetIds[hSelProcOutput->numSelectedDrcSets] =
|
||||||
hUniDrcConfig->drcInstructionsUniDrc[i].drcSetId;
|
hUniDrcConfig->drcInstructionsUniDrc[i].drcSetId;
|
||||||
hSelProcOutput->selectedDownmixIds[hSelProcOutput->numSelectedDrcSets] =
|
hSelProcOutput->selectedDownmixIds[hSelProcOutput->numSelectedDrcSets] =
|
||||||
@@ -2071,6 +2113,7 @@ static DRCDEC_SELECTION_PROCESS_RETURN _generateOutputInfo(
|
|||||||
for (i = 0; i < hUniDrcConfig->drcInstructionsUniDrcCount; i++) {
|
for (i = 0; i < hUniDrcConfig->drcInstructionsUniDrcCount; i++) {
|
||||||
DRC_INSTRUCTIONS_UNI_DRC* pInst =
|
DRC_INSTRUCTIONS_UNI_DRC* pInst =
|
||||||
&(hUniDrcConfig->drcInstructionsUniDrc[i]);
|
&(hUniDrcConfig->drcInstructionsUniDrc[i]);
|
||||||
|
if (!_drcSetIsUsable(hUniDrcConfig, pInst)) continue;
|
||||||
|
|
||||||
if (pInst->drcSetEffect & EB_FADE) {
|
if (pInst->drcSetEffect & EB_FADE) {
|
||||||
if (pInst->downmixId[0] == DOWNMIX_ID_ANY_DOWNMIX) {
|
if (pInst->downmixId[0] == DOWNMIX_ID_ANY_DOWNMIX) {
|
||||||
@@ -2098,6 +2141,7 @@ static DRCDEC_SELECTION_PROCESS_RETURN _generateOutputInfo(
|
|||||||
for (i = 0; i < hUniDrcConfig->drcInstructionsUniDrcCount; i++) {
|
for (i = 0; i < hUniDrcConfig->drcInstructionsUniDrcCount; i++) {
|
||||||
DRC_INSTRUCTIONS_UNI_DRC* pInst =
|
DRC_INSTRUCTIONS_UNI_DRC* pInst =
|
||||||
&(hUniDrcConfig->drcInstructionsUniDrc[i]);
|
&(hUniDrcConfig->drcInstructionsUniDrc[i]);
|
||||||
|
if (!_drcSetIsUsable(hUniDrcConfig, pInst)) continue;
|
||||||
|
|
||||||
if (pInst->drcSetEffect & (EB_DUCK_OTHER | EB_DUCK_SELF)) {
|
if (pInst->drcSetEffect & (EB_DUCK_OTHER | EB_DUCK_SELF)) {
|
||||||
for (j = 0; j < pInst->downmixIdCount; j++) {
|
for (j = 0; j < pInst->downmixIdCount; j++) {
|
||||||
@@ -2124,6 +2168,7 @@ static DRCDEC_SELECTION_PROCESS_RETURN _generateOutputInfo(
|
|||||||
for (i = 0; i < hUniDrcConfig->drcInstructionsUniDrcCount; i++) {
|
for (i = 0; i < hUniDrcConfig->drcInstructionsUniDrcCount; i++) {
|
||||||
DRC_INSTRUCTIONS_UNI_DRC* pInst =
|
DRC_INSTRUCTIONS_UNI_DRC* pInst =
|
||||||
&(hUniDrcConfig->drcInstructionsUniDrc[i]);
|
&(hUniDrcConfig->drcInstructionsUniDrc[i]);
|
||||||
|
if (!_drcSetIsUsable(hUniDrcConfig, pInst)) continue;
|
||||||
|
|
||||||
if (pInst->drcSetEffect & (EB_DUCK_OTHER | EB_DUCK_SELF)) {
|
if (pInst->drcSetEffect & (EB_DUCK_OTHER | EB_DUCK_SELF)) {
|
||||||
for (j = 0; j < pInst->downmixIdCount; j++) {
|
for (j = 0; j < pInst->downmixIdCount; j++) {
|
||||||
@@ -2231,6 +2276,11 @@ static DRCDEC_SELECTION_PROCESS_RETURN _drcSetPreSelection(
|
|||||||
for (j = 0; j < hUniDrcConfig->drcInstructionsCountInclVirtual; j++) {
|
for (j = 0; j < hUniDrcConfig->drcInstructionsCountInclVirtual; j++) {
|
||||||
DRC_INSTRUCTIONS_UNI_DRC* pDrcInstruction =
|
DRC_INSTRUCTIONS_UNI_DRC* pDrcInstruction =
|
||||||
&(hUniDrcConfig->drcInstructionsUniDrc[j]);
|
&(hUniDrcConfig->drcInstructionsUniDrc[j]);
|
||||||
|
/* check if ID is unique */
|
||||||
|
if (selectDrcInstructions(hUniDrcConfig, pDrcInstruction->drcSetId) !=
|
||||||
|
pDrcInstruction)
|
||||||
|
continue;
|
||||||
|
|
||||||
retVal = _drcSetPreSelectionSingleInstruction(
|
retVal = _drcSetPreSelectionSingleInstruction(
|
||||||
hSelProcInput, i, hUniDrcConfig, hLoudnessInfoSet, pDrcInstruction,
|
hSelProcInput, i, hUniDrcConfig, hLoudnessInfoSet, pDrcInstruction,
|
||||||
*ppCandidatesPotential, *ppCandidatesSelected, codecMode);
|
*ppCandidatesPotential, *ppCandidatesSelected, codecMode);
|
||||||
|
@@ -130,6 +130,9 @@ typedef struct {
|
|||||||
|
|
||||||
UCHAR uniDrcGainExtPresent;
|
UCHAR uniDrcGainExtPresent;
|
||||||
UNI_DRC_GAIN_EXTENSION uniDrcGainExtension;
|
UNI_DRC_GAIN_EXTENSION uniDrcGainExtension;
|
||||||
|
|
||||||
|
/* derived data */
|
||||||
|
UCHAR status;
|
||||||
} UNI_DRC_GAIN, *HANDLE_UNI_DRC_GAIN;
|
} UNI_DRC_GAIN, *HANDLE_UNI_DRC_GAIN;
|
||||||
|
|
||||||
/****************/
|
/****************/
|
||||||
|
@@ -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 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||||
Forschung e.V. All rights reserved.
|
Forschung e.V. All rights reserved.
|
||||||
|
|
||||||
1. INTRODUCTION
|
1. INTRODUCTION
|
||||||
@@ -213,8 +213,8 @@ TRANSPORTDEC_ERROR adtsRead_DecodeHeader(HANDLE_ADTS pAdts,
|
|||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FDKcrcReset(&pAdts->crcInfo);
|
||||||
if (!bs.protection_absent) {
|
if (!bs.protection_absent) {
|
||||||
FDKcrcReset(&pAdts->crcInfo);
|
|
||||||
FDKpushBack(hBs, 56); /* complete fixed and variable header! */
|
FDKpushBack(hBs, 56); /* complete fixed and variable header! */
|
||||||
crcReg = FDKcrcStartReg(&pAdts->crcInfo, hBs, 0);
|
crcReg = FDKcrcStartReg(&pAdts->crcInfo, hBs, 0);
|
||||||
FDKpushFor(hBs, 56);
|
FDKpushFor(hBs, 56);
|
||||||
@@ -314,15 +314,55 @@ TRANSPORTDEC_ERROR adtsRead_DecodeHeader(HANDLE_ADTS pAdts,
|
|||||||
if (bs.channel_config == 0) {
|
if (bs.channel_config == 0) {
|
||||||
int pceBits = 0;
|
int pceBits = 0;
|
||||||
UINT alignAnchor = FDKgetValidBits(hBs);
|
UINT alignAnchor = FDKgetValidBits(hBs);
|
||||||
|
CProgramConfig tmpPce;
|
||||||
|
|
||||||
if (FDKreadBits(hBs, 3) == ID_PCE) {
|
if (FDKreadBits(hBs, 3) == ID_PCE) {
|
||||||
/* Got luck! Parse the PCE */
|
/* Got luck! Parse the PCE */
|
||||||
crcReg = adtsRead_CrcStartReg(pAdts, hBs, 0);
|
crcReg = adtsRead_CrcStartReg(pAdts, hBs, 0);
|
||||||
|
|
||||||
CProgramConfig_Read(&pAsc->m_progrConfigElement, hBs, alignAnchor);
|
CProgramConfig_Init(&tmpPce);
|
||||||
|
CProgramConfig_Read(&tmpPce, hBs, alignAnchor);
|
||||||
|
|
||||||
|
if (CProgramConfig_IsValid(&tmpPce)) {
|
||||||
|
if (CProgramConfig_IsValid(&oldPce)) {
|
||||||
|
/* Compare the new and the old PCE (tags ignored) */
|
||||||
|
switch (CProgramConfig_Compare(&tmpPce, &oldPce)) {
|
||||||
|
case 0: /* Nothing to do because PCE matches the old one exactly. */
|
||||||
|
case 1: /* Channel configuration not changed. Just new metadata. */
|
||||||
|
FDKmemcpy(&pAsc->m_progrConfigElement, &tmpPce,
|
||||||
|
sizeof(CProgramConfig));
|
||||||
|
break;
|
||||||
|
case 2: /* The number of channels are identical but not the config
|
||||||
|
*/
|
||||||
|
case -1: /* The channel configuration is completely different */
|
||||||
|
default:
|
||||||
|
FDKmemcpy(&pAsc->m_progrConfigElement, &oldPce,
|
||||||
|
sizeof(CProgramConfig));
|
||||||
|
FDKpushBack(hBs, adtsHeaderLength);
|
||||||
|
return TRANSPORTDEC_PARSE_ERROR;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
FDKmemcpy(&pAsc->m_progrConfigElement, &tmpPce,
|
||||||
|
sizeof(CProgramConfig));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (CProgramConfig_IsValid(&oldPce)) {
|
||||||
|
FDKmemcpy(&pAsc->m_progrConfigElement, &oldPce,
|
||||||
|
sizeof(CProgramConfig));
|
||||||
|
} else {
|
||||||
|
FDKpushBack(hBs, adtsHeaderLength);
|
||||||
|
return TRANSPORTDEC_PARSE_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
adtsRead_CrcEndReg(pAdts, hBs, crcReg);
|
adtsRead_CrcEndReg(pAdts, hBs, crcReg);
|
||||||
pceBits = alignAnchor - FDKgetValidBits(hBs);
|
pceBits = (INT)alignAnchor - (INT)FDKgetValidBits(hBs);
|
||||||
|
adtsHeaderLength += pceBits;
|
||||||
|
|
||||||
|
if (pceBits > (INT)alignAnchor) {
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
|
|
||||||
/* store the number of PCE bits */
|
/* store the number of PCE bits */
|
||||||
bs.num_pce_bits = pceBits;
|
bs.num_pce_bits = pceBits;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -929,6 +929,11 @@ static TRANSPORTDEC_ERROR transportDec_readHeader(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* if an error is detected terminate config parsing to avoid that an
|
||||||
|
* invalid config is accepted in the second pass */
|
||||||
|
if (err != TRANSPORTDEC_OK) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Reset CRC because the next bits are the beginning of a
|
/* Reset CRC because the next bits are the beginning of a
|
||||||
|
Reference in New Issue
Block a user