static void draw_slice(AVFilterLink *link, int y, int h)

{

    ScaleContext *scale = link->dst->priv;

    int out_h;

    AVFilterPicRef *cur_pic = link->cur_pic;

    uint8_t *data[4];



    if (!scale->slice_dir) {

        if (y != 0 && y + h != link->h) {

            av_log(scale, AV_LOG_ERROR, "Slices start in the middle!\n");

            return;

        }

        scale->slice_dir = y ?                       -1 : 1;

        scale->slice_y   = y ? link->dst->outputs[0]->h : y;

    }



    data[0] = cur_pic->data[0] +  y               * cur_pic->linesize[0];

    data[1] = scale->input_is_pal ?

              cur_pic->data[1] :

              cur_pic->data[1] + (y>>scale->vsub) * cur_pic->linesize[1];

    data[2] = cur_pic->data[2] + (y>>scale->vsub) * cur_pic->linesize[2];

    data[3] = cur_pic->data[3] +  y               * cur_pic->linesize[3];



    out_h = sws_scale(scale->sws, data, cur_pic->linesize, y, h,

                      link->dst->outputs[0]->outpic->data,

                      link->dst->outputs[0]->outpic->linesize);



    if (scale->slice_dir == -1)

        scale->slice_y -= out_h;

    avfilter_draw_slice(link->dst->outputs[0], scale->slice_y, out_h);

    if (scale->slice_dir == 1)

        scale->slice_y += out_h;

}

static void draw_slice(AVFilterLink *link, int y, int h)

{

    ScaleContext *scale = link->dst->priv;

    int out_h;

    AVFilterPicRef *cur_pic = link->cur_pic;

    uint8_t *data[4];



    if (!scale->slice_dir) {

        if (y != 0 && y + h != link->h) {

            av_log(scale, AV_LOG_ERROR, "Slices start in the middle!\n");

            return;

        }

        scale->slice_dir = y ?                       -1 : 1;

        scale->slice_y   = y ? link->dst->outputs[0]->h : y;

    }



    data[0] = cur_pic->data[0] +  y               * cur_pic->linesize[0];

    data[1] = scale->input_is_pal ?

              cur_pic->data[1] :

              cur_pic->data[1] + (y>>scale->vsub) * cur_pic->linesize[1];

    data[2] = cur_pic->data[2] + (y>>scale->vsub) * cur_pic->linesize[2];

    data[3] = cur_pic->data[3] +  y               * cur_pic->linesize[3];



    out_h = sws_scale(scale->sws, data, cur_pic->linesize, y, h,

                      link->dst->outputs[0]->outpic->data,

                      link->dst->outputs[0]->outpic->linesize);



    if (scale->slice_dir == -1)

        scale->slice_y -= out_h;

    avfilter_draw_slice(link->dst->outputs[0], scale->slice_y, out_h);

    if (scale->slice_dir == 1)

        scale->slice_y += out_h;

}

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

{

    ScaleContext *scale = VAR_0->dst->priv;

    int VAR_3;

    AVFilterPicRef *cur_pic = VAR_0->cur_pic;

    uint8_t *data[4];



    if (!scale->slice_dir) {

        if (VAR_1 != 0 && VAR_1 + VAR_2 != VAR_0->VAR_2) {

            av_log(scale, AV_LOG_ERROR, "Slices start in the middle!\n");

            return;

        }

        scale->slice_dir = VAR_1 ?                       -1 : 1;

        scale->slice_y   = VAR_1 ? VAR_0->dst->outputs[0]->VAR_2 : VAR_1;

    }



    data[0] = cur_pic->data[0] +  VAR_1               * cur_pic->linesize[0];

    data[1] = scale->input_is_pal ?

              cur_pic->data[1] :

              cur_pic->data[1] + (VAR_1>>scale->vsub) * cur_pic->linesize[1];

    data[2] = cur_pic->data[2] + (VAR_1>>scale->vsub) * cur_pic->linesize[2];

    data[3] = cur_pic->data[3] +  VAR_1               * cur_pic->linesize[3];



    VAR_3 = sws_scale(scale->sws, data, cur_pic->linesize, VAR_1, VAR_2,

                      VAR_0->dst->outputs[0]->outpic->data,

                      VAR_0->dst->outputs[0]->outpic->linesize);



    if (scale->slice_dir == -1)

        scale->slice_y -= VAR_3;

    avfilter_draw_slice(VAR_0->dst->outputs[0], scale->slice_y, VAR_3);

    if (scale->slice_dir == 1)

        scale->slice_y += VAR_3;

}

static void FUNC_0(AVFilterLink *VAR_0, int VAR_1, int VAR_2)
{ ScaleContext *scale = VAR_0->dst->priv; int VAR_3; AVFilterPicRef *cur_pic = VAR_0->cur_pic; uint8_t *data[4]; if (!scale->slice_dir) { if (VAR_1 != 0 && VAR_1 + VAR_2 != VAR_0->VAR_2) { av_log(scale, AV_LOG_ERROR, "Slices start in the middle!\n"); return; } scale->slice_dir = VAR_1 ?                       -1 : 1; scale->slice_y   = VAR_1 ? VAR_0->dst->outputs[0]->VAR_2 : VAR_1; } data[0] = cur_pic->data[0] +  VAR_1               * cur_pic->linesize[0]; data[1] = scale->input_is_pal ?
cur_pic->data[1] :
cur_pic->data[1] + (VAR_1>>scale->vsub) * cur_pic->linesize[1]; data[2] = cur_pic->data[2] + (VAR_1>>scale->vsub) * cur_pic->linesize[2]; data[3] = cur_pic->data[3] +  VAR_1               * cur_pic->linesize[3]; VAR_3 = sws_scale(scale->sws, data, cur_pic->linesize, VAR_1, VAR_2,
VAR_0->dst->outputs[0]->outpic->data,
VAR_0->dst->outputs[0]->outpic->linesize); if (scale->slice_dir == -1)
scale->slice_y -= VAR_3; avfilter_draw_slice(VAR_0->dst->outputs[0], scale->slice_y, VAR_3); if (scale->slice_dir == 1)
scale->slice_y += VAR_3; }