static inline int hpel_motion(MpegEncContext *s,

                              uint8_t *dest, uint8_t *src,

                              int src_x, int src_y,

                              op_pixels_func *pix_op,

                              int motion_x, int motion_y)

{

    int dxy = 0;

    int emu = 0;



    src_x += motion_x >> 1;

    src_y += motion_y >> 1;



    /* WARNING: do no forget half pels */

    src_x = av_clip(src_x, -16, s->width); // FIXME unneeded for emu?

    if (src_x != s->width)

        dxy |= motion_x & 1;

    src_y = av_clip(src_y, -16, s->height);

    if (src_y != s->height)

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

    src += src_y * s->linesize + src_x;



        if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 1) - 8, 0) ||

            (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y & 1) - 8, 0)) {

            s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src,

                                     s->linesize, s->linesize,

                                     9, 9,

                                     src_x, src_y,

                                     s->h_edge_pos, s->v_edge_pos);

            src = s->edge_emu_buffer;

            emu = 1;

        }

    pix_op[dxy](dest, src, s->linesize, 8);

    return emu;

}

static inline int hpel_motion(MpegEncContext *s,

                              uint8_t *dest, uint8_t *src,

                              int src_x, int src_y,

                              op_pixels_func *pix_op,

                              int motion_x, int motion_y)

{

    int dxy = 0;

    int emu = 0;



    src_x += motion_x >> 1;

    src_y += motion_y >> 1;



    

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

    if (src_x != s->width)

        dxy |= motion_x & 1;

    src_y = av_clip(src_y, -16, s->height);

    if (src_y != s->height)

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

    src += src_y * s->linesize + src_x;



        if ((unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x & 1) - 8, 0) ||

            (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y & 1) - 8, 0)) {

            s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src,

                                     s->linesize, s->linesize,

                                     9, 9,

                                     src_x, src_y,

                                     s->h_edge_pos, s->v_edge_pos);

            src = s->edge_emu_buffer;

            emu = 1;

        }

    pix_op[dxy](dest, src, s->linesize, 8);

    return emu;

}

static inline int FUNC_0(MpegEncContext *VAR_0,

                              uint8_t *VAR_1, uint8_t *VAR_2,

                              int VAR_3, int VAR_4,

                              op_pixels_func *VAR_5,

                              int VAR_6, int VAR_7)

{

    int VAR_8 = 0;

    int VAR_9 = 0;



    VAR_3 += VAR_6 >> 1;

    VAR_4 += VAR_7 >> 1;



    

    VAR_3 = av_clip(VAR_3, -16, VAR_0->width); 

    if (VAR_3 != VAR_0->width)

        VAR_8 |= VAR_6 & 1;

    VAR_4 = av_clip(VAR_4, -16, VAR_0->height);

    if (VAR_4 != VAR_0->height)

        VAR_8 |= (VAR_7 & 1) << 1;

    VAR_2 += VAR_4 * VAR_0->linesize + VAR_3;



        if ((unsigned)VAR_3 > FFMAX(VAR_0->h_edge_pos - (VAR_6 & 1) - 8, 0) ||

            (unsigned)VAR_4 > FFMAX(VAR_0->v_edge_pos - (VAR_7 & 1) - 8, 0)) {

            VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, VAR_2,

                                     VAR_0->linesize, VAR_0->linesize,

                                     9, 9,

                                     VAR_3, VAR_4,

                                     VAR_0->h_edge_pos, VAR_0->v_edge_pos);

            VAR_2 = VAR_0->edge_emu_buffer;

            VAR_9 = 1;

        }

    VAR_5[VAR_8](VAR_1, VAR_2, VAR_0->linesize, 8);

    return VAR_9;

}

static inline int FUNC_0(MpegEncContext *VAR_0,
uint8_t *VAR_1, uint8_t *VAR_2,
int VAR_3, int VAR_4,
op_pixels_func *VAR_5,
int VAR_6, int VAR_7)
{ int VAR_8 = 0; int VAR_9 = 0; VAR_3 += VAR_6 >> 1; VAR_4 += VAR_7 >> 1; VAR_3 = av_clip(VAR_3, -16, VAR_0->width); if (VAR_3 != VAR_0->width)
VAR_8 |= VAR_6 & 1; VAR_4 = av_clip(VAR_4, -16, VAR_0->height); if (VAR_4 != VAR_0->height)
VAR_8 |= (VAR_7 & 1) << 1; VAR_2 += VAR_4 * VAR_0->linesize + VAR_3; if ((unsigned)VAR_3 > FFMAX(VAR_0->h_edge_pos - (VAR_6 & 1) - 8, 0) ||
(unsigned)VAR_4 > FFMAX(VAR_0->v_edge_pos - (VAR_7 & 1) - 8, 0)) { VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer, VAR_2,
VAR_0->linesize, VAR_0->linesize,
9, 9,
VAR_3, VAR_4,
VAR_0->h_edge_pos, VAR_0->v_edge_pos); VAR_2 = VAR_0->edge_emu_buffer; VAR_9 = 1; } VAR_5[VAR_8](VAR_1, VAR_2, VAR_0->linesize, 8); return VAR_9; }