Revision 32284910

View differences:

libavformat/timefilter.c
35 35
    int count;
36 36
};
37 37

  
38
TimeFilter * ff_timefilter_new(double feedback2_factor, double feedback3_factor)
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 = 1.0;
41
    self->integrator2_state = clock_period;
42 42
    self->feedback2_factor  = feedback2_factor;
43 43
    self->feedback3_factor  = feedback3_factor;
44 44
    return self;
......
98 98
                for(par0= bestpar0*0.8; par0<=bestpar0*1.21; par0+=bestpar0*0.05){
99 99
                    for(par1= bestpar1*0.8; par1<=bestpar1*1.21; par1+=bestpar1*0.05){
100 100
                        double error=0;
101
                        TimeFilter *tf= ff_timefilter_new(par0, par1);
101
                        TimeFilter *tf= ff_timefilter_new(1, par0, par1);
102 102
                        for(i=0; i<SAMPLES; i++){
103 103
                            double filtered;
104 104
                            filtered=  ff_timefilter_update(tf, samples[i], 1);
libavformat/timefilter.h
51 51
 * of the jitter, but also take a longer time for the loop to settle. A good
52 52
 * starting point is something between 0.3 and 3 Hz.
53 53
 *
54
 * @param clock_period period of the hardware clock in seconds
55
 *        (for example 1.0/44100)
56
 *
54 57
 * For more details about these parameters and background concepts please see:
55 58
 * http://www.kokkinizita.net/papers/usingdll.pdf
56 59
 */
57
TimeFilter * ff_timefilter_new(double feedback2_factor, double feedback3_factor);
60
TimeFilter * ff_timefilter_new(double clock_period, double feedback2_factor, double feedback3_factor);
58 61

  
59 62
/**
60 63
 * Update the filter
61 64
 *
62 65
 * This function must be called in real time, at each process cycle.
63 66
 *
64
 * period is the device cycle duration in seconds. For example, at
65
 * 44.1Hz and a buffer size of 512 frames, period = 512 / 44100.
67
 * @param period the device cycle duration in clock_periods. For example, at
68
 * 44.1kHz and a buffer size of 512 frames, period = 512 when clock_period
69
 * was 1.0/44100, or 512/44100 if clock_period was 1.
66 70
 *
67 71
 * system_time, in seconds, should be the value of the system clock time,
68 72
 * at (or as close as possible to) the moment the device hardware interrupt

Also available in: Unified diff