[FFmpeg-devel] [PATCH 1/3] lavu: add ROUNDED_RSHIFT and use it in various places.

Clément Bœsch ubitux at gmail.com
Wed May 8 16:20:45 CEST 2013


On Tue, May 07, 2013 at 05:50:27PM +0200, Michael Niedermayer wrote:
> On Tue, May 07, 2013 at 05:38:46PM +0200, Clément Bœsch wrote:
> > On Tue, May 07, 2013 at 05:13:44PM +0200, Michael Niedermayer wrote:
> > > On Tue, May 07, 2013 at 04:39:31PM +0200, Clément Bœsch wrote:
> > > > ---
> > > >  libavcodec/ffv1dec.c              |  4 ++--
> > > >  libavcodec/ffv1enc.c              |  4 ++--
> > > >  libavcodec/mimic.c                |  4 ++--
> > > >  libavcodec/mjpegdec.c             |  4 ++--
> > > >  libavcodec/snow.c                 |  4 ++--
> > > >  libavcodec/utils.c                | 13 +++++++------
> > > >  libavfilter/deshake_opencl.c      |  3 ++-
> > > >  libavfilter/vf_gradfun.c          |  4 ++--
> > > >  libavfilter/vf_tinterlace.c       |  2 +-
> > > >  libavutil/common.h                |  2 ++
> > > >  libavutil/frame.c                 |  2 +-
> > > >  libavutil/imgutils.c              |  2 +-
> > > >  libswscale/rgb2rgb_template.c     |  8 ++++----
> > > >  libswscale/swscale.c              |  6 +++---
> > > >  libswscale/swscale_unscaled.c     |  6 +++---
> > > >  libswscale/utils.c                | 10 +++++-----
> > > >  libswscale/x86/rgb2rgb_template.c |  8 ++++----
> > > >  17 files changed, 45 insertions(+), 41 deletions(-)
> > > > 
> > > > diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
> > > > index adc47be..2a9aac2 100644
> > > > --- a/libavcodec/ffv1dec.c
> > > > +++ b/libavcodec/ffv1dec.c
> > > > @@ -357,8 +357,8 @@ static int decode_slice(AVCodecContext *c, void *arg)
> > > >  
> > > >      av_assert1(width && height);
> > > >      if (f->colorspace == 0) {
> > > > -        const int chroma_width  = -((-width) >> f->chroma_h_shift);
> > > > -        const int chroma_height = -((-height) >> f->chroma_v_shift);
> > > > +        const int chroma_width  = ROUNDED_RSHIFT(width,  f->chroma_h_shift);
> > > > +        const int chroma_height = ROUNDED_RSHIFT(height, f->chroma_v_shift);
> > > 
> > > the operation is not a rounded (to nearest) shift but a
> > > shift with rounding to +infinity
> > > 
> > 
> > I'm not sure to understand; are you suggesting a macro rename? Not using
> > it in that particular place?
> 
> i meant a rename yes
> 
> we have other macros like ROUNDED_DIV that round to nearest
> also round() rounds to nearest
> 

Please pick one or suggest another:
  FF_INFRND_RSHIFT()
  FF_RNDINF_RSHIFT()
  FF_ROUNDINF_RSHIFT()
  FF_ROUNDED_INF_RSHIFT()
  FF_RSHIFT_INFRND()
  FF_RND_INF_R_SHFT
  FF_ALIGN_RSHIFT
  FF_RSHIFT_ALIGN
  FF_YELLOW_PINK()
  FF_RIGHT_SHIFT_ROUNDED_TOWARD_INFINITY()
  ...


-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130508/bb657d47/attachment.asc>


More information about the ffmpeg-devel mailing list