static inline void mpeg_motion(MpegEncContext *s,

                               UINT8 *dest_y, UINT8 *dest_cb, UINT8 *dest_cr,

                               int dest_offset,

                               UINT8 **ref_picture, int src_offset,

                               int field_based, op_pixels_func *pix_op,

                               int motion_x, int motion_y, int h)

{

    UINT8 *ptr;

    int dxy, offset, mx, my, src_x, src_y, height, linesize;

if(s->quarter_sample)

{

    motion_x>>=1;

    motion_y>>=1;

}



    dxy = ((motion_y & 1) << 1) | (motion_x & 1);

    src_x = s->mb_x * 16 + (motion_x >> 1);

    src_y = s->mb_y * (16 >> field_based) + (motion_y >> 1);

                

    /* WARNING: do no forget half pels */

    height = s->height >> field_based;

    src_x = clip(src_x, -16, s->width);

    if (src_x == s->width)

        dxy &= ~1;

    src_y = clip(src_y, -16, height);

    if (src_y == height)

        dxy &= ~2;

    linesize = s->linesize << field_based;

    ptr = ref_picture[0] + (src_y * linesize) + (src_x) + src_offset;

    dest_y += dest_offset;

    pix_op[dxy](dest_y, ptr, linesize, h);

    pix_op[dxy](dest_y + 8, ptr + 8, linesize, h);



    if (s->out_format == FMT_H263) {

        dxy = 0;

        if ((motion_x & 3) != 0)

            dxy |= 1;

        if ((motion_y & 3) != 0)

            dxy |= 2;

        mx = motion_x >> 2;

        my = motion_y >> 2;

    } else {

        mx = motion_x / 2;

        my = motion_y / 2;

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

        mx >>= 1;

        my >>= 1;

    }

    

    src_x = s->mb_x * 8 + mx;

    src_y = s->mb_y * (8 >> field_based) + my;

    src_x = clip(src_x, -8, s->width >> 1);

    if (src_x == (s->width >> 1))

        dxy &= ~1;

    src_y = clip(src_y, -8, height >> 1);

    if (src_y == (height >> 1))

        dxy &= ~2;



    offset = (src_y * (linesize >> 1)) + src_x + (src_offset >> 1);

    ptr = ref_picture[1] + offset;

    pix_op[dxy](dest_cb + (dest_offset >> 1), ptr, linesize >> 1, h >> 1);

    ptr = ref_picture[2] + offset;

    pix_op[dxy](dest_cr + (dest_offset >> 1), ptr, linesize >> 1, h >> 1);

}

static inline void mpeg_motion(MpegEncContext *s,

                               UINT8 *dest_y, UINT8 *dest_cb, UINT8 *dest_cr,

                               int dest_offset,

                               UINT8 **ref_picture, int src_offset,

                               int field_based, op_pixels_func *pix_op,

                               int motion_x, int motion_y, int h)

{

    UINT8 *ptr;

    int dxy, offset, mx, my, src_x, src_y, height, linesize;

if(s->quarter_sample)

{

    motion_x>>=1;

    motion_y>>=1;

}



    dxy = ((motion_y & 1) << 1) | (motion_x & 1);

    src_x = s->mb_x * 16 + (motion_x >> 1);

    src_y = s->mb_y * (16 >> field_based) + (motion_y >> 1);

                

    

    height = s->height >> field_based;

    src_x = clip(src_x, -16, s->width);

    if (src_x == s->width)

        dxy &= ~1;

    src_y = clip(src_y, -16, height);

    if (src_y == height)

        dxy &= ~2;

    linesize = s->linesize << field_based;

    ptr = ref_picture[0] + (src_y * linesize) + (src_x) + src_offset;

    dest_y += dest_offset;

    pix_op[dxy](dest_y, ptr, linesize, h);

    pix_op[dxy](dest_y + 8, ptr + 8, linesize, h);



    if (s->out_format == FMT_H263) {

        dxy = 0;

        if ((motion_x & 3) != 0)

            dxy |= 1;

        if ((motion_y & 3) != 0)

            dxy |= 2;

        mx = motion_x >> 2;

        my = motion_y >> 2;

    } else {

        mx = motion_x / 2;

        my = motion_y / 2;

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

        mx >>= 1;

        my >>= 1;

    }

    

    src_x = s->mb_x * 8 + mx;

    src_y = s->mb_y * (8 >> field_based) + my;

    src_x = clip(src_x, -8, s->width >> 1);

    if (src_x == (s->width >> 1))

        dxy &= ~1;

    src_y = clip(src_y, -8, height >> 1);

    if (src_y == (height >> 1))

        dxy &= ~2;



    offset = (src_y * (linesize >> 1)) + src_x + (src_offset >> 1);

    ptr = ref_picture[1] + offset;

    pix_op[dxy](dest_cb + (dest_offset >> 1), ptr, linesize >> 1, h >> 1);

    ptr = ref_picture[2] + offset;

    pix_op[dxy](dest_cr + (dest_offset >> 1), ptr, linesize >> 1, h >> 1);

}

static inline void FUNC_0(MpegEncContext *VAR_0,

                               UINT8 *VAR_1, UINT8 *VAR_2, UINT8 *VAR_3,

                               int VAR_4,

                               UINT8 **VAR_5, int VAR_6,

                               int VAR_7, op_pixels_func *VAR_8,

                               int VAR_9, int VAR_10, int VAR_11)

{

    UINT8 *ptr;

    int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19;

if(VAR_0->quarter_sample)

{

    VAR_9>>=1;

    VAR_10>>=1;

}



    VAR_12 = ((VAR_10 & 1) << 1) | (VAR_9 & 1);

    VAR_16 = VAR_0->mb_x * 16 + (VAR_9 >> 1);

    VAR_17 = VAR_0->mb_y * (16 >> VAR_7) + (VAR_10 >> 1);

                

    

    VAR_18 = VAR_0->VAR_18 >> VAR_7;

    VAR_16 = clip(VAR_16, -16, VAR_0->width);

    if (VAR_16 == VAR_0->width)

        VAR_12 &= ~1;

    VAR_17 = clip(VAR_17, -16, VAR_18);

    if (VAR_17 == VAR_18)

        VAR_12 &= ~2;

    VAR_19 = VAR_0->VAR_19 << VAR_7;

    ptr = VAR_5[0] + (VAR_17 * VAR_19) + (VAR_16) + VAR_6;

    VAR_1 += VAR_4;

    VAR_8[VAR_12](VAR_1, ptr, VAR_19, VAR_11);

    VAR_8[VAR_12](VAR_1 + 8, ptr + 8, VAR_19, VAR_11);



    if (VAR_0->out_format == FMT_H263) {

        VAR_12 = 0;

        if ((VAR_9 & 3) != 0)

            VAR_12 |= 1;

        if ((VAR_10 & 3) != 0)

            VAR_12 |= 2;

        VAR_14 = VAR_9 >> 2;

        VAR_15 = VAR_10 >> 2;

    } else {

        VAR_14 = VAR_9 / 2;

        VAR_15 = VAR_10 / 2;

        VAR_12 = ((VAR_15 & 1) << 1) | (VAR_14 & 1);

        VAR_14 >>= 1;

        VAR_15 >>= 1;

    }

    

    VAR_16 = VAR_0->mb_x * 8 + VAR_14;

    VAR_17 = VAR_0->mb_y * (8 >> VAR_7) + VAR_15;

    VAR_16 = clip(VAR_16, -8, VAR_0->width >> 1);

    if (VAR_16 == (VAR_0->width >> 1))

        VAR_12 &= ~1;

    VAR_17 = clip(VAR_17, -8, VAR_18 >> 1);

    if (VAR_17 == (VAR_18 >> 1))

        VAR_12 &= ~2;



    VAR_13 = (VAR_17 * (VAR_19 >> 1)) + VAR_16 + (VAR_6 >> 1);

    ptr = VAR_5[1] + VAR_13;

    VAR_8[VAR_12](VAR_2 + (VAR_4 >> 1), ptr, VAR_19 >> 1, VAR_11 >> 1);

    ptr = VAR_5[2] + VAR_13;

    VAR_8[VAR_12](VAR_3 + (VAR_4 >> 1), ptr, VAR_19 >> 1, VAR_11 >> 1);

}

static inline void FUNC_0(MpegEncContext *VAR_0,
UINT8 *VAR_1, UINT8 *VAR_2, UINT8 *VAR_3,
int VAR_4,
UINT8 **VAR_5, int VAR_6,
int VAR_7, op_pixels_func *VAR_8,
int VAR_9, int VAR_10, int VAR_11)
{ UINT8 *ptr; int VAR_12, VAR_13, VAR_14, VAR_15, VAR_16, VAR_17, VAR_18, VAR_19; if(VAR_0->quarter_sample)
{ VAR_9>>=1; VAR_10>>=1; } VAR_12 = ((VAR_10 & 1) << 1) | (VAR_9 & 1); VAR_16 = VAR_0->mb_x * 16 + (VAR_9 >> 1); VAR_17 = VAR_0->mb_y * (16 >> VAR_7) + (VAR_10 >> 1); VAR_18 = VAR_0->VAR_18 >> VAR_7; VAR_16 = clip(VAR_16, -16, VAR_0->width); if (VAR_16 == VAR_0->width)
VAR_12 &= ~1; VAR_17 = clip(VAR_17, -16, VAR_18); if (VAR_17 == VAR_18)
VAR_12 &= ~2; VAR_19 = VAR_0->VAR_19 << VAR_7; ptr = VAR_5[0] + (VAR_17 * VAR_19) + (VAR_16) + VAR_6; VAR_1 += VAR_4; VAR_8[VAR_12](VAR_1, ptr, VAR_19, VAR_11); VAR_8[VAR_12](VAR_1 + 8, ptr + 8, VAR_19, VAR_11); if (VAR_0->out_format == FMT_H263) { VAR_12 = 0; if ((VAR_9 & 3) != 0)
VAR_12 |= 1; if ((VAR_10 & 3) != 0)
VAR_12 |= 2; VAR_14 = VAR_9 >> 2; VAR_15 = VAR_10 >> 2; } else { VAR_14 = VAR_9 / 2; VAR_15 = VAR_10 / 2; VAR_12 = ((VAR_15 & 1) << 1) | (VAR_14 & 1); VAR_14 >>= 1; VAR_15 >>= 1; } VAR_16 = VAR_0->mb_x * 8 + VAR_14; VAR_17 = VAR_0->mb_y * (8 >> VAR_7) + VAR_15; VAR_16 = clip(VAR_16, -8, VAR_0->width >> 1); if (VAR_16 == (VAR_0->width >> 1))
VAR_12 &= ~1; VAR_17 = clip(VAR_17, -8, VAR_18 >> 1); if (VAR_17 == (VAR_18 >> 1))
VAR_12 &= ~2; VAR_13 = (VAR_17 * (VAR_19 >> 1)) + VAR_16 + (VAR_6 >> 1); ptr = VAR_5[1] + VAR_13; VAR_8[VAR_12](VAR_2 + (VAR_4 >> 1), ptr, VAR_19 >> 1, VAR_11 >> 1); ptr = VAR_5[2] + VAR_13; VAR_8[VAR_12](VAR_3 + (VAR_4 >> 1), ptr, VAR_19 >> 1, VAR_11 >> 1); }