頭文件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編碼器中沒看到類似的技術。