Marco [Fri, 5 Jan 2018 17:33:27 +0000 (09:33 -0800)]
vp9-svc: Use eightap_smooth for downsampling at low resol.
Switch from bilinear to eighttap_smooth for frame-level
downsampling at low resolutions (<= 320x240).
avgPSNR/SSIM metrics increase from ~0.5-2% (all clips positive gain),
for 2 and 3 spatial layer SVC, with 3 temporal layers.
Small/negligible increase in encoding time (< 1%).
Ralph Giles [Thu, 21 Dec 2017 21:48:55 +0000 (13:48 -0800)]
Don't force inlining for msvc targets.
INLINE is defined as __forceinline for vs* configs, but is the
normal, compiler-discretion inline for gcc/clang configs. This
makes many functions very large when building for windows targets,
much larger than they are elsewhere.
Use '__inline' as a consistent definition to get consistent function
sizes. Although Visual Studio documentation says that 'inline' is
only available in C+ code. This is probably incorrect, since Visual
Studio 2017 accepts C99 'inline' even when passed /TC. Nevertheless,
this commit uses the recommended '__inline' for consistency.
Marco [Fri, 15 Dec 2017 00:35:33 +0000 (16:35 -0800)]
vp9-svc: Add layer bitrate targeting to SVC datarate tests.
Modify and update the SVC datarate unittests to verify the
rate targeting for each spatial-temporal layer.
The current tests were only verifying the rate targeting
of the full SVC stream, not individual layers.
Also re-enabled a test that was disabled.
This is a stronger verification of the layered rate control
for SVC for 1 pass CBR encoding.
Added PostEncodeFrameHook, needed to get the layer_id and
update the layer buffer level.
James Zern [Tue, 19 Dec 2017 07:17:45 +0000 (23:17 -0800)]
lpf_test: correct threshold ranges
the random number generator creates values from [0, range) add 1 to all
and make hev more realistic by mirroring its calculation of level >> 4,
i.e., [0, 3]
Shiyou Yin [Fri, 15 Dec 2017 09:06:47 +0000 (17:06 +0800)]
vp8: [loongson] optimize loopfilter v2.
Optimize function vp8_mbloop_filter_vertical_edge_mmi and
function vp8_mbloop_filter_horizontal_edge_mmi.
Make full use of memory loading delay slot and reduce unnecessary
instructions.
Marco [Wed, 13 Dec 2017 21:34:44 +0000 (13:34 -0800)]
vp9: Update to SVC datarate tests.
With recent fixes to rate control for SVC the
buffer underrun in the tests does not happen,
so comment and TODO can be removed.
Also, in some of these SVC tests, replace the HD clip
with the corresponding VGA clip, which has > 400 frames.
For the (niklas) HD clip: it has only 60 frames but the
test was running up to 300 frames. Fixed it to 60 frames.
Keep some tests with the HD clip, needed for the 4 thread
and 5 level scaling test.
Marco [Fri, 8 Dec 2017 01:24:41 +0000 (17:24 -0800)]
vp9: Reset rc flags on some configuration changes.
For large dynamic changes in target avg_frame_bandwidth, or
a change in resolution, via the update in change_config()),
reset the under/overshoot flags (rc_1_frame, rc_2_frame)
to prevent constraining the QP for the first few frames
following the change.
For SVC use the spatial stream avg_frame_bandwidth in
reset condition.
For the avg_frame_bandwidth condition, use fairly large
threshold (~50%) for now in reset.
This allows for better/faster QP response if, for example,
application dynamically changes bitrate by large amount.
paulwilkins [Mon, 4 Dec 2017 13:41:44 +0000 (13:41 +0000)]
Bug fix for second reference stats.
Immediately following a key frame the trailing second reference
error in the first pass stats will be based on a reference frame from
the prior key frame group and will thus usually be much larger.
This fix eliminates that effect (which typically triggers a short arf
group immediately after a key frame). It also changes the accounting
for the first frame in each new arf group.
This change gives large gains on a couple of clips that contain mid
sequence key frames (e.g. 6% on 1080P tennis). Overall there was
a net gain in PSNR and PSNR-HVS ~(0.05- 0.4%) and mixed results for
SSIM (+/- 0.2%).
Marco [Wed, 6 Dec 2017 19:21:29 +0000 (11:21 -0800)]
vp9-svc: Set downsampling filter for VGA layer.
Downsampling filter for SVC was set to subsample (phase 0)
for HD -> VGA, and bilinear averaging (phase 8) for VGA -> QVGA.
This change makes it bilinear averaging for HD -> VGA.
Given the recent commit 9f9d4f8, quality is improved with
this change: avgPSNR/SSIM up ~1-3% on HD clips in RTC set.
Speed decrease of ~1% for 3 layer SVC.
Marco [Wed, 6 Dec 2017 18:11:54 +0000 (10:11 -0800)]
vp9: Nonrd-pickmode: move some early exits up.
Move the early exit checks on usable_ref_frame and
skip_ref_find_pref up before the check on flag_svc_subpel.
The code under flag_svc_subpel requires frame_mv to be set
for the golden/spatial reference, which is only set if the
both those exits don't pass.
Marco [Fri, 1 Dec 2017 23:20:41 +0000 (15:20 -0800)]
vp9-svc: Allow for nonzero motion on spatial reference.
For nonrd pickmode on a given spatial layer, the spatial
(golden) reference was always only using zeromv for prediction.
In this patch if the downsampling filter used for generating
the lower spatial layer is an averaging filter (nonzero phase),
we allow for subpel motion on the spatial (golden) reference to
compensate for the shift. This is done by forcing the testing of
nonzero motion mode to compensate for spatial downsampling shift.
Improvement for cases where the downsampling is averaging filter.
In the current code this is only done for generating
resolutions <= QVGA.
Improvement for avgPSNR/SSIM on RTC set for speed 7: ~1.2%.
Gain is larger (~2-3%) for VGA clips with 2 spatial layers.
~1% speed slowdown for 3 layer SVC on mac.
Johann [Fri, 1 Dec 2017 20:46:37 +0000 (12:46 -0800)]
nasm defaults to -Ox
No need to specify default behaviour. The original change introducing nasm:
https://chromium.googlesource.com/webm/libvpx/+/7be093ea4d50c8d38438f88cb9fa817c1c9de8dd
mentions requiring 2.0.9, which was the first release to default to this behaviour:
http://www.nasm.us/doc/nasmdoc2.html
"The -Ox mode is recommended for most uses, and is the default since NASM 2.09."
Marco [Thu, 30 Nov 2017 20:08:00 +0000 (12:08 -0800)]
Nonrd-pickmode: avoid duplicate computation of UV predictor.
Avoids duplicate computation of UV predictor.
Bit-exact when static_threshold is zero.
Small/neutral difference on RTC set with nonzero static_threshold
(since UV predictor won't be skipped with this change).
James Zern [Thu, 30 Nov 2017 18:52:25 +0000 (10:52 -0800)]
decouple spatial-svc from encoder abi
this is only meant for testing. along with --enable-experimental
--enable-spatial-svc require VPX_TEST_SPATIAL_SVC to be defined rather
than bumping the encoder ABI.
Marco [Tue, 21 Nov 2017 23:04:53 +0000 (15:04 -0800)]
vp9-svc: Fix to the layer buffer settings.
For the case when the number of temporal layers > 1,
the buffer levels (starting/optimal_buffer_level,
and maximum_buffer_size) were not scaled properly.
In vp9_update_layer_context_change_config():
when setting the layer-buffer levels, fix is to scale
the layer-target_bandwidth by the target_bandwidth
(which is the full stream bandwidth) instead of the
spatial_layer_target.
This is needed because prior to the call
vp9_update_layer_context_change_config(), set_rc_buffer_sizes()
is called which sets the buffer levels based on target bandwidth
(which is the full bandwidth for the SVC stream).
This fix properly sets the layer-buffer levels based on the
layer-bandwidth, and leads to better rate targeting.
Small/neutral change in avgPSNR/SSIM metrics on RTC set.
Vlad Tsyrklevich [Mon, 20 Nov 2017 21:40:54 +0000 (13:40 -0800)]
[CFI] Remove function pointer casts
Control Flow Integrity [1] indirect call checking verifies that function
pointers only call valid functions with a matching type signature. This
change eliminates function pointer casts to make libvpx CFI-safe.
paulwilkins [Thu, 16 Nov 2017 16:15:06 +0000 (16:15 +0000)]
Disable allow_partition_search_skip for speed 2.
When allow_partition_search_skip is set the two pass code
can optionally skip the partition search in the rd loop if the image
appears static (based on selection of 0,0 motion).
Unfortunately 0,0 motion does not necessarily mean that there are
no meaningful changes or that motion or intra modes will not be selected
in the second pass.
Disabling "allow_partition_search_skip" may hurt the encode speed a little
for a small number of clips but can have a big impact on compression.
The most notable example of this in our test sets is "bridge_close_cif"
where this change gives a gains of 18%, 12% and 16% in opsnr, ssim and
psnr-hvs.
paulwilkins [Wed, 15 Nov 2017 16:58:05 +0000 (16:58 +0000)]
Remove decay_accumulator clause from alt ref breakout.
The decay accumulator clause covers similar ground to the
new clause that tests the accumulated second reference error
so it has been removed to reduce complexity.
paulwilkins [Wed, 15 Nov 2017 16:39:54 +0000 (16:39 +0000)]
Add clause to alt ref group breakout.
Add a clause to the breakout test for alt ref groups that
examines the size of the accumulated second reference
frame error compared to the cost of intra coding.
This clause causes a reduction in the average group length for many
clips. Alongside the change to the group length the minimum
boost is increased.
On balance the results are positive for psnr and psnr-hvs
but is negative for ssim/fast ssim for the smaller image formats.
Strong gains on some harder clips (eg ducks take off (midres) ~20%,
husky (lowres) 6-17%. Most of the negative cases are lower motion
clips. Subsequent patch hopefully will help with those.