[FFmpeg-cvslog] r17845 - in trunk/libavformat: timefilter.c timefilter.h

michael subversion
Fri Mar 6 01:44:12 CET 2009


Author: michael
Date: Fri Mar  6 01:44:12 2009
New Revision: 17845

Log:
Add clock_period parameter, this should makes the code easier to use.

Modified:
   trunk/libavformat/timefilter.c
   trunk/libavformat/timefilter.h

Modified: trunk/libavformat/timefilter.c
==============================================================================
--- trunk/libavformat/timefilter.c	Fri Mar  6 01:26:51 2009	(r17844)
+++ trunk/libavformat/timefilter.c	Fri Mar  6 01:44:12 2009	(r17845)
@@ -35,10 +35,10 @@ struct TimeFilter {
     int count;
 };
 
-TimeFilter * ff_timefilter_new(double feedback2_factor, double feedback3_factor)
+TimeFilter * ff_timefilter_new(double clock_period, double feedback2_factor, double feedback3_factor)
 {
     TimeFilter *self        = av_mallocz(sizeof(TimeFilter));
-    self->integrator2_state = 1.0;
+    self->integrator2_state = clock_period;
     self->feedback2_factor  = feedback2_factor;
     self->feedback3_factor  = feedback3_factor;
     return self;
@@ -98,7 +98,7 @@ main(){
                 for(par0= bestpar0*0.8; par0<=bestpar0*1.21; par0+=bestpar0*0.05){
                     for(par1= bestpar1*0.8; par1<=bestpar1*1.21; par1+=bestpar1*0.05){
                         double error=0;
-                        TimeFilter *tf= ff_timefilter_new(par0, par1);
+                        TimeFilter *tf= ff_timefilter_new(1, par0, par1);
                         for(i=0; i<SAMPLES; i++){
                             double filtered;
                             filtered=  ff_timefilter_update(tf, samples[i], 1);

Modified: trunk/libavformat/timefilter.h
==============================================================================
--- trunk/libavformat/timefilter.h	Fri Mar  6 01:26:51 2009	(r17844)
+++ trunk/libavformat/timefilter.h	Fri Mar  6 01:44:12 2009	(r17845)
@@ -51,18 +51,22 @@ typedef struct TimeFilter TimeFilter;
  * of the jitter, but also take a longer time for the loop to settle. A good
  * starting point is something between 0.3 and 3 Hz.
  *
+ * @param clock_period period of the hardware clock in seconds
+ *        (for example 1.0/44100)
+ *
  * For more details about these parameters and background concepts please see:
  * http://www.kokkinizita.net/papers/usingdll.pdf
  */
-TimeFilter * ff_timefilter_new(double feedback2_factor, double feedback3_factor);
+TimeFilter * ff_timefilter_new(double clock_period, double feedback2_factor, double feedback3_factor);
 
 /**
  * Update the filter
  *
  * This function must be called in real time, at each process cycle.
  *
- * period is the device cycle duration in seconds. For example, at
- * 44.1Hz and a buffer size of 512 frames, period = 512 / 44100.
+ * @param period the device cycle duration in clock_periods. For example, at
+ * 44.1kHz and a buffer size of 512 frames, period = 512 when clock_period
+ * was 1.0/44100, or 512/44100 if clock_period was 1.
  *
  * system_time, in seconds, should be the value of the system clock time,
  * at (or as close as possible to) the moment the device hardware interrupt




More information about the ffmpeg-cvslog mailing list