diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-08-27 17:30:36 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-09-03 15:41:44 +0200 |
commit | 5b0856d2b9f6ca843a9a0aa0117121f5bdc9746f (patch) | |
tree | 615efd2367c0bd28815f741c687c9e81c8a99f53 /libavutil | |
parent | 65f68514486fade5c6ab973c90047a422198ce07 (diff) | |
download | ffmpeg-5b0856d2b9f6ca843a9a0aa0117121f5bdc9746f.tar.gz |
avutil/internal: Remove unused ff_rint64_clip()
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/internal.h | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/libavutil/internal.h b/libavutil/internal.h index b44cbaaa7b..c118936598 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -218,42 +218,6 @@ void avpriv_request_sample(void *avc, #endif /** - * Clip and convert 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. - * @param a value to clip - * @param amin minimum value of the clip range - * @param amax maximum value of the clip range - * @return clipped value - */ -static av_always_inline av_const int64_t ff_rint64_clip(double a, int64_t amin, int64_t amax) -{ - int64_t res; -#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 - // do range checks first - if (a >= 9223372036854775808.0) - return amax; - if (a <= -9223372036854775808.0) - return amin; - - // safe to call llrint and clip accordingly - res = llrint(a); - if (res > amax) - return amax; - if (res < amin) - return amin; - return res; -} - -/** * A wrapper for open() setting O_CLOEXEC. */ av_warn_unused_result |