[FFmpeg-devel] [PATCH] Add pad filter

Stefano Sabatini stefano.sabatini-lala
Fri Nov 27 01:09:28 CET 2009


On date Monday 2009-11-23 08:16:53 +0100, Michael Niedermayer encoded:
> On Sun, Nov 22, 2009 at 04:34:13PM +0100, Stefano Sabatini wrote:
[...]
> > 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

Yes.
 
> [...]
> > +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

Yes.

Regards.
-- 
FFmpeg = Fantastic and Faboulous Mean Philosofic Exciting God
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-pad-filter.patch
Type: text/x-diff
Size: 14503 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091127/446e4caf/attachment.patch>



More information about the ffmpeg-devel mailing list