mirror of https://github.com/mstorsjo/fdk-aac.git
Merge changes I97471c4d,I8a8626a8,I1f176740,I10da23ee,I9f9064fb am: ecc96969d7
am: f5512132f3
Change-Id: Ie01b6d6c881c4c9a52af921eee9f7ced6fd6880e
This commit is contained in:
commit
d6459f539c
|
@ -234,7 +234,8 @@ void CAacDecoder_SyncQmfMode(HANDLE_AACDECODER self) {
|
|||
MODE_HQ))) { /* MPS decoder does support the requested mode. */
|
||||
break;
|
||||
}
|
||||
} /* Fall-through: */
|
||||
}
|
||||
FDK_FALLTHROUGH;
|
||||
default:
|
||||
if (self->qmfModeUser == NOT_DEFINED) {
|
||||
/* Revert in case mpegSurroundDecoder_SetParam() fails. */
|
||||
|
@ -938,6 +939,7 @@ static AAC_DECODER_ERROR CAacDecoder_ExtPayloadParse(
|
|||
|
||||
case EXT_SBR_DATA_CRC:
|
||||
crcFlag = 1;
|
||||
FDK_FALLTHROUGH;
|
||||
case EXT_SBR_DATA:
|
||||
if (IS_CHANNEL_ELEMENT(previous_element)) {
|
||||
SBR_ERROR sbrError;
|
||||
|
@ -1076,6 +1078,7 @@ static AAC_DECODER_ERROR CAacDecoder_ExtPayloadParse(
|
|||
* intentional. */
|
||||
break;
|
||||
}
|
||||
FDK_FALLTHROUGH;
|
||||
|
||||
case EXT_FIL:
|
||||
|
||||
|
@ -1108,12 +1111,13 @@ static AAC_DECODER_ERROR aacDecoder_ParseExplicitMpsAndSbr(
|
|||
/* get the remaining bits of this frame */
|
||||
bitCnt = transportDec_GetAuBitsRemaining(self->hInput, 0);
|
||||
|
||||
if ((bitCnt > 0) && (self->flags[0] & AC_SBR_PRESENT) &&
|
||||
if ((self->flags[0] & AC_SBR_PRESENT) &&
|
||||
(self->flags[0] & (AC_USAC | AC_RSVD50 | AC_ELD | AC_DRM))) {
|
||||
SBR_ERROR err = SBRDEC_OK;
|
||||
int chElIdx, numChElements = el_cnt[ID_SCE] + el_cnt[ID_CPE] +
|
||||
el_cnt[ID_LFE] + el_cnt[ID_USAC_SCE] +
|
||||
el_cnt[ID_USAC_CPE] + el_cnt[ID_USAC_LFE];
|
||||
INT bitCntTmp = bitCnt;
|
||||
|
||||
if (self->flags[0] & AC_USAC) {
|
||||
chElIdx = numChElements - 1;
|
||||
|
@ -1123,6 +1127,7 @@ static AAC_DECODER_ERROR aacDecoder_ParseExplicitMpsAndSbr(
|
|||
|
||||
for (; chElIdx < numChElements; chElIdx += 1) {
|
||||
MP4_ELEMENT_ID sbrType;
|
||||
SBR_ERROR errTmp;
|
||||
if (self->flags[0] & (AC_USAC)) {
|
||||
FDK_ASSERT((self->elements[element_index] == ID_USAC_SCE) ||
|
||||
(self->elements[element_index] == ID_USAC_CPE));
|
||||
|
@ -1132,19 +1137,21 @@ static AAC_DECODER_ERROR aacDecoder_ParseExplicitMpsAndSbr(
|
|||
: ID_SCE;
|
||||
} else
|
||||
sbrType = self->elements[chElIdx];
|
||||
err = sbrDecoder_Parse(self->hSbrDecoder, bs, self->pDrmBsBuffer,
|
||||
self->drmBsBufferSize, &bitCnt, -1,
|
||||
self->flags[0] & AC_SBRCRC, sbrType, chElIdx,
|
||||
self->flags[0], self->elFlags);
|
||||
if (err != SBRDEC_OK) {
|
||||
break;
|
||||
errTmp = sbrDecoder_Parse(self->hSbrDecoder, bs, self->pDrmBsBuffer,
|
||||
self->drmBsBufferSize, &bitCnt, -1,
|
||||
self->flags[0] & AC_SBRCRC, sbrType, chElIdx,
|
||||
self->flags[0], self->elFlags);
|
||||
if (errTmp != SBRDEC_OK) {
|
||||
err = errTmp;
|
||||
bitCntTmp = bitCnt;
|
||||
bitCnt = 0;
|
||||
}
|
||||
}
|
||||
switch (err) {
|
||||
case SBRDEC_PARSE_ERROR:
|
||||
/* Can not go on parsing because we do not
|
||||
know the length of the SBR extension data. */
|
||||
FDKpushFor(bs, bitCnt);
|
||||
FDKpushFor(bs, bitCntTmp);
|
||||
bitCnt = 0;
|
||||
break;
|
||||
case SBRDEC_OK:
|
||||
|
@ -1495,11 +1502,13 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
|
|||
switch (asc->m_aot) {
|
||||
case AOT_AAC_LC:
|
||||
self->streamInfo.profile = 1;
|
||||
FDK_FALLTHROUGH;
|
||||
case AOT_ER_AAC_SCAL:
|
||||
if (asc->m_sc.m_gaSpecificConfig.m_layer > 0) {
|
||||
/* aac_scalable_extension_element() currently not supported. */
|
||||
return AAC_DEC_UNSUPPORTED_FORMAT;
|
||||
}
|
||||
FDK_FALLTHROUGH;
|
||||
case AOT_SBR:
|
||||
case AOT_PS:
|
||||
case AOT_ER_AAC_LC:
|
||||
|
|
|
@ -634,6 +634,7 @@ static AAC_DECODER_ERROR setConcealMethod(
|
|||
switch (err) {
|
||||
case PCMDMX_INVALID_HANDLE:
|
||||
errorStatus = AAC_DEC_INVALID_HANDLE;
|
||||
break;
|
||||
case PCMDMX_OK:
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -592,6 +592,7 @@ AAC_DECODER_ERROR CChannelElement_Read(
|
|||
line: ~599 */
|
||||
/* Note: The missing "break" is intentional here, since we need to call
|
||||
* CBlock_ReadScaleFactorData(). */
|
||||
FDK_FALLTHROUGH;
|
||||
|
||||
case scale_factor_data:
|
||||
if (flags & AC_ER_RVLC) {
|
||||
|
|
|
@ -1894,6 +1894,7 @@ INT CConcealment_TDFading(
|
|||
case ConcealState_FadeIn:
|
||||
idx = cntFadeFrames;
|
||||
idx -= TDFadeInStopBeforeFullLevel;
|
||||
FDK_FALLTHROUGH;
|
||||
case ConcealState_Ok:
|
||||
fadeFactor = pConcealParams->fadeInFactor;
|
||||
idx = (concealState == ConcealState_Ok) ? -1 : idx;
|
||||
|
|
|
@ -907,6 +907,7 @@ static AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder,
|
|||
case AOT_MP2_AAC_LC:
|
||||
case AOT_MP2_SBR:
|
||||
hAacConfig->usePns = 0;
|
||||
FDK_FALLTHROUGH;
|
||||
case AOT_AAC_LC:
|
||||
case AOT_SBR:
|
||||
case AOT_PS:
|
||||
|
@ -2091,12 +2092,14 @@ AACENC_ERROR aacEncoder_SetParam(const HANDLE_AACENCODER hAacEncoder,
|
|||
err = AACENC_INVALID_CONFIG;
|
||||
goto bail;
|
||||
}
|
||||
FDK_FALLTHROUGH;
|
||||
case AOT_SBR:
|
||||
case AOT_MP2_SBR:
|
||||
if (!(hAacEncoder->encoder_modis & (ENC_MODE_FLAG_SBR))) {
|
||||
err = AACENC_INVALID_CONFIG;
|
||||
goto bail;
|
||||
}
|
||||
FDK_FALLTHROUGH;
|
||||
case AOT_AAC_LC:
|
||||
case AOT_MP2_AAC_LC:
|
||||
case AOT_ER_AAC_LD:
|
||||
|
|
|
@ -643,6 +643,7 @@ static INT FDKaacEnc_writeExtensionPayload(HANDLE_FDK_BITSTREAM hBitStream,
|
|||
FDKwriteBits(hBitStream, *extPayloadData++, 4); /* nibble */
|
||||
}
|
||||
extBitsUsed += 4;
|
||||
FDK_FALLTHROUGH;
|
||||
case EXT_DYNAMIC_RANGE:
|
||||
case EXT_SBR_DATA:
|
||||
case EXT_SBR_DATA_CRC:
|
||||
|
@ -690,6 +691,7 @@ static INT FDKaacEnc_writeExtensionPayload(HANDLE_FDK_BITSTREAM hBitStream,
|
|||
|
||||
case EXT_FILL_DATA:
|
||||
fillByte = 0xA5;
|
||||
FDK_FALLTHROUGH;
|
||||
case EXT_FIL:
|
||||
default:
|
||||
if (hBitStream != NULL) {
|
||||
|
|
|
@ -467,6 +467,7 @@ void CProgramConfig_GetDefault(CProgramConfig *pPce, const UINT channelConfig) {
|
|||
pPce->BackElementIsCpe[1] = 1;
|
||||
pPce->NumChannels += 1;
|
||||
pPce->NumEffectiveChannels += 1;
|
||||
FDK_FALLTHROUGH;
|
||||
case 11: /* 3/0/3.1ch */
|
||||
pPce->NumFrontChannelElements += 2;
|
||||
pPce->FrontElementIsCpe[0] = 0;
|
||||
|
@ -482,25 +483,30 @@ void CProgramConfig_GetDefault(CProgramConfig *pPce, const UINT channelConfig) {
|
|||
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
case 14: /* 2/0/0-3/0/2-0.1ch front height */
|
||||
pPce->FrontElementHeightInfo[2] = 1; /* Top speaker */
|
||||
case 7: /* 5/0/2.1ch front */
|
||||
FDK_FALLTHROUGH;
|
||||
case 7: /* 5/0/2.1ch front */
|
||||
pPce->NumFrontChannelElements += 1;
|
||||
pPce->FrontElementIsCpe[2] = 1;
|
||||
pPce->NumChannels += 2;
|
||||
pPce->NumEffectiveChannels += 2;
|
||||
FDK_FALLTHROUGH;
|
||||
case 6: /* 3/0/2.1ch */
|
||||
pPce->NumLfeChannelElements += 1;
|
||||
pPce->NumChannels += 1;
|
||||
FDK_FALLTHROUGH;
|
||||
case 5: /* 3/0/2.0ch */
|
||||
case 4: /* 3/0/1.0ch */
|
||||
pPce->NumBackChannelElements += 1;
|
||||
pPce->BackElementIsCpe[0] = (channelConfig > 4) ? 1 : 0;
|
||||
pPce->NumChannels += (channelConfig > 4) ? 2 : 1;
|
||||
pPce->NumEffectiveChannels += (channelConfig > 4) ? 2 : 1;
|
||||
FDK_FALLTHROUGH;
|
||||
case 3: /* 3/0/0.0ch */
|
||||
pPce->NumFrontChannelElements += 1;
|
||||
pPce->FrontElementIsCpe[1] = 1;
|
||||
pPce->NumChannels += 2;
|
||||
pPce->NumEffectiveChannels += 2;
|
||||
FDK_FALLTHROUGH;
|
||||
case 1: /* 1/0/0.0ch */
|
||||
pPce->NumFrontChannelElements += 1;
|
||||
pPce->FrontElementIsCpe[0] = 0;
|
||||
|
@ -713,6 +719,7 @@ int CProgramConfig_LookupElement(CProgramConfig *pPce, UINT channelConfig,
|
|||
switch (elType) {
|
||||
case ID_CPE:
|
||||
isCpe = 1;
|
||||
FDK_FALLTHROUGH;
|
||||
case ID_SCE:
|
||||
/* search in front channels */
|
||||
for (i = 0; i < pPce->NumFrontChannelElements; i++) {
|
||||
|
@ -1412,7 +1419,7 @@ static TRANSPORTDEC_ERROR EldSpecificConfig_Parse(CSAudioSpecificConfig *asc,
|
|||
break;
|
||||
}
|
||||
|
||||
/* fall-through */
|
||||
FDK_FALLTHROUGH;
|
||||
default:
|
||||
for (cnt = 0; cnt < eldExtLen; cnt++) {
|
||||
FDKreadBits(hBs, 8);
|
||||
|
@ -2022,6 +2029,7 @@ static TRANSPORTDEC_ERROR AudioSpecificConfig_ExtensionParse(
|
|||
break;
|
||||
case ASCEXT_MPS: /* 0x76a */
|
||||
if (self->m_extensionAudioObjectType == AOT_MPEGS) break;
|
||||
FDK_FALLTHROUGH;
|
||||
case ASCEXT_LDMPS: /* 0x7cc */
|
||||
if ((ascExtId == ASCEXT_LDMPS) &&
|
||||
(self->m_extensionAudioObjectType == AOT_LD_MPEGS))
|
||||
|
@ -2498,6 +2506,7 @@ TRANSPORTDEC_ERROR DrmRawSdcAudioConfig_Parse(
|
|||
switch (audioMode) {
|
||||
case 1: /* parametric stereo */
|
||||
self->m_psPresentFlag = 1;
|
||||
FDK_FALLTHROUGH;
|
||||
case 0: /* mono */
|
||||
self->m_channelConfiguration = 1;
|
||||
break;
|
||||
|
|
|
@ -956,6 +956,7 @@ static TRANSPORTDEC_ERROR transportDec_readHeader(
|
|||
hTp->parser.latm.m_audioMuxLengthBytes = syncLayerFrameBits;
|
||||
syncLayerFrameBits <<= 3;
|
||||
}
|
||||
FDK_FALLTHROUGH;
|
||||
case TT_MP4_LATM_MCP1:
|
||||
case TT_MP4_LATM_MCP0:
|
||||
if (hTp->numberOfRawDataBlocks <= 0) {
|
||||
|
|
|
@ -212,6 +212,7 @@ static INT getPceRepetitionRate(const CHANNEL_MODE channelMode,
|
|||
for potential matrix mixdown */
|
||||
break;
|
||||
}
|
||||
FDK_FALLTHROUGH;
|
||||
case TT_MP4_LOAS: /* PCE in ASC if chChonfig==0 */
|
||||
case TT_MP4_LATM_MCP1: /* PCE in ASC if chChonfig==0 */
|
||||
default:
|
||||
|
|
|
@ -1043,6 +1043,7 @@ static PCMDMX_ERROR getMixFactors(const UCHAR inModeIsCfg,
|
|||
case CH_MODE_3_2_1_0:
|
||||
isValidCfg = FALSE;
|
||||
err = PCMDMX_INVALID_MODE;
|
||||
FDK_FALLTHROUGH;
|
||||
case CH_MODE_3_0_3_1: /* chCfg 11 */
|
||||
/* 6.1ch: C' = C; L' = L; R' = R; LFE' = LFE;
|
||||
Ls' = Ls*dmix_a_idx + Cs*dmix_b_idx;
|
||||
|
@ -1080,9 +1081,11 @@ static PCMDMX_ERROR getMixFactors(const UCHAR inModeIsCfg,
|
|||
LEFT_REAR_CHANNEL, FL2FXCONST_DMX(0.5f), 1);
|
||||
dmxSetChannel(mixFactors, mixScales, LEFT_REAR_CHANNEL,
|
||||
LEFT_REAR_CHANNEL, FL2FXCONST_DMX(0.5f), 1);
|
||||
FDK_FALLTHROUGH;
|
||||
case CH_MODE_5_2_1_0:
|
||||
isValidCfg = FALSE;
|
||||
err = PCMDMX_INVALID_MODE;
|
||||
FDK_FALLTHROUGH;
|
||||
case CH_MODE_5_0_2_1: /* chCfg 7 || 14 */
|
||||
if (inChCfg == 14) {
|
||||
/* 7.1ch Front Height: C' = C; Ls' = Ls; Rs' = Rs; LFE' = LFE;
|
||||
|
|
|
@ -1349,6 +1349,7 @@ int mpegSurroundDecoder_Parse(CMpegSurroundDecoder *pMpegSurroundDecoder,
|
|||
pMpegSurroundDecoder->mpegSurroundSscIsGlobalCfg = 0;
|
||||
}
|
||||
}
|
||||
FDK_FALLTHROUGH;
|
||||
case MPEGS_ANCTYPE_FRAME:
|
||||
|
||||
if (pMpegSurroundDecoder
|
||||
|
|
|
@ -1145,10 +1145,10 @@ static int sbrGetEnvelope(
|
|||
\brief Generates frame info for FIXFIXonly frame class used for low delay
|
||||
version
|
||||
|
||||
\return nothing
|
||||
\return zero for error, one for correct.
|
||||
****************************************************************************/
|
||||
static void generateFixFixOnly(FRAME_INFO *hSbrFrameInfo, int tranPosInternal,
|
||||
int numberTimeSlots, const UINT flags) {
|
||||
static int generateFixFixOnly(FRAME_INFO *hSbrFrameInfo, int tranPosInternal,
|
||||
int numberTimeSlots, const UINT flags) {
|
||||
int nEnv, i, tranIdx;
|
||||
const int *pTable;
|
||||
|
||||
|
@ -1159,12 +1159,11 @@ static void generateFixFixOnly(FRAME_INFO *hSbrFrameInfo, int tranPosInternal,
|
|||
case 15:
|
||||
pTable = FDK_sbrDecoder_envelopeTable_15[tranPosInternal];
|
||||
break;
|
||||
default:
|
||||
FDK_ASSERT(0);
|
||||
/* fall through */
|
||||
case 16:
|
||||
pTable = FDK_sbrDecoder_envelopeTable_16[tranPosInternal];
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* look number of envelopes in table */
|
||||
|
@ -1187,6 +1186,8 @@ static void generateFixFixOnly(FRAME_INFO *hSbrFrameInfo, int tranPosInternal,
|
|||
/* nEnv is always > 1, so nNoiseEnvelopes is always 2 (IEC 14496-3 4.6.19.3.2)
|
||||
*/
|
||||
hSbrFrameInfo->nNoiseEnvelopes = 2;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -1230,7 +1231,9 @@ static int extractLowDelayGrid(
|
|||
}
|
||||
|
||||
/* calculate borders according to the transient position */
|
||||
generateFixFixOnly(pFrameInfo, temp, numberTimeSlots, flags);
|
||||
if (!generateFixFixOnly(pFrameInfo, temp, numberTimeSlots, flags)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* decode freq res: */
|
||||
for (k = 0; k < pFrameInfo->nEnvelopes; k++) {
|
||||
|
|
|
@ -1056,6 +1056,10 @@ SBR_ERROR QmfTransposerReInit(HANDLE_HBE_TRANSPOSER hQmfTransposer,
|
|||
const FIXP_QTW* tmp_t_sin;
|
||||
|
||||
hQmfTransposer->startBand = FreqBandTable[0][0];
|
||||
FDK_ASSERT((!hQmfTransposer->bSbr41 && hQmfTransposer->startBand <= 32) ||
|
||||
(hQmfTransposer->bSbr41 &&
|
||||
hQmfTransposer->startBand <=
|
||||
16)); /* is checked by resetFreqBandTables() */
|
||||
hQmfTransposer->stopBand = FreqBandTable[0][NSfb[0]];
|
||||
|
||||
hQmfTransposer->synthSize =
|
||||
|
|
|
@ -1248,7 +1248,7 @@ resetSbrDec(HANDLE_SBR_DEC hSbrDec, HANDLE_SBR_HEADER_DATA hHeaderData,
|
|||
|
||||
hSbrDec->savedStates = 0;
|
||||
|
||||
if (flags & SBRDEC_USAC_HARMONICSBR) {
|
||||
if ((flags & SBRDEC_USAC_HARMONICSBR) && applySbrProc) {
|
||||
sbrError = QmfTransposerReInit(hSbrDec->hHBE,
|
||||
hHeaderData->freqBandData.freqBandTable,
|
||||
hHeaderData->freqBandData.nSfb);
|
||||
|
|
|
@ -1150,6 +1150,11 @@ SBR_ERROR sbrDecoder_Parse(HANDLE_SBRDECODER self, HANDLE_FDK_BITSTREAM hBs,
|
|||
|
||||
int lastSlot, lastHdrSlot = 0, thisHdrSlot = 0;
|
||||
|
||||
if (*count <= 0) {
|
||||
setFrameErrorFlag(self->pSbrElement[elementIndex], FRAME_ERROR);
|
||||
return SBRDEC_OK;
|
||||
}
|
||||
|
||||
/* SBR sanity checks */
|
||||
if (self == NULL) {
|
||||
errorStatus = SBRDEC_NOT_INITIALIZED;
|
||||
|
@ -1677,6 +1682,9 @@ static SBR_ERROR sbrDecoder_DecodeElement(
|
|||
/* reset */
|
||||
if (hSbrHeader->status & SBRDEC_HDR_STAT_RESET) {
|
||||
int ch;
|
||||
int applySbrProc = (hSbrHeader->syncState == SBR_ACTIVE ||
|
||||
(hSbrHeader->frameErrorFlag == 0 &&
|
||||
hSbrHeader->syncState == SBR_HEADER));
|
||||
for (ch = 0; ch < numElementChannels; ch++) {
|
||||
SBR_ERROR errorStatusTmp = SBRDEC_OK;
|
||||
|
||||
|
@ -1688,7 +1696,9 @@ static SBR_ERROR sbrDecoder_DecodeElement(
|
|||
hSbrHeader->syncState = UPSAMPLING;
|
||||
}
|
||||
}
|
||||
hSbrHeader->status &= ~SBRDEC_HDR_STAT_RESET;
|
||||
if (applySbrProc) {
|
||||
hSbrHeader->status &= ~SBRDEC_HDR_STAT_RESET;
|
||||
}
|
||||
}
|
||||
|
||||
/* decoding */
|
||||
|
|
|
@ -379,6 +379,17 @@ it. Hence, a fully platform-independant way to use alignment is not supported.
|
|||
#define LNK_SECTION_L1_DATA_A
|
||||
#define LNK_SECTION_L1_DATA_B
|
||||
|
||||
/**************************************************
|
||||
* Macros regarding static code analysis
|
||||
**************************************************/
|
||||
#if defined(__clang__)
|
||||
#define FDK_FALLTHROUGH [[clang::fallthrough]]
|
||||
#elif defined(__GNUC__) && (__GNUC__ >= 7)
|
||||
#define FDK_FALLTHROUGH __attribute__((fallthrough))
|
||||
#else
|
||||
#define FDK_FALLTHROUGH
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/*
|
||||
* Sometimes certain features are excluded from compilation and therefore the
|
||||
|
|
Loading…
Reference in New Issue