FFmpeg  2.1.1
Data Structures | Macros | Functions
rational.h File Reference

rational numbers More...

#include <stdint.h>
#include <limits.h>
#include "attributes.h"

Go to the source code of this file.

Data Structures

struct  AVRational
 rational number numerator/denominator More...
 

Macros

#define AVUTIL_RATIONAL_H
 

Functions

static int av_cmp_q (AVRational a, AVRational b)
 Compare two rationals. More...
 
static double av_q2d (AVRational a)
 Convert rational to double. More...
 
int av_reduce (int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
 Reduce a fraction. More...
 
AVRational av_mul_q (AVRational b, AVRational c) av_const
 Multiply two rationals. More...
 
AVRational av_div_q (AVRational b, AVRational c) av_const
 Divide one rational by another. More...
 
AVRational av_add_q (AVRational b, AVRational c) av_const
 Add two rationals. More...
 
AVRational av_sub_q (AVRational b, AVRational c) av_const
 Subtract one rational from another. More...
 
static av_always_inline AVRational av_inv_q (AVRational q)
 Invert a rational. More...
 
AVRational av_d2q (double d, int max) av_const
 Convert a double precision floating point number to a rational. More...
 
int av_nearer_q (AVRational q, AVRational q1, AVRational q2)
 
int av_find_nearest_q_idx (AVRational q, const AVRational *q_list)
 Find the nearest value in q_list to q. More...
 

Detailed Description

rational numbers

Author
Michael Niedermayer micha.nosp@m.elni.nosp@m.@gmx..nosp@m.at

Definition in file rational.h.

Macro Definition Documentation

#define AVUTIL_RATIONAL_H

Definition at line 2818 of file avcodec.h.

Function Documentation

static int av_cmp_q ( AVRational  a,
AVRational  b 
)
inlinestatic

Compare two rationals.

Parameters
afirst rational
bsecond rational
Returns
0 if a==b, 1 if a>b, -1 if a<b, and INT_MIN if one of the values is of the form 0/0

Definition at line 55 of file rational.h.

static double av_q2d ( AVRational  a)
inlinestatic

Convert rational to double.

Parameters
arational to convert
Returns
(double) a

Definition at line 69 of file rational.h.

static av_always_inline AVRational av_inv_q ( AVRational  q)
static

Invert a rational.

Parameters
qvalue
Returns
1 / q

Definition at line 122 of file rational.h.