/*****************************************************************************1* ratecontrol.h: ratecontrol2*****************************************************************************3* Copyright (C) 2003-2016 x264 project4*5* Authors: Loren Merritt <[email protected]>6* Laurent Aimar <[email protected]>7*8* This program is free software; you can redistribute it and/or modify9* it under the terms of the GNU General Public License as published by10* the Free Software Foundation; either version 2 of the License, or11* (at your option) any later version.12*13* This program is distributed in the hope that it will be useful,14* but WITHOUT ANY WARRANTY; without even the implied warranty of15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16* GNU General Public License for more details.17*18* You should have received a copy of the GNU General Public License19* along with this program; if not, write to the Free Software20* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.21*22* This program is also available under a commercial proprietary license.23* For more information, contact us at [email protected].24*****************************************************************************/2526#ifndef X264_RATECONTROL_H27#define X264_RATECONTROL_H2829/* Completely arbitrary. Ratecontrol lowers relative quality at higher framerates30* and the reverse at lower framerates; this serves as the center of the curve.31* Halve all the values for frame-packed 3D to compensate for the "doubled"32* framerate. */33#define BASE_FRAME_DURATION (0.04f / ((h->param.i_frame_packing == 5)+1))3435/* Arbitrary limitations as a sanity check. */36#define MAX_FRAME_DURATION (1.00f / ((h->param.i_frame_packing == 5)+1))37#define MIN_FRAME_DURATION (0.01f / ((h->param.i_frame_packing == 5)+1))3839#define CLIP_DURATION(f) x264_clip3f(f,MIN_FRAME_DURATION,MAX_FRAME_DURATION)4041int x264_ratecontrol_new ( x264_t * );42void x264_ratecontrol_delete( x264_t * );4344void x264_ratecontrol_init_reconfigurable( x264_t *h, int b_init );45int x264_encoder_reconfig_apply( x264_t *h, x264_param_t *param );4647void x264_adaptive_quant_frame( x264_t *h, x264_frame_t *frame, float *quant_offsets );48int x264_macroblock_tree_read( x264_t *h, x264_frame_t *frame, float *quant_offsets );49int x264_reference_build_list_optimal( x264_t *h );50void x264_thread_sync_ratecontrol( x264_t *cur, x264_t *prev, x264_t *next );51void x264_ratecontrol_start( x264_t *, int i_force_qp, int overhead );52int x264_ratecontrol_slice_type( x264_t *, int i_frame );53void x264_ratecontrol_set_weights( x264_t *h, x264_frame_t *frm );54int x264_ratecontrol_mb( x264_t *, int bits );55int x264_ratecontrol_qp( x264_t * );56int x264_ratecontrol_mb_qp( x264_t *h );57int x264_ratecontrol_end( x264_t *, int bits, int *filler );58void x264_ratecontrol_summary( x264_t * );59void x264_ratecontrol_set_estimated_size( x264_t *, int bits );60int x264_ratecontrol_get_estimated_size( x264_t const *);61int x264_rc_analyse_slice( x264_t *h );62int x264_weighted_reference_duplicate( x264_t *h, int i_ref, const x264_weight_t *w );63void x264_threads_distribute_ratecontrol( x264_t *h );64void x264_threads_merge_ratecontrol( x264_t *h );65void x264_hrd_fullness( x264_t *h );66#endif67686970