libavcodec/eval.h File Reference

simple arithmetic expression evaluator More...

Go to the source code of this file.

Typedefs

typedef struct AVExpr AVExpr

Functions

double ff_parse_and_eval_expr (const char *s, const double *const_value, const char *const *const_name, double(*const *func1)(void *, double), const char *const *func1_name, double(*const *func2)(void *, double, double), const char *const *func2_name, void *opaque, const char **error)
 Parses and evaluates an expression.
AVExprff_parse_expr (const char *s, const char *const *const_name, double(*const *func1)(void *, double), const char *const *func1_name, double(*const *func2)(void *, double, double), const char *const *func2_name, const char **error)
 Parses an expression.
double ff_eval_expr (AVExpr *e, const double *const_value, void *opaque)
 Evaluates a previously parsed expression.
void ff_free_expr (AVExpr *e)
 Frees a parsed expression previously created with ff_parse().
double av_strtod (const char *numstr, char **tail)
 Parses the string in numstr and returns its value as a double.


Detailed Description

simple arithmetic expression evaluator

Definition in file eval.h.


Typedef Documentation

typedef struct AVExpr AVExpr

Definition at line 29 of file eval.h.


Function Documentation

double av_strtod ( const char *  numstr,
char **  tail 
)

Parses the string in numstr and returns its value as a double.

If the string is empty, contains only whitespaces, or does not contain an initial substring that has the expected syntax for a floating-point number, no conversion is performed. In this case, returns a value of zero and the value returned in tail is the value of numstr.

Parameters:
numstr a string representing a number, may contain one of the International System number postfixes, for example 'K', 'M', 'G'. If 'i' is appended after the postfix, powers of 2 are used instead of powers of 10. The 'B' postfix multiplies the value for 8, and can be appended after another postfix or used alone. This allows using for example 'KB', 'MiB', 'G' and 'B' as postfix.
tail if non-NULL puts here the pointer to the char next after the last parsed character

Definition at line 70 of file eval.c.

Referenced by parse_primary().

double ff_eval_expr ( AVExpr e,
const double *  const_value,
void *  opaque 
)

Evaluates a previously parsed expression.

Parameters:
const_value a zero terminated array of values for the identifers from ff_parse const_name
opaque a pointer which will be passed to all functions from func1 and func2
Returns:
the value of the expression

Definition at line 407 of file eval.c.

Referenced by ff_parse_and_eval_expr(), and get_qscale().

void ff_free_expr ( AVExpr e  ) 

Frees a parsed expression previously created with ff_parse().

Definition at line 168 of file eval.c.

Referenced by ff_free_expr(), ff_parse_and_eval_expr(), ff_parse_expr(), ff_rate_control_uninit(), and parse_primary().

double ff_parse_and_eval_expr ( const char *  s,
const double *  const_value,
const char *const *  const_name,
double(**)(void *, double)  func1,
const char *const *  func1_name,
double(**)(void *, double, double)  func2,
const char *const *  func2_name,
void *  opaque,
const char **  error 
)

Parses and evaluates an expression.

Note, this is significantly slower than ff_eval_expr().

Parameters:
s expression as a zero terminated string for example "1+2^3+5*5+sin(2/3)"
func1 NULL terminated array of function pointers for functions which take 1 argument
func2 NULL terminated array of function pointers for functions which take 2 arguments
const_name NULL terminated array of zero terminated strings of constant identifers for example {"PI", "E", 0}
func1_name NULL terminated array of zero terminated strings of func1 identifers
func2_name NULL terminated array of zero terminated strings of func2 identifers
error pointer to a char* which is set to an error message if something goes wrong
const_value a zero terminated array of values for the identifers from const_name
opaque a pointer which will be passed to all functions from func1 and func2
Returns:
the value of the expression

Definition at line 415 of file eval.c.

Referenced by av_set_string3().

AVExpr* ff_parse_expr ( const char *  s,
const char *const *  const_name,
double(**)(void *, double)  func1,
const char *const *  func1_name,
double(**)(void *, double, double)  func2,
const char *const *  func2_name,
const char **  error 
)

Parses an expression.

Parameters:
s expression as a zero terminated string for example "1+2^3+5*5+sin(2/3)"
func1 NULL terminated array of function pointers for functions which take 1 argument
func2 NULL terminated array of function pointers for functions which take 2 arguments
const_name NULL terminated array of zero terminated strings of constant identifers for example {"PI", "E", 0}
func1_name NULL terminated array of zero terminated strings of func1 identifers
func2_name NULL terminated array of zero terminated strings of func2 identifers
error pointer to a char* which is set to an error message if something goes wrong
Returns:
AVExpr which must be freed with ff_free_expr() by the user when it is not needed anymore NULL if anything went wrong

Definition at line 372 of file eval.c.

Referenced by ff_parse_and_eval_expr(), and ff_rate_control_init().


Generated on Fri Oct 26 02:36:51 2012 for FFmpeg by  doxygen 1.5.8