static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)

{

    AVFilterContext *ctx = link->dst;

    CropContext *crop = ctx->priv;

    AVFilterBufferRef *ref2;

    int i;



    picref->video->w = crop->w;

    picref->video->h = crop->h;



    ref2 = avfilter_ref_buffer(picref, ~0);



    crop->var_values[VAR_T] = picref->pts == AV_NOPTS_VALUE ?

        NAN : picref->pts * av_q2d(link->time_base);

    crop->var_values[VAR_POS] = picref->pos == -1 ? NAN : picref->pos;

    crop->var_values[VAR_X] = av_expr_eval(crop->x_pexpr, crop->var_values, NULL);

    crop->var_values[VAR_Y] = av_expr_eval(crop->y_pexpr, crop->var_values, NULL);

    crop->var_values[VAR_X] = av_expr_eval(crop->x_pexpr, crop->var_values, NULL);



    normalize_double(&crop->x, crop->var_values[VAR_X]);

    normalize_double(&crop->y, crop->var_values[VAR_Y]);



    if (crop->x < 0) crop->x = 0;

    if (crop->y < 0) crop->y = 0;

    if ((unsigned)crop->x + (unsigned)crop->w > link->w) crop->x = link->w - crop->w;

    if ((unsigned)crop->y + (unsigned)crop->h > link->h) crop->y = link->h - crop->h;

    crop->x &= ~((1 << crop->hsub) - 1);

    crop->y &= ~((1 << crop->vsub) - 1);




    av_log(ctx, AV_LOG_DEBUG,

           "n:%d t:%f x:%d y:%d x+w:%d y+h:%d\n",

           (int)crop->var_values[VAR_N], crop->var_values[VAR_T], crop->x, crop->y, crop->x+crop->w, crop->y+crop->h);




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

    ref2->data[0] += crop->x * crop->max_step[0];



    if (!(av_pix_fmt_descriptors[link->format].flags & PIX_FMT_PAL)) {

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

            if (ref2->data[i]) {

                ref2->data[i] += (crop->y >> crop->vsub) * ref2->linesize[i];

                ref2->data[i] += (crop->x * crop->max_step[i]) >> crop->hsub;

            }

        }

    }



    /* alpha plane */

    if (ref2->data[3]) {

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

        ref2->data[3] += crop->x * crop->max_step[3];

    }



    avfilter_start_frame(link->dst->outputs[0], ref2);

}
static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)

{

    AVFilterContext *ctx = link->dst;

    CropContext *crop = ctx->priv;

    AVFilterBufferRef *ref2;

    int i;



    picref->video->w = crop->w;

    picref->video->h = crop->h;



    ref2 = avfilter_ref_buffer(picref, ~0);



    crop->var_values[VAR_T] = picref->pts == AV_NOPTS_VALUE ?

        NAN : picref->pts * av_q2d(link->time_base);

    crop->var_values[VAR_POS] = picref->pos == -1 ? NAN : picref->pos;

    crop->var_values[VAR_X] = av_expr_eval(crop->x_pexpr, crop->var_values, NULL);

    crop->var_values[VAR_Y] = av_expr_eval(crop->y_pexpr, crop->var_values, NULL);

    crop->var_values[VAR_X] = av_expr_eval(crop->x_pexpr, crop->var_values, NULL);



    normalize_double(&crop->x, crop->var_values[VAR_X]);

    normalize_double(&crop->y, crop->var_values[VAR_Y]);



    if (crop->x < 0) crop->x = 0;

    if (crop->y < 0) crop->y = 0;

    if ((unsigned)crop->x + (unsigned)crop->w > link->w) crop->x = link->w - crop->w;

    if ((unsigned)crop->y + (unsigned)crop->h > link->h) crop->y = link->h - crop->h;

    crop->x &= ~((1 << crop->hsub) - 1);

    crop->y &= ~((1 << crop->vsub) - 1);




    av_log(ctx, AV_LOG_DEBUG,

           "n:%d t:%f x:%d y:%d x+w:%d y+h:%d\n",

           (int)crop->var_values[VAR_N], crop->var_values[VAR_T], crop->x, crop->y, crop->x+crop->w, crop->y+crop->h);




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

    ref2->data[0] += crop->x * crop->max_step[0];



    if (!(av_pix_fmt_descriptors[link->format].flags & PIX_FMT_PAL)) {

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

            if (ref2->data[i]) {

                ref2->data[i] += (crop->y >> crop->vsub) * ref2->linesize[i];

                ref2->data[i] += (crop->x * crop->max_step[i]) >> crop->hsub;

            }

        }

    }



    

    if (ref2->data[3]) {

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

        ref2->data[3] += crop->x * crop->max_step[3];

    }



    avfilter_start_frame(link->dst->outputs[0], ref2);

}
static void FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1)

{

    AVFilterContext *ctx = VAR_0->dst;

    CropContext *crop = ctx->priv;

    AVFilterBufferRef *ref2;

    int VAR_2;



    VAR_1->video->w = crop->w;

    VAR_1->video->h = crop->h;



    ref2 = avfilter_ref_buffer(VAR_1, ~0);



    crop->var_values[VAR_T] = VAR_1->pts == AV_NOPTS_VALUE ?

        NAN : VAR_1->pts * av_q2d(VAR_0->time_base);

    crop->var_values[VAR_POS] = VAR_1->pos == -1 ? NAN : VAR_1->pos;

    crop->var_values[VAR_X] = av_expr_eval(crop->x_pexpr, crop->var_values, NULL);

    crop->var_values[VAR_Y] = av_expr_eval(crop->y_pexpr, crop->var_values, NULL);

    crop->var_values[VAR_X] = av_expr_eval(crop->x_pexpr, crop->var_values, NULL);



    normalize_double(&crop->x, crop->var_values[VAR_X]);

    normalize_double(&crop->y, crop->var_values[VAR_Y]);



    if (crop->x < 0) crop->x = 0;

    if (crop->y < 0) crop->y = 0;

    if ((unsigned)crop->x + (unsigned)crop->w > VAR_0->w) crop->x = VAR_0->w - crop->w;

    if ((unsigned)crop->y + (unsigned)crop->h > VAR_0->h) crop->y = VAR_0->h - crop->h;

    crop->x &= ~((1 << crop->hsub) - 1);

    crop->y &= ~((1 << crop->vsub) - 1);




    av_log(ctx, AV_LOG_DEBUG,

           "n:%d t:%f x:%d y:%d x+w:%d y+h:%d\n",

           (int)crop->var_values[VAR_N], crop->var_values[VAR_T], crop->x, crop->y, crop->x+crop->w, crop->y+crop->h);




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

    ref2->data[0] += crop->x * crop->max_step[0];



    if (!(av_pix_fmt_descriptors[VAR_0->format].flags & PIX_FMT_PAL)) {

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

            if (ref2->data[VAR_2]) {

                ref2->data[VAR_2] += (crop->y >> crop->vsub) * ref2->linesize[VAR_2];

                ref2->data[VAR_2] += (crop->x * crop->max_step[VAR_2]) >> crop->hsub;

            }

        }

    }



    

    if (ref2->data[3]) {

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

        ref2->data[3] += crop->x * crop->max_step[3];

    }



    avfilter_start_frame(VAR_0->dst->outputs[0], ref2);

}
static void FUNC_0(AVFilterLink *VAR_0, AVFilterBufferRef *VAR_1)
{ AVFilterContext *ctx = VAR_0->dst; CropContext *crop = ctx->priv; AVFilterBufferRef *ref2; int VAR_2; VAR_1->video->w = crop->w; VAR_1->video->h = crop->h; ref2 = avfilter_ref_buffer(VAR_1, ~0); crop->var_values[VAR_T] = VAR_1->pts == AV_NOPTS_VALUE ?
NAN : VAR_1->pts * av_q2d(VAR_0->time_base); crop->var_values[VAR_POS] = VAR_1->pos == -1 ? NAN : VAR_1->pos; crop->var_values[VAR_X] = av_expr_eval(crop->x_pexpr, crop->var_values, NULL); crop->var_values[VAR_Y] = av_expr_eval(crop->y_pexpr, crop->var_values, NULL); crop->var_values[VAR_X] = av_expr_eval(crop->x_pexpr, crop->var_values, NULL); normalize_double(&crop->x, crop->var_values[VAR_X]); normalize_double(&crop->y, crop->var_values[VAR_Y]); if (crop->x < 0) crop->x = 0; if (crop->y < 0) crop->y = 0; if ((unsigned)crop->x + (unsigned)crop->w > VAR_0->w) crop->x = VAR_0->w - crop->w; if ((unsigned)crop->y + (unsigned)crop->h > VAR_0->h) crop->y = VAR_0->h - crop->h; crop->x &= ~((1 << crop->hsub) - 1); crop->y &= ~((1 << crop->vsub) - 1); av_log(ctx, AV_LOG_DEBUG,
"n:%d t:%f x:%d y:%d x+w:%d y+h:%d\n",
(int)crop->var_values[VAR_N], crop->var_values[VAR_T], crop->x, crop->y, crop->x+crop->w, crop->y+crop->h); ref2->data[0] += crop->y * ref2->linesize[0]; ref2->data[0] += crop->x * crop->max_step[0]; if (!(av_pix_fmt_descriptors[VAR_0->format].flags & PIX_FMT_PAL)) { for (VAR_2 = 1; VAR_2 < 3; VAR_2 ++) { if (ref2->data[VAR_2]) { ref2->data[VAR_2] += (crop->y >> crop->vsub) * ref2->linesize[VAR_2]; ref2->data[VAR_2] += (crop->x * crop->max_step[VAR_2]) >> crop->hsub; } } } if (ref2->data[3]) { ref2->data[3] += crop->y * ref2->linesize[3]; ref2->data[3] += crop->x * crop->max_step[3]; } avfilter_start_frame(VAR_0->dst->outputs[0], ref2); }