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

Michael Niedermayer michaelni at gmx.at
Tue May 7 17:50:27 CEST 2013


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

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130507/b2938996/attachment.asc>


More information about the ffmpeg-devel mailing list