aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/kbdwin.h
diff options
context:
space:
mode:
authorGanesh Ajjanagadde <gajjanagadde@gmail.com>2015-11-01 09:33:29 -0500
committerGanesh Ajjanagadde <gajjanagadde@gmail.com>2015-11-13 21:48:16 -0500
commit6f520ce1a6c6bc8467e96a2d1d9f6dab88c210ca (patch)
treeba9f5af3cb10f212daedf466cfa59dad6b682de2 /libavcodec/kbdwin.h
parentdf91aa034b82b77a3c4e01791f4a2b2ff6c82066 (diff)
downloadffmpeg-6f520ce1a6c6bc8467e96a2d1d9f6dab88c210ca.tar.gz
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>
Diffstat (limited to 'libavcodec/kbdwin.h')
0 files changed, 0 insertions, 0 deletions