[FFmpeg-devel] [PATCH] avfilter: add mergeplanes

Michael Niedermayer michaelni at gmx.at
Fri Oct 11 13:02:48 CEST 2013


On Mon, Oct 07, 2013 at 08:52:56AM +0000, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
[...]
> +}
> +
> +static int filter_frame(AVFilterLink *inlink, AVFrame *in)
> +{
> +    MergePlanesContext *s = inlink->dst->priv;
> +    return ff_framesync_filter_frame(&s->fs, inlink, in);
> +}
> +
> +static av_cold int init(AVFilterContext *ctx)
> +{
> +    MergePlanesContext *s = ctx->priv;
> +    enum AVPixelFormat gray;
> +    int i, ret, is_16, is_be;
> +
> +    s->outdesc = av_pix_fmt_desc_get(s->out_fmt);
> +    if (!(s->outdesc->flags & AV_PIX_FMT_FLAG_PLANAR)) {
> +        av_log(ctx, AV_LOG_ERROR, "Only planar formats are supported.\n");
> +        return AVERROR(EINVAL);
> +    }
> +
> +    is_16 = s->outdesc->comp[0].depth_minus1 == 15;
> +    is_be = s->outdesc->flags & AV_PIX_FMT_FLAG_BE;

> +    gray  = is_16 ? is_be ? AV_PIX_FMT_GRAY16BE : AV_PIX_FMT_GRAY16LE : AV_PIX_FMT_GRAY8;

this might be more readable with a ()

also you could support any planar input and just use the first N
planes, that is for example with 4 inputs and yuva444p as output
and yuv420 inputs, the 4 y planes could end up being used for the
yuva planes
also if you implement above it should then be easy to add support
for the user to specify which planes of the inputs to use exactly


the rest of the patch looks reasonable from a quick look
i didnt test as it doesnt build (missing framesync patches on my
side i assume)


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131011/be075e04/attachment.asc>


More information about the ffmpeg-devel mailing list