static inline void xan_wc3_copy_pixel_run(XanContext *s, AVFrame *frame,

                                          int x, int y,

                                          int pixel_count, int motion_x,

                                          int motion_y)

{

    int stride;

    int line_inc;

    int curframe_index, prevframe_index;

    int curframe_x, prevframe_x;

    int width = s->avctx->width;

    uint8_t *palette_plane, *prev_palette_plane;



    if (y + motion_y < 0 || y + motion_y >= s->avctx->height ||

        x + motion_x < 0 || x + motion_x >= s->avctx->width)

        return;



    palette_plane = frame->data[0];

    prev_palette_plane = s->last_frame->data[0];

    if (!prev_palette_plane)

        prev_palette_plane = palette_plane;

    stride = frame->linesize[0];

    line_inc = stride - width;

    curframe_index = y * stride + x;

    curframe_x = x;

    prevframe_index = (y + motion_y) * stride + x + motion_x;

    prevframe_x = x + motion_x;



    if (prev_palette_plane == palette_plane && FFABS(curframe_index - prevframe_index) < pixel_count) {

         avpriv_request_sample(s->avctx, "Overlapping copy");

         return ;

    }



    while (pixel_count &&

           curframe_index  < s->frame_size &&

           prevframe_index < s->frame_size) {

        int count = FFMIN3(pixel_count, width - curframe_x,

                           width - prevframe_x);



        memcpy(palette_plane + curframe_index,

               prev_palette_plane + prevframe_index, count);

        pixel_count     -= count;

        curframe_index  += count;

        prevframe_index += count;

        curframe_x      += count;

        prevframe_x     += count;



        if (curframe_x >= width) {

            curframe_index += line_inc;

            curframe_x = 0;

        }



        if (prevframe_x >= width) {

            prevframe_index += line_inc;

            prevframe_x = 0;

        }

    }

}

static inline void xan_wc3_copy_pixel_run(XanContext *s, AVFrame *frame,

                                          int x, int y,

                                          int pixel_count, int motion_x,

                                          int motion_y)

{

    int stride;

    int line_inc;

    int curframe_index, prevframe_index;

    int curframe_x, prevframe_x;

    int width = s->avctx->width;

    uint8_t *palette_plane, *prev_palette_plane;



    if (y + motion_y < 0 || y + motion_y >= s->avctx->height ||

        x + motion_x < 0 || x + motion_x >= s->avctx->width)

        return;



    palette_plane = frame->data[0];

    prev_palette_plane = s->last_frame->data[0];

    if (!prev_palette_plane)

        prev_palette_plane = palette_plane;

    stride = frame->linesize[0];

    line_inc = stride - width;

    curframe_index = y * stride + x;

    curframe_x = x;

    prevframe_index = (y + motion_y) * stride + x + motion_x;

    prevframe_x = x + motion_x;



    if (prev_palette_plane == palette_plane && FFABS(curframe_index - prevframe_index) < pixel_count) {

         avpriv_request_sample(s->avctx, "Overlapping copy");

         return ;

    }



    while (pixel_count &&

           curframe_index  < s->frame_size &&

           prevframe_index < s->frame_size) {

        int count = FFMIN3(pixel_count, width - curframe_x,

                           width - prevframe_x);



        memcpy(palette_plane + curframe_index,

               prev_palette_plane + prevframe_index, count);

        pixel_count     -= count;

        curframe_index  += count;

        prevframe_index += count;

        curframe_x      += count;

        prevframe_x     += count;



        if (curframe_x >= width) {

            curframe_index += line_inc;

            curframe_x = 0;

        }



        if (prevframe_x >= width) {

            prevframe_index += line_inc;

            prevframe_x = 0;

        }

    }

}

    if (prev_palette_plane == palette_plane && FFABS(curframe_index - prevframe_index) < pixel_count) {
static inline void FUNC_0(XanContext *VAR_0, AVFrame *VAR_1,

                                          int VAR_2, int VAR_3,

                                          int VAR_4, int VAR_5,

                                          int VAR_6)

{

    int VAR_7;

    int VAR_8;

    int VAR_9, VAR_10;

    int VAR_11, VAR_12;

    int VAR_13 = VAR_0->avctx->VAR_13;

    uint8_t *palette_plane, *prev_palette_plane;



    if (VAR_3 + VAR_6 < 0 || VAR_3 + VAR_6 >= VAR_0->avctx->height ||

        VAR_2 + VAR_5 < 0 || VAR_2 + VAR_5 >= VAR_0->avctx->VAR_13)

        return;



    palette_plane = VAR_1->data[0];

    prev_palette_plane = VAR_0->last_frame->data[0];

    if (!prev_palette_plane)

        prev_palette_plane = palette_plane;

    VAR_7 = VAR_1->linesize[0];

    VAR_8 = VAR_7 - VAR_13;

    VAR_9 = VAR_3 * VAR_7 + VAR_2;

    VAR_11 = VAR_2;

    VAR_10 = (VAR_3 + VAR_6) * VAR_7 + VAR_2 + VAR_5;

    VAR_12 = VAR_2 + VAR_5;



    if (prev_palette_plane == palette_plane && FFABS(VAR_9 - VAR_10) < VAR_4) {

         avpriv_request_sample(VAR_0->avctx, "Overlapping copy");

         return ;

    }



    while (VAR_4 &&

           VAR_9  < VAR_0->frame_size &&

           VAR_10 < VAR_0->frame_size) {

        int VAR_14 = FFMIN3(VAR_4, VAR_13 - VAR_11,

                           VAR_13 - VAR_12);



        memcpy(palette_plane + VAR_9,

               prev_palette_plane + VAR_10, VAR_14);

        VAR_4     -= VAR_14;

        VAR_9  += VAR_14;

        VAR_10 += VAR_14;

        VAR_11      += VAR_14;

        VAR_12     += VAR_14;



        if (VAR_11 >= VAR_13) {

            VAR_9 += VAR_8;

            VAR_11 = 0;

        }



        if (VAR_12 >= VAR_13) {

            VAR_10 += VAR_8;

            VAR_12 = 0;

        }

    }

}

static inline void FUNC_0(XanContext *VAR_0, AVFrame *VAR_1,
int VAR_2, int VAR_3,
int VAR_4, int VAR_5,
int VAR_6)
{ int VAR_7; int VAR_8; int VAR_9, VAR_10; int VAR_11, VAR_12; int VAR_13 = VAR_0->avctx->VAR_13; uint8_t *palette_plane, *prev_palette_plane; if (VAR_3 + VAR_6 < 0 || VAR_3 + VAR_6 >= VAR_0->avctx->height ||
VAR_2 + VAR_5 < 0 || VAR_2 + VAR_5 >= VAR_0->avctx->VAR_13)
return; palette_plane = VAR_1->data[0]; prev_palette_plane = VAR_0->last_frame->data[0]; if (!prev_palette_plane)
prev_palette_plane = palette_plane; VAR_7 = VAR_1->linesize[0]; VAR_8 = VAR_7 - VAR_13; VAR_9 = VAR_3 * VAR_7 + VAR_2; VAR_11 = VAR_2; VAR_10 = (VAR_3 + VAR_6) * VAR_7 + VAR_2 + VAR_5; VAR_12 = VAR_2 + VAR_5; if (prev_palette_plane == palette_plane && FFABS(VAR_9 - VAR_10) < VAR_4) { avpriv_request_sample(VAR_0->avctx, "Overlapping copy"); return ; } while (VAR_4 &&
VAR_9  < VAR_0->frame_size &&
VAR_10 < VAR_0->frame_size) { int VAR_14 = FFMIN3(VAR_4, VAR_13 - VAR_11,
VAR_13 - VAR_12); memcpy(palette_plane + VAR_9,
prev_palette_plane + VAR_10, VAR_14); VAR_4     -= VAR_14; VAR_9  += VAR_14; VAR_10 += VAR_14; VAR_11      += VAR_14; VAR_12     += VAR_14; if (VAR_11 >= VAR_13) { VAR_9 += VAR_8; VAR_11 = 0; } if (VAR_12 >= VAR_13) { VAR_10 += VAR_8; VAR_12 = 0; } } }