1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-29 22:00:58 +02:00
FFmpeg/libavutil
Ganesh Ajjanagadde 6f520ce1a6 avutil/common: add av_rint64_clip
The rationale for this function is reflected in the documentation for
it, and is copied here:

Clip a double value into the long long amin-amax range.
This function is needed because conversion of floating point to integers when
it does not fit in the integer's representation does not necessarily saturate
correctly (usually converted to a cvttsd2si on x86) which saturates numbers
> INT64_MAX to INT64_MIN. The standard marks such conversions as undefined
behavior, allowing this sort of mathematically bogus conversions. This provides
a safe alternative that is slower obviously but assures safety and better
mathematical behavior.
API:
@param a value to clip
@param amin minimum value of the clip range
@param amax maximum value of the clip range
@return clipped value

Note that a priori if one can guarantee from the calling side that the
double is in range, it is safe to simply do an explicit/implicit cast,
and that will be far faster. However, otherwise this function should be
used.

avutil minor version is bumped.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-13 21:48:16 -05:00
..
2015-10-28 09:38:21 -05:00
2015-08-19 16:15:13 +00:00
2015-08-22 10:07:05 -07:00
2015-11-13 21:48:16 -05:00
2015-10-28 04:23:14 -05:00
2015-10-28 04:23:14 -05:00
2015-11-01 19:35:01 -05:00
2015-09-05 18:07:20 +02:00
2015-09-05 18:07:20 +02:00
2015-10-11 18:03:10 -04:00
2014-11-08 11:31:11 +01:00
2015-10-16 19:53:55 -04:00
2015-10-17 01:16:50 -07:00
2015-11-07 16:04:09 +01:00
2015-05-26 18:31:53 +02:00
2015-10-26 15:05:26 +01:00
2015-11-13 21:48:16 -05:00