static inline void chroma_4mv_motion_lowres(MpegEncContext *s,

                                            uint8_t *dest_cb, uint8_t *dest_cr,

                                            uint8_t **ref_picture,

                                            h264_chroma_mc_func * pix_op,

                                            int mx, int my)

{

    const int lowres     = s->avctx->lowres;

    const int op_index   = FFMIN(lowres, 2);

    const int block_s    = 8 >> lowres;

    const int s_mask     = (2 << lowres) - 1;

    const int h_edge_pos = s->h_edge_pos >> lowres + 1;

    const int v_edge_pos = s->v_edge_pos >> lowres + 1;

    int emu = 0, src_x, src_y, offset, sx, sy;

    uint8_t *ptr;



    if (s->quarter_sample) {

        mx /= 2;

        my /= 2;

    }



    /* In case of 8X8, we construct a single chroma motion vector

       with a special rounding */

    mx = ff_h263_round_chroma(mx);

    my = ff_h263_round_chroma(my);



    sx = mx & s_mask;

    sy = my & s_mask;

    src_x = s->mb_x * block_s + (mx >> lowres + 1);

    src_y = s->mb_y * block_s + (my >> lowres + 1);



    offset = src_y * s->uvlinesize + src_x;

    ptr = ref_picture[1] + offset;

    if (s->flags & CODEC_FLAG_EMU_EDGE) {

        if ((unsigned) src_x > h_edge_pos - (!!sx) - block_s ||

            (unsigned) src_y > v_edge_pos - (!!sy) - block_s) {

            s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,

                                    9, 9, src_x, src_y, h_edge_pos, v_edge_pos);

            ptr = s->edge_emu_buffer;

            emu = 1;

        }

    }

    sx = (sx << 2) >> lowres;

    sy = (sy << 2) >> lowres;

    pix_op[op_index](dest_cb, ptr, s->uvlinesize, block_s, sx, sy);



    ptr = ref_picture[2] + offset;

    if (emu) {

        s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9,

                                src_x, src_y, h_edge_pos, v_edge_pos);

        ptr = s->edge_emu_buffer;

    }

    pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy);

}

static inline void chroma_4mv_motion_lowres(MpegEncContext *s,

                                            uint8_t *dest_cb, uint8_t *dest_cr,

                                            uint8_t **ref_picture,

                                            h264_chroma_mc_func * pix_op,

                                            int mx, int my)

{

    const int lowres     = s->avctx->lowres;

    const int op_index   = FFMIN(lowres, 2);

    const int block_s    = 8 >> lowres;

    const int s_mask     = (2 << lowres) - 1;

    const int h_edge_pos = s->h_edge_pos >> lowres + 1;

    const int v_edge_pos = s->v_edge_pos >> lowres + 1;

    int emu = 0, src_x, src_y, offset, sx, sy;

    uint8_t *ptr;



    if (s->quarter_sample) {

        mx /= 2;

        my /= 2;

    }



    



    mx = ff_h263_round_chroma(mx);

    my = ff_h263_round_chroma(my);



    sx = mx & s_mask;

    sy = my & s_mask;

    src_x = s->mb_x * block_s + (mx >> lowres + 1);

    src_y = s->mb_y * block_s + (my >> lowres + 1);



    offset = src_y * s->uvlinesize + src_x;

    ptr = ref_picture[1] + offset;

    if (s->flags & CODEC_FLAG_EMU_EDGE) {

        if ((unsigned) src_x > h_edge_pos - (!!sx) - block_s ||

            (unsigned) src_y > v_edge_pos - (!!sy) - block_s) {

            s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,

                                    9, 9, src_x, src_y, h_edge_pos, v_edge_pos);

            ptr = s->edge_emu_buffer;

            emu = 1;

        }

    }

    sx = (sx << 2) >> lowres;

    sy = (sy << 2) >> lowres;

    pix_op[op_index](dest_cb, ptr, s->uvlinesize, block_s, sx, sy);



    ptr = ref_picture[2] + offset;

    if (emu) {

        s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9,

                                src_x, src_y, h_edge_pos, v_edge_pos);

        ptr = s->edge_emu_buffer;

    }

    pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy);

}

        if ((unsigned) src_x > h_edge_pos - (!!sx) - block_s ||             (unsigned) src_y > v_edge_pos - (!!sy) - block_s) {
static inline void FUNC_0(MpegEncContext *VAR_0,

                                            uint8_t *VAR_1, uint8_t *VAR_2,

                                            uint8_t **VAR_3,

                                            h264_chroma_mc_func * VAR_4,

                                            int VAR_5, int VAR_6)

{

    const int VAR_7     = VAR_0->avctx->VAR_7;

    const int VAR_8   = FFMIN(VAR_7, 2);

    const int VAR_9    = 8 >> VAR_7;

    const int VAR_10     = (2 << VAR_7) - 1;

    const int VAR_11 = VAR_0->VAR_11 >> VAR_7 + 1;

    const int VAR_12 = VAR_0->VAR_12 >> VAR_7 + 1;

    int VAR_13 = 0, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18;

    uint8_t *ptr;



    if (VAR_0->quarter_sample) {

        VAR_5 /= 2;

        VAR_6 /= 2;

    }



    



    VAR_5 = ff_h263_round_chroma(VAR_5);

    VAR_6 = ff_h263_round_chroma(VAR_6);



    VAR_17 = VAR_5 & VAR_10;

    VAR_18 = VAR_6 & VAR_10;

    VAR_14 = VAR_0->mb_x * VAR_9 + (VAR_5 >> VAR_7 + 1);

    VAR_15 = VAR_0->mb_y * VAR_9 + (VAR_6 >> VAR_7 + 1);



    VAR_16 = VAR_15 * VAR_0->uvlinesize + VAR_14;

    ptr = VAR_3[1] + VAR_16;

    if (VAR_0->flags & CODEC_FLAG_EMU_EDGE) {

        if ((unsigned) VAR_14 > VAR_11 - (!!VAR_17) - VAR_9 ||

            (unsigned) VAR_15 > VAR_12 - (!!VAR_18) - VAR_9) {

            VAR_0->dsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_0->uvlinesize,

                                    9, 9, VAR_14, VAR_15, VAR_11, VAR_12);

            ptr = VAR_0->edge_emu_buffer;

            VAR_13 = 1;

        }

    }

    VAR_17 = (VAR_17 << 2) >> VAR_7;

    VAR_18 = (VAR_18 << 2) >> VAR_7;

    VAR_4[VAR_8](VAR_1, ptr, VAR_0->uvlinesize, VAR_9, VAR_17, VAR_18);



    ptr = VAR_3[2] + VAR_16;

    if (VAR_13) {

        VAR_0->dsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_0->uvlinesize, 9, 9,

                                VAR_14, VAR_15, VAR_11, VAR_12);

        ptr = VAR_0->edge_emu_buffer;

    }

    VAR_4[VAR_8](VAR_2, ptr, VAR_0->uvlinesize, VAR_9, VAR_17, VAR_18);

}

static inline void FUNC_0(MpegEncContext *VAR_0,
uint8_t *VAR_1, uint8_t *VAR_2,
uint8_t **VAR_3,
h264_chroma_mc_func * VAR_4,
int VAR_5, int VAR_6)
{ const int VAR_7     = VAR_0->avctx->VAR_7; const int VAR_8   = FFMIN(VAR_7, 2); const int VAR_9    = 8 >> VAR_7; const int VAR_10     = (2 << VAR_7) - 1; const int VAR_11 = VAR_0->VAR_11 >> VAR_7 + 1; const int VAR_12 = VAR_0->VAR_12 >> VAR_7 + 1; int VAR_13 = 0, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18; uint8_t *ptr; if (VAR_0->quarter_sample) { VAR_5 /= 2; VAR_6 /= 2; } VAR_5 = ff_h263_round_chroma(VAR_5); VAR_6 = ff_h263_round_chroma(VAR_6); VAR_17 = VAR_5 & VAR_10; VAR_18 = VAR_6 & VAR_10; VAR_14 = VAR_0->mb_x * VAR_9 + (VAR_5 >> VAR_7 + 1); VAR_15 = VAR_0->mb_y * VAR_9 + (VAR_6 >> VAR_7 + 1); VAR_16 = VAR_15 * VAR_0->uvlinesize + VAR_14; ptr = VAR_3[1] + VAR_16; if (VAR_0->flags & CODEC_FLAG_EMU_EDGE) { if ((unsigned) VAR_14 > VAR_11 - (!!VAR_17) - VAR_9 ||
(unsigned) VAR_15 > VAR_12 - (!!VAR_18) - VAR_9) { VAR_0->dsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_0->uvlinesize,
9, 9, VAR_14, VAR_15, VAR_11, VAR_12); ptr = VAR_0->edge_emu_buffer; VAR_13 = 1; } } VAR_17 = (VAR_17 << 2) >> VAR_7; VAR_18 = (VAR_18 << 2) >> VAR_7; VAR_4[VAR_8](VAR_1, ptr, VAR_0->uvlinesize, VAR_9, VAR_17, VAR_18); ptr = VAR_3[2] + VAR_16; if (VAR_13) { VAR_0->dsp.emulated_edge_mc(VAR_0->edge_emu_buffer, ptr, VAR_0->uvlinesize, 9, 9,
VAR_14, VAR_15, VAR_11, VAR_12); ptr = VAR_0->edge_emu_buffer; } VAR_4[VAR_8](VAR_2, ptr, VAR_0->uvlinesize, VAR_9, VAR_17, VAR_18); }