src_x = mb_x * 16 + (motion_fx >> 1); src_y = mb_y * 16 + (motion_fy >> 1); assert(src_x >=-16 && src_x<=s->h_edge_pos); assert(src_y >=-16 && src_y<=s->v_edge_pos);
src_x = motion_fx >> 1; src_y = motion_fy >> 1;
static inline int check_bidir_mv(MpegEncContext * s,                   int mb_x, int mb_y,                   int motion_fx, int motion_fy,                   int motion_bx, int motion_by,                   int pred_fx, int pred_fy,                   int pred_bx, int pred_by){    //FIXME optimize?    //FIXME move into template?    //FIXME better f_code prediction (max mv & distance)    uint8_t * const mv_penalty= s->me.mv_penalty[s->f_code] + MAX_MV; // f_code of the prev frame    uint8_t *dest_y = s->me.scratchpad;    uint8_t *ptr;    int dxy;    int src_x, src_y;    int fbmin;    if(s->quarter_sample){        dxy = ((motion_fy & 3) << 2) | (motion_fx & 3);        src_x = mb_x * 16 + (motion_fx >> 2);        src_y = mb_y * 16 + (motion_fy >> 2);        assert(src_x >=-16 && src_x<=s->h_edge_pos);        assert(src_y >=-16 && src_y<=s->v_edge_pos);        ptr = s->last_picture.data[0] + (src_y * s->linesize) + src_x;        s->dsp.put_qpel_pixels_tab[0][dxy](dest_y    , ptr    , s->linesize);        dxy = ((motion_by & 3) << 2) | (motion_bx & 3);        src_x = mb_x * 16 + (motion_bx >> 2);        src_y = mb_y * 16 + (motion_by >> 2);        assert(src_x >=-16 && src_x<=s->h_edge_pos);        assert(src_y >=-16 && src_y<=s->v_edge_pos);            ptr = s->next_picture.data[0] + (src_y * s->linesize) + src_x;        s->dsp.avg_qpel_pixels_tab[0][dxy](dest_y    , ptr    , s->linesize);    }else{        dxy = ((motion_fy & 1) << 1) | (motion_fx & 1);        src_x = mb_x * 16 + (motion_fx >> 1);        src_y = mb_y * 16 + (motion_fy >> 1);        assert(src_x >=-16 && src_x<=s->h_edge_pos);        assert(src_y >=-16 && src_y<=s->v_edge_pos);        ptr = s->last_picture.data[0] + (src_y * s->linesize) + src_x;        s->dsp.put_pixels_tab[0][dxy](dest_y    , ptr    , s->linesize, 16);        dxy = ((motion_by & 1) << 1) | (motion_bx & 1);        src_x = mb_x * 16 + (motion_bx >> 1);        src_y = mb_y * 16 + (motion_by >> 1);        assert(src_x >=-16 && src_x<=s->h_edge_pos);        assert(src_y >=-16 && src_y<=s->v_edge_pos);            ptr = s->next_picture.data[0] + (src_y * s->linesize) + src_x;        s->dsp.avg_pixels_tab[0][dxy](dest_y    , ptr    , s->linesize, 16);    }    fbmin = (mv_penalty[motion_fx-pred_fx] + mv_penalty[motion_fy-pred_fy])*s->me.mb_penalty_factor           +(mv_penalty[motion_bx-pred_bx] + mv_penalty[motion_by-pred_by])*s->me.mb_penalty_factor           + s->dsp.mb_cmp[0](s, s->new_picture.data[0] + mb_x*16 + mb_y*16*s->linesize, dest_y, s->linesize);               if(s->avctx->mb_cmp&FF_CMP_CHROMA){    }    //FIXME CHROMA !!!               return fbmin;}