]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Make ratecontrol use ff_eval2().
authortakis <takis@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 27 Sep 2006 19:46:19 +0000 (19:46 +0000)
committertakis <takis@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 27 Sep 2006 19:46:19 +0000 (19:46 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@6354 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/mpegvideo.h
libavcodec/ratecontrol.c

index d8eebc3bbfc10a0debaaa62f346d87c630922207..f8efffbec0b2568d1f5ba15c5dc9c1d986159f46 100644 (file)
@@ -991,10 +991,16 @@ int ff_rate_control_init(MpegEncContext *s);
 float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run);
 void ff_write_pass1_stats(MpegEncContext *s);
 void ff_rate_control_uninit(MpegEncContext *s);
+#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
 double ff_eval(char *s, double *const_value, const char **const_name,
                double (**func1)(void *, double), const char **func1_name,
                double (**func2)(void *, double, double), char **func2_name,
                void *opaque);
+#endif
+double ff_eval2(char *s, double *const_value, const char **const_name,
+               double (**func1)(void *, double), const char **func1_name,
+               double (**func2)(void *, double, double), char **func2_name,
+               void *opaque, char **error);
 int ff_vbv_update(MpegEncContext *s, int frame_size);
 void ff_get_2pass_fcode(MpegEncContext *s);
 
index 5c339fa152fa711d23340eaaa051fa2c97456548..721edf95a916a19d44c316eb5fc1a5b977962ca2 100644 (file)
@@ -259,6 +259,7 @@ static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_f
     const int pict_type= rce->new_pict_type;
     const double mb_num= s->mb_num;
     int i;
+    char *error = NULL;
 
     double const_values[]={
         M_PI,
@@ -325,9 +326,9 @@ static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_f
         NULL
     };
 
-    bits= ff_eval(s->avctx->rc_eq, const_values, const_names, func1, func1_names, NULL, NULL, rce);
+    bits= ff_eval2(s->avctx->rc_eq, const_values, const_names, func1, func1_names, NULL, NULL, rce, &error);
     if (isnan(bits)) {
-        av_log(s->avctx, AV_LOG_ERROR, "Unable to parse rc_eq \"%s\".\n", s->avctx->rc_eq);
+        av_log(s->avctx, AV_LOG_ERROR, "Error evaluating rc_eq \"%s\": %s\n", s->avctx->rc_eq, error? error : "");
         return -1;
     }