Revision 78b01823 libavutil/mathematics.c

View differences:

libavutil/mathematics.c
136 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 147
#ifdef TEST
140 148
#include "integer.h"
141 149
#undef printf

Also available in: Unified diff