static int end_frame(AVFilterLink *inlink)
{
    AVFilterContext *ctx  = inlink->dst;
    TileContext *tile    = ctx->priv;

    avfilter_unref_bufferp(&inlink->cur_buf);
    if (++tile->current == tile->nb_frames)
        end_last_frame(ctx);
    return 0;
}