summaryrefslogtreecommitdiff
path: root/src/libffmpeg/libavcodec/rational.h
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2005-04-19 05:16:45 +0000
committerMike Melanson <mike@multimedia.cx>2005-04-19 05:16:45 +0000
commit97c50cb77949856573d7f5f5a3c28cb73e61e011 (patch)
tree2dbabcbb9009b09d66789498ce1d2451a4b39bc0 /src/libffmpeg/libavcodec/rational.h
parent19e7199dad84489aa49e3b2dd5c0e45657ec0fb8 (diff)
downloadxine-lib-97c50cb77949856573d7f5f5a3c28cb73e61e011.tar.gz
xine-lib-97c50cb77949856573d7f5f5a3c28cb73e61e011.tar.bz2
sync to FFmpeg build 4752
CVS patchset: 7463 CVS date: 2005/04/19 05:16:45
Diffstat (limited to 'src/libffmpeg/libavcodec/rational.h')
-rw-r--r--src/libffmpeg/libavcodec/rational.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/libffmpeg/libavcodec/rational.h b/src/libffmpeg/libavcodec/rational.h
index d5fc77f1a..fcda759c4 100644
--- a/src/libffmpeg/libavcodec/rational.h
+++ b/src/libffmpeg/libavcodec/rational.h
@@ -27,19 +27,27 @@
#ifndef RATIONAL_H
#define RATIONAL_H
+/**
+ * Rational number num/den.
+ */
typedef struct AVRational{
- int num;
- int den;
+ int num; ///< numerator
+ int den; ///< denominator
} AVRational;
+/**
+ * returns 0 if a==b, 1 if a>b and -1 if a<b.
+ */
static inline int av_cmp_q(AVRational a, AVRational b){
const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den;
- if (tmp < 0) return -1;
- else if(tmp == 0) return 0;
- else return 1;
+ if(tmp) return (tmp>>63)|1;
+ else return 0;
}
+/**
+ * converts the given AVRational to a double.
+ */
static inline double av_q2d(AVRational a){
return a.num / (double) a.den;
}