Mercurial > libavformat.hg
comparison timefilter.c @ 4664:48d9e631f630 libavformat
Add code to the self test to print jitter & drift.
author | michael |
---|---|
date | Fri, 06 Mar 2009 20:48:31 +0000 |
parents | 689b200f207f |
children | aed6cf383ca2 |
comparison
equal
deleted
inserted
replaced
4663:5910b77d9502 | 4664:48d9e631f630 |
---|---|
79 { | 79 { |
80 double n0,n1; | 80 double n0,n1; |
81 #define SAMPLES 1000 | 81 #define SAMPLES 1000 |
82 double ideal[SAMPLES]; | 82 double ideal[SAMPLES]; |
83 double samples[SAMPLES]; | 83 double samples[SAMPLES]; |
84 #if 1 | |
84 for(n0= 0; n0<40; n0=2*n0+1){ | 85 for(n0= 0; n0<40; n0=2*n0+1){ |
85 for(n1= 0; n1<10; n1=2*n1+1){ | 86 for(n1= 0; n1<10; n1=2*n1+1){ |
87 #else | |
88 {{ | |
89 n0=7; | |
90 n1=1; | |
91 #endif | |
86 double best_error= 1000000000; | 92 double best_error= 1000000000; |
87 double bestpar0=1; | 93 double bestpar0=1; |
88 double bestpar1=0.001; | 94 double bestpar1=0.001; |
89 int better, i; | 95 int better, i; |
90 | 96 |
114 better=1; | 120 better=1; |
115 } | 121 } |
116 } | 122 } |
117 } | 123 } |
118 }while(better); | 124 }while(better); |
125 #if 0 | |
126 double lastfil=9; | |
127 TimeFilter *tf= ff_timefilter_new(1, bestpar0, bestpar1); | |
128 for(i=0; i<SAMPLES; i++){ | |
129 double filtered; | |
130 filtered= ff_timefilter_update(tf, samples[i], 1); | |
131 printf("%f %f %f %f\n", i - samples[i] + 10, filtered - samples[i], samples[FFMAX(i, 1)] - samples[FFMAX(i-1, 0)], filtered - lastfil); | |
132 lastfil= filtered; | |
133 } | |
134 ff_timefilter_destroy(tf); | |
135 #else | |
119 printf(" [%f %f %f]", bestpar0, bestpar1, best_error); | 136 printf(" [%f %f %f]", bestpar0, bestpar1, best_error); |
137 #endif | |
120 } | 138 } |
121 printf("\n"); | 139 printf("\n"); |
122 } | 140 } |
123 return 0; | 141 return 0; |
124 } | 142 } |