yuv2rgb_full_1_c_template(SwsContext *c, const int16_t *buf0,

                     const int16_t *ubuf[2], const int16_t *vbuf[2],

                     const int16_t *abuf0, uint8_t *dest, int dstW,

                     int uvalpha, int y, enum AVPixelFormat target,

                     int hasAlpha)

{

    const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];

    int i;

    int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4;

    int err[4] = {0};



    if(   target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE

       || target == AV_PIX_FMT_BGR8      || target == AV_PIX_FMT_RGB8)

        step = 1;



    if (uvalpha < 2048) {

        int A = 0; //init to silence warning

        for (i = 0; i < dstW; i++) {

            int Y = buf0[i] << 2;

            int U = (ubuf0[i] - (128<<7)) << 2;

            int V = (vbuf0[i] - (128<<7)) << 2;



            if (hasAlpha) {

                A = (abuf0[i] + 64) >> 7;

                if (A & 0x100)

                    A = av_clip_uint8(A);

            }



            yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);

            dest += step;

        }

    } else {

        const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];

        int A = 0; //init to silence warning

        for (i = 0; i < dstW; i++) {

            int Y = buf0[i] << 2;

            int U = (ubuf0[i] + ubuf1[i] - (128<<8)) << 1;

            int V = (vbuf0[i] + vbuf1[i] - (128<<8)) << 1;



            if (hasAlpha) {

                A = (abuf0[i] + 64) >> 7;

                if (A & 0x100)

                    A = av_clip_uint8(A);

            }



            yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);

            dest += step;

        }

    }



    c->dither_error[0][i] = err[0];

    c->dither_error[1][i] = err[1];

    c->dither_error[2][i] = err[2];

}

yuv2rgb_full_1_c_template(SwsContext *c, const int16_t *buf0,

                     const int16_t *ubuf[2], const int16_t *vbuf[2],

                     const int16_t *abuf0, uint8_t *dest, int dstW,

                     int uvalpha, int y, enum AVPixelFormat target,

                     int hasAlpha)

{

    const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0];

    int i;

    int step = (target == AV_PIX_FMT_RGB24 || target == AV_PIX_FMT_BGR24) ? 3 : 4;

    int err[4] = {0};



    if(   target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE

       || target == AV_PIX_FMT_BGR8      || target == AV_PIX_FMT_RGB8)

        step = 1;



    if (uvalpha < 2048) {

        int A = 0; 

        for (i = 0; i < dstW; i++) {

            int Y = buf0[i] << 2;

            int U = (ubuf0[i] - (128<<7)) << 2;

            int V = (vbuf0[i] - (128<<7)) << 2;



            if (hasAlpha) {

                A = (abuf0[i] + 64) >> 7;

                if (A & 0x100)

                    A = av_clip_uint8(A);

            }



            yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);

            dest += step;

        }

    } else {

        const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1];

        int A = 0; 

        for (i = 0; i < dstW; i++) {

            int Y = buf0[i] << 2;

            int U = (ubuf0[i] + ubuf1[i] - (128<<8)) << 1;

            int V = (vbuf0[i] + vbuf1[i] - (128<<8)) << 1;



            if (hasAlpha) {

                A = (abuf0[i] + 64) >> 7;

                if (A & 0x100)

                    A = av_clip_uint8(A);

            }



            yuv2rgb_write_full(c, dest, i, Y, A, U, V, y, target, hasAlpha, err);

            dest += step;

        }

    }



    c->dither_error[0][i] = err[0];

    c->dither_error[1][i] = err[1];

    c->dither_error[2][i] = err[2];

}

FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1,

                     const int16_t *VAR_2[2], const int16_t *VAR_3[2],

                     const int16_t *VAR_4, uint8_t *VAR_5, int VAR_6,

                     int VAR_7, int VAR_8, enum AVPixelFormat VAR_9,

                     int VAR_10)

{

    const int16_t *VAR_11 = VAR_2[0], *vbuf0 = VAR_3[0];

    int VAR_12;

    int VAR_13 = (VAR_9 == AV_PIX_FMT_RGB24 || VAR_9 == AV_PIX_FMT_BGR24) ? 3 : 4;

    int VAR_14[4] = {0};



    if(   VAR_9 == AV_PIX_FMT_BGR4_BYTE || VAR_9 == AV_PIX_FMT_RGB4_BYTE

       || VAR_9 == AV_PIX_FMT_BGR8      || VAR_9 == AV_PIX_FMT_RGB8)

        VAR_13 = 1;



    if (VAR_7 < 2048) {

        int VAR_20 = 0; 

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

            int VAR_20 = VAR_1[VAR_12] << 2;

            int VAR_20 = (VAR_11[VAR_12] - (128<<7)) << 2;

            int VAR_20 = (vbuf0[VAR_12] - (128<<7)) << 2;



            if (VAR_10) {

                VAR_20 = (VAR_4[VAR_12] + 64) >> 7;

                if (VAR_20 & 0x100)

                    VAR_20 = av_clip_uint8(VAR_20);

            }



            yuv2rgb_write_full(VAR_0, VAR_5, VAR_12, VAR_20, VAR_20, VAR_20, VAR_20, VAR_8, VAR_9, VAR_10, VAR_14);

            VAR_5 += VAR_13;

        }

    } else {

        const int16_t *VAR_19 = VAR_2[1], *vbuf1 = VAR_3[1];

        int VAR_20 = 0; 

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

            int VAR_20 = VAR_1[VAR_12] << 2;

            int VAR_20 = (VAR_11[VAR_12] + VAR_19[VAR_12] - (128<<8)) << 1;

            int VAR_20 = (vbuf0[VAR_12] + vbuf1[VAR_12] - (128<<8)) << 1;



            if (VAR_10) {

                VAR_20 = (VAR_4[VAR_12] + 64) >> 7;

                if (VAR_20 & 0x100)

                    VAR_20 = av_clip_uint8(VAR_20);

            }



            yuv2rgb_write_full(VAR_0, VAR_5, VAR_12, VAR_20, VAR_20, VAR_20, VAR_20, VAR_8, VAR_9, VAR_10, VAR_14);

            VAR_5 += VAR_13;

        }

    }



    VAR_0->dither_error[0][VAR_12] = VAR_14[0];

    VAR_0->dither_error[1][VAR_12] = VAR_14[1];

    VAR_0->dither_error[2][VAR_12] = VAR_14[2];

}

FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1,
const int16_t *VAR_2[2], const int16_t *VAR_3[2],
const int16_t *VAR_4, uint8_t *VAR_5, int VAR_6,
int VAR_7, int VAR_8, enum AVPixelFormat VAR_9,
int VAR_10)
{ const int16_t *VAR_11 = VAR_2[0], *vbuf0 = VAR_3[0]; int VAR_12; int VAR_13 = (VAR_9 == AV_PIX_FMT_RGB24 || VAR_9 == AV_PIX_FMT_BGR24) ? 3 : 4; int VAR_14[4] = {0}; if(   VAR_9 == AV_PIX_FMT_BGR4_BYTE || VAR_9 == AV_PIX_FMT_RGB4_BYTE
|| VAR_9 == AV_PIX_FMT_BGR8      || VAR_9 == AV_PIX_FMT_RGB8)
VAR_13 = 1; if (VAR_7 < 2048) { int VAR_20 = 0; for (VAR_12 = 0; VAR_12 < VAR_6; VAR_12++) { int VAR_20 = VAR_1[VAR_12] << 2; int VAR_20 = (VAR_11[VAR_12] - (128<<7)) << 2; int VAR_20 = (vbuf0[VAR_12] - (128<<7)) << 2; if (VAR_10) { VAR_20 = (VAR_4[VAR_12] + 64) >> 7; if (VAR_20 & 0x100)
VAR_20 = av_clip_uint8(VAR_20); } yuv2rgb_write_full(VAR_0, VAR_5, VAR_12, VAR_20, VAR_20, VAR_20, VAR_20, VAR_8, VAR_9, VAR_10, VAR_14); VAR_5 += VAR_13; } } else { const int16_t *VAR_19 = VAR_2[1], *vbuf1 = VAR_3[1]; int VAR_20 = 0; for (VAR_12 = 0; VAR_12 < VAR_6; VAR_12++) { int VAR_20 = VAR_1[VAR_12] << 2; int VAR_20 = (VAR_11[VAR_12] + VAR_19[VAR_12] - (128<<8)) << 1; int VAR_20 = (vbuf0[VAR_12] + vbuf1[VAR_12] - (128<<8)) << 1; if (VAR_10) { VAR_20 = (VAR_4[VAR_12] + 64) >> 7; if (VAR_20 & 0x100)
VAR_20 = av_clip_uint8(VAR_20); } yuv2rgb_write_full(VAR_0, VAR_5, VAR_12, VAR_20, VAR_20, VAR_20, VAR_20, VAR_8, VAR_9, VAR_10, VAR_14); VAR_5 += VAR_13; } } VAR_0->dither_error[0][VAR_12] = VAR_14[0]; VAR_0->dither_error[1][VAR_12] = VAR_14[1]; VAR_0->dither_error[2][VAR_12] = VAR_14[2]; }