Commit Graph

106 Commits

Author SHA1 Message Date
Marco Paniconi
efa786d464 vp9 svc: Make top layer non-ref: for 2 TL case
Only affects 2 temporal layer case.
Modified the flags for 2 temporal layers to make
top layer (top spatial, top temporal) a non-reference
frame, conistent with the 3 TL case.

Add mismatch check to the datarate test of changing
svc pattern on the fly, which is test for 2 temporal
layers.

This re-applies the change: 254e2f5501,
that was reverted in: 658eb1d675.

Change-Id: Ib5fd4a7a0312c0c05329ae75baac480af34b4694
2018-01-31 09:17:43 -08:00
Marco Paniconi
7edd1a6cea Revert "vp9 svc: fix to make top layer frame non-ref"
This reverts commit 254e2f5501.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> vp9 svc: fix to make top layer frame non-ref
> 
> Add mismatch check to the datarate test of changing svc pattern on the
> fly.
> 
> Change-Id: I6a878736de44e6a40c077ed6430aabd7fadabdd9

TBR=marpan@google.com,builds@webmproject.org,jianj@google.com

Change-Id: Ibcb600438098f8dc380fe7e1de90cb81fc367468
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
2018-01-31 16:49:16 +00:00
Jerome Jiang
254e2f5501 vp9 svc: fix to make top layer frame non-ref
Add mismatch check to the datarate test of changing svc pattern on the
fly.

Change-Id: I6a878736de44e6a40c077ed6430aabd7fadabdd9
2018-01-29 18:38:46 -08:00
Jerome Jiang
cc91abb325 vp9 svc: Update temporal_layering_mode in config change.
temporal_layering_mode can be changed on the fly.

BUG=webm:1488

Change-Id: I223fd4085184e41878ddf0f9244d2e3d07636ae3
2018-01-26 13:38:04 -08:00
Marco
f8639b1554 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.

Change-Id: Idaccdb4aca25ba1d822ed1b4219f94e2e8640d43
2018-01-11 10:38:30 -08:00
Marco
321f295632 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%).

Change-Id: I758472fc4fddd51d87f13c9d1a1cd4986ef5d41f
2018-01-05 10:17:08 -08:00
Marco
a2127236ae vp9: Reset buffer level on large bitrate changes.
For a large change in the target avg_frame_bandwidth,
via the update in change_config()), reset the buffer_level
to optimal_level.

This fix prevents possible frame drops, where for example,
encoder suddenly goes from lower to higher bitrate.

Change-Id: I2f844c41d04c01240e85f574e59d2b9075c7eb6d
2017-12-19 09:57:21 -08:00
Marco
a40fa1f95d 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.

Change-Id: Ib6e3761732d956949d79c9247e50dba744a535c0
2017-12-13 10:41:38 -08:00
Jerome Jiang
c1e511fd82 vp9 svc: Allow denoising next to highest resolution.
Denoise 2 spatial layes at most.

Add noise sensitivity level 2 for vp9 such that applications can control
whether to denoise the second highest spatial layer.

Add tests to cover this case.

Change-Id: Ic327d14b29adeba3f0dae547629f43b98d22997f
2017-12-11 15:20:19 -08:00
Marco
3562d6b0a2 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.

Change-Id: If834a320e372b8b922a6bf7cab4227703b1beae6
2017-12-06 12:01:24 -08:00
Marco
f0b4868625 vp9-svc: Fix condition for setting downsampling filter.
Use (width * height) for setting downsampling filter type.

Change-Id: If4acfde7ff9339e0584155f8a4d15b2f134211f2
2017-11-28 16:28:29 -08:00
Marco
cbe62b9c2d 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.

Change-Id: Ic0f4f7f3487c37b9a9adb4781ae5edfed7140a57
2017-11-26 22:17:48 -08:00
Jerome Jiang
fdb054a05d vp9: SVC feature to use partition from lower resolution.
For SVC with 3 spatial layers:
Add feature to copy/upscale partition from middle spatial layer
to the upper/highest resolution, when superblock sad is not high.

Enabled for speed >= 7 and only for non-reference frames.

Speedup ~3-4%, small loss in avgPNSR/SSIM of ~1%.

Change-Id: I7f0a2716c0fde28bade0f86159d11b7e31d6ab8d
2017-11-09 14:16:50 -08:00
James Zern
df18412f32 remove vp9_firstpass.c w/CONFIG_REALTIME_ONLY
BUG=webm:1446

Change-Id: I6e0ea9342c715d354c641109737172afa649b85b
2017-07-11 13:10:16 -07:00
Marco
e30781ff80 vp9: SVC: Force subpel search off under certain conditions.
For SVC 1 pass non-rd mode:
Force subpel seach off for SVC for non-reference frames
under motion threshold.

Add flag to svc context to indicate if the frame is not used
as a reference.

Little/no quaity loss, ~2% speedup.

Change-Id: Ic433c44b514d19d08b28f80ff05231dc943b28e9
2017-06-01 20:48:52 -07:00
Marco
4e23998fb4 vp9: SVC: Add option to set downsampling filter type.
Add option in SVC to set the filter type and phase for
the frame level downsampling filters.

For 3 spatial layers: set downsampling filter type to bilinear
and set phase to 8, for lowest spatial layer.

Change-Id: Id81f4b1ba93db19c1cd37b6a46d1281a2c61bc43
2017-05-09 17:22:44 -07:00
Marco
9586d5e682 vp9: SVC: Modify conditon for setting downsample filter type.
Base the condition on the resolution of the spatial layer.
And remove restriction on scaling factor.

Change-Id: Iad00177ce364279d85661654bff00ce7f48a672e
2017-05-08 14:13:49 -07:00
Marco
9b729748ac vp9: SVC: Set downsample filtertype for lowest spatial layer.
For lowest spatial layer, in 3 layer SVC, set the
downsampling filtertype to get averaging filter.
Needed for reducing aliasing on low-res layer,
small increase in overall encoder time.

Change-Id: Ia31460123bd91b72eca49b46dd924b9f226d4563
2017-05-05 19:29:09 -07:00
Marco
3134a52d26 vp9: SVC: Redefine the source downsample filter choice.
Rename the source downsampling filter, and define it
per spatial layers. Used 1 pass CBR SVC.

Change-Id: I8135f2ab89c535c53429b9c58b586f746bb668c7
2017-04-20 10:17:13 -07:00
Marco
348bdc0195 vp9: Add phase to get averaging filter for 1:2 downsampling.
The scaling filter with zero shift will give sub-sampling for
2x downsampling. Allow for a phase shift to get an averaging filter.

Usage is for source scaling in 1 pass SVC mode for 1:2 downscale.
Reduces aliasing in downsampled image.

Keep the phase to 0/off for now.

Change-Id: Ic547ea0748d151b675f877527e656407fcf4d51e
2017-04-18 16:56:15 -07:00
Marco
adb9b4eddf vp9: SVC: fix to allow use_base_mv to be used for 3 layers.
Allow use_base_mv to be used for 3 spatial layers where
base is 4x4 scale from the top layer.

Change-Id: If6641baf8b8e4d0fd5dc67619d873c6d75065f43
2017-04-13 20:43:43 -07:00
Marco
076d4bd91a vp9: Fix to crash in svc code.
use_base_mv assumes 2x2 scaling, so fix is to shutoff
this feature unless spatial scale factors are 2.

Added svc unittest for 2 spatial layers with 5x5 scaling,
which generates the issue without this fix.

Also fix some settings in svc unittest:
let the speed setting vary (from 5 to 8), and enable static threshold.

BUG=webm:1344

Change-Id: Idfd0a6c633c21b49a0479601506302cfe974e30e
2016-12-09 08:57:09 -08:00
clang-format
5f6d143b41 apply clang-format
Change-Id: I501597b7c1e0f0c7ae2aea3ee8073f0a641b3487
2016-09-15 15:07:53 -07:00
clang-format
e0cc52db3f vp9/encoder: apply clang-format
Change-Id: I45d9fb4013f50766b24363a86365e8063e8954c2
2016-08-02 16:47:11 -07:00
jackychen
8ce67d714a vp9 svc: Enable different speed setting for each spatial layer.
This change only affects 1 pass cbr svc mode.

Change-Id: If0da87bb200f7e7762755340c40c8157cc7a16ca
2016-07-25 15:11:43 -07:00
JackyChen
110a2ddc9b vp9 svc: Reuse scaled_temp in two stage downscaling.
This change eliminates redundant computation in the two stage
downscaling, which saves ~1% encoding time in 3-layer svc encoding.

Change-Id: Ib4b218811b68499a740af1f9b7b5a5445e28d671
2016-07-12 10:09:55 -07:00
Marco
adf8533cee vp9: Move consec_zero_mv from cyclic refresh to cpi struct.
So it can be used even with aq-mode=3 not enabled.
Also cleans up some code in the places where its used.

No change in behavior.

Change-Id: Ib6b265308dbd483f691200da9a0be4da4b380dbc
2016-04-22 08:09:39 -07:00
James Zern
dc221e761b vp9_svc_layercontext(): fix proto mismatch
Change-Id: I8a76d150a61662fc2e3158a49ce4e642f917029a
2016-03-08 10:37:27 -08:00
Marco
a304d26bf1 vp9-svc: Fix to resetting pattern/flags on key frame.
Chane only affects 1 pass cbr svc mode.

Change-Id: Ie28557409eb87673ed0b66c6dfe1bf3509a18c4d
2016-03-07 13:54:43 -08:00
Marco
c83bcb3474 vp9-svc: Allow for 2 stage downscaling for spatial layers.
For 1 pass cbr mode: allow for two-stage 1:2 scaling
(which will use the 1:2 optimized scaler) if the spatial
layer is 1/4x1/4 of souce.

Without this change, the base layer for 3 spatial layers would
be using the non-normative scaler which is un-optimized/C code.

Change-Id: I9d73f92a4a96927d0f1d6bf75315c1e60513226a
2016-03-01 15:48:42 -08:00
James Zern
8062e10162 Revert "vp9-svc: Fix speed issue with source downscaling for spatial layers."
This reverts commit f51f0998e1.

This causes datarate tests to fail. Some are due to the new default
keyframe distance, another causes an assert even forcing 9999:

[ RUN      ] VP9/DatarateOnePassCbrSvc.OnePassCbrSvc3SpatialLayers/0
test_libvpx:
vpx_dsp/x86/vpx_subpixel_8t_intrin_ssse3.c:853: scaledconvolve2d:
Assertion `y_step_q4 <= 32' failed.

Change-Id: I4ee4fea97f47e4f1a23b82a62e6afc6280961e38
2016-02-26 16:53:26 -08:00
Marco
f51f0998e1 vp9-svc: Fix speed issue with source downscaling for spatial layers.
For 1 pass cbr mode: allow for two-stage 1:2 scaling
(which will use the 1:2 optimized scaler) if the spatial
layer is 1/4x1/4 of souce.

Without this change, the base layer for 3 spatial layers would
be using the non-normative scaler which is un-optimized/C code.

Change-Id: Ifcf526ec2aaf3e5fa7924588d9dd8660bf02fb46
2016-02-26 08:11:37 -08:00
James Zern
00a39d6e04 vp9_svc_layercontext: add missing alloc checks
Change-Id: Ieb305c178c64b3864f0e8fc1a13c29799e1ae8f5
2016-02-17 16:12:40 -08:00
James Zern
c9e057a9a0 vp9_svc_layercontext.c: relocate a macro definition
move SMALL_FRAME_FB_IDX closer to its first use. this is only used with
CONFIG_SPATIAL_SVC.

Change-Id: Ibf2b3e59a3aab2be2c3b3f89b4380ebe272e0ed6
2016-02-02 18:02:33 -08:00
Marco
abf58ecf6a Vidyo patch: Changes to the scalability code.
Changes to mode selection for 1 pass SVC mode:
use base layer motion vector, changes to intra-prediction.

Change-Id: I3e883aa04db521cfa026a0b12c9478ea35a344c9
2016-01-20 08:53:51 -08:00
Marco
e5dfca02a9 vp9-svc: Set initial values for ext_buffer/flag indices.
Set initial values for these parameters in the vp9_init_layer_context().

This also fixes an issue in the svc-bypass mode when frame flags are
passed via the vpx_codec_encode().

Change-Id: I0968f04672f8d3d2fe2cea6b8a23f79f80d7a8b1
2016-01-04 12:28:46 -08:00
Marco
c760c33b99 SVC 1 pass mode: Constrain inter mode search within superframe.
Keep track of frame indexes for the references, and
constrain inter mode search for reference with same
temporal alignment.

Improves speed by about ~15%, no noticeable loss in
compression performance.

Change-Id: I5c407a8acca921234060c4fcef4afd7d734201c8
2015-12-14 15:19:29 -08:00
Debargha Mukherjee
7ceba7c26b Fix a spatial svc assert failure
Fixes spatial svc rc assert failure introdcued in:
https://chromium-review.googlesource.com/#/c/312959/1

Change-Id: I6096bfbc484859d71a5fb55e6a3248a31885af61
2015-12-01 14:24:50 -08:00
Marco
eed5494fc6 vp9-svc: Fix to key frame counter for spatial layers.
Existing condition only applied to temporal layers.

Change-Id: Icef20a59d0afc61d4e14dea01aff4786fa9e41ae
2015-11-18 14:31:37 -08:00
Marco
4fb2ba2861 VP9-SVC: Allow frame dropping due to overshoot for spatial layers.
For 1 pass CBR mode.

Change-Id: I8bceb489a850ec26f05382eecb5c0c32a1bb8883
2015-10-27 14:51:47 -07:00
Marco
7266bedc04 Add first_spatial_layer_to_encode to SVC.
Use the existing VP9_SET_SVC control to set the
first spatial layer to encode.

Since we loop over all spatial layers inside the encoder, the
setting of spatial_layer_id via VP9_SET_SVC has no relevance.
Use it instead to set the first_spatial_layer_to_encode,
which allows an application to skip encoding lower layer(s).

Change only affects the 1 pass CBR SVC.

Change-Id: I5d63ab713c3e250fdf42c637f38d5ec8f60cd1fb
2015-10-06 08:56:15 -07:00
Marco
c05c58f8ff aq-mode for SVC: Add consec_zero_mv to layer context.
Change-Id: I63fadf1c7240d4b2893384f75c519311e9659d47
2015-09-29 10:01:53 -07:00
Marco
730cdefd3e Add SVC codec control to set frame flags and buffer indices.
Add SVC codec control to set the frame flags and buffer indices
for each spatial layer of the current (super)frame to be encoded.
This allows the application to set (and change on the fly) the
reference frame configuration for spatial layers.

Added an example layer pattern (spatial and temporal layers)
in vp9_spatial_svc_encoder for the bypass_mode using new control.

Change-Id: I05f941897cae13fb9275b939d11f93941cb73bee
2015-09-17 09:37:15 -07:00
Marco Paniconi
f6097ef243 Merge "SVC fix to set worst/best_quality per layer." 2015-09-15 22:06:13 +00:00
Marco
15c43d9ac7 SVC fix to set worst/best_quality per layer.
Allow the worst/best_quality to be set per layer via the
VP9E_SET_SVC_PARAMETERS control.

Change-Id: Icba5ec8ac757152f3bb7860d6010d9174a7bd578
2015-09-15 14:16:07 -07:00
Marco
eb53c69ece Add cyclic refresh parameters to svc-layer context.
For 1 pass CBR spatial-SVC:
Add cyclic refresh parameters to the svc-layer context.

This allows cyclic refresh (aq-mode=3) to be applied to
the whole super-frame (all spatial layers).
This gives a performance improvement for spatial layer encoding.

Addd the aq_mode mode on/off setting as command line option.

Change-Id: Ib9c3b5ba3cb7851bfb8c37d4f911664bef38e165
2015-09-15 10:06:36 -07:00
Johann
c5f11912ae Include vpx_dsp_common.h when using VPXMIN/MAX
Change-Id: I2e387a06484a06301f3cd6600c4ba2f4335b61ee
2015-08-31 14:36:35 -07:00
James Zern
5e16d397bd vpx_dsp_common: add VPX prefix to MIN/MAX
prevents redeclaration warnings;
vp8 has its own define which will be resolved in a future commit

Change-Id: Ic941fef3dd4262fcdce48b73075fe6b375f11c9c
2015-08-26 20:11:32 -07:00
James Zern
a390b90f01 vp9_update_layer_...config: delete dead assignment
Change-Id: I7401a70a3f33d13fa1ab0393e59fceb5ef083534
2015-08-25 18:45:05 -07:00
Debargha Mukherjee
653832ea06 Prevent an ASAN failure for svc tests
This patch just fixes the test for the time being, but does not
actually solve the underlying issue, which still needs investigation.

Change-Id: I54a35de839723f5b499b57e38dd2bdd400adc427
2015-08-24 10:28:02 -07:00