@@ -217,42 +217,6 @@ void avpriv_request_sample(void *avc,
217
217
#define SUINT32 uint32_t
218
218
#endif
219
219
220
- /**
221
- * Clip and convert a double value into the long long amin-amax range.
222
- * This function is needed because conversion of floating point to integers when
223
- * it does not fit in the integer's representation does not necessarily saturate
224
- * correctly (usually converted to a cvttsd2si on x86) which saturates numbers
225
- * > INT64_MAX to INT64_MIN. The standard marks such conversions as undefined
226
- * behavior, allowing this sort of mathematically bogus conversions. This provides
227
- * a safe alternative that is slower obviously but assures safety and better
228
- * mathematical behavior.
229
- * @param a value to clip
230
- * @param amin minimum value of the clip range
231
- * @param amax maximum value of the clip range
232
- * @return clipped value
233
- */
234
- static av_always_inline av_const int64_t ff_rint64_clip (double a , int64_t amin , int64_t amax )
235
- {
236
- int64_t res ;
237
- #if defined(HAVE_AV_CONFIG_H ) && defined(ASSERT_LEVEL ) && ASSERT_LEVEL >= 2
238
- if (amin > amax ) abort ();
239
- #endif
240
- // INT64_MAX+1,INT64_MIN are exactly representable as IEEE doubles
241
- // do range checks first
242
- if (a >= 9223372036854775808.0 )
243
- return amax ;
244
- if (a <= -9223372036854775808.0 )
245
- return amin ;
246
-
247
- // safe to call llrint and clip accordingly
248
- res = llrint (a );
249
- if (res > amax )
250
- return amax ;
251
- if (res < amin )
252
- return amin ;
253
- return res ;
254
- }
255
-
256
220
/**
257
221
* A wrapper for open() setting O_CLOEXEC.
258
222
*/
0 commit comments