aboutsummaryrefslogtreecommitdiffstats
path: root/libSBRdec/src/env_calc.cpp
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-10-22 03:10:23 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-10-22 03:10:23 +0000
commitb3ccda1719a116f649dae3316b0eb6d33c6ef8f7 (patch)
treefa7778872b05e66a9aeddce2a0fc1d7deab8c770 /libSBRdec/src/env_calc.cpp
parent56b78e9be81bd98878772b46510c771a5036b70d (diff)
parentfc8faa38d90380adfb61b2b280a36c73369c9aff (diff)
downloadfdk-aac-b3ccda1719a116f649dae3316b0eb6d33c6ef8f7.tar.gz
fdk-aac-b3ccda1719a116f649dae3316b0eb6d33c6ef8f7.tar.bz2
fdk-aac-b3ccda1719a116f649dae3316b0eb6d33c6ef8f7.zip
Snap for 5956624 from fc8faa38d90380adfb61b2b280a36c73369c9aff to rvc-release
Change-Id: I90c7f7de4ed5bb04e355e181028c850f6e95d8ad
Diffstat (limited to 'libSBRdec/src/env_calc.cpp')
-rw-r--r--libSBRdec/src/env_calc.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/libSBRdec/src/env_calc.cpp b/libSBRdec/src/env_calc.cpp
index c34ce96..41c9e88 100644
--- a/libSBRdec/src/env_calc.cpp
+++ b/libSBRdec/src/env_calc.cpp
@@ -739,7 +739,8 @@ static void apply_inter_tes(FIXP_DBL **qmfReal, FIXP_DBL **qmfImag,
fMin(DFRACT_BITS - 1, new_summand_sf - total_power_high_after_sf);
total_power_high_after_sf = new_summand_sf;
} else if (new_summand_sf < total_power_high_after_sf) {
- subsample_power_high[i] >>= total_power_high_after_sf - new_summand_sf;
+ subsample_power_high[i] >>=
+ fMin(DFRACT_BITS - 1, total_power_high_after_sf - new_summand_sf);
}
total_power_high_after += subsample_power_high[i] >> preShift2;
}
@@ -1831,7 +1832,8 @@ static void equalizeFiltBufferExp(
diff = (int)(nrgGain_e[band] - filtBuffer_e[band]);
if (diff > 0) {
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 */
} else if (diff < 0) {
/* The buffered gains seem to be larger, but maybe there
@@ -1851,8 +1853,8 @@ static void equalizeFiltBufferExp(
filtBuffer_e[band] -= reserve; /* Compensate in the exponent: */
/* For the remaining difference, change the new gain value */
- diff = fixMin(-(reserve + diff), DFRACT_BITS - 1);
- nrgGain[band] >>= diff;
+ diff = -(reserve + diff);
+ nrgGain[band] >>= fMin(diff, DFRACT_BITS - 1);
nrgGain_e[band] += diff;
}
}