aboutsummaryrefslogtreecommitdiffstats
path: root/libSBRdec
diff options
context:
space:
mode:
Diffstat (limited to 'libSBRdec')
-rw-r--r--libSBRdec/src/env_calc.cpp17
-rw-r--r--libSBRdec/src/hbe.cpp4
2 files changed, 11 insertions, 10 deletions
diff --git a/libSBRdec/src/env_calc.cpp b/libSBRdec/src/env_calc.cpp
index 1242833..c34ce96 100644
--- a/libSBRdec/src/env_calc.cpp
+++ b/libSBRdec/src/env_calc.cpp
@@ -1477,7 +1477,7 @@ void calculateSbrEnvelope(
for (k = 0; k < noSubbands; k++) {
int sc = scale_change - pNrgs->nrgGain_e[k] + (sc_change - 1);
- pNrgs->nrgGain[k] >>= sc;
+ pNrgs->nrgGain[k] >>= fixMin(sc, DFRACT_BITS - 1);
pNrgs->nrgGain_e[k] += sc;
}
@@ -1485,7 +1485,7 @@ void calculateSbrEnvelope(
for (k = 0; k < noSubbands; k++) {
int sc =
scale_change - h_sbr_cal_env->filtBuffer_e[k] + (sc_change - 1);
- h_sbr_cal_env->filtBuffer[k] >>= sc;
+ h_sbr_cal_env->filtBuffer[k] >>= fixMin(sc, DFRACT_BITS - 1);
}
}
@@ -1576,12 +1576,13 @@ void calculateSbrEnvelope(
FDK_ASSERT(!iTES_enable); /* not supported */
if (flags & SBRDEC_ELD_GRID) {
/* FDKmemset(analysBufferReal[j], 0, 64 * sizeof(FIXP_DBL)); */
- adjustTimeSlot_EldGrid(&analysBufferReal[j][lowSubband], pNrgs,
- &h_sbr_cal_env->harmIndex, lowSubband,
- noSubbands,
- fMin(scale_change, DFRACT_BITS - 1),
- noNoiseFlag, &h_sbr_cal_env->phaseIndex,
- EXP2SCALE(adj_e) - sbrScaleFactor->lb_scale);
+ adjustTimeSlot_EldGrid(
+ &analysBufferReal[j][lowSubband], pNrgs,
+ &h_sbr_cal_env->harmIndex, lowSubband, noSubbands,
+ fMin(scale_change, DFRACT_BITS - 1), noNoiseFlag,
+ &h_sbr_cal_env->phaseIndex,
+ fMax(EXP2SCALE(adj_e) - sbrScaleFactor->lb_scale,
+ -(DFRACT_BITS - 1)));
} else {
adjustTimeSlotLC(&analysBufferReal[j][lowSubband], pNrgs,
&h_sbr_cal_env->harmIndex, lowSubband, noSubbands,
diff --git a/libSBRdec/src/hbe.cpp b/libSBRdec/src/hbe.cpp
index 1141e9c..2284c42 100644
--- a/libSBRdec/src/hbe.cpp
+++ b/libSBRdec/src/hbe.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -1339,7 +1339,7 @@ static void addHighBandPart(FIXP_DBL g_r_m, FIXP_DBL g_i_m, INT g_e,
g_r_m = fMultDiv2(tmp_r, factor_m) << shift;
g_i_m = fMultDiv2(tmp_i, factor_m) << shift;
g_e = scale_factor_hbe - (g_e + factor_e + gammaCenter_e + add);
- fMax((INT)0, g_e);
+ g_e = fMax((INT)0, g_e);
*qmfHBEBufReal_F += g_r_m >> g_e;
*qmfHBEBufImag_F += g_i_m >> g_e;
}