[FFmpeg-devel] [PATCH] Add crop filter
Stefano Sabatini
stefano.sabatini-lala
Sun Oct 11 21:40:40 CEST 2009
On date Saturday 2009-10-10 01:51:39 +0200, Michael Niedermayer encoded:
> On Wed, Oct 07, 2009 at 11:50:19PM +0200, Stefano Sabatini wrote:
> > On date Tuesday 2009-10-06 15:01:32 +0200, Michael Niedermayer encoded:
> > > On Tue, Oct 06, 2009 at 12:58:41AM +0200, Stefano Sabatini wrote:
> [...]
> > +static int norm_offset(int x, int max)
> > +{
> > + if (x < 0)
> > + x = max + x;
> > + return av_clip(x, 0, max-1);
> > +}
>
> using max before its validated and cliped like that does not work
> anyway, iam not sure all that cliping is a good idea, i would just
> tell the user that his parameters are partly beyond the input image
> dimensions and that she should fix that.
Maybe fixed.
> [...]
> > +static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
> > +{
> > + CropContext *crop = link->dst->priv;
> > + AVFilterPicRef *ref2 = avfilter_ref_pic(picref, ~0);
> > + int i;
> > +
> > + ref2->w = crop->w;
> > + ref2->h = crop->h;
> > + ref2->data[0] += crop->y * ref2->linesize[0];
> > + ref2->data[0] += crop->x * crop->bpp;
> > +
> > + for (i = 1; i < 4; i ++) {
> > + if (ref2->data[i]) {
> > + ref2->data[i] += (crop->y >> crop->vsub) * ref2->linesize[i];
> > + ref2->data[i] += crop->x >> crop->hsub;
> > + }
> > + }
>
> fails for paletted formats
Added support for that (tested with the only pal8 sample I found:
avi/palette_change/toon.avi) and for monow/monob.
Regards.
--
FFmpeg = Forgiving and Friendly Mean Patchable Extreme God
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-crop-filter.patch
Type: text/x-diff
Size: 8847 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091011/fe833ee2/attachment.patch>
More information about the ffmpeg-devel
mailing list