FFmpeg
Loading...
Searching...
No Matches
rational64.c File Reference

64-bit rational numbers More...

#include <limits.h>
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "libavutil/int128.h"
#include "libavutil/intmath.h"
#include "rational64.h"

Go to the source code of this file.

Functions

static av_always_inline uint64_t high64 (av_int128 a)
 
static av_always_inline uint64_t gcd_u64 (uint64_t a, uint64_t b)
 
static av_int128 gcd128 (av_int128 a, av_int128 b)
 
static AVRational64 reduce64 (av_int128 num, av_int128 den)
 
static av_always_inline int fits31 (int64_t x)
 
static av_always_inline int fits31_q (AVRational64 b, AVRational64 c)
 
static AVRational64 reduce64_fast (int64_t num, int64_t den)
 
int ff_cmp_q64 (AVRational64 a, AVRational64 b)
 Compare two 64-bit rationals.
 
AVRational64 ff_mul_q64 (AVRational64 b, AVRational64 c)
 Multiply two 64-bit rationals.
 
AVRational64 ff_div_q64 (AVRational64 b, AVRational64 c)
 Divide one 64-bit rational by another.
 
AVRational64 ff_add_q64 (AVRational64 b, AVRational64 c)
 Add two 64-bit rationals.
 
AVRational64 ff_sub_q64 (AVRational64 b, AVRational64 c)
 Subtract one 64-bit rational from another.
 

Detailed Description

64-bit rational numbers

Author
Niklas Haas

Definition in file rational64.c.

Function Documentation

◆ high64()

static av_always_inline uint64_t high64 ( av_int128 a)
static

Definition at line 37 of file rational64.c.

Referenced by reduce64().

◆ gcd_u64()

static av_always_inline uint64_t gcd_u64 ( uint64_t a,
uint64_t b )
static

Definition at line 43 of file rational64.c.

Referenced by reduce64(), and reduce64_fast().

◆ gcd128()

static av_int128 gcd128 ( av_int128 a,
av_int128 b )
static

Definition at line 61 of file rational64.c.

Referenced by reduce64().

◆ reduce64()

static AVRational64 reduce64 ( av_int128 num,
av_int128 den )
static

Definition at line 71 of file rational64.c.

Referenced by ff_add_q64(), ff_mul_q64(), and ff_sub_q64().

◆ fits31()

static av_always_inline int fits31 ( int64_t x)
static

Definition at line 156 of file rational64.c.

Referenced by fits31_q().

◆ fits31_q()

static av_always_inline int fits31_q ( AVRational64 b,
AVRational64 c )
static

Definition at line 161 of file rational64.c.

Referenced by ff_add_q64(), ff_cmp_q64(), ff_mul_q64(), and ff_sub_q64().

◆ reduce64_fast()

static AVRational64 reduce64_fast ( int64_t num,
int64_t den )
static

Definition at line 167 of file rational64.c.

Referenced by ff_add_q64(), ff_mul_q64(), and ff_sub_q64().