1
0
mirror of https://github.com/mstorsjo/fdk-aac.git synced 2025-06-05 22:39:13 +02:00

Merge PQ1A.181205.006 from Pi-QPR1-Release into ToT for Pi-Platform release.\n\nBUG: 120448245

Change-Id: I1d3ce7e7d198f3256d3ecbd932f8d6f9977ba16d
This commit is contained in:
Bill Rassieur
2018-12-04 16:59:15 +00:00
3 changed files with 57 additions and 45 deletions

View File

@@ -27,6 +27,9 @@ cc_library_static {
misc_undefined:["unsigned-integer-overflow", "signed-integer-overflow"], misc_undefined:["unsigned-integer-overflow", "signed-integer-overflow"],
cfi: true, cfi: true,
}, },
shared_libs: [
"liblog",
],
export_include_dirs: [ export_include_dirs: [
"libAACdec/include", "libAACdec/include",
"libAACenc/include", "libAACenc/include",

View File

@@ -1630,17 +1630,9 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
aacChannelsOffset = 0; aacChannelsOffset = 0;
aacChannelsOffsetIdx = 0; aacChannelsOffsetIdx = 0;
elementOffset = 0; elementOffset = 0;
if (configMode & AC_CM_ALLOC_MEM) { if ((ascChannels <= 0) || (ascChannels > (8)) ||
if ((ascChannels <= 0) || (asc->m_channelConfiguration > AACDEC_MAX_CH_CONF)) {
(asc->m_channelConfiguration > AACDEC_MAX_CH_CONF)) { return AAC_DEC_UNSUPPORTED_CHANNELCONFIG;
return AAC_DEC_UNSUPPORTED_CHANNELCONFIG;
}
if ((ascChannels + aacChannelsOffsetIdx) > ((8) * 2)) {
return AAC_DEC_UNSUPPORTED_CHANNELCONFIG;
}
if ((ascChannels + aacChannelsOffset) > (8)) {
return AAC_DEC_UNSUPPORTED_CHANNELCONFIG;
}
} }
/* Set syntax flags */ /* Set syntax flags */
@@ -2055,17 +2047,12 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
if (self->flags[streamIndex] & (AC_RSV603DA | AC_USAC)) { if (self->flags[streamIndex] & (AC_RSV603DA | AC_USAC)) {
_numElements = (int)asc->m_sc.m_usacConfig.m_usacNumElements; _numElements = (int)asc->m_sc.m_usacConfig.m_usacNumElements;
} }
if (self->flags[streamIndex] & (AC_ER | AC_LD | AC_ELD)) {
_numElements = (asc->m_channelConfiguration == 7)
? 8
: asc->m_channelConfiguration;
}
for (int _el = 0; _el < _numElements; _el++) { for (int _el = 0; _el < _numElements; _el++) {
int el_channels = 0; int el_channels = 0;
int el = elementOffset + _el; int el = elementOffset + _el;
if (self->flags[streamIndex] & if (self->flags[streamIndex] &
(AC_ELD | AC_RSV603DA | AC_USAC | AC_RSVD50)) { (AC_ER | AC_LD | AC_ELD | AC_RSV603DA | AC_USAC | AC_RSVD50)) {
if (ch >= ascChannels) { if (ch >= ascChannels) {
break; break;
} }
@@ -2115,7 +2102,9 @@ CAacDecoder_Init(HANDLE_AACDECODER self, const CSAudioSpecificConfig *asc,
(SPECTRAL_PTR)&self->workBufferCore2[ch * 1024]; (SPECTRAL_PTR)&self->workBufferCore2[ch * 1024];
if (el_channels == 2) { if (el_channels == 2) {
FDK_ASSERT(ch < (8) - 1); if (ch >= (8) - 1) {
return AAC_DEC_UNSUPPORTED_CHANNELCONFIG;
}
self->pAacDecoderChannelInfo[ch + 1]->pComData = self->pAacDecoderChannelInfo[ch + 1]->pComData =
self->pAacDecoderChannelInfo[ch]->pComData; self->pAacDecoderChannelInfo[ch]->pComData;
self->pAacDecoderChannelInfo[ch + 1]->pComStaticData = self->pAacDecoderChannelInfo[ch + 1]->pComStaticData =

View File

@@ -118,6 +118,10 @@ amm-info@iis.fraunhofer.de
\sa lppTransposer(), main_audio.cpp, sbr_scale.h, \ref documentationOverview \sa lppTransposer(), main_audio.cpp, sbr_scale.h, \ref documentationOverview
*/ */
#ifdef __ANDROID__
#include "log/log.h"
#endif
#include "lpp_tran.h" #include "lpp_tran.h"
#include "sbr_ram.h" #include "sbr_ram.h"
@@ -295,7 +299,6 @@ void lppTransposer(
int ovLowBandShift; int ovLowBandShift;
int lowBandShift; int lowBandShift;
/* int ovHighBandShift;*/ /* int ovHighBandShift;*/
int targetStopBand;
alphai[0] = FL2FXCONST_SGL(0.0f); alphai[0] = FL2FXCONST_SGL(0.0f);
alphai[1] = FL2FXCONST_SGL(0.0f); alphai[1] = FL2FXCONST_SGL(0.0f);
@@ -311,25 +314,34 @@ void lppTransposer(
autoCorrLength = pSettings->nCols + pSettings->overlap; autoCorrLength = pSettings->nCols + pSettings->overlap;
/* Set upper subbands to zero: if (pSettings->noOfPatches > 0) {
This is required in case that the patches do not cover the complete /* Set upper subbands to zero:
highband (because the last patch would be too short). Possible This is required in case that the patches do not cover the complete
optimization: Clearing bands up to usb would be sufficient here. */ highband (because the last patch would be too short). Possible
targetStopBand = patchParam[pSettings->noOfPatches - 1].targetStartBand + optimization: Clearing bands up to usb would be sufficient here. */
patchParam[pSettings->noOfPatches - 1].numBandsInPatch; int targetStopBand =
patchParam[pSettings->noOfPatches - 1].targetStartBand +
patchParam[pSettings->noOfPatches - 1].numBandsInPatch;
int memSize = ((64) - targetStopBand) * sizeof(FIXP_DBL); int memSize = ((64) - targetStopBand) * sizeof(FIXP_DBL);
if (!useLP) { if (!useLP) {
for (i = startSample; i < stopSampleClear; i++) { for (i = startSample; i < stopSampleClear; i++) {
FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize); FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize);
FDKmemclear(&qmfBufferImag[i][targetStopBand], memSize); FDKmemclear(&qmfBufferImag[i][targetStopBand], memSize);
} }
} else { } else {
for (i = startSample; i < stopSampleClear; i++) { for (i = startSample; i < stopSampleClear; i++) {
FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize); FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize);
}
} }
} }
#ifdef __ANDROID__
else {
// Safetynet logging
android_errorWriteLog(0x534e4554, "112160868");
}
#endif
/* init bwIndex for each patch */ /* init bwIndex for each patch */
FDKmemclear(bwIndex, sizeof(bwIndex)); FDKmemclear(bwIndex, sizeof(bwIndex));
@@ -874,7 +886,6 @@ void lppTransposerHBE(
int ovLowBandShift; int ovLowBandShift;
int lowBandShift; int lowBandShift;
/* int ovHighBandShift;*/ /* int ovHighBandShift;*/
int targetStopBand;
alphai[0] = FL2FXCONST_SGL(0.0f); alphai[0] = FL2FXCONST_SGL(0.0f);
alphai[1] = FL2FXCONST_SGL(0.0f); alphai[1] = FL2FXCONST_SGL(0.0f);
@@ -889,19 +900,28 @@ void lppTransposerHBE(
autoCorrLength = pSettings->nCols + pSettings->overlap; autoCorrLength = pSettings->nCols + pSettings->overlap;
/* Set upper subbands to zero: if (pSettings->noOfPatches > 0) {
This is required in case that the patches do not cover the complete /* Set upper subbands to zero:
highband (because the last patch would be too short). Possible This is required in case that the patches do not cover the complete
optimization: Clearing bands up to usb would be sufficient here. */ highband (because the last patch would be too short). Possible
targetStopBand = patchParam[pSettings->noOfPatches - 1].targetStartBand + optimization: Clearing bands up to usb would be sufficient here. */
patchParam[pSettings->noOfPatches - 1].numBandsInPatch; int targetStopBand =
patchParam[pSettings->noOfPatches - 1].targetStartBand +
patchParam[pSettings->noOfPatches - 1].numBandsInPatch;
int memSize = ((64) - targetStopBand) * sizeof(FIXP_DBL); int memSize = ((64) - targetStopBand) * sizeof(FIXP_DBL);
for (i = startSample; i < stopSampleClear; i++) { for (i = startSample; i < stopSampleClear; i++) {
FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize); FDKmemclear(&qmfBufferReal[i][targetStopBand], memSize);
FDKmemclear(&qmfBufferImag[i][targetStopBand], memSize); FDKmemclear(&qmfBufferImag[i][targetStopBand], memSize);
}
} }
#ifdef __ANDROID__
else {
// Safetynet logging
android_errorWriteLog(0x534e4554, "112160868");
}
#endif
/* /*
Calc common low band scale factor Calc common low band scale factor