Further adjustment of RD behaviour with Q and Zbin.
Following conversations with Tim T (Derf) I ran a large number of tests comparing the existing polynomial expression with a simpler ^2 variant. Though the polynomial was sometimes a little better at the extremes of Q it was possible to get close for most clips and even a little better on some. This code also changes the way the RD multiplier is calculated when the ZBIN is extended to use a variant of the same ^2 expression. I hope that this simpler expression will be easier to tune further as we expand our test set and consider adjustments based on content. Change-Id: I73b2564346e74d1332c33e2c1964ae093437456c
This commit is contained in:
parent
f1a3b1e0d9
commit
1ca39bf26d
@ -231,18 +231,29 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int Qvalue)
|
||||
int i;
|
||||
int *thresh;
|
||||
int threshmult;
|
||||
|
||||
int capped_q = (Qvalue < 160) ? Qvalue : 160;
|
||||
double capped_q = (Qvalue < 160) ? (double)Qvalue : 160.0;
|
||||
double rdconst = 3.00;
|
||||
|
||||
vp8_clear_system_state(); //__asm emms;
|
||||
|
||||
cpi->RDMULT = (int)( (0.0001 * (capped_q * capped_q * capped_q * capped_q))
|
||||
-(0.015 * (capped_q * capped_q * capped_q))
|
||||
+(3.25 * (capped_q * capped_q))
|
||||
-(17.5 * capped_q) + 125.0);
|
||||
// Further tests required to see if optimum is different
|
||||
// for key frames, golden frames and arf frames.
|
||||
// if (cpi->common.refresh_golden_frame ||
|
||||
// cpi->common.refresh_alt_ref_frame)
|
||||
cpi->RDMULT = (int)(rdconst * (capped_q * capped_q));
|
||||
|
||||
if (cpi->RDMULT < 125)
|
||||
cpi->RDMULT = 125;
|
||||
// Extend rate multiplier along side quantizer zbin increases
|
||||
if (cpi->zbin_over_quant > 0)
|
||||
{
|
||||
double oq_factor;
|
||||
double modq;
|
||||
|
||||
// Experimental code using the same basic equation as used for Q above
|
||||
// The units of cpi->zbin_over_quant are 1/128 of Q bin size
|
||||
oq_factor = 1.0 + ((double)0.0015625 * cpi->zbin_over_quant);
|
||||
modq = (int)((double)capped_q * oq_factor);
|
||||
cpi->RDMULT = (int)(rdconst * (modq * modq));
|
||||
}
|
||||
|
||||
if (cpi->pass == 2 && (cpi->common.frame_type != KEY_FRAME))
|
||||
{
|
||||
@ -252,17 +263,8 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int Qvalue)
|
||||
cpi->RDMULT += (cpi->RDMULT * rd_iifactor[cpi->next_iiratio]) >> 4;
|
||||
}
|
||||
|
||||
|
||||
// Extend rate multiplier along side quantizer zbin increases
|
||||
if (cpi->zbin_over_quant > 0)
|
||||
{
|
||||
double oq_factor = pow(1.006, cpi->zbin_over_quant);
|
||||
|
||||
if (oq_factor > (1.0 + ((double)cpi->zbin_over_quant / 64.0)))
|
||||
oq_factor = (1.0 + (double)cpi->zbin_over_quant / 64.0);
|
||||
|
||||
cpi->RDMULT = (int)(oq_factor * cpi->RDMULT);
|
||||
}
|
||||
if (cpi->RDMULT < 125)
|
||||
cpi->RDMULT = 125;
|
||||
|
||||
cpi->mb.errorperbit = (cpi->RDMULT / 100);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user