void vp8_mc_chroma(VP8Context *s, VP8ThreadData *td, uint8_t *dst1, uint8_t *dst2,

                   ThreadFrame *ref, const VP56mv *mv, int x_off, int y_off,

                   int block_w, int block_h, int width, int height, int linesize,

                   vp8_mc_func mc_func[3][3])

{

    uint8_t *src1 = ref->f->data[1], *src2 = ref->f->data[2];



    if (AV_RN32A(mv)) {

        int mx = mv->x&7, mx_idx = subpel_idx[0][mx];

        int my = mv->y&7, my_idx = subpel_idx[0][my];



        x_off += mv->x >> 3;

        y_off += mv->y >> 3;



        // edge emulation

        src1 += y_off * linesize + x_off;

        src2 += y_off * linesize + x_off;

        ff_thread_await_progress(ref, (3 + y_off + block_h + subpel_idx[2][my]) >> 3, 0);

        if (x_off < mx_idx || x_off >= width  - block_w - subpel_idx[2][mx] ||

            y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) {

            s->vdsp.emulated_edge_mc(td->edge_emu_buffer, src1 - my_idx * linesize - mx_idx, linesize,

                                     block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my],

                                     x_off - mx_idx, y_off - my_idx, width, height);

            src1 = td->edge_emu_buffer + mx_idx + linesize * my_idx;

            mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my);



            s->vdsp.emulated_edge_mc(td->edge_emu_buffer, src2 - my_idx * linesize - mx_idx, linesize,

                                     block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my],

                                     x_off - mx_idx, y_off - my_idx, width, height);

            src2 = td->edge_emu_buffer + mx_idx + linesize * my_idx;

            mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my);

        } else {

            mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my);

            mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my);

        }

    } else {

        ff_thread_await_progress(ref, (3 + y_off + block_h) >> 3, 0);

        mc_func[0][0](dst1, linesize, src1 + y_off * linesize + x_off, linesize, block_h, 0, 0);

        mc_func[0][0](dst2, linesize, src2 + y_off * linesize + x_off, linesize, block_h, 0, 0);

    }

}

void vp8_mc_chroma(VP8Context *s, VP8ThreadData *td, uint8_t *dst1, uint8_t *dst2,

                   ThreadFrame *ref, const VP56mv *mv, int x_off, int y_off,

                   int block_w, int block_h, int width, int height, int linesize,

                   vp8_mc_func mc_func[3][3])

{

    uint8_t *src1 = ref->f->data[1], *src2 = ref->f->data[2];



    if (AV_RN32A(mv)) {

        int mx = mv->x&7, mx_idx = subpel_idx[0][mx];

        int my = mv->y&7, my_idx = subpel_idx[0][my];



        x_off += mv->x >> 3;

        y_off += mv->y >> 3;



        

        src1 += y_off * linesize + x_off;

        src2 += y_off * linesize + x_off;

        ff_thread_await_progress(ref, (3 + y_off + block_h + subpel_idx[2][my]) >> 3, 0);

        if (x_off < mx_idx || x_off >= width  - block_w - subpel_idx[2][mx] ||

            y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) {

            s->vdsp.emulated_edge_mc(td->edge_emu_buffer, src1 - my_idx * linesize - mx_idx, linesize,

                                     block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my],

                                     x_off - mx_idx, y_off - my_idx, width, height);

            src1 = td->edge_emu_buffer + mx_idx + linesize * my_idx;

            mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my);



            s->vdsp.emulated_edge_mc(td->edge_emu_buffer, src2 - my_idx * linesize - mx_idx, linesize,

                                     block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my],

                                     x_off - mx_idx, y_off - my_idx, width, height);

            src2 = td->edge_emu_buffer + mx_idx + linesize * my_idx;

            mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my);

        } else {

            mc_func[my_idx][mx_idx](dst1, linesize, src1, linesize, block_h, mx, my);

            mc_func[my_idx][mx_idx](dst2, linesize, src2, linesize, block_h, mx, my);

        }

    } else {

        ff_thread_await_progress(ref, (3 + y_off + block_h) >> 3, 0);

        mc_func[0][0](dst1, linesize, src1 + y_off * linesize + x_off, linesize, block_h, 0, 0);

        mc_func[0][0](dst2, linesize, src2 + y_off * linesize + x_off, linesize, block_h, 0, 0);

    }

}

                   int block_w, int block_h, int width, int height, int linesize,
void FUNC_0(VP8Context *VAR_0, VP8ThreadData *VAR_1, uint8_t *VAR_2, uint8_t *VAR_3,

                   ThreadFrame *VAR_4, const VP56mv *VAR_5, int VAR_6, int VAR_7,

                   int VAR_8, int VAR_9, int VAR_10, int VAR_11, int VAR_12,

                   vp8_mc_func VAR_13[3][3])

{

    uint8_t *src1 = VAR_4->f->data[1], *src2 = VAR_4->f->data[2];



    if (AV_RN32A(VAR_5)) {

        int VAR_14 = VAR_5->x&7, VAR_15 = subpel_idx[0][VAR_14];

        int VAR_16 = VAR_5->y&7, VAR_17 = subpel_idx[0][VAR_16];



        VAR_6 += VAR_5->x >> 3;

        VAR_7 += VAR_5->y >> 3;



        

        src1 += VAR_7 * VAR_12 + VAR_6;

        src2 += VAR_7 * VAR_12 + VAR_6;

        ff_thread_await_progress(VAR_4, (3 + VAR_7 + VAR_9 + subpel_idx[2][VAR_16]) >> 3, 0);

        if (VAR_6 < VAR_15 || VAR_6 >= VAR_10  - VAR_8 - subpel_idx[2][VAR_14] ||

            VAR_7 < VAR_17 || VAR_7 >= VAR_11 - VAR_9 - subpel_idx[2][VAR_16]) {

            VAR_0->vdsp.emulated_edge_mc(VAR_1->edge_emu_buffer, src1 - VAR_17 * VAR_12 - VAR_15, VAR_12,

                                     VAR_8 + subpel_idx[1][VAR_14], VAR_9 + subpel_idx[1][VAR_16],

                                     VAR_6 - VAR_15, VAR_7 - VAR_17, VAR_10, VAR_11);

            src1 = VAR_1->edge_emu_buffer + VAR_15 + VAR_12 * VAR_17;

            VAR_13[VAR_17][VAR_15](VAR_2, VAR_12, src1, VAR_12, VAR_9, VAR_14, VAR_16);



            VAR_0->vdsp.emulated_edge_mc(VAR_1->edge_emu_buffer, src2 - VAR_17 * VAR_12 - VAR_15, VAR_12,

                                     VAR_8 + subpel_idx[1][VAR_14], VAR_9 + subpel_idx[1][VAR_16],

                                     VAR_6 - VAR_15, VAR_7 - VAR_17, VAR_10, VAR_11);

            src2 = VAR_1->edge_emu_buffer + VAR_15 + VAR_12 * VAR_17;

            VAR_13[VAR_17][VAR_15](VAR_3, VAR_12, src2, VAR_12, VAR_9, VAR_14, VAR_16);

        } else {

            VAR_13[VAR_17][VAR_15](VAR_2, VAR_12, src1, VAR_12, VAR_9, VAR_14, VAR_16);

            VAR_13[VAR_17][VAR_15](VAR_3, VAR_12, src2, VAR_12, VAR_9, VAR_14, VAR_16);

        }

    } else {

        ff_thread_await_progress(VAR_4, (3 + VAR_7 + VAR_9) >> 3, 0);

        VAR_13[0][0](VAR_2, VAR_12, src1 + VAR_7 * VAR_12 + VAR_6, VAR_12, VAR_9, 0, 0);

        VAR_13[0][0](VAR_3, VAR_12, src2 + VAR_7 * VAR_12 + VAR_6, VAR_12, VAR_9, 0, 0);

    }

}

void FUNC_0(VP8Context *VAR_0, VP8ThreadData *VAR_1, uint8_t *VAR_2, uint8_t *VAR_3,
ThreadFrame *VAR_4, const VP56mv *VAR_5, int VAR_6, int VAR_7,
int VAR_8, int VAR_9, int VAR_10, int VAR_11, int VAR_12,
vp8_mc_func VAR_13[3][3])
{ uint8_t *src1 = VAR_4->f->data[1], *src2 = VAR_4->f->data[2]; if (AV_RN32A(VAR_5)) { int VAR_14 = VAR_5->x&7, VAR_15 = subpel_idx[0][VAR_14]; int VAR_16 = VAR_5->y&7, VAR_17 = subpel_idx[0][VAR_16]; VAR_6 += VAR_5->x >> 3; VAR_7 += VAR_5->y >> 3; src1 += VAR_7 * VAR_12 + VAR_6; src2 += VAR_7 * VAR_12 + VAR_6; ff_thread_await_progress(VAR_4, (3 + VAR_7 + VAR_9 + subpel_idx[2][VAR_16]) >> 3, 0); if (VAR_6 < VAR_15 || VAR_6 >= VAR_10  - VAR_8 - subpel_idx[2][VAR_14] ||
VAR_7 < VAR_17 || VAR_7 >= VAR_11 - VAR_9 - subpel_idx[2][VAR_16]) { VAR_0->vdsp.emulated_edge_mc(VAR_1->edge_emu_buffer, src1 - VAR_17 * VAR_12 - VAR_15, VAR_12,
VAR_8 + subpel_idx[1][VAR_14], VAR_9 + subpel_idx[1][VAR_16],
VAR_6 - VAR_15, VAR_7 - VAR_17, VAR_10, VAR_11); src1 = VAR_1->edge_emu_buffer + VAR_15 + VAR_12 * VAR_17; VAR_13[VAR_17][VAR_15](VAR_2, VAR_12, src1, VAR_12, VAR_9, VAR_14, VAR_16); VAR_0->vdsp.emulated_edge_mc(VAR_1->edge_emu_buffer, src2 - VAR_17 * VAR_12 - VAR_15, VAR_12,
VAR_8 + subpel_idx[1][VAR_14], VAR_9 + subpel_idx[1][VAR_16],
VAR_6 - VAR_15, VAR_7 - VAR_17, VAR_10, VAR_11); src2 = VAR_1->edge_emu_buffer + VAR_15 + VAR_12 * VAR_17; VAR_13[VAR_17][VAR_15](VAR_3, VAR_12, src2, VAR_12, VAR_9, VAR_14, VAR_16); } else { VAR_13[VAR_17][VAR_15](VAR_2, VAR_12, src1, VAR_12, VAR_9, VAR_14, VAR_16); VAR_13[VAR_17][VAR_15](VAR_3, VAR_12, src2, VAR_12, VAR_9, VAR_14, VAR_16); } } else { ff_thread_await_progress(VAR_4, (3 + VAR_7 + VAR_9) >> 3, 0); VAR_13[0][0](VAR_2, VAR_12, src1 + VAR_7 * VAR_12 + VAR_6, VAR_12, VAR_9, 0, 0); VAR_13[0][0](VAR_3, VAR_12, src2 + VAR_7 * VAR_12 + VAR_6, VAR_12, VAR_9, 0, 0); } }