Mercurial > libavutil.hg
comparison mathematics.c @ 830:a6eab70dd366 libavutil
av_compare_ts()
author | michael |
---|---|
date | Sun, 07 Feb 2010 16:26:50 +0000 |
parents | fd7a78f003e7 |
children | 4d9ad0ed07d0 |
comparison
equal
deleted
inserted
replaced
829:bd84e0b5d422 | 830:a6eab70dd366 |
---|---|
134 int64_t b= bq.num * (int64_t)cq.den; | 134 int64_t b= bq.num * (int64_t)cq.den; |
135 int64_t c= cq.num * (int64_t)bq.den; | 135 int64_t c= cq.num * (int64_t)bq.den; |
136 return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); | 136 return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); |
137 } | 137 } |
138 | 138 |
139 int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){ | |
140 int64_t a= tb_a.num * (int64_t)tb_b.den; | |
141 int64_t b= tb_b.num * (int64_t)tb_a.den; | |
142 if (av_rescale_rnd(ts_a, a, b, AV_ROUND_DOWN) < ts_b) return -1; | |
143 if (av_rescale_rnd(ts_b, b, a, AV_ROUND_DOWN) < ts_a) return 1; | |
144 return 0; | |
145 } | |
146 | |
139 #ifdef TEST | 147 #ifdef TEST |
140 #include "integer.h" | 148 #include "integer.h" |
141 #undef printf | 149 #undef printf |
142 int main(void){ | 150 int main(void){ |
143 int64_t a,b,c,d,e; | 151 int64_t a,b,c,d,e; |