mirror of https://github.com/mstorsjo/fdk-aac.git
Fix nrgGain_e update in equalizeFiltBufferExp(). Prevents negative shift exponents in calculateSbrEnvelope().
Bug: 131430997 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I66ad54dae0fa1d414d8b2b9a9e0b6145cce4042d
This commit is contained in:
parent
ade11a1d6f
commit
54cd15bd80
|
@ -1831,7 +1831,8 @@ static void equalizeFiltBufferExp(
|
||||||
diff = (int)(nrgGain_e[band] - filtBuffer_e[band]);
|
diff = (int)(nrgGain_e[band] - filtBuffer_e[band]);
|
||||||
if (diff > 0) {
|
if (diff > 0) {
|
||||||
filtBuffer[band] >>=
|
filtBuffer[band] >>=
|
||||||
diff; /* Compensate for the scale change by shifting the mantissa. */
|
fMin(diff, DFRACT_BITS - 1); /* Compensate for the scale change by
|
||||||
|
shifting the mantissa. */
|
||||||
filtBuffer_e[band] += diff; /* New gain is bigger, use its exponent */
|
filtBuffer_e[band] += diff; /* New gain is bigger, use its exponent */
|
||||||
} else if (diff < 0) {
|
} else if (diff < 0) {
|
||||||
/* The buffered gains seem to be larger, but maybe there
|
/* The buffered gains seem to be larger, but maybe there
|
||||||
|
@ -1851,8 +1852,8 @@ static void equalizeFiltBufferExp(
|
||||||
filtBuffer_e[band] -= reserve; /* Compensate in the exponent: */
|
filtBuffer_e[band] -= reserve; /* Compensate in the exponent: */
|
||||||
|
|
||||||
/* For the remaining difference, change the new gain value */
|
/* For the remaining difference, change the new gain value */
|
||||||
diff = fixMin(-(reserve + diff), DFRACT_BITS - 1);
|
diff = -(reserve + diff);
|
||||||
nrgGain[band] >>= diff;
|
nrgGain[band] >>= fMin(diff, DFRACT_BITS - 1);
|
||||||
nrgGain_e[band] += diff;
|
nrgGain_e[band] += diff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue