From bedfd82356dafa1f51f360af29f302a672d6866c Mon Sep 17 00:00:00 2001 From: Fraunhofer IIS FDK Date: Fri, 9 Aug 2019 17:09:00 +0200 Subject: Fix shift value assignment in addHighBandPart(). Bug: 131430997 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I69457c1b551e33e3ee9ef39b457b0f83de2e370e --- libSBRdec/src/hbe.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libSBRdec/src') 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; } -- cgit v1.2.3 From a65911cd2ef6a16878e88cd91818ef962950ceec Mon Sep 17 00:00:00 2001 From: Fraunhofer IIS FDK Date: Fri, 9 Aug 2019 17:09:18 +0200 Subject: Limit shift exponent in adjustTimeSlot_EldGrid(). Bug: 131430997 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I4000972d63d74e871d47f2db031308cd7ea285d6 --- libSBRdec/src/env_calc.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'libSBRdec/src') diff --git a/libSBRdec/src/env_calc.cpp b/libSBRdec/src/env_calc.cpp index 1242833..eaf739d 100644 --- a/libSBRdec/src/env_calc.cpp +++ b/libSBRdec/src/env_calc.cpp @@ -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, -- cgit v1.2.3 From 6f98eab35095f5fd7bcfb9df585ff0b0c6f1460d Mon Sep 17 00:00:00 2001 From: Fraunhofer IIS FDK Date: Fri, 9 Aug 2019 17:09:36 +0200 Subject: Saturate shift value in calculateSbrEnvelope(). Prevents too large shift values. Bug: 131430997 Test: atest DecoderTestXheAac ; atest DecoderTestAacDrc Change-Id: I3331ac9bc267cd3fa4c1178bc445998869f0d99b --- libSBRdec/src/env_calc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libSBRdec/src') diff --git a/libSBRdec/src/env_calc.cpp b/libSBRdec/src/env_calc.cpp index eaf739d..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); } } -- cgit v1.2.3