]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/mathematics.h
time_internal: Prefix fallback versions of gmtime_r/localtime_r with ff_
[ffmpeg] / libavutil / mathematics.h
index 0b072ebe63cfcda52b757737651ba4a1e0fab453..043dd0fafea85034edef9079c8662f815409ab48 100644 (file)
 #include <math.h>
 #include "attributes.h"
 #include "rational.h"
+#include "intfloat.h"
 
-#ifndef M_E
-#define M_E            2.7182818284590452354   /* e */
-#endif
-#ifndef M_LN2
-#define M_LN2          0.69314718055994530942  /* log_e 2 */
-#endif
-#ifndef M_LN10
-#define M_LN10         2.30258509299404568402  /* log_e 10 */
-#endif
 #ifndef M_LOG2_10
 #define M_LOG2_10      3.32192809488736234787  /* log_2 10 */
 #endif
 #ifndef M_PHI
 #define M_PHI          1.61803398874989484820   /* phi / golden ratio */
 #endif
-#ifndef M_PI
-#define M_PI           3.14159265358979323846  /* pi */
-#endif
-#ifndef M_SQRT1_2
-#define M_SQRT1_2      0.70710678118654752440  /* 1/sqrt(2) */
-#endif
-#ifndef M_SQRT2
-#define M_SQRT2        1.41421356237309504880  /* sqrt(2) */
-#endif
 #ifndef NAN
-#define NAN            (0.0/0.0)
+#define NAN            av_int2float(0x7fc00000)
 #endif
 #ifndef INFINITY
-#define INFINITY       (1.0/0.0)
+#define INFINITY       av_int2float(0x7f800000)
 #endif
 
 /**
@@ -95,6 +78,12 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_cons
  */
 int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
 
+/**
+ * Rescale a 64-bit integer by 2 rational numbers with specified rounding.
+ */
+int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
+                         enum AVRounding) av_const;
+
 /**
  * Compare 2 timestamps each in its own timebases.
  * The result of the function is undefined if one of the timestamps