aboutsummaryrefslogtreecommitdiff
path: root/libavutil/mathematics.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavutil/mathematics.c')
-rw-r--r--libavutil/mathematics.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index 9988baae9c..91b76f3aaf 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -136,6 +136,14 @@ int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){
return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF);
}
+int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){
+ int64_t a= tb_a.num * (int64_t)tb_b.den;
+ int64_t b= tb_b.num * (int64_t)tb_a.den;
+ if (av_rescale_rnd(ts_a, a, b, AV_ROUND_DOWN) < ts_b) return -1;
+ if (av_rescale_rnd(ts_b, b, a, AV_ROUND_DOWN) < ts_a) return 1;
+ return 0;
+}
+
#ifdef TEST
#include "integer.h"
#undef printf