MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ff_rate_control_init

Function ff_rate_control_init

libavcodec/ratecontrol.c:496–707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

494}
495
496av_cold int ff_rate_control_init(MPVMainEncContext *const m)
497{
498 MPVEncContext *const s = &m->s;
499 RateControlContext *rcc = &m->rc_context;
500 AVCodecContext *const avctx = s->c.avctx;
501 int i, res;
502 static const char * const const_names[] = {
503 "PI",
504 "E",
505 "iTex",
506 "pTex",
507 "tex",
508 "mv",
509 "fCode",
510 "iCount",
511 "mcVar",
512 "var",
513 "isI",
514 "isP",
515 "isB",
516 "avgQP",
517 "qComp",
518 "avgIITex",
519 "avgPITex",
520 "avgPPTex",
521 "avgBPTex",
522 "avgTex",
523 NULL
524 };
525 static double (* const func1[])(void *, double) = {
526 bits2qp_cb,
527 qp2bits_cb,
528 NULL
529 };
530 static const char * const func1_names[] = {
531 "bits2qp",
532 "qp2bits",
533 NULL
534 };
535
536 if (!avctx->rc_max_available_vbv_use && avctx->rc_buffer_size) {
537 if (avctx->rc_max_rate) {
538 avctx->rc_max_available_vbv_use = av_clipf(avctx->rc_max_rate/(avctx->rc_buffer_size*get_fps(avctx)), 1.0/3, 1.0);
539 } else
540 avctx->rc_max_available_vbv_use = 1.0;
541 }
542
543 res = av_expr_parse(&rcc->rc_eq_eval,
544 rcc->rc_eq ? rcc->rc_eq : "tex^qComp",
545 const_names, func1_names, func1,
546 NULL, NULL, 0, avctx);
547 if (res < 0) {
548 av_log(avctx, AV_LOG_ERROR, "Error parsing rc_eq \"%s\"\n", rcc->rc_eq);
549 return res;
550 }
551
552 for (i = 0; i < 5; i++) {
553 rcc->pred[i].coeff = FF_QP2LAMBDA * 7.0;

Callers 2

encode_initFunction · 0.85
ff_mpv_encode_initFunction · 0.85

Calls 7

get_fpsFunction · 0.85
av_expr_parseFunction · 0.85
av_logFunction · 0.85
init_pass2Function · 0.85
get_qscaleFunction · 0.85
av_malloc_arrayFunction · 0.85
av_malloczFunction · 0.50

Tested by

no test coverage detected