[FFmpeg-cvslog] eval: add support for pow() function
Stefano Sabatini
git at videolan.org
Tue Jun 7 00:47:48 CEST 2011
ffmpeg | branch: master | Stefano Sabatini <stefano.sabatini-lala at poste.it> | Mon Jun 6 15:00:25 2011 +0200| [d58ed64a8953d07f33259317a2ea5856d0c91dfd] | committer: Stefano Sabatini
eval: add support for pow() function
It is a more search-friendly alternative to the ^ operator.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d58ed64a8953d07f33259317a2ea5856d0c91dfd
---
doc/eval.texi | 4 ++++
libavutil/avutil.h | 2 +-
libavutil/eval.c | 5 +++++
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/doc/eval.texi b/doc/eval.texi
index 25c0ea6..ac27750 100644
--- a/doc/eval.texi
+++ b/doc/eval.texi
@@ -79,6 +79,10 @@ Compute the square root of @var{expr}. This is equivalent to
@item not(expr)
Return 1.0 if @var{expr} is zero, 0.0 otherwise.
+
+ at item pow(x, y)
+Compute the power of @var{x} elevated @var{y}, it is equivalent to
+"(@var{x})^(@var{y})".
@end table
Note that:
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index 1912d20..bd3ff70 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -41,7 +41,7 @@
#define LIBAVUTIL_VERSION_MAJOR 51
#define LIBAVUTIL_VERSION_MINOR 6
-#define LIBAVUTIL_VERSION_MICRO 0
+#define LIBAVUTIL_VERSION_MICRO 1
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
diff --git a/libavutil/eval.c b/libavutil/eval.c
index 3312215..5ae90f0 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -290,6 +290,7 @@ static int parse_primary(AVExpr **e, Parser *p)
else if (strmatch(next, "trunc" )) d->type = e_trunc;
else if (strmatch(next, "sqrt" )) d->type = e_sqrt;
else if (strmatch(next, "not" )) d->type = e_not;
+ else if (strmatch(next, "pow" )) d->type = e_pow;
else {
for (i=0; p->func1_names && p->func1_names[i]; i++) {
if (strmatch(next, p->func1_names[i])) {
@@ -643,6 +644,10 @@ int main(void)
"not(1)",
"not(NAN)",
"not(0)",
+ "pow(0,1.23)",
+ "pow(PI,1.23)",
+ "PI^1.23",
+ "pow(-1,1.23)",
NULL
};
More information about the ffmpeg-cvslog
mailing list