comparison internal.h @ 411:d25e027364d6 libavutil

Check for the presence of llrint(), lrint(), round() and roundf() and provide simple replacements if they are unavailable. patch by Michael Kostylev, mik niipt ru
author diego
date Thu, 27 Dec 2007 01:53:02 +0000
parents 033099f22fc2
children fa6c031f2a57
comparison
equal deleted inserted replaced
410:033099f22fc2 411:d25e027364d6
268 av_log(NULL, AV_LOG_ERROR, "Cannot allocate memory.");\ 268 av_log(NULL, AV_LOG_ERROR, "Cannot allocate memory.");\
269 goto fail;\ 269 goto fail;\
270 }\ 270 }\
271 } 271 }
272 272
273 #ifndef HAVE_LLRINT
274 static av_always_inline long long llrint(double x)
275 {
276 return rint(x);
277 }
278 #endif /* HAVE_LLRINT */
279
280 #ifndef HAVE_LRINT
281 static av_always_inline long int lrint(double x)
282 {
283 return rint(x);
284 }
285 #endif /* HAVE_LRINT */
286
273 #ifndef HAVE_LRINTF 287 #ifndef HAVE_LRINTF
274 static av_always_inline long int lrintf(float x) 288 static av_always_inline long int lrintf(float x)
275 { 289 {
276 return (int)(rint(x)); 290 return (int)(rint(x));
277 } 291 }
278 #endif /* HAVE_LRINTF */ 292 #endif /* HAVE_LRINTF */
279 293
294 #ifndef HAVE_ROUND
295 static av_always_inline double round(double x)
296 {
297 return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
298 }
299 #endif /* HAVE_ROUND */
300
301 #ifndef HAVE_ROUNDF
302 static av_always_inline float roundf(float x)
303 {
304 return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
305 }
306 #endif /* HAVE_ROUNDF */
307
280 #endif /* FFMPEG_INTERNAL_H */ 308 #endif /* FFMPEG_INTERNAL_H */