Revision 2e51dedd

View differences:

libavformat/timefilter.c
31 31
    double cycle_time;
32 32
    double feedback2_factor;
33 33
    double feedback3_factor;
34
    double integrator2_state;
34
    double clock_period;
35 35
    int count;
36 36
};
37 37

  
38 38
TimeFilter * ff_timefilter_new(double clock_period, double feedback2_factor, double feedback3_factor)
39 39
{
40 40
    TimeFilter *self        = av_mallocz(sizeof(TimeFilter));
41
    self->integrator2_state = clock_period;
41
    self->clock_period      = clock_period;
42 42
    self->feedback2_factor  = feedback2_factor;
43 43
    self->feedback3_factor  = feedback3_factor;
44 44
    return self;
......
62 62
        self->cycle_time        = system_time;
63 63
    } else {
64 64
        double loop_error;
65
        self->cycle_time+= self->integrator2_state * period;
65
        self->cycle_time   += self->clock_period * period;
66 66
        /// calculate loop error
67 67
        loop_error = system_time - self->cycle_time;
68 68

  
69 69
        /// update loop
70 70
        self->cycle_time        += FFMAX(self->feedback2_factor, 1.0/(self->count)) * loop_error;
71
        self->integrator2_state += self->feedback3_factor * loop_error / period;
71
        self->clock_period += self->feedback3_factor * loop_error / period;
72 72
    }
73 73
    return self->cycle_time;
74 74
}

Also available in: Unified diff