Commit Graph

106 Commits

Author SHA1 Message Date
Linfeng Zhang
d331e7a1c0 Remove get_filter_base() and get_filter_offset() in convolve
so that the convolve functions are independent of table alignment.

Change-Id: Ieab132a30d72c6e75bbe9473544fbe2cf51541ee
2017-09-05 15:22:36 -07:00
Jerome Jiang
6b9c691daf Merge "Clean up writing YUV files for debug purpose." 2017-08-15 18:28:54 +00:00
Jerome Jiang
a153080b55 Clean up writing YUV files for debug purpose.
Change legacy vp8/9_write_yuv_frame to vpx_write_yuv_files.
Delete some flags that can be enabled during build.

To enable writing denoised YUV, use the following command line:
CFLAGS='-DOUTPUT_YUV_DENOISED' ./configure
--enable-vp9-temporal-denoising

For skinmap, use CFLAGS='-DOUTPUT_YUV_SKINMAP'

Change-Id: I236974ac8b3cf279d20c4dc7f6162d8b480b6528
2017-08-15 10:44:03 -07:00
Marco
e9ccc6fe79 vp9: Denoiser fix: use correct bsize for skin detection.
Change-Id: I9d201fa3a4b00ebd147b57ed519fab8d59b0a802
2017-08-15 10:02:19 -07:00
Jerome Jiang
0f8ebddec4 vp9 SVC: Fix the denoiser frame buffer management.
Change the denoiser frame buffer management for SVC to more generally
handle the layer patterns in SVC (where last is not always refreshed).

This change is only for SVC with denoising and is bitexact.

Change-Id: Ic2b146a924cdf6e7114609158afa3d4880fe3fae
2017-08-10 16:56:46 -07:00
Marco
999bd6ea84 vp9: Fix denoising condition when pickmode partition is used.
When the superblock partition is based on the nonrd-pickmode,
we need to avoid the denoising. Current condition was based on
the speed level. This change is to make the condition at the
superblock level, as the switch in partitioning may be done at
sb level based on source_sad (e.g., in speed 6).

Change-Id: I12ece4f60b93ed34ee65ff2d6cdce1213c36de04
2017-07-30 23:16:38 -07:00
Jerome Jiang
fd216268ad vp9: Allocate alt-ref in denoiser for SVC.
When SVC is used, allocate alt-ref in denoiser.

Change-Id: I1b17221b55b9444cd23b97d481b54ff8d296d857
2017-07-18 13:22:47 -07:00
Marco
3818a3723b vp9: Fix to SVC and denoising for fixed pattern case.
For fixed pattern SVC: keep track of denoised last_frame buffer
for base temporal layer, and if alt_ref is updated on middle/upper
temporal layers, force an update to denoised last_frame buffer.
This allows for improved denoising on top temporal layers.

Change-Id: Icbd08566027d4d2eabc024d3b7a0d959d2f8c18b
2017-07-11 11:27:04 -07:00
Jerome Jiang
2ac7c549e9 vp9: Remove alt-ref from denoiser.
Denoiser is used in real-time mode which does not use alt-ref.
Reduce memory usage when denoiser is enabled.

Change-Id: I54ba3bcaeeb1818bbdf718ef90e97d4897ff793d
2017-07-10 10:56:03 -07:00
Marco
c5c31b9eb6 vp9: SVC: Increase the partiiton and acskip thresholds
Increase the partition and acskip thresholds for temporal
enhancement layers.

~1-2% speedup, with negligible loss in quality.

Change-Id: Id527398a05855298ad9ddac10ada972482415627
2017-05-11 12:28:19 -07:00
Jerome Jiang
597d1f4c03 vp9: Fix ubsan failure in denoiser.
Fix the overflow for subtraction between two unsigned integers.

BUG=webm:1432

Change-Id: I7b665e93ba5850548810eff23258782c4f5ee15a
2017-05-10 13:43:17 -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
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
Marco
c824eda6cc vp9: SVC: Fix issue with artifact for svc-denoising.
Issue/bug happens for denoising with spatial layers, where
the golden (spatial) reference is used in pickmode, but
denoising is only done wrt to last (temporal).

Fix is to make sure set_ref_ptrs is set before build predictors
in denoiser.

Change-Id: I793cf441341edf7c4a88b8ab1e1b22b3cb0eb508
2017-03-31 10:05:32 -07:00
Marco
fc83fcb7c4 vp9: SVC: fix to allow output of denoised result.
Change-Id: Iaf55cfb5e9621d074eb33d6a32f184e4777968f8
2017-03-29 14:02:54 -07:00
Jerome Jiang
dbed479d79 Fix the data race caused by vp9 denoiser.
BUG=webm:1391

Change-Id: I9669ae62fe9c695d4c6f9973094cb0f39bed51c7
2017-03-21 15:46:25 -07:00
Marco
a340c64a79 vp9: Fix some issues with denoiser and SVC.
Fix the update of the denoiser buffer when the base
spatial layer is a key frame. And allow for better/lower
QP on high spatial layers when their base layer is key frame.

Change-Id: I96b2426f1eaa43b8b8d4c31a68b0c6d68c3024a2
2017-03-15 17:19:17 -07:00
Marco
7f2daa74a0 vp9: Incorporate source sum_diff into non-rd partition thresholds.
Increase the variance partition thresholds for superblocks that
have low sum-diff (from source analysis prior to encoding frame).
Use it for now only for speed >= 7 or for denoising on.

Small change on metrics for rtc set: less than ~0.1 avgPNSR decrease
on RTC set, for both speed 7 and 8.

Change-Id: I38325046ebd5f371f51d6e91233d68ff73561af1
2017-02-21 17:22:11 -08:00
Marco
1a5482d4d8 vp9: Denoiser speed-up: increase partition and ac skip thresholds.
Add factor to increase varianace partition and ac skip thresholds,
under certain conditions (noise level and sum_diff), to increase
denoiser speed.

Change-Id: I7671140ef3598bf5f114a72623d68792bcd7b77b
2017-02-07 10:33:13 -08:00
Marco
3b2d08a93b vp9-denoiser: Modify skip denoising condition for small blocks.
Skip denoising for blocks < 16x16, and for block = 16x16
skip denoising for low noise levels and width > 480 for now.
Allow for some speed-up in denoiser.

Change-Id: Ib46cefe4741962d145fa08775defea3a9c928567
2017-01-25 11:48:09 -08:00
Marco
7e3a82c384 vp9: Make the denoiser work with spatial SVC.
If enabled denoiser will only denoise the top spatial layer for now.

Added unittest for SVC with denoising.

Change-Id: Ifa373771c4ecfa208615eb163cc38f1c22c6664b
2017-01-10 17:23:58 -08:00
clang-format
e0cc52db3f vp9/encoder: apply clang-format
Change-Id: I45d9fb4013f50766b24363a86365e8063e8954c2
2016-08-02 16:47:11 -07:00
JackyChen
47cc64cdf8 vp9 denoiser: Derefencing pointer should be after null check.
BUG=webm:1267

Change-Id: I899fc9e8d784c6eefcbe27945c619845adb7b6f0
2016-07-26 17:31:17 -07:00
JackyChen
57c7c11633 vp9: Fix a bug where best_sse_mv is not set properly.
In VP9 internal denoiser, motion magnitude is computed from
best_sse_mv, which should be set to 0 at the begining. This bug may
cause visual aritifact in denoiser. Also, delete two improper comments.

Change-Id: I8710d2acba23320bc85cf72af17d65245c19438b
2016-04-25 11:44:40 -07:00
Marco
229c686c89 vp9-denoiser: Bugfix and some adjustments for high noise case.
Need to check that sse for non-zero mv has been set for the current block
(i.e., check that nonzero-mv is tested as a mode, so newmv_sse != UINT_MAX)
before forcing to not use zero-mv for denoising.

Also increase some thresholds (sse and sse_diff) for high noise case,
and use shift operaton instead of multiplication on a threshold computation.

Change-Id: Iae7339475d57240316b7fa8b887c4ee3c0d0dbec
2016-04-25 10:15:03 -07:00
Marco
80bbba1494 vp9: Some adjustments to denoiser under high-noise condition.
Change-Id: Ib47d742d07f13c7c39cea85e228c19ae298baf4a
2016-04-22 10:31:19 -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
Marco
ac86dde3af vp9-denoiser: Avoid copy-block when denoising is at LowLow level.
Avoid copy-block when denoising is at LowLow level (i.e., no denoising is done).
Instead, don't enter denoiser at all, and when level goes back up over kLowLow
do a reset in denoiser.

Change-Id: I0544adf58f4dd51ecc4a4607fcb0353bfbbb7a59
2016-04-04 17:02:24 -07:00
Marco Paniconi
71cf9fac83 Merge "vp9-noise estimation: Increase threshold for Low-level." 2016-04-04 17:33:35 +00:00
Marco
9ff73fe092 vp9-noise estimation: Increase threshold for Low-level.
This make it more likely clean/low-noise content will
be set as LowLow, and hence no denoising will be done.
Also set early exit on denoising for small blocks.

Change-Id: I4a72bba3e6c5e2d523d304c39deacc9c39bf216c
2016-04-04 09:32:22 -07:00
Marco
a2307ff095 vp9-denoiser. Code cleanup and bugfix.
Some cleanup and bugfix: pass mi_row/mi_col (not mv_col/mv_row)
to build_inter_predictors. This only affects case where
the frame is resized, but since denoising is not done on resized
frames, the fix has not effect currently.

Change-Id: I36617a7f0b43b6f49976745f15d400977e6ffa46
2016-04-04 09:11:00 -07:00
Marco
7467ee0458 vp9-denoiser: Adjust usage of skin and consec_zeromv.
Change-Id: I250258fc70ec0fcf1b501708c5d4b84685cf882e
2016-04-01 11:50:15 -07:00
Marco
48e7294e48 vp9-denoiser: Incorporate consec_zeromv in skin detection for denoising.
Change-Id: Ibe4e1207c0db1779e1358f4566da67c9a07bdb15
2016-03-28 10:57:54 -07:00
Marco
ce39add465 vp9: Improvement to skin detection.
Add consec_zeromv to skin detection.
Reduces false detection in steady background areas.

Change-Id: Ic31c831537d29f082f58477f82ed78f313d7dd30
2016-03-17 16:26:10 -07:00
Marco
2a3f994723 vp9-denoiser: Allow for checking skin for bsize <=32x32.
Change-Id: I6c99ac6fd3735e24cf668479c55bff313c0b4970
2016-02-08 13:01:38 -08:00
Marco
c9e984a858 vp9-denoiser: Force increase_denoising = 0 for skin block.
Change-Id: Ic5af41db58a3daad4103175b4b4b9300675020c0
2016-01-29 08:37:02 -08:00
Scott LaVarnway
5232326716 VP9: Eliminate MB_MODE_INFO
Change-Id: Ifa607dd2bb366ce09fa16dfcad3cc45a2440c185
2016-01-19 16:40:20 -08:00
Marco
c0307e6cea vp9-denoiser: Set motion threshold for skin_map to 0.
More aggresive on avoiding denoising on skin.
May supplement this later by adding condtion onn consec_zeromv.

Change-Id: Ied92b332f9b24e821d2009f81d1565758588d9a5
2016-01-15 15:04:14 -08:00
Marco
a8b7c6aad3 vp9-skin detection: Refactoring.
Add function to compute skin map for a given block, as its
used in several places (cyclic refresh, noise estimation, and denoising).

Change-Id: Ied622908df43b6927f7fafc6c019d1867f2a24eb
2016-01-04 16:58:06 -08:00
Marco
1abf575f32 vp9 denoiser: Re-evaluate mode selection for golden reference.
Under certain denoising conditons, check for re-evaluation of
zero_last mode if best mode was golden reference.

Change-Id: Ic6cdfd175eef2f7d68606300c7173ab6654b3f6e
2015-12-01 09:39:01 -08:00
Marco Paniconi
610b413d7b Merge "vp9 denoiser: Re-evaluate ZEROMV after denoiser filtering." 2015-11-25 04:24:00 +00:00
Marco
5b0ddb931d vp9 denoiser: Re-evaluate ZEROMV after denoiser filtering.
For denoising, and for noise level above threshold, re-evaluate
ZEROMV for mode selection after denoising.
Current change only does this check if selected best mode (before denoising)
was intra.

Change-Id: I4b1435b68d26c78f7597b995ee7bff0ddd5f9511
2015-11-24 17:30:32 -08:00
Marco
fbd245c598 vp9-denoiser: Fix to reset frame_stats.
zeromv_lastref_sse was not reset.

Change-Id: I23c12e804d63dc7dc18514f6efe71de1d1acbd6a
2015-11-24 15:58:28 -08:00
Marco
131c1600a9 vp9 denoiser: Bias to last reference for temporal filter.
Change-Id: I6a360a12e8da8cdcb8a779647512591612d64f31
2015-11-20 15:38:32 -08:00
Marco
ff32369804 vp9 denoiser: Add another noise level to denoising.
Change-Id: Idc755ab54e4f78bb7d75bc97634c451804edad99
2015-11-11 11:21:26 -08:00
Marco
c7da053d4b Move noise level estimate outside denoiser.
Source noise level estimate is also useful for
setting variance encoder parameters (variance thresholds,
qp-delta, mode selection, etc), so allow it to be used also
if denoising is not on.

Change-Id: I4fe23d47607b4e17a35287057f489c29114beed1
2015-11-02 12:15:26 -08:00
Marco
c2f6a7df8d vp9 denoiser: Don't estimate noise on resized trigger frame.
Change-Id: I60461f011d1aba0b1eb6584c6940f745221915f4
2015-11-02 09:11:35 -08:00
Marco
823a47ee3b Update to vp9-denoising.
Set increase_denoising parameter for temporal filter.

Change-Id: Id98bf160db98dfa9aedf76e20b43e6f7c783fb1c
2015-10-27 15:52:56 -07:00
Marco
8a2fc54508 Adjustments to vp9-denoising.
Adjust variance threshold, delta-qp, and intra penalty cost,
based on estimated noise level in source.

Replace denoising_on with a level value=L/M/H.

Change-Id: I0c017dae75a5d897367d2c42dec26f2f37e447c1
2015-10-27 10:44:19 -07:00
Marco
f2845ed83c Code cleanup for vp9-denoiser.
Change-Id: Ibb573f50c4bf2cfb382b589803f3363db0ac1285
2015-10-26 12:04:54 -07:00