FFmpeg
Data Structures | Functions
AVRational64

64-bit extension of AVRational More...

Data Structures

struct  AVRational64
 64-bit Rational number (pair of numerator and denominator). More...
 

Functions

static AVRational64 av_make_q64 (int64_t num, int64_t den)
 Create an AVRational64. More...
 
int av_cmp_q64 (AVRational64 a, AVRational64 b)
 Compare two 64-bit rationals. More...
 
static double av_q2d_64 (AVRational64 a)
 Convert an AVRational64 to a double. More...
 
AVRational64 av_mul_q64 (AVRational64 b, AVRational64 c) av_const
 Multiply two 64-bit rationals. More...
 
AVRational64 av_div_q64 (AVRational64 b, AVRational64 c) av_const
 Divide one 64-bit rational by another. More...
 
AVRational64 av_add_q64 (AVRational64 b, AVRational64 c) av_const
 Add two 64-bit rationals. More...
 
AVRational64 av_sub_q64 (AVRational64 b, AVRational64 c) av_const
 Subtract one 64-bit rational from another. More...
 
static av_always_inline AVRational64 av_inv_q64 (AVRational64 q)
 Invert a 64-bit rational. More...
 
AVRational64 av_gcd_q64 (AVRational64 a, AVRational64 b, int max_den, AVRational64 def)
 Return the best rational so that a and b are multiple of it. More...
 

Detailed Description

64-bit extension of AVRational

Offers a 64-bit extended version of AVRational. This is less efficient (and may revolve around emulated 128-bit multiplications internally), but allows to represent a much larger range of rational numbers without overflow.

Function Documentation

◆ av_make_q64()

static AVRational64 av_make_q64 ( int64_t  num,
int64_t  den 
)
inlinestatic

Create an AVRational64.

Useful for compilers that do not support compound literals.

Note
The return value is not reduced.

Definition at line 64 of file rational64.h.

Referenced by ff_sws_apply_op_q().

◆ av_cmp_q64()

int av_cmp_q64 ( AVRational64  a,
AVRational64  b 
)

Compare two 64-bit rationals.

Parameters
aFirst rational
bSecond rational
Returns
One of the following values:
  • 0 if a == b
  • 1 if a > b
  • -1 if a < b
  • INT_MIN if one of the values is of the form 0 / 0

Definition at line 108 of file rational64.c.

Referenced by av_max_q64(), av_min_q64(), extract_scalar(), ff_sws_linear_mask(), ff_sws_op_list_optimize(), ff_sws_op_list_update_comps(), main(), and op_commute_swizzle().

◆ av_q2d_64()

static double av_q2d_64 ( AVRational64  a)
inlinestatic

Convert an AVRational64 to a double.

Parameters
aAVRational64 to convert
Returns
a in floating-point form
See also
av_d2q()

Definition at line 90 of file rational64.h.

Referenced by main(), and print_q().

◆ av_mul_q64()

AVRational64 av_mul_q64 ( AVRational64  b,
AVRational64  c 
) const

Multiply two 64-bit rationals.

Parameters
bFirst multiplicant
cSecond multiplicant
Returns
b*c

Definition at line 124 of file rational64.c.

Referenced by apply_filter_weights(), av_div_q64(), ff_sws_apply_op_q(), ff_sws_op_list_optimize(), ff_sws_op_list_update_comps(), and main().

◆ av_div_q64()

AVRational64 av_div_q64 ( AVRational64  b,
AVRational64  c 
) const

Divide one 64-bit rational by another.

Parameters
bDividend
cDivisor
Returns
b/c

Definition at line 130 of file rational64.c.

Referenced by main().

◆ av_add_q64()

AVRational64 av_add_q64 ( AVRational64  b,
AVRational64  c 
) const

Add two 64-bit rationals.

Parameters
bFirst addend
cSecond addend
Returns
b+c

Definition at line 135 of file rational64.c.

Referenced by apply_filter_weights(), ff_sws_apply_op_q(), ff_sws_op_list_optimize(), ff_sws_op_list_update_comps(), and main().

◆ av_sub_q64()

AVRational64 av_sub_q64 ( AVRational64  b,
AVRational64  c 
) const

Subtract one 64-bit rational from another.

Parameters
bMinuend
cSubtrahend
Returns
b-c

Definition at line 141 of file rational64.c.

Referenced by main().

◆ av_inv_q64()

static av_always_inline AVRational64 av_inv_q64 ( AVRational64  q)
static

Invert a 64-bit rational.

Parameters
qvalue
Returns
1 / q

Definition at line 131 of file rational64.h.

Referenced by av_div_q64().

◆ av_gcd_q64()

AVRational64 av_gcd_q64 ( AVRational64  a,
AVRational64  b,
int  max_den,
AVRational64  def 
)

Return the best rational so that a and b are multiple of it.

If the resulting denominator is larger than max_den, return def.