[SCM] libav/experimental: optimized ticker_tick() if num is big - please test it (should reduce CPU usage - this code is temporary before new PTS handling scheme)

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 15:32:25 UTC 2013


The following commit has been merged in the experimental branch:
commit d714edf190413ff34eee7938c51dc9f04a428aa3
Author: Fabrice Bellard <fabrice at bellard.org>
Date:   Tue Jun 11 13:23:09 2002 +0000

    optimized ticker_tick() if num is big - please test it (should reduce CPU usage - this code is temporary before new PTS handling scheme)
    
    Originally committed as revision 681 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libav/tick.h b/libav/tick.h
index 46bd865..8a8e42b 100644
--- a/libav/tick.h
+++ b/libav/tick.h
@@ -22,10 +22,20 @@ static inline int ticker_tick(Ticker *tick, int num)
     int n = num * tick->div;
 
     tick->value += num * tick->mod;
+#if 1
+    if (tick->value > 0) {
+        n += (tick->value / tick->inrate);
+        tick->value = tick->value % tick->inrate;
+        if (tick->value > 0) {
+            tick->value -= tick->inrate;
+            n++;
+        }
+    }
+#else
     while (tick->value > 0) {
         tick->value -= tick->inrate;
         n++;
     }
-
+#endif
     return n;
 }

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list