yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2],

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

                      const int16_t *abuf[2], uint8_t *dest, int dstW,

                      int yalpha, int uvalpha, int y,

                      enum AVPixelFormat target)

{

    const int16_t *buf0  = buf[0],  *buf1  = buf[1];

    const uint8_t * const d128 = dither_8x8_220[y & 7];

    int  yalpha1 = 4096 - yalpha;

    int i;



    if (c->flags & SWS_ERROR_DIFFUSION) {

        int err = 0;

        int acc = 0;

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

            int Y;



            Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19;

            Y += (7*err + 1*c->dither_error[0][i] + 5*c->dither_error[0][i+1] + 3*c->dither_error[0][i+2] + 8 - 256)>>4;

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

            acc = 2*acc + (Y >= 128);

            Y -= 220*(acc&1);



            err = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19;

            err += (7*Y + 1*c->dither_error[0][i+1] + 5*c->dither_error[0][i+2] + 3*c->dither_error[0][i+3] + 8 - 256)>>4;

            c->dither_error[0][i+1] = Y;

            acc = 2*acc + (err >= 128);

            err -= 220*(acc&1);



            if ((i & 7) == 6)

                output_pixel(*dest++, acc);

        }

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

    } else {

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

        int Y, acc = 0;



        Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[0]);

        Y = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[1]);

        Y = (buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[2]);

        Y = (buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[3]);

        Y = (buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[4]);

        Y = (buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[5]);

        Y = (buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[6]);

        Y = (buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[7]);



        output_pixel(*dest++, acc);

    }

    }

}

yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2],

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

                      const int16_t *abuf[2], uint8_t *dest, int dstW,

                      int yalpha, int uvalpha, int y,

                      enum AVPixelFormat target)

{

    const int16_t *buf0  = buf[0],  *buf1  = buf[1];

    const uint8_t * const d128 = dither_8x8_220[y & 7];

    int  yalpha1 = 4096 - yalpha;

    int i;



    if (c->flags & SWS_ERROR_DIFFUSION) {

        int err = 0;

        int acc = 0;

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

            int Y;



            Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19;

            Y += (7*err + 1*c->dither_error[0][i] + 5*c->dither_error[0][i+1] + 3*c->dither_error[0][i+2] + 8 - 256)>>4;

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

            acc = 2*acc + (Y >= 128);

            Y -= 220*(acc&1);



            err = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19;

            err += (7*Y + 1*c->dither_error[0][i+1] + 5*c->dither_error[0][i+2] + 3*c->dither_error[0][i+3] + 8 - 256)>>4;

            c->dither_error[0][i+1] = Y;

            acc = 2*acc + (err >= 128);

            err -= 220*(acc&1);



            if ((i & 7) == 6)

                output_pixel(*dest++, acc);

        }

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

    } else {

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

        int Y, acc = 0;



        Y = (buf0[i + 0] * yalpha1 + buf1[i + 0] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[0]);

        Y = (buf0[i + 1] * yalpha1 + buf1[i + 1] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[1]);

        Y = (buf0[i + 2] * yalpha1 + buf1[i + 2] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[2]);

        Y = (buf0[i + 3] * yalpha1 + buf1[i + 3] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[3]);

        Y = (buf0[i + 4] * yalpha1 + buf1[i + 4] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[4]);

        Y = (buf0[i + 5] * yalpha1 + buf1[i + 5] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[5]);

        Y = (buf0[i + 6] * yalpha1 + buf1[i + 6] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[6]);

        Y = (buf0[i + 7] * yalpha1 + buf1[i + 7] * yalpha) >> 19;

        accumulate_bit(acc, Y + d128[7]);



        output_pixel(*dest++, acc);

    }

    }

}

FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1[2],

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

                      const int16_t *VAR_4[2], uint8_t *VAR_5, int VAR_6,

                      int VAR_7, int VAR_8, int VAR_9,

                      enum AVPixelFormat VAR_10)

{

    const int16_t *VAR_11  = VAR_1[0],  *buf1  = VAR_1[1];

    const uint8_t * const VAR_12 = dither_8x8_220[VAR_9 & 7];

    int  VAR_13 = 4096 - VAR_7;

    int VAR_14;



    if (VAR_0->flags & SWS_ERROR_DIFFUSION) {

        int VAR_15 = 0;

        int VAR_18 = 0;

        for (VAR_14 = 0; VAR_14 < VAR_6; VAR_14 +=2) {

            int VAR_18;



            VAR_18 = (VAR_11[VAR_14 + 0] * VAR_13 + buf1[VAR_14 + 0] * VAR_7) >> 19;

            VAR_18 += (7*VAR_15 + 1*VAR_0->dither_error[0][VAR_14] + 5*VAR_0->dither_error[0][VAR_14+1] + 3*VAR_0->dither_error[0][VAR_14+2] + 8 - 256)>>4;

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

            VAR_18 = 2*VAR_18 + (VAR_18 >= 128);

            VAR_18 -= 220*(VAR_18&1);



            VAR_15 = (VAR_11[VAR_14 + 1] * VAR_13 + buf1[VAR_14 + 1] * VAR_7) >> 19;

            VAR_15 += (7*VAR_18 + 1*VAR_0->dither_error[0][VAR_14+1] + 5*VAR_0->dither_error[0][VAR_14+2] + 3*VAR_0->dither_error[0][VAR_14+3] + 8 - 256)>>4;

            VAR_0->dither_error[0][VAR_14+1] = VAR_18;

            VAR_18 = 2*VAR_18 + (VAR_15 >= 128);

            VAR_15 -= 220*(VAR_18&1);



            if ((VAR_14 & 7) == 6)

                output_pixel(*VAR_5++, VAR_18);

        }

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

    } else {

    for (VAR_14 = 0; VAR_14 < VAR_6; VAR_14 += 8) {

        int VAR_18, VAR_18 = 0;



        VAR_18 = (VAR_11[VAR_14 + 0] * VAR_13 + buf1[VAR_14 + 0] * VAR_7) >> 19;

        accumulate_bit(VAR_18, VAR_18 + VAR_12[0]);

        VAR_18 = (VAR_11[VAR_14 + 1] * VAR_13 + buf1[VAR_14 + 1] * VAR_7) >> 19;

        accumulate_bit(VAR_18, VAR_18 + VAR_12[1]);

        VAR_18 = (VAR_11[VAR_14 + 2] * VAR_13 + buf1[VAR_14 + 2] * VAR_7) >> 19;

        accumulate_bit(VAR_18, VAR_18 + VAR_12[2]);

        VAR_18 = (VAR_11[VAR_14 + 3] * VAR_13 + buf1[VAR_14 + 3] * VAR_7) >> 19;

        accumulate_bit(VAR_18, VAR_18 + VAR_12[3]);

        VAR_18 = (VAR_11[VAR_14 + 4] * VAR_13 + buf1[VAR_14 + 4] * VAR_7) >> 19;

        accumulate_bit(VAR_18, VAR_18 + VAR_12[4]);

        VAR_18 = (VAR_11[VAR_14 + 5] * VAR_13 + buf1[VAR_14 + 5] * VAR_7) >> 19;

        accumulate_bit(VAR_18, VAR_18 + VAR_12[5]);

        VAR_18 = (VAR_11[VAR_14 + 6] * VAR_13 + buf1[VAR_14 + 6] * VAR_7) >> 19;

        accumulate_bit(VAR_18, VAR_18 + VAR_12[6]);

        VAR_18 = (VAR_11[VAR_14 + 7] * VAR_13 + buf1[VAR_14 + 7] * VAR_7) >> 19;

        accumulate_bit(VAR_18, VAR_18 + VAR_12[7]);



        output_pixel(*VAR_5++, VAR_18);

    }

    }

}

FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1[2],
const int16_t *VAR_2[2], const int16_t *VAR_3[2],
const int16_t *VAR_4[2], uint8_t *VAR_5, int VAR_6,
int VAR_7, int VAR_8, int VAR_9,
enum AVPixelFormat VAR_10)
{ const int16_t *VAR_11  = VAR_1[0],  *buf1  = VAR_1[1]; const uint8_t * const VAR_12 = dither_8x8_220[VAR_9 & 7]; int  VAR_13 = 4096 - VAR_7; int VAR_14; if (VAR_0->flags & SWS_ERROR_DIFFUSION) { int VAR_15 = 0; int VAR_18 = 0; for (VAR_14 = 0; VAR_14 < VAR_6; VAR_14 +=2) { int VAR_18; VAR_18 = (VAR_11[VAR_14 + 0] * VAR_13 + buf1[VAR_14 + 0] * VAR_7) >> 19; VAR_18 += (7*VAR_15 + 1*VAR_0->dither_error[0][VAR_14] + 5*VAR_0->dither_error[0][VAR_14+1] + 3*VAR_0->dither_error[0][VAR_14+2] + 8 - 256)>>4; VAR_0->dither_error[0][VAR_14] = VAR_15; VAR_18 = 2*VAR_18 + (VAR_18 >= 128); VAR_18 -= 220*(VAR_18&1); VAR_15 = (VAR_11[VAR_14 + 1] * VAR_13 + buf1[VAR_14 + 1] * VAR_7) >> 19; VAR_15 += (7*VAR_18 + 1*VAR_0->dither_error[0][VAR_14+1] + 5*VAR_0->dither_error[0][VAR_14+2] + 3*VAR_0->dither_error[0][VAR_14+3] + 8 - 256)>>4; VAR_0->dither_error[0][VAR_14+1] = VAR_18; VAR_18 = 2*VAR_18 + (VAR_15 >= 128); VAR_15 -= 220*(VAR_18&1); if ((VAR_14 & 7) == 6)
output_pixel(*VAR_5++, VAR_18); } VAR_0->dither_error[0][VAR_14] = VAR_15; } else { for (VAR_14 = 0; VAR_14 < VAR_6; VAR_14 += 8) { int VAR_18, VAR_18 = 0; VAR_18 = (VAR_11[VAR_14 + 0] * VAR_13 + buf1[VAR_14 + 0] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[0]); VAR_18 = (VAR_11[VAR_14 + 1] * VAR_13 + buf1[VAR_14 + 1] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[1]); VAR_18 = (VAR_11[VAR_14 + 2] * VAR_13 + buf1[VAR_14 + 2] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[2]); VAR_18 = (VAR_11[VAR_14 + 3] * VAR_13 + buf1[VAR_14 + 3] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[3]); VAR_18 = (VAR_11[VAR_14 + 4] * VAR_13 + buf1[VAR_14 + 4] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[4]); VAR_18 = (VAR_11[VAR_14 + 5] * VAR_13 + buf1[VAR_14 + 5] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[5]); VAR_18 = (VAR_11[VAR_14 + 6] * VAR_13 + buf1[VAR_14 + 6] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[6]); VAR_18 = (VAR_11[VAR_14 + 7] * VAR_13 + buf1[VAR_14 + 7] * VAR_7) >> 19; accumulate_bit(VAR_18, VAR_18 + VAR_12[7]); output_pixel(*VAR_5++, VAR_18); } } }