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

Vitor Sessak vitor1001 at gmail.com
Wed Jan 9 20:47:17 CET 2008


Hi

Bobby Bingham wrote:
> On Mon, 07 Jan 2008 22:17:22 +0100
> Vitor Sessak <vitor1001 at gmail.com> wrote:
>> 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?

The only other possible solution I can think of would be to do a filter 
that calls the filter chain the same way ffplay.c does... It's a lot of 
code to get little work done, so maybe it's not worth the trouble. 
Unless, maybe, if we create a pseudo_filters.c file and put every 
pseudo-filter there (and reusing the complicated code). But I'm not 
really sure of the better way to implement this...

-Vitor



More information about the FFmpeg-soc mailing list