aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2002-06-11 13:23:09 +0000
committerFabrice Bellard <fabrice@bellard.org>2002-06-11 13:23:09 +0000
commitd714edf190413ff34eee7938c51dc9f04a428aa3 (patch)
tree539a60a91481032ba9daa399ac47d8b39a696de2
parent5eb765ef341c3ec1bea31914c897750f88476ede (diff)
downloadffmpeg-d714edf190413ff34eee7938c51dc9f04a428aa3.tar.gz
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
-rw-r--r--libav/tick.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/libav/tick.h b/libav/tick.h
index 46bd865eb5..8a8e42b818 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;
}