Round toward zero.
Round away from zero.
Round toward -infinity.
Round toward +infinity.
Round to nearest and halfway cases away from zero.
Flag to pass INT64_MIN/MAX through instead of rescaling, this avoids special cases for AV_NOPTS_VALUE.
Definition at line 67 of file mathematics.h.
Trailing zero bit count.
Definition at line 36 of file intmath.c.
Referenced by remove_wasted_bits().
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(), avformat_find_stream_info(), decode_main_header(), dump_stream_format(), eval_expr(), ff_h263_decode_picture_header(), ff_MPV_encode_init(), find_frame_rate_index(), rtp_send_samples(), and xvid_correct_framerate().
Rescale a 64-bit integer with rounding to nearest.
A simple a*b/c isn't possible as it can overflow.
Definition at line 118 of file mathematics.c.
Referenced by asf_build_simple_index(), audio_read_packet(), av_dump_format(), avi_read_header(), compute_pkt_fields(), compute_pkt_fields2(), config_props(), dc1394_read_common(), estimate_timings_from_bit_rate(), ff_gen_search(), ff_pcm_read_seek(), ff_update_cur_dts(), filter_frame(), finalize_packet(), generate_intervals(), get_delay(), get_pcr(), hls_write_packet(), mkv_write_tracks(), mov_build_index(), mov_find_next_sample(), mov_read_mvhd(), mov_write_tapt_tag(), mov_write_tmcd_tag(), mp3_parse_vbr_tags(), mpeg_mux_write_packet(), mpegts_write_header(), mpegts_write_packet_internal(), mpegts_write_pes(), mxf_read_seek(), nsv_parse_NSVs_header(), output_packet(), r3d_read_reda(), rate_emu_sleep(), read_header(), read_xing_toc(), rm_read_header(), sbg_read_header(), sdl_write_header(), seek_frame_internal(), transcode_subtitles(), update_wrap_reference(), vivo_read_header(), and vqf_read_seek().
Rescale a 64-bit integer with specified rounding.
A simple a*b/c isn't possible as it can overflow.
Definition at line 60 of file mathematics.c.
Referenced by av_compare_ts(), av_nearer_q(), av_rescale(), av_rescale_q_rnd(), av_rescale_rnd(), avformat_seek_file(), compute_pkt_fields(), dv_write_pack(), ff_nut_reset_ts(), ff_pcm_read_seek(), filter_frame(), 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(), request_frame(), rtmp_read_seek(), vp8_init(), and vqf_read_seek().
Rescale a 64-bit integer by 2 rational numbers.
Definition at line 130 of file mathematics.c.
Referenced by av_mpeg4_decode_header(), av_rescale_delta(), avcodec_decode_audio4(), avcodec_decode_subtitle2(), avformat_find_stream_info(), avformat_seek_file(), avi_read_packet(), avi_read_seek(), buffer_offset(), caca_write_header(), choose_output(), close_output_stream(), compute_chapters_end(), concat_read_packet(), copy_chapters(), decode_audio(), decode_frame(), decode_video(), display_picref(), do_audio_out(), do_streamcopy(), do_subtitle_out(), do_video_out(), dv_extract_video_info(), dv_read_header(), ff_af_queue_add(), ff_buffersink_read_samples_compat(), ff_dv_offset_reset(), ff_filter_frame_needs_framing(), ff_interleave_add_packet(), ff_interleave_compare_dts(), ff_interleave_new_audio_packet(), 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(), filter_frame(), flush_encoders(), get_subtitle_pkt(), guess_ni_flag(), http_prepare_data(), init(), init_convert_timestamp(), lavfi_read_packet(), main(), microdvd_decode_frame(), mkv_write_chapters(), mov_create_chapter_track(), mov_read_seek(), mov_text_decode_frame(), mov_write_chpl_tag(), mov_write_single_packet(), mp3_parse_vbr_tags(), mpl2_decode_frame(), mxf_parse_structural_metadata(), mxf_read_seek(), ogg_compare_granule(), ogg_write_packet(), output_packet(), parse_forced_key_frames(), plot_spectrum_column(), print_report(), process_input(), push_frame(), push_samples(), r3d_read_rdvo(), r3d_seek(), rawvideo_read_header(), read_from_fifo(), read_header(), reap_filters(), request_frame(), rl2_read_seek(), rtcp_send_sr(), rtp_write_header(), rtsp_read_play(), rtsp_read_seek(), sami_decode_frame(), sbg_read_seek2(), seek_subtitle(), seg_write_packet(), send_silence(), source_request_frame(), srt_decode_frame(), sub2video_heartbeat(), sub2video_update(), text_decode_frame(), transcode_init(), ts_str(), update_stream_timings(), video_thread(), and webvtt_decode_frame().
Rescale a 64-bit integer by 2 rational numbers with specified rounding.
Definition at line 122 of file mathematics.c.
Referenced by av_rescale_delta(), av_rescale_q(), ff_interleave_packet_per_dts(), filter_frame(), parse_packet(), and rtp_write_header().
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 135 of file mathematics.c.
Referenced by check_recording_time(), ff_gen_syncpoint_search(), ff_interleave_compare_dts(), hls_read_packet(), hls_write_packet(), ism_write_packet(), nut_write_packet(), search_hi_lo_keyframes(), seg_write_packet(), and try_filter_frame().
Compare 2 integers modulo mod.
That is we compare integers a and b for which only the least significant log2(mod) bits are known.
Definition at line 145 of file mathematics.c.
Referenced by av_read_frame().
Rescale a timestamp while preserving known durations.
Definition at line 152 of file mathematics.c.
Referenced by decode_audio(), and do_streamcopy().
Compare two rationals.
Definition at line 55 of file rational.h.
Referenced by av_nearer_q(), decode_slice_header(), dump_stream_format(), ff_h263_aspect_to_info(), ff_mxf_get_samples_per_frame(), filter_frame(), find_frame_rate_index(), init_muxer(), mpeg_decode_postinit(), sdl_write_header(), and video_thread().
Convert rational to double.
Definition at line 69 of file rational.h.
Referenced by audio_decode_frame(), av_dump_format(), av_ts_make_time_string(), avformat_find_stream_info(), avi_write_header(), calculate_display_rect(), config_input(), config_output(), config_output_props(), config_props(), configure_input_video_filter(), decode_frame(), decode_syncpoint(), 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_mxf_get_samples_per_frame(), ff_vf_next_put_image(), filter_frame(), flv_write_header(), geq_filter_frame(), get_fps(), get_video_frame(), grab_read_header(), init(), init_muxer(), init_stream(), mkv_write_tracks(), mov_write_tkhd_tag(), mov_write_tmcd_tag(), mov_write_trak_tag(), mpeg1_encode_sequence_header(), mxf_compute_sample_count(), new_video_stream(), output_packet(), pkt_dump_internal(), queue_picture(), read_header(), read_seek(), read_thread(), seg_write_packet(), select_frame(), send_out(), subtitle_thread(), thp_read_header(), transcode_init(), v4l2_read_header(), video_thread(), writer_print_time(), x11grab_read_header(), and x11grab_read_packet().
Reduce a fraction.
This is useful for framerate calculations.
Definition at line 36 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(), avcodec_string(), avformat_find_stream_info(), avi_write_header(), avpriv_set_pts_info(), config_input(), decode_frame(), decode_sequence_header_adv(), dump_stream_format(), dxa_read_header(), ff_audio_resample_init(), ff_MPV_encode_init(), ff_rm_read_mdpr_codecdata(), filter_frame(), h264_slice_header_init(), matroska_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(), show_stream(), skeleton_header(), smacker_read_header(), tmv_read_header(), transcode_init(), vmd_read_header(), X264_init(), and yuv4_read_header().
Multiply two rationals.
Definition at line 80 of file rational.c.
Referenced by av_div_q(), avi_write_header(), config_input(), config_props(), find_frame_rate_index(), mpeg_decode_postinit(), mxf_compute_sample_count(), rv20_decode_picture_header(), and sdl_write_header().
Divide one rational by another.
Definition at line 88 of file rational.c.
Referenced by avi_read_header(), build_frame_code(), config_output(), config_output_props(), config_props_output(), configure_input_video_filter(), and mpeg_decode_postinit().
Add two rationals.
Definition at line 93 of file rational.c.
Referenced by av_sub_q().
Subtract one rational from another.
Definition at line 101 of file rational.c.
Invert a rational.
Definition at line 122 of file rational.h.
Referenced by avformat_find_stream_info(), config_props(), configure_input_video_filter(), ea_read_header(), fbdev_read_header(), ff_raw_video_read_header(), find_frame_rate_index(), init(), mxf_compute_sample_count(), mxf_parse_structural_metadata(), mxf_read_seek(), mxf_write_header(), parse_video_var(), r3d_read_rdvo(), r3d_seek(), transcode_init(), vfw_read_header(), vivo_read_header(), and x11grab_read_header().
Convert a double precision floating point number to a rational.
inf is expressed as {1,0} or {-1,0} depending on the sign.
Definition at line 106 of file rational.c.
Referenced by av_get_q(), av_opt_get_q(), av_opt_set_defaults2(), av_parse_ratio(), config_output_props(), decode_frame(), microdvd_read_header(), mov_read_tkhd(), mov_read_trak(), mpeg_decode_postinit(), nuv_header(), read_header(), thp_read_header(), transcode_init(), var_read_float(), and write_number().
Definition at line 123 of file rational.c.
Referenced by av_find_nearest_q_idx(), and find_frame_rate_index().
Find the nearest value in q_list to q.
Definition at line 138 of file rational.c.
Referenced by transcode_init().