Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
1b85ec1e
Commit
1b85ec1e
authored
Mar 06, 2009
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Selftest code.
Originally committed as revision 17844 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
8537591a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
timefilter.c
libavformat/timefilter.c
+48
-0
No files found.
libavformat/timefilter.c
View file @
1b85ec1e
...
...
@@ -72,3 +72,51 @@ double ff_timefilter_update(TimeFilter *self, double system_time, double period)
}
return
self
->
cycle_time
;
}
#ifdef TEST
main
(){
double
n0
,
n1
;
#define SAMPLES 1000
double
ideal
[
SAMPLES
];
double
samples
[
SAMPLES
];
for
(
n0
=
0
;
n0
<
40
;
n0
=
2
*
n0
+
1
){
for
(
n1
=
0
;
n1
<
10
;
n1
=
2
*
n1
+
1
){
double
best_error
=
1000000000
;
double
bestpar0
=
1
;
double
bestpar1
=
0
.
001
;
int
better
,
i
;
srandom
(
123
);
for
(
i
=
0
;
i
<
SAMPLES
;
i
++
){
ideal
[
i
]
=
10
+
i
+
n1
*
i
/
(
1000
);
samples
[
i
]
=
ideal
[
i
]
+
n0
*
(
rand
()
-
RAND_MAX
/
2
)
/
(
RAND_MAX
*
10LL
);
}
do
{
double
par0
,
par1
;
better
=
0
;
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
);
for
(
i
=
0
;
i
<
SAMPLES
;
i
++
){
double
filtered
;
filtered
=
ff_timefilter_update
(
tf
,
samples
[
i
],
1
);
error
+=
(
filtered
-
ideal
[
i
])
*
(
filtered
-
ideal
[
i
]);
}
ff_timefilter_destroy
(
tf
);
if
(
error
<
best_error
){
best_error
=
error
;
bestpar0
=
par0
;
bestpar1
=
par1
;
better
=
1
;
}
}
}
}
while
(
better
);
printf
(
" [%f %f %f]"
,
bestpar0
,
bestpar1
,
best_error
);
}
printf
(
"
\n
"
);
}
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment