00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00028 #ifndef FFMPEG_RATIONAL_H
00029 #define FFMPEG_RATIONAL_H
00030
00031 #include <stdint.h>
00032
00036 typedef struct AVRational{
00037 int num;
00038 int den;
00039 } AVRational;
00040
00047 static inline int av_cmp_q(AVRational a, AVRational b){
00048 const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
00049
00050 if(tmp) return (tmp>>63)|1;
00051 else return 0;
00052 }
00053
00059 static inline double av_q2d(AVRational a){
00060 return a.num / (double) a.den;
00061 }
00062
00073 int av_reduce(int *dst_nom, int *dst_den, int64_t nom, int64_t den, int64_t max);
00074
00081 AVRational av_mul_q(AVRational b, AVRational c);
00082
00089 AVRational av_div_q(AVRational b, AVRational c);
00090
00097 AVRational av_add_q(AVRational b, AVRational c);
00098
00105 AVRational av_sub_q(AVRational b, AVRational c);
00106
00113 AVRational av_d2q(double d, int max);
00114
00115 #endif