00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef AVUTIL_MATHEMATICS_H
00022 #define AVUTIL_MATHEMATICS_H
00023
00024 #include <stdint.h>
00025 #include <math.h>
00026 #include "attributes.h"
00027 #include "rational.h"
00028 #include "intfloat.h"
00029
00030 #ifndef M_E
00031 #define M_E 2.7182818284590452354
00032 #endif
00033 #ifndef M_LN2
00034 #define M_LN2 0.69314718055994530942
00035 #endif
00036 #ifndef M_LN10
00037 #define M_LN10 2.30258509299404568402
00038 #endif
00039 #ifndef M_LOG2_10
00040 #define M_LOG2_10 3.32192809488736234787
00041 #endif
00042 #ifndef M_PHI
00043 #define M_PHI 1.61803398874989484820
00044 #endif
00045 #ifndef M_PI
00046 #define M_PI 3.14159265358979323846
00047 #endif
00048 #ifndef M_SQRT1_2
00049 #define M_SQRT1_2 0.70710678118654752440
00050 #endif
00051 #ifndef M_SQRT2
00052 #define M_SQRT2 1.41421356237309504880
00053 #endif
00054 #ifndef NAN
00055 #define NAN av_int2float(0x7fc00000)
00056 #endif
00057 #ifndef INFINITY
00058 #define INFINITY av_int2float(0x7f800000)
00059 #endif
00060
00067 enum AVRounding {
00068 AV_ROUND_ZERO = 0,
00069 AV_ROUND_INF = 1,
00070 AV_ROUND_DOWN = 2,
00071 AV_ROUND_UP = 3,
00072 AV_ROUND_NEAR_INF = 5,
00073 };
00074
00080 int64_t av_const av_gcd(int64_t a, int64_t b);
00081
00086 int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const;
00087
00092 int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const;
00093
00097 int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
00098
00102 int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq,
00103 enum AVRounding) av_const;
00104
00111 int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b);
00112
00123 int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod);
00124
00129 #endif