1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/amrnbde: Fix undefined shift in decode_pitch_vector()

This also simplifies the code

Found-by: Clang -fsanitize=shift
Reported-by: Thierry Foucu <tfoucu@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-03-11 16:28:06 +01:00
parent fa74058dd3
commit 8c7a0932ab

View File

@ -399,17 +399,17 @@ static void decode_pitch_vector(AMRContext *p,
decode_pitch_lag_1_6(&pitch_lag_int, &pitch_lag_frac, decode_pitch_lag_1_6(&pitch_lag_int, &pitch_lag_frac,
amr_subframe->p_lag, p->pitch_lag_int, amr_subframe->p_lag, p->pitch_lag_int,
subframe); subframe);
} else } else {
ff_decode_pitch_lag(&pitch_lag_int, &pitch_lag_frac, ff_decode_pitch_lag(&pitch_lag_int, &pitch_lag_frac,
amr_subframe->p_lag, amr_subframe->p_lag,
p->pitch_lag_int, subframe, p->pitch_lag_int, subframe,
mode != MODE_4k75 && mode != MODE_5k15, mode != MODE_4k75 && mode != MODE_5k15,
mode <= MODE_6k7 ? 4 : (mode == MODE_7k95 ? 5 : 6)); mode <= MODE_6k7 ? 4 : (mode == MODE_7k95 ? 5 : 6));
pitch_lag_frac *= 2;
}
p->pitch_lag_int = pitch_lag_int; // store previous lag in a uint8_t p->pitch_lag_int = pitch_lag_int; // store previous lag in a uint8_t
pitch_lag_frac <<= (p->cur_frame_mode != MODE_12k2);
pitch_lag_int += pitch_lag_frac > 0; pitch_lag_int += pitch_lag_frac > 0;
/* Calculate the pitch vector by interpolating the past excitation at the /* Calculate the pitch vector by interpolating the past excitation at the