#include <stdint.h>
#include <math.h>
#include "attributes.h"
#include "rational.h"
Go to the source code of this file.
Defines | |
#define | M_E 2.7182818284590452354 |
#define | M_LN2 0.69314718055994530942 |
#define | M_LN10 2.30258509299404568402 |
#define | M_LOG2_10 3.32192809488736234787 |
#define | M_PHI 1.61803398874989484820 |
#define | M_PI 3.14159265358979323846 |
#define | M_SQRT1_2 0.70710678118654752440 |
#define | M_SQRT2 1.41421356237309504880 |
#define | NAN (0.0/0.0) |
#define | INFINITY (1.0/0.0) |
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. |
#define INFINITY (1.0/0.0) |
Definition at line 57 of file mathematics.h.
Referenced by av_dbl2ext(), codebook_trellis_rate(), encode_window_bands_info(), get_exponent_dynamic(), parse_options(), quantize_and_encode_band(), search_for_ms(), search_for_quantizers_anmr(), search_for_quantizers_faac(), and search_for_quantizers_twoloop().
#define M_E 2.7182818284590452354 |
Definition at line 30 of file mathematics.h.
Referenced by config(), config_input(), config_input_overlay(), config_output_props(), config_props(), get_qscale(), init(), and put_image().
#define M_LN10 2.30258509299404568402 |
Definition at line 36 of file mathematics.h.
Referenced by acelp_decode_gain_codef(), calc_input_response(), decode_frame(), ff_acelp_decode_gain_code(), and ff_sipr_decode_frame_16k().
#define M_LN2 0.69314718055994530942 |
Definition at line 33 of file mathematics.h.
Referenced by decode_frame(), encode_block(), encode_init(), and ff_sipr_decode_frame_16k().
#define M_LOG2_10 3.32192809488736234787 |
#define M_PHI 1.61803398874989484820 |
Definition at line 42 of file mathematics.h.
Referenced by config_input(), config_input_overlay(), config_output_props(), config_props(), and init().
#define M_PI 3.14159265358979323846 |
Definition at line 45 of file mathematics.h.
#define M_SQRT1_2 0.70710678118654752440 |
Definition at line 48 of file mathematics.h.
Referenced by dca_decode_frame(), dca_filter_channels(), nelly_decode_block(), and ps_tableinit().
#define M_SQRT2 1.41421356237309504880 |
#define NAN (0.0/0.0) |
Definition at line 54 of file mathematics.h.
Referenced by av_expr_parse_and_eval(), av_ext2dbl(), av_get_double(), av_int2dbl(), av_int2flt(), config_input(), config_props(), eval_expr(), init(), select_frame(), and start_frame().
enum AVRounding |
Definition at line 60 of file mathematics.h.
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 ff_gen_syncpoint_search(), ff_interleave_compare_dts(), search_hi_lo_keyframes(), and transcode().
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(), ff_parse_specific_params(), h263_decode_picture_header(), init(), and MPV_encode_init().
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(), av_dump_format(), av_estimate_timings_from_bit_rate(), av_gen_search(), av_seek_frame(), av_update_cur_dts(), avi_read_header(), compute_pkt_fields(), compute_pkt_fields2(), config_props(), dc1394_read_header(), finalize_packet(), 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(), 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_update_stream_timings(), avformat_find_stream_info(), avi_read_packet(), avi_read_seek(), compute_chapters_end(), copy_chapters(), decode_frame(), do_audio_out(), do_subtitle_out(), do_video_out(), dv_extract_video_info(), dv_offset_reset(), dv_read_header(), ff_interleave_new_audio_packet(), ff_write_chained(), fill_all_stream_timings(), get_subtitle_pkt(), http_prepare_data(), main(), mkv_write_chapters(), mov_create_chapter_track(), mov_read_seek(), mov_write_chpl_tag(), mp3_parse_vbr_tags(), ogg_compare_granule(), 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(), 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(), pcm_read_seek(), read_seek2(), rtmp_read_seek(), rtp_write_header(), vp8_init(), vqf_read_seek(), and write_packet().