Jingning Han [Fri, 31 Aug 2018 22:54:10 +0000 (15:54 -0700)]
Adaptive ARF factor decision
Re-count the factors to decide bit boost factor for the
intermediate layer ARFs. Make the gfu_boost factor assigned to
each ARF adapt to its local factors.
This and the recursive change 5bfe9eb together improves the
multi-layer ARF compression performance:
Jingning Han [Thu, 30 Aug 2018 04:30:35 +0000 (21:30 -0700)]
Recursive rate allocation for multi-layer ARF coding
Recursively calculate the rate boost for the ARF frames at the
given layer depth from the remaining available bit resource after
the prior layer ARFs consumption.
Jingning Han [Tue, 28 Aug 2018 21:08:02 +0000 (14:08 -0700)]
Enable adaptive rate allocation for multi-layer ARFs
Increase the bit allocation for the intermediate layer ARFs. The
current strategy assigns higher offset to the lower layer ARFs.
The needed budget is borrowed from the base layer ARF allocation.
Jingning Han [Tue, 28 Aug 2018 19:43:34 +0000 (12:43 -0700)]
Increase encoder buffer for multi-layer ARFs
When multi-layer ARF mode is enabled, increase the encoder buffer
to account for the situation where several ARFs are coded together
in a frame packet.
Paul Wilkins [Mon, 3 Sep 2018 15:48:02 +0000 (16:48 +0100)]
Fix short first kf bug.
This change is in response to quality issue in b/112953058
The quality regression observed is a result of a bug that manifested
because of a very short key frame group at the start of a chunk.
The group was so short that it was less than the minimum allowed
length of an ARF group, so the initial group was coded as a GF only
group. However, group length was not set correctly and the result
was a frame coded with a target of 0 bits.
This causes two problems:
Firstly one very poor frame that caused the issue to be raised.
Secondly that one frame obviously overshoots its 0 target very heavily
and this has the effect moving the needle significantly in terms of the
adaptive rate control (specifically the estimate of bits per macro block
used to estimate the active Q range). Consequently there is undershoot
for most of the rest of the chunk and the overall rate ends up much lower
than the target (14Mb/s vs a target of 22Mb/s). (The sharp drop in the
overall rate is also noted in the issue.
Paul Wilkins [Mon, 3 Sep 2018 15:12:22 +0000 (16:12 +0100)]
Revert "Revert "Prevent double application of min rate in two pass.""
This rate control bug in the original patch is not the underlying cause
of the quality regression but simply unmasked a problem which stems
from applying 0 bits to the last frame in a short KF group at the start
of a chunk.
Marco Paniconi [Mon, 3 Sep 2018 05:17:32 +0000 (22:17 -0700)]
vp9-svc: Fix condition for pattern constraints
For fixed/non-flexible SVC mode: on non-key spatial
enhancement layers modify constraint on the inter-layer
prediction to include the first_spatial_layer_to_encode.
Marco Paniconi [Fri, 31 Aug 2018 22:42:19 +0000 (15:42 -0700)]
vp9-svc: Add first_spatial_layer_to_encode per superframe
VP9E_SET_SVC_LAYER_ID sets the first spatial layer to
encoder per superframe, so add this parameter to svc encoder.
This is needed, for example, to properly set is_key_frame for
spatial layers when base spatial layer is skipped encoded.
Hui Su [Tue, 17 Jul 2018 05:05:19 +0000 (22:05 -0700)]
ML based rectangular partition search pruning
Add a ML model to predict if rectangular partition search can be skipped
without much coding loss. This model is enabled for speed 0 low bitdepth
only.
Johann [Thu, 30 Aug 2018 21:07:02 +0000 (14:07 -0700)]
silence c++ abi warning
Linking c++ libraries built with gcc 6 and gcc 7 on arm
generates some warnings because of incompatibilities between those
compilers:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77728
libvpx does not generate a c++ library. C++ is only used for examples and tests.
Jingning Han [Mon, 27 Aug 2018 22:22:24 +0000 (15:22 -0700)]
Rework enc/dec mismatch detection
The previous enc/dec mismatch detection assumes the previously
reconstructed frame would always stay at frame buffer pool index
at 0. It could hence cause certain delay in enc/dec mismatch
detection when the immediate reconstruction frame is not yet
propagated to index 0 in the buffer map pool.
This change always keeps the latest decoded show frame buffer
index and directly gets the reconstructed frame from encoder and
decoder buffer pools to check for mismatch.
Reason for revert: it causes visual quality drop as described in b/112953058.
Original change's description:
> Prevent double application of min rate in two pass.
>
> The initial allocation of bits in the two pass code to each frame
> should be within the min max limits on the command line. However,
> when forming an ARF group the cost of the ARF is shared by frames
> in that group such that the residual bits for a frame could drop below
> the min value. This change prevents the minimum being re-applied
> after the cost of the ARF has been deducted as this may otherwise
> cause low rate sections to overshoot their target.
>
> Test runs comparing to a baseline run with min and max section pct
> 0-2000% vs one closer to the YT use case (50-150%) suggest that
> this fix not only results in better rate control but also gives a better
> rd outcome.
>
> For example the HD set vs 0-2000% baseline (opsnr, ssim).
> Old code (50-150): +0.751, +1.099
> New code(50-150): +0.241, -0.009
>
> Change-Id: I715da7b130bf53ba8aa609532aa9e18b84f5e2ef
Jingning Han [Wed, 22 Aug 2018 17:23:53 +0000 (10:23 -0700)]
Skip update prev_mi frame in show_existing_frame mode
When the current frame is coded by directly using a reference
frame in buffer, no need to update the prev_mi frame information
for next frame encoding control.
Hui Su [Wed, 22 Aug 2018 05:02:42 +0000 (22:02 -0700)]
Rework the ref_frame_skip_mask feature in RDO
Previously we often skip all compound inter prediction modes,
causing large coding loss. This patch modifies how we set the
ref_frame_skip_mask so that compound modes are considered in RDO.
Jingning Han [Tue, 21 Aug 2018 00:03:07 +0000 (17:03 -0700)]
Unify set_arf_sign_bias function
Determine if an ARF is on the future side by checking if its
offset meets the gop frame length. This unifies the support to
single- and multiple-layer ARF cases.
Supradeep T R [Tue, 12 Jun 2018 08:27:39 +0000 (13:57 +0530)]
Loopfilter MultiThread Optimization
Adding LPF within the tileworker hook. This means that LPF will be done
immediately after decode, without waiting for all threads to sync.
Performance Improvement -
Platform Resolution 2 Threads 4 Threads
X86 720p 7.24% 22.04%
1080p 5.29% 17.02%
ARM 720p 4.61% 8.75%
1080p 5.55% 12.03%
x86 Improvement measured on Intel Core i7-6700 CPU @ 2.10GHz set
in performance with turbo mode off
ARM Improvement measured on Nexus 6 Snapdragon 805 Quad-core @ 2.65 GHz