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.
Marco Paniconi [Wed, 28 Mar 2018 19:09:54 +0000 (12:09 -0700)]
vp9-svc: Modify logic for frame dropping with spatial layers.
In the constrained framedrop mode for svc: modify the buffer check
condition relative to (non-zero) dropmark to include uppper spatial layers,
in addition to the current spatial layer.
But keep the single layer check if the buffer goes below zero, since
in this case (buffer underflow) we should force drop of that layer
regardless of upper layers.
James Zern [Wed, 28 Mar 2018 19:42:27 +0000 (12:42 -0700)]
test: use testing::*tuple instead of std::tr1
googletest imports tuple into testing to allow for compatibility across
c++ versions where tuple may be in std::tr1 or std. fixes deprecation
warnings under visual studio 2017
Marco Paniconi [Mon, 26 Mar 2018 17:53:38 +0000 (10:53 -0700)]
vp9-svc: Allow for setting frame drop thresholds per layer.
Add encoder control to set the frame drop thresholds per
spatial layer, and add a frame drop mode: 0 = per-layer drop,
and 1 = constrained drop mode (a drop on a given layer forces
drops to all upper layers).
Default is mode 0 (per-layer dropping).
Implementation for mode 1 will come in subsequent change.
If the control is not used, then the spatial layer frame
drop thresholds (water mark) are all equal and set to the value
given by the encoder config (oxcf->drop_frames_water_mark).
Even on x86_64, emms has to be called if the x87 state has
been clobbered - the calling code (either within libvpx or
in a caller outside of libvpx) may be using the x87 instructions,
even though use of them isn't all that common on x86_64.
Martin Storsjö [Fri, 23 Mar 2018 19:49:40 +0000 (19:49 +0000)]
Merge changes from topic "llvm-mingw"
* changes:
configure: Add an arm64-win64-gcc target
test: Check for ARCH_X86_64 in addition to _WIN64
configure: Add an armv7-win32-gcc target
ads2gas: Add a -noelf option
Reason for revert: x87 instruction usage might not be as
clear cut as I would like. At the very least, llvm mingw
builds appear to having issues with emms.
Original change's description:
> remove fldcw/fstcw from Win64 builds
>
> _MCW_PC (Precision control) is not supported on x64:
> https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/control87-controlfp-control87-2
>
> The x87 FPU is not used on Win64 or ARM so setting the x87 control word
> is not necessary. The SSE/SSE2 and ARM FPUs don't have a precision
> control - the precision is embedded in each instruction - so the need to
> set the control word is also gone.
Johann [Mon, 5 Mar 2018 21:48:35 +0000 (13:48 -0800)]
remove fldcw/fstcw from Win64 builds
_MCW_PC (Precision control) is not supported on x64:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/control87-controlfp-control87-2
The x87 FPU is not used on Win64 or ARM so setting the x87 control word
is not necessary. The SSE/SSE2 and ARM FPUs don't have a precision
control - the precision is embedded in each instruction - so the need to
set the control word is also gone.
Martin Storsjo [Wed, 21 Mar 2018 12:15:13 +0000 (14:15 +0200)]
configure: Add an arm64-win64-gcc target
This configuration doesn't require any extra custom settings, since
it only uses neon intrinsics that are handled automatically by the
compiler (no external assembly).
Martin Storsjo [Wed, 21 Mar 2018 12:12:04 +0000 (14:12 +0200)]
configure: Add an armv7-win32-gcc target
This builds for windows on arm, with llvm-mingw. The target triplet
is named -gcc since that's how similar existing targets are named,
even though it technically runs clang (via frontends named
"$CROSS-gcc").
Assemble using $CC -c since there's no standalone assembler
available (except perhaps llvm-mc).
Jerome Jiang [Tue, 20 Mar 2018 22:39:02 +0000 (15:39 -0700)]
vp9 svc frame drop: enable adaptive rd for row mt.
adaptive_rd_threshold_mt is set to 1 when speed >= 7 for SVC.
QVGA in SVC uses speed 5 which set adaptive_rd_threshold_mt to 0.
If VGA or HD is dropped for the last super frame, the flag is still 0
when the encoder is destroyed. Thus memory won't be released.
Linfeng Zhang [Thu, 22 Mar 2018 01:00:40 +0000 (18:00 -0700)]
Fix a strict-overflow warning
Compiler -- gcc (Debian 7.3.0-5) 7.3.0
./libvpx/vp9/encoder/vp9_denoiser.c:374:9: assuming signed overflow
does not occur when assuming that (X + c) < X is always false
[-Wstrict-overflow]
for (j = 0; j < xmis; j++) {
Jerome Jiang [Tue, 20 Mar 2018 18:12:16 +0000 (11:12 -0700)]
VP9 SVC: Add control to disable inter layer prediction.
Add VP9E_SET_SVC_INTER_LAYER_PRED to disable inter layer (spatial)
prediction.
0: prediction on
1: prediction off for all frames
2: prediction off for non key frames
Marco Paniconi [Mon, 19 Mar 2018 03:46:30 +0000 (20:46 -0700)]
vp9-svc: Improve frame dropper for spatial layers.
SVC frame dropper: modify the logic to allow for individual
spatial layers to drop. This removes the constraint that all
upper spatial layers must drop when a given spatial layer drops.
Add a flag to the pkt to indicate whether a spatial layer is
encoded or dropped. This is needed for applications that enable
this feature (frame dropping for SVC).
For a current spatial layer, if its previous spatial layer is
dropped, then disable certain features for that layer:
inter-layer prediction, base_mv, partition_reuse, copy partition.
Also add the constraint to never drop a spatial layer if its
base layer is a key frame.
Updates to sample encoder (vp9_spatial_svc_encoder) and the
SVC datarate unittests to properly handle frame dropping.
Bump up ABI version.
Change-Id: I7d14ccf67b8d014a7abfce5ba3989fc623e94067
James Zern [Sat, 17 Mar 2018 00:47:56 +0000 (17:47 -0700)]
CopyFrameTest: reduce max size for 32-bit targets
avoids potential OOM when allocating 3 buffers for 16383x16383; 3840 is
used as a replacement
this test was missed in: 215bddf32 vpx_scale_test: reduce max size for 32-bit targets
Marco Paniconi [Wed, 14 Mar 2018 17:03:31 +0000 (10:03 -0700)]
vp9-svc: Frame dropper for SVC.
If a given spatial layer decides to drop, due to the
buffer/overshoot conditions for that layer, then drop
that current spatial layer and all spatial layers above.
In the current implementation the svc frame counter
(and hence the pattern for the non-flexible SVC case)
are updated on frame drops.
Also add last spatial layer encoded to the pkt.
This is useful for RTC applications that enable
frame dropping for SVC.
Update to the SVC datarate tests:
enabled frame dropper on all SVC datarate tests, and
made a fix to properly set the temporal_layer_id, which
works now even on frame drops.
Reason for revert:
this should be investigated further to ensure the memset is really
necessary outside of the static analysis pass.
Original change's description:
> vp9_loopfilter.c: zero lfl_uv
>
> The initialization depends on cm and mi_row which static
> analysis does not approve of.
>
> Clears a static analysis warning:
> warning: The right operand of '+' is a garbage value
> const loop_filter_thresh *lfi = lfthr + *lfl;
>
> Change-Id: I8c863ced2b1e9a7e10103b7281098f20941a6ca2
Marco Paniconi [Thu, 15 Mar 2018 00:00:27 +0000 (17:00 -0700)]
vp9-svc: Bugfix to dyanmic enabling/disabling of layers.
Fix a bug when middle and top spatial layer are skip encoded
(disabled) and then re-enabled again, during the sequence.
Issue is that pending_frame_count in the packing may
be incremented on middle layer, even though that layer is skipped
(not encoded and hence zero size). Fix is to add size check.
Clears static analysis warnings similar to the low bitdepth version:
commit c4367b9b51782969d3b37ead6694d19ef9bfb58c
Author: James Zern <jzern@google.com>
Date: Wed Mar 18 14:34:30 2015 -0700
vp9_resize_plane: quiet some static analysis warnings
Johann [Wed, 14 Mar 2018 20:25:05 +0000 (13:25 -0700)]
vp8 rdopt.c: zero rd.[rate_uv|distortion_uv]
These values are not consistently set before calling update_best_mode.
In vp9_rdopt.c they are individual values instead of a struct and are
zero'd at declaration.
Clears a static analysis warning:
warning: The right operand of '-' is a garbage value
RDCOST(x->rdmult, x->rddiv, (rd->rate2 - rd->rate_uv - other_cost),
warning: The right operand of '-' is a garbage value
(rd->distortion2 - rd->distortion_uv));
Johann [Wed, 14 Mar 2018 20:10:08 +0000 (13:10 -0700)]
vp8 mfqe: zero map[]
The loop appears to set map[i] with the intention of running
the 'j' loop up to that point. However, without zero'ing map[]
first the behavior is unpredictable.
Fixes a static analysis warning:
warning: Branch condition evaluates to a garbage value
for (j = 0; j < 4 && map[j]; ++j) {