diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2005-12-23 19:05:48 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2005-12-23 19:05:48 +0000 |
commit | d4f0c2fcc3dc6681578376f38343582d14371e3c (patch) | |
tree | cec3ab1d2ae037135464804a9b05f8a121b27369 /libavcodec/motion_est.c | |
parent | 316a2ec84ce19909e2732a1dc10be20bd38304c5 (diff) | |
download | ffmpeg-d4f0c2fcc3dc6681578376f38343582d14371e3c.tar.gz |
10l (segfault fix)
Originally committed as revision 4769 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/motion_est.c')
-rw-r--r-- | libavcodec/motion_est.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index b645ffef03..757d8f3e6e 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -1646,14 +1646,17 @@ static inline int bidir_refine(MpegEncContext * s, int mb_x, int mb_y) if(s->avctx->bidir_refine){ int score, end; #define CHECK_BIDIR(fx,fy,bx,by)\ - 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){\ - fbmin= score;\ - motion_fx+=fx;\ - motion_fy+=fy;\ - motion_bx+=bx;\ - motion_by+=by;\ - end=0;\ + if( (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)){\ + 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){\ + fbmin= score;\ + motion_fx+=fx;\ + motion_fy+=fy;\ + motion_bx+=bx;\ + motion_by+=by;\ + end=0;\ + }\ } #define CHECK_BIDIR2(a,b,c,d)\ CHECK_BIDIR(a,b,c,d)\ @@ -1668,10 +1671,6 @@ CHECK_BIDIR2(d,a,b,c) do{ end=1; - if( motion_fx >= xmax || motion_bx >= xmax || motion_fx <= xmin || motion_bx <= xmin - || motion_fy >= ymax || motion_by >= ymax || motion_fy <= ymin || motion_by <= ymin) - break; - CHECK_BIDIRR( 0, 0, 0, 1) if(s->avctx->bidir_refine > 1){ CHECK_BIDIRR( 0, 0, 1, 1) |