[FFmpeg-cvslog] avutil/mathematics/av_add_stable: avoid unneeded variable

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


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Jun  2 18:00:34 2014 +0200| [5b7519fbaa8f6406d9d796de809ff3bc22060836] | committer: Michael Niedermayer

avutil/mathematics/av_add_stable: avoid unneeded variable

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

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

 libavutil/mathematics.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavutil/mathematics.c b/libavutil/mathematics.c
index 81841f7..48373bf 100644
--- a/libavutil/mathematics.c
+++ b/libavutil/mathematics.c
@@ -188,14 +188,14 @@ simple_round:
 
 int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc)
 {
-    AVRational step = av_mul_q(inc_tb, (AVRational) {inc, 1});
+    inc_tb = av_mul_q(inc_tb, (AVRational) {inc, 1});
 
-    if (av_cmp_q(step, ts_tb) < 0) {
+    if (av_cmp_q(inc_tb, ts_tb) < 0) {
         //increase step is too small for even 1 step to be representable
         return ts;
     } else {
-        int64_t old = av_rescale_q(ts, ts_tb, step);
-        int64_t old_ts = av_rescale_q(old, step, ts_tb);
-        return av_rescale_q(old + 1, step, ts_tb) + (ts - old_ts);
+        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