diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2009-03-05 23:57:42 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2009-03-05 23:57:42 +0000 |
commit | 28e947e458638aae240677b41905bc75bff725bd (patch) | |
tree | b91dae6fed963793a6bb5c1014d7faffc88c7fdc | |
parent | f982c6d87a34bd33857f9d070c0dafaf91f8071c (diff) | |
download | ffmpeg-28e947e458638aae240677b41905bc75bff725bd.tar.gz |
Reorder operations, 20% improved performance, 1 variable less.
Originally committed as revision 17839 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/timefilter.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libavformat/timefilter.c b/libavformat/timefilter.c index 152f45b1a3..6fdc148d00 100644 --- a/libavformat/timefilter.c +++ b/libavformat/timefilter.c @@ -29,7 +29,6 @@ struct TimeFilter { /// Delay Locked Loop data. These variables refer to mathematical /// concepts described in: http://www.kokkinizita.net/papers/usingdll.pdf double cycle_time; - double next_cycle_time; double feedback2_factor; double feedback3_factor; double integrator2_state; @@ -59,14 +58,14 @@ void ff_timefilter_update(TimeFilter *self, double system_time) if (!self->cycle_time) { /// init loop self->cycle_time = system_time; - self->next_cycle_time = self->cycle_time + self->integrator2_state; } else { + double loop_error; + self->cycle_time+= self->integrator2_state; /// calculate loop error - double loop_error = system_time - self->next_cycle_time; + loop_error = system_time - self->cycle_time; /// update loop - self->cycle_time = self->next_cycle_time; - self->next_cycle_time += self->feedback2_factor * loop_error + self->integrator2_state; + self->cycle_time += self->feedback2_factor * loop_error; self->integrator2_state += self->feedback3_factor * loop_error; } } |