[FFmpeg-devel] [PATCH] Add crop filter

Stefano Sabatini stefano.sabatini-lala
Tue Oct 13 20:47:09 CEST 2009


On date Tuesday 2009-10-13 13:16:29 +0200, Michael Niedermayer encoded:
> On Mon, Oct 12, 2009 at 08:41:08PM +0200, Stefano Sabatini wrote:
> > On date Monday 2009-10-12 09:28:29 +0200, Michael Niedermayer encoded:
[...]
> > > mess
> > > 
> > > if(   crop->x < 0 || crop->y < 0 || crop->w < 0 || crop->h < 0
> > >    || (unsigned)crop->x + (unsigned)crop->w > link->w
> > >    || (unsigned)crop->y + (unsigned)crop->h > link->h)
> > 
> > Bah, this is missing even the original filter facility (size == 0 ->
> > size = max allowed)
> 
> not at all, it just verifies that the values are correct, a size of 0
> is not.
> the user parameter of 0 must be changed to size before this of course
> its your twisted code that tried to check validity before calculating the
> values that are being checked
> 
> > and doesn't provide any hints about what the user
> > is doing wrong in that case (just a laconic: somethin's wrong).
> 
> you can split that check if you think it makes sense
>
> > 
> > So specify which semantics you want implemented, that's clearly not
> > what I documented in the texi file.
> 
> Iam trying to get the filters into svn and for that keeping things simple
> and discussing extensions seperately is likely a good idea, that said i
> dont mind the =0 case

Added support for 0 -> max, removed all the other stuff.

[...]
> > The alternative I get is less readable though:
> > 
> >     ref2->data[0] += (crop->y * ref2->linesize[0]);
> >     if (link->format == PIX_FMT_MONOWHITE || PIX_FMT_MONOBLACK)
> >         ref2->data[0] += (crop->x >> 3);
> >     else
> >         ref2->data[0] += crop->x * crop->bpp;
> 
> ref2->data[0] += (crop->x * crop->bpp)>>3;

Slightly factorized using a parametric s[hift] param, tested with make
lavfitest and with monow/monob bitstreams.

Regards.
-- 
FFmpeg = Faboulous Faboulous Mastodontic Pure Extreme Gadget
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-crop-filter.patch
Type: text/x-diff
Size: 8220 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091013/81ddca15/attachment.patch>



More information about the ffmpeg-devel mailing list