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 } |
Functions | |
int64_t av_const | av_gcd (int64_t a, int64_t b) |
Return the greatest common divisor of a and b. | |
int64_t | av_rescale (int64_t a, int64_t b, int64_t c) av_const |
Rescale a 64-bit integer with rounding to nearest. | |
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. | |
int64_t | av_rescale_q (int64_t a, AVRational bq, AVRational cq) av_const |
Rescale a 64-bit integer by 2 rational numbers. | |
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. | |
int64_t | av_compare_mod (uint64_t a, uint64_t b, uint64_t mod) |
Compare 2 integers modulo mod. | |
static int | av_cmp_q (AVRational a, AVRational b) |
Compare two rationals. | |
static double | av_q2d (AVRational a) |
Convert rational to double. | |
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) av_const |
Multiply two rationals. | |
AVRational | av_div_q (AVRational b, AVRational c) av_const |
Divide one rational by another. | |
AVRational | av_add_q (AVRational b, AVRational c) av_const |
Add two rationals. | |
AVRational | av_sub_q (AVRational b, AVRational c) av_const |
Subtract one rational from another. | |
AVRational | av_d2q (double d, int max) av_const |
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. |
enum AVRounding |
Definition at line 66 of file mathematics.h.
AVRational av_add_q | ( | AVRational | b, | |
AVRational | c | |||
) | const |
Add two rationals.
b | first rational | |
c | second rational |
Definition at line 93 of file rational.c.
Referenced by av_sub_q().
static int av_cmp_q | ( | AVRational | a, | |
AVRational | b | |||
) | [inline, static] |
Compare two rationals.
a | first rational | |
b | second rational |
Definition at line 55 of file rational.h.
Referenced by av_nearer_q(), avformat_write_header(), decode_slice_header(), dump_stream_format(), ff_h263_aspect_to_info(), mpeg_decode_postinit(), start_frame(), and video_thread().
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 |
Definition at line 150 of file mathematics.c.
Referenced by av_read_frame().
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.
Definition at line 140 of file mathematics.c.
Referenced by check_output_constraints(), ff_gen_syncpoint_search(), ff_interleave_compare_dts(), and search_hi_lo_keyframes().
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 106 of file rational.c.
Referenced by av_get_q(), av_opt_get_q(), av_opt_set_defaults2(), av_parse_video_rate(), config_output_props(), init(), matroska_read_header(), microdvd_read_header(), mov_read_tkhd(), mov_read_trak(), mpeg_decode_postinit(), nuv_header(), thp_read_header(), and write_number().
AVRational av_div_q | ( | AVRational | b, | |
AVRational | c | |||
) | const |
Divide one rational by another.
b | first rational | |
c | second rational |
Definition at line 88 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 138 of file rational.c.
Referenced by transcode_init().
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.
Definition at line 73 of file mathematics.c.
Referenced by av_gcd(), av_reduce(), avcodec_string(), avformat_find_stream_info(), config_output(), decode_main_header(), dump_stream_format(), eval_expr(), ff_parse_specific_params(), h263_decode_picture_header(), init(), MPV_encode_init(), and rtp_send_samples().
AVRational av_mul_q | ( | AVRational | b, | |
AVRational | c | |||
) | const |
Multiply two rationals.
b | first rational | |
c | second rational |
Definition at line 80 of file rational.c.
Referenced by av_div_q(), avi_write_header(), config_props(), and mpeg_decode_postinit().
int av_nearer_q | ( | AVRational | q, | |
AVRational | q1, | |||
AVRational | q2 | |||
) |
Definition at line 123 of file rational.c.
Referenced by av_find_nearest_q_idx().
static double av_q2d | ( | AVRational | a | ) | [inline, static] |
Convert rational to double.
a | rational to convert |
Definition at line 69 of file rational.h.
Referenced by audio_decode_frame(), av_dump_format(), avfilter_start_frame(), avformat_find_stream_info(), avformat_write_header(), avi_write_header(), config_input(), config_output_props(), decode_syncpoint(), do_video_out(), do_video_stats(), draw_text(), dump_stream_format(), dv_write_pack(), end_frame(), fbdev_read_header(), fbdev_read_packet(), ff_rate_control_init(), ff_rate_estimate_qscale(), ff_vbv_update(), filter_samples(), flv_write_header(), get_video_frame(), grab_read_header(), init(), init_input_stream(), init_pass2(), mkv_write_tracks(), modify_qscale(), mov_write_tkhd_tag(), mov_write_trak_tag(), mpeg1_encode_sequence_header(), MPV_encode_init(), MPV_encode_picture(), mxf_write_header(), pkt_dump_internal(), queue_picture(), read_header(), read_seek(), read_thread(), sdl_write_header(), select_frame(), start_frame(), subtitle_thread(), thp_read_header(), transcode(), transcode_init(), v4l2_read_header(), vf_next_put_image(), video_image_display(), video_thread(), write_trailer(), writer_print_time(), x11grab_read_header(), and x11grab_read_packet().
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_mul_q(), av_resample_init(), avcodec_string(), avi_write_header(), avpriv_set_pts_info(), config_output(), decode_frame(), decode_sequence_header_adv(), decode_slice_header(), dump_stream_format(), dxa_read_header(), ff_rm_read_mdpr_codecdata(), matroska_read_header(), mov_read_trak(), mov_write_pasp_tag(), mpeg_decode_postinit(), MPV_encode_init(), mxf_parse_mpeg2_frame(), parse_source_parameters(), read_fps(), show_stream(), skeleton_header(), smacker_read_header(), start_frame(), swri_resample_init(), tmv_read_header(), transcode_init(), vmd_read_header(), X264_init(), and yuv4_read_header().
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.
Definition at line 130 of file mathematics.c.
Referenced by asf_build_simple_index(), audio_read_packet(), av_dump_format(), av_seek_frame(), avi_read_header(), compute_pkt_fields(), compute_pkt_fields2(), config_props(), dc1394_read_header(), estimate_timings_from_bit_rate(), ff_gen_search(), ff_update_cur_dts(), filter_samples(), finalize_packet(), flush_encoders(), get_pcr(), mov_build_index(), mov_find_next_sample(), mov_read_trak(), mov_write_tapt_tag(), mp3_parse_vbr_tags(), mpeg_mux_write_packet(), mpegts_write_header(), mpegts_write_packet(), mpegts_write_pes(), mxf_read_seek(), nsv_parse_NSVs_header(), output_packet(), pcm_read_seek(), r3d_read_reda(), rate_emu_sleep(), read_header(), and vqf_read_seek().
int64_t av_rescale_q | ( | int64_t | a, | |
AVRational | bq, | |||
AVRational | cq | |||
) | const |
Rescale a 64-bit integer by 2 rational numbers.
Definition at line 134 of file mathematics.c.
Referenced by av_interleave_packet_per_dts(), avformat_find_stream_info(), avi_read_packet(), avi_read_seek(), compute_chapters_end(), copy_chapters(), decode_frame(), display_picref(), do_audio_out(), do_streamcopy(), do_subtitle_out(), do_video_out(), dv_extract_video_info(), dv_offset_reset(), dv_read_header(), encode_frame(), ff_interleave_add_packet(), ff_interleave_compare_dts(), ff_interleave_new_audio_packet(), ff_mov_write_packet(), ff_write_chained(), fill_all_stream_timings(), flush_encoders(), get_subtitle_pkt(), gsm_read_seek2(), http_prepare_data(), init(), lavfi_read_packet(), main(), mkv_write_chapters(), mov_create_chapter_track(), mov_read_seek(), mov_write_chpl_tag(), mp3_parse_vbr_tags(), ogg_compare_granule(), ogg_get_length(), oggvorbis_encode_frame(), output_packet(), parse_forced_key_frames(), print_report(), read_header(), read_seek2(), rl2_read_seek(), rtcp_send_sr(), rtp_write_header(), rtsp_read_play(), rtsp_read_seek(), seek_subtitle(), source_request_frame(), start_frame(), start_frame_overlay(), transcode(), transcode_init(), transcode_video(), ts_str(), update_stream_timings(), video_thread(), write_audio_frame(), and write_video_frame().
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.
Definition at line 78 of file mathematics.c.
Referenced by applehttp_read_seek(), av_compare_ts(), av_nearer_q(), av_rescale(), av_rescale_q(), av_rescale_rnd(), compute_pkt_fields(), dv_write_pack(), ff_nut_reset_ts(), gxf_compare_field_nb(), gxf_write_media_preamble(), mov_write_edts_tag(), mov_write_mvhd_tag(), mov_write_tkhd_tag(), nut_write_packet(), pcm_read_seek(), read_seek2(), rtmp_read_seek(), rtp_write_header(), vp8_init(), and vqf_read_seek().
AVRational av_sub_q | ( | AVRational | b, | |
AVRational | c | |||
) | const |
Subtract one rational from another.
b | first rational | |
c | second rational |
Definition at line 101 of file rational.c.