Commit 5f0acc50 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/g729postfilter: Fix left shift of negative value

Fixes: Ticket8176
Reviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 7056ddc0
...@@ -346,7 +346,7 @@ static int16_t long_term_filter(AudioDSPContext *adsp, int pitch_delay_int, ...@@ -346,7 +346,7 @@ static int16_t long_term_filter(AudioDSPContext *adsp, int pitch_delay_int,
L_temp1 = gain_long_num * gain_long_num; L_temp1 = gain_long_num * gain_long_num;
L_temp1 = MULL(L_temp1, gain_den, FRAC_BITS); L_temp1 = MULL(L_temp1, gain_den, FRAC_BITS);
tmp = ((sh_gain_long_num - sh_gain_num) << 1) - (sh_gain_long_den - sh_gain_den); tmp = ((sh_gain_long_num - sh_gain_num) * 2) - (sh_gain_long_den - sh_gain_den);
if (tmp > 0) if (tmp > 0)
L_temp0 >>= tmp; L_temp0 >>= tmp;
else else
...@@ -367,7 +367,7 @@ static int16_t long_term_filter(AudioDSPContext *adsp, int pitch_delay_int, ...@@ -367,7 +367,7 @@ static int16_t long_term_filter(AudioDSPContext *adsp, int pitch_delay_int,
/* Rescale selected signal to original value. */ /* Rescale selected signal to original value. */
if (shift > 0) if (shift > 0)
for (i = 0; i < subframe_size; i++) for (i = 0; i < subframe_size; i++)
selected_signal[i] <<= shift; selected_signal[i] *= 1 << shift;
else else
for (i = 0; i < subframe_size; i++) for (i = 0; i < subframe_size; i++)
selected_signal[i] >>= -shift; selected_signal[i] >>= -shift;
...@@ -464,7 +464,7 @@ static int16_t get_tilt_comp(AudioDSPContext *adsp, int16_t *lp_gn, ...@@ -464,7 +464,7 @@ static int16_t get_tilt_comp(AudioDSPContext *adsp, int16_t *lp_gn,
speech[i] = (speech[i] * temp + 0x4000) >> 15; speech[i] = (speech[i] * temp + 0x4000) >> 15;
} }
return -(rh1 << 15) / rh0; return -(rh1 * (1 << 15)) / rh0;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment