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

Clément Bœsch ubitux at gmail.com
Tue May 7 17:38:46 CEST 2013


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?

-- 
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/20130507/1b99270f/attachment.asc>


More information about the ffmpeg-devel mailing list