changeset 4304:dbaae8e5ec55 libavcodec

limit x/ymin/max to me_range slight psnr/bitrate gain for most but not all files if me_range is used
author michael
date Sun, 17 Dec 2006 12:07:09 +0000
parents 7e907f7d6a21
children 4e75fbc983c9
files motion_est.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/motion_est.c	Sun Dec 17 11:11:44 2006 +0000
+++ b/motion_est.c	Sun Dec 17 12:07:09 2006 +0000
@@ -689,6 +689,7 @@
 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 @@
         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){