FFmpeg
Loading...
Searching...
No Matches
ratecontrol.h
Go to the documentation of this file.
1/*
2 * Ratecontrol
3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
4 * Copyright (c) 2002-2004 Michael Niedermayer
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef AVCODEC_RATECONTROL_H
24#define AVCODEC_RATECONTROL_H
25
26/**
27 * @file
28 * ratecontrol header.
29 */
30
31#include <stdint.h>
32
33typedef struct Predictor{
34 double coeff;
35 double count;
36 double decay;
37} Predictor;
38
56
57/**
58 * rate control context.
59 */
60typedef struct RateControlContext{
61 int num_entries; ///< number of RateControlEntries
63 double buffer_index; ///< amount of bits in the video/audio buffer
65 double short_term_qsum; ///< sum of recent qscales
66 double short_term_qcount; ///< count of recent qscales
67 double pass1_rc_eq_output_sum;///< sum of the output of the rc equation, this is used for normalization
68 double pass1_wanted_bits; ///< bits which should have been output by the pass1 code (including complexity init)
70 double last_qscale_for[5]; ///< last qscale for a specific pict type, used for max_diff & ipb factor stuff
73 uint64_t i_cplx_sum[5];
74 uint64_t p_cplx_sum[5];
75 uint64_t mv_bits_sum[5];
76 uint64_t qscale_sum[5];
79
80 /**
81 * ratecontrol qmin qmax limiting method
82 * 0-> clipping, 1-> use a nice continuous function to limit qscale within qmin/qmax.
83 */
84 float qsquish;
85 float qmod_amp;
89
90 char *rc_eq;
92
95
97
98/* rate control */
100float ff_rate_estimate_qscale(MPVMainEncContext *m, int dry_run);
105
106#endif /* AVCODEC_RATECONTROL_H */
long long int64_t
Definition coverity.c:34
static const uint8_t frame_size[4]
Definition g723_1.h:222
float ff_rate_estimate_qscale(MPVMainEncContext *m, int dry_run)
void ff_rate_control_uninit(RateControlContext *rcc)
int ff_rate_control_init(MPVMainEncContext *m)
void ff_get_2pass_fcode(MPVMainEncContext *m)
int ff_vbv_update(MPVMainEncContext *m, int frame_size)
void ff_write_pass1_stats(MPVMainEncContext *m)
Definition ratecontrol.c:37
Definition eval.c:171
double decay
Definition ratecontrol.h:36
double count
Definition ratecontrol.h:35
double coeff
Definition ratecontrol.h:34
rate control context.
Definition ratecontrol.h:60
float qsquish
ratecontrol qmin qmax limiting method 0-> clipping, 1-> use a nice continuous function to limit qscal...
Definition ratecontrol.h:84
Predictor pred[5]
Definition ratecontrol.h:64
struct AVExpr * rc_eq_eval
Definition ratecontrol.h:91
uint64_t qscale_sum[5]
Definition ratecontrol.h:76
uint64_t i_cplx_sum[5]
Definition ratecontrol.h:73
double short_term_qcount
count of recent qscales
Definition ratecontrol.h:66
RateControlEntry * entry
Definition ratecontrol.h:62
uint64_t p_cplx_sum[5]
Definition ratecontrol.h:74
double buffer_index
amount of bits in the video/audio buffer
Definition ratecontrol.h:63
int num_entries
number of RateControlEntries
Definition ratecontrol.h:61
double pass1_rc_eq_output_sum
sum of the output of the rc equation, this is used for normalization
Definition ratecontrol.h:67
int64_t last_mb_var_sum
Definition ratecontrol.h:72
double pass1_wanted_bits
bits which should have been output by the pass1 code (including complexity init)
Definition ratecontrol.h:68
uint64_t mv_bits_sum[5]
Definition ratecontrol.h:75
int64_t last_mc_mb_var_sum
Definition ratecontrol.h:71
double last_qscale_for[5]
last qscale for a specific pict type, used for max_diff & ipb factor stuff
Definition ratecontrol.h:70
double short_term_qsum
sum of recent qscales
Definition ratecontrol.h:65
uint64_t expected_bits
Definition ratecontrol.h:50
int64_t mc_mb_var_sum
Definition ratecontrol.h:53