]> git.sesse.net Git - ffmpeg/commitdiff
avutil/mathematics/av_add_stable: check for the common case of inc=1
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 2 Jun 2014 16:02:08 +0000 (18:02 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 2 Jun 2014 16:02:27 +0000 (18:02 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/mathematics.c

index 48373bf7597f74432efa2437acadbd814a17dc1c..c8f1e1cd89723e78d401f70b1ddfb80495c3f533 100644 (file)
@@ -188,7 +188,8 @@ simple_round:
 
 int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc)
 {
-    inc_tb = av_mul_q(inc_tb, (AVRational) {inc, 1});
+    if (inc != 1)
+        inc_tb = av_mul_q(inc_tb, (AVRational) {inc, 1});
 
     if (av_cmp_q(inc_tb, ts_tb) < 0) {
         //increase step is too small for even 1 step to be representable