[FFmpeg-devel] [PATCH] lavu/common: add av_clipl_uint32_c

Michael Niedermayer michaelni at gmx.at
Thu Nov 21 20:11:41 CET 2013


On Thu, Nov 21, 2013 at 01:42:38AM +0100, Lukasz Marek wrote:
> Signed-off-by: Lukasz Marek <lukasz.m.luki at gmail.com>
> ---
>  libavutil/common.h  | 11 +++++++++++
>  libavutil/version.h |  2 +-
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/common.h b/libavutil/common.h
> index e487218..3b92359 100644
> --- a/libavutil/common.h
> +++ b/libavutil/common.h
> @@ -173,6 +173,17 @@ static av_always_inline av_const int16_t av_clip_int16_c(int a)
>  }
>  
>  /**
> + * Clip a signed 64-bit integer value into the 0 - 4294967295 range.
> + * @param a value to clip
> + * @return clipped value
> + */
> +static av_always_inline av_const uint32_t av_clipl_uint32_c(int64_t a)
> +{
> +    if (a & INT64_C(~0xFFFFFFFF)) return (uint32_t)((-a)>>63);

~0xFFFFFFFF == 0
so this looks a bit strange


> +    else                          return (uint32_t)a;
> +}
> +
> +/**
>   * Clip a signed 64-bit integer value into the -2147483648,2147483647 range.
>   * @param a value to clip
>   * @return clipped value
> diff --git a/libavutil/version.h b/libavutil/version.h
> index 3e64a20..c01da93 100644
> --- a/libavutil/version.h
> +++ b/libavutil/version.h
> @@ -75,7 +75,7 @@
>   */
>  
>  #define LIBAVUTIL_VERSION_MAJOR  52
> -#define LIBAVUTIL_VERSION_MINOR  53
> +#define LIBAVUTIL_VERSION_MINOR  54
>  #define LIBAVUTIL_VERSION_MICRO 100
>  
>  #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
> -- 
> 1.8.3.2
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- 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/20131121/5766870c/attachment.asc>


More information about the ffmpeg-devel mailing list