aboutsummaryrefslogtreecommitdiffstats
path: root/libSBRdec
diff options
context:
space:
mode:
Diffstat (limited to 'libSBRdec')
-rw-r--r--libSBRdec/src/env_calc.cpp19
-rw-r--r--libSBRdec/src/sbrdec_drc.cpp53
2 files changed, 52 insertions, 20 deletions
diff --git a/libSBRdec/src/env_calc.cpp b/libSBRdec/src/env_calc.cpp
index 0b2f651..ad5edfe 100644
--- a/libSBRdec/src/env_calc.cpp
+++ b/libSBRdec/src/env_calc.cpp
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
-© Copyright 1995 - 2019 Fraunhofer-Gesellschaft zur Förderung der angewandten
+© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -1398,6 +1398,17 @@ void calculateSbrEnvelope(
*/
noise_e = (start_pos < no_cols) ? adj_e : final_e;
+ if (start_pos >= no_cols) {
+ int diff = h_sbr_cal_env->filtBufferNoise_e - noise_e;
+ if (diff > 0) {
+ int s = getScalefactor(h_sbr_cal_env->filtBufferNoise, noSubbands);
+ if (diff > s) {
+ final_e += diff - s;
+ noise_e = final_e;
+ }
+ }
+ }
+
/*
Convert energies to amplitude levels
*/
@@ -2741,6 +2752,9 @@ static void adjustTimeSlotHQ_GainAndNoise(
fMult(direct_ratio, noiseLevel[k]);
}
+ smoothedNoise = fMax(fMin(smoothedNoise, (FIXP_DBL)(MAXVAL_DBL / 2)),
+ (FIXP_DBL)(MINVAL_DBL / 2));
+
/*
The next 2 multiplications constitute the actual envelope adjustment
of the signal and should be carried out with full accuracy
@@ -2930,6 +2944,9 @@ static void adjustTimeSlotHQ(
fMult(direct_ratio, noiseLevel[k]);
}
+ smoothedNoise = fMax(fMin(smoothedNoise, (FIXP_DBL)(MAXVAL_DBL / 2)),
+ (FIXP_DBL)(MINVAL_DBL / 2));
+
/*
The next 2 multiplications constitute the actual envelope adjustment
of the signal and should be carried out with full accuracy
diff --git a/libSBRdec/src/sbrdec_drc.cpp b/libSBRdec/src/sbrdec_drc.cpp
index 2d73f32..089d046 100644
--- a/libSBRdec/src/sbrdec_drc.cpp
+++ b/libSBRdec/src/sbrdec_drc.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 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
Forschung e.V. All rights reserved.
1. INTRODUCTION
@@ -233,14 +233,19 @@ void sbrDecoder_drcApplySlot(HANDLE_SBR_DRC_CHANNEL hDrcData,
if (hDrcData->winSequenceCurr != 2) { /* long window */
int j = col + (numQmfSubSamples >> 1);
- if (hDrcData->drcInterpolationSchemeCurr == 0) {
- INT k = (frameLenFlag) ? 0x4444445 : 0x4000000;
+ if (j < winBorderToColMap[15]) {
+ if (hDrcData->drcInterpolationSchemeCurr == 0) {
+ INT k = (frameLenFlag) ? 0x4444445 : 0x4000000;
- alphaValue = (FIXP_DBL)(j * k);
- } else {
- if (j >= (int)winBorderToColMap[hDrcData->drcInterpolationSchemeCurr]) {
- alphaValue = (FIXP_DBL)MAXVAL_DBL;
+ alphaValue = (FIXP_DBL)(j * k);
+ } else {
+ if (j >=
+ (int)winBorderToColMap[hDrcData->drcInterpolationSchemeCurr]) {
+ alphaValue = (FIXP_DBL)MAXVAL_DBL;
+ }
}
+ } else {
+ alphaValue = (FIXP_DBL)MAXVAL_DBL;
}
} else { /* short windows */
shortDrc = 1;
@@ -254,14 +259,19 @@ void sbrDecoder_drcApplySlot(HANDLE_SBR_DRC_CHANNEL hDrcData,
if (hDrcData->winSequenceNext != 2) { /* next: long window */
int j = col - (numQmfSubSamples >> 1);
- if (hDrcData->drcInterpolationSchemeNext == 0) {
- INT k = (frameLenFlag) ? 0x4444445 : 0x4000000;
+ if (j < winBorderToColMap[15]) {
+ if (hDrcData->drcInterpolationSchemeNext == 0) {
+ INT k = (frameLenFlag) ? 0x4444445 : 0x4000000;
- alphaValue = (FIXP_DBL)(j * k);
- } else {
- if (j >= (int)winBorderToColMap[hDrcData->drcInterpolationSchemeNext]) {
- alphaValue = (FIXP_DBL)MAXVAL_DBL;
+ alphaValue = (FIXP_DBL)(j * k);
+ } else {
+ if (j >=
+ (int)winBorderToColMap[hDrcData->drcInterpolationSchemeNext]) {
+ alphaValue = (FIXP_DBL)MAXVAL_DBL;
+ }
}
+ } else {
+ alphaValue = (FIXP_DBL)MAXVAL_DBL;
}
fact_mag = hDrcData->nextFact_mag;
@@ -289,14 +299,19 @@ void sbrDecoder_drcApplySlot(HANDLE_SBR_DRC_CHANNEL hDrcData,
if (hDrcData->winSequenceNext != 2) { /* long window */
int j = col - (numQmfSubSamples >> 1);
- if (hDrcData->drcInterpolationSchemeNext == 0) {
- INT k = (frameLenFlag) ? 0x4444445 : 0x4000000;
+ if (j < winBorderToColMap[15]) {
+ if (hDrcData->drcInterpolationSchemeNext == 0) {
+ INT k = (frameLenFlag) ? 0x4444445 : 0x4000000;
- alphaValue = (FIXP_DBL)(j * k);
- } else {
- if (j >= (int)winBorderToColMap[hDrcData->drcInterpolationSchemeNext]) {
- alphaValue = (FIXP_DBL)MAXVAL_DBL;
+ alphaValue = (FIXP_DBL)(j * k);
+ } else {
+ if (j >=
+ (int)winBorderToColMap[hDrcData->drcInterpolationSchemeNext]) {
+ alphaValue = (FIXP_DBL)MAXVAL_DBL;
+ }
}
+ } else {
+ alphaValue = (FIXP_DBL)MAXVAL_DBL;
}
} else { /* short windows */
shortDrc = 1;