Mathematical utilities for working with timestamp and time base.
Rounding methods.
| Enumerator | |
|---|---|
| AV_ROUND_ZERO | Round toward zero. |
| AV_ROUND_INF | Round away from zero. |
| AV_ROUND_DOWN | Round toward -infinity. |
| AV_ROUND_UP | Round toward +infinity. |
| AV_ROUND_NEAR_INF | Round to nearest and halfway cases away from zero. |
| AV_ROUND_PASS_MINMAX | Flag telling rescaling functions to pass Unlike other values of the enumeration AVRounding, this value is a bitmask that must be used in conjunction with another value of the enumeration through a bitwise OR, in order to set behavior for normal cases. // Rescaling 3:
// Calculating 3 * 1 / 2
// 3 / 2 is rounded up to 2
// => 2
// Rescaling AV_NOPTS_VALUE:
// AV_NOPTS_VALUE == INT64_MIN
// AV_NOPTS_VALUE is passed through
// => AV_NOPTS_VALUE
|
Definition at line 79 of file mathematics.h.
Compute the greatest common divisor of two integer operands.
Definition at line 37 of file mathematics.c.
Referenced by av_gcd_q(), av_reduce(), avcodec_string(), config_output(), decode_main_header(), eval_expr(), ff_h263_decode_picture_header(), ff_mpv_encode_init(), ff_parse_specific_params(), ff_put_wav_header(), ff_rfps_add_frame(), ff_tx_decompose_length(), ff_tx_gen_compound_mapping(), main(), mpsub_read_header(), rtp_send_samples(), and xvid_correct_framerate().
Rescale a 64-bit integer with rounding to nearest.
The operation is mathematically equivalent to a * b / c, but writing that directly can overflow.
This function is equivalent to av_rescale_rnd() with AV_ROUND_NEAR_INF.
Definition at line 129 of file mathematics.c.
Referenced by aconfig_props(), activate(), amv_init(), asf_build_simple_index(), asf_read_simple_index(), audio_read_packet(), av_dict_set_fxp(), av_dump_format(), av_q2intfloat(), avi_read_header(), avpriv_update_cur_dts(), calculate_bitrate(), calculate_display_rect(), check_stream_max_drift(), compute_dar(), compute_display_area(), compute_pkt_fields(), compute_texture_rect(), config_comm_output(), config_filter(), config_input(), config_output(), config_props(), create_stream(), dash_read_packet(), dc1394_read_common(), dca_parse(), dxa_read_header(), enable_pcr_generation_for_stream(), estimate_timings_from_bit_rate(), ff_decklink_read_header(), ff_gen_search(), ff_interleave_add_packet(), ff_pcm_read_seek(), ff_rtp_check_and_send_back_rr(), ff_scale_adjust_dimensions(), ff_vorbiscomment_write(), filter(), filter_frame(), finalize_packet(), flv_write_packet(), generate_intervals(), get_aiff_header(), get_delay(), get_edit_list_entry(), get_lin_h(), get_lin_h2(), get_pcr(), get_pts(), get_pts_range(), get_vcd_padding_size(), h264_parse(), ifile_get_packet(), imf_seek(), interpolate(), libaribb24_handle_regions(), mcc_read_header(), mkv_write_info(), mkv_write_track_video(), mov_build_index(), mov_find_next_sample(), mov_flush_fragment(), mov_read_header(), mov_read_sidx(), mov_read_timecode_track(), mov_write_moov_tag(), mov_write_tapt_tag(), mov_write_tkhd_tag(), mov_write_tmcd_tag(), mp3_parse_info_tag(), mp3_parse_vbr_tags(), mp3_seek(), mp3_update_xing(), mpeg_mux_write_packet(), mpegts_init(), mpegts_write_packet_internal(), mpegts_write_pes(), mxf_read_seek(), nsv_parse_NSVs_header(), opengl_compute_display_area(), opus_header(), output_frame(), output_packet(), pad_opencl_config_output(), postProcess_TMPL(), process_subtitle(), process_work_frame(), push_frame(), r3d_read_reda(), read_header(), read_packet(), read_xing_toc(), request_frame(), rescale_mastering_chroma(), rescale_mastering_luma(), rescale_mdcv(), rm_read_header(), sbg_read_header(), sds_read_header(), seek_frame_internal(), select_pcr_streams(), sga_audio_packet(), sga_read_header(), ts_to_samples(), ttml_get_extent(), ttml_get_origin(), update_wrap_reference(), vc2_encode_frame(), video_frame(), vivo_read_header(), vqf_read_seek(), xv_write_header(), and xwma_read_header().
Rescale a 64-bit integer with specified rounding.
The operation is mathematically equivalent to a * b / c, but writing that directly can overflow, and does not support different rounding methods. If the result is not representable then INT64_MIN is returned.
Definition at line 58 of file mathematics.c.
Referenced by aa_read_seek(), aom_init(), argo_brp_read_header(), argo_brp_read_packet(), audio_frame(), av_compare_ts(), av_image_check_sar(), av_nearer_q(), av_rescale(), av_rescale_q_rnd(), av_rescale_rnd(), avformat_seek_file(), calc_max_seg_no(), compute_pkt_fields(), config_input(), dash_read_seek(), dv_write_pack(), enable_pcr_generation_for_stream(), estimate_timings_from_pts(), ff_nut_reset_ts(), ff_pcm_read_seek(), get_out_samples(), 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(), mxf_init(), nut_write_packet(), offset(), rtmp_read_seek(), svs_read_header(), video_frame(), vpx_init(), vqf_read_seek(), write_audio_frame(), and write_time().
Rescale a 64-bit integer by 2 rational numbers.
The operation is mathematically equivalent to a * bq / cq.
This function is equivalent to av_rescale_q_rnd() with AV_ROUND_NEAR_INF.
Definition at line 142 of file mathematics.c.
Referenced by activate(), adjust_frame_pts_to_encoder_tb(), alloc_out_frame(), amv_write_trailer(), asf_write_markers(), audio_frame(), av_add_stable(), av_packet_rescale_ts(), av_rescale_delta(), avcodec_decode_subtitle2(), avf_read_packet(), avformat_find_stream_info(), avformat_seek_file(), avi_read_packet(), avi_read_seek(), avi_write_header(), avisynth_read_packet_audio(), avisynth_read_seek(), caca_write_header(), check_stream_max_drift(), compand_delay(), compand_drain(), compare_ts_with_wrapdetect(), compute_chapters_end(), concat_read_packet(), config_input(), config_output(), copy_chapters(), correct_input_start_times(), create_stream(), cuvid_decode_packet(), cuvid_output_frame(), dash_flush(), dash_write_packet(), dash_write_trailer(), ddagrab_config_props(), dec_enc(), decode(), decode_fctl_chunk(), decode_flush(), decode_frame(), decode_simple_internal(), decode_syncpoint(), decode_video(), decoder_decode_frame(), display_frame(), do_audio_out(), do_morpho(), do_streamcopy(), do_subtitle_out(), draw_spatial(), ff_af_queue_add(), ff_configure_buffers_for_index(), ff_framequeue_skip_samples(), ff_framesync_dualinput_get(), ff_get_muxer_ts_offset(), ff_interleave_packet_per_dts(), ff_mediacodec_dec_send(), ff_qsv_encode(), ff_qsvvpp_filter_frame(), ff_read_packet(), ff_rescale_interval(), ff_samples_to_time_base(), ff_update_link_current_pts(), ff_vorbiscomment_write(), fifo_thread_attempt_recovery(), fill_all_stream_timings(), fill_timing_for_id3_timestamped_stream(), filter_callback(), filter_frame(), find_and_decode_index(), framesync_inject_frame(), get_frag_time(), get_next_nb_samples(), get_pkt_pts(), get_subtitle_pkt(), guess_pkt_duration(), guess_status_pts(), handle_avoid_negative_ts(), hls_read_packet(), imf_read_packet(), init(), init_convert_timestamp(), init_output_stream(), init_output_stream_streamcopy(), interleave_compare_dts(), ism_flush(), kmsgrab_read_header(), libaribb24_decode(), main(), mediacodec_receive(), mediacodec_send(), mediacodec_wrap_hw_buffer(), mediacodec_wrap_sw_buffer(), mf_from_mf_time(), mf_to_mf_time(), mkv_write_block(), mkv_write_chapters(), mkv_write_packet(), mkv_write_track(), mov_create_chapter_track(), mov_create_timecode_track(), mov_get_skip_samples(), mov_preroll_write_stbl_atoms(), mov_read_dops(), mov_read_seek(), mov_read_sidx(), mov_write_chpl_tag(), mov_write_prft_tag(), mov_write_single_packet(), movie_common_init(), mp3_parse_info_tag(), mp3_parse_vbr_tags(), mpeg4_decode_header(), mpegts_write_packet_internal(), mxf_compute_sample_count(), mxf_edit_unit_absolute_offset(), mxf_parse_physical_source_package(), mxf_parse_structural_metadata(), mxf_read_seek(), mxf_set_audio_pts(), mxf_set_current_edit_unit(), next_duration(), ni_prepare_read(), nut_write_packet(), of_output_packet(), ogg_buffer_data(), ogg_compare_granule(), ogg_write_packet_internal(), omx_encode_frame(), output_frame(), overflow_heartbeat(), parse_forced_key_frames(), plot_freqs(), plot_spectrum_column(), process_frame(), process_input_packet(), process_work_frame(), pulse_write_packet(), push_frame(), push_samples(), query_frame(), r3d_read_rdvo(), r3d_seek(), rawvideo_read_header(), read_header(), read_interval_packets(), reap_filters(), request_frame(), rescale_pts(), rl2_read_seek(), rtcp_send_sr(), rtp_mpegts_write_packet(), rtp_parse_one_packet(), rtp_set_prft(), rtsp_read_play(), rtsp_read_seek(), save_subtitle_set(), sbg_read_seek2(), seek_chapter(), seek_subtitle(), seek_to_start(), seg_write_packet(), select_frame(), send_silence(), ser_read_header(), source_request_frame(), sq_set_tb(), sub2video_heartbeat(), sub2video_update(), submit_frame(), teletext_decode_frame(), trigger_fix_sub_duration_heartbeat(), try_push_frame(), ts_discontinuity_detect(), ts_discontinuity_process(), ts_fixup(), ts_str(), update(), update_initial_timestamps(), update_pts(), update_stream_timings(), v4l2_get_pts(), v4l2_set_pts(), video_frame(), viv_read_packet(), viv_read_seek(), webm_chunk_write_packet(), write_audio_frame(), write_chapter(), write_manifest(), write_packet(), and xfade_opencl_config_output().
Rescale a 64-bit integer by 2 rational numbers with specified rounding.
The operation is mathematically equivalent to a * bq / cq.
Definition at line 134 of file mathematics.c.
Referenced by av_rescale_delta(), av_rescale_q(), config_props(), ff_interleave_add_packet(), ff_rescale_interval(), handle_avoid_negative_ts(), init(), lavfi_read_packet(), movie_push_frame(), parse_packet(), read_frame(), rv10_write_header(), send_filter_eof(), ts_discontinuity_detect(), update_eof_pts(), update_stream_timings(), and write_packet_header().
Compare two timestamps each in its own time base.
ts_a is before ts_bts_a is after ts_bint64_t range when represented in the other's timebase. Definition at line 147 of file mathematics.c.
Referenced by chapter_start_cmp(), check_recording_time(), dash_write_packet(), ff_rtp_send_aac(), ff_rtp_send_amr(), ff_rtp_send_xiph(), filter_frame(), finish_stream(), forced_kf_apply(), get_audio_frame(), get_video_frame(), handle_avoid_negative_ts(), hds_write_packet(), hls_write_packet(), ifile_duration_update(), interleave_compare_dts(), ism_write_packet(), main(), mux_frames(), nut_write_packet(), overflow_heartbeat(), packet_after_outpoint(), queue_head_update(), receive_for_stream(), rtp_send_ilbc(), seek_chapter(), seg_write_packet(), and stream_update_ts().
Compare the remainders of two integer operands divided by a common divisor.
In other words, compare the least significant log2(mod) bits of integers a and b.
a % mod < b % moda % mod > b % moda % mod == b % mod Definition at line 160 of file mathematics.c.
Referenced by av_read_frame(), and compare_ts_with_wrapdetect().
Rescale a timestamp while preserving known durations.
This function is designed to be called per audio packet to scale the input timestamp to a different time base. Compared to a simple av_rescale_q() call, this function is robust against possible inconsistent frame durations.
The last parameter is a state variable that must be preserved for all subsequent calls for the same stream. For the first call, *last should be initialized to AV_NOPTS_VALUE.
in_tb and out_tb fs_tb, acting as a state variable out_tbDefinition at line 168 of file mathematics.c.
Referenced by decode_audio(), and do_streamcopy().
Add a value to a timestamp.
This function guarantees that when the same value is repeatly added that no accumulation of rounding errors occurs.
inc Definition at line 191 of file mathematics.c.
Referenced by compute_pkt_fields(), and main().