[FFmpeg-cvslog] avutil/mathematics/av_add_stable: Avoid av_cmp_q() call

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 19:03:55 2014 +0200| [666e29fe9e7eb9a87eb870f0e6d68331c0615d43] | committer: Michael Niedermayer

avutil/mathematics/av_add_stable: Avoid av_cmp_q() call

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

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

 libavutil/mathematics.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index df7d0d8..126cffc 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -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);



More information about the ffmpeg-cvslog mailing list