static inline int hpel_motion_lowres(MpegEncContext *s,

                                     uint8_t *dest, uint8_t *src,

                                     int field_based, int field_select,

                                     int src_x, int src_y,

                                     int width, int height, int stride,

                                     int h_edge_pos, int v_edge_pos,

                                     int w, int h, h264_chroma_mc_func *pix_op,

                                     int motion_x, int motion_y)

{

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

    const int op_index = FFMIN(lowres, 3);

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

    int emu = 0;

    int sx, sy;



    if (s->quarter_sample) {

        motion_x /= 2;

        motion_y /= 2;

    }



    sx = motion_x & s_mask;

    sy = motion_y & s_mask;

    src_x += motion_x >> lowres + 1;

    src_y += motion_y >> lowres + 1;



    src   += src_y * stride + src_x;



    if ((unsigned)src_x > FFMAX( h_edge_pos - (!!sx) - w,                 0) ||

        (unsigned)src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {

        s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w + 1,

                                (h + 1) << field_based, src_x,

                                src_y   << field_based,

                                h_edge_pos,

                                v_edge_pos);

        src = s->edge_emu_buffer;

        emu = 1;

    }



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

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

    if (field_select)

        src += s->linesize;

    pix_op[op_index](dest, src, stride, h, sx, sy);

    return emu;

}

static inline int hpel_motion_lowres(MpegEncContext *s,

                                     uint8_t *dest, uint8_t *src,

                                     int field_based, int field_select,

                                     int src_x, int src_y,

                                     int width, int height, int stride,

                                     int h_edge_pos, int v_edge_pos,

                                     int w, int h, h264_chroma_mc_func *pix_op,

                                     int motion_x, int motion_y)

{

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

    const int op_index = FFMIN(lowres, 3);

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

    int emu = 0;

    int sx, sy;



    if (s->quarter_sample) {

        motion_x /= 2;

        motion_y /= 2;

    }



    sx = motion_x & s_mask;

    sy = motion_y & s_mask;

    src_x += motion_x >> lowres + 1;

    src_y += motion_y >> lowres + 1;



    src   += src_y * stride + src_x;



    if ((unsigned)src_x > FFMAX( h_edge_pos - (!!sx) - w,                 0) ||

        (unsigned)src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {

        s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w + 1,

                                (h + 1) << field_based, src_x,

                                src_y   << field_based,

                                h_edge_pos,

                                v_edge_pos);

        src = s->edge_emu_buffer;

        emu = 1;

    }



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

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

    if (field_select)

        src += s->linesize;

    pix_op[op_index](dest, src, stride, h, sx, sy);

    return emu;

}

                                     int width, int height, int stride,
static inline int FUNC_0(MpegEncContext *VAR_0,

                                     uint8_t *VAR_1, uint8_t *VAR_2,

                                     int VAR_3, int VAR_4,

                                     int VAR_5, int VAR_6,

                                     int VAR_7, int VAR_8, int VAR_9,

                                     int VAR_10, int VAR_11,

                                     int VAR_12, int VAR_13, h264_chroma_mc_func *VAR_14,

                                     int VAR_15, int VAR_16)

{

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

    const int VAR_18 = FFMIN(VAR_17, 3);

    const int VAR_19   = (2 << VAR_17) - 1;

    int VAR_20 = 0;

    int VAR_21, VAR_22;



    if (VAR_0->quarter_sample) {

        VAR_15 /= 2;

        VAR_16 /= 2;

    }



    VAR_21 = VAR_15 & VAR_19;

    VAR_22 = VAR_16 & VAR_19;

    VAR_5 += VAR_15 >> VAR_17 + 1;

    VAR_6 += VAR_16 >> VAR_17 + 1;



    VAR_2   += VAR_6 * VAR_9 + VAR_5;



    if ((unsigned)VAR_5 > FFMAX( VAR_10 - (!!VAR_21) - VAR_12,                 0) ||

        (unsigned)VAR_6 > FFMAX((VAR_11 >> VAR_3) - (!!VAR_22) - VAR_13, 0)) {

        VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, VAR_2, VAR_0->linesize, VAR_12 + 1,

                                (VAR_13 + 1) << VAR_3, VAR_5,

                                VAR_6   << VAR_3,

                                VAR_10,

                                VAR_11);

        VAR_2 = VAR_0->edge_emu_buffer;

        VAR_20 = 1;

    }



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

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

    if (VAR_4)

        VAR_2 += VAR_0->linesize;

    VAR_14[VAR_18](VAR_1, VAR_2, VAR_9, VAR_13, VAR_21, VAR_22);

    return VAR_20;

}

static inline int FUNC_0(MpegEncContext *VAR_0,
uint8_t *VAR_1, uint8_t *VAR_2,
int VAR_3, int VAR_4,
int VAR_5, int VAR_6,
int VAR_7, int VAR_8, int VAR_9,
int VAR_10, int VAR_11,
int VAR_12, int VAR_13, h264_chroma_mc_func *VAR_14,
int VAR_15, int VAR_16)
{ const int VAR_17   = VAR_0->avctx->VAR_17; const int VAR_18 = FFMIN(VAR_17, 3); const int VAR_19   = (2 << VAR_17) - 1; int VAR_20 = 0; int VAR_21, VAR_22; if (VAR_0->quarter_sample) { VAR_15 /= 2; VAR_16 /= 2; } VAR_21 = VAR_15 & VAR_19; VAR_22 = VAR_16 & VAR_19; VAR_5 += VAR_15 >> VAR_17 + 1; VAR_6 += VAR_16 >> VAR_17 + 1; VAR_2   += VAR_6 * VAR_9 + VAR_5; if ((unsigned)VAR_5 > FFMAX( VAR_10 - (!!VAR_21) - VAR_12,                 0) ||
(unsigned)VAR_6 > FFMAX((VAR_11 >> VAR_3) - (!!VAR_22) - VAR_13, 0)) { VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, VAR_2, VAR_0->linesize, VAR_12 + 1,
(VAR_13 + 1) << VAR_3, VAR_5,
VAR_6   << VAR_3,
VAR_10,
VAR_11); VAR_2 = VAR_0->edge_emu_buffer; VAR_20 = 1; } VAR_21 = (VAR_21 << 2) >> VAR_17; VAR_22 = (VAR_22 << 2) >> VAR_17; if (VAR_4)
VAR_2 += VAR_0->linesize; VAR_14[VAR_18](VAR_1, VAR_2, VAR_9, VAR_13, VAR_21, VAR_22); return VAR_20; }