void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3],

                   VP8Macroblock *mb, int mb_x, int mb_y)

{

    int x, y, mode, nnz;

    uint32_t tr;



    /* for the first row, we need to run xchg_mb_border to init the top edge

     * to 127 otherwise, skip it if we aren't going to deblock */

    if (mb_y && (s->deblock_filter || !mb_y) && td->thread_nr == 0)

        xchg_mb_border(s->top_border[mb_x + 1], dst[0], dst[1], dst[2],

                       s->linesize, s->uvlinesize, mb_x, mb_y, s->mb_width,

                       s->filter.simple, 1);



    if (mb->mode < MODE_I4x4) {

        mode = check_intra_pred8x8_mode_emuedge(mb->mode, mb_x, mb_y);

        s->hpc.pred16x16[mode](dst[0], s->linesize);

    } else {

        uint8_t *ptr = dst[0];

        uint8_t *intra4x4 = mb->intra4x4_pred_mode_mb;

        uint8_t tr_top[4] = { 127, 127, 127, 127 };



        // all blocks on the right edge of the macroblock use bottom edge

        // the top macroblock for their topright edge

        uint8_t *tr_right = ptr - s->linesize + 16;



        // if we're on the right edge of the frame, said edge is extended

        // from the top macroblock

        if (mb_y && mb_x == s->mb_width - 1) {

            tr       = tr_right[-1] * 0x01010101u;

            tr_right = (uint8_t *) &tr;

        }



        if (mb->skip)

            AV_ZERO128(td->non_zero_count_cache);



        for (y = 0; y < 4; y++) {

            uint8_t *topright = ptr + 4 - s->linesize;

            for (x = 0; x < 4; x++) {

                int copy = 0, linesize = s->linesize;

                uint8_t *dst = ptr + 4 * x;

                DECLARE_ALIGNED(4, uint8_t, copy_dst)[5 * 8];



                if ((y == 0 || x == 3) && mb_y == 0) {

                    topright = tr_top;

                } else if (x == 3)

                    topright = tr_right;



                mode = check_intra_pred4x4_mode_emuedge(intra4x4[x],

                                                        mb_x + x, mb_y + y,

                                                        &copy);

                if (copy) {

                    dst      = copy_dst + 12;

                    linesize = 8;

                    if (!(mb_y + y)) {

                        copy_dst[3] = 127U;

                        AV_WN32A(copy_dst + 4, 127U * 0x01010101U);

                    } else {

                        AV_COPY32(copy_dst + 4, ptr + 4 * x - s->linesize);

                        if (!(mb_x + x)) {

                            copy_dst[3] = 129U;

                        } else {

                            copy_dst[3] = ptr[4 * x - s->linesize - 1];

                        }

                    }

                    if (!(mb_x + x)) {

                        copy_dst[11] =

                        copy_dst[19] =

                        copy_dst[27] =

                        copy_dst[35] = 129U;

                    } else {

                        copy_dst[11] = ptr[4 * x                   - 1];

                        copy_dst[19] = ptr[4 * x + s->linesize     - 1];

                        copy_dst[27] = ptr[4 * x + s->linesize * 2 - 1];

                        copy_dst[35] = ptr[4 * x + s->linesize * 3 - 1];

                    }

                }

                s->hpc.pred4x4[mode](dst, topright, linesize);

                if (copy) {

                    AV_COPY32(ptr + 4 * x,                   copy_dst + 12);

                    AV_COPY32(ptr + 4 * x + s->linesize,     copy_dst + 20);

                    AV_COPY32(ptr + 4 * x + s->linesize * 2, copy_dst + 28);

                    AV_COPY32(ptr + 4 * x + s->linesize * 3, copy_dst + 36);

                }



                nnz = td->non_zero_count_cache[y][x];

                if (nnz) {

                    if (nnz == 1)

                        s->vp8dsp.vp8_idct_dc_add(ptr + 4 * x,

                                                  td->block[y][x], s->linesize);

                    else

                        s->vp8dsp.vp8_idct_add(ptr + 4 * x,

                                               td->block[y][x], s->linesize);

                }

                topright += 4;

            }



            ptr      += 4 * s->linesize;

            intra4x4 += 4;

        }

    }



    mode = check_intra_pred8x8_mode_emuedge(mb->chroma_pred_mode, mb_x, mb_y);

    s->hpc.pred8x8[mode](dst[1], s->uvlinesize);

    s->hpc.pred8x8[mode](dst[2], s->uvlinesize);



    if (mb_y && (s->deblock_filter || !mb_y) && td->thread_nr == 0)

        xchg_mb_border(s->top_border[mb_x + 1], dst[0], dst[1], dst[2],

                       s->linesize, s->uvlinesize, mb_x, mb_y, s->mb_width,

                       s->filter.simple, 0);

}

void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3],

                   VP8Macroblock *mb, int mb_x, int mb_y)

{

    int x, y, mode, nnz;

    uint32_t tr;



    



    if (mb_y && (s->deblock_filter || !mb_y) && td->thread_nr == 0)

        xchg_mb_border(s->top_border[mb_x + 1], dst[0], dst[1], dst[2],

                       s->linesize, s->uvlinesize, mb_x, mb_y, s->mb_width,

                       s->filter.simple, 1);



    if (mb->mode < MODE_I4x4) {

        mode = check_intra_pred8x8_mode_emuedge(mb->mode, mb_x, mb_y);

        s->hpc.pred16x16[mode](dst[0], s->linesize);

    } else {

        uint8_t *ptr = dst[0];

        uint8_t *intra4x4 = mb->intra4x4_pred_mode_mb;

        uint8_t tr_top[4] = { 127, 127, 127, 127 };



        

        

        uint8_t *tr_right = ptr - s->linesize + 16;



        

        

        if (mb_y && mb_x == s->mb_width - 1) {

            tr       = tr_right[-1] * 0x01010101u;

            tr_right = (uint8_t *) &tr;

        }



        if (mb->skip)

            AV_ZERO128(td->non_zero_count_cache);



        for (y = 0; y < 4; y++) {

            uint8_t *topright = ptr + 4 - s->linesize;

            for (x = 0; x < 4; x++) {

                int copy = 0, linesize = s->linesize;

                uint8_t *dst = ptr + 4 * x;

                DECLARE_ALIGNED(4, uint8_t, copy_dst)[5 * 8];



                if ((y == 0 || x == 3) && mb_y == 0) {

                    topright = tr_top;

                } else if (x == 3)

                    topright = tr_right;



                mode = check_intra_pred4x4_mode_emuedge(intra4x4[x],

                                                        mb_x + x, mb_y + y,

                                                        &copy);

                if (copy) {

                    dst      = copy_dst + 12;

                    linesize = 8;

                    if (!(mb_y + y)) {

                        copy_dst[3] = 127U;

                        AV_WN32A(copy_dst + 4, 127U * 0x01010101U);

                    } else {

                        AV_COPY32(copy_dst + 4, ptr + 4 * x - s->linesize);

                        if (!(mb_x + x)) {

                            copy_dst[3] = 129U;

                        } else {

                            copy_dst[3] = ptr[4 * x - s->linesize - 1];

                        }

                    }

                    if (!(mb_x + x)) {

                        copy_dst[11] =

                        copy_dst[19] =

                        copy_dst[27] =

                        copy_dst[35] = 129U;

                    } else {

                        copy_dst[11] = ptr[4 * x                   - 1];

                        copy_dst[19] = ptr[4 * x + s->linesize     - 1];

                        copy_dst[27] = ptr[4 * x + s->linesize * 2 - 1];

                        copy_dst[35] = ptr[4 * x + s->linesize * 3 - 1];

                    }

                }

                s->hpc.pred4x4[mode](dst, topright, linesize);

                if (copy) {

                    AV_COPY32(ptr + 4 * x,                   copy_dst + 12);

                    AV_COPY32(ptr + 4 * x + s->linesize,     copy_dst + 20);

                    AV_COPY32(ptr + 4 * x + s->linesize * 2, copy_dst + 28);

                    AV_COPY32(ptr + 4 * x + s->linesize * 3, copy_dst + 36);

                }



                nnz = td->non_zero_count_cache[y][x];

                if (nnz) {

                    if (nnz == 1)

                        s->vp8dsp.vp8_idct_dc_add(ptr + 4 * x,

                                                  td->block[y][x], s->linesize);

                    else

                        s->vp8dsp.vp8_idct_add(ptr + 4 * x,

                                               td->block[y][x], s->linesize);

                }

                topright += 4;

            }



            ptr      += 4 * s->linesize;

            intra4x4 += 4;

        }

    }



    mode = check_intra_pred8x8_mode_emuedge(mb->chroma_pred_mode, mb_x, mb_y);

    s->hpc.pred8x8[mode](dst[1], s->uvlinesize);

    s->hpc.pred8x8[mode](dst[2], s->uvlinesize);



    if (mb_y && (s->deblock_filter || !mb_y) && td->thread_nr == 0)

        xchg_mb_border(s->top_border[mb_x + 1], dst[0], dst[1], dst[2],

                       s->linesize, s->uvlinesize, mb_x, mb_y, s->mb_width,

                       s->filter.simple, 0);

}

                   VP8Macroblock *mb, int mb_x, int mb_y)         mode = check_intra_pred8x8_mode_emuedge(mb->mode, mb_x, mb_y);         uint8_t tr_top[4] = { 127, 127, 127, 127 };                 mode = check_intra_pred4x4_mode_emuedge(intra4x4[x],                                                         mb_x + x, mb_y + y,                                                         &copy);                         copy_dst[3] = 127U;                         AV_WN32A(copy_dst + 4, 127U * 0x01010101U);                             copy_dst[3] = 129U;                         copy_dst[35] = 129U;     mode = check_intra_pred8x8_mode_emuedge(mb->chroma_pred_mode, mb_x, mb_y);
void FUNC_0(VP8Context *VAR_0, VP8ThreadData *VAR_1, uint8_t *VAR_2[3],

                   VP8Macroblock *VAR_3, int VAR_4, int VAR_5)

{

    int VAR_6, VAR_7, VAR_8, VAR_9;

    uint32_t tr;



    



    if (VAR_5 && (VAR_0->deblock_filter || !VAR_5) && VAR_1->thread_nr == 0)

        xchg_mb_border(VAR_0->top_border[VAR_4 + 1], VAR_2[0], VAR_2[1], VAR_2[2],

                       VAR_0->VAR_11, VAR_0->uvlinesize, VAR_4, VAR_5, VAR_0->mb_width,

                       VAR_0->filter.simple, 1);



    if (VAR_3->VAR_8 < MODE_I4x4) {

        VAR_8 = check_intra_pred8x8_mode_emuedge(VAR_3->VAR_8, VAR_4, VAR_5);

        VAR_0->hpc.pred16x16[VAR_8](VAR_2[0], VAR_0->VAR_11);

    } else {

        uint8_t *ptr = VAR_2[0];

        uint8_t *intra4x4 = VAR_3->intra4x4_pred_mode_mb;

        uint8_t tr_top[4] = { 127, 127, 127, 127 };



        

        

        uint8_t *tr_right = ptr - VAR_0->VAR_11 + 16;



        

        

        if (VAR_5 && VAR_4 == VAR_0->mb_width - 1) {

            tr       = tr_right[-1] * 0x01010101u;

            tr_right = (uint8_t *) &tr;

        }



        if (VAR_3->skip)

            AV_ZERO128(VAR_1->non_zero_count_cache);



        for (VAR_7 = 0; VAR_7 < 4; VAR_7++) {

            uint8_t *topright = ptr + 4 - VAR_0->VAR_11;

            for (VAR_6 = 0; VAR_6 < 4; VAR_6++) {

                int VAR_10 = 0, VAR_11 = VAR_0->VAR_11;

                uint8_t *VAR_2 = ptr + 4 * VAR_6;

                DECLARE_ALIGNED(4, uint8_t, copy_dst)[5 * 8];



                if ((VAR_7 == 0 || VAR_6 == 3) && VAR_5 == 0) {

                    topright = tr_top;

                } else if (VAR_6 == 3)

                    topright = tr_right;



                VAR_8 = check_intra_pred4x4_mode_emuedge(intra4x4[VAR_6],

                                                        VAR_4 + VAR_6, VAR_5 + VAR_7,

                                                        &VAR_10);

                if (VAR_10) {

                    VAR_2      = copy_dst + 12;

                    VAR_11 = 8;

                    if (!(VAR_5 + VAR_7)) {

                        copy_dst[3] = 127U;

                        AV_WN32A(copy_dst + 4, 127U * 0x01010101U);

                    } else {

                        AV_COPY32(copy_dst + 4, ptr + 4 * VAR_6 - VAR_0->VAR_11);

                        if (!(VAR_4 + VAR_6)) {

                            copy_dst[3] = 129U;

                        } else {

                            copy_dst[3] = ptr[4 * VAR_6 - VAR_0->VAR_11 - 1];

                        }

                    }

                    if (!(VAR_4 + VAR_6)) {

                        copy_dst[11] =

                        copy_dst[19] =

                        copy_dst[27] =

                        copy_dst[35] = 129U;

                    } else {

                        copy_dst[11] = ptr[4 * VAR_6                   - 1];

                        copy_dst[19] = ptr[4 * VAR_6 + VAR_0->VAR_11     - 1];

                        copy_dst[27] = ptr[4 * VAR_6 + VAR_0->VAR_11 * 2 - 1];

                        copy_dst[35] = ptr[4 * VAR_6 + VAR_0->VAR_11 * 3 - 1];

                    }

                }

                VAR_0->hpc.pred4x4[VAR_8](VAR_2, topright, VAR_11);

                if (VAR_10) {

                    AV_COPY32(ptr + 4 * VAR_6,                   copy_dst + 12);

                    AV_COPY32(ptr + 4 * VAR_6 + VAR_0->VAR_11,     copy_dst + 20);

                    AV_COPY32(ptr + 4 * VAR_6 + VAR_0->VAR_11 * 2, copy_dst + 28);

                    AV_COPY32(ptr + 4 * VAR_6 + VAR_0->VAR_11 * 3, copy_dst + 36);

                }



                VAR_9 = VAR_1->non_zero_count_cache[VAR_7][VAR_6];

                if (VAR_9) {

                    if (VAR_9 == 1)

                        VAR_0->vp8dsp.vp8_idct_dc_add(ptr + 4 * VAR_6,

                                                  VAR_1->block[VAR_7][VAR_6], VAR_0->VAR_11);

                    else

                        VAR_0->vp8dsp.vp8_idct_add(ptr + 4 * VAR_6,

                                               VAR_1->block[VAR_7][VAR_6], VAR_0->VAR_11);

                }

                topright += 4;

            }



            ptr      += 4 * VAR_0->VAR_11;

            intra4x4 += 4;

        }

    }



    VAR_8 = check_intra_pred8x8_mode_emuedge(VAR_3->chroma_pred_mode, VAR_4, VAR_5);

    VAR_0->hpc.pred8x8[VAR_8](VAR_2[1], VAR_0->uvlinesize);

    VAR_0->hpc.pred8x8[VAR_8](VAR_2[2], VAR_0->uvlinesize);



    if (VAR_5 && (VAR_0->deblock_filter || !VAR_5) && VAR_1->thread_nr == 0)

        xchg_mb_border(VAR_0->top_border[VAR_4 + 1], VAR_2[0], VAR_2[1], VAR_2[2],

                       VAR_0->VAR_11, VAR_0->uvlinesize, VAR_4, VAR_5, VAR_0->mb_width,

                       VAR_0->filter.simple, 0);

}

void FUNC_0(VP8Context *VAR_0, VP8ThreadData *VAR_1, uint8_t *VAR_2[3],
VP8Macroblock *VAR_3, int VAR_4, int VAR_5)
{ int VAR_6, VAR_7, VAR_8, VAR_9; uint32_t tr; if (VAR_5 && (VAR_0->deblock_filter || !VAR_5) && VAR_1->thread_nr == 0)
xchg_mb_border(VAR_0->top_border[VAR_4 + 1], VAR_2[0], VAR_2[1], VAR_2[2],
VAR_0->VAR_11, VAR_0->uvlinesize, VAR_4, VAR_5, VAR_0->mb_width,
VAR_0->filter.simple, 1); if (VAR_3->VAR_8 < MODE_I4x4) { VAR_8 = check_intra_pred8x8_mode_emuedge(VAR_3->VAR_8, VAR_4, VAR_5); VAR_0->hpc.pred16x16[VAR_8](VAR_2[0], VAR_0->VAR_11); } else { uint8_t *ptr = VAR_2[0]; uint8_t *intra4x4 = VAR_3->intra4x4_pred_mode_mb; uint8_t tr_top[4] = { 127, 127, 127, 127 }; uint8_t *tr_right = ptr - VAR_0->VAR_11 + 16; if (VAR_5 && VAR_4 == VAR_0->mb_width - 1) { tr       = tr_right[-1] * 0x01010101u; tr_right = (uint8_t *) &tr; } if (VAR_3->skip)
AV_ZERO128(VAR_1->non_zero_count_cache); for (VAR_7 = 0; VAR_7 < 4; VAR_7++) { uint8_t *topright = ptr + 4 - VAR_0->VAR_11; for (VAR_6 = 0; VAR_6 < 4; VAR_6++) { int VAR_10 = 0, VAR_11 = VAR_0->VAR_11; uint8_t *VAR_2 = ptr + 4 * VAR_6; DECLARE_ALIGNED(4, uint8_t, copy_dst)[5 * 8]; if ((VAR_7 == 0 || VAR_6 == 3) && VAR_5 == 0) { topright = tr_top; } else if (VAR_6 == 3) topright = tr_right; VAR_8 = check_intra_pred4x4_mode_emuedge(intra4x4[VAR_6],
VAR_4 + VAR_6, VAR_5 + VAR_7,
&VAR_10); if (VAR_10) { VAR_2      = copy_dst + 12; VAR_11 = 8; if (!(VAR_5 + VAR_7)) { copy_dst[3] = 127U; AV_WN32A(copy_dst + 4, 127U * 0x01010101U); } else { AV_COPY32(copy_dst + 4, ptr + 4 * VAR_6 - VAR_0->VAR_11); if (!(VAR_4 + VAR_6)) { copy_dst[3] = 129U; } else { copy_dst[3] = ptr[4 * VAR_6 - VAR_0->VAR_11 - 1]; } } if (!(VAR_4 + VAR_6)) { copy_dst[11] =
copy_dst[19] =
copy_dst[27] =
copy_dst[35] = 129U; } else { copy_dst[11] = ptr[4 * VAR_6                   - 1]; copy_dst[19] = ptr[4 * VAR_6 + VAR_0->VAR_11     - 1]; copy_dst[27] = ptr[4 * VAR_6 + VAR_0->VAR_11 * 2 - 1]; copy_dst[35] = ptr[4 * VAR_6 + VAR_0->VAR_11 * 3 - 1]; } } VAR_0->hpc.pred4x4[VAR_8](VAR_2, topright, VAR_11); if (VAR_10) { AV_COPY32(ptr + 4 * VAR_6,                   copy_dst + 12); AV_COPY32(ptr + 4 * VAR_6 + VAR_0->VAR_11,     copy_dst + 20); AV_COPY32(ptr + 4 * VAR_6 + VAR_0->VAR_11 * 2, copy_dst + 28); AV_COPY32(ptr + 4 * VAR_6 + VAR_0->VAR_11 * 3, copy_dst + 36); } VAR_9 = VAR_1->non_zero_count_cache[VAR_7][VAR_6]; if (VAR_9) { if (VAR_9 == 1)
VAR_0->vp8dsp.vp8_idct_dc_add(ptr + 4 * VAR_6,
VAR_1->block[VAR_7][VAR_6], VAR_0->VAR_11); else
VAR_0->vp8dsp.vp8_idct_add(ptr + 4 * VAR_6,
VAR_1->block[VAR_7][VAR_6], VAR_0->VAR_11); } topright += 4; } ptr      += 4 * VAR_0->VAR_11; intra4x4 += 4; } } VAR_8 = check_intra_pred8x8_mode_emuedge(VAR_3->chroma_pred_mode, VAR_4, VAR_5); VAR_0->hpc.pred8x8[VAR_8](VAR_2[1], VAR_0->uvlinesize); VAR_0->hpc.pred8x8[VAR_8](VAR_2[2], VAR_0->uvlinesize); if (VAR_5 && (VAR_0->deblock_filter || !VAR_5) && VAR_1->thread_nr == 0)
xchg_mb_border(VAR_0->top_border[VAR_4 + 1], VAR_2[0], VAR_2[1], VAR_2[2],
VAR_0->VAR_11, VAR_0->uvlinesize, VAR_4, VAR_5, VAR_0->mb_width,
VAR_0->filter.simple, 0); }