annotate lib/libavutil/eval.h @ 2241:9df0477a5e2b

restoring deleted line in mm7_4.cpp
author Grumpy7
date Sun, 23 Feb 2014 18:44:01 +0100
parents 992d2e6f907d
children
rev   line source
2134
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
1 /*
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
2 * Copyright (c) 2002 Michael Niedermayer <michaelni@gmx.at>
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
3 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
4 * This file is part of FFmpeg.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
5 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
10 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
14 * Lesser General Public License for more details.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
15 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
19 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
20
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
21 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
22 * @file
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
23 * simple arithmetic expression evaluator
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
24 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
25
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
26 #ifndef AVUTIL_EVAL_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
27 #define AVUTIL_EVAL_H
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
28
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
29 #include "avutil.h"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
30
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
31 typedef struct AVExpr AVExpr;
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
32
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
33 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
34 * Parse and evaluate an expression.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
35 * Note, this is significantly slower than av_expr_eval().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
36 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
37 * @param res a pointer to a double where is put the result value of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
38 * the expression, or NAN in case of error
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
39 * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
40 * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0}
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
41 * @param const_values a zero terminated array of values for the identifiers from const_names
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
42 * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
43 * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
44 * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
45 * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
46 * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
47 * @param log_ctx parent logging context
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
48 * @return 0 in case of success, a negative value corresponding to an
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
49 * AVERROR code otherwise
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
50 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
51 int av_expr_parse_and_eval(double *res, const char *s,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
52 const char * const *const_names, const double *const_values,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
53 const char * const *func1_names, double (* const *funcs1)(void *, double),
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
54 const char * const *func2_names, double (* const *funcs2)(void *, double, double),
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
55 void *opaque, int log_offset, void *log_ctx);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
56
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
57 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
58 * Parse an expression.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
59 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
60 * @param expr a pointer where is put an AVExpr containing the parsed
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
61 * value in case of successful parsing, or NULL otherwise.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
62 * The pointed to AVExpr must be freed with av_expr_free() by the user
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
63 * when it is not needed anymore.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
64 * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)"
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
65 * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0}
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
66 * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
67 * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
68 * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
69 * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
70 * @param log_ctx parent logging context
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
71 * @return 0 in case of success, a negative value corresponding to an
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
72 * AVERROR code otherwise
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
73 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
74 int av_expr_parse(AVExpr **expr, const char *s,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
75 const char * const *const_names,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
76 const char * const *func1_names, double (* const *funcs1)(void *, double),
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
77 const char * const *func2_names, double (* const *funcs2)(void *, double, double),
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
78 int log_offset, void *log_ctx);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
79
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
80 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
81 * Evaluate a previously parsed expression.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
82 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
83 * @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
84 * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
85 * @return the value of the expression
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
86 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
87 double av_expr_eval(AVExpr *e, const double *const_values, void *opaque);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
88
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
89 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
90 * Free a parsed expression previously created with av_expr_parse().
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
91 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
92 void av_expr_free(AVExpr *e);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
93
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
94 /**
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
95 * Parse the string in numstr and return its value as a double. If
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
96 * the string is empty, contains only whitespaces, or does not contain
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
97 * an initial substring that has the expected syntax for a
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
98 * floating-point number, no conversion is performed. In this case,
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
99 * returns a value of zero and the value returned in tail is the value
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
100 * of numstr.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
101 *
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
102 * @param numstr a string representing a number, may contain one of
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
103 * the International System number postfixes, for example 'K', 'M',
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
104 * 'G'. If 'i' is appended after the postfix, powers of 2 are used
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
105 * instead of powers of 10. The 'B' postfix multiplies the value for
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
106 * 8, and can be appended after another postfix or used alone. This
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
107 * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix.
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
108 * @param tail if non-NULL puts here the pointer to the char next
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
109 * after the last parsed character
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
110 */
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
111 double av_strtod(const char *numstr, char **tail);
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
112
992d2e6f907d preparation for libavcodec
zipi
parents:
diff changeset
113 #endif /* AVUTIL_EVAL_H */