mirror of https://github.com/mstorsjo/fdk-aac.git
Revise bypass mode in SpatialDecApplyParameterSets() to prevent an assert in fDivNorm().
Bug: 176246647 Test: atest android.media.cts.DecoderTestAacFormat android.media.cts.DecoderTestXheAac android.media.cts.DecoderTestAacDrc Change-Id: I198747688f1677b82f27a17a2fcf40229c92b1da
This commit is contained in:
parent
bfd912da32
commit
d6a7375bfa
|
@ -1,7 +1,7 @@
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
Software License for The Fraunhofer FDK AAC Codec Library for Android
|
Software License for The Fraunhofer FDK AAC Codec Library for Android
|
||||||
|
|
||||||
© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||||
Forschung e.V. All rights reserved.
|
Forschung e.V. All rights reserved.
|
||||||
|
|
||||||
1. INTRODUCTION
|
1. INTRODUCTION
|
||||||
|
@ -1098,6 +1098,28 @@ static void SpatialDecApplyBypass(spatialDec *self, FIXP_DBL **hybInputReal,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set internal error and reset error status
|
||||||
|
*
|
||||||
|
* \param self spatialDec handle.
|
||||||
|
* \param bypassMode pointer to bypassMode.
|
||||||
|
* \param err error status.
|
||||||
|
*
|
||||||
|
* \return error status.
|
||||||
|
*/
|
||||||
|
static SACDEC_ERROR SpatialDecSetInternalError(spatialDec *self,
|
||||||
|
int *bypassMode,
|
||||||
|
SACDEC_ERROR err) {
|
||||||
|
*bypassMode = 1;
|
||||||
|
|
||||||
|
if (self->errInt == MPS_OK) {
|
||||||
|
/* store internal error before it gets overwritten */
|
||||||
|
self->errInt = err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return MPS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
Functionname: SpatialDecApplyParameterSets
|
Functionname: SpatialDecApplyParameterSets
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
@ -1118,7 +1140,7 @@ static SACDEC_ERROR SpatialDecApplyParameterSets(
|
||||||
const FDK_channelMapDescr *const mapDescr) {
|
const FDK_channelMapDescr *const mapDescr) {
|
||||||
SACDEC_ERROR err = MPS_OK;
|
SACDEC_ERROR err = MPS_OK;
|
||||||
|
|
||||||
FIXP_SGL alpha;
|
FIXP_SGL alpha = FL2FXCONST_SGL(0.0);
|
||||||
|
|
||||||
int ts;
|
int ts;
|
||||||
int ch;
|
int ch;
|
||||||
|
@ -1141,20 +1163,22 @@ static SACDEC_ERROR SpatialDecApplyParameterSets(
|
||||||
ts++, ts_io++) {
|
ts++, ts_io++) {
|
||||||
int currSlot = frame->paramSlot[ps];
|
int currSlot = frame->paramSlot[ps];
|
||||||
|
|
||||||
|
err = (currSlot < ts) ? MPS_WRONG_PARAMETERSETS : MPS_OK;
|
||||||
|
if (err != MPS_OK) {
|
||||||
|
err = SpatialDecSetInternalError(self, &bypassMode, err);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get new parameter set
|
* Get new parameter set
|
||||||
*/
|
*/
|
||||||
if (ts == prevSlot + 1) {
|
if (ts == prevSlot + 1) {
|
||||||
err = SpatialDecCalculateM1andM2(self, ps,
|
if (bypassMode == 0) {
|
||||||
frame); /* input: ottCLD, ottICC, ... */
|
err = SpatialDecCalculateM1andM2(
|
||||||
|
self, ps, frame); /* input: ottCLD, ottICC, ... */
|
||||||
/* output: M1param(Real/Imag), M2(Real/Imag) */
|
/* output: M1param(Real/Imag), M2(Real/Imag) */
|
||||||
if (err != MPS_OK) {
|
if (err != MPS_OK) {
|
||||||
bypassMode = 1;
|
err = SpatialDecSetInternalError(self, &bypassMode, err);
|
||||||
if (self->errInt == MPS_OK) {
|
|
||||||
/* store internal error befor it gets overwritten */
|
|
||||||
self->errInt = err;
|
|
||||||
}
|
}
|
||||||
err = MPS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ps == 0) && (self->bOverwriteM1M2prev != 0)) {
|
if ((ps == 0) && (self->bOverwriteM1M2prev != 0)) {
|
||||||
|
@ -1168,13 +1192,16 @@ static SACDEC_ERROR SpatialDecApplyParameterSets(
|
||||||
self->bOverwriteM1M2prev = 0;
|
self->bOverwriteM1M2prev = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bypassMode == 0) {
|
||||||
SpatialDecSmoothM1andM2(
|
SpatialDecSmoothM1andM2(
|
||||||
self, frame,
|
self, frame,
|
||||||
ps); /* input: M1param(Real/Imag)(Prev), M2(Real/Imag)(Prev) */
|
ps); /* input: M1param(Real/Imag)(Prev), M2(Real/Imag)(Prev) */
|
||||||
/* output: M1param(Real/Imag), M2(Real/Imag) */
|
} /* output: M1param(Real/Imag), M2(Real/Imag) */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bypassMode == 0) {
|
||||||
alpha = FX_DBL2FX_SGL(fDivNorm(ts - prevSlot, currSlot - prevSlot));
|
alpha = FX_DBL2FX_SGL(fDivNorm(ts - prevSlot, currSlot - prevSlot));
|
||||||
|
}
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case INPUTMODE_QMF_SBR:
|
case INPUTMODE_QMF_SBR:
|
||||||
|
@ -1360,7 +1387,7 @@ static SACDEC_ERROR SpatialDecApplyParameterSets(
|
||||||
} /* !self->tempShapeConfig == 1 */
|
} /* !self->tempShapeConfig == 1 */
|
||||||
} /* !bypassMode */
|
} /* !bypassMode */
|
||||||
|
|
||||||
if (self->phaseCoding == 1) {
|
if ((self->phaseCoding == 1) && (bypassMode == 0)) {
|
||||||
/* only if bsPhaseCoding == 1 and bsResidualCoding == 0 */
|
/* only if bsPhaseCoding == 1 and bsResidualCoding == 0 */
|
||||||
|
|
||||||
SpatialDecApplyPhase(
|
SpatialDecApplyPhase(
|
||||||
|
|
Loading…
Reference in New Issue