Commit 56fd4705 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/motion_est_template: Fix undefined shifts in CHECK_MV_DIR()

Fixes: signal_sigsegv_2e64ee0_2762_cov_4170502227_missing_frames.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 2f8c8163
...@@ -384,13 +384,13 @@ static int qpel_motion_search(MpegEncContext * s, ...@@ -384,13 +384,13 @@ static int qpel_motion_search(MpegEncContext * s,
#define CHECK_MV_DIR(x,y,new_dir)\ #define CHECK_MV_DIR(x,y,new_dir)\
{\ {\
const unsigned key = ((y)<<ME_MAP_MV_BITS) + (x) + map_generation;\ const unsigned key = ((unsigned)(y)<<ME_MAP_MV_BITS) + (x) + map_generation;\
const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1);\ const int index= (((unsigned)(y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1);\
if(map[index]!=key){\ if(map[index]!=key){\
d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\ d= cmp(s, x, y, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);\
map[index]= key;\ map[index]= key;\
score_map[index]= d;\ score_map[index]= d;\
d += (mv_penalty[((x)<<shift)-pred_x] + mv_penalty[((y)<<shift)-pred_y])*penalty_factor;\ d += (mv_penalty[(int)((unsigned)(x)<<shift)-pred_x] + mv_penalty[(int)((unsigned)(y)<<shift)-pred_y])*penalty_factor;\
if(d<dmin){\ if(d<dmin){\
best[0]=x;\ best[0]=x;\
best[1]=y;\ best[1]=y;\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment