Marco [Wed, 24 Jan 2018 04:03:19 +0000 (20:03 -0800)]
vp9-svc: Re-adjust some aq-mode=3 control parameters.
Remove an adjustment to two cyclic refresh (aq-mode= 3)
parameters for SVC. The adjustment was to reduce the
delta-qp on second segment, and reduce the motion threshold.
This was done early on in the SVC encoder development,
in the latest codebase removing this adjustment yields
some improvements in metrics.
The avgPSNR/SSIM metrics increase on average by ~1%
(most clip positive gain), for 3 and 2 layer SVC.
Shiyou Yin [Tue, 23 Jan 2018 03:33:25 +0000 (11:33 +0800)]
vp8: [loongson] fix bug of type conflict.
In commit 577d4fa79, int8_t was used to replace char. This will result in a
compilation error, for int8_t was typedefined to signed char, but not char.
Marco [Tue, 16 Jan 2018 19:37:40 +0000 (11:37 -0800)]
vp8: Fix to multi-res-encoder for skipping streams.
For the vp8 simulcast/multi-res-encoder:
Add flags to keep track of the disabling/skipping of
streams for the multi-res-encoder. And if the lower spatial
stream is skipped for a given stream, disable the motion
vector reuse for that stream.
Also remove the condition of forcing same frame type
across all streams.
This fix allows for the skipping/disabling of the base
or middle layer streams.
Without this applications cannot use the vpx_codec_control macro
for VP9_SET_SKIP_LOOP_FILTER. The tests only cover the underscored
version vpx_codec_control_().
Marco [Wed, 10 Jan 2018 00:35:29 +0000 (16:35 -0800)]
vp9: Skip encoding of enhancement layers on the fly.
For SVC: if an enhancement layer (spatial_layer > 0)
has 0 bandwidth, skip/drop the encoding of the layer.
This allows the application to dynamically disable
higher layers for SVC.
Add flag to signal the skip encoding, this is needed
to modify the packing of the superframe when the top
layer is skipped/dropped.
Also moved some updates (current_video_frame counter and
the last_avg_frame_bandwidth) to the postencode_update_drop_frame().
Added datarate unittest for dynamically going from 3 to 2
and then back to 3 spatial layers.
Vlad Tsyrklevich [Wed, 10 Jan 2018 23:53:09 +0000 (15:53 -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 some function pointer casts that I missed in my last
CL https://crrev.com/c/780144.
paulwilkins [Tue, 9 Jan 2018 15:51:28 +0000 (15:51 +0000)]
Add zoom break out for kf boost loop.
Adds a breakout threshold to key frame boost loop.
This reduces the boost somewhat in cases where there is a
significant zoom component. In tests most clips no effect
but a sizable gain for some clips like station.
paulwilkins [Wed, 10 Jan 2018 15:03:21 +0000 (15:03 +0000)]
Fix kf detection in some slide shows.
This fix improves detection of key frames in slide shows.
In particular it helps if the slides are pictures of varying formats
as in a sample provided by yclin@.
This change does not impact any of the clips in our standard tests
but for the example slide show test clip helped global psnr by
several db and resolved a serious visual quality issue.
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%).
paulwilkins [Thu, 4 Jan 2018 16:02:42 +0000 (16:02 +0000)]
Fix bug in use of zoom metric as part of arf breakout.
The in/out (or zoom metrics) in accumulate_frame_motion_stats()
are in effect a % of the blocks that have a motion vector pointing
either towards or away from the center. As such they are already
normalized in terms of image size and the thresholds against which
these are tested should be image size independent.
In practice a zoom either in or out is an indicator for a shorter group
length so the abs value is more important as a breakout clause.
This patch fixes the threshold test. Clips without noticeable zoom show
no effect but some with strong zooms such as "station" show a big
gain (5-10%). Average psnr-hvs gain on hdres set was 0.292%
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."