[FFmpeg-devel] [PATCH] vf_unsharp: provide better names for the MIN/MAX_SIZE macros

Stefano Sabatini stefasab at gmail.com
Mon Feb 6 15:29:33 CET 2012


On date Sunday 2011-08-14 16:26:56 +0200, Stefano Sabatini encoded:
> On date Sunday 2011-08-14 14:28:32 +0200, Michael Niedermayer encoded:
> > On Sun, Aug 14, 2011 at 02:22:24PM +0200, Michael Niedermayer wrote:
> > > On Sat, Aug 13, 2011 at 01:11:42AM +0200, Stefano Sabatini wrote:
> > > > ---
> > > >  libavfilter/vf_unsharp.c |    9 +++++----
> > > >  1 files changed, 5 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c
> > > > index b770437..e41e76f 100644
> > > > --- a/libavfilter/vf_unsharp.c
> > > > +++ b/libavfilter/vf_unsharp.c
> > > > @@ -41,8 +41,9 @@
> > > >  #include "libavutil/mem.h"
> > > >  #include "libavutil/pixdesc.h"
> > > >  
> > > > -#define MIN_SIZE 3
> > > > -#define MAX_SIZE 13
> > > > +#define MATRIX_MIN_LINE_SIZE 3
> > > > +#define MATRIX_MAX_LINE_SIZE 13
> > > > +#define MATRIX_MAX_SIZE (MATRIX_MAX_LINE_SIZE * MATRIX_MAX_LINE_SIZE)
> > > >
> > > >  /* right-shift and round-up */
> > > >  #define UPSHIFT(x,shift) (-((-(x))>>(shift)))
> > > > @@ -55,7 +56,7 @@ typedef struct FilterParam {
> > > >      int steps_y;                             ///< vertical step count
> > > >      int scalebits;                           ///< bits to shift pixel
> > > >      int32_t halfscale;                       ///< amount to add to pixel
> > > > -    uint32_t *sc[(MAX_SIZE * MAX_SIZE) - 1]; ///< finite state machine storage
> > > > +    uint32_t *sc[MATRIX_MAX_SIZE - 1]; ///< finite state machine storage
> > > >  } FilterParam;
> > > >  
> > > >  typedef struct {
> > > 
> > > > @@ -69,7 +70,7 @@ static void apply_unsharp(      uint8_t *dst, int dst_stride,
> > > >                            int width, int height, FilterParam *fp)
> > > >  {
> > > >      uint32_t **sc = fp->sc;
> > > > -    uint32_t sr[(MAX_SIZE * MAX_SIZE) - 1], tmp1, tmp2;
> > > > +    uint32_t sr[MATRIX_MAX_SIZE - 1], tmp1, tmp2;
> > > 
> 
> > > The original code in libmpcodecs makes more sense to me then both the
> > > before and afterwards of this patch.
> > > why was this ever changed to MAX_SIZE * MAX_SIZE ?
> 
> Agree.

Updated.
-- 
FFmpeg = Faithless & Fabulous Martial Perennial Enlightened Gadget
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-vf_unsharp-use-the-same-macros-used-in-the-original-.patch
Type: text/x-diff
Size: 2630 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120206/474a7632/attachment.bin>


More information about the ffmpeg-devel mailing list