[FFmpeg-devel] [PATCH] Add scale filter

Stefano Sabatini stefano.sabatini-lala
Wed Oct 28 23:00:33 CET 2009


On date Wednesday 2009-10-28 18:15:08 +0100, Diego Biurrun encoded:
> On Wed, Oct 28, 2009 at 12:42:43AM +0100, Stefano Sabatini wrote:
> > 
> > --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> > +++ ffmpeg/libavfilter/vf_scale.c	2009-10-28 00:39:51.000000000 +0100
> > @@ -0,0 +1,199 @@
> > +
> > +/**
> > + * @file libavfilter/vf_scale.c
> > + * video scale filter
> 
> video filter
> 
> > +    int hsub, vsub;             ///< chroma subsampling
> > +    int slice_y;                ///< top of current output slice
> > +    int slice_dir;              ///< the detected slice direction order for the current frame
> 
> s/the//
> 
> > +    /* sanity check parms */
> 
> parAms
> 
> > +    if (scale->w <  -1 || scale->h <  -1) {
> > +        av_log(ctx, AV_LOG_ERROR, "Value for size less than -1 is not acceptable\n");
> 
> Size values less than -1 are not acceptable.
> 
> > +    if (w == -1)
> > +        w = scale->h*link->src->inputs[0]->w/link->src->inputs[0]->h;
> > +    if (h == -1)
> > +        h = scale->w*link->src->inputs[0]->h/link->src->inputs[0]->w;
> 
> I think spaces around * and / would make this more readable.  At a first
> glance I missed these operators.

Yes.
 
> > --- ffmpeg.orig/doc/libavfilter.texi	2009-10-27 21:13:14.000000000 +0100
> > +++ ffmpeg/doc/libavfilter.texi	2009-10-27 23:17:40.000000000 +0100
> > @@ -149,6 +149,29 @@
> >  
> > +If ``width'' or ``height'' is 0, the corresponding input size is
> > +used.
> 
> Maybe I'm dumb, but I dunno which size corresponds in this case.

Check again, the new expression still sounds awkward to me.
 
> > --- ffmpeg.orig/libavfilter/allfilters.c	2009-10-27 20:53:12.000000000 +0100
> > +++ ffmpeg/libavfilter/allfilters.c	2009-10-27 23:17:40.000000000 +0100
> > @@ -39,4 +39,5 @@
> >      REGISTER_FILTER (NOFORMAT,noformat,vf);
> >      REGISTER_FILTER (NULL,null,vf);
> >      REGISTER_FILTER (VFLIP,vflip,vf);
> > +    REGISTER_FILTER (SCALE,scale,vf);
> 
> Ahem...

Fixed.
-- 
FFmpeg = Foolish & Faithless Multipurpose Puritan Erudite Generator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add-scale-filter.patch
Type: text/x-diff
Size: 9039 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091028/9c8aee1f/attachment.patch>



More information about the ffmpeg-devel mailing list