[FFmpeg-devel] [PATCH 5/6] avcodec/mpegvideo: Fix undefined left shift of negative numbers
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Wed Sep 28 21:58:17 EEST 2022
Fixes the rv20-1239 FATE-test.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavcodec/mpegvideo.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index d8c7bc687d..5095149eaa 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -843,7 +843,7 @@ static inline int hpel_motion_lowres(MpegEncContext *s,
s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, src,
s->linesize, s->linesize,
w + 1, (h + 1) << field_based,
- src_x, src_y << field_based,
+ src_x, src_y * (1 << field_based),
h_edge_pos, v_edge_pos);
src = s->sc.edge_emu_buffer;
emu = 1;
@@ -945,7 +945,7 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr_y,
linesize >> field_based, linesize >> field_based,
17, 17 + field_based,
- src_x, src_y << field_based, h_edge_pos,
+ src_x, src_y * (1 << field_based), h_edge_pos,
v_edge_pos);
ptr_y = s->sc.edge_emu_buffer;
if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
@@ -956,12 +956,12 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
s->vdsp.emulated_edge_mc(ubuf, ptr_cb,
uvlinesize >> field_based, uvlinesize >> field_based,
9, 9 + field_based,
- uvsrc_x, uvsrc_y << field_based,
+ uvsrc_x, uvsrc_y * (1 << field_based),
h_edge_pos >> 1, v_edge_pos >> 1);
s->vdsp.emulated_edge_mc(vbuf, ptr_cr,
uvlinesize >> field_based,uvlinesize >> field_based,
9, 9 + field_based,
- uvsrc_x, uvsrc_y << field_based,
+ uvsrc_x, uvsrc_y * (1 << field_based),
h_edge_pos >> 1, v_edge_pos >> 1);
ptr_cb = ubuf;
ptr_cr = vbuf;
--
2.34.1
More information about the ffmpeg-devel
mailing list