Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/wmavoice.c')
-rw-r--r--libavcodec/wmavoice.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index fcbee0ef8e..f6550c6a71 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -636,12 +636,14 @@ static void calc_input_response(WMAVoiceContext *s, float *lpcs,
for (n = 0; n <= 64; n++) {
float pwr;
- idx = FFMAX(0, lrint((max - lpcs[n]) * irange) - 1);
+ idx = lrint((max - lpcs[n]) * irange - 1);
+ idx = FFMAX(0, idx);
pwr = wmavoice_denoise_power_table[s->denoise_strength][idx];
lpcs[n] = angle_mul * pwr;
/* 70.57 =~ 1/log10(1.0331663) */
- idx = (pwr * gain_mul - 0.0295) * 70.570526123;
+ idx = av_clipf((pwr * gain_mul - 0.0295) * 70.570526123, 0, INT_MAX / 2);
+
if (idx > 127) { // fall back if index falls outside table range
coeffs[n] = wmavoice_energy_table[127] *
powf(1.0331663, idx - 127);