[FFmpeg-soc] [soc]: r1794 - in libavfilter: Makefile allfilters.h avfilter.c vf_rotate.c

Bobby Bingham uhmmmm at gmail.com
Mon Jan 7 23:07:38 CET 2008


On Mon, 07 Jan 2008 22:17:22 +0100
Vitor Sessak <vitor1001 at gmail.com> wrote:

> Hi
> 
> Michael Niedermayer wrote:
> > On Mon, Jan 07, 2008 at 09:24:51PM +0100, Michael Niedermayer wrote:
> >> On Mon, Jan 07, 2008 at 08:13:39PM +0100, vitor wrote:
> >>> Author: vitor
> >>> Date: Mon Jan  7 20:13:38 2008
> >>> New Revision: 1794
> >>>
> >>> Log:
> >>> Rotation filter
> >> [...]
> >>> +/**
> >>> + * @file vf_rotate.c
> >>> + * rotation filter
> >>> + *
> >>> + * @todo Copy code from rotozoom.c to remove use of
> >>> floating-point
> >>> + * @todo Handle packed pixel formats
> >>> + * @todo Make backcolor configurable
> >>> +*/
> >> @todo: fast 90° increment rot filter (unless this code is as fast)
> 
> I agree completely. Actually, I want to rename this filter later to 
> rotate_slow and create a filter named "rotate" that would be just a 
> dummy filter, with a code like
> 
> switch(ang%360) {
> case 0:
> 	filter = "dummy";
> 	break;
> case 90:
> 	//vflip changes only linesize, so it's very fast
> 	filter = "vflip,transpose"
> 	break;
> case 180:
> 	filter = "hflip,vflip"
> 	break;
> case 270:
> 	filter = "transpose,vflip"
> 	break;
> else:
> 	sprintf(filter,"rotate_slow=%i",ang);
> 	break;
> }
> 
> filter_frame(filter);
> 
> It avoids duplicating the transpose and hflip code.
> 
> I think also it would be particularly nice also to serve as a
> template for other future pseudo-filters like crop_or_pad_to_size.
> I've tried to do that using code from avfiltergraph.c, but it's
> pretty complex... Bobby, do you have an idea about it?

One way that'd be pretty easy I think, but might too hackish, is
something like this:

extern AVFilter avfilter_vf_graphdesc;

static int init(AVFilterContext *ctx, ...)
{
    int ret;
    char *filters;

    // switch statement you wrote to set filters

    ctx->filter = &avfilter_vf_graph;
    ctx->priv   = av_mallocz(sizeof(ctx->filter->priv_size));
    ret = ctx->filter->init(ctx, filters, NULL);

    av_free(filters);
    return ret;
}

This essentially changes the filter into a filter graph during
initialization.  I don't see any reason it shouldn't work, but like I
said, maybe it's too much of a hack.  Maybe similar functionality can
be exposed more cleanly?

> 
> >> @todo: port libmpcodecs/vf_perspective.c, which can trivially
> >>        be extended to do just rotations, making this filter
> >> redundant
> > 
> > and you can copy and paste anything from vf_perspective.c under
> > LGPL!
> 
> I'll have a look.
> 
> > And loose the floats in the inner loop of vf_rotate.c. Unless they
> > are significantly faster.
> 
> See my first TODO. I want to remove float usage completely.
> 
> -Vitor
> 
> PS: don't forget to have a look at the ffmpeg.c integration question. 
> It's a show-stopper for svn...

Right.  Will do.

-- 
Bobby Bingham
Never trust atoms.  Or anything made of atoms.
このメールは再利用されたバイトでできている。



More information about the FFmpeg-soc mailing list