]> git.sesse.net Git - ffmpeg/commitdiff
avutil/mathematics/av_add_stable: Avoid av_cmp_q() call
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 2 Jun 2014 17:03:55 +0000 (19:03 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 2 Jun 2014 17:06:39 +0000 (19:06 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/mathematics.c

index df7d0d88bf30bde55d0c9752c7ffc1ab39b4e00f..126cffc3f0c95e86ee2e8037bed9c0b6420e6552 100644 (file)
@@ -198,11 +198,10 @@ int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t i
 
     if (m % d == 0)
         return ts + m / d;
-
-    if (av_cmp_q(inc_tb, ts_tb) < 0) {
-        //increase step is too small for even 1 step to be representable
+    if (m < d)
         return ts;
-    } else {
+
+    {
         int64_t old = av_rescale_q(ts, ts_tb, inc_tb);
         int64_t old_ts = av_rescale_q(old, inc_tb, ts_tb);
         return av_rescale_q(old + 1, inc_tb, ts_tb) + (ts - old_ts);