diff options
author | Wim Taymans <wtaymans@redhat.com> | 2019-05-22 19:04:57 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2019-05-22 19:04:57 +0200 |
commit | 282947f73b01df9b6f7f75f7c7e9019186e4e1f1 (patch) | |
tree | 54987cc01f11b9941b3f4ded0497bc597aab8799 | |
parent | 61d06a0d1e3d0a58fc8f4504e95de32721c5250d (diff) |
Fix compilation, remove some more stuffstripped3
-rw-r--r-- | libAACdec/src/aacdecoder.cpp | 157 | ||||
-rw-r--r-- | libAACdec/src/aacdecoder_lib.cpp | 45 | ||||
-rw-r--r-- | libAACdec/src/block.cpp | 50 | ||||
-rw-r--r-- | libAACdec/src/channel.cpp | 9 | ||||
-rw-r--r-- | libAACdec/src/usacdec_lpd.cpp | 20 | ||||
-rw-r--r-- | libAACenc/src/aacenc_lib.cpp | 56 | ||||
-rw-r--r-- | libAACenc/src/bitenc.cpp | 2 | ||||
-rw-r--r-- | libMpegTPDec/src/tpdec_asc.cpp | 112 | ||||
-rw-r--r-- | libMpegTPEnc/src/tpenc_asc.cpp | 79 |
9 files changed, 27 insertions, 503 deletions
diff --git a/libAACdec/src/aacdecoder.cpp b/libAACdec/src/aacdecoder.cpp index a074624..2679feb 100644 --- a/libAACdec/src/aacdecoder.cpp +++ b/libAACdec/src/aacdecoder.cpp @@ -1187,8 +1187,6 @@ LINKSPEC_CPP HANDLE_AACDECODER CAacDecoder_Open( /* initialize progam config */ CProgramConfig_Init(&self->pce); - self->concealMethodUser = ConcealMethodNone; /* undefined -> auto mode */ - self->hDrcInfo = GetDrcInfo(); if (self->hDrcInfo == NULL) { goto bail; @@ -1429,12 +1427,10 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc, case AOT_DRM_SURROUND: initRenderMode = AACDEC_RENDER_IMDCT; break; - case AOT_ER_AAC_ELD: - initRenderMode = AACDEC_RENDER_ELDFB; - break; case AOT_USAC: initRenderMode = AACDEC_RENDER_IMDCT; break; + case AOT_ER_AAC_ELD: default: return AAC_DEC_UNSUPPORTED_AOT; } @@ -1688,26 +1684,8 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc, ascChanged = 1; } - if (asc->m_aot == AOT_ER_AAC_ELD && - asc->m_sc.m_eldSpecificConfig.m_downscaledSamplingFrequency != 0) { - if (self->samplingRateInfo[0].samplingRate != - asc->m_sc.m_eldSpecificConfig.m_downscaledSamplingFrequency || - self->samplingRateInfo[0].samplingRate * self->downscaleFactor != - asc->m_samplingFrequency) { - /* get downscaledSamplingFrequency from ESC and compute the downscale - * factor */ - downscaleFactorInBS = - asc->m_samplingFrequency / - asc->m_sc.m_eldSpecificConfig.m_downscaledSamplingFrequency; - if (downscaleFactorInBS == 1 || downscaleFactorInBS == 2 || - downscaleFactorInBS == 3 || downscaleFactorInBS == 4) { - downscaleFactor = downscaleFactorInBS; - } - } - } else { - downscaleFactorInBS = 1; - downscaleFactor = 1; - } + downscaleFactorInBS = 1; + downscaleFactor = 1; if (self->downscaleFactorInBS != downscaleFactorInBS) { if (configMode & AC_CM_ALLOC_MEM) { @@ -1724,17 +1702,6 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc, self->streamInfo.bitRate = 0; - if (asc->m_aot == AOT_ER_AAC_ELD) { - if (self->useLdQmfTimeAlign != - asc->m_sc.m_eldSpecificConfig.m_useLdQmfTimeAlign) { - ascChanged = 1; - } - if (configMode & AC_CM_ALLOC_MEM) { - self->useLdQmfTimeAlign = - asc->m_sc.m_eldSpecificConfig.m_useLdQmfTimeAlign; - } - } - self->streamInfo.extAot = asc->m_extensionAudioObjectType; if (self->streamInfo.extSamplingRate != (INT)asc->m_extensionSamplingFrequency) { @@ -1767,21 +1734,6 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc, self->flags[streamIndex] |= (asc->m_hcrFlag) ? AC_ER_HCR : 0; if (asc->m_aot == AOT_ER_AAC_ELD) { - self->mpsEnableCurr = 0; - self->flags[streamIndex] |= AC_ELD; - self->flags[streamIndex] |= - (asc->m_sbrPresentFlag) - ? AC_SBR_PRESENT - : 0; /* Need to set the SBR flag for backward-compatibility - reasons. Even if SBR is not supported. */ - self->flags[streamIndex] |= - (asc->m_sc.m_eldSpecificConfig.m_sbrCrcFlag) ? AC_SBRCRC : 0; - self->flags[streamIndex] |= - (asc->m_sc.m_eldSpecificConfig.m_useLdQmfTimeAlign) ? AC_MPS_PRESENT - : 0; - if (self->mpsApplicable) { - self->mpsEnableCurr = asc->m_sc.m_eldSpecificConfig.m_useLdQmfTimeAlign; - } return AAC_DEC_UNSUPPORTED_ER_FORMAT; } self->flags[streamIndex] |= (asc->m_aot == AOT_ER_AAC_LD) ? AC_LD : 0; @@ -1857,31 +1809,6 @@ 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) { - for (int _el = 0; - _el < (int)self->pUsacConfig[streamIndex]->m_usacNumElements; - _el++) { - int el = elementOffset + _el; - if (IS_USAC_CHANNEL_ELEMENT(self->elements[el])) { - if (usacStereoConfigIndex < 0) { - usacStereoConfigIndex = self->usacStereoConfigIndex[el]; - } else { - if ((usacStereoConfigIndex != self->usacStereoConfigIndex[el]) || - (self->usacStereoConfigIndex[el] > 0)) { - goto bail; - } - } - } - } - - if (usacStereoConfigIndex < 0) { - goto bail; - } - - if (usacStereoConfigIndex == 3) { - self->flags[streamIndex] |= AC_USAC_SCFGI3; - } - } break; default: break; @@ -1894,44 +1821,8 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc, */ switch (asc->m_aot) { case AOT_USAC: - if (self->sbrEnabled) { - const UCHAR map_sbrRatio_2_nAnaBands[] = {16, 24, 32}; - - FDK_ASSERT(asc->m_sc.m_usacConfig.m_sbrRatioIndex > 0); - FDK_ASSERT(streamIndex == 0); - - self->qmfDomain.globalConf.nInputChannels_requested = ascChannels; - self->qmfDomain.globalConf.nOutputChannels_requested = - (usacStereoConfigIndex == 1) ? 2 : ascChannels; - self->qmfDomain.globalConf.flags_requested = 0; - self->qmfDomain.globalConf.nBandsAnalysis_requested = - map_sbrRatio_2_nAnaBands[asc->m_sc.m_usacConfig.m_sbrRatioIndex - - 1]; - self->qmfDomain.globalConf.nBandsSynthesis_requested = 64; - self->qmfDomain.globalConf.nQmfTimeSlots_requested = - (asc->m_sc.m_usacConfig.m_sbrRatioIndex == 1) ? 64 : 32; - self->qmfDomain.globalConf.nQmfOvTimeSlots_requested = - (asc->m_sc.m_usacConfig.m_sbrRatioIndex == 1) ? 12 : 6; - self->qmfDomain.globalConf.nQmfProcBands_requested = 64; - self->qmfDomain.globalConf.nQmfProcChannels_requested = 1; - self->qmfDomain.globalConf.parkChannel = - (usacStereoConfigIndex == 3) ? 1 : 0; - self->qmfDomain.globalConf.parkChannel_requested = - (usacStereoConfigIndex == 3) ? 1 : 0; - self->qmfDomain.globalConf.qmfDomainExplicitConfig = 1; - } break; case AOT_ER_AAC_ELD: - if (self->mpsEnableCurr && - asc->m_sc.m_eldSpecificConfig.m_useLdQmfTimeAlign) { - SAC_INPUT_CONFIG sac_interface = - (self->sbrEnabled && self->hSbrDecoder) ? SAC_INTERFACE_QMF - : SAC_INTERFACE_TIME; - mpegSurroundDecoder_ConfigureQmfDomain( - (CMpegSurroundDecoder *)self->pMpegSurroundDecoder, sac_interface, - (UINT)self->streamInfo.aacSampleRate, asc->m_aot); - self->qmfDomain.globalConf.qmfDomainExplicitConfig = 1; - } break; default: self->qmfDomain.globalConf.qmfDomainExplicitConfig = @@ -2126,15 +2017,6 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc, if (self->pAacDecoderStaticChannelInfo[ch]->pCpeStaticData != NULL) { self->pAacDecoderStaticChannelInfo[ch] - ->pCpeStaticData->jointStereoPersistentData - .spectralCoeffs[ch2] = - self->pAacDecoderStaticChannelInfo[ch] - ->concealmentInfo.spectralCoefficient; - self->pAacDecoderStaticChannelInfo[ch] - ->pCpeStaticData->jointStereoPersistentData.specScale[ch2] = - self->pAacDecoderStaticChannelInfo[ch] - ->concealmentInfo.specScale; - self->pAacDecoderStaticChannelInfo[ch] ->pCpeStaticData->jointStereoPersistentData.scratchBuffer = (FIXP_DBL *)self->pTimeData2; } @@ -2433,14 +2315,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( return AAC_DEC_UNKNOWN; } - /* if last frame was broken and this frame is no independent frame, - * correct decoding is impossible we need to trigger concealment */ - if ((CConcealment_GetLastFrameOk( - &self->pAacDecoderStaticChannelInfo[ch]->concealmentInfo, - 1) == 0) && - !(self->flags[streamIndex] & AC_INDEP)) { - self->frameOK = 0; - } ch++; } } @@ -2901,7 +2775,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( (8) * sizeof(AUDIO_CHANNEL_TYPE)); /* restore */ FDKmemcpy(self->channelIndices, self->channelIndicesPrev, (8) * sizeof(UCHAR)); /* restore */ - self->sbrEnabled = self->sbrEnabledPrev; } else { /* store or restore the number of channels and the corresponding info */ if (self->frameOK && !(flags & AACDEC_CONCEAL)) { @@ -3098,13 +2971,8 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( * following concealment method, mark the frame as erroneous */ { CIcsInfo *pIcsInfo = &pAacDecoderChannelInfo->icsInfo; - CConcealmentInfo *hConcealmentInfo = - &pAacDecoderStaticChannelInfo->concealmentInfo; const int mute_release_active = - (self->frameOK && !(flags & AACDEC_CONCEAL)) && - ((hConcealmentInfo->concealState >= ConcealState_Mute) && - (hConcealmentInfo->cntValidFrames + 1 <= - hConcealmentInfo->pConcealParams->numMuteReleaseFrames)); + (self->frameOK && !(flags & AACDEC_CONCEAL)); const int icsIsInvalid = (GetScaleFactorBandsTransmitted(pIcsInfo) > GetScaleFactorBandsTotal(pIcsInfo)); const int icsInfoUsedinFadeOut = @@ -3133,7 +3001,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( aacDecoder_drcApply( self->hDrcInfo, pAacDecoderChannelInfo, &pAacDecoderStaticChannelInfo->drcData, self->extGain, c, - self->streamInfo.aacSamplesPerFrame, + self->streamInfo.aacSamplesPerFrame ); if (timeDataSize < timeDataChannelOffset * self->aacChannels) { @@ -3144,7 +3012,7 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( !(flags & AACDEC_CONCEAL)) { FDKmemclear(pTimeData + offset, sizeof(FIXP_PCM) * self->streamInfo.aacSamplesPerFrame); - } else + } else { switch (pAacDecoderChannelInfo->renderMode) { case AACDEC_RENDER_IMDCT: @@ -3184,19 +3052,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR CAacDecoder_DecodeFrame( ErrorStatus = AAC_DEC_UNKNOWN; break; } - /* TimeDomainFading */ - if (!CConceal_TDFading_Applied[c]) { - CConceal_TDFading_Applied[c] = CConcealment_TDFading( - self->streamInfo.aacSamplesPerFrame, - &self->pAacDecoderStaticChannelInfo[c], pTimeData + offset, 0); - if (c + 1 < (8) && c < aacChannels - 1) { - /* update next TDNoise Seed to avoid muting in case of Parametric - * Stereo */ - self->pAacDecoderStaticChannelInfo[c + 1] - ->concealmentInfo.TDNoiseSeed = - self->pAacDecoderStaticChannelInfo[c] - ->concealmentInfo.TDNoiseSeed; - } } } } diff --git a/libAACdec/src/aacdecoder_lib.cpp b/libAACdec/src/aacdecoder_lib.cpp index 50c9563..5650dd1 100644 --- a/libAACdec/src/aacdecoder_lib.cpp +++ b/libAACdec/src/aacdecoder_lib.cpp @@ -306,13 +306,6 @@ static INT aacDecoder_FreeMemCallback(void *handle, errTp = TRANSPORTDEC_UNKOWN_ERROR; } - /* free Ram_SbrDecoder and Ram_SbrDecChannel */ - if (self->hSbrDecoder != NULL) { - if (sbrDecoder_FreeMem(&self->hSbrDecoder) != SBRDEC_OK) { - errTp = TRANSPORTDEC_UNKOWN_ERROR; - } - } - /* free pSpatialDec and mpsData */ if (self->pMpegSurroundDecoder != NULL) { if (mpegSurroundDecoder_FreeMem( @@ -344,23 +337,6 @@ static INT aacDecoder_CtrlCFGChangeCallback( return errTp; } -static INT aacDecoder_SbrCallback( - void *handle, HANDLE_FDK_BITSTREAM hBs, const INT sampleRateIn, - const INT sampleRateOut, const INT samplesPerFrame, - const AUDIO_OBJECT_TYPE coreCodec, const MP4_ELEMENT_ID elementID, - const INT elementIndex, const UCHAR harmonicSBR, - const UCHAR stereoConfigIndex, const UCHAR configMode, UCHAR *configChanged, - const INT downscaleFactor) { - HANDLE_SBRDECODER self = (HANDLE_SBRDECODER)handle; - - INT errTp = sbrDecoder_Header(self, hBs, sampleRateIn, sampleRateOut, - samplesPerFrame, coreCodec, elementID, - elementIndex, harmonicSBR, stereoConfigIndex, - configMode, configChanged, downscaleFactor); - - return errTp; -} - static INT aacDecoder_SscCallback(void *handle, HANDLE_FDK_BITSTREAM hBs, const AUDIO_OBJECT_TYPE coreCodec, const INT samplingRate, const INT frameSize, @@ -806,9 +782,6 @@ LINKSPEC_CPP AAC_DECODER_ERROR aacDecoder_SetParam( packed into a helper function which keeps all modules and libs in a consistent state even in the case an error occures. */ errorStatus = setConcealMethod(self, value); - if (errorStatus == AAC_DEC_OK) { - self->concealMethodUser = (CConcealmentMethod)value; - } break; default: @@ -1302,9 +1275,7 @@ aacDecoder_DecodeFrame(HANDLE_AACDECODER self, INT_PCM *pTimeData_extern, if (!self->qmfDomain.globalConf.qmfDomainExplicitConfig && self->mpsEnableCurr) { - SAC_INPUT_CONFIG sac_interface = (self->sbrEnabled && self->hSbrDecoder) - ? SAC_INTERFACE_QMF - : SAC_INTERFACE_TIME; + SAC_INPUT_CONFIG sac_interface = SAC_INTERFACE_TIME; /* needs to be done before first SBR apply. */ mpegSurroundDecoder_ConfigureQmfDomain( (CMpegSurroundDecoder *)self->pMpegSurroundDecoder, sac_interface, @@ -1344,8 +1315,6 @@ aacDecoder_DecodeFrame(HANDLE_AACDECODER self, INT_PCM *pTimeData_extern, frameSize = self->streamInfo.frameSize; sac_interface = SAC_INTERFACE_TIME; - if (self->sbrEnabled && self->hSbrDecoder) - sac_interface = SAC_INTERFACE_QMF; if (self->streamInfo.aot == AOT_USAC) { if (self->flags[0] & AC_USAC_SCFGI3) { sac_interface = SAC_INTERFACE_TIME; @@ -1429,11 +1398,9 @@ aacDecoder_DecodeFrame(HANDLE_AACDECODER self, INT_PCM *pTimeData_extern, /* If SBR and/or MPS is active, the DRC gains are aligned to the QMF domain signal before the QMF synthesis. Therefore the DRC gains need to be delayed by the QMF synthesis delay. */ - if (self->sbrEnabled) drcDelay = 257; if (self->mpsEnableCurr) drcDelay = 257; /* Take into account concealment delay */ - drcDelay += CConcealment_GetDelay(&self->concealCommonData) * - self->streamInfo.frameSize; + drcDelay += 0 * self->streamInfo.frameSize; for (ch = 0; ch < self->streamInfo.numChannels; ch++) { UCHAR mapValue = FDK_chMapDescr_getMapValue( @@ -1450,7 +1417,7 @@ aacDecoder_DecodeFrame(HANDLE_AACDECODER self, INT_PCM *pTimeData_extern, * necessary for FDK_drcDec_ProcessTime, which accepts deinterleaved * audio only. */ if ((self->streamInfo.numChannels > 1) && - (0 || (self->sbrEnabled) || (self->mpsEnableCurr))) { + (0 || (self->mpsEnableCurr))) { /* interleaving/deinterleaving is performed on upper part of * pTimeDataPcmPost. Check if this buffer is large enough. */ if (timeDataPcmPostSize < @@ -1523,7 +1490,7 @@ aacDecoder_DecodeFrame(HANDLE_AACDECODER self, INT_PCM *pTimeData_extern, } INT interleaved = 0; - interleaved |= (self->sbrEnabled) ? 1 : 0; + interleaved |= 0; interleaved |= (self->mpsEnableCurr) ? 1 : 0; /* do PCM post processing */ @@ -1561,7 +1528,7 @@ aacDecoder_DecodeFrame(HANDLE_AACDECODER self, INT_PCM *pTimeData_extern, pcmLimiter_SetSampleRate(self->hLimiter, self->streamInfo.sampleRate); pcmLimiterScale += PCM_OUT_HEADROOM; - if ((self->streamInfo.numChannels == 1) || (self->sbrEnabled) || + if ((self->streamInfo.numChannels == 1) || (self->mpsEnableCurr)) { pInterleaveBuffer = (PCM_LIM *)pTimeDataPcmPost; } else { @@ -1584,7 +1551,7 @@ aacDecoder_DecodeFrame(HANDLE_AACDECODER self, INT_PCM *pTimeData_extern, /* If numChannels = 1 we do not need interleaving. The same applies if SBR or MPS are used, since their output is interleaved already (resampled or not) */ - if ((self->streamInfo.numChannels == 1) || (self->sbrEnabled) || + if ((self->streamInfo.numChannels == 1) || (self->mpsEnableCurr)) { scaleValuesSaturate( pTimeData, pTimeDataPcmPost, diff --git a/libAACdec/src/block.cpp b/libAACdec/src/block.cpp index 95ae2ed..0e78475 100644 --- a/libAACdec/src/block.cpp +++ b/libAACdec/src/block.cpp @@ -242,56 +242,6 @@ void CBlock_ScaleSpectralData(CAacDecoderChannelInfo *pAacDecoderChannelInfo, fMax(SpecScale_window, (int)pSfbScale[window * 16 + band]); } - if (pAacDecoderChannelInfo->pDynData->TnsData.Active && - pAacDecoderChannelInfo->pDynData->TnsData.NumberOfFilters[window] > - 0) { - int filter_index, SpecScale_window_tns; - int tns_start, tns_stop; - - /* Find max scale of TNS bands */ - SpecScale_window_tns = 0; - tns_start = GetMaximumTnsBands(&pAacDecoderChannelInfo->icsInfo, - pSamplingRateInfo->samplingRateIndex); - tns_stop = 0; - for (filter_index = 0; - filter_index < (int)pAacDecoderChannelInfo->pDynData->TnsData - .NumberOfFilters[window]; - filter_index++) { - for (band = pAacDecoderChannelInfo->pDynData->TnsData - .Filter[window][filter_index] - .StartBand; - band < pAacDecoderChannelInfo->pDynData->TnsData - .Filter[window][filter_index] - .StopBand; - band++) { - SpecScale_window_tns = - fMax(SpecScale_window_tns, (int)pSfbScale[window * 16 + band]); - } - /* Find TNS line boundaries for all TNS filters */ - tns_start = - fMin(tns_start, (int)pAacDecoderChannelInfo->pDynData->TnsData - .Filter[window][filter_index] - .StartBand); - tns_stop = - fMax(tns_stop, (int)pAacDecoderChannelInfo->pDynData->TnsData - .Filter[window][filter_index] - .StopBand); - } - SpecScale_window_tns = SpecScale_window_tns + - pAacDecoderChannelInfo->pDynData->TnsData.GainLd; - FDK_ASSERT(tns_stop >= tns_start); - /* Consider existing headroom of all MDCT lines inside the TNS bands. */ - SpecScale_window_tns -= - getScalefactor(pSpectrum + BandOffsets[tns_start], - BandOffsets[tns_stop] - BandOffsets[tns_start]); - if (SpecScale_window <= 17) { - SpecScale_window_tns++; - } - /* Add enough mantissa head room such that the spectrum is still - representable after applying TNS. */ - SpecScale_window = fMax(SpecScale_window, SpecScale_window_tns); - } - /* store scaling of current window */ pSpecScale[window] = SpecScale_window; diff --git a/libAACdec/src/channel.cpp b/libAACdec/src/channel.cpp index f8858ae..25da179 100644 --- a/libAACdec/src/channel.cpp +++ b/libAACdec/src/channel.cpp @@ -277,15 +277,6 @@ void CChannelElement_Decode( for (ch = 0; ch < el_channels; ch++) { if (pAacDecoderChannelInfo[ch]->renderMode == AACDEC_RENDER_LPD) { } else { - if (!(flags & (AC_USAC | AC_RSVD50 | AC_RSV603DA))) { - /* Use same seed for coupled channels (CPE) */ - int pnsCh = (ch > 0) ? L : ch; - CPns_UpdateNoiseState( - &pAacDecoderChannelInfo[ch]->data.aac.PnsData, - pAacDecoderChannelInfo[pnsCh]->data.aac.PnsData.currentSeed, - pAacDecoderChannelInfo[ch]->pComData->pnsRandomSeed); - } - if ((!(flags & (AC_USAC))) || ((flags & (AC_USAC)) && (pAacDecoderChannelInfo[L]->pDynData->specificTo.usac.tns_active == diff --git a/libAACdec/src/usacdec_lpd.cpp b/libAACdec/src/usacdec_lpd.cpp index 2110172..fcf7a76 100644 --- a/libAACdec/src/usacdec_lpd.cpp +++ b/libAACdec/src/usacdec_lpd.cpp @@ -111,8 +111,6 @@ amm-info@iis.fraunhofer.de #include "usacdec_acelp.h" #include "overlapadd.h" -#include "conceal.h" - #include "block.h" #define SF_PITCH_TRACK 6 @@ -1210,8 +1208,7 @@ AAC_DECODER_ERROR CLpdChannelStream_Read( : &lg_table_ccfl[1][lg_table_offset]; int last_lpc_lost = pAacDecoderStaticChannelInfo->last_lpc_lost; - int last_frame_ok = CConcealment_GetLastFrameOk( - &pAacDecoderStaticChannelInfo->concealmentInfo, 1); + int last_frame_ok = 1; INT i_offset; UINT samplingRate; @@ -1392,13 +1389,7 @@ AAC_DECODER_ERROR CLpdChannelStream_Read( } } - if (!CConcealment_GetLastFrameOk( - &pAacDecoderStaticChannelInfo->concealmentInfo, 1)) { - E_LPC_f_lsp_a_conversion( - pAacDecoderChannelInfo->data.usac.lsp_coeff[0], - pAacDecoderChannelInfo->data.usac.lp_coeff[0], - &pAacDecoderChannelInfo->data.usac.lp_coeff_exp[0]); - } else if (pAacDecoderStaticChannelInfo->last_lpd_mode != 0) { + if (pAacDecoderStaticChannelInfo->last_lpd_mode != 0) { if (pAacDecoderStaticChannelInfo->last_lpd_mode == 255) { /* We need it for TCX decoding or ACELP excitation update */ E_LPC_f_lsp_a_conversion( @@ -1426,9 +1417,7 @@ AAC_DECODER_ERROR CLpdChannelStream_Read( FD_SHORT; pAacDecoderChannelInfo->data.usac.lpd_mode_last = 255; - if ((pAacDecoderStaticChannelInfo->last_core_mode != FD_SHORT) && - CConcealment_GetLastFrameOk( - &pAacDecoderStaticChannelInfo->concealmentInfo, 1)) { + if ((pAacDecoderStaticChannelInfo->last_core_mode != FD_SHORT)) { /* USAC Conformance document: short_fac_flag shall be encoded with a value of 1 if the window_sequence of the previous frame was 2 (EIGHT_SHORT_SEQUENCE). @@ -1604,8 +1593,7 @@ AAC_DECODER_ERROR CLpd_RenderTimeSignal( return AAC_DEC_UNKNOWN; } - last_frame_lost = !CConcealment_GetLastFrameOk( - &pAacDecoderStaticChannelInfo->concealmentInfo, 0); + last_frame_lost = 0; /* Maintain LPD mode from previous frame */ if ((pAacDecoderStaticChannelInfo->last_core_mode == FD_LONG) || diff --git a/libAACenc/src/aacenc_lib.cpp b/libAACenc/src/aacenc_lib.cpp index b4ca019..db4076b 100644 --- a/libAACenc/src/aacenc_lib.cpp +++ b/libAACenc/src/aacenc_lib.cpp @@ -198,6 +198,8 @@ typedef struct { UINT userDownscaleFactor; } USER_PARAM; +#define MAX_PAYLOAD_SIZE 256 + /** * SBR extenxion payload struct provides buffers to be filled in SBR encoder * library. @@ -510,7 +512,6 @@ static INT getBufDescIdx(const AACENC_BufDesc *pBufDesc, ****************************************************************************/ AAC_ENCODER_ERROR aacEncDefaultConfig(HANDLE_AACENC_CONFIG hAacConfig, -<<<<<<< HEAD USER_PARAM *config) { /* make reasonable default settings */ FDKaacEnc_AacInitDefaultConfig(hAacConfig); @@ -546,49 +547,6 @@ AAC_ENCODER_ERROR aacEncDefaultConfig(HANDLE_AACENC_CONFIG hAacConfig, config->userAncDataRate = 0; return AAC_ENC_OK; -======= - USER_PARAM *config) -{ - /* make reasonable default settings */ - FDKaacEnc_AacInitDefaultConfig (hAacConfig); - - /* clear configuration structure and copy default settings */ - FDKmemclear(config, sizeof(USER_PARAM)); - - /* copy encoder configuration settings */ - config->nChannels = hAacConfig->nChannels; - config->userAOT = hAacConfig->audioObjectType = AOT_AAC_LC; - config->userSamplerate = hAacConfig->sampleRate; - config->userChannelMode = hAacConfig->channelMode; - config->userBitrate = hAacConfig->bitRate; - config->userBitrateMode = hAacConfig->bitrateMode; - config->userPeakBitrate = (UINT)-1; - config->userBandwidth = hAacConfig->bandWidth; - config->userIntensity = hAacConfig->useIS; - config->userAfterburner = hAacConfig->useRequant; - config->userFramelength = (UINT)-1; - - if (hAacConfig->syntaxFlags & AC_ER_VCB11) { - config->userErTools |= 0x01; - } - if (hAacConfig->syntaxFlags & AC_ER_HCR) { - config->userErTools |= 0x02; - } - - /* initialize transport parameters */ - config->userTpType = TT_UNKNOWN; - config->userTpAmxv = 0; - config->userTpSignaling = 0xFF; /* choose signaling automatically */ - config->userTpNsubFrames = 1; - config->userTpProtection = 0; /* not crc protected*/ - config->userTpHeaderPeriod = 0xFF; /* header period in auto mode */ - config->userPceAdditions = 0; /* no matrix mixdown coefficient */ - config->userMetaDataMode = 0; /* do not embed any meta data info */ - - config->userAncDataRate = 0; - - return AAC_ENC_OK; ->>>>>>> Remove TNS } static INT aacEncoder_LimitBitrate(const HANDLE_TRANSPORTENC hTpEnc, @@ -614,7 +572,7 @@ static INT aacEncoder_LimitBitrate(const HANDLE_TRANSPORTENC hTpEnc, if ((aot == AOT_ER_AAC_ELD) && (syntaxFlags & AC_LD_MPS) && (channelMode == MODE_1)) { bitRate = FDK_MpegsEnc_GetClosestBitRate( - aot, MODE_212, samplingRate, (sbrActive) ? sbrDownSampleRate : 0, + aot, MODE_212, samplingRate, 0, bitRate); } @@ -627,8 +585,7 @@ static INT aacEncoder_LimitBitrate(const HANDLE_TRANSPORTENC hTpEnc, * \hAacConfig Internal encoder config * \return Bitrate */ -static INT FDKaacEnc_GetCBRBitrate(const HANDLE_AACENC_CONFIG hAacConfig, - const INT userSbrRatio) { +static INT FDKaacEnc_GetCBRBitrate(const HANDLE_AACENC_CONFIG hAacConfig) { INT bitrate = FDKaacEnc_GetChannelModeConfiguration(hAacConfig->channelMode) ->nChannelsEff * hAacConfig->sampleRate; @@ -684,7 +641,7 @@ static AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder, return AACENC_INVALID_CONFIG; /* downscaling only allowed for AOT_ER_AAC_ELD */ } - if (config->userDownscaleFactor > 1 && config->userSbrEnabled == 1) { + if (config->userDownscaleFactor > 1) { return AACENC_INVALID_CONFIG; /* downscaling only allowed for AOT_ER_AAC_ELD w/o SBR */ } @@ -704,7 +661,6 @@ static AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder, switch (config->userAOT) { case AOT_MP2_AAC_LC: case AOT_MP2_SBR: - hAacConfig->usePns = 0; FDK_FALLTHROUGH; case AOT_AAC_LC: case AOT_SBR: @@ -778,7 +734,7 @@ static AACENC_ERROR FDKaacEnc_AdjustEncSettings(HANDLE_AACENCODER hAacEncoder, /* Set default bitrate if no external bitrate declared. */ if (config->userBitrate == (UINT)-1) { hAacConfig->bitRate = - FDKaacEnc_GetCBRBitrate(hAacConfig, config->userSbrRatio); + FDKaacEnc_GetCBRBitrate(hAacConfig); } hAacConfig->averageBits = -1; break; diff --git a/libAACenc/src/bitenc.cpp b/libAACenc/src/bitenc.cpp index 2c04acf..0755049 100644 --- a/libAACenc/src/bitenc.cpp +++ b/libAACenc/src/bitenc.cpp @@ -910,7 +910,7 @@ AAC_ENCODER_ERROR FDKaacEnc_ChannelElementWrite( case scale_factor_data: { INT sfDataBits = FDKaacEnc_encodeScaleFactorData( pChMaxValueInSfb, pChSectionData, pChScf, hBitStream, - psyOutChannel[ch]->noiseNrg, psyOutChannel[ch]->isScale, + psyOutChannel[ch]->isScale, chGlobalGain); if ((hBitStream != NULL) && (sfDataBits != (qcOutChannel[ch]->sectionData.scalefacBits))) { diff --git a/libMpegTPDec/src/tpdec_asc.cpp b/libMpegTPDec/src/tpdec_asc.cpp index cb407de..dbc16c9 100644 --- a/libMpegTPDec/src/tpdec_asc.cpp +++ b/libMpegTPDec/src/tpdec_asc.cpp @@ -1544,22 +1544,7 @@ static TRANSPORTDEC_ERROR UsacRsv60DecoderConfig_Parse( usc->element[i].m_noiseFilling = FDKreadBits(hBs, 1); /* end of UsacCoreConfig() */ if (usc->m_sbrRatioIndex > 0) { - if (cb->cbSbr == NULL) { - return TRANSPORTDEC_UNKOWN_ERROR; - } - /* SbrConfig() ISO/IEC FDIS 23003-3 Table 11 */ - usc->element[i].m_harmonicSBR = FDKreadBit(hBs); - usc->element[i].m_interTes = FDKreadBit(hBs); - usc->element[i].m_pvc = FDKreadBit(hBs); - if (cb->cbSbr(cb->cbSbrData, hBs, asc->m_samplingFrequency, - asc->m_extensionSamplingFrequency, - asc->m_samplesPerFrame, asc->m_aot, ID_SCE, - channelElementIdx, usc->element[i].m_harmonicSBR, - usc->element[i].m_stereoConfigIndex, asc->configMode, - &asc->SbrConfigChanged, 1)) { return TRANSPORTDEC_PARSE_ERROR; - } - /* end of SbrConfig() */ } usc->m_nUsacChannels += 1; channelElementIdx++; @@ -1573,61 +1558,7 @@ static TRANSPORTDEC_ERROR UsacRsv60DecoderConfig_Parse( usc->element[i].m_noiseFilling = FDKreadBits(hBs, 1); /* end of UsacCoreConfig() */ if (usc->m_sbrRatioIndex > 0) { - if (cb->cbSbr == NULL) return TRANSPORTDEC_UNKOWN_ERROR; - /* SbrConfig() ISO/IEC FDIS 23003-3 */ - usc->element[i].m_harmonicSBR = FDKreadBit(hBs); - usc->element[i].m_interTes = FDKreadBit(hBs); - usc->element[i].m_pvc = FDKreadBit(hBs); - { - INT bitsToSkip = skipSbrHeader(hBs, 1); - /* read stereoConfigIndex */ - usc->element[i].m_stereoConfigIndex = FDKreadBits(hBs, 2); - /* rewind */ - FDKpushBack(hBs, bitsToSkip + 2); - } - { - MP4_ELEMENT_ID el_type = - (usc->element[i].m_stereoConfigIndex == 1 || - usc->element[i].m_stereoConfigIndex == 2) - ? ID_SCE - : ID_CPE; - if (cb->cbSbr(cb->cbSbrData, hBs, asc->m_samplingFrequency, - asc->m_extensionSamplingFrequency, - asc->m_samplesPerFrame, asc->m_aot, el_type, - channelElementIdx, usc->element[i].m_harmonicSBR, - usc->element[i].m_stereoConfigIndex, asc->configMode, - &asc->SbrConfigChanged, 1)) { - return TRANSPORTDEC_PARSE_ERROR; - } - } - /* end of SbrConfig() */ - - usc->element[i].m_stereoConfigIndex = - FDKreadBits(hBs, 2); /* Needed in RM5 syntax */ - - if (usc->element[i].m_stereoConfigIndex > 0) { - if (cb->cbSsc != NULL) { - int samplesPerFrame = asc->m_samplesPerFrame; - - if (usc->m_sbrRatioIndex == 1) samplesPerFrame <<= 2; - if (usc->m_sbrRatioIndex == 2) - samplesPerFrame = (samplesPerFrame * 8) / 3; - if (usc->m_sbrRatioIndex == 3) samplesPerFrame <<= 1; - - /* Mps212Config() ISO/IEC FDIS 23003-3 */ - if (cb->cbSsc(cb->cbSscData, hBs, asc->m_aot, - asc->m_extensionSamplingFrequency, samplesPerFrame, - usc->element[i].m_stereoConfigIndex, - usc->m_coreSbrFrameLengthIndex, - 0, /* don't know the length */ - asc->configMode, &asc->SacConfigChanged)) { - return TRANSPORTDEC_PARSE_ERROR; - } - /* end of Mps212Config() */ - } else { - return TRANSPORTDEC_UNKOWN_ERROR; - } - } + return TRANSPORTDEC_UNSUPPORTED_FORMAT; } else { usc->element[i].m_stereoConfigIndex = 0; } @@ -1640,19 +1571,7 @@ static TRANSPORTDEC_ERROR UsacRsv60DecoderConfig_Parse( usc->element[i].m_noiseFilling = 0; usc->m_nUsacChannels += 1; if (usc->m_sbrRatioIndex > 0) { - /* Use SBR for upsampling */ - if (cb->cbSbr == NULL) return ErrorStatus = TRANSPORTDEC_UNKOWN_ERROR; - usc->element[i].m_harmonicSBR = (UCHAR)0; - usc->element[i].m_interTes = (UCHAR)0; - usc->element[i].m_pvc = (UCHAR)0; - if (cb->cbSbr(cb->cbSbrData, hBs, asc->m_samplingFrequency, - asc->m_extensionSamplingFrequency, - asc->m_samplesPerFrame, asc->m_aot, ID_LFE, - channelElementIdx, usc->element[i].m_harmonicSBR, - usc->element[i].m_stereoConfigIndex, asc->configMode, - &asc->SbrConfigChanged, 1)) { - return ErrorStatus = TRANSPORTDEC_PARSE_ERROR; - } + return TRANSPORTDEC_UNSUPPORTED_FORMAT; } channelElementIdx++; break; @@ -2080,22 +1999,7 @@ static TRANSPORTDEC_ERROR Drm_xHEAACDecoderConfig( usc->m_nUsacChannels = 1; usc->element[elemIdx].m_noiseFilling = FDKreadBits(hBs, 1); if (usc->m_sbrRatioIndex > 0) { - if (cb == NULL) { - return ErrorStatus; - } - if (cb->cbSbr != NULL) { - usc->element[elemIdx].m_harmonicSBR = FDKreadBit(hBs); - usc->element[elemIdx].m_interTes = FDKreadBit(hBs); - usc->element[elemIdx].m_pvc = FDKreadBit(hBs); - if (cb->cbSbr(cb->cbSbrData, hBs, asc->m_samplingFrequency, - asc->m_extensionSamplingFrequency, - asc->m_samplesPerFrame, asc->m_aot, ID_SCE, elemIdx, - usc->element[elemIdx].m_harmonicSBR, - usc->element[elemIdx].m_stereoConfigIndex, - asc->configMode, &asc->SbrConfigChanged, 1)) { - return ErrorStatus = TRANSPORTDEC_PARSE_ERROR; - } - } + return TRANSPORTDEC_UNSUPPORTED_FORMAT; } break; case 2: /* stereo: ID_USAC_CPE */ @@ -2144,15 +2048,7 @@ static TRANSPORTDEC_ERROR Drm_xHEAACDecoderConfig( usc->element[elemIdx].m_stereoConfigIndex == 2) ? ID_SCE : ID_CPE; - if (cb->cbSbr == NULL) return ErrorStatus = TRANSPORTDEC_UNKOWN_ERROR; - if (cb->cbSbr(cb->cbSbrData, hBs, asc->m_samplingFrequency, - asc->m_extensionSamplingFrequency, - asc->m_samplesPerFrame, asc->m_aot, el_type, elemIdx, - usc->element[elemIdx].m_harmonicSBR, - usc->element[elemIdx].m_stereoConfigIndex, - asc->configMode, &asc->SbrConfigChanged, 1)) { - return ErrorStatus = TRANSPORTDEC_PARSE_ERROR; - } + return TRANSPORTDEC_UNSUPPORTED_FORMAT; } /*usc->element[elemIdx].m_stereoConfigIndex =*/FDKreadBits(hBs, 2); if (usc->element[elemIdx].m_stereoConfigIndex > 0) { diff --git a/libMpegTPEnc/src/tpenc_asc.cpp b/libMpegTPEnc/src/tpenc_asc.cpp index 0b484a0..ec925b1 100644 --- a/libMpegTPEnc/src/tpenc_asc.cpp +++ b/libMpegTPEnc/src/tpenc_asc.cpp @@ -769,87 +769,8 @@ static int transportEnc_writeELDSpecificConfig(HANDLE_FDK_BITSTREAM hBs, FDKwriteBits(hBs, (config->samplingRate == config->extSamplingRate) ? 0 : 1, 1); /* Samplerate Flag */ FDKwriteBits(hBs, (config->flags & CC_SBRCRC) ? 1 : 0, 1); /* SBR CRC flag*/ - - if (cb->cbSbr != NULL) { - const PCE_CONFIGURATION *pPce; - int e, sbrElementIndex = 0; - - pPce = getPceEntry(config->channelMode); - - for (e = 0; e < pPce->num_front_channel_elements + - pPce->num_side_channel_elements + - pPce->num_back_channel_elements + - pPce->num_lfe_channel_elements; - e++) { - if ((pPce->pEl_type[e] == ID_SCE) || (pPce->pEl_type[e] == ID_CPE)) { - cb->cbSbr(cb->cbSbrData, hBs, 0, 0, 0, config->aot, pPce->pEl_type[e], - sbrElementIndex, 0, 0, 0, NULL, 1); - sbrElementIndex++; - } - } - } } - if ((config->flags & CC_SAC) && (cb->cbSsc != NULL)) { - FDKwriteBits(hBs, ELDEXT_LDSAC, 4); - - const INT eldExtLen = - (cb->cbSsc(cb->cbSscData, NULL, config->aot, config->extSamplingRate, 0, - 0, 0, 0, 0, NULL) + - 7) >> - 3; - INT cnt = eldExtLen; - - if (cnt < 0xF) { - FDKwriteBits(hBs, cnt, 4); - } else { - FDKwriteBits(hBs, 0xF, 4); - cnt -= 0xF; - - if (cnt < 0xFF) { - FDKwriteBits(hBs, cnt, 8); - } else { - FDKwriteBits(hBs, 0xFF, 8); - cnt -= 0xFF; - - FDK_ASSERT(cnt <= 0xFFFF); - FDKwriteBits(hBs, cnt, 16); - } - } - - cb->cbSsc(cb->cbSscData, hBs, config->aot, config->extSamplingRate, 0, 0, 0, - 0, 0, NULL); - } - - if (config->downscaleSamplingRate != 0 && - config->downscaleSamplingRate != config->extSamplingRate) { - /* downscale active */ - - /* eldExtLenDsc: Number of bytes for the ELD downscale extension (srIdx - needs 1 byte - + downscaleSamplingRate needs additional 3 bytes) */ - int eldExtLenDsc = 1; - int downscaleSamplingRate = config->downscaleSamplingRate; - FDKwriteBits(hBs, ELDEXT_DOWNSCALEINFO, 4); /* ELDEXT_DOWNSCALEINFO */ - - if ((downscaleSamplingRate != 96000) && (downscaleSamplingRate != 88200) && - (downscaleSamplingRate != 64000) && (downscaleSamplingRate != 48000) && - (downscaleSamplingRate != 44100) && (downscaleSamplingRate != 32000) && - (downscaleSamplingRate != 24000) && (downscaleSamplingRate != 22050) && - (downscaleSamplingRate != 16000) && (downscaleSamplingRate != 12000) && - (downscaleSamplingRate != 11025) && (downscaleSamplingRate != 8000) && - (downscaleSamplingRate != 7350)) { - eldExtLenDsc = 4; /* length extends to 4 if downscaleSamplingRate's value - is not one of the listed values */ - } - - FDKwriteBits(hBs, eldExtLenDsc, 4); - writeSampleRate(hBs, downscaleSamplingRate, 4); - FDKwriteBits(hBs, 0x0, 4); /* fill_nibble */ - } - - FDKwriteBits(hBs, ELDEXT_TERM, 4); /* ELDEXT_TERM */ - return 0; } |