ffmpeg / libavutil / mathematics.h @ 94d85eaf
History | View | Annotate | Download (888 Bytes)
1 |
#ifndef MATHEMATICS_H
|
---|---|
2 |
#define MATHEMATICS_H
|
3 |
|
4 |
#include "rational.h" |
5 |
|
6 |
enum AVRounding {
|
7 |
AV_ROUND_ZERO = 0, ///< round toward zero |
8 |
AV_ROUND_INF = 1, ///< round away from zero |
9 |
AV_ROUND_DOWN = 2, ///< round toward -infinity |
10 |
AV_ROUND_UP = 3, ///< round toward +infinity |
11 |
AV_ROUND_NEAR_INF = 5, ///< round to nearest and halfway cases away from zero |
12 |
}; |
13 |
|
14 |
/**
|
15 |
* rescale a 64bit integer with rounding to nearest.
|
16 |
* a simple a*b/c isn't possible as it can overflow
|
17 |
*/
|
18 |
int64_t av_rescale(int64_t a, int64_t b, int64_t c); |
19 |
|
20 |
/**
|
21 |
* rescale a 64bit integer with specified rounding.
|
22 |
* a simple a*b/c isn't possible as it can overflow
|
23 |
*/
|
24 |
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding);
|
25 |
|
26 |
/**
|
27 |
* rescale a 64bit integer by 2 rational numbers.
|
28 |
*/
|
29 |
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq); |
30 |
|
31 |
#endif /* MATHEMATICS_H */ |