World of Might and Magic
0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
|
Файлы | |
файл | rational.h |
Классы | |
struct | AVRational |
Определения типов | |
typedef struct AVRational | AVRational |
Функции | |
static AVRational | av_make_q (int num, int den) |
static int | av_cmp_q (AVRational a, AVRational b) |
static double | av_q2d (AVRational a) |
int | av_reduce (int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max) |
AVRational | av_mul_q (AVRational b, AVRational c) av_const |
AVRational | av_div_q (AVRational b, AVRational c) av_const |
AVRational | av_add_q (AVRational b, AVRational c) av_const |
AVRational | av_sub_q (AVRational b, AVRational c) av_const |
static av_always_inline AVRational | av_inv_q (AVRational q) |
AVRational | av_d2q (double d, int max) av_const |
int | av_nearer_q (AVRational q, AVRational q1, AVRational q2) |
int | av_find_nearest_q_idx (AVRational q, const AVRational *q_list) |
uint32_t | av_q2intfloat (AVRational q) |
Rational number calculation.
While rational numbers can be expressed as floating-point numbers, the conversion process is a lossy one, so are floating-point operations. On the other hand, the nature of FFmpeg demands highly accurate calculation of timestamps. This set of rational number utilities serves as a generic interface for manipulating rational numbers as pairs of numerators and denominators.
Many of the functions that operate on AVRational's have the suffix _q
, in reference to the mathematical symbol "ℚ" (Q) which denotes the set of all rational numbers.
typedef struct AVRational AVRational |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/rational.h>
Rational number (pair of numerator and denominator).
|
inlinestatic |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/rational.h>
Create an AVRational.
Useful for compilers that do not support compound literals.
См. определение в файле rational.h строка 71
|
inlinestatic |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/rational.h>
Compare two rationals.
a | First rational |
b | Second rational |
a == b
a > b
a < b
INT_MIN
if one of the values is of the form 0 / 0
См. определение в файле rational.h строка 89
|
inlinestatic |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/rational.h>
Convert an AVRational to a double
.
a | AVRational to convert |
a
in floating-point form См. определение в файле rational.h строка 104
Используется в av_ts_make_time_string() и AVVideoStream::open().
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/rational.h>
Reduce a fraction.
This is useful for framerate calculations.
[out] | dst_num | Destination numerator |
[out] | dst_den | Destination denominator |
[in] | num | Source numerator |
[in] | den | Source denominator |
[in] | max | Maximum allowed values for dst_num & dst_den |
AVRational av_mul_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/rational.h>
Multiply two rationals.
b | First rational |
c | Second rational |
AVRational av_div_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/rational.h>
Divide one rational by another.
b | First rational |
c | Second rational |
AVRational av_add_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/rational.h>
Add two rationals.
b | First rational |
c | Second rational |
AVRational av_sub_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/rational.h>
Subtract one rational from another.
b | First rational |
c | Second rational |
|
static |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/rational.h>
Invert a rational.
q | value |
См. определение в файле rational.h строка 159
Перекрестные ссылки AVRational::den.
AVRational av_d2q | ( | double | d, |
int | max | ||
) | const |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/rational.h>
Convert a double precision floating point number to a rational.
In case of infinity, the returned value is expressed as {1, 0}
or {-1, 0}
depending on the sign.
d | double to convert |
max | Maximum allowed numerator and denominator |
d
in AVRational form int av_nearer_q | ( | AVRational | q, |
AVRational | q1, | ||
AVRational | q2 | ||
) |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/rational.h>
Find which of the two rationals is closer to another rational.
q | Rational to be compared against |
q1,q2 | Rationals to be tested |
q1
is nearer to q
than q2
q2
is nearer to q
than q1
int av_find_nearest_q_idx | ( | AVRational | q, |
const AVRational * | q_list | ||
) |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/rational.h>
Find the value in a list of rationals nearest a given reference rational.
q | Reference rational |
q_list | Array of rationals terminated by {0, 0} |
uint32_t av_q2intfloat | ( | AVRational | q | ) |
#include <C:/git/world-of-might-and-magic/lib/win32/x86/ffmpeg-4.2.2/include/libavutil/rational.h>
Convert an AVRational to a IEEE 32-bit float
expressed in fixed-point format.
q | Rational to be converted |