tune quantization biases toward higher precision

* raise U/V quantization bias to more neutral values
* also raise the non-zero AC bias for Y1/Y2 matrices

(we need all the precision we can for U/V leves, which are often empty)
This will increase quality in the higher range (q >= 90) mostly.
Files size is exacted to raise a little (5-7%). and SSIM accordingly of course.

Change-Id: I8a9ffdb6d8fb6dadb959e3fd392e66dc5aaed64e
This commit is contained in:
skal 2013-10-30 23:57:23 +01:00
parent 1e898619cb
commit a014e9c9cd

View File

@ -169,20 +169,8 @@ static const uint16_t kCoeffThresh[16] = {
30, 30, 30, 30 30, 30, 30, 30
}; };
// TODO(skal): tune more. Coeff thresholding? static const uint8_t kBiasMatrices[3][2] = { // [luma-ac,luma-dc,chroma][dc,ac]
static const uint8_t kBiasMatrices[3][16] = { // [3] = [luma-ac,luma-dc,chroma] { 96, 110 }, { 96, 112 }, { 112, 120 }
{ 96, 96, 96, 96,
96, 96, 96, 96,
96, 96, 96, 96,
96, 96, 96, 96 },
{ 96, 96, 96, 96,
96, 96, 96, 96,
96, 96, 96, 96,
96, 96, 96, 96 },
{ 96, 96, 96, 96,
96, 96, 96, 96,
96, 96, 96, 96,
96, 96, 96, 96 }
}; };
// Sharpening by (slightly) raising the hi-frequency coeffs. // Sharpening by (slightly) raising the hi-frequency coeffs.
@ -205,7 +193,8 @@ static int ExpandMatrix(VP8Matrix* const m, int type) {
m->q_[i] = m->q_[1]; m->q_[i] = m->q_[1];
} }
for (i = 0; i < 16; ++i) { for (i = 0; i < 16; ++i) {
const int bias = kBiasMatrices[type][i]; const int is_ac_coeff = (i > 0);
const int bias = kBiasMatrices[type][is_ac_coeff];
m->iq_[i] = (1 << QFIX) / m->q_[i]; m->iq_[i] = (1 << QFIX) / m->q_[i];
m->bias_[i] = BIAS(bias); m->bias_[i] = BIAS(bias);
// TODO(skal): tune kCoeffThresh[] // TODO(skal): tune kCoeffThresh[]