From a014e9c9cd50c56948637be8b6f5222b2bfcbea7 Mon Sep 17 00:00:00 2001 From: skal Date: Wed, 30 Oct 2013 23:57:23 +0100 Subject: [PATCH] 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 --- src/enc/quant.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/enc/quant.c b/src/enc/quant.c index 9cc6ab1f..0cab861b 100644 --- a/src/enc/quant.c +++ b/src/enc/quant.c @@ -169,20 +169,8 @@ static const uint16_t kCoeffThresh[16] = { 30, 30, 30, 30 }; -// TODO(skal): tune more. Coeff thresholding? -static const uint8_t kBiasMatrices[3][16] = { // [3] = [luma-ac,luma-dc,chroma] - { 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 } +static const uint8_t kBiasMatrices[3][2] = { // [luma-ac,luma-dc,chroma][dc,ac] + { 96, 110 }, { 96, 112 }, { 112, 120 } }; // 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]; } 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->bias_[i] = BIAS(bias); // TODO(skal): tune kCoeffThresh[]