int xmin, int ymin, int xmax, int ymax, int pred_x, int pred_y, Picture *picture, int n, int size, uint8_t * const mv_penalty)
int pred_x, int pred_y, uint8_t *src_data[3], uint8_t *ref_data[6], int stride, int uvstride, int size, int h, uint8_t * const mv_penalty)
static inline int sad_hpel_motion_search(MpegEncContext * s,				  int *mx_ptr, int *my_ptr, int dmin,				  int xmin, int ymin, int xmax, int ymax,                                  int pred_x, int pred_y, Picture *picture,                                  int n, int size, uint8_t * const mv_penalty){    uint8_t *ref_picture= picture->data[0];    uint32_t *score_map= s->me.score_map;    const int penalty_factor= s->me.sub_penalty_factor;    int mx, my, xx, yy, dminh;    uint8_t *pix, *ptr;    op_pixels_abs_func pix_abs_x2;    op_pixels_abs_func pix_abs_y2;    op_pixels_abs_func pix_abs_xy2;        if(size==0){        pix_abs_x2 = s->dsp.pix_abs16x16_x2;        pix_abs_y2 = s->dsp.pix_abs16x16_y2;        pix_abs_xy2= s->dsp.pix_abs16x16_xy2;    }else{        pix_abs_x2 = s->dsp.pix_abs8x8_x2;        pix_abs_y2 = s->dsp.pix_abs8x8_y2;        pix_abs_xy2= s->dsp.pix_abs8x8_xy2;    }    if(s->me.skip){//    printf("S");        *mx_ptr = 0;        *my_ptr = 0;        return dmin;    }//    printf("N");            xx = 16 * s->mb_x + 8*(n&1);    yy = 16 * s->mb_y + 8*(n>>1);    pix =  s->new_picture.data[0] + (yy * s->linesize) + xx;    mx = *mx_ptr;    my = *my_ptr;    ptr = ref_picture + ((yy + my) * s->linesize) + (xx + mx);        dminh = dmin;    if (mx > xmin && mx < xmax &&         my > ymin && my < ymax) {        int dx=0, dy=0;        int d, pen_x, pen_y;         const int index= (my<<ME_MAP_SHIFT) + mx;        const int t= score_map[(index-(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)];        const int l= score_map[(index- 1               )&(ME_MAP_SIZE-1)];        const int r= score_map[(index+ 1               )&(ME_MAP_SIZE-1)];        const int b= score_map[(index+(1<<ME_MAP_SHIFT))&(ME_MAP_SIZE-1)];        mx<<=1;        my<<=1;                pen_x= pred_x + mx;        pen_y= pred_y + my;        ptr-= s->linesize;        if(t<=b){            CHECK_SAD_HALF_MV(y2 , 0, -1)            if(l<=r){                CHECK_SAD_HALF_MV(xy2, -1, -1)                if(t+r<=b+l){                    CHECK_SAD_HALF_MV(xy2, +1, -1)                    ptr+= s->linesize;                }else{                    ptr+= s->linesize;                    CHECK_SAD_HALF_MV(xy2, -1, +1)                }                CHECK_SAD_HALF_MV(x2 , -1,  0)            }else{                CHECK_SAD_HALF_MV(xy2, +1, -1)                if(t+l<=b+r){                    CHECK_SAD_HALF_MV(xy2, -1, -1)                    ptr+= s->linesize;                }else{                    ptr+= s->linesize;                    CHECK_SAD_HALF_MV(xy2, +1, +1)                }                CHECK_SAD_HALF_MV(x2 , +1,  0)            }        }else{            if(l<=r){                if(t+l<=b+r){                    CHECK_SAD_HALF_MV(xy2, -1, -1)                    ptr+= s->linesize;                }else{                    ptr+= s->linesize;                    CHECK_SAD_HALF_MV(xy2, +1, +1)                }                CHECK_SAD_HALF_MV(x2 , -1,  0)                CHECK_SAD_HALF_MV(xy2, -1, +1)            }else{                if(t+r<=b+l){                    CHECK_SAD_HALF_MV(xy2, +1, -1)                    ptr+= s->linesize;                }else{                    ptr+= s->linesize;                    CHECK_SAD_HALF_MV(xy2, -1, +1)                }                CHECK_SAD_HALF_MV(x2 , +1,  0)                CHECK_SAD_HALF_MV(xy2, +1, +1)            }            CHECK_SAD_HALF_MV(y2 ,  0, +1)        }        mx+=dx;        my+=dy;    }else{        mx<<=1;        my<<=1;    }    *mx_ptr = mx;    *my_ptr = my;    return dminh;}