[FFmpeg-devel] [PATCH 1/2] avutil/common: add av_rint64_clip
Pedro Arthur
bygrandao at gmail.com
Fri Nov 13 13:05:20 CET 2015
> +static av_always_inline av_const int64_t av_rint64_clip_c(double a,
> int64_t amin, int64_t amax)
> +{
> +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >=
> 2
> + if (amin > amax) abort();
> +#endif
> + // INT64_MAX+1,INT64_MIN are exactly representable as IEEE doubles
> + if (a >= 9223372036854775808.0)
> + return INT64_MAX;
> + if (a <= INT64_MIN)
> + return INT64_MIN;
> + // Finally safe to call av_clipd_c
> + return (int64_t)av_clipd_c(a, amin, amax);
> +}
>
If I use av_rint64_clip_c(INT64_MAX+2, 0, 10) this function will return
INT64_MAX instead of 10. Is that the intended behavior?
More information about the ffmpeg-devel
mailing list