changeset 960:dd421045b4ce libavcodec

b frame segfault fix
author michaelni
date Mon, 06 Jan 2003 01:20:37 +0000
parents 3ec070eef24a
children f8c5babc7b4e
files motion_est.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/motion_est.c	Sun Jan 05 20:59:29 2003 +0000
+++ b/motion_est.c	Mon Jan 06 01:20:37 2003 +0000
@@ -1309,15 +1309,15 @@
         min= FFMIN(s->me.direct_basis_mv[i][0], s->me.direct_basis_mv[i][0] - s->me.co_located_mv[i][0])>>shift;
         max+= (2*mb_x + (i& 1))*8 - 1; // +-1 is for the simpler rounding
         min+= (2*mb_x + (i& 1))*8 + 1;
-        if(max >= s->width) xmax= s->width - max - 1;
-        if(min < -16      ) xmin= - 32 - min;
+        xmax= FFMIN(xmax, s->width - max);
+        xmin= FFMAX(xmin, - 16     - min);
 
         max= FFMAX(s->me.direct_basis_mv[i][1], s->me.direct_basis_mv[i][1] - s->me.co_located_mv[i][1])>>shift;
         min= FFMIN(s->me.direct_basis_mv[i][1], s->me.direct_basis_mv[i][1] - s->me.co_located_mv[i][1])>>shift;
         max+= (2*mb_y + (i>>1))*8 - 1; // +-1 is for the simpler rounding
         min+= (2*mb_y + (i>>1))*8 + 1;
-        if(max >= s->height) ymax= s->height - max - 1;
-        if(min < -16       ) ymin= - 32 - min;
+        ymax= FFMIN(ymax, s->height - max);
+        ymin= FFMAX(ymin, - 16      - min);
         
         if(s->mv_type == MV_TYPE_16X16) break;
     }