const int ref_mv_stride= s->mb_width+2; const int ref_mv_xy= 1 + s->mb_x + (s->mb_y + 1)*ref_mv_stride;
const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride;
static int RENAME(epzs_motion_search4)(MpegEncContext * s, int block,                             int *mx_ptr, int *my_ptr,                             int P[10][2], int pred_x, int pred_y,                             int xmin, int ymin, int xmax, int ymax, Picture *ref_picture, int16_t (*last_mv)[2],                              int ref_mv_scale, uint8_t * const mv_penalty){    int best[2]={0, 0};    int d, dmin;     const int shift= 1+s->quarter_sample;    uint32_t *map= s->me.map;    int map_generation;    const int penalty_factor= s->me.penalty_factor;    const int size=1;    const int ref_mv_stride= s->mb_width+2;    const int ref_mv_xy= 1 + s->mb_x + (s->mb_y + 1)*ref_mv_stride;    me_cmp_func cmp, chroma_cmp;    LOAD_COMMON((s->mb_x*2 + (block&1))*8, (s->mb_y*2 + (block>>1))*8);        cmp= s->dsp.me_cmp[size];    chroma_cmp= s->dsp.me_cmp[size+1];    map_generation= update_map_generation(s);    dmin = 1000000;//printf("%d %d %d %d //",xmin, ymin, xmax, ymax);     /* first line */    if (s->mb_y == 0 && block<2) {	CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)        CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,                         (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)        CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)    }else{        CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)        //FIXME try some early stop        if(dmin>64*2){            CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift)            CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)            CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift)            CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)            CHECK_CLIPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,                             (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)        }    }    if(dmin>64*4){        CHECK_CLIPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,                         (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)        CHECK_CLIPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,                         (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)    }    if(s->me.dia_size==-1)        dmin= RENAME(funny_diamond_search)(s, best, dmin, ref_picture,                                   pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax, 				   shift, map, map_generation, size, mv_penalty);    else if(s->me.dia_size<-1)        dmin= RENAME(sab_diamond_search)(s, best, dmin, ref_picture,                                   pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax, 				   shift, map, map_generation, size, mv_penalty);    else if(s->me.dia_size<2)        dmin= RENAME(small_diamond_search)(s, best, dmin, ref_picture,                                   pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax, 				   shift, map, map_generation, size, mv_penalty);    else        dmin= RENAME(var_diamond_search)(s, best, dmin, ref_picture,                                   pred_x, pred_y, penalty_factor, xmin, ymin, xmax, ymax, 				   shift, map, map_generation, size, mv_penalty);    *mx_ptr= best[0];    *my_ptr= best[1];    //    printf("%d %d %d \n", best[0], best[1], dmin);    return dmin;}