diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2018-12-27 14:28:38 -0800 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-12-27 14:28:38 -0800 |
commit | f5512132f3850ab06a13b9e541cac51f6f389bf2 (patch) | |
tree | e78e88638c742d3dcd5f704d6ad50758d256a945 | |
parent | 2027969e1f72be4464e48f1bc0065b2bed1590b9 (diff) | |
parent | ecc96969d7db139242dbba9930857ed5ce955b29 (diff) | |
download | fdk-aac-f5512132f3850ab06a13b9e541cac51f6f389bf2.tar.gz fdk-aac-f5512132f3850ab06a13b9e541cac51f6f389bf2.tar.bz2 fdk-aac-f5512132f3850ab06a13b9e541cac51f6f389bf2.zip |
Merge changes I97471c4d,I8a8626a8,I1f176740,I10da23ee,I9f9064fb
am: ecc96969d7
Change-Id: I588392116ecdf22e1266ec6fff8416fa87d911c4
-rw-r--r-- | libAACdec/src/aacdecoder.cpp | 27 | ||||
-rw-r--r-- | libAACdec/src/aacdecoder_lib.cpp | 1 | ||||
-rw-r--r-- | libAACdec/src/channel.cpp | 1 | ||||
-rw-r--r-- | libAACdec/src/conceal.cpp | 1 | ||||
-rw-r--r-- | libAACenc/src/aacenc_lib.cpp | 3 | ||||
-rw-r--r-- | libAACenc/src/bitenc.cpp | 2 | ||||
-rw-r--r-- | libMpegTPDec/src/tpdec_asc.cpp | 13 | ||||
-rw-r--r-- | libMpegTPDec/src/tpdec_lib.cpp | 1 | ||||
-rw-r--r-- | libMpegTPEnc/src/tpenc_lib.cpp | 1 | ||||
-rw-r--r-- | libPCMutils/src/pcmdmx_lib.cpp | 3 | ||||
-rw-r--r-- | libSACdec/src/sac_dec_lib.cpp | 1 | ||||
-rw-r--r-- | libSBRdec/src/env_extr.cpp | 17 | ||||
-rw-r--r-- | libSBRdec/src/hbe.cpp | 4 | ||||
-rw-r--r-- | libSBRdec/src/sbr_dec.cpp | 2 | ||||
-rw-r--r-- | libSBRdec/src/sbrdecoder.cpp | 12 | ||||
-rw-r--r-- | libSYS/include/machine_type.h | 11 |
16 files changed, 80 insertions, 20 deletions
diff --git a/libAACdec/src/aacdecoder.cpp b/libAACdec/src/aacdecoder.cpp index 8993927..a529389 100644 --- a/libAACdec/src/aacdecoder.cpp +++ b/libAACdec/src/aacdecoder.cpp @@ -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: diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp index b528ef1..2860bf6 100644 --- a/libAACdec/src/aacdecoder_lib.cpp +++ b/libAACdec/src/aacdecoder_lib.cpp @@ -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: diff --git a/libAACdec/src/channel.cpp b/libAACdec/src/channel.cpp index cfffd57..a020034 100644 --- a/libAACdec/src/channel.cpp +++ b/libAACdec/src/channel.cpp @@ -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) { diff --git a/libAACdec/src/conceal.cpp b/libAACdec/src/conceal.cpp index a6064b6..cc6de75 100644 --- a/libAACdec/src/conceal.cpp +++ b/libAACdec/src/conceal.cpp @@ -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; diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp index f92cff4..9e0630c 100644 --- a/libAACenc/src/aacenc_lib.cpp +++ b/libAACenc/src/aacenc_lib.cpp @@ -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: diff --git a/libAACenc/src/bitenc.cpp b/libAACenc/src/bitenc.cpp index 652d1fd..957e821 100644 --- a/libAACenc/src/bitenc.cpp +++ b/libAACenc/src/bitenc.cpp @@ -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) { diff --git a/libMpegTPDec/src/tpdec_asc.cpp b/libMpegTPDec/src/tpdec_asc.cpp index 8d411e8..6260cad 100644 --- a/libMpegTPDec/src/tpdec_asc.cpp +++ b/libMpegTPDec/src/tpdec_asc.cpp @@ -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; diff --git a/libMpegTPDec/src/tpdec_lib.cpp b/libMpegTPDec/src/tpdec_lib.cpp index 2a40187..1976cb9 100644 --- a/libMpegTPDec/src/tpdec_lib.cpp +++ b/libMpegTPDec/src/tpdec_lib.cpp @@ -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) { diff --git a/libMpegTPEnc/src/tpenc_lib.cpp b/libMpegTPEnc/src/tpenc_lib.cpp index a8567b9..14ea5fe 100644 --- a/libMpegTPEnc/src/tpenc_lib.cpp +++ b/libMpegTPEnc/src/tpenc_lib.cpp @@ -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: diff --git a/libPCMutils/src/pcmdmx_lib.cpp b/libPCMutils/src/pcmdmx_lib.cpp index b09a848..2070dbc 100644 --- a/libPCMutils/src/pcmdmx_lib.cpp +++ b/libPCMutils/src/pcmdmx_lib.cpp @@ -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; diff --git a/libSACdec/src/sac_dec_lib.cpp b/libSACdec/src/sac_dec_lib.cpp index 5ae89d1..e881599 100644 --- a/libSACdec/src/sac_dec_lib.cpp +++ b/libSACdec/src/sac_dec_lib.cpp @@ -1349,6 +1349,7 @@ int mpegSurroundDecoder_Parse(CMpegSurroundDecoder *pMpegSurroundDecoder, pMpegSurroundDecoder->mpegSurroundSscIsGlobalCfg = 0; } } + FDK_FALLTHROUGH; case MPEGS_ANCTYPE_FRAME: if (pMpegSurroundDecoder diff --git a/libSBRdec/src/env_extr.cpp b/libSBRdec/src/env_extr.cpp index e6ae6dc..c72a7b6 100644 --- a/libSBRdec/src/env_extr.cpp +++ b/libSBRdec/src/env_extr.cpp @@ -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++) { diff --git a/libSBRdec/src/hbe.cpp b/libSBRdec/src/hbe.cpp index 53b21c9..1141e9c 100644 --- a/libSBRdec/src/hbe.cpp +++ b/libSBRdec/src/hbe.cpp @@ -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 = diff --git a/libSBRdec/src/sbr_dec.cpp b/libSBRdec/src/sbr_dec.cpp index 2e18e6c..30611e7 100644 --- a/libSBRdec/src/sbr_dec.cpp +++ b/libSBRdec/src/sbr_dec.cpp @@ -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); diff --git a/libSBRdec/src/sbrdecoder.cpp b/libSBRdec/src/sbrdecoder.cpp index e2455da..4bc6f69 100644 --- a/libSBRdec/src/sbrdecoder.cpp +++ b/libSBRdec/src/sbrdecoder.cpp @@ -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 */ diff --git a/libSYS/include/machine_type.h b/libSYS/include/machine_type.h index be8de37..b66d5ad 100644 --- a/libSYS/include/machine_type.h +++ b/libSYS/include/machine_type.h @@ -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 |