diff options
author | Yaowu Xu <yaowu@google.com> | 2018-11-29 09:44:16 -0800 |
---|---|---|
committer | Yaowu Xu <yaowu@google.com> | 2018-12-05 18:27:17 -0800 |
commit | 93488acda641c74bdc0f606cd4086b021e733f84 (patch) | |
tree | 0d786693fab54d85bfe24e60c45309064658ad98 /vp9/encoder/vp9_rd.c | |
parent | 356174583506fb6654a3de7264348fbbfb7ca62c (diff) | |
download | libvpx-93488acda641c74bdc0f606cd4086b021e733f84.tar libvpx-93488acda641c74bdc0f606cd4086b021e733f84.tar.gz libvpx-93488acda641c74bdc0f606cd4086b021e733f84.tar.bz2 libvpx-93488acda641c74bdc0f606cd4086b021e733f84.zip |
Optimize RDMult
This commit introduces the optimized RDMult values for both key
and non-key frames. For key frames, the commit gets values back
from commit#b13f6154df9c0834d74f7e3d41e41c4208f56d18. For impact
on key frame only encodings, see commit message for that commit.
For inter frames, the values get optimzied by running encoding tests
in Q mode with the following range using 150 frames:
2 6 10 14 18 22 26 30 34 38 42 46 50 54 58 62
The impact of current set of RDMULT values:
PSNR SSIM PSNR-HVS
lowres: -0.325% 0.422% -0.228%
midres: -0.377% 0.158% -0.376%
hdres: -0.309% 0.522% -0.322%
Test baseline is on commit#35617458
Overall, the values help PSNR based metrics, but hurt SSIM metric
slightly.
Change-Id: I7eba37a6524cb36b8498a1d104d2667781bc2089
Diffstat (limited to 'vp9/encoder/vp9_rd.c')
-rw-r--r-- | vp9/encoder/vp9_rd.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/vp9/encoder/vp9_rd.c b/vp9/encoder/vp9_rd.c index 18b74f57b..c01e5f81b 100644 --- a/vp9/encoder/vp9_rd.c +++ b/vp9/encoder/vp9_rd.c @@ -176,8 +176,27 @@ static const int rd_frame_type_factor[FRAME_UPDATE_TYPES] = { 128, 144, 128, int vp9_compute_rd_mult_based_on_qindex(const VP9_COMP *cpi, int qindex) { // largest dc_quant is 21387, therefore rdmult should always fit in int32_t const int q = vp9_dc_quant(qindex, 0, cpi->common.bit_depth); - int rdmult = q * q; - rdmult = rdmult * 3 + (rdmult * 2 / 3); + uint32_t rdmult = q * q; + + if (cpi->common.frame_type != KEY_FRAME) { + if (qindex < 1) + rdmult = rdmult * 3 + (rdmult * 2 / 3); + else if (qindex < 128) + rdmult = rdmult * 4; + else if (qindex < 190) + rdmult = rdmult * 4 + rdmult / 2; + else + rdmult = rdmult * 3; + } else { + if (qindex < 64) + rdmult = rdmult * 4; + else if (qindex <= 128) + rdmult = rdmult * 3 + rdmult / 2; + else if (qindex < 190) + rdmult = rdmult * 4 + rdmult / 2; + else + rdmult = rdmult * 7 + rdmult / 2; + } #if CONFIG_VP9_HIGHBITDEPTH switch (cpi->common.bit_depth) { case VPX_BITS_10: rdmult = ROUND_POWER_OF_TWO(rdmult, 4); break; |