FFmpeg
2.7.6
|
Data Structures | |
struct | AVRational |
rational number numerator/denominator More... | |
Enumerations | |
enum | AVRounding { AV_ROUND_ZERO = 0, AV_ROUND_INF = 1, AV_ROUND_DOWN = 2, AV_ROUND_UP = 3, AV_ROUND_NEAR_INF = 5, AV_ROUND_PASS_MINMAX = 8192 } |
Functions | |
int64_t av_const | av_gcd (int64_t a, int64_t b) |
Return the greatest common divisor of a and b. More... | |
int64_t | av_rescale (int64_t a, int64_t b, int64_t c) av_const |
Rescale a 64-bit integer with rounding to nearest. More... | |
int64_t | av_rescale_rnd (int64_t a, int64_t b, int64_t c, enum AVRounding) av_const |
Rescale a 64-bit integer with specified rounding. More... | |
int64_t | av_rescale_q (int64_t a, AVRational bq, AVRational cq) av_const |
Rescale a 64-bit integer by 2 rational numbers. More... | |
int64_t | av_rescale_q_rnd (int64_t a, AVRational bq, AVRational cq, enum AVRounding) av_const |
Rescale a 64-bit integer by 2 rational numbers with specified rounding. More... | |
int | av_compare_ts (int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b) |
Compare 2 timestamps each in its own timebases. More... | |
int64_t | av_compare_mod (uint64_t a, uint64_t b, uint64_t mod) |
Compare 2 integers modulo mod. More... | |
int64_t | av_rescale_delta (AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb) |
Rescale a timestamp while preserving known durations. More... | |
int64_t | av_add_stable (AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc) |
Add a value to a timestamp. More... | |
static AVRational | av_make_q (int num, int den) |
Create a rational. More... | |
static int | av_cmp_q (AVRational a, AVRational b) |
Compare two rationals. More... | |
static double | av_q2d (AVRational a) |
Convert rational to double. More... | |
int | av_reduce (int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max) |
Reduce a fraction. More... | |
AVRational | av_mul_q (AVRational b, AVRational c) av_const |
Multiply two rationals. More... | |
AVRational | av_div_q (AVRational b, AVRational c) av_const |
Divide one rational by another. More... | |
AVRational | av_add_q (AVRational b, AVRational c) av_const |
Add two rationals. More... | |
AVRational | av_sub_q (AVRational b, AVRational c) av_const |
Subtract one rational from another. More... | |
static av_always_inline AVRational | av_inv_q (AVRational q) |
Invert a rational. More... | |
AVRational | av_d2q (double d, int max) av_const |
Convert a double precision floating point number to a rational. More... | |
int | av_nearer_q (AVRational q, AVRational q1, AVRational q2) |
int | av_find_nearest_q_idx (AVRational q, const AVRational *q_list) |
Find the nearest value in q_list to q. More... | |
uint32_t | av_q2intfloat (AVRational q) |
Converts a AVRational to a IEEE 32bit float. More... | |
enum AVRounding |
Definition at line 70 of file mathematics.h.
int64_t av_const av_gcd | ( | int64_t | a, |
int64_t | b | ||
) |
Return the greatest common divisor of a and b.
If both a and b are 0 or either or both are <0 then behavior is undefined.
int64_t av_rescale | ( | int64_t | a, |
int64_t | b, | ||
int64_t | c | ||
) | const |
Rescale a 64-bit integer with rounding to nearest.
A simple a*b/c isn't possible as it can overflow.
int64_t av_rescale_rnd | ( | int64_t | a, |
int64_t | b, | ||
int64_t | c, | ||
enum | AVRounding | ||
) | const |
Rescale a 64-bit integer with specified rounding.
A simple a*b/c isn't possible as it can overflow.
Referenced by main(), and write_audio_frame().
int64_t av_rescale_q | ( | int64_t | a, |
AVRational | bq, | ||
AVRational | cq | ||
) | const |
Rescale a 64-bit integer by 2 rational numbers.
Referenced by display_frame(), main(), and write_audio_frame().
int64_t av_rescale_q_rnd | ( | int64_t | a, |
AVRational | bq, | ||
AVRational | cq, | ||
enum | AVRounding | ||
) | const |
Rescale a 64-bit integer by 2 rational numbers with specified rounding.
Referenced by main().
int av_compare_ts | ( | int64_t | ts_a, |
AVRational | tb_a, | ||
int64_t | ts_b, | ||
AVRational | tb_b | ||
) |
Compare 2 timestamps each in its own timebases.
The result of the function is undefined if one of the timestamps is outside the int64_t range when represented in the others timebase.
Referenced by get_audio_frame(), get_video_frame(), and main().
int64_t av_compare_mod | ( | uint64_t | a, |
uint64_t | b, | ||
uint64_t | mod | ||
) |
Compare 2 integers modulo mod.
That is we compare integers a and b for which only the least significant log2(mod) bits are known.
mod | must be a power of 2 |
int64_t av_rescale_delta | ( | AVRational | in_tb, |
int64_t | in_ts, | ||
AVRational | fs_tb, | ||
int | duration, | ||
int64_t * | last, | ||
AVRational | out_tb | ||
) |
Rescale a timestamp while preserving known durations.
in_ts | Input timestamp |
in_tb | Input timebase |
fs_tb | Duration and *last timebase |
duration | duration till the next call |
out_tb | Output timebase |
int64_t av_add_stable | ( | AVRational | ts_tb, |
int64_t | ts, | ||
AVRational | inc_tb, | ||
int64_t | inc | ||
) |
Add a value to a timestamp.
This function guarantees that when the same value is repeatly added that no accumulation of rounding errors occurs.
ts | Input timestamp |
ts_tb | Input timestamp timebase |
inc | value to add to ts |
inc_tb | inc timebase |
|
inlinestatic |
Create a rational.
Useful for compilers that do not support compound literals.
Definition at line 53 of file rational.h.
|
inlinestatic |
Compare two rationals.
a | first rational |
b | second rational |
Definition at line 66 of file rational.h.
|
inlinestatic |
Convert rational to double.
a | rational to convert |
Definition at line 80 of file rational.h.
Referenced by av_ts_make_time_string().
int av_reduce | ( | int * | dst_num, |
int * | dst_den, | ||
int64_t | num, | ||
int64_t | den, | ||
int64_t | max | ||
) |
Reduce a fraction.
This is useful for framerate calculations.
dst_num | destination numerator |
dst_den | destination denominator |
num | source numerator |
den | source denominator |
max | the maximum allowed for dst_num & dst_den |
AVRational av_mul_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
Multiply two rationals.
b | first rational |
c | second rational |
AVRational av_div_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
Divide one rational by another.
b | first rational |
c | second rational |
AVRational av_add_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
Add two rationals.
b | first rational |
c | second rational |
AVRational av_sub_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
Subtract one rational from another.
b | first rational |
c | second rational |
|
static |
AVRational av_d2q | ( | double | d, |
int | max | ||
) | const |
Convert a double precision floating point number to a rational.
inf is expressed as {1,0} or {-1,0} depending on the sign.
d | double to convert |
max | the maximum allowed numerator and denominator |
int av_nearer_q | ( | AVRational | q, |
AVRational | q1, | ||
AVRational | q2 | ||
) |
int av_find_nearest_q_idx | ( | AVRational | q, |
const AVRational * | q_list | ||
) |
Find the nearest value in q_list to q.
q_list | an array of rationals terminated by {0, 0} |
uint32_t av_q2intfloat | ( | AVRational | q | ) |
Converts a AVRational to a IEEE 32bit float.
The float is returned in a uint32_t and its value is platform indepenant.