Mercurial > libavcodec.hg
comparison ratecontrol.c @ 11832:e522dbf60abd libavcodec
Move eval.c and eval.h from libavcodec to libavutil, and make the eval
API public.
author | stefano |
---|---|
date | Sat, 05 Jun 2010 12:01:28 +0000 |
parents | 026edf66e3a9 |
children |
comparison
equal
deleted
inserted
replaced
11831:9b1da3f82dd7 | 11832:e522dbf60abd |
---|---|
28 #include "libavutil/intmath.h" | 28 #include "libavutil/intmath.h" |
29 #include "avcodec.h" | 29 #include "avcodec.h" |
30 #include "dsputil.h" | 30 #include "dsputil.h" |
31 #include "ratecontrol.h" | 31 #include "ratecontrol.h" |
32 #include "mpegvideo.h" | 32 #include "mpegvideo.h" |
33 #include "eval.h" | 33 #include "libavutil/eval.h" |
34 | 34 |
35 #undef NDEBUG // Always check asserts, the speed effect is far too small to disable them. | 35 #undef NDEBUG // Always check asserts, the speed effect is far too small to disable them. |
36 #include <assert.h> | 36 #include <assert.h> |
37 | 37 |
38 #ifndef M_E | 38 #ifndef M_E |
104 "qp2bits", | 104 "qp2bits", |
105 NULL | 105 NULL |
106 }; | 106 }; |
107 emms_c(); | 107 emms_c(); |
108 | 108 |
109 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); | 109 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); |
110 if (res < 0) { | 110 if (res < 0) { |
111 av_log(s->avctx, AV_LOG_ERROR, "Error parsing rc_eq \"%s\"\n", s->avctx->rc_eq); | 111 av_log(s->avctx, AV_LOG_ERROR, "Error parsing rc_eq \"%s\"\n", s->avctx->rc_eq); |
112 return res; | 112 return res; |
113 } | 113 } |
114 | 114 |
252 void ff_rate_control_uninit(MpegEncContext *s) | 252 void ff_rate_control_uninit(MpegEncContext *s) |
253 { | 253 { |
254 RateControlContext *rcc= &s->rc_context; | 254 RateControlContext *rcc= &s->rc_context; |
255 emms_c(); | 255 emms_c(); |
256 | 256 |
257 ff_free_expr(rcc->rc_eq_eval); | 257 av_free_expr(rcc->rc_eq_eval); |
258 av_freep(&rcc->entry); | 258 av_freep(&rcc->entry); |
259 | 259 |
260 #if CONFIG_LIBXVID | 260 #if CONFIG_LIBXVID |
261 if((s->flags&CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) | 261 if((s->flags&CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) |
262 ff_xvid_rate_control_uninit(s); | 262 ff_xvid_rate_control_uninit(s); |
336 rcc->p_cplx_sum[FF_B_TYPE] / (double)rcc->frame_count[FF_B_TYPE], | 336 rcc->p_cplx_sum[FF_B_TYPE] / (double)rcc->frame_count[FF_B_TYPE], |
337 (rcc->i_cplx_sum[pict_type] + rcc->p_cplx_sum[pict_type]) / (double)rcc->frame_count[pict_type], | 337 (rcc->i_cplx_sum[pict_type] + rcc->p_cplx_sum[pict_type]) / (double)rcc->frame_count[pict_type], |
338 0 | 338 0 |
339 }; | 339 }; |
340 | 340 |
341 bits= ff_eval_expr(rcc->rc_eq_eval, const_values, rce); | 341 bits = av_eval_expr(rcc->rc_eq_eval, const_values, rce); |
342 if (isnan(bits)) { | 342 if (isnan(bits)) { |
343 av_log(s->avctx, AV_LOG_ERROR, "Error evaluating rc_eq \"%s\"\n", s->avctx->rc_eq); | 343 av_log(s->avctx, AV_LOG_ERROR, "Error evaluating rc_eq \"%s\"\n", s->avctx->rc_eq); |
344 return -1; | 344 return -1; |
345 } | 345 } |
346 | 346 |