[FFmpeg-cvslog] avutil/mathematics/av_add_stable: check for the common case of inc=1

Michael Niedermayer git at videolan.org
Mon Jun 2 19:18:25 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Jun  2 18:02:08 2014 +0200| [4956d0e5a6a555d31345c913485bcc4e0a53481e] | committer: Michael Niedermayer

avutil/mathematics/av_add_stable: check for the common case of inc=1

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4956d0e5a6a555d31345c913485bcc4e0a53481e
---

 libavutil/mathematics.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index 48373bf..c8f1e1c 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -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



More information about the ffmpeg-cvslog mailing list