static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src,

                    int stride, int x, int y)

{

    uint8_t *dst = s->frames[VP56_FRAME_CURRENT]->data[plane] + s->block_offset[b];

    uint8_t *src_block;

    int src_offset;

    int overlap_offset = 0;

    int mask = s->vp56_coord_div[b] - 1;

    int deblock_filtering = s->deblock_filtering;

    int dx;

    int dy;



    if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||

        (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY

         && !s->frames[VP56_FRAME_CURRENT]->key_frame))

        deblock_filtering = 0;



    dx = s->mv[b].x / s->vp56_coord_div[b];

    dy = s->mv[b].y / s->vp56_coord_div[b];



    if (b >= 4) {

        x /= 2;

        y /= 2;

    }

    x += dx - 2;

    y += dy - 2;



    if (x<0 || x+12>=s->plane_width[plane] ||

        y<0 || y+12>=s->plane_height[plane]) {

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

                            src + s->block_offset[b] + (dy-2)*stride + (dx-2),

                            stride, 12, 12, x, y,

                            s->plane_width[plane],

                            s->plane_height[plane]);

        src_block = s->edge_emu_buffer;

        src_offset = 2 + 2*stride;

    } else if (deblock_filtering) {

        /* only need a 12x12 block, but there is no such dsp function, */

        /* so copy a 16x12 block */

        s->hdsp.put_pixels_tab[0][0](s->edge_emu_buffer,

                                     src + s->block_offset[b] + (dy-2)*stride + (dx-2),

                                     stride, 12);

        src_block = s->edge_emu_buffer;

        src_offset = 2 + 2*stride;

    } else {

        src_block = src;

        src_offset = s->block_offset[b] + dy*stride + dx;

    }



    if (deblock_filtering)

        vp56_deblock_filter(s, src_block, stride, dx&7, dy&7);



    if (s->mv[b].x & mask)

        overlap_offset += (s->mv[b].x > 0) ? 1 : -1;

    if (s->mv[b].y & mask)

        overlap_offset += (s->mv[b].y > 0) ? stride : -stride;



    if (overlap_offset) {

        if (s->filter)

            s->filter(s, dst, src_block, src_offset, src_offset+overlap_offset,

                      stride, s->mv[b], mask, s->filter_selection, b<4);

        else

            s->vp3dsp.put_no_rnd_pixels_l2(dst, src_block+src_offset,

                                           src_block+src_offset+overlap_offset,

                                           stride, 8);

    } else {

        s->hdsp.put_pixels_tab[1][0](dst, src_block+src_offset, stride, 8);

    }

}

static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src,

                    int stride, int x, int y)

{

    uint8_t *dst = s->frames[VP56_FRAME_CURRENT]->data[plane] + s->block_offset[b];

    uint8_t *src_block;

    int src_offset;

    int overlap_offset = 0;

    int mask = s->vp56_coord_div[b] - 1;

    int deblock_filtering = s->deblock_filtering;

    int dx;

    int dy;



    if (s->avctx->skip_loop_filter >= AVDISCARD_ALL ||

        (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY

         && !s->frames[VP56_FRAME_CURRENT]->key_frame))

        deblock_filtering = 0;



    dx = s->mv[b].x / s->vp56_coord_div[b];

    dy = s->mv[b].y / s->vp56_coord_div[b];



    if (b >= 4) {

        x /= 2;

        y /= 2;

    }

    x += dx - 2;

    y += dy - 2;



    if (x<0 || x+12>=s->plane_width[plane] ||

        y<0 || y+12>=s->plane_height[plane]) {

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

                            src + s->block_offset[b] + (dy-2)*stride + (dx-2),

                            stride, 12, 12, x, y,

                            s->plane_width[plane],

                            s->plane_height[plane]);

        src_block = s->edge_emu_buffer;

        src_offset = 2 + 2*stride;

    } else if (deblock_filtering) {

        

        

        s->hdsp.put_pixels_tab[0][0](s->edge_emu_buffer,

                                     src + s->block_offset[b] + (dy-2)*stride + (dx-2),

                                     stride, 12);

        src_block = s->edge_emu_buffer;

        src_offset = 2 + 2*stride;

    } else {

        src_block = src;

        src_offset = s->block_offset[b] + dy*stride + dx;

    }



    if (deblock_filtering)

        vp56_deblock_filter(s, src_block, stride, dx&7, dy&7);



    if (s->mv[b].x & mask)

        overlap_offset += (s->mv[b].x > 0) ? 1 : -1;

    if (s->mv[b].y & mask)

        overlap_offset += (s->mv[b].y > 0) ? stride : -stride;



    if (overlap_offset) {

        if (s->filter)

            s->filter(s, dst, src_block, src_offset, src_offset+overlap_offset,

                      stride, s->mv[b], mask, s->filter_selection, b<4);

        else

            s->vp3dsp.put_no_rnd_pixels_l2(dst, src_block+src_offset,

                                           src_block+src_offset+overlap_offset,

                                           stride, 8);

    } else {

        s->hdsp.put_pixels_tab[1][0](dst, src_block+src_offset, stride, 8);

    }

}

                    int stride, int x, int y)
static void FUNC_0(VP56Context *VAR_0, int VAR_1, int VAR_2, uint8_t *VAR_3,

                    int VAR_4, int VAR_5, int VAR_6)

{

    uint8_t *dst = VAR_0->frames[VP56_FRAME_CURRENT]->data[VAR_2] + VAR_0->block_offset[VAR_1];

    uint8_t *src_block;

    int VAR_7;

    int VAR_8 = 0;

    int VAR_9 = VAR_0->vp56_coord_div[VAR_1] - 1;

    int VAR_10 = VAR_0->VAR_10;

    int VAR_11;

    int VAR_12;



    if (VAR_0->avctx->skip_loop_filter >= AVDISCARD_ALL ||

        (VAR_0->avctx->skip_loop_filter >= AVDISCARD_NONKEY

         && !VAR_0->frames[VP56_FRAME_CURRENT]->key_frame))

        VAR_10 = 0;



    VAR_11 = VAR_0->mv[VAR_1].VAR_5 / VAR_0->vp56_coord_div[VAR_1];

    VAR_12 = VAR_0->mv[VAR_1].VAR_6 / VAR_0->vp56_coord_div[VAR_1];



    if (VAR_1 >= 4) {

        VAR_5 /= 2;

        VAR_6 /= 2;

    }

    VAR_5 += VAR_11 - 2;

    VAR_6 += VAR_12 - 2;



    if (VAR_5<0 || VAR_5+12>=VAR_0->plane_width[VAR_2] ||

        VAR_6<0 || VAR_6+12>=VAR_0->plane_height[VAR_2]) {

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

                            VAR_3 + VAR_0->block_offset[VAR_1] + (VAR_12-2)*VAR_4 + (VAR_11-2),

                            VAR_4, 12, 12, VAR_5, VAR_6,

                            VAR_0->plane_width[VAR_2],

                            VAR_0->plane_height[VAR_2]);

        src_block = VAR_0->edge_emu_buffer;

        VAR_7 = 2 + 2*VAR_4;

    } else if (VAR_10) {

        

        

        VAR_0->hdsp.put_pixels_tab[0][0](VAR_0->edge_emu_buffer,

                                     VAR_3 + VAR_0->block_offset[VAR_1] + (VAR_12-2)*VAR_4 + (VAR_11-2),

                                     VAR_4, 12);

        src_block = VAR_0->edge_emu_buffer;

        VAR_7 = 2 + 2*VAR_4;

    } else {

        src_block = VAR_3;

        VAR_7 = VAR_0->block_offset[VAR_1] + VAR_12*VAR_4 + VAR_11;

    }



    if (VAR_10)

        vp56_deblock_filter(VAR_0, src_block, VAR_4, VAR_11&7, VAR_12&7);



    if (VAR_0->mv[VAR_1].VAR_5 & VAR_9)

        VAR_8 += (VAR_0->mv[VAR_1].VAR_5 > 0) ? 1 : -1;

    if (VAR_0->mv[VAR_1].VAR_6 & VAR_9)

        VAR_8 += (VAR_0->mv[VAR_1].VAR_6 > 0) ? VAR_4 : -VAR_4;



    if (VAR_8) {

        if (VAR_0->filter)

            VAR_0->filter(VAR_0, dst, src_block, VAR_7, VAR_7+VAR_8,

                      VAR_4, VAR_0->mv[VAR_1], VAR_9, VAR_0->filter_selection, VAR_1<4);

        else

            VAR_0->vp3dsp.put_no_rnd_pixels_l2(dst, src_block+VAR_7,

                                           src_block+VAR_7+VAR_8,

                                           VAR_4, 8);

    } else {

        VAR_0->hdsp.put_pixels_tab[1][0](dst, src_block+VAR_7, VAR_4, 8);

    }

}

static void FUNC_0(VP56Context *VAR_0, int VAR_1, int VAR_2, uint8_t *VAR_3,
int VAR_4, int VAR_5, int VAR_6)
{ uint8_t *dst = VAR_0->frames[VP56_FRAME_CURRENT]->data[VAR_2] + VAR_0->block_offset[VAR_1]; uint8_t *src_block; int VAR_7; int VAR_8 = 0; int VAR_9 = VAR_0->vp56_coord_div[VAR_1] - 1; int VAR_10 = VAR_0->VAR_10; int VAR_11; int VAR_12; if (VAR_0->avctx->skip_loop_filter >= AVDISCARD_ALL ||
(VAR_0->avctx->skip_loop_filter >= AVDISCARD_NONKEY
&& !VAR_0->frames[VP56_FRAME_CURRENT]->key_frame))
VAR_10 = 0; VAR_11 = VAR_0->mv[VAR_1].VAR_5 / VAR_0->vp56_coord_div[VAR_1]; VAR_12 = VAR_0->mv[VAR_1].VAR_6 / VAR_0->vp56_coord_div[VAR_1]; if (VAR_1 >= 4) { VAR_5 /= 2; VAR_6 /= 2; } VAR_5 += VAR_11 - 2; VAR_6 += VAR_12 - 2; if (VAR_5<0 || VAR_5+12>=VAR_0->plane_width[VAR_2] ||
VAR_6<0 || VAR_6+12>=VAR_0->plane_height[VAR_2]) { VAR_0->vdsp.emulated_edge_mc(VAR_0->edge_emu_buffer,
VAR_3 + VAR_0->block_offset[VAR_1] + (VAR_12-2)*VAR_4 + (VAR_11-2),
VAR_4, 12, 12, VAR_5, VAR_6,
VAR_0->plane_width[VAR_2],
VAR_0->plane_height[VAR_2]); src_block = VAR_0->edge_emu_buffer; VAR_7 = 2 + 2*VAR_4; } else if (VAR_10) { VAR_0->hdsp.put_pixels_tab[0][0](VAR_0->edge_emu_buffer,
VAR_3 + VAR_0->block_offset[VAR_1] + (VAR_12-2)*VAR_4 + (VAR_11-2),
VAR_4, 12); src_block = VAR_0->edge_emu_buffer; VAR_7 = 2 + 2*VAR_4; } else { src_block = VAR_3; VAR_7 = VAR_0->block_offset[VAR_1] + VAR_12*VAR_4 + VAR_11; } if (VAR_10)
vp56_deblock_filter(VAR_0, src_block, VAR_4, VAR_11&7, VAR_12&7); if (VAR_0->mv[VAR_1].VAR_5 & VAR_9)
VAR_8 += (VAR_0->mv[VAR_1].VAR_5 > 0) ? 1 : -1; if (VAR_0->mv[VAR_1].VAR_6 & VAR_9)
VAR_8 += (VAR_0->mv[VAR_1].VAR_6 > 0) ? VAR_4 : -VAR_4; if (VAR_8) { if (VAR_0->filter)
VAR_0->filter(VAR_0, dst, src_block, VAR_7, VAR_7+VAR_8,
VAR_4, VAR_0->mv[VAR_1], VAR_9, VAR_0->filter_selection, VAR_1<4); else
VAR_0->vp3dsp.put_no_rnd_pixels_l2(dst, src_block+VAR_7,
src_block+VAR_7+VAR_8,
VAR_4, 8); } else { VAR_0->hdsp.put_pixels_tab[1][0](dst, src_block+VAR_7, VAR_4, 8); } }