[FFmpeg-devel] [PATCH 2/2] Add hflip filter.

Michael Niedermayer michaelni
Mon Aug 16 16:44:57 CEST 2010


On Thu, Aug 12, 2010 at 06:39:51PM +0200, Stefano Sabatini wrote:
> On date Wednesday 2010-08-04 14:23:49 +0200, Michael Niedermayer encoded:
> > On Sat, Jul 31, 2010 at 02:07:29AM +0200, Stefano Sabatini wrote:
> [...]
> > > +static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
> > > +{
> > > +    FlipContext *flip = inlink->dst->priv;
> > > +    AVFilterPicRef *inpic  = inlink->cur_pic;
> > > +    AVFilterPicRef *outpic = inlink->dst->outputs[0]->outpic;
> > > +    uint8_t *inrow, *outrow;
> > > +    int i, j, plane, step, hsub, vsub;
> > > +
> > > +    for (plane = 0; plane < 4 && inpic->data[plane]; plane++) {
> > > +        step = flip->max_step[plane];
> > > +        hsub = (plane == 1 || plane == 2) ? flip->hsub : 0;
> > > +        vsub = (plane == 1 || plane == 2) ? flip->vsub : 0;
> > > +
> > > +        outrow = outpic->data[plane] + (y>>vsub) * outpic->linesize[plane];
> > > +        inrow  = inpic ->data[plane] + (y>>vsub) * inpic ->linesize[plane] + ((inlink->w >> hsub) - 1) * step;
> > > +        for (i = 0; i < h>>vsub; i++) {
> > > +            for (j = 0; j < (inlink->w >> hsub); j++)
> > > +                memcpy(outrow + j*step, inrow - j*step, step);
> > 
> > variable length memcpy on a per pixel base is slow
> 
> Updated.
> 
> I didn't manage to understand how bswap/dsputils may be used, I don't
> know if that would improve it.
> 
> Regards.
> -- 
> FFmpeg = Frightening and Friendly Mere Pure Erroneous Gargoyle

>  doc/filters.texi         |   10 ++
>  libavfilter/Makefile     |    1 
>  libavfilter/allfilters.c |    1 
>  libavfilter/vf_hflip.c   |  168 +++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 180 insertions(+)
> b091322eaa37c5570cfb630bd37f578508eea926  0001-Add-hflip-filter.patch
> From 96b7efa03da48278d6128441fccea482fd414077 Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Sat, 31 Jul 2010 02:05:27 +0200
> Subject: [PATCH 1/1] Add hflip filter.

should be ok

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100816/1a2e2fef/attachment.pgp>



More information about the ffmpeg-devel mailing list