Commit a6c98f6f authored by Fiona Glaser's avatar Fiona Glaser

Use a gaussian window for cplxblur

Cplxblur was originally intended to use a gaussian window, but in its current form did not.  This change provides a tiny improvement to 2pass ratecontrol.
parent 970d6100
......@@ -1801,15 +1801,17 @@ static int init_pass2( x264_t *h )
weight *= 1 - pow( (float)rcj->i_count / rcc->nmb, 2 );
if(weight < .0001)
break;
weight_sum += weight;
cplx_sum += weight * (qscale2bits(rcj, 1) - rcj->misc_bits);
double gaussian_weight = weight * exp(-j*j/200.0);
weight_sum += gaussian_weight;
cplx_sum += gaussian_weight * (qscale2bits(rcj, 1) - rcj->misc_bits);
}
/* weighted average of cplx of past frames */
weight = 1.0;
for(j=0; j<=cplxblur*2 && j<=i; j++){
ratecontrol_entry_t *rcj = &rcc->entry[i-j];
weight_sum += weight;
cplx_sum += weight * (qscale2bits(rcj, 1) - rcj->misc_bits);
double gaussian_weight = weight * exp(-j*j/200.0);
weight_sum += gaussian_weight;
cplx_sum += gaussian_weight * (qscale2bits(rcj, 1) - rcj->misc_bits);
weight *= 1 - pow( (float)rcj->i_count / rcc->nmb, 2 );
if(weight < .0001)
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment