[FFmpeg-devel] [PATCH] Add crop filter

Stefano Sabatini stefano.sabatini-lala
Wed Oct 21 22:59:11 CEST 2009


On date Wednesday 2009-10-21 22:32:03 +0200, Stefano Sabatini encoded:
> On date Wednesday 2009-10-21 14:56:21 +0200, Michael Niedermayer encoded:
> > On Wed, Oct 21, 2009 at 12:51:42AM +0200, Stefano Sabatini wrote:
> > > On date Tuesday 2009-10-20 01:14:20 +0200, Michael Niedermayer encoded:
> > > > On Mon, Oct 19, 2009 at 11:50:08PM +0200, Stefano Sabatini wrote:
> > > > > On date Friday 2009-10-16 12:49:33 +0200, Michael Niedermayer encoded:
> > > > > > On Fri, Oct 16, 2009 at 12:34:07AM +0200, Stefano Sabatini wrote:
> > > > [...]
> > > > > > > +        round_hsub = crop->hsub;
> > > > > > > +        round_vsub = crop->vsub;
> > > > > > > +    }
> > > > > > > +
> > > > > > > +    crop->x &= ~((1 << round_hsub) - 1);
> > > > > > > +    crop->y &= ~((1 << round_vsub) - 1);
> > > > > > 
> > > > > > > +    crop->w &= ~((1 << round_hsub) - 1);
> > > > > > > +    crop->h &= ~((1 << round_vsub) - 1);
> > > > > > 
> > > > > > i dont think these are needed
> > > > > 
> > > > > How so?
> > > > 
> > > > ffmpeg should support all videos, even ones with odd with or height,
> > > > they arent common but they do exist out there.
> > > 
> > > Patch updated with other minor fixes.
> > 
> > [...]
> > > +static int query_formats(AVFilterContext *ctx)
> > > +{
> > > +    enum PixelFormat pix_fmts[] = {
> > 
> > static const
> > 
> > looks ok except that given it has been tested extensively
> > for example no slowdown if multiple crop filters are added in a row in
> > any filter chain
> 
> test-chain.pl -f "null,crop" -n 20 ^/dev/null | grep "^bench" | nl -n ln
> 1     	bench: utime=3.308s
> 2     	bench: utime=3.332s
> 3     	bench: utime=3.332s
> 4     	bench: utime=3.292s
> 5     	bench: utime=3.288s
> 6     	bench: utime=3.308s
> 7     	bench: utime=3.372s
> 8     	bench: utime=3.424s
> 9     	bench: utime=3.628s
> 10    	bench: utime=3.944s
> 11    	bench: utime=4.692s
> 12    	bench: utime=6.508s
> 13    	bench: utime=14.793s
> 14    	bench: utime=33.618s
> 
> At each iteration the -f argument for the script is duplicated, then
> with more than 2^14=16384 filters something funny happens and the
> script exits.
> 
> I'm going to apply it soon.

Applied.
-- 
FFmpeg = Free and Fostering Mere Powerful Epic Game



More information about the ffmpeg-devel mailing list