diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2006-12-17 12:07:09 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2006-12-17 12:07:09 +0000 |
commit | a6daaf7cce2df4123cf3f560d9dd805f3578a0a7 (patch) | |
tree | adeb1c5c67e4440075a88c7e07959b7a20b08e0d /libavcodec/motion_est.c | |
parent | 6f3e4e1712260ef8c5b4754d781ccd80bcfa1d0c (diff) | |
download | ffmpeg-a6daaf7cce2df4123cf3f560d9dd805f3578a0a7.tar.gz |
limit x/ymin/max to me_range
slight psnr/bitrate gain for most but not all files if me_range is used
Originally committed as revision 7325 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/motion_est.c')
-rw-r--r-- | libavcodec/motion_est.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index cb6cc64529..d81ab32a44 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -689,6 +689,7 @@ static inline void set_p_mv_tables(MpegEncContext * s, int mx, int my, int mv4) static inline void get_limits(MpegEncContext *s, int x, int y) { MotionEstContext * const c= &s->me; + int range= c->avctx->me_range >> (1 + !!(c->flags&FLAG_QPEL)); /* if(c->avctx->me_range) c->range= c->avctx->me_range >> 1; else c->range= 16; @@ -710,6 +711,12 @@ static inline void get_limits(MpegEncContext *s, int x, int y) c->xmax = - x + s->mb_width *16 - 16; c->ymax = - y + s->mb_height*16 - 16; } + if(range){ + c->xmin = FFMAX(c->xmin,-range); + c->xmax = FFMIN(c->xmax, range); + c->ymin = FFMAX(c->ymin,-range); + c->ymax = FFMIN(c->ymax, range); + } } static inline void init_mv4_ref(MotionEstContext *c){ |