mirror of
https://github.com/mstorsjo/fdk-aac.git
synced 2025-02-14 18:30:39 +01:00
FDKv2 additional fixes am: 9ab67882ec
am: 259a3c5bd5 Change-Id: Iac5c03364819ea0ef7a91cccfc0b62af0b19b612
This commit is contained in:
commit
b2ce5c82bd
@ -396,7 +396,8 @@ static INT aacDecoder_SscCallback(void *handle, HANDLE_FDK_BITSTREAM hBs,
|
|||||||
/* MPS found but invalid or not decodable by this instance */
|
/* MPS found but invalid or not decodable by this instance */
|
||||||
hAacDecoder->mpsEnableCurr = 0;
|
hAacDecoder->mpsEnableCurr = 0;
|
||||||
hAacDecoder->mpsApplicable = 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;
|
errTp = TRANSPORTDEC_PARSE_ERROR;
|
||||||
} else {
|
} else {
|
||||||
errTp = TRANSPORTDEC_OK;
|
errTp = TRANSPORTDEC_OK;
|
||||||
@ -1654,14 +1655,14 @@ aacDecoder_DecodeFrame(HANDLE_AACDECODER self, INT_PCM *pTimeData_extern,
|
|||||||
self->streamInfo.frameSize;
|
self->streamInfo.frameSize;
|
||||||
|
|
||||||
for (ch = 0; ch < self->streamInfo.numChannels; ch++) {
|
for (ch = 0; ch < self->streamInfo.numChannels; ch++) {
|
||||||
int mapValue = FDK_chMapDescr_getMapValue(
|
UCHAR mapValue = FDK_chMapDescr_getMapValue(
|
||||||
&self->mapDescr, (UCHAR)ch, self->chMapIndex);
|
&self->mapDescr, (UCHAR)ch, self->chMapIndex);
|
||||||
reverseInChannelMap[mapValue] = ch;
|
if (mapValue < (8)) reverseInChannelMap[mapValue] = ch;
|
||||||
}
|
}
|
||||||
for (ch = 0; ch < (int)numDrcOutChannels; ch++) {
|
for (ch = 0; ch < (int)numDrcOutChannels; ch++) {
|
||||||
int mapValue = FDK_chMapDescr_getMapValue(
|
UCHAR mapValue = FDK_chMapDescr_getMapValue(
|
||||||
&self->mapDescr, (UCHAR)ch, numDrcOutChannels);
|
&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
|
/* The output of SBR and MPS is interleaved. Deinterleaving may be
|
||||||
|
@ -225,15 +225,18 @@ void CChannelElement_Decode(
|
|||||||
/* apply intensity stereo */ /* modifies pAacDecoderChannelInfo[]->aSpecSfb
|
/* apply intensity stereo */ /* modifies pAacDecoderChannelInfo[]->aSpecSfb
|
||||||
*/
|
*/
|
||||||
if (!(flags & (AC_USAC | AC_RSVD50 | AC_RSV603DA))) {
|
if (!(flags & (AC_USAC | AC_RSVD50 | AC_RSV603DA))) {
|
||||||
CJointStereo_ApplyIS(
|
if ((pAacDecoderChannelInfo[L]->pDynData->RawDataInfo.CommonWindow ==
|
||||||
pAacDecoderChannelInfo,
|
1) &&
|
||||||
GetScaleFactorBandOffsets(&pAacDecoderChannelInfo[L]->icsInfo,
|
(el_channels == 2)) {
|
||||||
pSamplingRateInfo),
|
CJointStereo_ApplyIS(
|
||||||
GetWindowGroupLengthTable(&pAacDecoderChannelInfo[L]->icsInfo),
|
pAacDecoderChannelInfo,
|
||||||
GetWindowGroups(&pAacDecoderChannelInfo[L]->icsInfo),
|
GetScaleFactorBandOffsets(&pAacDecoderChannelInfo[L]->icsInfo,
|
||||||
GetScaleFactorBandsTransmitted(&pAacDecoderChannelInfo[L]->icsInfo),
|
pSamplingRateInfo),
|
||||||
pAacDecoderChannelInfo[L]->pDynData->RawDataInfo.CommonWindow ? 1
|
GetWindowGroupLengthTable(&pAacDecoderChannelInfo[L]->icsInfo),
|
||||||
: 0);
|
GetWindowGroups(&pAacDecoderChannelInfo[L]->icsInfo),
|
||||||
|
GetScaleFactorBandsTransmitted(
|
||||||
|
&pAacDecoderChannelInfo[L]->icsInfo));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} /* maybe_stereo */
|
} /* maybe_stereo */
|
||||||
|
|
||||||
|
@ -478,15 +478,13 @@ void CJointStereo_ApplyMS(
|
|||||||
\param pWindowGroupLength pointer to window group length array.
|
\param pWindowGroupLength pointer to window group length array.
|
||||||
\param windowGroups number of window groups.
|
\param windowGroups number of window groups.
|
||||||
\param scaleFactorBandsTransmitted number of transmitted scalefactor bands.
|
\param scaleFactorBandsTransmitted number of transmitted scalefactor bands.
|
||||||
\param CommonWindow common window bit.
|
|
||||||
\return none
|
\return none
|
||||||
*/
|
*/
|
||||||
void CJointStereo_ApplyIS(CAacDecoderChannelInfo *pAacDecoderChannelInfo[2],
|
void CJointStereo_ApplyIS(CAacDecoderChannelInfo *pAacDecoderChannelInfo[2],
|
||||||
const short *pScaleFactorBandOffsets,
|
const short *pScaleFactorBandOffsets,
|
||||||
const UCHAR *pWindowGroupLength,
|
const UCHAR *pWindowGroupLength,
|
||||||
const int windowGroups,
|
const int windowGroups,
|
||||||
const int scaleFactorBandsTransmitted,
|
const int scaleFactorBandsTransmitted);
|
||||||
const UINT CommonWindow);
|
|
||||||
|
|
||||||
/* aacdec_pns.cpp */
|
/* aacdec_pns.cpp */
|
||||||
int CPns_IsPnsUsed(const CPnsData *pPnsData, const int group, const int band);
|
int CPns_IsPnsUsed(const CPnsData *pPnsData, const int group, const int band);
|
||||||
|
@ -1177,8 +1177,7 @@ void CJointStereo_ApplyIS(CAacDecoderChannelInfo *pAacDecoderChannelInfo[2],
|
|||||||
const SHORT *pScaleFactorBandOffsets,
|
const SHORT *pScaleFactorBandOffsets,
|
||||||
const UCHAR *pWindowGroupLength,
|
const UCHAR *pWindowGroupLength,
|
||||||
const int windowGroups,
|
const int windowGroups,
|
||||||
const int scaleFactorBandsTransmitted,
|
const int scaleFactorBandsTransmitted) {
|
||||||
const UINT CommonWindow) {
|
|
||||||
CJointStereoData *pJointStereoData =
|
CJointStereoData *pJointStereoData =
|
||||||
&pAacDecoderChannelInfo[L]->pComData->jointStereoData;
|
&pAacDecoderChannelInfo[L]->pComData->jointStereoData;
|
||||||
|
|
||||||
@ -1228,7 +1227,7 @@ void CJointStereo_ApplyIS(CAacDecoderChannelInfo *pAacDecoderChannelInfo[2],
|
|||||||
|
|
||||||
rightScale[band] = leftScale[band] + msb + 1;
|
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 */
|
if (CodeBook[band] == INTENSITY_HCB) /* _NOT_ in-phase */
|
||||||
{
|
{
|
||||||
scale = -scale;
|
scale = -scale;
|
||||||
|
@ -2488,7 +2488,7 @@ TRANSPORTDEC_ERROR DrmRawSdcAudioConfig_Parse(
|
|||||||
|
|
||||||
switch (audioCoding) {
|
switch (audioCoding) {
|
||||||
case 0: /* AAC */
|
case 0: /* AAC */
|
||||||
if (coderField >> 2) {
|
if ((coderField >> 2) && (audioMode != 1)) {
|
||||||
self->m_aot = AOT_DRM_SURROUND; /* Set pseudo AOT for Drm Surround */
|
self->m_aot = AOT_DRM_SURROUND; /* Set pseudo AOT for Drm Surround */
|
||||||
} else {
|
} else {
|
||||||
self->m_aot = AOT_DRM_AAC; /* Set pseudo AOT for Drm AAC */
|
self->m_aot = AOT_DRM_AAC; /* Set pseudo AOT for Drm AAC */
|
||||||
|
@ -126,7 +126,6 @@ static TRANSPORTDEC_ERROR CLatmDemux_ReadAudioMuxElement(
|
|||||||
CSTpCallBacks *pTpDecCallbacks, CSAudioSpecificConfig *pAsc,
|
CSTpCallBacks *pTpDecCallbacks, CSAudioSpecificConfig *pAsc,
|
||||||
int *pfConfigFound) {
|
int *pfConfigFound) {
|
||||||
TRANSPORTDEC_ERROR ErrorStatus = TRANSPORTDEC_OK;
|
TRANSPORTDEC_ERROR ErrorStatus = TRANSPORTDEC_OK;
|
||||||
UCHAR applyAsc = pLatmDemux->applyAsc;
|
|
||||||
|
|
||||||
if (m_muxConfigPresent) {
|
if (m_muxConfigPresent) {
|
||||||
pLatmDemux->m_useSameStreamMux = FDKreadBits(bs, 1);
|
pLatmDemux->m_useSameStreamMux = FDKreadBits(bs, 1);
|
||||||
@ -152,7 +151,12 @@ static TRANSPORTDEC_ERROR CLatmDemux_ReadAudioMuxElement(
|
|||||||
goto bail;
|
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;
|
pLatmDemux->newCfgHasAudioPreRoll = 0;
|
||||||
/* with audioPreRoll we must flush before applying new cfg */
|
/* with audioPreRoll we must flush before applying new cfg */
|
||||||
pLatmDemux->applyAsc = 0;
|
pLatmDemux->applyAsc = 0;
|
||||||
@ -223,7 +227,7 @@ static TRANSPORTDEC_ERROR CLatmDemux_ReadAudioMuxElement(
|
|||||||
|
|
||||||
bail:
|
bail:
|
||||||
if (ErrorStatus != TRANSPORTDEC_OK) {
|
if (ErrorStatus != TRANSPORTDEC_OK) {
|
||||||
pLatmDemux->applyAsc = applyAsc;
|
pLatmDemux->applyAsc = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ErrorStatus);
|
return (ErrorStatus);
|
||||||
|
@ -1151,6 +1151,12 @@ static TRANSPORTDEC_ERROR synchronization(HANDLE_TRANSPORTDEC hTp,
|
|||||||
&syncLayerFrameBits, &fConfigFound,
|
&syncLayerFrameBits, &fConfigFound,
|
||||||
&headerBits);
|
&headerBits);
|
||||||
if (TPDEC_IS_FATAL_ERROR(err)) {
|
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;
|
goto bail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -698,6 +698,7 @@ SACDEC_ERROR mpegSurroundDecoder_Config(
|
|||||||
INT coreSbrFrameLengthIndex, INT configBytes, const UCHAR configMode,
|
INT coreSbrFrameLengthIndex, INT configBytes, const UCHAR configMode,
|
||||||
UCHAR *configChanged) {
|
UCHAR *configChanged) {
|
||||||
SACDEC_ERROR err = MPS_OK;
|
SACDEC_ERROR err = MPS_OK;
|
||||||
|
SPATIAL_SPECIFIC_CONFIG spatialSpecificConfig;
|
||||||
|
|
||||||
switch (coreCodec) {
|
switch (coreCodec) {
|
||||||
case AOT_DRM_USAC:
|
case AOT_DRM_USAC:
|
||||||
@ -705,7 +706,6 @@ SACDEC_ERROR mpegSurroundDecoder_Config(
|
|||||||
if (configMode == AC_CM_DET_CFG_CHANGE) {
|
if (configMode == AC_CM_DET_CFG_CHANGE) {
|
||||||
/* In config detection mode write spatial specific config parameters
|
/* In config detection mode write spatial specific config parameters
|
||||||
* into temporarily allocated structure */
|
* into temporarily allocated structure */
|
||||||
SPATIAL_SPECIFIC_CONFIG spatialSpecificConfig;
|
|
||||||
err = SpatialDecParseMps212Config(
|
err = SpatialDecParseMps212Config(
|
||||||
hBs, &spatialSpecificConfig, samplingRate, coreCodec,
|
hBs, &spatialSpecificConfig, samplingRate, coreCodec,
|
||||||
stereoConfigIndex, coreSbrFrameLengthIndex);
|
stereoConfigIndex, coreSbrFrameLengthIndex);
|
||||||
@ -718,9 +718,16 @@ SACDEC_ERROR mpegSurroundDecoder_Config(
|
|||||||
break;
|
break;
|
||||||
case AOT_ER_AAC_ELD:
|
case AOT_ER_AAC_ELD:
|
||||||
case AOT_ER_AAC_LD:
|
case AOT_ER_AAC_LD:
|
||||||
err = SpatialDecParseSpecificConfig(
|
if (configMode == AC_CM_DET_CFG_CHANGE) {
|
||||||
hBs, &pMpegSurroundDecoder->spatialSpecificConfigBackup, configBytes,
|
/* In config detection mode write spatial specific config parameters
|
||||||
coreCodec);
|
* into temporarily allocated structure */
|
||||||
|
err = SpatialDecParseSpecificConfig(hBs, &spatialSpecificConfig,
|
||||||
|
configBytes, coreCodec);
|
||||||
|
} else {
|
||||||
|
err = SpatialDecParseSpecificConfig(
|
||||||
|
hBs, &pMpegSurroundDecoder->spatialSpecificConfigBackup,
|
||||||
|
configBytes, coreCodec);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
err = MPS_UNSUPPORTED_FORMAT;
|
err = MPS_UNSUPPORTED_FORMAT;
|
||||||
|
@ -379,16 +379,22 @@ static UINT huff_enc_1D(HANDLE_FDK_BITSTREAM strm, const DATA_TYPE data_type,
|
|||||||
|
|
||||||
switch (data_type) {
|
switch (data_type) {
|
||||||
case t_CLD:
|
case t_CLD:
|
||||||
part0 = fdk_sacenc_huffPart0Tab.cld[in_data[0]];
|
|
||||||
pHuffTab = fdk_sacenc_huffCLDTab.h1D[dim1];
|
pHuffTab = fdk_sacenc_huffCLDTab.h1D[dim1];
|
||||||
break;
|
break;
|
||||||
case t_ICC:
|
case t_ICC:
|
||||||
part0 = fdk_sacenc_huffPart0Tab.icc[in_data[0]];
|
|
||||||
pHuffTab = fdk_sacenc_huffICCTab.h1D[dim1];
|
pHuffTab = fdk_sacenc_huffICCTab.h1D[dim1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p0_flag) {
|
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));
|
huffBits += FDKwriteBits(strm, HUFF_VALUE(part0), HUFF_LENGTH(part0));
|
||||||
offset = 1;
|
offset = 1;
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ static FIXP_DBL addHighbandEnergies(
|
|||||||
accu += (EnergiesM[slotOut][j] >> scale[0]);
|
accu += (EnergiesM[slotOut][j] >> scale[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nrgTotal = accu >> (scaleEnergies[1] - scale[1]);
|
nrgTotal = fAddSaturate(nrgTotal, accu >> (scaleEnergies[1] - scale[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (nrgTotal);
|
return (nrgTotal);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user