From 3ef65fd4d1d0cdfa0b60351c719bef93d3664ea2 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Fri, 26 Mar 2021 18:18:05 +0100 Subject: avcodec/motion_est: Fix invalid left shift of negative numbers Affected many FATE-tests. Signed-off-by: Andreas Rheinhardt --- libavcodec/motion_est_template.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'libavcodec/motion_est_template.c') diff --git a/libavcodec/motion_est_template.c b/libavcodec/motion_est_template.c index d3b2f97744..6ab0ea13dc 100644 --- a/libavcodec/motion_est_template.c +++ b/libavcodec/motion_est_template.c @@ -82,7 +82,7 @@ static int hpel_motion_search(MpegEncContext * s, if (mx > xmin && mx < xmax && my > ymin && my < ymax) { int d= dmin; - const int index= (my<penalty_factor; const int l= score_map[(index- 1 )&(ME_MAP_SIZE-1)] @@ -95,13 +95,13 @@ static int hpel_motion_search(MpegEncContext * s, #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 unsigned key; unsigned map_generation= c->map_generation; - key= ((my-1)<map[(index-(1<map[(index+(1<map[(index+1)&(ME_MAP_SIZE-1)] == key); - key= ((my)<map[(index-1)&(ME_MAP_SIZE-1)] == key); #endif if(t<=b){ @@ -246,7 +246,7 @@ static int qpel_motion_search(MpegEncContext * s, int bx=4*mx, by=4*my; int d= dmin; int i, nx, ny; - const int index= (my<