Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
143f1e92
Commit
143f1e92
authored
Jul 01, 2012
by
Martin Storsjö
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eval: Add the isinf() function and tests for it
Signed-off-by:
Martin Storsjö
<
martin@martin.st
>
parent
25accf93
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
2 deletions
+23
-2
eval.texi
doc/eval.texi
+2
-0
avutil.h
libavutil/avutil.h
+1
-1
eval.c
libavutil/eval.c
+8
-1
eval
tests/ref/fate/eval
+12
-0
No files found.
doc/eval.texi
View file @
143f1e92
...
...
@@ -34,6 +34,8 @@ The following functions are available:
@item abs(x)
@item squish(x)
@item gauss(x)
@item isinf(x)
Return 1.0 if @var{x} is +/-INFINITY, 0.0 otherwise.
@item isnan(x)
Return 1.0 if @var{x} is NAN, 0.0 otherwise.
...
...
libavutil/avutil.h
View file @
143f1e92
...
...
@@ -153,7 +153,7 @@
#define LIBAVUTIL_VERSION_MAJOR 51
#define LIBAVUTIL_VERSION_MINOR 34
#define LIBAVUTIL_VERSION_MICRO
0
#define LIBAVUTIL_VERSION_MICRO
1
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
...
...
libavutil/eval.c
View file @
143f1e92
...
...
@@ -120,7 +120,7 @@ static int strmatch(const char *s, const char *prefix)
struct
AVExpr
{
enum
{
e_value
,
e_const
,
e_func0
,
e_func1
,
e_func2
,
e_squish
,
e_gauss
,
e_ld
,
e_isnan
,
e_squish
,
e_gauss
,
e_ld
,
e_isnan
,
e_isinf
,
e_mod
,
e_max
,
e_min
,
e_eq
,
e_gt
,
e_gte
,
e_pow
,
e_mul
,
e_div
,
e_add
,
e_last
,
e_st
,
e_while
,
e_floor
,
e_ceil
,
e_trunc
,
...
...
@@ -148,6 +148,7 @@ static double eval_expr(Parser *p, AVExpr *e)
case
e_gauss
:
{
double
d
=
eval_expr
(
p
,
e
->
param
[
0
]);
return
exp
(
-
d
*
d
/
2
)
/
sqrt
(
2
*
M_PI
);
}
case
e_ld
:
return
e
->
value
*
p
->
var
[
av_clip
(
eval_expr
(
p
,
e
->
param
[
0
]),
0
,
VARS
-
1
)];
case
e_isnan
:
return
e
->
value
*
!!
isnan
(
eval_expr
(
p
,
e
->
param
[
0
]));
case
e_isinf
:
return
e
->
value
*
!!
isinf
(
eval_expr
(
p
,
e
->
param
[
0
]));
case
e_floor
:
return
e
->
value
*
floor
(
eval_expr
(
p
,
e
->
param
[
0
]));
case
e_ceil
:
return
e
->
value
*
ceil
(
eval_expr
(
p
,
e
->
param
[
0
]));
case
e_trunc
:
return
e
->
value
*
trunc
(
eval_expr
(
p
,
e
->
param
[
0
]));
...
...
@@ -282,6 +283,7 @@ static int parse_primary(AVExpr **e, Parser *p)
else
if
(
strmatch
(
next
,
"lt"
))
{
AVExpr
*
tmp
=
d
->
param
[
1
];
d
->
param
[
1
]
=
d
->
param
[
0
];
d
->
param
[
0
]
=
tmp
;
d
->
type
=
e_gte
;
}
else
if
(
strmatch
(
next
,
"ld"
))
d
->
type
=
e_ld
;
else
if
(
strmatch
(
next
,
"isnan"
))
d
->
type
=
e_isnan
;
else
if
(
strmatch
(
next
,
"isinf"
))
d
->
type
=
e_isinf
;
else
if
(
strmatch
(
next
,
"st"
))
d
->
type
=
e_st
;
else
if
(
strmatch
(
next
,
"while"
))
d
->
type
=
e_while
;
else
if
(
strmatch
(
next
,
"floor"
))
d
->
type
=
e_floor
;
...
...
@@ -453,6 +455,7 @@ static int verify_expr(AVExpr *e)
case
e_ld
:
case
e_gauss
:
case
e_isnan
:
case
e_isinf
:
case
e_floor
:
case
e_ceil
:
case
e_trunc
:
...
...
@@ -601,6 +604,10 @@ int main(int argc, char **argv)
"st(0, 1); while(lte(ld(0),100), st(1, ld(1)+ld(0)); st(0, ld(0)+1))"
,
"isnan(1)"
,
"isnan(NAN)"
,
"isnan(INF)"
,
"isinf(1)"
,
"isinf(NAN)"
,
"isinf(INF)"
,
"floor(NAN)"
,
"floor(123.123)"
,
"floor(-123.123)"
,
...
...
tests/ref/fate/eval
View file @
143f1e92
...
...
@@ -112,6 +112,18 @@ Evaluating 'isnan(1)'
Evaluating 'isnan(NAN)'
'isnan(NAN)' -> 1.000000
Evaluating 'isnan(INF)'
'isnan(INF)' -> 0.000000
Evaluating 'isinf(1)'
'isinf(1)' -> 0.000000
Evaluating 'isinf(NAN)'
'isinf(NAN)' -> 0.000000
Evaluating 'isinf(INF)'
'isinf(INF)' -> 1.000000
Evaluating 'floor(NAN)'
'floor(NAN)' -> nan
...
...
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