Mercurial > libavformat.hg
comparison timefilter.c @ 4653:34a843f958b7 libavformat
Merge ff_timefilter_read() and ff_timefilter_update(), this simplifies API and
avoids calling them in the wrong order.
author | michael |
---|---|
date | Fri, 06 Mar 2009 00:14:44 +0000 |
parents | 28b80bbf6288 |
children | d90df812a2a1 |
comparison
equal
deleted
inserted
replaced
4652:28b80bbf6288 | 4653:34a843f958b7 |
---|---|
51 void ff_timefilter_reset(TimeFilter *self) | 51 void ff_timefilter_reset(TimeFilter *self) |
52 { | 52 { |
53 self->cycle_time = 0; | 53 self->cycle_time = 0; |
54 } | 54 } |
55 | 55 |
56 void ff_timefilter_update(TimeFilter *self, double system_time, double period) | 56 double ff_timefilter_update(TimeFilter *self, double system_time, double period) |
57 { | 57 { |
58 if (!self->cycle_time) { | 58 if (!self->cycle_time) { |
59 /// init loop | 59 /// init loop |
60 self->cycle_time = system_time; | 60 self->cycle_time = system_time; |
61 } else { | 61 } else { |
66 | 66 |
67 /// update loop | 67 /// update loop |
68 self->cycle_time += self->feedback2_factor * loop_error; | 68 self->cycle_time += self->feedback2_factor * loop_error; |
69 self->integrator2_state += self->feedback3_factor * loop_error / period; | 69 self->integrator2_state += self->feedback3_factor * loop_error / period; |
70 } | 70 } |
71 } | |
72 | |
73 double ff_timefilter_read(TimeFilter *self) | |
74 { | |
75 return self->cycle_time; | 71 return self->cycle_time; |
76 } | 72 } |