aboutsummaryrefslogtreecommitdiffstats
path: root/libSBRdec
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
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')
-rw-r--r--libSBRdec/src/HFgen_preFlat.cpp15
-rw-r--r--libSBRdec/src/env_calc.cpp10
-rw-r--r--libSBRdec/src/sbrdec_freq_sca.cpp7
3 files changed, 19 insertions, 13 deletions
diff --git a/libSBRdec/src/HFgen_preFlat.cpp b/libSBRdec/src/HFgen_preFlat.cpp
index 96adbb9..268011e 100644
--- a/libSBRdec/src/HFgen_preFlat.cpp
+++ b/libSBRdec/src/HFgen_preFlat.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
@@ -904,23 +904,24 @@ void sbrDecoder_calculateGainVec(FIXP_DBL **sourceBufferReal,
}
if (maxVal != FL2FX_DBL(0.0f)) {
- reserve = fixMax(0, CntLeadingZeros(maxVal) - 2);
+ reserve = CntLeadingZeros(maxVal) - 2;
}
nrg_ov = nrg = (FIXP_DBL)0;
if (scale_nrg_ov > -31) {
for (i = startSample; i < overlap; i++) {
- nrg_ov += (fPow2Div2(sourceBufferReal[i][loBand] << reserve) +
- fPow2Div2(sourceBufferImag[i][loBand] << reserve)) >>
- sum_scale_ov;
+ nrg_ov +=
+ (fPow2Div2(scaleValue(sourceBufferReal[i][loBand], reserve)) +
+ fPow2Div2(scaleValue(sourceBufferImag[i][loBand], reserve))) >>
+ sum_scale_ov;
}
} else {
scale_nrg_ov = 0;
}
if (scale_nrg > -31) {
for (i = overlap; i < stopSample; i++) {
- nrg += (fPow2Div2(sourceBufferReal[i][loBand] << reserve) +
- fPow2Div2(sourceBufferImag[i][loBand] << reserve)) >>
+ nrg += (fPow2Div2(scaleValue(sourceBufferReal[i][loBand], reserve)) +
+ fPow2Div2(scaleValue(sourceBufferImag[i][loBand], reserve))) >>
sum_scale;
}
} else {
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;
}
}
diff --git a/libSBRdec/src/sbrdec_freq_sca.cpp b/libSBRdec/src/sbrdec_freq_sca.cpp
index 165f94b..e187656 100644
--- a/libSBRdec/src/sbrdec_freq_sca.cpp
+++ b/libSBRdec/src/sbrdec_freq_sca.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
@@ -230,6 +230,8 @@ static UCHAR getStopBand(
}
}
+ stopMin = fMin(stopMin, 64);
+
/*
Choose a stop band between k1 and 64 depending on stopFreq (0..13),
based on a logarithmic scale.
@@ -523,7 +525,8 @@ static FIXP_SGL calcFactorPerBand(int k_start, int k_stop, int num_bands) {
step = FL2FXCONST_DBL(0.0f);
}
}
- return FX_DBL2FX_SGL(bandfactor << 1);
+ return (bandfactor >= FL2FXCONST_DBL(0.5)) ? (FIXP_SGL)MAXVAL_SGL
+ : FX_DBL2FX_SGL(bandfactor << 1);
}
/*!