diff options
Diffstat (limited to 'libSBRdec/src/env_calc.cpp')
-rw-r--r-- | libSBRdec/src/env_calc.cpp | 62 |
1 files changed, 24 insertions, 38 deletions
diff --git a/libSBRdec/src/env_calc.cpp b/libSBRdec/src/env_calc.cpp index f72e8c6..1242833 100644 --- a/libSBRdec/src/env_calc.cpp +++ b/libSBRdec/src/env_calc.cpp @@ -2439,8 +2439,7 @@ static void adjustTimeSlot_EldGrid( sbNoise = *pNoiseLevel++; if (((INT)sineLevel_curr | noNoiseFlag) == 0) { signalReal += - (fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[phaseIndex][0], sbNoise) - << 4); + fMult(FDK_sbrDecoder_sbr_randomPhase[phaseIndex][0], sbNoise); } signalReal += sineLevel_curr * p_harmonicPhase[0]; signalReal = @@ -2474,8 +2473,7 @@ static void adjustTimeSlot_EldGrid( sbNoise = *pNoiseLevel++; if (((INT)sineLevel_curr | noNoiseFlag) == 0) { signalReal += - (fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[phaseIndex][0], sbNoise) - << 4); + fMult(FDK_sbrDecoder_sbr_randomPhase[phaseIndex][0], sbNoise); } signalReal += sineLevel_curr * p_harmonicPhase[0]; *ptrReal++ = signalReal; @@ -2535,8 +2533,7 @@ static void adjustTimeSlotLC( else if (!noNoiseFlag) /* Add noisefloor to the amplified signal */ signalReal += - (fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0]) - << 4); + fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0]); { if (!(harmIndex & 0x1)) { @@ -2583,9 +2580,8 @@ static void adjustTimeSlotLC( !noNoiseFlag) { /* Add noisefloor to the amplified signal */ index &= (SBR_NF_NO_RANDOM_VAL - 1); - signalReal += (fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], - pNoiseLevel[0]) - << 4); + signalReal += + fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0]); } /* The next multiplication constitutes the actual envelope adjustment of @@ -2610,9 +2606,8 @@ static void adjustTimeSlotLC( else if (!noNoiseFlag) { /* Add noisefloor to the amplified signal */ index &= (SBR_NF_NO_RANDOM_VAL - 1); - signalReal += (fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], - pNoiseLevel[0]) - << 4); + signalReal += + fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0]); } pNoiseLevel++; @@ -2641,10 +2636,8 @@ static void adjustTimeSlotLC( else if (!noNoiseFlag) { /* Add noisefloor to the amplified signal */ index &= (SBR_NF_NO_RANDOM_VAL - 1); - signalReal = - signalReal + - (fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], pNoiseLevel[0]) - << 4); + signalReal = signalReal + fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], + pNoiseLevel[0]); } if (!(harmIndex & 0x1)) { @@ -2749,11 +2742,9 @@ static void adjustTimeSlotHQ_GainAndNoise( /* Add noisefloor to the amplified signal */ index &= (SBR_NF_NO_RANDOM_VAL - 1); noiseReal = - fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise) - << 4; + fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise); noiseImag = - fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise) - << 4; + fMult(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise); *ptrReal++ = (signalReal + noiseReal); *ptrImag++ = (signalImag + noiseImag); } @@ -2771,13 +2762,12 @@ static void adjustTimeSlotHQ_GainAndNoise( smoothedNoise = noiseLevel[k]; index &= (SBR_NF_NO_RANDOM_VAL - 1); noiseReal = - fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise); + fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise); noiseImag = - fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise); + fMult(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise); - /* FDK_sbrDecoder_sbr_randomPhase is downscaled by 2^3 */ - signalReal += noiseReal << 4; - signalImag += noiseImag << 4; + signalReal += noiseReal; + signalImag += noiseImag; } *ptrReal++ = signalReal; *ptrImag++ = signalImag; @@ -2952,13 +2942,10 @@ static void adjustTimeSlotHQ( } else { /* Add noisefloor to the amplified signal */ index &= (SBR_NF_NO_RANDOM_VAL - 1); - /* FDK_sbrDecoder_sbr_randomPhase is downscaled by 2^3 */ noiseReal = - fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise) - << 4; + fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise); noiseImag = - fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise) - << 4; + fMult(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise); *ptrReal++ = (signalReal + noiseReal); *ptrImag++ = (signalImag + noiseImag); } @@ -3000,14 +2987,13 @@ static void adjustTimeSlotHQ( /* Add noisefloor to the amplified signal */ smoothedNoise = noiseLevel[k]; index &= (SBR_NF_NO_RANDOM_VAL - 1); - noiseReal = fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][0], - smoothedNoise); - noiseImag = fMultDiv2(FDK_sbrDecoder_sbr_randomPhase[index][1], - smoothedNoise); - - /* FDK_sbrDecoder_sbr_randomPhase is downscaled by 2^3 */ - signalReal += noiseReal << 4; - signalImag += noiseImag << 4; + noiseReal = + fMult(FDK_sbrDecoder_sbr_randomPhase[index][0], smoothedNoise); + noiseImag = + fMult(FDK_sbrDecoder_sbr_randomPhase[index][1], smoothedNoise); + + signalReal += noiseReal; + signalImag += noiseImag; } } *ptrReal++ = signalReal; |