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

Michael Niedermayer michaelni at gmx.at
Wed May 8 17:27:43 CEST 2013


On Wed, May 08, 2013 at 04:20:45PM +0200, Clément Bœsch wrote:
> 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()

iam fine with any that the people like

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- 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/20130508/85f4390b/attachment.asc>


More information about the ffmpeg-devel mailing list