From: Michael Niedermayer Date: Fri, 2 Apr 2010 12:34:08 +0000 (+0000) Subject: Change bidir refine hash code so we only need to perform a single X-Git-Tag: v0.6~350 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a69220cce0aea2d5e017cb1d15b894f7e9cd3e1b;p=platform%2Fupstream%2Flibav.git Change bidir refine hash code so we only need to perform a single hash calculation for the whole function. negligibly faster (about 0.1%) Originally committed as revision 22775 to svn://svn.ffmpeg.org/ffmpeg/trunk --- diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 17954b5..c1062fa 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -1475,12 +1475,12 @@ static inline int bidir_refine(MpegEncContext * s, int mb_x, int mb_y) const int ymin= c->ymin<xmax<ymax<avctx->bidir_refine){ int score, end; #define CHECK_BIDIR(fx,fy,bx,by)\ - if( !BIDIR_MAP(fx,fy,bx,by)\ + if( !map[(hashidx+HASH(fx,fy,bx,by))&255]\ &&(fx<=0 || motion_fx+fx<=xmax) && (fy<=0 || motion_fy+fy<=ymax) && (bx<=0 || motion_bx+bx<=xmax) && (by<=0 || motion_by+by<=ymax)\ &&(fx>=0 || motion_fx+fx>=xmin) && (fy>=0 || motion_fy+fy>=ymin) && (bx>=0 || motion_bx+bx>=xmin) && (by>=0 || motion_by+by>=ymin)){\ - BIDIR_MAP(fx,fy,bx,by) = 1;\ + map[(hashidx+HASH(fx,fy,bx,by))&255] = 1;\ score= check_bidir_mv(s, motion_fx+fx, motion_fy+fy, motion_bx+bx, motion_by+by, pred_fx, pred_fy, pred_bx, pred_by, 0, 16);\ if(score < fbmin){\ + hashidx += HASH(fx,fy,bx,by);\ fbmin= score;\ motion_fx+=fx;\ motion_fy+=fy;\