diff mbox series

[FFmpeg-devel,5/6] avcodec/mpegvideo: Fix undefined left shift of negative numbers

Message ID GV1P250MB07377DC2EA20A282DAF5454D8F549@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit e5f6918cbd5d7b6024f83ff86075d5e762c38034
Headers show
Series [FFmpeg-devel,1/6] avcodec/g723_1enc: Remove unnecessary av_clipl_int32() | expand

Commit Message

Andreas Rheinhardt Sept. 28, 2022, 6:58 p.m. UTC
Fixes the rv20-1239 FATE-test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpegvideo.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Michael Niedermayer Sept. 29, 2022, 6:01 p.m. UTC | #1
On Wed, Sep 28, 2022 at 08:58:17PM +0200, Andreas Rheinhardt wrote:
> Fixes the rv20-1239 FATE-test.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/mpegvideo.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

LGTM

thx

[...]
diff mbox series

Patch

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;