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
80a49958
Commit
80a49958
authored
Jan 17, 2005
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify
benchmark Originally committed as revision 3844 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
fdb86eb1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
eval.c
libavcodec/eval.c
+15
-14
No files found.
libavcodec/eval.c
View file @
80a49958
...
...
@@ -141,15 +141,11 @@ static double evalPrimary(Parser *p){
return
d
;
}
static
double
evalPow
(
Parser
*
p
){
if
(
p
->
s
[
0
]
==
'+'
)
p
->
s
++
;
if
(
p
->
s
[
0
]
==
'-'
){
p
->
s
++
;
return
-
evalPrimary
(
p
);
}
else
return
evalPrimary
(
p
);
int
sign
=
(
*
p
->
s
==
'+'
)
-
(
*
p
->
s
==
'-'
);
p
->
s
+=
sign
&
1
;
return
(
sign
|
1
)
*
evalPrimary
(
p
);
}
static
double
evalFactor
(
Parser
*
p
){
...
...
@@ -171,17 +167,15 @@ static double evalTerm(Parser *p){
}
static
double
evalExpression
(
Parser
*
p
){
double
ret
;
double
ret
=
0
;
if
(
p
->
stack_index
<=
0
)
//protect against stack overflows
return
NAN
;
p
->
stack_index
--
;
ret
=
evalTerm
(
p
);
while
(
p
->
s
[
0
]
==
'+'
||
p
->
s
[
0
]
==
'-'
){
if
(
*
p
->
s
++
==
'+'
)
ret
+=
evalTerm
(
p
);
else
ret
-=
evalTerm
(
p
);
}
do
{
ret
+=
evalTerm
(
p
);
}
while
(
*
p
->
s
==
'+'
||
*
p
->
s
==
'-'
);
p
->
stack_index
++
;
...
...
@@ -220,6 +214,13 @@ static const char *const_names[]={
0
};
main
(){
int
i
;
printf
(
"%f == 12.7
\n
"
,
ff_eval
(
"1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)"
,
const_values
,
const_names
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
));
for
(
i
=
0
;
i
<
1050
;
i
++
){
START_TIMER
ff_eval
(
"1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)"
,
const_values
,
const_names
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
STOP_TIMER
(
"ff_eval"
)
}
}
#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