[FFmpeg-devel] [PATCH 11/21] Rename ff_eval2() to ff_parse_and_eval_expr().
Stefano Sabatini
stefano.sabatini-lala
Sun Apr 11 01:01:56 CEST 2010
The new name better expresses what the function does.
---
libavcodec/eval.c | 10 +++++-----
libavcodec/eval.h | 2 +-
libavcodec/opt.c | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/libavcodec/eval.c b/libavcodec/eval.c
index a2af48f..441a239 100644
--- a/libavcodec/eval.c
+++ b/libavcodec/eval.c
@@ -467,7 +467,7 @@ double ff_eval_expr(AVExpr * e, const double *const_value, void *opaque) {
return eval_expr(&p, e);
}
-int ff_eval2(double *res, const char *s, const double *const_value, const char * const *const_name,
+int ff_parse_and_eval_expr(double *res, const char *s, const double *const_value, const char * const *const_name,
double (**func1)(void *, double), const char **func1_name,
double (**func2)(void *, double, double), const char **func2_name,
void *opaque, void *log_ctx){
@@ -498,16 +498,16 @@ int main(void){
int i;
double d;
- ff_eval2(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", const_values, const_names, NULL, NULL, NULL, NULL, NULL, NULL);
+ ff_parse_and_eval_expr(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", const_values, const_names, NULL, NULL, NULL, NULL, NULL, NULL);
printf("%f == 12.7\n", d);
- ff_eval2(&d, "80G/80Gi", const_values, const_names, NULL, NULL, NULL, NULL, NULL, NULL);
+ ff_parse_and_eval_expr(&d, "80G/80Gi", const_values, const_names, NULL, NULL, NULL, NULL, NULL, NULL);
printf("%f == 0.931322575\n", d);
for(i=0; i<1050; i++){
START_TIMER
- ff_eval2(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", const_values, const_names, NULL, NULL, NULL, NULL, NULL, NULL);
- STOP_TIMER("ff_eval2")
+ ff_parse_and_eval_expr(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", const_values, const_names, NULL, NULL, NULL, NULL, NULL, NULL);
+ STOP_TIMER("ff_parse_and_eval_expr")
}
return 0;
}
diff --git a/libavcodec/eval.h b/libavcodec/eval.h
index 3c74ccf..57cff68 100644
--- a/libavcodec/eval.h
+++ b/libavcodec/eval.h
@@ -46,7 +46,7 @@ typedef struct AVExpr AVExpr;
* @return 0 in case of successfull parsing, a negative value
* corresponding to an AVERROR code in case of parsing failure
*/
-int ff_eval2(double *res, const char *s, const double *const_value, const char * const *const_name,
+int ff_parse_and_eval_expr(double *res, const char *s, const double *const_value, const char * const *const_name,
double (**func1)(void *, double), const char **func1_name,
double (**func2)(void *, double, double), const char **func2_name,
void *opaque, void *log_ctx);
diff --git a/libavcodec/opt.c b/libavcodec/opt.c
index 1d97f40..e48dbbe 100644
--- a/libavcodec/opt.c
+++ b/libavcodec/opt.c
@@ -164,7 +164,7 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons
else if(!strcmp(buf, "none" )) d= 0;
else if(!strcmp(buf, "all" )) d= ~0;
else {
- ret = ff_eval2(&d, buf, const_values, const_names, NULL, NULL, NULL, NULL, NULL, obj);
+ ret = ff_parse_and_eval_expr(&d, buf, const_values, const_names, NULL, NULL, NULL, NULL, NULL, obj);
if (isnan(d)) {
av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val);
return AVERROR(EINVAL);
--
1.7.0
More information about the ffmpeg-devel
mailing list