odintrin.h: reduce scope of floating-point OD_LOG2 Move it entenc.c, its only user. Otherwise, it brings floating point functions into the namespace of the decoder, while math.h isn't stricly needed to use odintrin.h. Change-Id: I97f19d9768be4b2921b09c4d96bc4a1239faa945
diff --git a/aom_dsp/entenc.c b/aom_dsp/entenc.c index ad147a1..0d69148 100644 --- a/aom_dsp/entenc.c +++ b/aom_dsp/entenc.c
@@ -15,9 +15,17 @@ #include <stdlib.h> #include <string.h> +#include <math.h> #include "aom_dsp/entenc.h" #include "aom_dsp/prob.h" +#if OD_MEASURE_EC_OVERHEAD +#if !defined(M_LOG2E) +#define M_LOG2E (1.4426950408889634073599246810019) +#endif +#define OD_LOG2(x) (M_LOG2E * log(x)) +#endif // OD_MEASURE_EC_OVERHEAD + /*A range encoder. See entdec.c and the references for implementation details \cite{Mar79,MNW98}.
diff --git a/av1/common/odintrin.h b/av1/common/odintrin.h index a555265..e75148f 100644 --- a/av1/common/odintrin.h +++ b/av1/common/odintrin.h
@@ -14,10 +14,6 @@ #ifndef AV1_COMMON_ODINTRIN_H_ #define AV1_COMMON_ODINTRIN_H_ -#if defined(_MSC_VER) -# define _USE_MATH_DEFINES -#endif -#include <math.h> #include <stdlib.h> #include <string.h> @@ -30,26 +26,6 @@ extern "C" { #endif -# if !defined(M_PI) -# define M_PI (3.1415926535897932384626433832795) -# endif - -# if !defined(M_SQRT2) -# define M_SQRT2 (1.41421356237309504880168872420970) -# endif - -# if !defined(M_SQRT1_2) -# define M_SQRT1_2 (0.70710678118654752440084436210485) -# endif - -# if !defined(M_LOG2E) -# define M_LOG2E (1.4426950408889634073599246810019) -# endif - -# if !defined(M_LN2) -# define M_LN2 (0.69314718055994530941723212145818) -# endif - typedef int od_coeff; #define OD_DIVU_DMAX (1024) @@ -74,9 +50,6 @@ #define OD_CLZ(x) (-get_msb(x)) #define OD_ILOG_NZ(x) (OD_CLZ0 - OD_CLZ(x)) -#define OD_LOG2(x) (M_LOG2E*log(x)) -#define OD_EXP2(x) (exp(M_LN2*(x))) - /*Enable special features for gcc and compatible compilers.*/ #if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) #define OD_GNUC_PREREQ(maj, min, pat) \