00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00024 #ifndef AVUTIL_LIBM_H
00025 #define AVUTIL_LIBM_H
00026
00027 #include <math.h>
00028 #include "config.h"
00029 #include "attributes.h"
00030
00031 #if !HAVE_EXP2
00032 #undef exp2
00033 #define exp2(x) exp((x) * 0.693147180559945)
00034 #endif
00035
00036 #if !HAVE_EXP2F
00037 #undef exp2f
00038 #define exp2f(x) ((float)exp2(x))
00039 #endif
00040
00041 #if !HAVE_LLRINT
00042 #undef llrint
00043 #define llrint(x) ((long long)rint(x))
00044 #endif
00045
00046 #if !HAVE_LOG2
00047 #undef log2
00048 #define log2(x) (log(x) * 1.44269504088896340736)
00049 #endif
00050
00051 #if !HAVE_LOG2F
00052 #undef log2f
00053 #define log2f(x) ((float)log2(x))
00054 #endif
00055
00056 #if !HAVE_LRINT
00057 static av_always_inline av_const long int lrint(double x)
00058 {
00059 return rint(x);
00060 }
00061 #endif
00062
00063 #if !HAVE_LRINTF
00064 static av_always_inline av_const long int lrintf(float x)
00065 {
00066 return (int)(rint(x));
00067 }
00068 #endif
00069
00070 #if !HAVE_ROUND
00071 static av_always_inline av_const double round(double x)
00072 {
00073 return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
00074 }
00075 #endif
00076
00077 #if !HAVE_ROUNDF
00078 static av_always_inline av_const float roundf(float x)
00079 {
00080 return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5);
00081 }
00082 #endif
00083
00084 #if !HAVE_TRUNCF
00085 static av_always_inline av_const float truncf(float x)
00086 {
00087 return (x > 0) ? floor(x) : ceil(x);
00088 }
00089 #endif
00090
00091 #endif