Mercurial > libavutil.hg
diff mathematics.c @ 830:a6eab70dd366 libavutil
av_compare_ts()
author | michael |
---|---|
date | Sun, 07 Feb 2010 16:26:50 +0000 |
parents | fd7a78f003e7 |
children | 4d9ad0ed07d0 |
line wrap: on
line diff
--- a/mathematics.c Sun Jan 31 17:13:57 2010 +0000 +++ b/mathematics.c Sun Feb 07 16:26:50 2010 +0000 @@ -136,6 +136,14 @@ 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