libavutil/rational.h File Reference

Rational numbers. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  AVRational
 Rational number num/den. More...

Functions

static int av_cmp_q (AVRational a, AVRational b)
 Compare two rationals.
static double av_q2d (AVRational a)
 Rational to double conversion.
int av_reduce (int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max)
 Reduce a fraction.
AVRational av_mul_q (AVRational b, AVRational c)
 Multiplies two rationals.
AVRational av_div_q (AVRational b, AVRational c)
 Divides one rational by another.
AVRational av_add_q (AVRational b, AVRational c)
 Adds two rationals.
AVRational av_sub_q (AVRational b, AVRational c)
 Subtracts one rational from another.
AVRational av_d2q (double d, int max)
 Converts a double precision floating point number to a rational.


Detailed Description

Rational numbers.

Author:
Michael Niedermayer <michaelni@gmx.at>

Definition in file rational.h.


Function Documentation

AVRational av_add_q ( AVRational  b,
AVRational  c 
)

Adds two rationals.

Parameters:
b first rational.
c second rational.
Returns:
b+c.

Definition at line 86 of file rational.c.

Referenced by av_sub_q().

static int av_cmp_q ( AVRational  a,
AVRational  b 
) [inline, static]

Compare two rationals.

Parameters:
a first rational
b second rational
Returns:
0 if a==b, 1 if a>b and -1 if a<b.

Definition at line 47 of file rational.h.

Referenced by new_video_stream().

AVRational av_d2q ( double  d,
int  max 
)

Converts a double precision floating point number to a rational.

Parameters:
d double to convert
max the maximum allowed numerator and denominator
Returns:
(AVRational) d.

Definition at line 95 of file rational.c.

Referenced by av_get_q(), av_opt_set_defaults2(), av_parse_video_frame_rate(), av_set_number(), mpeg_decode_postinit(), new_video_stream(), nuv_header(), and thp_read_header().

AVRational av_div_q ( AVRational  b,
AVRational  c 
)

Divides one rational by another.

Parameters:
b first rational.
c second rational.
Returns:
b/c.

Definition at line 82 of file rational.c.

Referenced by avi_read_header(), and mpeg_decode_postinit().

AVRational av_mul_q ( AVRational  b,
AVRational  c 
)

Multiplies two rationals.

Parameters:
b first rational.
c second rational.
Returns:
b*c.

Definition at line 77 of file rational.c.

Referenced by av_div_q(), and mkv_write_tracks().

static double av_q2d ( AVRational  a  )  [inline, static]

int av_reduce ( int *  dst_nom,
int *  dst_den,
int64_t  nom,
int64_t  den,
int64_t  max 
)

Reduce a fraction.

This is useful for framerate calculations.

Parameters:
dst_nom destination numerator
dst_den destination denominator
nom source numerator
den source denominator
max the maximum allowed for dst_nom & dst_den
Returns:
1 if exact, 0 otherwise

Definition at line 35 of file rational.c.

Referenced by asf_read_header(), av_add_q(), av_d2q(), av_find_stream_info(), av_mul_q(), avcodec_string(), decode_slice_header(), dxa_read_header(), matroska_read_header(), mpeg_decode_postinit(), smacker_read_header(), vmd_read_header(), yuv4_generate_header(), and yuv4_read_header().

AVRational av_sub_q ( AVRational  b,
AVRational  c 
)

Subtracts one rational from another.

Parameters:
b first rational.
c second rational.
Returns:
b-c.

Definition at line 91 of file rational.c.

Referenced by new_video_stream().


Generated on Wed Feb 9 19:10:13 2011 for ffmpeg by  doxygen 1.5.6