summaryrefslogtreecommitdiff
path: root/libavcodec/motion_est.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2003-01-06 01:20:37 +0000
committerMichael Niedermayer <michaelni@gmx.at>2003-01-06 01:20:37 +0000
commit4a711c33cce6cea8870f6fb8391ba3665890f23c (patch)
tree95c73dc27e517f0b5b9e5f155b3c054c03b46c09 /libavcodec/motion_est.c
parentb17d099db43b2d52876c05fcec6f7d3773d3e56e (diff)
b frame segfault fix
Originally committed as revision 1400 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/motion_est.c')
-rw-r--r--libavcodec/motion_est.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index da565eb95d..8310db8d5a 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -1309,15 +1309,15 @@ static inline int direct_search(MpegEncContext * s,
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;
}