ratecontrol.h 4.5 KB
Newer Older
1
/*****************************************************************************
2
 * ratecontrol.h: ratecontrol
3
 *****************************************************************************
Henrik Gramner's avatar
Henrik Gramner committed
4
 * Copyright (C) 2003-2017 x264 project
5
 *
6 7
 * Authors: Loren Merritt <lorenm@u.washington.edu>
 *          Laurent Aimar <fenrir@via.ecp.fr>
8 9 10 11 12 13 14 15 16 17 18 19 20
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
22 23 24
 *
 * This program is also available under a commercial proprietary license.
 * For more information, contact us at licensing@x264.com.
25 26
 *****************************************************************************/

Anton Mitrofanov's avatar
Anton Mitrofanov committed
27 28
#ifndef X264_ENCODER_RATECONTROL_H
#define X264_ENCODER_RATECONTROL_H
29

30
/* Completely arbitrary.  Ratecontrol lowers relative quality at higher framerates
31 32 33 34
 * and the reverse at lower framerates; this serves as the center of the curve.
 * Halve all the values for frame-packed 3D to compensate for the "doubled"
 * framerate. */
#define BASE_FRAME_DURATION (0.04f / ((h->param.i_frame_packing == 5)+1))
35 36

/* Arbitrary limitations as a sanity check. */
37 38
#define MAX_FRAME_DURATION (1.00f / ((h->param.i_frame_packing == 5)+1))
#define MIN_FRAME_DURATION (0.01f / ((h->param.i_frame_packing == 5)+1))
39 40 41

#define CLIP_DURATION(f) x264_clip3f(f,MIN_FRAME_DURATION,MAX_FRAME_DURATION)

42
#define x264_ratecontrol_new x264_template(ratecontrol_new)
43
int  x264_ratecontrol_new   ( x264_t * );
44
#define x264_ratecontrol_delete x264_template(ratecontrol_delete)
45
void x264_ratecontrol_delete( x264_t * );
46

47
#define x264_ratecontrol_init_reconfigurable x264_template(ratecontrol_init_reconfigurable)
48
void x264_ratecontrol_init_reconfigurable( x264_t *h, int b_init );
49
#define x264_encoder_reconfig_apply x264_template(encoder_reconfig_apply)
50
int x264_encoder_reconfig_apply( x264_t *h, x264_param_t *param );
51

52
#define x264_adaptive_quant_frame x264_template(adaptive_quant_frame)
53
void x264_adaptive_quant_frame( x264_t *h, x264_frame_t *frame, float *quant_offsets );
54
#define x264_macroblock_tree_read x264_template(macroblock_tree_read)
55
int  x264_macroblock_tree_read( x264_t *h, x264_frame_t *frame, float *quant_offsets );
56
#define x264_reference_build_list_optimal x264_template(reference_build_list_optimal)
57
int  x264_reference_build_list_optimal( x264_t *h );
58
#define x264_thread_sync_ratecontrol x264_template(thread_sync_ratecontrol)
Loren Merritt's avatar
Loren Merritt committed
59
void x264_thread_sync_ratecontrol( x264_t *cur, x264_t *prev, x264_t *next );
60
#define x264_ratecontrol_zone_init x264_template(ratecontrol_zone_init)
61
void x264_ratecontrol_zone_init( x264_t * );
62
#define x264_ratecontrol_start x264_template(ratecontrol_start)
63
void x264_ratecontrol_start( x264_t *, int i_force_qp, int overhead );
64
#define x264_ratecontrol_slice_type x264_template(ratecontrol_slice_type)
65
int  x264_ratecontrol_slice_type( x264_t *, int i_frame );
66
#define x264_ratecontrol_set_weights x264_template(ratecontrol_set_weights)
67
void x264_ratecontrol_set_weights( x264_t *h, x264_frame_t *frm );
68
#define x264_ratecontrol_mb x264_template(ratecontrol_mb)
69
int  x264_ratecontrol_mb( x264_t *, int bits );
70
#define x264_ratecontrol_qp x264_template(ratecontrol_qp)
71
int  x264_ratecontrol_qp( x264_t * );
72
#define x264_ratecontrol_mb_qp x264_template(ratecontrol_mb_qp)
73
int  x264_ratecontrol_mb_qp( x264_t *h );
74
#define x264_ratecontrol_end x264_template(ratecontrol_end)
75
int  x264_ratecontrol_end( x264_t *, int bits, int *filler );
76
#define x264_ratecontrol_summary x264_template(ratecontrol_summary)
77
void x264_ratecontrol_summary( x264_t * );
78
#define x264_rc_analyse_slice x264_template(rc_analyse_slice)
79
int  x264_rc_analyse_slice( x264_t *h );
80
#define x264_threads_distribute_ratecontrol x264_template(threads_distribute_ratecontrol)
81
void x264_threads_distribute_ratecontrol( x264_t *h );
82
#define x264_threads_merge_ratecontrol x264_template(threads_merge_ratecontrol)
83
void x264_threads_merge_ratecontrol( x264_t *h );
84
#define x264_hrd_fullness x264_template(hrd_fullness)
Fiona Glaser's avatar
Fiona Glaser committed
85
void x264_hrd_fullness( x264_t *h );
86

87
#endif