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

avcodec/ra144enc: Fix invalid left shift of negative number

by replacing it with a multiplication. Said multiplication can't
overflow an int32_t because lpc_coefs is limited to 16 bit precision.

Fixes the FACE-test acodec-ra144 as well as part of #8217.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Andreas Rheinhardt 2020-01-22 15:52:10 +01:00 committed by Michael Niedermayer
parent d033f403d6
commit e3fb9af6f1

View File

@ -477,8 +477,8 @@ static int ra144_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
LPC_ORDER, 16, lpc_coefs, shift, FF_LPC_TYPE_LEVINSON, LPC_ORDER, 16, lpc_coefs, shift, FF_LPC_TYPE_LEVINSON,
0, ORDER_METHOD_EST, 0, 12, 0); 0, ORDER_METHOD_EST, 0, 12, 0);
for (i = 0; i < LPC_ORDER; i++) for (i = 0; i < LPC_ORDER; i++)
block_coefs[NBLOCKS - 1][i] = -(lpc_coefs[LPC_ORDER - 1][i] << block_coefs[NBLOCKS - 1][i] = -lpc_coefs[LPC_ORDER - 1][i]
(12 - shift[LPC_ORDER - 1])); * (1 << (12 - shift[LPC_ORDER - 1]));
/** /**
* TODO: apply perceptual weighting of the input speech through bandwidth * TODO: apply perceptual weighting of the input speech through bandwidth