Libav 0.7.1
|
rational numbers More...
#include "avassert.h"
#include <limits.h>
#include "common.h"
#include "mathematics.h"
#include "rational.h"
Go to the source code of this file.
Defines | |
#define | LOG2 0.69314718055994530941723212145817656807550013436025 |
Functions | |
int | av_reduce (int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max) |
Reduce a fraction. | |
AVRational | av_mul_q (AVRational b, AVRational c) |
Multiply two rationals. | |
AVRational | av_div_q (AVRational b, AVRational c) |
Divide one rational by another. | |
AVRational | av_add_q (AVRational b, AVRational c) |
Add two rationals. | |
AVRational | av_sub_q (AVRational b, AVRational c) |
Subtract one rational from another. | |
AVRational | av_d2q (double d, int max) |
Convert a double precision floating point number to a rational. | |
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. |
rational numbers
Definition in file rational.c.
#define LOG2 0.69314718055994530941723212145817656807550013436025 |
Referenced by av_d2q().
AVRational av_add_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
Add two rationals.
b | first rational |
c | second rational |
Definition at line 87 of file rational.c.
Referenced by av_sub_q().
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 |
Definition at line 96 of file rational.c.
Referenced by av_get_q(), av_opt_set_defaults2(), av_parse_video_rate(), av_set_number2(), config_output_props(), config_props(), init(), matroska_read_header(), mov_read_tkhd(), mov_read_trak(), mpeg_decode_postinit(), new_video_stream(), nuv_header(), and thp_read_header().
AVRational av_div_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
Divide one rational by another.
b | first rational |
c | second rational |
Definition at line 83 of file rational.c.
Referenced by avi_read_header(), config_props_output(), and mpeg_decode_postinit().
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} |
Definition at line 127 of file rational.c.
Referenced by transcode().
AVRational av_mul_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
Multiply two rationals.
b | first rational |
c | second rational |
Definition at line 78 of file rational.c.
Referenced by av_div_q(), avi_write_header(), and mpeg_decode_postinit().
int av_nearer_q | ( | AVRational | q, |
AVRational | q1, | ||
AVRational | q2 | ||
) |
Definition at line 112 of file rational.c.
Referenced by av_find_nearest_q_idx().
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 |
Definition at line 36 of file rational.c.
Referenced by asf_read_header(), av_add_q(), av_d2q(), av_find_stream_info(), av_mul_q(), av_set_pts_info(), avcodec_string(), avi_write_header(), config_output(), decode_frame(), decode_slice_header(), dump_stream_format(), dxa_read_header(), matroska_read_header(), mov_read_trak(), mov_write_pasp_tag(), mpeg_decode_postinit(), mxf_parse_mpeg2_frame(), parse_source_parameters(), read_fps(), show_stream(), skeleton_header(), smacker_read_header(), start_frame(), tmv_read_header(), transcode(), vmd_read_header(), and yuv4_read_header().
AVRational av_sub_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
Subtract one rational from another.
b | first rational |
c | second rational |
Definition at line 92 of file rational.c.