您的位置:首页 > 编程语言

x265代码阅读:码率控制(二)

2017-04-24 15:42 761 查看
头文件x265.h中的码率控制参数:

struct
{
/* Explicit mode of rate-control, necessary for API users. It must
* be one of the X265_RC_METHODS enum values. */
int       rateControlMode;

/* Base QP to use for Constant QP rate control. Adaptive QP may alter
* the QP used for each block. If a QP is specified on the command line
* CQP rate control is implied. Default: 32 */
int       qp;

/* target bitrate for Average BitRate (ABR) rate control. If a non- zero
* bitrate is specified on the command line, ABR is implied. Default 0 */
int       bitrate;

/* qComp sets the quantizer curve compression factor. It weights the frame
* quantizer based on the complexity of residual (measured by lookahead).
* Default value is 0.6. Increasing it to 1 will effectively generate CQP */
double    qCompress;

/* QP offset between I/P and P/B frames. Default ipfactor: 1.4
* Default pbFactor: 1.3 */
double    ipFactor;
double    pbFactor;

/* Max QP difference between frames. Default: 4 */
int       qpStep;

/* Ratefactor constant: targets a certain constant "quality".
* Acceptable values between 0 and 51. Default value: 28 */
double    rfConstant;

/* Enable adaptive quantization. This mode distributes available bits between all
* CTUs of a frame, assigning more bits to low complexity areas. Turning
* this ON will usually affect PSNR negatively, however SSIM and visual quality
* generally improves. Default: X265_AQ_VARIANCE */
int       aqMode;

/* Sets the strength of AQ bias towards low detail CTUs. Valid only if
* AQ is enabled. Default value: 1.0. Acceptable values between 0.0 and 3.0 */
double    aqStrength;

/* Sets the maximum rate the VBV buffer should be assumed to refill at
* Default is zero */
int       vbvMaxBitrate;

/* Sets the size of the VBV buffer in kilobits. Default is zero */
int       vbvBufferSize;

/* Sets how full the VBV buffer must be before playback starts. If it is less than
* 1, then the initial fill is vbv-init * vbvBufferSize. Otherwise, it is
* interpreted as the initial fill in kbits. Default is 0.9 */
double    vbvBufferInit;

/* Enable CUTree ratecontrol. This keeps track of the CUs that propagate temporally
* across frames and assigns more bits to these CUs. Improves encode efficiency.
* Default: enabled */
int       cuTree;

/* In CRF mode, maximum CRF as caused by VBV. 0 implies no limit */
double    rfConstantMax;

/* In CRF mode, minimum CRF as caused by VBV */
double    rfConstantMin;

/* Multi-pass encoding */
/* Enable writing the stats in a multipass encode to the stat output file */
int       bStatWrite;

/* Enable loading data from the stat input file in a multi pass encode */
int       bStatRead;

/* Filename of the 2pass output/input stats file, if unspecified the
* encoder will default to using x265_2pass.log */
char*     statFileName;

/* temporally blur quants */
double    qblur;

/* temporally blur complexity */
double    complexityBlur;

/* Enable slow and a more detailed first pass encode in multi pass rate control */
int       bEnableSlowFirstPass;

/* ratecontrol overrides */
int        zoneCount;
x265_zone* zones;

/* specify a text file which contains MAX_MAX_QP + 1 floating point
* values to be copied into x265_lambda_tab and a second set of
* MAX_MAX_QP + 1 floating point values for x265_lambda2_tab. All values
* are separated by comma, space or newline. Text after a hash (#) is
* ignored. The lambda tables are process-global, so these new lambda
* values will affect all encoders in the same process */
const char* lambdaFileName;

/* Enable stricter conditions to check bitrate deviations in CBR mode. May compromise
quality to maintain bitrate adherence */
int bStrictCbr;
} rc;


成员变量aqMode和aqStrength是一起使用的,用于assign more bits to low complexity CTUs,这种应该属于空域的RDO,而complexityBlur、blurredComplexity、cuTree均属于时域的RDO。

aqMode和aqStrength的作用类似于HM中的CU级多QP优化,但不需要遍历多个QP。cuTree在HM编码器中没看到类似的技术。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: