FFmpeg
Functions
ratecontrol.c File Reference
#include "libavutil/attributes.h"
#include "libavutil/internal.h"
#include "avcodec.h"
#include "ratecontrol.h"
#include "mpegutils.h"
#include "mpegvideoenc.h"
#include "libavutil/eval.h"

Go to the source code of this file.

Functions

void ff_write_pass1_stats (MpegEncContext *s)
 
static double get_fps (AVCodecContext *avctx)
 
static double qp2bits (RateControlEntry *rce, double qp)
 
static double bits2qp (RateControlEntry *rce, double bits)
 
static double get_diff_limited_q (MpegEncContext *s, RateControlEntry *rce, double q)
 
static void get_qminmax (int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pict_type)
 Get the qmin & qmax for pict_type. More...
 
static double modify_qscale (MpegEncContext *s, RateControlEntry *rce, double q, int frame_num)
 
static double get_qscale (MpegEncContext *s, RateControlEntry *rce, double rate_factor, int frame_num)
 Modify the bitrate curve from pass1 for one frame. More...
 
static int init_pass2 (MpegEncContext *s)
 
av_cold int ff_rate_control_init (MpegEncContext *s)
 
av_cold void ff_rate_control_uninit (MpegEncContext *s)
 
int ff_vbv_update (MpegEncContext *s, int frame_size)
 
static double predict_size (Predictor *p, double q, double var)
 
static void update_predictor (Predictor *p, double q, double var, double size)
 
static void adaptive_quantization (MpegEncContext *s, double q)
 
void ff_get_2pass_fcode (MpegEncContext *s)
 
float ff_rate_estimate_qscale (MpegEncContext *s, int dry_run)
 

Detailed Description

Rate control for video encoders.

Definition in file ratecontrol.c.

Function Documentation

◆ ff_write_pass1_stats()

void ff_write_pass1_stats ( MpegEncContext s)

Definition at line 37 of file ratecontrol.c.

Referenced by encode_frame(), and ff_mpv_encode_picture().

◆ get_fps()

static double get_fps ( AVCodecContext avctx)
static

◆ qp2bits()

static double qp2bits ( RateControlEntry rce,
double  qp 
)
inlinestatic

Definition at line 63 of file ratecontrol.c.

Referenced by ff_rate_control_init(), get_qscale(), and init_pass2().

◆ bits2qp()

static double bits2qp ( RateControlEntry rce,
double  bits 
)
inlinestatic

Definition at line 71 of file ratecontrol.c.

Referenced by ff_rate_control_init(), get_qscale(), and modify_qscale().

◆ get_diff_limited_q()

static double get_diff_limited_q ( MpegEncContext s,
RateControlEntry rce,
double  q 
)
static

Definition at line 79 of file ratecontrol.c.

Referenced by ff_rate_estimate_qscale(), and init_pass2().

◆ get_qminmax()

static void get_qminmax ( int qmin_ret,
int qmax_ret,
MpegEncContext s,
int  pict_type 
)
static

Get the qmin & qmax for pict_type.

Definition at line 118 of file ratecontrol.c.

Referenced by ff_rate_estimate_qscale(), and modify_qscale().

◆ modify_qscale()

static double modify_qscale ( MpegEncContext s,
RateControlEntry rce,
double  q,
int  frame_num 
)
static

Definition at line 146 of file ratecontrol.c.

Referenced by ff_rate_estimate_qscale(), and init_pass2().

◆ get_qscale()

static double get_qscale ( MpegEncContext s,
RateControlEntry rce,
double  rate_factor,
int  frame_num 
)
static

Modify the bitrate curve from pass1 for one frame.

Definition at line 237 of file ratecontrol.c.

Referenced by ff_rate_control_init(), ff_rate_estimate_qscale(), and init_pass2().

◆ init_pass2()

static int init_pass2 ( MpegEncContext s)
static

Definition at line 310 of file ratecontrol.c.

Referenced by ff_rate_control_init().

◆ ff_rate_control_init()

av_cold int ff_rate_control_init ( MpegEncContext s)

Definition at line 471 of file ratecontrol.c.

Referenced by encode_init(), and ff_mpv_encode_init().

◆ ff_rate_control_uninit()

av_cold void ff_rate_control_uninit ( MpegEncContext s)

Definition at line 671 of file ratecontrol.c.

Referenced by encode_end(), ff_mpv_encode_end(), and ff_rate_control_init().

◆ ff_vbv_update()

int ff_vbv_update ( MpegEncContext s,
int  frame_size 
)

Definition at line 680 of file ratecontrol.c.

Referenced by ff_mpv_encode_picture(), init_pass2(), and select_input_picture().

◆ predict_size()

static double predict_size ( Predictor p,
double  q,
double  var 
)
static

Definition at line 722 of file ratecontrol.c.

Referenced by ff_rate_estimate_qscale().

◆ update_predictor()

static void update_predictor ( Predictor p,
double  q,
double  var,
double  size 
)
static

Definition at line 727 of file ratecontrol.c.

Referenced by ff_rate_estimate_qscale().

◆ adaptive_quantization()

static void adaptive_quantization ( MpegEncContext s,
double  q 
)
static

Definition at line 739 of file ratecontrol.c.

Referenced by ff_rate_estimate_qscale().

◆ ff_get_2pass_fcode()

void ff_get_2pass_fcode ( MpegEncContext s)

Definition at line 855 of file ratecontrol.c.

Referenced by encode_picture().

◆ ff_rate_estimate_qscale()

float ff_rate_estimate_qscale ( MpegEncContext s,
int  dry_run 
)

Definition at line 866 of file ratecontrol.c.

Referenced by encode_frame(), estimate_qp(), and ratecontrol_1pass().