[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:13:44 CEST 2013


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


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"
-------------- 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/a626ee9a/attachment.asc>


More information about the ffmpeg-devel mailing list