Commit Graph

330 Commits

Author SHA1 Message Date
Marco Paniconi
e6657f32c5 Merge "vp9: Adjustment to scene-cut detection." 2016-04-13 22:36:29 +00:00
Marco
24db57f0e1 vp9: Adjustment to scene-cut detection.
Change recursive weight for average_source_sad and
put some constraint on spacing between detected scene-cuts.

Change only affects 1 pass real-time mode.

Change-Id: I1917e748d845e244812d11aec2a9d755372ec182
2016-04-13 14:40:08 -07:00
Yunqing Wang
885872f899 Fix Visual Studio build warning
Fixed warning C4244: '-=' : conversion from 'const double' to 'int',
possible loss of data.

Change-Id: Ic4691346037767b244e7f71248c2f871f92002f3
2016-04-13 09:09:08 -07:00
Marco
6a3cf099aa vp9: Adjust threshold for scene-change detection.
For 1 pass vbr.

Change-Id: I10b7eefc36d65c30844d205e139515bec7fed6af
2016-04-12 18:28:04 -07:00
Marco Paniconi
f81b0000f6 Merge "vp9: Fix to active_best for GF/ARF in 1 pass vbr." 2016-04-12 21:18:41 +00:00
Marco
3861b25be1 vp9: Fix to active_best for GF/ARF in 1 pass vbr.
Correct the setting of Q basis of GF/ARF in 1 pass vbr.

Existing logic would switch to using avg_QP of key frame if
avg_QP of inter is less than active worst (even if key frame is
not last frame).

Instead fix the logic (as per the comment) to use the lower of
active_worst_quality and avg_Q for inter as basis for GF/ARF
active_best_quality (unless last frame was key frame).

Increase in metrics: AvgPSNR/SSIM up by ~0.7/0.3 on ytlive set.

Change-Id: I9a628378ec6684bfda9457ebfc2384ef6d8579f7
2016-04-12 10:37:45 -07:00
Debargha Mukherjee
c47c460f69 Step towards making the 2-pass cq mode perceptual
Uses a metric on fraction of smooth blocks derived from first pass
stats in a frame to adjust down the cq_level modestly in the cq mode.
The current implementation does not add much complexity, and is
fairly light in the adaptation.

Change-Id: Ic484e810d5bd51b7bb6b8945f378c7c3d9d27053
2016-04-09 06:24:18 -07:00
Marco
f6f544278e vp9: Some adjustments to scene-cut detection.
Change only affects 1 pass vbr mode, speed >=5.
Increase min_thresh, decrease boost, and set a min/max
value for gf_interval.

Change-Id: I9c1e1a1ab0c5780064eb62714ee39a72ea4d2107
2016-04-07 14:26:15 -07:00
Marco
8fab3e82ca vp9-1 pass vbr: Use average QP for active_worst_quality, for inter-frames.
And replace some operation with shift.

Change-Id: If1ea874ee05b7238d5f954e55bb3ceda804a091a
2016-03-30 17:43:47 -07:00
Paul Wilkins
a84f1f846e Increase min-max q range for normal inter frames.
Allow the encode loop to select from a wider range of Q values
when encoding normal (non arf or kf) frames.

This change is targeted at improving psycho-visual quality in some
easy sections that are currently not getting enough bits.
This is likely to be a little worse from a metrics perspective  and may also
have a small impact on encode speed in cases where extra recode
iterations are triggered.

Change-Id: I667eebf33c753bcbcf8b93596467369e5708b889
2016-03-22 12:56:05 -07:00
Paul Wilkins
afd869308e Merge "Revert "Fix bug in stats output for HBD."" 2016-03-15 19:21:45 +00:00
Paul Wilkins
a132100e63 Revert "Fix bug in stats output for HBD."
This reverts commit c7780075ec.

Change-Id: I2d2e1b387bf0c70cc7238ee4f8edab2aad873489
2016-03-15 19:21:14 +00:00
Marco
2bf51c76e3 vp9: Fix to scene cut/content change detection.
Use proper conditon on resolution check.

Change-Id: Idf563eb4391f373baf79546414a075b6516a5d35
2016-03-15 10:31:57 -07:00
Marco
239bf26fde vp9: Scene cut/content change detection: Adjust gf update.
For 1 pass vbr mode: Increase the period of gf update on scene
cut (keep it same as orginal/default setting for now).

Change-Id: I679c3bd21152f6c4e486c8098d931c00e1d26b5f
2016-03-14 12:16:37 -07:00
Marco
3521e9ee7c vp9: Scene cut/slide change detection: Increse min_thresh.
Only affects vbr mode.

Change-Id: I15e24c50343bc9171c734dfc7685491c7dbb8654
2016-03-14 10:43:42 -07:00
Marco
15be44a58f vp9: Fix issue in scene/content change detection.
The change https://chromium-review.googlesource.com/#/c/329181/
also changed behavior for cbr mode, which causes some regression
in screenshare test in webrtc.

Resetting the specific change to leave the cbr behavior
unchanged for now.

Change-Id: I52df158806422f86398e1d2f522e92067d8325eb
2016-03-11 12:20:12 -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
Paul Wilkins
38b3593eb9 Merge "Fix bug in stats output for HBD." 2016-03-04 15:55:11 +00:00
paulwilkins
c7780075ec Fix bug in stats output for HBD.
Change-Id: Ic3b033e22cdcdc4a0f78cef433b2208fd254c27b
2016-03-04 12:57:10 +00:00
Marco
38e401b5da vp9-svc: Fix issues with svc with periodic key frames.
Use the superframe counter to set the key frame, and force
it to the key frame on base spatial layer only.
Also, update svc frame counters under frame dropping.

Update unittest: add specific tests with short key frame period.

https://bugs.chromium.org/p/webm/issues/detail?id=1150

Change-Id: I5b1c9a09253e6e5fbfce51b4cf603ae22d422b01
2016-03-02 16:59:58 -08:00
Marco
1cab19e9e4 vp9: Update to scene/content change detection.
Update some parameters and put check on frame size change.
For 1 pass VBR mode, speed >= 5.

Change-Id: If24ed94a21e705ea57d40b9bf235ad079db786fc
2016-02-23 17:52:37 -08:00
Marco
a0278cad3f vp9 aq-mode=3: Allow it to be used for 1 pass VBR mode.
Change-Id: I630b8e33106c78382545d49da5fb4c75b1b0b528
2016-02-22 17:44:20 -08:00
Marco
958f372509 vp9: 1 pass vbr real-time mode: Adjust gf refresh for scene change.
Use the existing scene/content change detection to better
update/adjust golden frame refresh.

Change only affects 1 pass real-time vbr mode, speed >=5.

Change-Id: I2963a5bb7ca4a19f8cf8511b0a925e502f60e014
2016-02-19 09:40:23 -08:00
Alex Converse
4b2b90fed3 vp9: Be more responsive to massive overshoot.
Limit oscilation detection in the case where overshoot is very very
large.

This keeps the 9-bit cost patch from breaking the DownUp reisze test.
The patch pushed us to an 11% undershoot right before a scene cut
causing a 1200% overshoot. (Whereas before we were undershooting by
only 6% before overshooting by 1200%).

Change-Id: Id90ccfab8aba872ccadc45b73b3bb097b895677f
2016-01-25 12:03:50 -08:00
paulwilkins
fc50d95b2e Fixed interval, fixed Q 1 pass test patch.
For testing implemented a fixed pattern and delta, 1 pass,
fixed Q, low delay mode.

This has not in any way been tuned or optimized.

Change-Id: Idf5ee179b277fa15d07a97f14f2ce5bbaae80a04
2015-12-15 15:00:38 +00:00
paulwilkins
cea5e1c1e3 1 pass VBR mode bug fix.
The one pass VBR mode selects a Q range based on a
moving average of recent Q values. This calculation
should have been excluding arf overlay frames as these
are usually coded at the highest allowed value. Their
inclusion skews the average and can cause it to drift
upwards even when the clip as a whole is undershooting.

As such it can undermine correct adaptation of the allowed
Q range especially for easy content.

Change-Id: I7d10fe4227262376aa2dc2a7aec0f1fd82bf11f9
2015-12-15 10:27:51 +00:00
paulwilkins
4e692bbee2 Changes to exhaustive motion search.
This change has been imported from VP9 and
alters the nature and use of exhaustive motion search.

Firstly any exhaustive search is preceded by a normal step search.
The exhaustive search is only carried out if the distortion resulting
from the step search is above a threshold value.

Secondly the simple +/- 64 exhaustive search is replaced by a
multi stage mesh based search where each stage has a range
and step/interval size. Subsequent stages use the best position from
the previous stage as the center of the search but use a reduced range
and interval size.

For example:
  stage 1: Range +/- 64 interval 4
  stage 2: Range +/- 32 interval 2
  stage 3: Range +/- 15 interval 1

This process, especially when it follows on from a normal step
search, has shown itself to be almost as effective as a full range
exhaustive search with step 1 but greatly lowers the computational
complexity such that it can be used in some cases for speeds 0-2.

This patch also removes a double exhaustive search for sub 8x8 blocks
which also contained  a bug (the two searches used different distortion
metrics).

For best quality in my test animation sequence this patch has almost
no impact on quality but improves encode speed by more than 5X.

Restricted use in good quality speeds 0-2 yields significant quality gains
on the animation test of 0.2 - 0.5 db with only a small impact on encode
speed. On most natural video clips, however, where the step search
is performing well, the quality gain and speed impact are small.

Change-Id: Iac24152ae239f42a246f39ee5f00fe62d193cb98
2015-12-08 16:54:42 +00:00
paulwilkins
4a79503b3e Fix bug when overlaying middle arfs in multi-arf groups.
Do not reset the alt ref active flag when overlaying the middle
arf(s) of a multi arf group.

Change-Id: Ia55a55a376973f3fd17161429fd2afb07b4df31f
2015-12-03 15:19:02 +00:00
Marco
80a3e2615a vp9-svc: Fix the setting of is_key_frame.
Change on affects 1 pass CBR.
On key frame, temporal layer_id is reset to 0 for 1 pass CBR,
but since "layer" is reset, the svc.layer_context[layer].is_key_frame
was not correspondingly set properly.

Change-Id: I08f6da0a55ac7429ccfbaddfb7be14479e43543b
2015-11-20 08:51:13 -08:00
jackychen
3c9a424e6e VP9 dynamic resize: increase waiting time after key frame.
For 1 pass CBR mode: increase waiting time after key frame
before we start sampling rate control behavior for determining
resize. This change need to disable one internal resize(DownUp)
temporally since it requires a longer clip to do so.

Change-Id: If21beda1be23f169ee541ab4dd642f718347887a
2015-11-09 12:04:00 -08:00
Jacky Chen
039f241fc2 Merge "VP9_resizing: add limitation to the downsacling resolution." 2015-10-29 21:00:36 +00:00
jackychen
dba2d5b3f3 VP9_resizing: add limitation to the downsacling resolution.
Width and height of downscaling resolution should not be lower
than min_width and min_height which can be set as needed, both
are 180 for now.

Change-Id: I34d06704ea51affbdd814246e22ee8d41d991f00
2015-10-29 09:42:44 -07: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
Paul Wilkins
762c0f2264 Bug in clamping of base_frame_target.
Bug relating to issue:- http://b/25090786

base_frame_target is supposed to track the idealized bit
allocation based on error score and not the actual bits
allocated to each frame.

The clamping of this value based on the VBR min and max pct values
was causing a bug where in some cases the loop that adjusts the
active max quantizer for each GF group was running out of bits at
the end of a KF group. This caused a spike in Q and some ugly artifacts.

A second change makes sure that the calculation of the active
Q range for a group DOES, however, take account of clamping.

Change-Id: I31035e97d18853530b0874b433c1da7703f607d1
2015-10-23 14:45:48 -07:00
Jacky Chen
a5d74843eb Merge "VP9_resizing: adjust the threshold and another improvement." 2015-10-15 21:35:02 +00:00
Marco Paniconi
cff15f9d3c Merge "Fix resetting of cyclic refresh on dynamic resize change." 2015-10-15 21:09:06 +00:00
JackyChen
dc002cb7b4 VP9_resizing: adjust the threshold and another improvement.
Adjust the qp threshold based on the denoising setting; not allow
to scale directly from original resolution to one half and vise versa.

Change-Id: I032a9b22f8e1c88de6bb81cf8351367223a3e40d
2015-10-15 09:27:22 -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
1a0a10cf3d VP9: Rate control update for re-encode screen-content.
For the re-encoding (at max-qp) on the detected high-content change:
update rate correction factor, reset rate over/under-shoot flags,
and update/reset the rate control for layered coding.

Change-Id: I5dc72bb235427344dc87b5235f2b0f31704a034a
2015-10-15 08:26:15 -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
jackychen
de53e6de49 Add the check of resolution in VP9 dynamic resizing.
The resolution check fixs the issue which resets resize_pending
unnecessarily and causes not-bitexact with previous one-step version.

Change-Id: I4e7660b3c8f34f59781e2e61ca30d61080c322de
2015-10-05 15:39:32 -07:00
Marco
37293583cd Stabilize the encoder buffer from going too negative.
For screen-content mode, with frame dropper off, put a limit
on how low encoder buffer can go.

Under hard slide changes, the buffer level can go too low and then
take long time to come back up (in particular when frame-dropping
is not used), which will affect the active_worst and target frame size.

Change-Id: Ie9fca097e05cd71141f978ec687f852daf9de332
2015-10-02 11:07:59 -07:00
jackychen
ba06be3844 Two-steps scaling in VP9 encoder dynamic resizing.
Dynamic resizing now support two-steps scaling: first go down to
3/4 and then 1/2. This feature is under a flag which controls the
switch between two-steps scaling and one-step scaling (1/2 only).

Change-Id: I3a6c1d3d5668cf8e016a0a02aeca737565604a0f
2015-10-01 18:18:49 -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
Debargha Mukherjee
0e1b4fb941 Fix two pass svc encoding
Fixes temporal scalability. Updates were inadvertently turned
off for two pass svc causing crashes due to gf_group.index
growing unchecked.

Change-Id: Iff759946bf61bbde70630347cc8fa4d51a8c2d2f
2015-09-15 06:11:24 -07:00
jackychen
419456617e Change parameters for VP9 dynamic resizing.
Use a smaller window in dynamic resizing and wait a shorter
time after key frame.

Change-Id: I086f840cdec3c6bdaa9acfe11346d919e445973d
2015-09-14 16:17:52 -07:00
jackychen
f5617fd083 Change the qp threshold of VP9 dynamic resizing.
Change-Id: I1efe086191665ff8fa063f03d8e2032024dc090f
2015-09-09 15:47:07 -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
Marco
42b6791774 Allow for re-encoding frame if high overshoot.
For 1 pass CBR mode under screen content mode:
if pre-analysis (source temporal-sad) indicates significant
change in content, then check the projected frame size after
encode_frame(), and if size is above threshold, force re-encode
of that frame at max QP.

Change-Id: I91e66d9f3167aff2ffcc6f16f47f19f1c21dc688
2015-08-18 15:36:59 -07:00