summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libavcodec/Makefile1
-rw-r--r--libavcodec/avcodec.h2
-rw-r--r--libavcodec/opt.c4
-rw-r--r--libavcodec/ratecontrol.c8
-rw-r--r--libavcodec/ratecontrol.h2
-rw-r--r--libavutil/Makefile2
-rw-r--r--libavutil/avutil.h2
-rw-r--r--libavutil/eval.c (renamed from libavcodec/eval.c)62
-rw-r--r--libavutil/eval.h (renamed from libavcodec/eval.h)22
9 files changed, 53 insertions, 52 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 268e13f..376ba67 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -11,7 +11,6 @@ OBJS = allcodecs.o \
bitstream.o \
bitstream_filter.o \
dsputil.o \
- eval.o \
faanidct.o \
imgconvert.o \
jrevdct.o \
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 432d2e6..a878319 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -31,7 +31,7 @@
#define LIBAVCODEC_VERSION_MAJOR 52
#define LIBAVCODEC_VERSION_MINOR 74
-#define LIBAVCODEC_VERSION_MICRO 0
+#define LIBAVCODEC_VERSION_MICRO 1
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
diff --git a/libavcodec/opt.c b/libavcodec/opt.c
index 8473d90..128d95d 100644
--- a/libavcodec/opt.c
+++ b/libavcodec/opt.c
@@ -27,7 +27,7 @@
#include "avcodec.h"
#include "opt.h"
-#include "eval.h"
+#include "libavutil/eval.h"
//FIXME order them and do a bin search
const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mask, int flags){
@@ -165,7 +165,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 {
- int res = ff_parse_and_eval_expr(&d, buf, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, obj);
+ int res = av_parse_and_eval_expr(&d, buf, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, obj);
if (res < 0) {
av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val);
return res;
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index 375815a..4261678 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -30,7 +30,7 @@
#include "dsputil.h"
#include "ratecontrol.h"
#include "mpegvideo.h"
-#include "eval.h"
+#include "libavutil/eval.h"
#undef NDEBUG // Always check asserts, the speed effect is far too small to disable them.
#include <assert.h>
@@ -106,7 +106,7 @@ int ff_rate_control_init(MpegEncContext *s)
};
emms_c();
- res = ff_parse_expr(&rcc->rc_eq_eval, s->avctx->rc_eq ? s->avctx->rc_eq : "tex^qComp", const_names, func1_names, func1, NULL, NULL, 0, s->avctx);
+ res = av_parse_expr(&rcc->rc_eq_eval, s->avctx->rc_eq ? s->avctx->rc_eq : "tex^qComp", const_names, func1_names, func1, NULL, NULL, 0, s->avctx);
if (res < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Error parsing rc_eq \"%s\"\n", s->avctx->rc_eq);
return res;
@@ -254,7 +254,7 @@ void ff_rate_control_uninit(MpegEncContext *s)
RateControlContext *rcc= &s->rc_context;
emms_c();
- ff_free_expr(rcc->rc_eq_eval);
+ av_free_expr(rcc->rc_eq_eval);
av_freep(&rcc->entry);
#if CONFIG_LIBXVID
@@ -338,7 +338,7 @@ static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_f
0
};
- bits= ff_eval_expr(rcc->rc_eq_eval, const_values, rce);
+ bits = av_eval_expr(rcc->rc_eq_eval, const_values, rce);
if (isnan(bits)) {
av_log(s->avctx, AV_LOG_ERROR, "Error evaluating rc_eq \"%s\"\n", s->avctx->rc_eq);
return -1;
diff --git a/libavcodec/ratecontrol.h b/libavcodec/ratecontrol.h
index d5fe2bc..32efe01 100644
--- a/libavcodec/ratecontrol.h
+++ b/libavcodec/ratecontrol.h
@@ -30,7 +30,7 @@
#include <stdio.h>
#include <stdint.h>
-#include "eval.h"
+#include "libavutil/eval.h"
typedef struct Predictor{
double coeff;
diff --git a/libavutil/Makefile b/libavutil/Makefile
index 6035ba6..f6961ac 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -10,6 +10,7 @@ HEADERS = adler32.h \
common.h \
crc.h \
error.h \
+ eval.h \
fifo.h \
intfloat_readwrite.h \
log.h \
@@ -32,6 +33,7 @@ OBJS = adler32.o \
crc.o \
des.o \
error.o \
+ eval.o \
fifo.o \
intfloat_readwrite.o \
lfg.o \
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index b23f42f..663b386 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -40,7 +40,7 @@
#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
#define LIBAVUTIL_VERSION_MAJOR 50
-#define LIBAVUTIL_VERSION_MINOR 17
+#define LIBAVUTIL_VERSION_MINOR 18
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
diff --git a/libavcodec/eval.c b/libavutil/eval.c
index 2a8fc44..59ebd94 100644
--- a/libavcodec/eval.c
+++ b/libavutil/eval.c
@@ -171,11 +171,11 @@ static double eval_expr(Parser *p, AVExpr *e)
static int parse_expr(AVExpr **e, Parser *p);
-void ff_free_expr(AVExpr *e)
+void av_free_expr(AVExpr *e)
{
if (!e) return;
- ff_free_expr(e->param[0]);
- ff_free_expr(e->param[1]);
+ av_free_expr(e->param[0]);
+ av_free_expr(e->param[1]);
av_freep(&e);
}
@@ -213,7 +213,7 @@ static int parse_primary(AVExpr **e, Parser *p)
if (p->s==NULL) {
av_log(p, AV_LOG_ERROR, "undefined constant or missing (\n");
p->s= next;
- ff_free_expr(d);
+ av_free_expr(d);
return AVERROR(EINVAL);
}
p->s++; // "("
@@ -223,7 +223,7 @@ static int parse_primary(AVExpr **e, Parser *p)
return ret;
if (p->s[0] != ')') {
av_log(p, AV_LOG_ERROR, "missing )\n");
- ff_free_expr(d);
+ av_free_expr(d);
return AVERROR(EINVAL);
}
p->s++; // ")"
@@ -231,7 +231,7 @@ static int parse_primary(AVExpr **e, Parser *p)
return 0;
}
if ((ret = parse_expr(&(d->param[0]), p)) < 0) {
- ff_free_expr(d);
+ av_free_expr(d);
return ret;
}
if (p->s[0]== ',') {
@@ -240,7 +240,7 @@ static int parse_primary(AVExpr **e, Parser *p)
}
if (p->s[0] != ')') {
av_log(p, AV_LOG_ERROR, "missing )\n");
- ff_free_expr(d);
+ av_free_expr(d);
return AVERROR(EINVAL);
}
p->s++; // ")"
@@ -291,7 +291,7 @@ static int parse_primary(AVExpr **e, Parser *p)
}
av_log(p, AV_LOG_ERROR, "unknown function\n");
- ff_free_expr(d);
+ av_free_expr(d);
return AVERROR(EINVAL);
}
@@ -328,13 +328,13 @@ static int parse_factor(AVExpr **e, Parser *p)
e1 = e0;
p->s++;
if ((ret = parse_pow(&e2, p, &sign2)) < 0) {
- ff_free_expr(e1);
+ av_free_expr(e1);
return ret;
}
e0 = new_eval_expr(e_pow, 1, e1, e2);
if (!e0) {
- ff_free_expr(e1);
- ff_free_expr(e2);
+ av_free_expr(e1);
+ av_free_expr(e2);
return AVERROR(ENOMEM);
}
if (e0->param[1]) e0->param[1]->value *= (sign2|1);
@@ -355,13 +355,13 @@ static int parse_term(AVExpr **e, Parser *p)
int c= *p->s++;
e1 = e0;
if ((ret = parse_factor(&e2, p)) < 0) {
- ff_free_expr(e1);
+ av_free_expr(e1);
return ret;
}
e0 = new_eval_expr(c == '*' ? e_mul : e_div, 1, e1, e2);
if (!e0) {
- ff_free_expr(e1);
- ff_free_expr(e2);
+ av_free_expr(e1);
+ av_free_expr(e2);
return AVERROR(ENOMEM);
}
}
@@ -378,13 +378,13 @@ static int parse_subexpr(AVExpr **e, Parser *p)
while (*p->s == '+' || *p->s == '-') {
e1 = e0;
if ((ret = parse_term(&e2, p)) < 0) {
- ff_free_expr(e1);
+ av_free_expr(e1);
return ret;
}
e0 = new_eval_expr(e_add, 1, e1, e2);
if (!e0) {
- ff_free_expr(e1);
- ff_free_expr(e2);
+ av_free_expr(e1);
+ av_free_expr(e2);
return AVERROR(ENOMEM);
}
};
@@ -406,14 +406,14 @@ static int parse_expr(AVExpr **e, Parser *p)
while (*p->s == ';') {
e1 = e0;
if ((ret = parse_subexpr(&e2, p)) < 0) {
- ff_free_expr(e1);
+ av_free_expr(e1);
return ret;
}
p->s++;
e0 = new_eval_expr(e_last, 1, e1, e2);
if (!e0) {
- ff_free_expr(e1);
- ff_free_expr(e2);
+ av_free_expr(e1);
+ av_free_expr(e2);
return AVERROR(ENOMEM);
}
};
@@ -438,7 +438,7 @@ static int verify_expr(AVExpr *e)
}
}
-int ff_parse_expr(AVExpr **expr, const char *s,
+int av_parse_expr(AVExpr **expr, const char *s,
const char * const *const_names,
const char * const *func1_names, double (* const *funcs1)(void *, double),
const char * const *func2_names, double (* const *funcs2)(void *, double, double),
@@ -471,7 +471,7 @@ int ff_parse_expr(AVExpr **expr, const char *s,
if ((ret = parse_expr(&e, &p)) < 0)
goto end;
if (!verify_expr(e)) {
- ff_free_expr(e);
+ av_free_expr(e);
ret = AVERROR(EINVAL);
goto end;
}
@@ -481,7 +481,7 @@ end:
return ret;
}
-double ff_eval_expr(AVExpr *e, const double *const_values, void *opaque)
+double av_eval_expr(AVExpr *e, const double *const_values, void *opaque)
{
Parser p;
@@ -490,21 +490,21 @@ double ff_eval_expr(AVExpr *e, const double *const_values, void *opaque)
return eval_expr(&p, e);
}
-int ff_parse_and_eval_expr(double *d, const char *s,
+int av_parse_and_eval_expr(double *d, const char *s,
const char * const *const_names, const double *const_values,
const char * const *func1_names, double (* const *funcs1)(void *, double),
const char * const *func2_names, double (* const *funcs2)(void *, double, double),
void *opaque, int log_offset, void *log_ctx)
{
AVExpr *e = NULL;
- int ret = ff_parse_expr(&e, s, const_names, func1_names, funcs1, func2_names, funcs2, log_offset, log_ctx);
+ int ret = av_parse_expr(&e, s, const_names, func1_names, funcs1, func2_names, funcs2, log_offset, log_ctx);
if (ret < 0) {
*d = NAN;
return ret;
}
- *d = ff_eval_expr(e, const_values, opaque);
- ff_free_expr(e);
+ *d = av_eval_expr(e, const_values, opaque);
+ av_free_expr(e);
return isnan(*d) ? AVERROR(EINVAL) : 0;
}
@@ -526,21 +526,21 @@ int main(void)
{
int i;
double d;
- ff_parse_and_eval_expr(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)",
+ av_parse_and_eval_expr(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)",
const_names, const_values,
NULL, NULL, NULL, NULL, NULL, 0, NULL);
printf("%f == 12.7\n", d);
- ff_parse_and_eval_expr(&d, "80G/80Gi",
+ av_parse_and_eval_expr(&d, "80G/80Gi",
const_names, const_values,
NULL, NULL, NULL, NULL, NULL, 0, NULL);
printf("%f == 0.931322575\n", d);
for (i=0; i<1050; i++) {
START_TIMER
- ff_parse_and_eval_expr(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)",
+ av_parse_and_eval_expr(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)",
const_names, const_values,
NULL, NULL, NULL, NULL, NULL, 0, NULL);
- STOP_TIMER("ff_parse_and_eval_expr")
+ STOP_TIMER("av_parse_and_eval_expr")
}
return 0;
}
diff --git a/libavcodec/eval.h b/libavutil/eval.h
index 350205d..38b4c25 100644
--- a/libavcodec/eval.h
+++ b/libavutil/eval.h
@@ -23,14 +23,14 @@
* simple arithmetic expression evaluator
*/
-#ifndef AVCODEC_EVAL_H
-#define AVCODEC_EVAL_H
+#ifndef AVUTIL_EVAL_H
+#define AVUTIL_EVAL_H
typedef struct AVExpr AVExpr;
/**
* Parses and evaluates an expression.
- * Note, this is significantly slower than ff_eval_expr().
+ * Note, this is significantly slower than av_eval_expr().
*
* @param res a pointer to a double where is put the result value of
* the expression, or NAN in case of error
@@ -46,7 +46,7 @@ typedef struct AVExpr AVExpr;
* @return 0 in case of success, a negative value corresponding to an
* AVERROR code otherwise
*/
-int ff_parse_and_eval_expr(double *res, const char *s,
+int av_parse_and_eval_expr(double *res, const char *s,
const char * const *const_names, const double *const_values,
const char * const *func1_names, double (* const *funcs1)(void *, double),
const char * const *func2_names, double (* const *funcs2)(void *, double, double),
@@ -57,7 +57,7 @@ int ff_parse_and_eval_expr(double *res, const char *s,
*
* @param expr a pointer where is put an AVExpr containing the parsed
* value in case of successfull parsing, or NULL otherwise.
- * The pointed to AVExpr must be freed with ff_free_expr() by the user
+ * The pointed to AVExpr must be freed with av_free_expr() by the user
* when it is not needed anymore.
* @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)"
* @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0}
@@ -69,7 +69,7 @@ int ff_parse_and_eval_expr(double *res, const char *s,
* @return 0 in case of success, a negative value corresponding to an
* AVERROR code otherwise
*/
-int ff_parse_expr(AVExpr **expr, const char *s,
+int av_parse_expr(AVExpr **expr, const char *s,
const char * const *const_names,
const char * const *func1_names, double (* const *funcs1)(void *, double),
const char * const *func2_names, double (* const *funcs2)(void *, double, double),
@@ -78,16 +78,16 @@ int ff_parse_expr(AVExpr **expr, const char *s,
/**
* Evaluates a previously parsed expression.
*
- * @param const_values a zero terminated array of values for the identifiers from ff_parse() const_names
+ * @param const_values a zero terminated array of values for the identifiers from av_parse_expr() const_names
* @param opaque a pointer which will be passed to all functions from funcs1 and funcs2
* @return the value of the expression
*/
-double ff_eval_expr(AVExpr *e, const double *const_values, void *opaque);
+double av_eval_expr(AVExpr *e, const double *const_values, void *opaque);
/**
- * Frees a parsed expression previously created with ff_parse_expr().
+ * Frees a parsed expression previously created with av_parse_expr().
*/
-void ff_free_expr(AVExpr *e);
+void av_free_expr(AVExpr *e);
/**
* Parses the string in numstr and returns its value as a double. If
@@ -108,4 +108,4 @@ void ff_free_expr(AVExpr *e);
*/
double av_strtod(const char *numstr, char **tail);
-#endif /* AVCODEC_EVAL_H */
+#endif /* AVUTIL_EVAL_H */
OpenPOWER on IntegriCloud