Commit Graph

6548 Commits

Author SHA1 Message Date
Yunqing Wang
b68f14d0ed Merge "Make the row based multi-threaded encoder deterministic" 2017-04-26 16:12:14 +00:00
Linfeng Zhang
54c4e0f7a5 Merge "Update highbd convolve functions arguments to use uint16_t src/dst" 2017-04-26 15:50:46 +00:00
Marco Paniconi
004fab120a Merge "vp9: SVC: Adjust some speed settings for temporal layers." 2017-04-26 15:45:06 +00:00
Jerome Jiang
997e54ea43 Merge "vp9: speed >= 8: Skip uv variance in model_rd_sb_y_large" 2017-04-26 00:09:22 +00:00
Marco
c614164cb6 vp9: SVC: Adjust some speed settings for temporal layers.
Make some speed setting changes for temporal enhancement layers,
and remove the switch in subpel_force_stop for the aggressive_base_mv
in non-rd pickmode.

Gain some 2-3% speed with little/negligible quality loss.

Change-Id: I3e2a7f80ff45f38c0a6ceb01b34dbca2f53edbf0
2017-04-25 16:27:01 -07:00
Jerome Jiang
69b0242e9a vp9: speed >= 8: Skip uv variance in model_rd_sb_y_large
For speed >= 8 and color_sensitivity not set, skip the transform
skipping test in UV planes.
Add a new condition to check noise level to skip chroma check
for speed >= 8 if y_sad is high.

1~2% speedup on ARM for speed 8.

Borg tests show neutral results in both rtc and rtc_derf.

Change-Id: Idecd3ff6e28c97757a43bb6f3a7082c85f72109c
2017-04-25 16:21:36 -07:00
Linfeng Zhang
51dc998f3a Update highbd convolve functions arguments to use uint16_t src/dst
BUG=webm:1388

Change-Id: I6912de2639895d817ce850da8ea9f6c8fe21da42
2017-04-25 14:22:19 -07:00
Marco
92ec0674fd vp9; Reduce artifact in non-rd pickmode for lighting changes.
Add a low-variance high-sumdiff to the superblock content state
and use it to limit the mv and bias some decisions in non-rd pickmode.
Only affects speed >= 6.

Reduces artifact for lighting changes.
Small/no difference in metrics on RTC set.

Change-Id: Ic84b2379fe0ae3fa71ae826ee6bae3eaf551a25b
2017-04-24 17:08:43 -07:00
Yunqing Wang
10a497bd38 Make the row based multi-threaded encoder deterministic
This patch followed allow_exhaustive_searches feature modification and
continued to modify the encoder to achieve the determinism in the row
based multi-threaded encoding. While row-mt = 1 and using multiple
threads, the adaptive feature in encoder was disabled, which gave
BDRate gain(at speed 1, -0.6% ~ -0.7%; at speed 2, -0.46% ~ -0.59%),
but some encoder speed losses(7% ~ 10% at speed 1 and 3% ~ 6% at
speed 2). These speed losses were acceptable considering the speed
gains obtained from row-mt.

Change-Id: I60d87a25346ebc487a864b57d559f560b7e398bb
2017-04-24 16:28:27 -07:00
Yunqing Wang
c530208ae3 Merge "Make allow_exhaustive_searches feature no longer adaptive" 2017-04-24 17:41:10 +00:00
Marco Paniconi
b35f64241f Merge "vp9: SVC: fix condition for partition/skip threshold when denoising." 2017-04-21 21:28:17 +00:00
Yunqing Wang
bca4564683 Make allow_exhaustive_searches feature no longer adaptive
A previous patch turned on allow_exhaustive_searches feature only for
FC_GRAPHICS_ANIMATION content. This patch further modified the feature
by removing the exhaustive search limit, and made it no longer adaptive.
As a result, the 2 counts that recorded the number of motion searches
were removed, which helped achieve the determinism in the row based
multi-threading encoding. Tests showed that this patch didn't cause
the encoder much slower.

Used exhaustive_searches_thresh for this speed feature, and removed
allow_exhaustive_searches. Also, refactored the speed feature code
to follow the general speed feature setting style.

Change-Id: Ib96b182c4c8dfff4c1ab91d2497cc42bb9e5a4aa
2017-04-21 11:14:02 -07:00
Jerome Jiang
58fe1bde59 Merge "vp9: Non-rd pickmode: Avoid computation duplication." 2017-04-21 00:51:47 +00:00
Marco
5de0e9ed08 vp9: SVC: fix condition for partition/skip threshold when denoising.
The more aggressive settings should only be used when denoise_svc
condition is satisfied (which means top spatial layer).

Change-Id: Ia8e3515b27f31bf21b1976ca80a2fa826daece3a
2017-04-20 16:36:55 -07:00
Jerome Jiang
7ae1e321a1 vp9: Non-rd pickmode: Avoid computation duplication.
In non-rd pickmode (speed >= 5), avoid duplication of computations in
model_rd_for_sb_y when the speed feature use_simple_block_yrd is
enabled (or for high bitdepth build under certain conditions).

QVGA, VGA and HD have 1.23%, 2.68% and 1.7% speedup on ARM for speed 8,
respectively.

Encoding results are bitexact for speed >= 5.

Change-Id: I3f9130810c21439f5ad7e159e21cb2243dcd05f1
2017-04-20 16:20:59 -07:00
Marco
29938b3a5a vp9: 1 pass SVC: Fix comment and condition for up-sampling reference.
No change in behavior.

Change-Id: I218fb30289091da623acb23324027435b8510d0e
2017-04-20 14:21:05 -07:00
Yunqing Wang
30ef50b522 Merge "Only allow allow_exhaustive_searches for FC_GRAPHICS_ANIMATION content" 2017-04-20 19:57:46 +00: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
Yunqing Wang
e96e49c2f9 Only allow allow_exhaustive_searches for FC_GRAPHICS_ANIMATION content
The allow_exhaustive_searches feature improves the encoding quality
of FC_GRAPHICS_ANIMATION content a lot. For non-FC_GRAPHICS_ANIMATION
content, the quality test result is almost neutral. This patch makes
this feature to be used only for FC_GRAPHICS_ANIMATION content.

The motivation of doing that is to make this feature no longer adaptive,
which will be implemented in the following patch.

Change-Id: Ic911df6dd757402b6480789cc247801e99840369
2017-04-20 00:03:27 +00:00
Linfeng Zhang
fbbdba3b04 Merge changes I9e18a73b,Ie47c8cd4
* changes:
  Clean CONVERT_TO_BYTEPTR/SHORTPTR in convolve
  Create CAST_TO_BYTEPTR/SHORTPTR
2017-04-19 23:55:58 +00:00
Linfeng Zhang
bf8a49abbd Clean CONVERT_TO_BYTEPTR/SHORTPTR in convolve
Replace by CAST_TO_BYTEPTR/SHORTPTR.
The rule is: if a short ptr is casted to a byte ptr, any offset
operation on the byte ptr must be doubled. We do this by casting to
short ptr first, adding offset, then casting back to byte ptr.

BUG=webm:1388

Change-Id: I9e18a73ba45ddae58fc9dae470c0ff34951fe248
2017-04-19 12:13:49 -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
ad2e3598d2 vp9: Add key_frame condition to is_reference check for loopfilter.
This condiiton is not needed as key_frame should set the refresh
of the reference frames, but good to have for clarity in condition.

Change-Id: Icf9838e7e4f0ff5cf0a9562ae3b5d6c7e6f78702
2017-04-17 15:18:46 -07:00
Marco Paniconi
9aa429a66d Revert "Revert "vp9: Avoid encoder loopfilter for non-reference frames.""
This reverts commit e9b7f98c56.

Reason for revert:
Commit d578bdad fixes the issue (encoder/decoder mismatch
in 3TL datarate test) that causes the original revert.

Original change's description:
> Revert "vp9: Avoid encoder loopfilter for non-reference frames."
>
> This reverts commit 863f860bfc.
>
> This causes encoder / decoder mismatches in various
> VP9/DatarateTestVP9Large.BasicRateTargeting3TemporalLayers tests
>
> BUG=webm:1408
>
> Change-Id: Ic200c39d7ed9c0b0247ef562f5d6f7b2625f7e14
>

TBR=jzern@google.com,marpan@google.com,builds@webmproject.org,jianj@google.com
BUG=webm:1408

Change-Id: Ifeb81460856d1d56482d4e0477a70ee98f8bfaa6
2017-04-17 11:02:02 -07:00
James Zern
e9b7f98c56 Revert "vp9: Avoid encoder loopfilter for non-reference frames."
This reverts commit 863f860bfc.

This causes encoder / decoder mismatches in various
VP9/DatarateTestVP9Large.BasicRateTargeting3TemporalLayers tests

BUG=webm:1408

Change-Id: Ic200c39d7ed9c0b0247ef562f5d6f7b2625f7e14
2017-04-14 11:50:06 -07:00
Marco Paniconi
b937f1c839 Merge "vp9: SVC: fix to allow use_base_mv to be used for 3 layers." 2017-04-14 17:12:58 +00: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 Paniconi
f0ccaff553 Merge "vp9: Avoid encoder loopfilter for non-reference frames." 2017-04-14 00:45:42 +00:00
Marco
6bff6cb5a9 vp9: 1 pass VBR: Fix to rate control at low min-q.
Fix to avoid getting stuck at very low Q even
though content is changing, which can happen for --min-q=0.

Fix is to more aggressively increase active_worst_quality
when detecting significant rate_deviation at very low Q.

Change will only affect 1 pass VBR for --min-q < 4, so no
change in ytlive metrics for --min-q >= 4.

Change-Id: I4dd77dd7c08a30a4390da0ff2c8bda6fccfa76d7
2017-04-13 11:44:35 -07:00
Marco
863f860bfc vp9: Avoid encoder loopfilter for non-reference frames.
Useful for SVC, where the top layer enhancement frames may
not update any reference buffers, as is the case for the
patterns in the 1 pass CBR SVC when #temporal_layers > 1.

~3% encoder speedup for SVC patterns with temporal layers
in 1 pass CBR mode.

Updated the SVC datarate tests for the mismatch frames.
Set the frame-dropper off in some tests with #temporal_layers > 1
so we can correctly set #mismatch frames. Adjusted rate target
threshold for tests where frame-dropper was turned off.

Change-Id: Ia0c142f02100be0fed61cd2049691be9c59d6793
2017-04-13 09:51:55 -07:00
Yunqing Wang
f22b828d68 Fix an integer overflow in vp9_mcomp.c
The MV unit test revealed an integer overflow issue in vp9_mcomp.c.
This was caused if the MV was very large. In mv_err_cost(), when
mv->row = 8184, mv->col = 8184 and ref_mv is 0, mv_cost = 34363
and error_per_bit = 132412, causing the overflow.

BUG=webm:1406

Change-Id: I35f8299f22f9bee39cd9153d7b00d0993838845e
2017-04-10 18:09:50 -07:00
Jerome Jiang
2420f44342 Merge "vp9: speed >= 8: Adjust speed settings on ARM." 2017-04-11 00:45:21 +00:00
Jerome Jiang
f16f08e55b vp9: speed >= 8: Adjust speed settings on ARM.
Set adaptive_rd_thresh to 2 when simple block yrd is not used.

Fix regression caused by computing y sad without
int_pro_motion_estimation on low res motion clips.

Overall 0.07% quality loss on rtc_derf.

Change only affects low res on speed 8.

Change-Id: Ic6a188a56529f1034d6431005fb4b0e24e8a7e27
2017-04-11 00:26:56 +00:00
Marco
6557baf336 vp9: 1 pass CBR: avoid nonrd_pick_partition on segment.
For speed 5, 1 pass CBR: Don't use the nonrd_pick_partition
on the segment, rather use choose_partitioning followed by
nonrd_select_partition (as is done on base segment).

Little/no quality loss on RTC and RTC_derf (< 0.3%),
speedup of at least 5%.

Change-Id: I5273d5f950e60adf5e437b4ca8c4f63964641e83
2017-04-10 15:02:49 -07:00
Marco Paniconi
ff1fef9607 Merge "vp9: Fix to noise estimation for temporal denoising." 2017-04-07 17:13:22 +00:00
Yunqing Wang
f496032686 Merge "VP9 motion vector unit test" 2017-04-07 16:46:22 +00:00
Marco
349c3118bd vp9: Fix to noise estimation for temporal denoising.
If the noise estimation is avoided due to large motion,
the last_source for denoising should still be updated.

Change-Id: I67155ea7dbe9ac2785978e64a27bdafd7d57aac0
2017-04-07 09:23:30 -07:00
Marco
18b54ef468 vp9: Adjust consec_zeromv threshold for aq-mode=3.
To reduce refresh on partial super-blocks on boundary,
for noisy input. Reduces some artifacts on noisy input.

Change-Id: I10b5808a296874e08c7f378b3df58466591d8dbe
Edit
2017-04-07 08:54:09 -07:00
James Zern
04e9456567 Merge changes from topic 'Wshorten'
* changes:
  configure: enable -Wshorten-64-to-32 for hbd
  vp9_encodeframe: resolve -Wshorten-64-to-32 in hbd
  Resolve -Wshorten-64-to-32 in highbd variance.
2017-04-07 07:32:14 +00:00
Marco
3227a9be5f vp9; Move the denoising condition for speed 5.
Move the condition for effectively disabling the denoising
for speed 5 into the vp9_denoiser_denoise().

This is cleaner, and also moving the condition into vp9_denoiser_denoise
will keep the denoiser buffer updated with the current source.
This allows for more consistent behavior if speed is changed midstream.

Change-Id: Ia001f591c56e454bf724c3ae73c024badb183ef8
2017-04-06 11:03:04 -07:00
Jerome Jiang
c9fbb1881a Merge "vp9: speed 8: Compute y sad without int_pro_motion_estimation." 2017-04-06 02:57:16 +00:00
Jerome Jiang
705fc9f107 Merge "Refactor: Clean memory allocation for copy partition." 2017-04-06 02:57:08 +00:00
Yunqing Wang
1aa46abbdf VP9 motion vector unit test
To prevent the motion vector out of range bug, added a motion vector unit
test in VP9. In the 4k video encoding, always forced to use extreme motion
vectors and also encouraged to use INTER modes. In the decoding, checked if
the motion vector was valid, and also checked the encoder/decoder mismatch.

The tests showed that this unit test could reveal the issue we saw before.

Change-Id: I0a880bd847dad8a13f7fd2012faf6868b02fa3b4
2017-04-06 00:50:56 +00:00
James Zern
b3e2eb14c5 vp9_encodeframe: resolve -Wshorten-64-to-32 in hbd
vp9_high_get_sby_perpixel_variance the variance operated on in is
already in 32-bits

Change-Id: I97006eb9c08dbd0f88ee35e1a1ca205737508296
2017-04-05 17:34:06 -07:00
Jerome Jiang
288d73c861 vp9: speed 8: Compute y sad without int_pro_motion_estimation.
Little change in overall PSNR in rtc. 2-4% speedup on VGA on ARM.

Change-Id: I3395806d7afd456deacd4077c330adca13ab0645
2017-04-05 17:25:47 -07:00
Marco
2136de9374 vp9: Temporal denoising: avoid denoising for speed <= 5.
Temporal denoiser runs in non-rd pickmode, so it is only used
for speed >= 5. Regression exists for speed 5, due to use of
reference_partition (which use non-rd pickmode for partitioning).
Avoid denoising for now at speed 5.

Change-Id: I74a74d2e1404d7cfd33dcf4ec06dd2e503256cf0
2017-04-05 16:43:39 -07:00
Jerome Jiang
58ba880b94 Refactor: Clean memory allocation for copy partition.
Move the memory allocation from setting speed features.

Change-Id: I2e89dfaeb46daee63effe5a5df62feed732aa990
2017-04-05 15:33:24 -07:00
Jerome Jiang
fb60204d4c vp9: Remove legacy comments for avg_source_sad.
Change-Id: Ia6e8614535a097f17f37fc382cef8e22e03b70f6
2017-04-04 16:28:27 -07:00
Marco
8097b49997 vp9: Adjust condition of golden update with cyclic refresh.
Base the low_content_frame metric on the motion vectors,
and adjust the logic for preventing golden update.

Small change in behavior: small positive gain (~0.2-1%) on clips
with high activity.

Change-Id: I0b861c8e9666cd82b45cde5ee57ee8a1e5ab453c
2017-04-04 09:55:24 -07:00
Marco
6b3f4bc794 vp9: 1 pass CBR: cleanup to cyclic refresh.
Code cleanup: merged two functions that were doing postencode
update for cylic refresh, remove some unused code and fix comments.

No change in behavior.

Change-Id: I9be0d7e346d34dec29bf4e5bb380a7bf81c8480a
2017-04-03 16:37:45 -07:00