yuv2mono_X_c_template(SwsContext *c, const int16_t *lumFilter,

                      const int16_t **lumSrc, int lumFilterSize,

                      const int16_t *chrFilter, const int16_t **chrUSrc,

                      const int16_t **chrVSrc, int chrFilterSize,

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

                      int y, enum AVPixelFormat target)

{

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

    int i;

    unsigned acc = 0;

    int err = 0;



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

        int j;

        int Y1 = 1 << 18;

        int Y2 = 1 << 18;



        for (j = 0; j < lumFilterSize; j++) {

            Y1 += lumSrc[j][i]   * lumFilter[j];

            Y2 += lumSrc[j][i+1] * lumFilter[j];

        }

        Y1 >>= 19;

        Y2 >>= 19;

        if ((Y1 | Y2) & 0x100) {

            Y1 = av_clip_uint8(Y1);

            Y2 = av_clip_uint8(Y2);

        }

        if (c->flags & SWS_ERROR_DIFFUSION) {

            Y1 += (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 + (Y1 >= 128);

            Y1 -= 220*(acc&1);



            err = Y2 + ((7*Y1 + 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] = Y1;

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

            err -= 220*(acc&1);

        } else {

            accumulate_bit(acc, Y1 + d128[(i + 0) & 7]);

            accumulate_bit(acc, Y2 + d128[(i + 1) & 7]);

        }

        if ((i & 7) == 6) {

            output_pixel(*dest++, acc);

        }

    }

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



    if (i & 6) {

        output_pixel(*dest, acc);

    }

}

yuv2mono_X_c_template(SwsContext *c, const int16_t *lumFilter,

                      const int16_t **lumSrc, int lumFilterSize,

                      const int16_t *chrFilter, const int16_t **chrUSrc,

                      const int16_t **chrVSrc, int chrFilterSize,

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

                      int y, enum AVPixelFormat target)

{

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

    int i;

    unsigned acc = 0;

    int err = 0;



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

        int j;

        int Y1 = 1 << 18;

        int Y2 = 1 << 18;



        for (j = 0; j < lumFilterSize; j++) {

            Y1 += lumSrc[j][i]   * lumFilter[j];

            Y2 += lumSrc[j][i+1] * lumFilter[j];

        }

        Y1 >>= 19;

        Y2 >>= 19;

        if ((Y1 | Y2) & 0x100) {

            Y1 = av_clip_uint8(Y1);

            Y2 = av_clip_uint8(Y2);

        }

        if (c->flags & SWS_ERROR_DIFFUSION) {

            Y1 += (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 + (Y1 >= 128);

            Y1 -= 220*(acc&1);



            err = Y2 + ((7*Y1 + 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] = Y1;

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

            err -= 220*(acc&1);

        } else {

            accumulate_bit(acc, Y1 + d128[(i + 0) & 7]);

            accumulate_bit(acc, Y2 + d128[(i + 1) & 7]);

        }

        if ((i & 7) == 6) {

            output_pixel(*dest++, acc);

        }

    }

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



    if (i & 6) {

        output_pixel(*dest, acc);

    }

}

FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1,

                      const int16_t **VAR_2, int VAR_3,

                      const int16_t *VAR_4, const int16_t **VAR_5,

                      const int16_t **VAR_6, int VAR_7,

                      const int16_t **VAR_8, uint8_t *VAR_9, int VAR_10,

                      int VAR_11, enum AVPixelFormat VAR_12)

{

    const uint8_t * const VAR_13=dither_8x8_220[VAR_11&7];

    int VAR_14;

    unsigned VAR_15 = 0;

    int VAR_16 = 0;



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

        int VAR_17;

        int VAR_18 = 1 << 18;

        int VAR_19 = 1 << 18;



        for (VAR_17 = 0; VAR_17 < VAR_3; VAR_17++) {

            VAR_18 += VAR_2[VAR_17][VAR_14]   * VAR_1[VAR_17];

            VAR_19 += VAR_2[VAR_17][VAR_14+1] * VAR_1[VAR_17];

        }

        VAR_18 >>= 19;

        VAR_19 >>= 19;

        if ((VAR_18 | VAR_19) & 0x100) {

            VAR_18 = av_clip_uint8(VAR_18);

            VAR_19 = av_clip_uint8(VAR_19);

        }

        if (VAR_0->flags & SWS_ERROR_DIFFUSION) {

            VAR_18 += (7*VAR_16 + 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_16;

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

            VAR_18 -= 220*(VAR_15&1);



            VAR_16 = VAR_19 + ((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_15 = 2*VAR_15 + (VAR_16 >= 128);

            VAR_16 -= 220*(VAR_15&1);

        } else {

            accumulate_bit(VAR_15, VAR_18 + VAR_13[(VAR_14 + 0) & 7]);

            accumulate_bit(VAR_15, VAR_19 + VAR_13[(VAR_14 + 1) & 7]);

        }

        if ((VAR_14 & 7) == 6) {

            output_pixel(*VAR_9++, VAR_15);

        }

    }

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



    if (VAR_14 & 6) {

        output_pixel(*VAR_9, VAR_15);

    }

}

FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1,
const int16_t **VAR_2, int VAR_3,
const int16_t *VAR_4, const int16_t **VAR_5,
const int16_t **VAR_6, int VAR_7,
const int16_t **VAR_8, uint8_t *VAR_9, int VAR_10,
int VAR_11, enum AVPixelFormat VAR_12)
{ const uint8_t * const VAR_13=dither_8x8_220[VAR_11&7]; int VAR_14; unsigned VAR_15 = 0; int VAR_16 = 0; for (VAR_14 = 0; VAR_14 < VAR_10; VAR_14 += 2) { int VAR_17; int VAR_18 = 1 << 18; int VAR_19 = 1 << 18; for (VAR_17 = 0; VAR_17 < VAR_3; VAR_17++) { VAR_18 += VAR_2[VAR_17][VAR_14]   * VAR_1[VAR_17]; VAR_19 += VAR_2[VAR_17][VAR_14+1] * VAR_1[VAR_17]; } VAR_18 >>= 19; VAR_19 >>= 19; if ((VAR_18 | VAR_19) & 0x100) { VAR_18 = av_clip_uint8(VAR_18); VAR_19 = av_clip_uint8(VAR_19); } if (VAR_0->flags & SWS_ERROR_DIFFUSION) { VAR_18 += (7*VAR_16 + 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_16; VAR_15 = 2*VAR_15 + (VAR_18 >= 128); VAR_18 -= 220*(VAR_15&1); VAR_16 = VAR_19 + ((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_15 = 2*VAR_15 + (VAR_16 >= 128); VAR_16 -= 220*(VAR_15&1); } else { accumulate_bit(VAR_15, VAR_18 + VAR_13[(VAR_14 + 0) & 7]); accumulate_bit(VAR_15, VAR_19 + VAR_13[(VAR_14 + 1) & 7]); } if ((VAR_14 & 7) == 6) { output_pixel(*VAR_9++, VAR_15); } } VAR_0->dither_error[0][VAR_14] = VAR_16; if (VAR_14 & 6) { output_pixel(*VAR_9, VAR_15); } }