1
0
mirror of https://github.com/mstorsjo/fdk-aac.git synced 2025-02-07 15:18:48 +01:00

Snap for 4765094 from 9ab67882eca7454dc001e158bc1e6e2219d6650b to pi-release

Change-Id: Iecf0e5905c400a1b43555619b5bf7e1823f15f48
This commit is contained in:
android-build-team Robot 2018-05-06 07:23:21 +00:00
commit 2fd44f2027
10 changed files with 55 additions and 31 deletions

View File

@ -396,7 +396,8 @@ static INT aacDecoder_SscCallback(void *handle, HANDLE_FDK_BITSTREAM hBs,
/* MPS found but invalid or not decodable by this instance */
hAacDecoder->mpsEnableCurr = 0;
hAacDecoder->mpsApplicable = 0;
if ((coreCodec == AOT_USAC) || IS_LOWDELAY(coreCodec)) {
if ((coreCodec == AOT_USAC) || (coreCodec == AOT_DRM_USAC) ||
IS_LOWDELAY(coreCodec)) {
errTp = TRANSPORTDEC_PARSE_ERROR;
} else {
errTp = TRANSPORTDEC_OK;
@ -1654,14 +1655,14 @@ aacDecoder_DecodeFrame(HANDLE_AACDECODER self, INT_PCM *pTimeData_extern,
self->streamInfo.frameSize;
for (ch = 0; ch < self->streamInfo.numChannels; ch++) {
int mapValue = FDK_chMapDescr_getMapValue(
UCHAR mapValue = FDK_chMapDescr_getMapValue(
&self->mapDescr, (UCHAR)ch, self->chMapIndex);
reverseInChannelMap[mapValue] = ch;
if (mapValue < (8)) reverseInChannelMap[mapValue] = ch;
}
for (ch = 0; ch < (int)numDrcOutChannels; ch++) {
int mapValue = FDK_chMapDescr_getMapValue(
UCHAR mapValue = FDK_chMapDescr_getMapValue(
&self->mapDescr, (UCHAR)ch, numDrcOutChannels);
reverseOutChannelMap[mapValue] = ch;
if (mapValue < (8)) reverseOutChannelMap[mapValue] = ch;
}
/* The output of SBR and MPS is interleaved. Deinterleaving may be

View File

@ -225,15 +225,18 @@ void CChannelElement_Decode(
/* apply intensity stereo */ /* modifies pAacDecoderChannelInfo[]->aSpecSfb
*/
if (!(flags & (AC_USAC | AC_RSVD50 | AC_RSV603DA))) {
CJointStereo_ApplyIS(
pAacDecoderChannelInfo,
GetScaleFactorBandOffsets(&pAacDecoderChannelInfo[L]->icsInfo,
pSamplingRateInfo),
GetWindowGroupLengthTable(&pAacDecoderChannelInfo[L]->icsInfo),
GetWindowGroups(&pAacDecoderChannelInfo[L]->icsInfo),
GetScaleFactorBandsTransmitted(&pAacDecoderChannelInfo[L]->icsInfo),
pAacDecoderChannelInfo[L]->pDynData->RawDataInfo.CommonWindow ? 1
: 0);
if ((pAacDecoderChannelInfo[L]->pDynData->RawDataInfo.CommonWindow ==
1) &&
(el_channels == 2)) {
CJointStereo_ApplyIS(
pAacDecoderChannelInfo,
GetScaleFactorBandOffsets(&pAacDecoderChannelInfo[L]->icsInfo,
pSamplingRateInfo),
GetWindowGroupLengthTable(&pAacDecoderChannelInfo[L]->icsInfo),
GetWindowGroups(&pAacDecoderChannelInfo[L]->icsInfo),
GetScaleFactorBandsTransmitted(
&pAacDecoderChannelInfo[L]->icsInfo));
}
}
} /* maybe_stereo */

View File

@ -478,15 +478,13 @@ void CJointStereo_ApplyMS(
\param pWindowGroupLength pointer to window group length array.
\param windowGroups number of window groups.
\param scaleFactorBandsTransmitted number of transmitted scalefactor bands.
\param CommonWindow common window bit.
\return none
*/
void CJointStereo_ApplyIS(CAacDecoderChannelInfo *pAacDecoderChannelInfo[2],
const short *pScaleFactorBandOffsets,
const UCHAR *pWindowGroupLength,
const int windowGroups,
const int scaleFactorBandsTransmitted,
const UINT CommonWindow);
const int scaleFactorBandsTransmitted);
/* aacdec_pns.cpp */
int CPns_IsPnsUsed(const CPnsData *pPnsData, const int group, const int band);

View File

@ -1177,8 +1177,7 @@ void CJointStereo_ApplyIS(CAacDecoderChannelInfo *pAacDecoderChannelInfo[2],
const SHORT *pScaleFactorBandOffsets,
const UCHAR *pWindowGroupLength,
const int windowGroups,
const int scaleFactorBandsTransmitted,
const UINT CommonWindow) {
const int scaleFactorBandsTransmitted) {
CJointStereoData *pJointStereoData =
&pAacDecoderChannelInfo[L]->pComData->jointStereoData;
@ -1228,7 +1227,7 @@ void CJointStereo_ApplyIS(CAacDecoderChannelInfo *pAacDecoderChannelInfo[2],
rightScale[band] = leftScale[band] + msb + 1;
if (CommonWindow && (pJointStereoData->MsUsed[band] & groupMask)) {
if (pJointStereoData->MsUsed[band] & groupMask) {
if (CodeBook[band] == INTENSITY_HCB) /* _NOT_ in-phase */
{
scale = -scale;

View File

@ -2488,7 +2488,7 @@ TRANSPORTDEC_ERROR DrmRawSdcAudioConfig_Parse(
switch (audioCoding) {
case 0: /* AAC */
if (coderField >> 2) {
if ((coderField >> 2) && (audioMode != 1)) {
self->m_aot = AOT_DRM_SURROUND; /* Set pseudo AOT for Drm Surround */
} else {
self->m_aot = AOT_DRM_AAC; /* Set pseudo AOT for Drm AAC */

View File

@ -126,7 +126,6 @@ static TRANSPORTDEC_ERROR CLatmDemux_ReadAudioMuxElement(
CSTpCallBacks *pTpDecCallbacks, CSAudioSpecificConfig *pAsc,
int *pfConfigFound) {
TRANSPORTDEC_ERROR ErrorStatus = TRANSPORTDEC_OK;
UCHAR applyAsc = pLatmDemux->applyAsc;
if (m_muxConfigPresent) {
pLatmDemux->m_useSameStreamMux = FDKreadBits(bs, 1);
@ -152,7 +151,12 @@ static TRANSPORTDEC_ERROR CLatmDemux_ReadAudioMuxElement(
goto bail;
}
if (pLatmDemux->newCfgHasAudioPreRoll) {
/* Allow flushing only when audioPreroll functionality is enabled in
* current and new config otherwise the new config can be applied
* immediately. */
if (pAsc->m_sc.m_usacConfig.element[0]
.extElement.usacExtElementHasAudioPreRoll &&
pLatmDemux->newCfgHasAudioPreRoll) {
pLatmDemux->newCfgHasAudioPreRoll = 0;
/* with audioPreRoll we must flush before applying new cfg */
pLatmDemux->applyAsc = 0;
@ -223,7 +227,7 @@ static TRANSPORTDEC_ERROR CLatmDemux_ReadAudioMuxElement(
bail:
if (ErrorStatus != TRANSPORTDEC_OK) {
pLatmDemux->applyAsc = applyAsc;
pLatmDemux->applyAsc = 1;
}
return (ErrorStatus);

View File

@ -1151,6 +1151,12 @@ static TRANSPORTDEC_ERROR synchronization(HANDLE_TRANSPORTDEC hTp,
&syncLayerFrameBits, &fConfigFound,
&headerBits);
if (TPDEC_IS_FATAL_ERROR(err)) {
/* Rewind - TPDEC_SYNCSKIP, in order to look for a synch one bit ahead
* next time. Ensure that the bit amount lands at a multiple of
* TPDEC_SYNCSKIP. */
FDKpushBiDirectional(
hBs, -headerBits + TPDEC_SYNCSKIP + (bitsAvail % TPDEC_SYNCSKIP));
goto bail;
}
}

View File

@ -698,6 +698,7 @@ SACDEC_ERROR mpegSurroundDecoder_Config(
INT coreSbrFrameLengthIndex, INT configBytes, const UCHAR configMode,
UCHAR *configChanged) {
SACDEC_ERROR err = MPS_OK;
SPATIAL_SPECIFIC_CONFIG spatialSpecificConfig;
switch (coreCodec) {
case AOT_DRM_USAC:
@ -705,7 +706,6 @@ SACDEC_ERROR mpegSurroundDecoder_Config(
if (configMode == AC_CM_DET_CFG_CHANGE) {
/* In config detection mode write spatial specific config parameters
* into temporarily allocated structure */
SPATIAL_SPECIFIC_CONFIG spatialSpecificConfig;
err = SpatialDecParseMps212Config(
hBs, &spatialSpecificConfig, samplingRate, coreCodec,
stereoConfigIndex, coreSbrFrameLengthIndex);
@ -718,9 +718,16 @@ SACDEC_ERROR mpegSurroundDecoder_Config(
break;
case AOT_ER_AAC_ELD:
case AOT_ER_AAC_LD:
err = SpatialDecParseSpecificConfig(
hBs, &pMpegSurroundDecoder->spatialSpecificConfigBackup, configBytes,
coreCodec);
if (configMode == AC_CM_DET_CFG_CHANGE) {
/* In config detection mode write spatial specific config parameters
* into temporarily allocated structure */
err = SpatialDecParseSpecificConfig(hBs, &spatialSpecificConfig,
configBytes, coreCodec);
} else {
err = SpatialDecParseSpecificConfig(
hBs, &pMpegSurroundDecoder->spatialSpecificConfigBackup,
configBytes, coreCodec);
}
break;
default:
err = MPS_UNSUPPORTED_FORMAT;

View File

@ -379,16 +379,22 @@ static UINT huff_enc_1D(HANDLE_FDK_BITSTREAM strm, const DATA_TYPE data_type,
switch (data_type) {
case t_CLD:
part0 = fdk_sacenc_huffPart0Tab.cld[in_data[0]];
pHuffTab = fdk_sacenc_huffCLDTab.h1D[dim1];
break;
case t_ICC:
part0 = fdk_sacenc_huffPart0Tab.icc[in_data[0]];
pHuffTab = fdk_sacenc_huffICCTab.h1D[dim1];
break;
}
if (p0_flag) {
switch (data_type) {
case t_CLD:
part0 = fdk_sacenc_huffPart0Tab.cld[in_data[0]];
break;
case t_ICC:
part0 = fdk_sacenc_huffPart0Tab.icc[in_data[0]];
break;
}
huffBits += FDKwriteBits(strm, HUFF_VALUE(part0), HUFF_LENGTH(part0));
offset = 1;
}

View File

@ -366,7 +366,7 @@ static FIXP_DBL addHighbandEnergies(
accu += (EnergiesM[slotOut][j] >> scale[0]);
}
}
nrgTotal = accu >> (scaleEnergies[1] - scale[1]);
nrgTotal = fAddSaturate(nrgTotal, accu >> (scaleEnergies[1] - scale[1]));
}
return (nrgTotal);