static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)

{

    FadeContext *fade = inlink->dst->priv;

    AVFilterBufferRef *outpic = inlink->cur_buf;

    uint8_t *p;

    int i, j, plane;



    if (fade->factor < 65536) {

        /* luma or rgb plane */

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

            p = outpic->data[0] + (y+i) * outpic->linesize[0];

            for (j = 0; j < inlink->w * fade->bpp; j++) {

                /* fade->factor is using 16 lower-order bits for decimal

                 * places. 32768 = 1 << 15, it is an integer representation

                 * of 0.5 and is for rounding. */

                *p = (*p * fade->factor + 32768) >> 16;

                p++;

            }

        }



        if (outpic->data[0] && outpic->data[1]) {

            /* chroma planes */

            for (plane = 1; plane < 3; plane++) {

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

                    p = outpic->data[plane] + ((y+i) >> fade->vsub) * outpic->linesize[plane];

                    for (j = 0; j < inlink->w >> fade->hsub; j++) {

                        /* 8421367 = ((128 << 1) + 1) << 15. It is an integer

                         * representation of 128.5. The .5 is for rounding

                         * purposes. */

                        *p = ((*p - 128) * fade->factor + 8421367) >> 16;

                        p++;

                    }

                }

            }

        }

    }



    avfilter_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);

}

static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)

{

    FadeContext *fade = inlink->dst->priv;

    AVFilterBufferRef *outpic = inlink->cur_buf;

    uint8_t *p;

    int i, j, plane;



    if (fade->factor < 65536) {

        

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

            p = outpic->data[0] + (y+i) * outpic->linesize[0];

            for (j = 0; j < inlink->w * fade->bpp; j++) {

                





                *p = (*p * fade->factor + 32768) >> 16;

                p++;

            }

        }



        if (outpic->data[0] && outpic->data[1]) {

            

            for (plane = 1; plane < 3; plane++) {

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

                    p = outpic->data[plane] + ((y+i) >> fade->vsub) * outpic->linesize[plane];

                    for (j = 0; j < inlink->w >> fade->hsub; j++) {

                        





                        *p = ((*p - 128) * fade->factor + 8421367) >> 16;

                        p++;

                    }

                }

            }

        }

    }



    avfilter_draw_slice(inlink->dst->outputs[0], y, h, slice_dir);

}

static void FUNC_0(AVFilterLink *VAR_0, int VAR_1, int VAR_2, int VAR_3)

{

    FadeContext *fade = VAR_0->dst->priv;

    AVFilterBufferRef *outpic = VAR_0->cur_buf;

    uint8_t *p;

    int VAR_4, VAR_5, VAR_6;



    if (fade->factor < 65536) {

        

        for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) {

            p = outpic->data[0] + (VAR_1+VAR_4) * outpic->linesize[0];

            for (VAR_5 = 0; VAR_5 < VAR_0->w * fade->bpp; VAR_5++) {

                





                *p = (*p * fade->factor + 32768) >> 16;

                p++;

            }

        }



        if (outpic->data[0] && outpic->data[1]) {

            

            for (VAR_6 = 1; VAR_6 < 3; VAR_6++) {

                for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) {

                    p = outpic->data[VAR_6] + ((VAR_1+VAR_4) >> fade->vsub) * outpic->linesize[VAR_6];

                    for (VAR_5 = 0; VAR_5 < VAR_0->w >> fade->hsub; VAR_5++) {

                        





                        *p = ((*p - 128) * fade->factor + 8421367) >> 16;

                        p++;

                    }

                }

            }

        }

    }



    avfilter_draw_slice(VAR_0->dst->outputs[0], VAR_1, VAR_2, VAR_3);

}

static void FUNC_0(AVFilterLink *VAR_0, int VAR_1, int VAR_2, int VAR_3)
{ FadeContext *fade = VAR_0->dst->priv; AVFilterBufferRef *outpic = VAR_0->cur_buf; uint8_t *p; int VAR_4, VAR_5, VAR_6; if (fade->factor < 65536) { for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) { p = outpic->data[0] + (VAR_1+VAR_4) * outpic->linesize[0]; for (VAR_5 = 0; VAR_5 < VAR_0->w * fade->bpp; VAR_5++) { *p = (*p * fade->factor + 32768) >> 16; p++; } } if (outpic->data[0] && outpic->data[1]) { for (VAR_6 = 1; VAR_6 < 3; VAR_6++) { for (VAR_4 = 0; VAR_4 < VAR_2; VAR_4++) { p = outpic->data[VAR_6] + ((VAR_1+VAR_4) >> fade->vsub) * outpic->linesize[VAR_6]; for (VAR_5 = 0; VAR_5 < VAR_0->w >> fade->hsub; VAR_5++) { *p = ((*p - 128) * fade->factor + 8421367) >> 16; p++; } } } } } avfilter_draw_slice(VAR_0->dst->outputs[0], VAR_1, VAR_2, VAR_3); }