Commit d714edf1 authored by Fabrice Bellard's avatar Fabrice Bellard

optimized ticker_tick() if num is big - please test it (should reduce CPU...

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
parent 5eb765ef
...@@ -22,10 +22,20 @@ static inline int ticker_tick(Ticker *tick, int num) ...@@ -22,10 +22,20 @@ static inline int ticker_tick(Ticker *tick, int num)
int n = num * tick->div; int n = num * tick->div;
tick->value += num * tick->mod; 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) { while (tick->value > 0) {
tick->value -= tick->inrate; tick->value -= tick->inrate;
n++; n++;
} }
#endif
return n; return n;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment