static inline void apply_motion_generic(RoqContext *ri, int x, int y, int deltax,

                                        int deltay, int sz)

{

    int mx, my, cp;



    mx = x + deltax;

    my = y + deltay;



    /* check MV against frame boundaries */

    if ((mx < 0) || (mx > ri->width - sz) ||

        (my < 0) || (my > ri->height - sz)) {

        av_log(ri->avctx, AV_LOG_ERROR, "motion vector out of bounds: MV = (%d, %d), boundaries = (0, 0, %d, %d)\n",

            mx, my, ri->width, ri->height);

        return;

    }



    if (ri->last_frame->data[0] == NULL) {

        av_log(ri->avctx, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n");

        return;

    }



    for(cp = 0; cp < 3; cp++) {

        int outstride = ri->current_frame->linesize[cp];

        int instride  = ri->last_frame   ->linesize[cp];

        block_copy(ri->current_frame->data[cp] + y*outstride + x,

                   ri->last_frame->data[cp] + my*instride + mx,

                   outstride, instride, sz);

    }

}

static inline void apply_motion_generic(RoqContext *ri, int x, int y, int deltax,

                                        int deltay, int sz)

{

    int mx, my, cp;



    mx = x + deltax;

    my = y + deltay;



    

    if ((mx < 0) || (mx > ri->width - sz) ||

        (my < 0) || (my > ri->height - sz)) {

        av_log(ri->avctx, AV_LOG_ERROR, "motion vector out of bounds: MV = (%d, %d), boundaries = (0, 0, %d, %d)\n",

            mx, my, ri->width, ri->height);

        return;

    }



    if (ri->last_frame->data[0] == NULL) {

        av_log(ri->avctx, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n");

        return;

    }



    for(cp = 0; cp < 3; cp++) {

        int outstride = ri->current_frame->linesize[cp];

        int instride  = ri->last_frame   ->linesize[cp];

        block_copy(ri->current_frame->data[cp] + y*outstride + x,

                   ri->last_frame->data[cp] + my*instride + mx,

                   outstride, instride, sz);

    }

}

static inline void FUNC_0(RoqContext *VAR_0, int VAR_1, int VAR_2, int VAR_3,

                                        int VAR_4, int VAR_5)

{

    int VAR_6, VAR_7, VAR_8;



    VAR_6 = VAR_1 + VAR_3;

    VAR_7 = VAR_2 + VAR_4;



    

    if ((VAR_6 < 0) || (VAR_6 > VAR_0->width - VAR_5) ||

        (VAR_7 < 0) || (VAR_7 > VAR_0->height - VAR_5)) {

        av_log(VAR_0->avctx, AV_LOG_ERROR, "motion vector out of bounds: MV = (%d, %d), boundaries = (0, 0, %d, %d)\n",

            VAR_6, VAR_7, VAR_0->width, VAR_0->height);

        return;

    }



    if (VAR_0->last_frame->data[0] == NULL) {

        av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n");

        return;

    }



    for(VAR_8 = 0; VAR_8 < 3; VAR_8++) {

        int VAR_9 = VAR_0->current_frame->linesize[VAR_8];

        int VAR_10  = VAR_0->last_frame   ->linesize[VAR_8];

        block_copy(VAR_0->current_frame->data[VAR_8] + VAR_2*VAR_9 + VAR_1,

                   VAR_0->last_frame->data[VAR_8] + VAR_7*VAR_10 + VAR_6,

                   VAR_9, VAR_10, VAR_5);

    }

}

static inline void FUNC_0(RoqContext *VAR_0, int VAR_1, int VAR_2, int VAR_3,
int VAR_4, int VAR_5)
{ int VAR_6, VAR_7, VAR_8; VAR_6 = VAR_1 + VAR_3; VAR_7 = VAR_2 + VAR_4; if ((VAR_6 < 0) || (VAR_6 > VAR_0->width - VAR_5) ||
(VAR_7 < 0) || (VAR_7 > VAR_0->height - VAR_5)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "motion vector out of bounds: MV = (%d, %d), boundaries = (0, 0, %d, %d)\n",
VAR_6, VAR_7, VAR_0->width, VAR_0->height); return; } if (VAR_0->last_frame->data[0] == NULL) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid decode type. Invalid header?\n"); return; } for(VAR_8 = 0; VAR_8 < 3; VAR_8++) { int VAR_9 = VAR_0->current_frame->linesize[VAR_8]; int VAR_10  = VAR_0->last_frame   ->linesize[VAR_8]; block_copy(VAR_0->current_frame->data[VAR_8] + VAR_2*VAR_9 + VAR_1,
VAR_0->last_frame->data[VAR_8] + VAR_7*VAR_10 + VAR_6,
VAR_9, VAR_10, VAR_5); } }