[FFmpeg-devel] [PATCH] Add pad filter

Michael Niedermayer michaelni
Mon Nov 23 08:16:53 CET 2009


On Sun, Nov 22, 2009 at 04:34:13PM +0100, Stefano Sabatini wrote:
> On date Monday 2009-11-09 00:39:26 +0100, Michael Niedermayer encoded:
> > On Sun, Nov 08, 2009 at 09:50:13PM +0100, Stefano Sabatini wrote:
> > > Hi,
> > > 
> > > this patch is not still ready for review, it is what I have in my
> > > working tree, I'm publishing here as backup and for requesting some
> > > comments.
> > > 
> > > TODO:
> > > * remove normalizations
> > > * add support for packed formats
> > > 
> > > What I like to be reviewed is the syntax, is OK to use
> > > parseutils+expressions or it would be better just a simple:
> > > 
> > > w:h:x:y:color
> > 
> > iam strongly in favor of the simplest thing possible so as not to hold
> > the patch application up
> 
> sscanf + positional parameters, I'm not using expressions for now.
> 
> > > I believe expressions boost the filter flexibility, but I'll drop
> > > their support if this will help to get the filter integrated sooner.
> > 
> > i agree that expressions are a great thing that we definitly should support
> > but i dont think the inital commit should
> 
> New patch attached.
> 
> I added support for RGB32 and RGB24 formats, it works fine but it
> looks like the memcpy are quite slow, maybe someone can suggest how to
> make them faster.

make a full line of the color and copy from that


[...]
> +static int config_input(AVFilterLink *inlink)
> +{
> +    AVFilterContext *ctx = inlink->dst;
> +    PadContext *pad = ctx->priv;
> +    uint8_t ridx, gidx, bidx, aidx;
> +    uint8_t rgba_color[4];
> +

> +    switch (inlink->format) {
> +    case PIX_FMT_ARGB:
> +        aidx = 0; ridx = 1; gidx = 2; bidx = 3;
> +        pad->pix_step = 4;
> +        pad->is_packed_rgb = 1;
> +        break;
> +
> +    case PIX_FMT_RGBA:
> +        ridx = 0; gidx = 1; bidx = 2; aidx = 3;
> +        pad->pix_step = 4;
> +        pad->is_packed_rgb = 1;
> +        break;
> +
> +    case PIX_FMT_ABGR:
> +        aidx = 0; bidx = 1; gidx = 2; ridx = 3;
> +        pad->pix_step = 4;
> +        pad->is_packed_rgb = 1;
> +        break;
> +
> +    case PIX_FMT_BGRA:
> +        bidx = 0; gidx = 1; ridx = 2; aidx = 3;
> +        pad->pix_step = 4;
> +        pad->is_packed_rgb = 1;
> +        break;
> +
> +    case PIX_FMT_RGB24:
> +        ridx = 0; gidx = 1; bidx = 2; aidx = 3;
> +        pad->pix_step = 3;
> +        pad->is_packed_rgb = 1;
> +        break;
> +
> +    case PIX_FMT_BGR24:
> +        bidx = 0; gidx = 1; ridx = 2; aidx = 3;
> +        pad->pix_step = 3;
> +        pad->is_packed_rgb = 1;
> +        break;
> +
> +    default:
> +        pad->pix_step = 1;
> +        break;
> +    }

iam pretty sure this can be done more compactly


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

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091123/99cd49db/attachment.pgp>



More information about the ffmpeg-devel mailing list