FFmpeg
|
Data Structures | |
struct | AVRational |
rational number numerator/denominator More... | |
Macros | |
#define | ff_ctz ff_ctz_c |
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 | |
static av_always_inline av_const int | ff_ctz_c (int v) |
int | av_ctz (int v) |
Trailing zero bit count. | |
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. | |
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. | |
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. | |
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. | |
int64_t | av_add_stable (AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc) |
Add a value to a timestamp. | |
static AVRational | av_make_q (int num, int den) |
Create a rational. | |
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. | |
static av_always_inline AVRational | av_inv_q (AVRational q) |
Invert a rational. | |
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 70 of file mathematics.h.
|
static |
int av_ctz | ( | int | v | ) |
Trailing zero bit count.
v | input value. If v is 0, the result is undefined. |
Definition at line 36 of file intmath.c.
Referenced by remove_wasted_bits().
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 55 of file mathematics.c.
Referenced by av_gcd(), av_reduce(), avcodec_string(), decode_main_header(), eval_expr(), ff_framesync_configure(), ff_h263_decode_picture_header(), ff_MPV_encode_init(), ff_parse_specific_params(), ff_put_wav_header(), ff_rfps_add_frame(), find_frame_rate_index(), rtp_send_samples(), and xvid_correct_framerate().
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 127 of file mathematics.c.
Referenced by asf_build_simple_index(), audio_read_packet(), av_dump_format(), avi_read_header(), calculate_bitrate(), check_stream_max_drift(), compute_display_area(), compute_overlay_rect(), compute_pkt_fields(), compute_pkt_fields2(), config_input(), config_props(), dc1394_read_common(), estimate_timings_from_bit_rate(), ff_gen_search(), ff_interleave_add_packet(), ff_pcm_read_seek(), ff_rtp_check_and_send_back_rr(), ff_update_cur_dts(), filter_frame(), finalize_packet(), generate_intervals(), get_delay(), get_input_packet(), get_pcr(), matroska_parse_tracks(), mov_build_index(), mov_find_next_sample(), mov_read_mvhd(), mov_write_moov_tag(), mov_write_tapt_tag(), mov_write_tmcd_tag(), mp3_seek(), mpeg_mux_write_packet(), mpegts_write_header(), mpegts_write_packet_internal(), mpegts_write_pes(), mxf_read_seek(), nsv_parse_NSVs_header(), opengl_compute_display_area(), opus_header(), output_packet(), push_frame(), r3d_read_reda(), read_header(), read_xing_toc(), request_frame(), rm_read_header(), sbg_read_header(), seek_frame_internal(), transcode_subtitles(), update_wrap_reference(), vivo_read_header(), vqf_read_seek(), and xv_write_header().
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 63 of file mathematics.c.
Referenced by av_compare_ts(), av_image_check_sar(), av_nearer_q(), av_rescale(), av_rescale_q_rnd(), av_rescale_rnd(), avformat_seek_file(), avresample_get_out_samples(), compute_pkt_fields(), dv_write_pack(), estimate_timings_from_pts(), ff_nut_reset_ts(), ff_pcm_read_seek(), gxf_compare_field_nb(), gxf_write_media_preamble(), handle_file(), hls_read_packet(), hls_read_seek(), main(), mov_write_edts_tag(), mov_write_mvhd_tag(), mov_write_tkhd_tag(), nut_write_packet(), rtmp_read_seek(), vpx_init(), vqf_read_seek(), 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.
Definition at line 140 of file mathematics.c.
Referenced by asf_write_markers(), audio_decode_frame(), av_add_stable(), av_buffersink_get_samples(), av_packet_rescale_ts(), av_rescale_delta(), avcodec_decode_audio4(), avcodec_decode_subtitle2(), avf_read_packet(), avformat_find_stream_info(), avformat_seek_file(), avi_read_packet(), avi_read_seek(), avisynth_read_packet_audio(), avisynth_read_seek(), buffer_offset(), caca_write_header(), check_stream_max_drift(), choose_output(), close_output_stream(), compand_delay(), compand_drain(), compare_ts_with_wrapdetect(), compute_chapters_end(), concat_read_packet(), config_input(), copy_chapters(), create_ass_text(), decode_audio(), decode_frame(), decode_syncpoint(), decode_video(), display_frame(), do_streamcopy(), do_subtitle_out(), do_video_out(), dv_extract_video_info(), dv_read_header(), encode_write_frame(), ff_af_queue_add(), ff_dv_offset_reset(), ff_filter_frame_needs_framing(), ff_interleave_packet_per_dts(), ff_read_packet(), ff_samples_to_time_base(), ff_update_link_current_pts(), ff_write_chained(), fill_all_stream_timings(), fill_timing_for_id3_timestamped_stream(), filter_frame(), find_and_decode_index(), framesync_inject_frame(), get_subtitle_pkt(), hls_read_packet(), http_prepare_data(), init(), init_convert_timestamp(), interleave_compare_dts(), interleave_new_audio_packet(), lavfi_read_packet(), main(), matroska_parse_frame(), matroska_parse_tracks(), microdvd_decode_frame(), mkv_write_block(), mkv_write_chapters(), mkv_write_track(), mov_create_chapter_track(), mov_read_seek(), mov_text_decode_frame(), mov_write_chpl_tag(), mov_write_single_packet(), mp3_parse_info_tag(), mp3_parse_vbr_tags(), mpeg4_decode_header(), mpegts_write_packet_internal(), mpl2_decode_frame(), mxf_parse_structural_metadata(), mxf_read_seek(), nut_write_packet(), ogg_buffer_data(), ogg_compare_granule(), ogg_write_packet_internal(), output_packet(), parse_forced_key_frames(), plot_spectrum_column(), print_report(), process_frame(), process_input(), pulse_write_packet(), push_frame(), push_samples(), qtkit_read_packet(), r3d_read_rdvo(), r3d_seek(), rawvideo_read_header(), read_from_fifo(), read_header(), read_interval_packets(), reap_filters(), request_frame(), rescale_interval(), rl2_read_seek(), rtcp_send_sr(), rtp_parse_one_packet(), rtp_write_header(), rtsp_read_play(), rtsp_read_seek(), sami_decode_frame(), save_subtitle_set(), sbg_read_seek2(), seek_chapter(), seek_subtitle(), seg_write_packet(), send_silence(), source_request_frame(), srt_decode_frame(), sub2video_heartbeat(), sub2video_update(), tee_write_packet(), teletext_decode_frame(), text_decode_frame(), transcode_init(), ts_str(), update_stream_timings(), webvtt_decode_frame(), write_audio_frame(), write_chapter(), and write_packet().
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.
Definition at line 132 of file mathematics.c.
Referenced by av_rescale_delta(), av_rescale_q(), encode_write_frame(), ff_interleave_add_packet(), filter_frame(), main(), parse_packet(), rescale_interval(), rtp_write_header(), and write_packet().
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 145 of file mathematics.c.
Referenced by check_recording_time(), ff_gen_syncpoint_search(), get_audio_frame(), get_video_frame(), hds_write_packet(), hls_write_packet(), interleave_compare_dts(), ism_write_packet(), main(), nut_write_packet(), search_hi_lo_keyframes(), seek_chapter(), and seg_write_packet().
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 158 of file mathematics.c.
Referenced by av_read_frame(), and compare_ts_with_wrapdetect().
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 |
Definition at line 166 of file mathematics.c.
Referenced by decode_audio(), and do_streamcopy().
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 |
Definition at line 189 of file mathematics.c.
Referenced by compute_pkt_fields().
|
inlinestatic |
Create a rational.
Useful for compilers that do not support compound literals.
Definition at line 53 of file rational.h.
Referenced by config_out_props(), config_output(), config_props(), encode_frame(), filter_frame(), and push_frame().
|
inlinestatic |
Compare two rationals.
a | first rational |
b | second rational |
Definition at line 66 of file rational.h.
Referenced by av_nearer_q(), compute_display_area(), compute_overlay_rect(), config_output(), dump_stream_format(), ff_h263_aspect_to_info(), ff_h264_decode_slice_header(), ff_mxf_get_samples_per_frame(), filter_frame(), find_frame_rate_index(), init_muxer(), mpeg_decode_postinit(), and opengl_compute_display_area().
|
inlinestatic |
Convert rational to double.
a | rational to convert |
Definition at line 80 of file rational.h.
Referenced by audio_decode_frame(), av_dump_format(), av_guess_frame_rate(), av_ts_make_time_string(), avformat_find_stream_info(), avi_read_seek(), avi_write_header(), calculate_display_rect(), config_input(), config_output(), config_output_props(), config_props(), decode_frame(), decode_syncpoint(), do_blend(), do_video_out(), do_video_stats(), draw_text(), dump_stream_format(), dv_write_pack(), fbdev_read_header(), fbdev_read_packet(), ff_filter_frame_framed(), ff_MPV_encode_init(), ff_MPV_encode_picture(), ff_rfps_add_frame(), ff_rfps_calculate(), ff_vf_next_put_image(), filter_frame(), filter_slice(), find_compressor(), flv_write_header(), gdigrab_read_header(), gdigrab_read_packet(), geq_filter_frame(), get_best_frame(), get_fps(), get_video_frame(), grab_read_header(), init(), init_muxer(), init_stream(), init_video(), mov_get_mpeg2_xdcam_codec_tag(), mov_write_tkhd_tag(), mov_write_tmcd_tag(), mov_write_trak_tag(), mxf_compute_sample_count(), output_packet(), pkt_dump_internal(), push_frame(), read_header(), read_seek(), read_thread(), seg_write_packet(), select_frame(), send_out(), subtitle_thread(), transcode_init(), update(), v4l2_read_header(), video_thread(), write_manifest(), 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 35 of file rational.c.
Referenced by asf_read_header(), av_add_q(), av_d2q(), av_guess_sample_aspect_ratio(), av_mul_q(), av_parse_ratio(), av_resample_init(), avcodec_string(), avformat_find_stream_info(), avi_write_header(), avpriv_set_pts_info(), compute_dar(), config_input(), decode_frame(), decode_sequence_header_adv(), dump_stream_format(), dxa_read_header(), ff_audio_resample_init(), ff_MPV_encode_init(), ff_rfps_calculate(), ff_rm_read_mdpr_codecdata(), filter_frame(), h264_slice_header_init(), libx265_encode_init(), matroska_parse_tracks(), mov_read_header(), mov_read_trak(), mov_write_pasp_tag(), mpeg4_encode_vol_header(), mpeg_decode_postinit(), mxf_parse_mpeg2_frame(), parse_source_parameters(), parse_video_var(), pcx_encode_frame(), read_fps(), resample_init(), set_sar(), set_sps(), show_stream(), skeleton_header(), smacker_read_header(), tmv_read_header(), transcode_init(), vmd_read_header(), X264_init(), xvid_encode_frame(), yuv4_generate_header(), and yuv4_read_header().
AVRational av_mul_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
Multiply two rationals.
b | first rational |
c | second rational |
Definition at line 79 of file rational.c.
Referenced by av_add_stable(), av_div_q(), avi_write_header(), compute_display_area(), compute_overlay_rect(), compute_pkt_fields(), config_input(), config_out_props(), config_output(), config_props(), encode_frame(), find_frame_rate_index(), mpeg_decode_postinit(), mxf_compute_sample_count(), opengl_compute_display_area(), put_videoinfoheader2(), rv20_decode_picture_header(), transcode_init(), and update_sar().
AVRational av_div_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
Divide one rational by another.
b | first rational |
c | second rational |
Definition at line 87 of file rational.c.
Referenced by av_guess_frame_rate(), avi_read_header(), build_frame_code(), config_output(), config_output_props(), config_props(), config_props_output(), and mpeg_decode_postinit().
AVRational av_add_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
Add two rationals.
b | first rational |
c | second rational |
Definition at line 92 of file rational.c.
Referenced by av_sub_q().
AVRational av_sub_q | ( | AVRational | b, |
AVRational | c | ||
) | const |
Subtract one rational from another.
b | first rational |
c | second rational |
Definition at line 100 of file rational.c.
Referenced by ff_mxf_get_samples_per_frame().
|
static |
Invert a rational.
q | value |
Definition at line 133 of file rational.h.
Referenced by av_guess_frame_rate(), avformat_find_stream_info(), avi_read_header(), config_output(), config_props(), configure_input_video_filter(), decode_frame(), dv_extract_video_info(), ea_read_header(), fbdev_read_header(), ff_raw_video_read_header(), ff_rfps_calculate(), find_frame_rate_index(), gdigrab_read_header(), init(), mov_create_timecode_track(), mv_read_header(), mxf_compute_sample_count(), mxf_parse_structural_metadata(), mxf_read_seek(), mxf_write_header(), output_packet(), r3d_read_rdvo(), r3d_seek(), read_header(), rtp_write_header(), smush_read_header(), transcode_init(), txd_read_header(), vfw_read_header(), vivo_read_header(), x11grab_read_header(), and yuv4_read_header().
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 105 of file rational.c.
Referenced by av_get_q(), av_opt_get_q(), av_opt_get_video_rate(), av_opt_set_defaults2(), av_parse_ratio(), config_output_props(), decode_frame(), decode_header(), get_aspect_ratio(), init(), microdvd_read_header(), mov_read_tkhd(), mov_read_trak(), mpeg_decode_postinit(), nuv_header(), opt_list(), read_header(), thp_read_header(), var_read_float(), and write_number().
int av_nearer_q | ( | AVRational | q, |
AVRational | q1, | ||
AVRational | q2 | ||
) |
Definition at line 125 of file rational.c.
Referenced by av_find_nearest_q_idx(), and find_frame_rate_index().
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 140 of file rational.c.
Referenced by ff_mxf_get_samples_per_frame(), and transcode_init().