comparison motion_est.c @ 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 ffa6f24a0c0f
children 4e75fbc983c9
comparison
equal deleted inserted replaced
4303:7e907f7d6a21 4304:dbaae8e5ec55
687 * get fullpel ME search limits. 687 * get fullpel ME search limits.
688 */ 688 */
689 static inline void get_limits(MpegEncContext *s, int x, int y) 689 static inline void get_limits(MpegEncContext *s, int x, int y)
690 { 690 {
691 MotionEstContext * const c= &s->me; 691 MotionEstContext * const c= &s->me;
692 int range= c->avctx->me_range >> (1 + !!(c->flags&FLAG_QPEL));
692 /* 693 /*
693 if(c->avctx->me_range) c->range= c->avctx->me_range >> 1; 694 if(c->avctx->me_range) c->range= c->avctx->me_range >> 1;
694 else c->range= 16; 695 else c->range= 16;
695 */ 696 */
696 if (s->unrestricted_mv) { 697 if (s->unrestricted_mv) {
707 } else { 708 } else {
708 c->xmin = - x; 709 c->xmin = - x;
709 c->ymin = - y; 710 c->ymin = - y;
710 c->xmax = - x + s->mb_width *16 - 16; 711 c->xmax = - x + s->mb_width *16 - 16;
711 c->ymax = - y + s->mb_height*16 - 16; 712 c->ymax = - y + s->mb_height*16 - 16;
713 }
714 if(range){
715 c->xmin = FFMAX(c->xmin,-range);
716 c->xmax = FFMIN(c->xmax, range);
717 c->ymin = FFMAX(c->ymin,-range);
718 c->ymax = FFMIN(c->ymax, range);
712 } 719 }
713 } 720 }
714 721
715 static inline void init_mv4_ref(MotionEstContext *c){ 722 static inline void init_mv4_ref(MotionEstContext *c){
716 const int stride= c->stride; 723 const int stride= c->stride;