[FFmpeg-devel] [PATCH] lavfi/unsharp: add check on matrix x/y size values oddity

Stefano Sabatini stefasab at gmail.com
Sun Feb 17 11:57:04 CET 2013


On date Saturday 2013-02-16 10:48:09 +0100, Nicolas George encoded:
> Le septidi 27 pluviôse, an CCXXI, Stefano Sabatini a écrit :
> > TODO: bump micro
> > ---
> >  doc/filters.texi         |    6 +++---
> >  libavfilter/vf_unsharp.c |   20 +++++++++++++++++---
> >  2 files changed, 20 insertions(+), 6 deletions(-)
> > 
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index d2f2b2e..1527a32 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -4926,13 +4926,13 @@ A description of the accepted options follows.
> >  @table @option
> >  @item luma_msize_x, lx
> >  @item chroma_msize_x, cx
> > -Set the luma/chroma matrix horizontal size. It can be an integer
> > +Set the luma/chroma matrix horizontal size. It must be an odd integer
> >  between 3 and 63, default value is 5.
> >  
> >  @item luma_msize_y, ly
> >  @item chroma_msize_y, cy
> > -Set the luma/chroma matrix vertical size. It can be an integer between
> > -3 and 63, default value is 5.
> > +Set the luma/chroma matrix vertical size. It must be an odd integer
> > +between 3 and 63, default value is 5.
> >  
> >  @item luma_amount, la
> >  @item chroma_amount, ca
> > diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c
> > index 9fd0588..867e2a0 100644
> > --- a/libavfilter/vf_unsharp.c
> > +++ b/libavfilter/vf_unsharp.c
> > @@ -195,11 +195,18 @@ static int query_formats(AVFilterContext *ctx)
> >      return 0;
> >  }
> >  
> > -static void init_filter_param(AVFilterContext *ctx, FilterParam *fp, const char *effect_type, int width)
> > +static int init_filter_param(AVFilterContext *ctx, FilterParam *fp, const char *effect_type, int width)
> >  {
> >      int z;
> >      const char *effect;
> >  
> > +    if (!(fp->msize_x & 1) || !(fp->msize_y & 1)) {
> 
> It could be written if (!(fp->msize_x & fp->msize_y & 1)).
> 
> > +        av_log(ctx, AV_LOG_ERROR,
> > +               "Invalid even size for %s matrix size x value '%d' or y value '%d'\n",
> > +               effect_type, fp->msize_x, fp->msize_y);
> 
> "Invalid even size for %s matrix size %d x %d\n" ?
[...] 
> LGTM, thanks.

Applied with the suggested changes, thanks.
-- 
FFmpeg = Faithless and Fanciful Muttering Puristic Ephemeral Guru


More information about the ffmpeg-devel mailing list