Change calculation of rd multiplier.
authorPaul Wilkins <paulwilkins@google.com>
Wed, 31 Mar 2021 15:58:51 +0000 (16:58 +0100)
committerPaul Wilkins <paulwilkins@google.com>
Wed, 31 Mar 2021 16:08:04 +0000 (17:08 +0100)
commitd3aaac367bd716b2db06e774f0a8eea7768dd184
tree649e9f1d374c13d036751c8de0dde1654049e542
parente37ee40f7ee0dbafa41e7d1c32dc34740727c7a1
Change calculation of rd multiplier.

Change the way the rd multiplier is adjusted for Q and frame type.

Previously in VP9 the rd multiplier was adjusted based on crude Q bins
and whether the frame was a key frame or inter frame.

The Q bins create some problems as they potentially introduce
discontinuities in the RD curve. For example, rate rising with a
stepwise increase in Q instead of falling. As such, in AV1 they
have been removed.

A further issue was identified when examining the first round of
results from from the Vizier project. Here the multiplier for each Q bin
and each frame type was optimized for a training set, for various video
formats, using single point encodes at the appropriate YT rates.

These initial results appeared to show a trend for increased rd
multiplier at higher Q for key frames. This fits with intuition as in
this encoding context a higher Q indicates that a clip is harder to
encode and frames  less well predicted.  However, the situation
appeared to reverse for inter frames with higher rd multipliers
chosen at low Q.

My initial suspicion was that this was a result of over fitting, but on
closer analysis I realized that this may be more related to frame type
within the broader inter frame classification. Specifically frames coded
at low Q are predominantly ARF frames, for the mid Q bin there will
likely be a mix of ARF and normal inter frames, and for the high Q bin
the frames will almost exclusively be normal inter frames from difficult
content.

ARF frames are inherently less well predicted than other inter frames
being further apart and not having access to as many prediction modes.
We also know from previous work that ARF frames have a higher
incidence of INTRA coding and may well behave more like key frames
in this context.

This patch replaces the bin based approach with a linear function
that applies a small but smooth Q based adjustment. It also splits
ARF frames and normal inter frames into separate categories.

With this done number of parameters that will be exposed for the
next round of Vizier training is reduced from 7 to 3 (one adjustment
factor each for inter, ARF and key frames)

This patch gives net BDATE gains for our test sets even with the
baseline / default factors as follows: (% BDRATE change in overall
PSNR and SSIM, -ve is better)

LowRes  -0.231, -0.050
ugc360p  0.160,  -0.315
midres2 -0.348, -1.170
hdres2 -0.407, -0.691

Change-Id: I46dd2fea77b1c2849c122f10fd0df74bbd3fcc7f
vp9/encoder/vp9_rd.c
vp9/encoder/vp9_rd.h