static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift)

{

    MotionEstContext * const c= &s->me;

    const int size= 1;

    const int h=8;

    int block;

    int P[10][2];

    int dmin_sum=0, mx4_sum=0, my4_sum=0;

    int same=1;

    const int stride= c->stride;

    uint8_t *mv_penalty= c->current_mv_penalty;



    init_mv4_ref(c);



    for(block=0; block<4; block++){

        int mx4, my4;

        int pred_x4, pred_y4;

        int dmin4;

        static const int off[4]= {2, 1, 1, -1};

        const int mot_stride = s->b8_stride;

        const int mot_xy = s->block_index[block];



        P_LEFT[0] = s->current_picture.motion_val[0][mot_xy - 1][0];

        P_LEFT[1] = s->current_picture.motion_val[0][mot_xy - 1][1];



        if(P_LEFT[0]       > (c->xmax<<shift)) P_LEFT[0]       = (c->xmax<<shift);



        /* special case for first line */

        if (s->first_slice_line && block<2) {

            c->pred_x= pred_x4= P_LEFT[0];

            c->pred_y= pred_y4= P_LEFT[1];

        } else {

            P_TOP[0]      = s->current_picture.motion_val[0][mot_xy - mot_stride             ][0];

            P_TOP[1]      = s->current_picture.motion_val[0][mot_xy - mot_stride             ][1];

            P_TOPRIGHT[0] = s->current_picture.motion_val[0][mot_xy - mot_stride + off[block]][0];

            P_TOPRIGHT[1] = s->current_picture.motion_val[0][mot_xy - mot_stride + off[block]][1];

            if(P_TOP[1]      > (c->ymax<<shift)) P_TOP[1]     = (c->ymax<<shift);

            if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift);

            if(P_TOPRIGHT[0] > (c->xmax<<shift)) P_TOPRIGHT[0]= (c->xmax<<shift);

            if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift);



            P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);

            P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);



            c->pred_x= pred_x4 = P_MEDIAN[0];

            c->pred_y= pred_y4 = P_MEDIAN[1];

        }

        P_MV1[0]= mx;

        P_MV1[1]= my;



        dmin4 = epzs_motion_search4(s, &mx4, &my4, P, block, block, s->p_mv_table, (1<<16)>>shift);



        dmin4= c->sub_motion_search(s, &mx4, &my4, dmin4, block, block, size, h);



        if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){

            int dxy;

            const int offset= ((block&1) + (block>>1)*stride)*8;

            uint8_t *dest_y = c->scratchpad + offset;

            if(s->quarter_sample){

                uint8_t *ref= c->ref[block][0] + (mx4>>2) + (my4>>2)*stride;

                dxy = ((my4 & 3) << 2) | (mx4 & 3);



                if(s->no_rounding)

                    s->dsp.put_no_rnd_qpel_pixels_tab[1][dxy](dest_y   , ref    , stride);

                else

                    s->dsp.put_qpel_pixels_tab       [1][dxy](dest_y   , ref    , stride);

            }else{

                uint8_t *ref= c->ref[block][0] + (mx4>>1) + (my4>>1)*stride;

                dxy = ((my4 & 1) << 1) | (mx4 & 1);



                if(s->no_rounding)

                    s->hdsp.put_no_rnd_pixels_tab[1][dxy](dest_y    , ref    , stride, h);

                else

                    s->hdsp.put_pixels_tab       [1][dxy](dest_y    , ref    , stride, h);

            }

            dmin_sum+= (mv_penalty[mx4-pred_x4] + mv_penalty[my4-pred_y4])*c->mb_penalty_factor;

        }else

            dmin_sum+= dmin4;



        if(s->quarter_sample){

            mx4_sum+= mx4/2;

            my4_sum+= my4/2;

        }else{

            mx4_sum+= mx4;

            my4_sum+= my4;

        }



        s->current_picture.motion_val[0][s->block_index[block]][0] = mx4;

        s->current_picture.motion_val[0][s->block_index[block]][1] = my4;



        if(mx4 != mx || my4 != my) same=0;

    }



    if(same)

        return INT_MAX;



    if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){

        dmin_sum += s->dsp.mb_cmp[0](s, s->new_picture.f.data[0] + s->mb_x*16 + s->mb_y*16*stride, c->scratchpad, stride, 16);

    }



    if(c->avctx->mb_cmp&FF_CMP_CHROMA){

        int dxy;

        int mx, my;

        int offset;



        mx= ff_h263_round_chroma(mx4_sum);

        my= ff_h263_round_chroma(my4_sum);

        dxy = ((my & 1) << 1) | (mx & 1);



        offset= (s->mb_x*8 + (mx>>1)) + (s->mb_y*8 + (my>>1))*s->uvlinesize;



        if(s->no_rounding){

            s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad    , s->last_picture.f.data[1] + offset, s->uvlinesize, 8);

            s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_picture.f.data[2] + offset, s->uvlinesize, 8);

        }else{

            s->hdsp.put_pixels_tab       [1][dxy](c->scratchpad    , s->last_picture.f.data[1] + offset, s->uvlinesize, 8);

            s->hdsp.put_pixels_tab       [1][dxy](c->scratchpad + 8, s->last_picture.f.data[2] + offset, s->uvlinesize, 8);

        }



        dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.f.data[1] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad  , s->uvlinesize, 8);

        dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.f.data[2] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad+8, s->uvlinesize, 8);

    }



    c->pred_x= mx;

    c->pred_y= my;



    switch(c->avctx->mb_cmp&0xFF){

    /*case FF_CMP_SSE:

        return dmin_sum+ 32*s->qscale*s->qscale;*/

    case FF_CMP_RD:

        return dmin_sum;

    default:

        return dmin_sum+ 11*c->mb_penalty_factor;

    }

}

static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift)

{

    MotionEstContext * const c= &s->me;

    const int size= 1;

    const int h=8;

    int block;

    int P[10][2];

    int dmin_sum=0, mx4_sum=0, my4_sum=0;

    int same=1;

    const int stride= c->stride;

    uint8_t *mv_penalty= c->current_mv_penalty;



    init_mv4_ref(c);



    for(block=0; block<4; block++){

        int mx4, my4;

        int pred_x4, pred_y4;

        int dmin4;

        static const int off[4]= {2, 1, 1, -1};

        const int mot_stride = s->b8_stride;

        const int mot_xy = s->block_index[block];



        P_LEFT[0] = s->current_picture.motion_val[0][mot_xy - 1][0];

        P_LEFT[1] = s->current_picture.motion_val[0][mot_xy - 1][1];



        if(P_LEFT[0]       > (c->xmax<<shift)) P_LEFT[0]       = (c->xmax<<shift);



        

        if (s->first_slice_line && block<2) {

            c->pred_x= pred_x4= P_LEFT[0];

            c->pred_y= pred_y4= P_LEFT[1];

        } else {

            P_TOP[0]      = s->current_picture.motion_val[0][mot_xy - mot_stride             ][0];

            P_TOP[1]      = s->current_picture.motion_val[0][mot_xy - mot_stride             ][1];

            P_TOPRIGHT[0] = s->current_picture.motion_val[0][mot_xy - mot_stride + off[block]][0];

            P_TOPRIGHT[1] = s->current_picture.motion_val[0][mot_xy - mot_stride + off[block]][1];

            if(P_TOP[1]      > (c->ymax<<shift)) P_TOP[1]     = (c->ymax<<shift);

            if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift);

            if(P_TOPRIGHT[0] > (c->xmax<<shift)) P_TOPRIGHT[0]= (c->xmax<<shift);

            if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift);



            P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);

            P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);



            c->pred_x= pred_x4 = P_MEDIAN[0];

            c->pred_y= pred_y4 = P_MEDIAN[1];

        }

        P_MV1[0]= mx;

        P_MV1[1]= my;



        dmin4 = epzs_motion_search4(s, &mx4, &my4, P, block, block, s->p_mv_table, (1<<16)>>shift);



        dmin4= c->sub_motion_search(s, &mx4, &my4, dmin4, block, block, size, h);



        if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){

            int dxy;

            const int offset= ((block&1) + (block>>1)*stride)*8;

            uint8_t *dest_y = c->scratchpad + offset;

            if(s->quarter_sample){

                uint8_t *ref= c->ref[block][0] + (mx4>>2) + (my4>>2)*stride;

                dxy = ((my4 & 3) << 2) | (mx4 & 3);



                if(s->no_rounding)

                    s->dsp.put_no_rnd_qpel_pixels_tab[1][dxy](dest_y   , ref    , stride);

                else

                    s->dsp.put_qpel_pixels_tab       [1][dxy](dest_y   , ref    , stride);

            }else{

                uint8_t *ref= c->ref[block][0] + (mx4>>1) + (my4>>1)*stride;

                dxy = ((my4 & 1) << 1) | (mx4 & 1);



                if(s->no_rounding)

                    s->hdsp.put_no_rnd_pixels_tab[1][dxy](dest_y    , ref    , stride, h);

                else

                    s->hdsp.put_pixels_tab       [1][dxy](dest_y    , ref    , stride, h);

            }

            dmin_sum+= (mv_penalty[mx4-pred_x4] + mv_penalty[my4-pred_y4])*c->mb_penalty_factor;

        }else

            dmin_sum+= dmin4;



        if(s->quarter_sample){

            mx4_sum+= mx4/2;

            my4_sum+= my4/2;

        }else{

            mx4_sum+= mx4;

            my4_sum+= my4;

        }



        s->current_picture.motion_val[0][s->block_index[block]][0] = mx4;

        s->current_picture.motion_val[0][s->block_index[block]][1] = my4;



        if(mx4 != mx || my4 != my) same=0;

    }



    if(same)

        return INT_MAX;



    if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){

        dmin_sum += s->dsp.mb_cmp[0](s, s->new_picture.f.data[0] + s->mb_x*16 + s->mb_y*16*stride, c->scratchpad, stride, 16);

    }



    if(c->avctx->mb_cmp&FF_CMP_CHROMA){

        int dxy;

        int mx, my;

        int offset;



        mx= ff_h263_round_chroma(mx4_sum);

        my= ff_h263_round_chroma(my4_sum);

        dxy = ((my & 1) << 1) | (mx & 1);



        offset= (s->mb_x*8 + (mx>>1)) + (s->mb_y*8 + (my>>1))*s->uvlinesize;



        if(s->no_rounding){

            s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad    , s->last_picture.f.data[1] + offset, s->uvlinesize, 8);

            s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_picture.f.data[2] + offset, s->uvlinesize, 8);

        }else{

            s->hdsp.put_pixels_tab       [1][dxy](c->scratchpad    , s->last_picture.f.data[1] + offset, s->uvlinesize, 8);

            s->hdsp.put_pixels_tab       [1][dxy](c->scratchpad + 8, s->last_picture.f.data[2] + offset, s->uvlinesize, 8);

        }



        dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.f.data[1] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad  , s->uvlinesize, 8);

        dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.f.data[2] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad+8, s->uvlinesize, 8);

    }



    c->pred_x= mx;

    c->pred_y= my;



    switch(c->avctx->mb_cmp&0xFF){

    



    case FF_CMP_RD:

        return dmin_sum;

    default:

        return dmin_sum+ 11*c->mb_penalty_factor;

    }

}

        dmin_sum += s->dsp.mb_cmp[0](s, s->new_picture.f.data[0] + s->mb_x*16 + s->mb_y*16*stride, c->scratchpad, stride, 16);             s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad    , s->last_picture.f.data[1] + offset, s->uvlinesize, 8);             s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_picture.f.data[2] + offset, s->uvlinesize, 8);             s->hdsp.put_pixels_tab       [1][dxy](c->scratchpad    , s->last_picture.f.data[1] + offset, s->uvlinesize, 8);             s->hdsp.put_pixels_tab       [1][dxy](c->scratchpad + 8, s->last_picture.f.data[2] + offset, s->uvlinesize, 8);         dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.f.data[1] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad  , s->uvlinesize, 8);         dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.f.data[2] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad+8, s->uvlinesize, 8);
static inline int FUNC_0(MpegEncContext *VAR_0, int VAR_23, int VAR_23, int VAR_3)

{

    MotionEstContext * const c= &VAR_0->me;

    const int VAR_4= 1;

    const int VAR_5=8;

    int VAR_6;

    int VAR_7[10][2];

    int VAR_8=0, VAR_9=0, VAR_10=0;

    int VAR_11=1;

    const int VAR_12= c->VAR_12;

    uint8_t *mv_penalty= c->current_mv_penalty;



    init_mv4_ref(c);



    for(VAR_6=0; VAR_6<4; VAR_6++){

        int VAR_13, VAR_14;

        int VAR_15, VAR_16;

        int VAR_17;

        static const int VAR_18[4]= {2, 1, 1, -1};

        const int VAR_19 = VAR_0->b8_stride;

        const int VAR_20 = VAR_0->block_index[VAR_6];



        P_LEFT[0] = VAR_0->current_picture.motion_val[0][VAR_20 - 1][0];

        P_LEFT[1] = VAR_0->current_picture.motion_val[0][VAR_20 - 1][1];



        if(P_LEFT[0]       > (c->xmax<<VAR_3)) P_LEFT[0]       = (c->xmax<<VAR_3);



        

        if (VAR_0->first_slice_line && VAR_6<2) {

            c->pred_x= VAR_15= P_LEFT[0];

            c->pred_y= VAR_16= P_LEFT[1];

        } else {

            P_TOP[0]      = VAR_0->current_picture.motion_val[0][VAR_20 - VAR_19             ][0];

            P_TOP[1]      = VAR_0->current_picture.motion_val[0][VAR_20 - VAR_19             ][1];

            P_TOPRIGHT[0] = VAR_0->current_picture.motion_val[0][VAR_20 - VAR_19 + VAR_18[VAR_6]][0];

            P_TOPRIGHT[1] = VAR_0->current_picture.motion_val[0][VAR_20 - VAR_19 + VAR_18[VAR_6]][1];

            if(P_TOP[1]      > (c->ymax<<VAR_3)) P_TOP[1]     = (c->ymax<<VAR_3);

            if(P_TOPRIGHT[0] < (c->xmin<<VAR_3)) P_TOPRIGHT[0]= (c->xmin<<VAR_3);

            if(P_TOPRIGHT[0] > (c->xmax<<VAR_3)) P_TOPRIGHT[0]= (c->xmax<<VAR_3);

            if(P_TOPRIGHT[1] > (c->ymax<<VAR_3)) P_TOPRIGHT[1]= (c->ymax<<VAR_3);



            P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);

            P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);



            c->pred_x= VAR_15 = P_MEDIAN[0];

            c->pred_y= VAR_16 = P_MEDIAN[1];

        }

        P_MV1[0]= VAR_23;

        P_MV1[1]= VAR_23;



        VAR_17 = epzs_motion_search4(VAR_0, &VAR_13, &VAR_14, VAR_7, VAR_6, VAR_6, VAR_0->p_mv_table, (1<<16)>>VAR_3);



        VAR_17= c->sub_motion_search(VAR_0, &VAR_13, &VAR_14, VAR_17, VAR_6, VAR_6, VAR_4, VAR_5);



        if(VAR_0->dsp.me_sub_cmp[0] != VAR_0->dsp.mb_cmp[0]){

            int VAR_23;

            const int VAR_23= ((VAR_6&1) + (VAR_6>>1)*VAR_12)*8;

            uint8_t *dest_y = c->scratchpad + VAR_23;

            if(VAR_0->quarter_sample){

                uint8_t *ref= c->ref[VAR_6][0] + (VAR_13>>2) + (VAR_14>>2)*VAR_12;

                VAR_23 = ((VAR_14 & 3) << 2) | (VAR_13 & 3);



                if(VAR_0->no_rounding)

                    VAR_0->dsp.put_no_rnd_qpel_pixels_tab[1][VAR_23](dest_y   , ref    , VAR_12);

                else

                    VAR_0->dsp.put_qpel_pixels_tab       [1][VAR_23](dest_y   , ref    , VAR_12);

            }else{

                uint8_t *ref= c->ref[VAR_6][0] + (VAR_13>>1) + (VAR_14>>1)*VAR_12;

                VAR_23 = ((VAR_14 & 1) << 1) | (VAR_13 & 1);



                if(VAR_0->no_rounding)

                    VAR_0->hdsp.put_no_rnd_pixels_tab[1][VAR_23](dest_y    , ref    , VAR_12, VAR_5);

                else

                    VAR_0->hdsp.put_pixels_tab       [1][VAR_23](dest_y    , ref    , VAR_12, VAR_5);

            }

            VAR_8+= (mv_penalty[VAR_13-VAR_15] + mv_penalty[VAR_14-VAR_16])*c->mb_penalty_factor;

        }else

            VAR_8+= VAR_17;



        if(VAR_0->quarter_sample){

            VAR_9+= VAR_13/2;

            VAR_10+= VAR_14/2;

        }else{

            VAR_9+= VAR_13;

            VAR_10+= VAR_14;

        }



        VAR_0->current_picture.motion_val[0][VAR_0->block_index[VAR_6]][0] = VAR_13;

        VAR_0->current_picture.motion_val[0][VAR_0->block_index[VAR_6]][1] = VAR_14;



        if(VAR_13 != VAR_23 || VAR_14 != VAR_23) VAR_11=0;

    }



    if(VAR_11)

        return INT_MAX;



    if(VAR_0->dsp.me_sub_cmp[0] != VAR_0->dsp.mb_cmp[0]){

        VAR_8 += VAR_0->dsp.mb_cmp[0](VAR_0, VAR_0->new_picture.f.data[0] + VAR_0->mb_x*16 + VAR_0->mb_y*16*VAR_12, c->scratchpad, VAR_12, 16);

    }



    if(c->avctx->mb_cmp&FF_CMP_CHROMA){

        int VAR_23;

        int VAR_23, VAR_23;

        int VAR_23;



        VAR_23= ff_h263_round_chroma(VAR_9);

        VAR_23= ff_h263_round_chroma(VAR_10);

        VAR_23 = ((VAR_23 & 1) << 1) | (VAR_23 & 1);



        VAR_23= (VAR_0->mb_x*8 + (VAR_23>>1)) + (VAR_0->mb_y*8 + (VAR_23>>1))*VAR_0->uvlinesize;



        if(VAR_0->no_rounding){

            VAR_0->hdsp.put_no_rnd_pixels_tab[1][VAR_23](c->scratchpad    , VAR_0->last_picture.f.data[1] + VAR_23, VAR_0->uvlinesize, 8);

            VAR_0->hdsp.put_no_rnd_pixels_tab[1][VAR_23](c->scratchpad + 8, VAR_0->last_picture.f.data[2] + VAR_23, VAR_0->uvlinesize, 8);

        }else{

            VAR_0->hdsp.put_pixels_tab       [1][VAR_23](c->scratchpad    , VAR_0->last_picture.f.data[1] + VAR_23, VAR_0->uvlinesize, 8);

            VAR_0->hdsp.put_pixels_tab       [1][VAR_23](c->scratchpad + 8, VAR_0->last_picture.f.data[2] + VAR_23, VAR_0->uvlinesize, 8);

        }



        VAR_8 += VAR_0->dsp.mb_cmp[1](VAR_0, VAR_0->new_picture.f.data[1] + VAR_0->mb_x*8 + VAR_0->mb_y*8*VAR_0->uvlinesize, c->scratchpad  , VAR_0->uvlinesize, 8);

        VAR_8 += VAR_0->dsp.mb_cmp[1](VAR_0, VAR_0->new_picture.f.data[2] + VAR_0->mb_x*8 + VAR_0->mb_y*8*VAR_0->uvlinesize, c->scratchpad+8, VAR_0->uvlinesize, 8);

    }



    c->pred_x= VAR_23;

    c->pred_y= VAR_23;



    switch(c->avctx->mb_cmp&0xFF){

    



    case FF_CMP_RD:

        return VAR_8;

    default:

        return VAR_8+ 11*c->mb_penalty_factor;

    }

}

static inline int FUNC_0(MpegEncContext *VAR_0, int VAR_23, int VAR_23, int VAR_3)
{ MotionEstContext * const c= &VAR_0->me; const int VAR_4= 1; const int VAR_5=8; int VAR_6; int VAR_7[10][2]; int VAR_8=0, VAR_9=0, VAR_10=0; int VAR_11=1; const int VAR_12= c->VAR_12; uint8_t *mv_penalty= c->current_mv_penalty; init_mv4_ref(c); for(VAR_6=0; VAR_6<4; VAR_6++){ int VAR_13, VAR_14; int VAR_15, VAR_16; int VAR_17; static const int VAR_18[4]= {2, 1, 1, -1}; const int VAR_19 = VAR_0->b8_stride; const int VAR_20 = VAR_0->block_index[VAR_6]; P_LEFT[0] = VAR_0->current_picture.motion_val[0][VAR_20 - 1][0]; P_LEFT[1] = VAR_0->current_picture.motion_val[0][VAR_20 - 1][1]; if(P_LEFT[0]       > (c->xmax<<VAR_3)) P_LEFT[0]       = (c->xmax<<VAR_3); if (VAR_0->first_slice_line && VAR_6<2) { c->pred_x= VAR_15= P_LEFT[0]; c->pred_y= VAR_16= P_LEFT[1]; } else { P_TOP[0]      = VAR_0->current_picture.motion_val[0][VAR_20 - VAR_19             ][0]; P_TOP[1]      = VAR_0->current_picture.motion_val[0][VAR_20 - VAR_19             ][1]; P_TOPRIGHT[0] = VAR_0->current_picture.motion_val[0][VAR_20 - VAR_19 + VAR_18[VAR_6]][0]; P_TOPRIGHT[1] = VAR_0->current_picture.motion_val[0][VAR_20 - VAR_19 + VAR_18[VAR_6]][1]; if(P_TOP[1]      > (c->ymax<<VAR_3)) P_TOP[1]     = (c->ymax<<VAR_3); if(P_TOPRIGHT[0] < (c->xmin<<VAR_3)) P_TOPRIGHT[0]= (c->xmin<<VAR_3); if(P_TOPRIGHT[0] > (c->xmax<<VAR_3)) P_TOPRIGHT[0]= (c->xmax<<VAR_3); if(P_TOPRIGHT[1] > (c->ymax<<VAR_3)) P_TOPRIGHT[1]= (c->ymax<<VAR_3); P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]); P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]); c->pred_x= VAR_15 = P_MEDIAN[0]; c->pred_y= VAR_16 = P_MEDIAN[1]; } P_MV1[0]= VAR_23; P_MV1[1]= VAR_23; VAR_17 = epzs_motion_search4(VAR_0, &VAR_13, &VAR_14, VAR_7, VAR_6, VAR_6, VAR_0->p_mv_table, (1<<16)>>VAR_3); VAR_17= c->sub_motion_search(VAR_0, &VAR_13, &VAR_14, VAR_17, VAR_6, VAR_6, VAR_4, VAR_5); if(VAR_0->dsp.me_sub_cmp[0] != VAR_0->dsp.mb_cmp[0]){ int VAR_23; const int VAR_23= ((VAR_6&1) + (VAR_6>>1)*VAR_12)*8; uint8_t *dest_y = c->scratchpad + VAR_23; if(VAR_0->quarter_sample){ uint8_t *ref= c->ref[VAR_6][0] + (VAR_13>>2) + (VAR_14>>2)*VAR_12; VAR_23 = ((VAR_14 & 3) << 2) | (VAR_13 & 3); if(VAR_0->no_rounding)
VAR_0->dsp.put_no_rnd_qpel_pixels_tab[1][VAR_23](dest_y   , ref    , VAR_12); else
VAR_0->dsp.put_qpel_pixels_tab       [1][VAR_23](dest_y   , ref    , VAR_12); }else{ uint8_t *ref= c->ref[VAR_6][0] + (VAR_13>>1) + (VAR_14>>1)*VAR_12; VAR_23 = ((VAR_14 & 1) << 1) | (VAR_13 & 1); if(VAR_0->no_rounding)
VAR_0->hdsp.put_no_rnd_pixels_tab[1][VAR_23](dest_y    , ref    , VAR_12, VAR_5); else
VAR_0->hdsp.put_pixels_tab       [1][VAR_23](dest_y    , ref    , VAR_12, VAR_5); } VAR_8+= (mv_penalty[VAR_13-VAR_15] + mv_penalty[VAR_14-VAR_16])*c->mb_penalty_factor; }else VAR_8+= VAR_17; if(VAR_0->quarter_sample){ VAR_9+= VAR_13/2; VAR_10+= VAR_14/2; }else{ VAR_9+= VAR_13; VAR_10+= VAR_14; } VAR_0->current_picture.motion_val[0][VAR_0->block_index[VAR_6]][0] = VAR_13; VAR_0->current_picture.motion_val[0][VAR_0->block_index[VAR_6]][1] = VAR_14; if(VAR_13 != VAR_23 || VAR_14 != VAR_23) VAR_11=0; } if(VAR_11)
return INT_MAX; if(VAR_0->dsp.me_sub_cmp[0] != VAR_0->dsp.mb_cmp[0]){ VAR_8 += VAR_0->dsp.mb_cmp[0](VAR_0, VAR_0->new_picture.f.data[0] + VAR_0->mb_x*16 + VAR_0->mb_y*16*VAR_12, c->scratchpad, VAR_12, 16); } if(c->avctx->mb_cmp&FF_CMP_CHROMA){ int VAR_23; int VAR_23, VAR_23; int VAR_23; VAR_23= ff_h263_round_chroma(VAR_9); VAR_23= ff_h263_round_chroma(VAR_10); VAR_23 = ((VAR_23 & 1) << 1) | (VAR_23 & 1); VAR_23= (VAR_0->mb_x*8 + (VAR_23>>1)) + (VAR_0->mb_y*8 + (VAR_23>>1))*VAR_0->uvlinesize; if(VAR_0->no_rounding){ VAR_0->hdsp.put_no_rnd_pixels_tab[1][VAR_23](c->scratchpad    , VAR_0->last_picture.f.data[1] + VAR_23, VAR_0->uvlinesize, 8); VAR_0->hdsp.put_no_rnd_pixels_tab[1][VAR_23](c->scratchpad + 8, VAR_0->last_picture.f.data[2] + VAR_23, VAR_0->uvlinesize, 8); }else{ VAR_0->hdsp.put_pixels_tab       [1][VAR_23](c->scratchpad    , VAR_0->last_picture.f.data[1] + VAR_23, VAR_0->uvlinesize, 8); VAR_0->hdsp.put_pixels_tab       [1][VAR_23](c->scratchpad + 8, VAR_0->last_picture.f.data[2] + VAR_23, VAR_0->uvlinesize, 8); } VAR_8 += VAR_0->dsp.mb_cmp[1](VAR_0, VAR_0->new_picture.f.data[1] + VAR_0->mb_x*8 + VAR_0->mb_y*8*VAR_0->uvlinesize, c->scratchpad  , VAR_0->uvlinesize, 8); VAR_8 += VAR_0->dsp.mb_cmp[1](VAR_0, VAR_0->new_picture.f.data[2] + VAR_0->mb_x*8 + VAR_0->mb_y*8*VAR_0->uvlinesize, c->scratchpad+8, VAR_0->uvlinesize, 8); } c->pred_x= VAR_23; c->pred_y= VAR_23; switch(c->avctx->mb_cmp&0xFF){ case FF_CMP_RD:
return VAR_8; default:
return VAR_8+ 11*c->mb_penalty_factor; } }