Peter de Rivaz [Tue, 2 Dec 2014 12:14:52 +0000 (12:14 +0000)]
Reinsert macro to fix issue 884.
Change 72056 unfolded some macro definitions,
but lost some alternative behaviour required for
high bitdepth encodes.
This causes the encoder to crash, see issue 884.
Jingning Han [Mon, 1 Dec 2014 01:40:58 +0000 (17:40 -0800)]
Turn off temporal svc unit test in RTC setting
A hidden enc/dec mismatch bug was accidentally triggered by
https://gerrit.chromium.org/gerrit/#/c/72247/
Adaptively adjust mode test kick-off thresholds in RTC coding
This commit temporarily turns off the broken unit tests to avoid
blocking other CLs while fixing.
Yunqing Wang [Wed, 26 Nov 2014 00:53:47 +0000 (16:53 -0800)]
vp9_ethread: calculate and save the tok starting address for tiles
Each tile's tok starting address is calculated before the encoding
process. These addresses are stored so that the same calculation
won't be done again in packing bit stream.
Yaowu Xu [Fri, 21 Nov 2014 19:55:27 +0000 (11:55 -0800)]
Separate rate_correction_factor for boosted GFs
When the golden frame is boosted, the rate correction factor is not
correlated well with other inter frames even in CBR mode. This commit
changes to use GF specific rate_correction_factor when gf_cbr_boost
is greater than 20%.
Jingning Han [Mon, 24 Nov 2014 22:40:42 +0000 (14:40 -0800)]
Adaptively adjust mode test kick-off thresholds in RTC coding
This commit allows the encoder to increase the mode test kick-off
thresholds if the previous best mode renders all zero quantized
coefficients, thereby saving motion search runs when possible.
The compression performance of speed -5 and -6 is down by -0.446%
and 0.591%, respectively. The runtime of speed -6 is improved by
10% for many test clips.
vidyo1, 1000 kbps
16578 b/f, 40.316 dB, 7873 ms -> 16575 b/f, 40.262 dB, 7126 ms
nik720p, 1000 kbps
33311 b/f, 38.651 dB, 7263 ms -> 33304 b/f, 38.629 dB, 6865 ms
dark720p, 1000 kbps
33331 b/f, 39.718 dB, 13596 ms -> 33324 b/f, 39.651 dB, 12000 ms
mmoving, 1000 kbps
33263 b/f, 40.983 dB, 7566 ms -> 33259 b/f, 40.978 dB, 7531 ms
Yunqing Wang [Fri, 21 Nov 2014 19:11:06 +0000 (11:11 -0800)]
vp9_ethread: modify VP9_COMP structure
This patch modified struct VP9_COMP. Created a struct ThreadData
to include data that need to be copied for each thread. In
multiple thread case, one thread processes one tile. all threads
share one copy of VP9_COMP,
(refer to VP9_COMP *cpi in the code)
but each thread has its own copy of ThreadData,
(refer to ThreadData *td in the code).
Therefore, within the scope of encode_tiles(), both cpi and td
need to be passed as function parameters.
In single thread case, the FRAME_COUNTS pointer in ThreadData
points to "counts" in VP9_COMMON.
Jingning Han [Mon, 24 Nov 2014 17:31:10 +0000 (09:31 -0800)]
Remove redundant intra mode penalty from vp9_pick_inter_mode
The intra mode penalty is covered by intra_cost_penalty. This
commit removes the other intra cost threshold, provided that the
constant 50 is negligible in normal rate-distortion cost.
Peter de Rivaz [Fri, 24 Oct 2014 07:37:39 +0000 (08:37 +0100)]
Refactored idct routines and headers
This change is made in preparation for a
subsequent patch which adds acceleration
for the highbitdepth transform functions.
The highbitdepth transform functions attempt
to use 16/32bit sse instructions where possible,
but fallback to using the C implementations if
potential overflow is detected. For this reason
the dct routines are made global so they can be
called from the acceleration functions in the
subsequent patch.
Jingning Han [Fri, 21 Nov 2014 20:18:53 +0000 (12:18 -0800)]
Rework forward txfm/quantization skip system in RTC coding mode
This commit allows more aggressive decision to skip forward
transform and quantization for luma component in RTC coding mode.
The chroma components remains going through the normal coding
routine, since they are not included in the non-RD mode search
process.
It reduces the runtime cost by 2% - 10%. In speed -6,
vidyo1 1000 kbps
16576 b/f, 40.281 dB, 8402 ms -> 16576 b/f, 40.323 dB, 7764 ms
nik720p 1000 kbps
33337 b/f, 38.622 dB, 7473 ms -> 33299 b/f, 38.660 dB, 7314 ms
dark720p 1000 kbps
33330 b/f, 39.785 dB, 13505 ms -> 33325 b/f, 39.714 dB, 13105 ms
The compression performance of speed -6 is improved by 0.44% in
PSNR and 1.31% in SSIM.
Paul Wilkins [Fri, 21 Nov 2014 02:32:44 +0000 (18:32 -0800)]
Remove rate component adjustment for AQ1
In AQ1 a rate adjustment was applied for blocks coded with a
deltaq. This tends to skew the partition selection and cause
rate overshoot.
For example, consider a 64x64 super block where some but not all
sub blocks are in a low q segment and some are in a high q segment.
The choice of Q when considering large partition and transform sizes
is defined by the lowest sub block segment id (currently this implies the
lowest Q). If some parts of the larger partition are very hard this will
cause a high rate component.
The correct behavior here is for the rd code to discard the large partition
choice and break down to sub blocks where some have low and some
have high Q. However the rate correction factor above mask the high
cost of coding at a larger partition size.
Johann [Thu, 20 Nov 2014 21:24:55 +0000 (13:24 -0800)]
Correctly initialize "ones" value in neon quantize
By using 0xff for a short it was not setting the high bits. When
comparing the output with vtst to find non-zero elements it was skipping
vaules which had no low bits set such as -512 / 0xFE00.
Using -8191 as the first element of coeff will generate this condition.
Paul Wilkins [Fri, 7 Nov 2014 16:32:50 +0000 (16:32 +0000)]
Add variance restriction to AQ2.
Add an additional restriction to bit/complexity based
segmentation based on spatial variance.
Only lower Q when both the number of bits spent
in the initial encoding pass and the spatial complexity are
below a threshold. This will prevent the low Q segments
being used just because there is a surfeit of bits.
Small metrics gains especially opsnr.
derf ~0.2% std-hd ~0.3%
Yunqing Wang [Thu, 20 Nov 2014 20:42:36 +0000 (12:42 -0800)]
vp9_ethread: move filter_cache out of RD_OPT struct
Similar to mask_filter, the filter_cache in RD_OPT struct can be
moved out, and declared as a local variable since it is only
used in pick_inter_mode functions.
Paul Wilkins [Thu, 20 Nov 2014 20:22:53 +0000 (12:22 -0800)]
Fix bug in calculating number of mbs with scaling.
Correct calculation of number of mbs in two pass code when
frame resizing is enabled. Always use initial number of mbs if
scaling is enabled, as this is what was used in the first pass.
Yunqing Wang [Thu, 20 Nov 2014 17:41:49 +0000 (09:41 -0800)]
vp9_ethread: change mask_filter to a local variable
The mask_filter in RD_OPT struct is used to record rd result in
filter decision. It is only used in pick_inter_mode functions,
and is removed from the struct and declared as a local variable.
Yunqing Wang [Thu, 20 Nov 2014 17:24:50 +0000 (09:24 -0800)]
vp9_ethread: move max/min partition size to mb struct
The max_partition_size and max_partition_size are set at the
beginning while setting speed features, and then adjusted at
SB level. Moving them to mb struct ensures there is a local
copy for each thread.
Yaowu Xu [Wed, 19 Nov 2014 23:32:11 +0000 (15:32 -0800)]
Add a reset to rc tracking for dropped frames
VP9/DatarateTestVP9Large.ChangingDropFrameThresh/[34] fails post the
merge of commit#ffa06b37. This commit adds reset of rc tracking info
when frame is dropped, and fixes the causes of the bad interaction
between the tests and the previous commit.
Jingning Han [Tue, 18 Nov 2014 19:53:14 +0000 (11:53 -0800)]
Combine fdct8x8 and quantization process
This commit reworks the forward transform and quantization process
for 8x8 block coding. It combines the two operations in a single
function to save a store/load stage of the original transform
coefficients. Overall the speed -6 is slightly faster (around 1%
range). The compression performance of speed -6 is improved by
3.4%.
Yaowu Xu [Tue, 18 Nov 2014 16:52:21 +0000 (08:52 -0800)]
Prevent severe rate control errors in CBR mode
In rare cases, the interaction between rate correction factor and Q
choices may cause severe oscillating frame sizes that are way off
target bandwidth. This commit adds tracking of rate control results
for last two frames, and use the information to prevent oscillating
Q choices.
Jingning Han [Tue, 18 Nov 2014 16:58:09 +0000 (08:58 -0800)]
Add sse2 version for vp9_quantize_fp
vp9_quantize_fp is the quantization process used by rtc coding
mode. This commit adds a sse2 implementation of it. The
implementation is modified based on vp9_quantize_b_sse2. No speed
difference from ssse3 version.
Marco [Tue, 11 Nov 2014 19:01:55 +0000 (11:01 -0800)]
Modify active_worst_quality setting for one pass CBR.
Current setting had active_worst_quality set too high (close to worst_quality)
for first frame(s) following first key frame. This changes that to be somewhat
more aggressive in allowing active_worst_quality to be lower following key frame.
Also remove the 4/5 reduction in active_worst for key frame as
this should be set by the user qp_max setting.
Jingning Han [Mon, 17 Nov 2014 19:21:42 +0000 (11:21 -0800)]
Add empty pointer check to pred buffering in rtc coding mode
This commit adds a check condition to the prediction buffering
operation used in the rtc coding mode. This resolves a unit test
warning in example/vpx_tsvc_encoder_vp9_mode_7.
Yunqing Wang [Sat, 15 Nov 2014 00:04:15 +0000 (16:04 -0800)]
vp9_ethread: combine encoder counts in separate struct
Several frame counters in encoder are updated at SB level. Combine
those counters and put them in a separate struct, which allows us
to allocate one copy for each thread.