Commit Graph

54 Commits

Author SHA1 Message Date
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
b121a3e7b8 aq-mode=3: Don't reset segment if block is determined to be skin.
For coding block sizes <=16X16, if the block is determined to be skin,
then always allow for that block to be candidate for refresh. So if that
block happens to be on the boost segment(s), segment won't get reset to 0
and delta-q will be applied.

PSNR/SSIM metrics neutral (little/no change) on RTC clips.
Speed increase small/negligible (< 1%).
Some visual improvement on faces in a few RTC clips.

Change-Id: I6bf0fce6f39d820b491ce05d7c017ad168fce7d6
2015-12-22 10:23:44 -08:00
Marco
384fc5e381 Adjust motion threshold to limit cyclic refresh.
Change-Id: Icfca27a567eb8929c312c6315856ee130d982a04
2015-11-11 18:22:21 -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
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
b44c5cf639 Adjustment on limiting cyclic refresh on steady blocks.
Adjust the qp threshold and consec_zeromv threshold for
limiting cyclic refresh. Also increase the refresh period
when the limit amount is significant, and some code-cleanup.

Small gain in PSNR/SSIM metrics: ~0.25/0.3 gain on RTC set, speed 7.

Change only affects non-screen content.

Change-Id: I1ced87a89a132684c071e722616e445b2d18236a
2015-10-16 10:16:44 -07:00
Marco
d6bbda4bc2 Fix resetting of cyclic refresh on dynamic resize change.
Put the reset at the right place, during the setup and prior
to updating the map.

Change-Id: I75e550ae9d8cc15081330b8857edc04c23947875
2015-10-15 09:03:51 -07:00
Marco
bc137ff67b Move setting of refresh threshold outside loop.
Small code cleanup. consec_zeromv refresh threshold
does not need to be computed for every super-block.

No change in behavior.

Change-Id: I8c4b1b28072f42b01d917fff6d1f62722f1e1554
2015-10-06 17:51:30 -07:00
Marco
3f7656cc23 Limit cyclic refresh on steady background blocks.
Use the existing QP condition on limiting cyclic refresh, and add
addiitonal condition that block has been encoded with zero/small motion
x frames in row (where x is at least several times the refresh period).
Additional condition only affect non-screen content mode.

This helps to improve visual stability for noisy input, where on steady
background areas the application of delta_qp may lead to encoding the noise.

Also added a change to use the true skip (after encoding) to update the
last QP.

Change-Id: I234a1128d017d284cf767fdb58ef6c59d809f679
2015-09-25 10:40:35 -07:00
Marco
9b51b3a9ca Adjust rate-boost threshold in cyclic refresh for seg#2.
Small gain in metrics (average ~0.2dB), small
reduction in rate fluctuation.

Change-Id: Id75bd89c168486f075308fb474ebd26e3bdfb85b
2015-09-23 11:52:55 -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
Alex Converse
575e81f7c9 CR: Don't attempt to read qindex_delta for segments CR is unaware of.
Found by the remoting VideoEncoderVpxTest.Vp9LossyUnchangedFrame unit
test under asan.

Change-Id: Icac63051bf37c7355e661837b57c257d58c764fc
2015-09-14 13:55:30 -07:00
Alex Converse
3d6b8a667f Prevent CR in screen mode from refreshing flat inter blocks forever.
Take the minimum last_codec_q_map on inter skip.

Change-Id: Ibb308526dd19793bb359f51ebd7b48d8692903fd
2015-09-10 15:03:13 -07:00
Marco
bda690d446 Move cyclic_refresh struct into .h file.
Change-Id: I9327cd52d0ec050887ba7e591b094d74bd36bce8
2015-09-08 13:49:24 -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
Alex Converse
a8a08ce57e Move vp9_systemdependent.h to vpx_ports bitops.h and system_state.h
Use system_state.h in vpx_dsp and remove unneeded includes of
vp9_systemdependent.h.

Change-Id: I92557ec6dd5aa790160b4f31fe7967db0d7ec3c4
2015-08-10 15:37:14 -07:00
Marco
dc36e5aff0 Fix a setting in cyclic refresh.
Use the correct period (in terms of cr->percent_refresh) for the condition
of larger delta-qp following key frame.
And account for larger interval for temporal layers.

Change-Id: Ibb43f5200f9b1eeb8bbb8211327b08ecda3c3b8a
2015-08-07 10:34:47 -07:00
Marco
7ae1aa6b37 Dynamic resize for 1 pass: update of golden frame.
In aq-mode=3 under a resizing action (i.e., resize_pending != 0),
force an update of the golden reference frame.

Change-Id: I14806f6db71b5f8c827678cc5e1fc913c138a9a4
2015-07-16 09:27:20 -07:00
Marco
3dd9cde2a5 Fix to unstable build from commit 517a66.
Change-Id: I123db2d20ae65a10e2dec95eec61150e2f69546d
2015-06-24 17:28:57 -07:00
Marco
517a662005 aq-mode=3: Reduce boost for segment#2 at low bitrates/low res.
Reduce boost for segment#2 for low bitrates and low-res.

This change is to reduce the rate overshoot at low bitrates.
No change in behavior, except at the very low bitrates.

Change-Id: I0dbd9d3b6356da5804de94adf10fca6a7a8f8948
2015-06-23 16:50:43 -07:00
Alex Converse
90c9ede8e6 Limit cyclic refresh revisitng blocks at the same quantizer.
For screen content don't refresh a block at a quantizer higher than
it was last coded at. PReviosuly at realtime speeds the encoder had a
tendency to recode a block from GOLDEN with a higher Q than it was last
coded at.

Change-Id: Iacd561806c769dcce1a81b9827ffc70090f5ba18
2015-06-19 15:23:02 -07:00
Marco
d77f51ba9e Add dynamic resize logic for 1 pass CBR.
Decision to scale down/up is based on buffer state and average QP
over previous time window. Limit the total amount of down-scaling
to be at most one scale down for now.

Reset certain quantities after resize (buffer level, cyclic refresh,
rate correction factor).

Feature is enable via the setting rc_resize_allowed = 1.

Change-Id: I9b1a53024e1e1e953fb8a1e1f75d21d160280dc7
2015-06-18 17:13:37 -07:00
Marco
2aa67ce20f Move adjustment of some CR parameters to existing function.
Refactor/no change in behavior.

Change-Id: Idb3c55b1304feaf689b90403f79bc96dba26f060
2015-06-11 08:31:03 -07:00
Marco
997ac14c6a Adjust some parameters for cyclic refresh for low bitrates.
Reduce motion threshold and boost factor for second segment,
for low bitrates, at low resolutions for now.
This is to reduce the rate fluctuation/frame dropping that occurs
at these low bitrates.

Change-Id: Ia66c3be41831882fca8c1e4fe104f5ea8fbe7142
2015-06-09 15:10:03 -07:00
James Zern
700b7fd0a9 vp9/encoder: make some functions static
silences missing prototype warnings

Change-Id: I3338fcaa67b5dcdf6bf237e8b374db3befd18753
2015-05-15 10:43:47 -07:00
Yunqing Wang
fd90ce2711 Merge "Improve golden frame refreshing in non-rd mode" 2015-04-30 15:57:55 +00:00
Yunqing Wang
d31698b0e0 Improve golden frame refreshing in non-rd mode
The default golden frame interval was doubled. After encoding a
frame, the background motion was measured. If the motion was high,
the current frame was set as the golden frame. Currently, the
changes were applied only while aq-mode 3 was on.

Borg tests(rtc set) showed a 0.226% PSNR gain and 0.312% SSIM gain.
No speed changes.

Change-Id: Id1e2793cc5be37e8a9bacec1380af6f36182f9b1
2015-04-29 16:43:43 -07:00
James Zern
f58011ada5 vpx_mem: remove vpx_memset
vestigial. replace instances with memset() which they already were being
defined to.

Change-Id: Ie030cfaaa3e890dd92cf1a995fcb1927ba175201
2015-04-28 20:00:59 -07:00
Marco
71e6ed7bd1 Adjustments to aq-mode=3.
Factor in segment#2 and skip blocks into the postencode estimated bits,
and increase somewhat the aggressiveness of the refresh.

PSNR/SSIM Metrics on RTC set go up by ~0.8/0.5%.

Change-Id: I5d4e7cb00a3aefb25d18c88b6b24118b72dc5d51
2015-03-18 12:06:16 -07:00
Marco
deaf661f45 Merge "Lower bitrate threshold below which cyclic refresh is turned off." 2015-03-13 10:31:35 -07:00
Marco
62a3f53997 Lower bitrate threshold below which cyclic refresh is turned off.
Change-Id: Ib54ab11adf8178eec74f65388a89c8f912c7869a
2015-03-13 09:42:45 -07:00
Alex Converse
1bfacd3529 Reconcile active_map and cyclic refresh
Change-Id: Id7f8654aeeb20caa402bc822521b1d72c658f4f9
2015-03-12 16:19:49 -07:00
Marco
fb31aa09e2 Modify update golden reference update under aq-mode=3 mode.
For non-SVC 1 pass CBR: make the GF update interval a multiple of the
cyclic refresh period, and use encoding stats to prevent GF update at certain times.

Change-Id: I4c44cacc2f70f1d27391a47644837e1eaa065017
2015-03-10 10:54:00 -07:00
Marco
c3f7bb16b4 Fix arithmetic overflow warnings.
Change-Id: Ib85b5bc135aa0907a76b8c74faafe577e27d014f
2015-02-26 15:27:21 -08:00
Marco
0187f4b411 Adjustments to cyclic refresh (aq-mode=3).
Target higher delta-qp for big blocks with zero motion,
and for segment#1: avoid 64x64 partition size and force 8x8 tx size.

Metrics on RTC set mostly positive: SSIM up by ~4%, PSRN by ~1.5%.
Doesn't seem to be any change in speed.

Change-Id: I1f68fa3c4f62dab3b90cc58041f05ebb048ae5ac
2015-02-20 08:47:59 -08:00
Marco
3f1af6e85e aq-mode=3: Update to allow for refresh on modes other than zero-mv.
Add distortion threshold condition to refresh state of a coding block,
and allow for qp adjustment also for some intra modes and non-zero motion modes.

Also some code cleanup (remove unused variables/code).

Change-Id: I735fa2b28bc64f60e0323976b82510577b074203
2015-01-26 16:44:25 -08:00
Marco
a047e7cdf8 Increase delta-qp for aq=3 mode, after key frame.
For a few refresh periods after key frame, use large qp-delta
to increase quality ramp-up.

Change-Id: Ib5a150fb2dfa6bafd0d4e6b5d28dfd0724b61319
2014-12-03 13:04:45 -08:00
Marco Paniconi
83fd18977f Cyclic refresh: factor segment delta-q into rate control.
Incorporate segment delta-q into estimated bits.
This generally improves the rate control under cyclic refresh (aq=3) mode.

Change-Id: I1dc60fb230e7d08357fae18909d8ed27bf58e037
2014-12-01 16:56:43 -08:00
Marco
53c3f2ca4d Only allow for cyclic refresh (aq=3 mode) for base layer.
Condition existed for temporal case, added it for spatial as well.
Issue: https://code.google.com/p/webm/issues/detail?id=878.

Change-Id: I38339207f9a94924f5568a081eabe64f867a686d
2014-11-21 14:47:32 -08:00
Yunqing Wang
8ee605f188 vp9_ethread: modify the cyclic refresh struct
Two members in struct CYCLIC_REFRESH
  int64_t projected_rate_sb;
  int64_t projected_dist_sb;
are updated at the superblock level, which makes them shared data
in the multi-thread situation, and requires extra work to handle
them. However, those values are updated and used immediately, and
therefore can be removed. This patch cleaned up the code and
removed the two members.

Change-Id: I2c6ee4552bf49fb63ce590cdb47f9723974fffb1
2014-11-13 15:05:46 -08:00
Jingning Han
caaf63b2c4 Rework cut-off decisions in cyclic refresh aq mode
This commit removes the cyclic aq mode dependency on
in_static_area and reworks the corresponding cut-off thresholds.
It improves the compression performance of speed -5 by 1.47% in
PSNR and 2.07% in SSIM, and the compression performance of speed
-6 by 3.10% in PSNR and 5.25% in SSIM. Speed wise, about 1% faster
in both settings at high bit-rates.

Change-Id: I1ffc775afdc047964448d9dff5751491ba4ff4a9
2014-11-05 21:17:09 -08:00
Deb Mukherjee
5cd0aab81a Adds high bitdepth quantization functions
Adds various high bitdepth quantization functions.

Change-Id: I36fc0bf75a1bd15128ed271df8723de0ac134b0c
2014-09-16 14:55:37 -07:00
Alex Converse
03c276ea17 Split vp9_rdopt into vp9_rdopt and vp9_rd.
vp9_rdopt is for making rd optimal mode decisions. vp9_rd is for all
other rd related routines. Anything used outside of making an rd optimal
decision belongs in rd.

Change-Id: I772a3073f7588bdf139f551fb9810b6864d8e64b
2014-07-02 15:33:33 -07:00
Jingning Han
80a4f55989 Enable background detection for adaptive quantizer control
This commit enables a background detection approach for adaptive
quantizer control. It combines the cyclic refresh pattern and the
background information to determine the segment id for adaptive
quantizer selection, prior to the non-RD mode decision process.
It hence allows proper quantization information update for a more
precise rate-distortion modeling in the non-RD mode decision.

The compression performance of speed -5 for rtc set is improved
by 2.5%, at no speed change.

Change-Id: Ic3713e8ed9185b403b5b1679d19dabd57506d452
2014-04-21 08:57:53 -07:00
Dmitry Kovalev
4e9529cb24 Renaming av_per_frame_bandwidth to avg_frame_bandwidth.
Just to be consistent with min_frame_bandwidth & max_frame_bandwidth names.

Change-Id: I36702c708cba9ad1a5c36393f37758a2edeadb90
2014-04-15 18:36:01 -07:00
Dmitry Kovalev
591e383df5 Adding temp variable q to vp9_cyclic_refresh_setup().
Change-Id: If0e9c811c8ae78c0914d615bad0067a5b57e4a71
2014-04-11 10:31:54 -07:00
Dmitry Kovalev
91dbac178f Moving compute_qdelta functions into vp9_ratectrl.{h, c}.
Change-Id: I512f2a287dd8765879a2d1144e2f028dc65f71ff
2014-04-07 16:57:53 -07:00
Marco Paniconi
36f61aa836 Set min_block_size for aq_mode=3 to 8x8.
For real-time mode under cbr, this increases the gain (5-10%)
for speed 5 (none/little change for 6), on vc-clips.

Change-Id: I9b38beeb3c820de22c43a0ba53a9456168dd24ba
2014-04-02 14:09:38 -07:00
Marco Paniconi
fc0b33182b aq_mode=3: Set target seg_map in sb-block order.
Removes a TODO. Changed meaning of some parameters
(target-max-percent refresh and starting index) to be
defined relative to superblock. Also, modify turn-off condition.

Change-Id: I5e55f372b7079c24f9cdac0b06fa34620dbf456b
2014-03-26 18:09:20 -07:00