Marco Paniconi [Tue, 8 May 2018 18:05:03 +0000 (11:05 -0700)]
vp9-svc: Fix to SVC for frame dropping.
When the previous frame is dropped, for the current
spatial layer make sure the lst_fb_idx corresponds
to the buffer index last updated on the (last) encoded
TL0 frame(for same spatial layer).
This is needed to preserve the temporal prediction pattern
for fixed/non-flexible mode under frame dropping.
This patch improves coding of slide shows with fade or other
complex transitions.
Previously, fades and other complex transitions between static "slides"
were sometimes being incorrectly marked such that they were coded
as a single static slide rather than two slides with a transition.
As the initial key frame for the first slide is not necessarily a good
predictor of the second slide and ARFs were turned off, this led to a
poor visual and metrics outcome in some such cases.
This patch allows for long GF groups in static sections before and after
a complex transition (instead of just with simple slide transitions) with
one or more normal ARF groups during the transition. It also enforces a
single "normal" length GF group after the transition before any extended
group is allowed. The reason for this is that the ARF that spans the
transition my not have a very high quality and hence may not act as a
good GF for the long static section that follows.
Martin Storsjo [Fri, 4 May 2018 06:32:41 +0000 (09:32 +0300)]
configure: Disable pthread_h if linking failed
When doing both check_header and check_lib, the check_header call
will already enable pthread_h if the header was found. This was
overlooked when the pthread linking check was amended into a header
check and a separate linking check in 9b7d4cce635e.
This brings back the same result as the original check in 38dc27cc6.
Marco Paniconi [Thu, 3 May 2018 01:04:35 +0000 (18:04 -0700)]
vp9-svc: On key frame update all reference slots for SVC.
Key frame updates the slots corresponding to the 3 references
last/golden/altref, but for SVC where more references buffers
may be in use, especialy for dynamically swithing up/down in layers,
make sure we should update all 8 slots on key frame.
VP9 SVC: Add new level to constrain inter-layer pred.
Add another level (INTER_LAYER_PRED_ON_CONSTRAINED) to the
inter-layer prediction control. This new level enforces the
condition that a given spatial layer S can only do inter-layer
prediction from the previous spatial layer (S - 1) from the same
time/superframe.
Marco Paniconi [Fri, 27 Apr 2018 00:32:22 +0000 (17:32 -0700)]
vp9-svc: Remove unneeded call and init some parameters.
Remove the unneeded vp9_copy_flags_ref_update_idx(cpi),
and initialize the struct parameters needed for the
GET_SVC_REF_FRAME_CONFIG. This init is useful for the case
for spatial layer frame drops.
Marco Paniconi [Thu, 19 Apr 2018 00:15:16 +0000 (17:15 -0700)]
vp9: Rate control fix for CBR mode.
For CBR mode: modify the qp clamping to allow q to respond
faster to overshoot. Can reduce some suprious overshoot events
observed in screen content coding.
Marco Paniconi [Mon, 16 Apr 2018 23:15:05 +0000 (16:15 -0700)]
vp9: Changes for scene detection overshoot and SVC.
Refactor the scene detection for 1 pass cbr to allow the
scene detection to be checked once per superframe (on the base layer),
using the full resolution sources.
If scene change is detected: check for re-encoding due to
large overshoot for all spatial layers withing the superframe.
Add speed feature to control the re-encode step.
Keep the re-encode step on for now.
Small change in nonrd_pickmode to remove the possible skip of golden
reference for SVC, when the high_source_sad is set for the superframe.
Change only affects SVC encoding with screen-content mode enabled.
Old vs New
Variance 64x64 time: 1145 ms 797 ms
Variance 64x32 time: 1200 ms 831 ms
Variance 32x32 time: 1228 ms 1135 ms
Variance 32x16 time: 1374 ms 1491 ms
Variance 16x16 time: 1688 ms 1571 ms
sse2 vs avx2
Variance 32x64 time: 1645 ms 957 ms
Variance 16x32 time: 2031 ms 1243 ms
Variance 16x8 time: 3071 ms 2275 ms
Old vs New
Variance 64x64 time: 197 ms 143 ms
Variance 64x32 time: 200 ms 146 ms
Variance 32x64 time: 203 ms 140 ms
Variance 32x32 time: 214 ms 152 ms
Variance 32x16 time: 243 ms 153 ms
Variance 16x32 time: 234 ms 197 ms
Variance 16x16 time: 205 ms 205 ms
Variance 16x8 time: 228 ms 222 ms
Variance 8x16 time: 228 ms 232 ms
Variance 8x8 time: 282 ms 240 ms
Variance 8x4 time: 506 ms 341 ms
Variance 4x8 time: 518 ms 415 ms
Variance 4x4 time: 604 ms 628 ms
Observed vp9 encoder speed up when encoding a 720p video.
Martin Storsjo [Sat, 14 Apr 2018 20:40:46 +0000 (23:40 +0300)]
configure: Test linking pthreads before using it
This avoids enabling pthreads if only pthreads-w32 is available.
pthreads-w32 provides pthread.h but has a link library with a
different name (libpthreadGC2.a).
Generally, always using win32 threads when on windows would be
sensible.
However, libstdc++ can be configured to use pthreads (winpthreads), and
in these cases, standard C++ headers can pollute the namespace with
pthreads declarations, which break the win32 threads headers that
declare similar symbols - leading us to prefer pthreads on windows
whenever available (see d167a1ae and bug 1132).
Marco Paniconi [Fri, 6 Apr 2018 16:17:46 +0000 (09:17 -0700)]
vp9-svc: Hybrid search on spatial layers whose base is key.
For spatial layers whose base is a key frame, i.e., when
svc.layer_context[cpi->svc.temporal_layer_id].is_key_frame = 1,
allow for hybrid search, similar to what we do on key frames.
For small blocks (<= 8x8) rd-based intra search will be used,
otherwise non-rd pick mode is used.
Feature is controlled by nonrd_keyframe, which is set to 1
for now on non-base spatial layers, so this change has
currently no effect.
Small change only when inter-layer prediction is off, as we now
call vp9_pick_intra_mode instead of vp9_pick_inter_mode on key frame.
But this change is very small/insignificant.
Reason for revert: <INSERT REASONING HERE>
We need to do this on all key frames in the stream (not just the first one). Will make another cleaner change for this.
Original change's description:
> vp9-svc: Fix to first superframe when inter_layer is off.
>
> When the application selects the setting INTER_LAYER_PRED_OFF
> each spatial stream should be decodeable separately.
> For this we need to force key frames on all spatial layers
> on the first superframe.
>
> In order to maintain the quality at the beginning of the stream
> the active_worst for spatial layer of the second superframe is set
> to the last_QP of the correspondng spatial layer of the first superframe.
> Also make sure nonrd_keyframe is set for non-base spatial layers.
>
> Change only affects SVC mode wit number_spatial_layers > 1 and
> svc->disable_inter_layer_pred == INTER_LAYER_PRED_OFF.
> And only affects first and second frame of sequence.
>
> Change-Id: I8ee9a0873ab1d3a02515774571f719617771ad41
Marco Paniconi [Wed, 4 Apr 2018 23:24:39 +0000 (16:24 -0700)]
vp9-svc: Fix to first superframe when inter_layer is off.
When the application selects the setting INTER_LAYER_PRED_OFF
each spatial stream should be decodeable separately.
For this we need to force key frames on all spatial layers
on the first superframe.
In order to maintain the quality at the beginning of the stream
the active_worst for spatial layer of the second superframe is set
to the last_QP of the correspondng spatial layer of the first superframe.
Also make sure nonrd_keyframe is set for non-base spatial layers.
Change only affects SVC mode wit number_spatial_layers > 1 and
svc->disable_inter_layer_pred == INTER_LAYER_PRED_OFF.
And only affects first and second frame of sequence.
Marco Paniconi [Thu, 5 Apr 2018 22:54:17 +0000 (15:54 -0700)]
vp9-svc: Fix to disable cyclic refresh on key superframes.
Cyclic refresh is disabled on key frames, but we did not
disable it for for spatial layers whose base is a key frame
(i.e., on a key-superframe).
This fix means generally somewhat lower frame-level QP will be
used for those spatial layers whose base is a key frame,
which will generally mean little better quality for the
key-superframes.
Johann [Tue, 27 Mar 2018 17:41:54 +0000 (10:41 -0700)]
ios configure: quiet shell warning
Generating file lists on a non-mac with:
--target=x86-iphonsimulator-gcc --enable-external-build
the lack of xcrun would cause a warning to print:
libvpx/build/make/configure.sh: line 1397: [: : integer expression expected
Marco Paniconi [Tue, 3 Apr 2018 22:50:19 +0000 (15:50 -0700)]
vp9-svc: Fix in choose_partitioning for different scaling.
In the SVC encoder LAST ref frame should be the last temporal
reference at the same resolution. This is the case for the default/fixed
patterns, but may not be the case for arbitrary pattern in flexible mode.
Add check that the LAST reference frame has same resolution as the current frame.
If the reference scale for LAST is different from current treat the current
frame as key frame just for the purpose of superblock partitioning.
This avoids potential segfault in vp9_int_pro_motion_estimation() for different
scaled reference.
paulwilkins [Thu, 29 Mar 2018 11:52:15 +0000 (12:52 +0100)]
Add extra case to wq_err_divisor()
Add extra case for 360P and smaller.
This hurts a little in psnr for the derf cif set but helps a little
in terms of average rate accuracy. Most clips come in a little
smaller with this patch.