static int config_input(AVFilterLink *inlink)
{
    IlContext *il = inlink->dst->priv;
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
    int bpp = av_get_padded_bits_per_pixel(desc) >> 3;
    int bytes = FFALIGN(desc->comp[0].depth_minus1 + 1, 8) / 8;
    int i;

    for (i = 0; i < desc->nb_components; i++)
        il->nb_planes = FFMAX(il->nb_planes, desc->comp[i].plane);
    il->nb_planes++;

    il->chroma_height = inlink->h >> desc->log2_chroma_h;
    il->chroma_width  = (inlink->w >> desc->log2_chroma_w) * bytes;
    il->width         = inlink->w * bytes;
    if (!(desc->flags & PIX_FMT_PLANAR))
        il->width *= bpp;

    return 0;
}