This reverts commit 4e5b4b5848.
Reason for revert: Commit message inaccurate.
Original change's description:
> Add ROI support for VP9.
>
> Extended ROI struct suitable for VP9.
> ROI input from user is passed into internal struct and applied on every frame
> (except key frame).
>
> Enabled usage of all 4 VP9 segment features (delta_qp, delta_lf, skip,
> ref_frame) via the ROI map input.
> Made changes to nonrd_pickmode for the ref_frame feature.
>
> Only works for realtime speed >= 5.
> AQ_MODE needs to be turned off for ROI to take effect.
>
> Change example in the sample encoder: vpx_temporal_svc_encoder.c to be suitable
> for VP9.
> Add datarate test.
>
> Bump up ABI version.
>
> BUG=webm:1470
>
> Change-Id: I7e0cf6890649adb98a5fda2efb6ae1fa511c7fc9
TBR=yaowu@google.com,jzern@google.com,marpan@google.com,builds@webmproject.org,jianj@google.com
Change-Id: I000dbd81e0c67cb8a0dcde4013ee9bf7afb038f0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webm:1470
Extended ROI struct suitable for VP9.
ROI input from user is passed into internal struct and applied on every frame
(except key frame).
Enabled usage of all 4 VP9 segment features (delta_qp, delta_lf, skip,
ref_frame) via the ROI map input.
Made changes to nonrd_pickmode for the ref_frame feature.
Only works for realtime speed >= 5.
AQ_MODE needs to be turned off for ROI to take effect.
Change example in the sample encoder: vpx_temporal_svc_encoder.c to be suitable
for VP9.
Add datarate test.
Bump up ABI version.
BUG=webm:1470
Change-Id: I7e0cf6890649adb98a5fda2efb6ae1fa511c7fc9
scaled_temp frame is used as an intermediate buffer for
2 stage down-sampling: two stages of 1/2 down-sampling
for a target of 1/4x1/4. This is used in 3 layer SVC
to avoid duplicate frame downsampling (on middle layer).
As this allocation is only needed/used when the
number_spatial_layers > 2, add this condition to avoid
unneeded allocation for 1 and 2 spatial SVC.
Change-Id: If342466644f685c1ea3ca5344b581793e5136c09
For 3 spatial layers with 1/2 downsampling, the
downsampling filter for the middle layer was not
set for the very first frame, so it was defaulting
to the subsample filter (no averaging/phase = 0).
Its not set due to the two stage scaling that is
done for 1/4 on base layer, during which the intermediate
1/2 result is saved for the middle layer.
Fix for now is to set the default downsampling filter
to Bilinear (averaging/non-zero phase) for all layers on
init (vp9_init_layer_context):.
Change-Id: Ic7407810b34c621e7e7420682508d45478bdffcf
Eliminate false positives in previous patch.
The previous patch did a good job of detecting slide transitions but
in discussions a number of situations were identified that might trigger
harmful false positives. This risk seems to be born out by some testing
on a wider YT set done by yclin@.
This patch adds an additional clause that requires that the best case
inter and intra error for the frame are very similar,meaning it is almost
as easy to code a key frame as an inter frame. This will certainly prevent
the false positive conditions that Jim and I discussed and even if one
does occur it should not be very damaging.
The down side is that this clause may mean that we still miss some
real slide transitions, especially if the images are small and similar. If this
proves to be the case then some further adjustment of the threshold may be
required. However, in the specific problem sample provided we do trap every
transition correctly.
Change-Id: I7e5e79e52dc09bc47917565bf00cc44e5cddd44c
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
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
For SVC, on spatial enhancement layer, intra
search was disabled unless best reference frame
is golden (i.e., spatial/inter-layer prediction),
except for some other conditions (lower layer is key
or golden is not an allowed reference).
Fix is to add the base temporal layer condition,
so intra search will not be force-disabled for base
temporal layer frames.
This improves metrics (-1-2%) for SVC 3 and 2 layer config.
Some small encode time is expected, but since condition
only affect base temporal layers (i.e., every 4 frames
for 3 layers), increase is small.
Change-Id: I10b824faef99560dfdeeb02ba8bf8e3e1eea6255
In nonrd-pickmode: the golden/spatial reference for inter-layer
prediction may be skipped in the mode testing. Add QP dependency
to reduce the threshold for skipping (i.e., check it more often)
at high QP, if the lower layer was encoded at lower QP relative
to the current layer.
At high QP, a better quality lower resolution is more likely to
provide good spatial (inter-layer) prediction.
avgPSNR/SSIM metrics up by ~1% (all clips positive gain or neutral).
Some decrease in encode time (~1-2%) expected at lower bitrates,
for 3 layer SVC.
Change-Id: I9ee0f62d4b10d4ebd30165d378ecfa4399ae5ef1
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.
Change-Id: I7a4d5114f16b2a1df383dbe6b3fe02940e29e6cc
Remove trailing commas to keep multiple elements on one line.
Add blank lines to prevent comments from being treated as blocks.
clang-format guards for struct with a comment in the middle.
Change-Id: I3bcb8313ae8aaf69179249a13b4087b1272cdbc0
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
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.
BUG=chromium:776905
[1] https://www.chromium.org/developers/testing/control-flow-integrity
Change-Id: I1c7adbdfffa4fe0b62e993bfb31d06e64b022d66
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.
Change-Id: I8b7a4d57f7ce5f4e3faab3f5688f7e4d61679b9a
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.
Change-Id: Iaeeeed55dc0bb50aeacd4996ed660ced06374603
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
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%
Change-Id: I4f97a72b0e273e4e844ade15285749c32cd81c1c
Increase the recursive average factor from 15/16 to 3/4
to make the noise estimation respond faster.
Small/neglible change on low noise content, but better
denoising for noisy content.
Also encoder speedup of ~2-3% observed on some noisy clips.
Change-Id: I9dd02fe961ca24b411fe4c2732f814bf1e9a7f9f
eob is a pointer to a uint16_t. previously the code would store 64-bits
causing a crash or test failure with the right stack layout.
Change-Id: Ibd653baf323db114f2444951b9d8b00c596bf15a
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
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
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
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%).
Change-Id: I8e00538ac2c0b5c2e7e637903cac329ce5c2a375
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
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.
No change in behavior.
Change-Id: Id304276c745eeb389ff85fa2dcf510d5976bc413
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.
Change-Id: I9ec4fa20a38947934fc650594596c25280c3b289
Set num_inter_modes based on ref_mode_set_svc, which is
smaller set than ref_mode_set (which may use alt-ref).
No change in behavior.
Change-Id: I31169bb09028db230552c6fca0a86959d1ade692
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).
Small speed gain, ~1-2%, at speed 8.
Change-Id: Iba8d22a307768b391e29d63c9826aac5a4d9c285