Jingning Han [Mon, 25 Feb 2013 20:08:29 +0000 (12:08 -0800)]
Improving the forward 16x16 ADST/DCT accuracy
Increase the first stage dynamic range by 4 times, and reduce it
back with proper rounding before applying the second stage. Hence
it still fits in the given dynamic range and slightly improves
the key frame coding performance.
Jingning Han [Sat, 23 Feb 2013 00:29:28 +0000 (16:29 -0800)]
clean up forward and inverse hybrid transform
Rebased.
Remove the old matrix multiplication transform computation. The 16x16
ADST/DCT can be switched on/off and evaluated by setting ACTIVE_HT16
300/0 in vp9/common/vp9_blockd.h.
Paul Wilkins [Mon, 25 Feb 2013 12:36:38 +0000 (12:36 +0000)]
Minor rate control refactoring and experiments.
Some minor refactoring code relating to estimates of
bits per MB at a given Q and estimating the allowed Q range.
Most of the changes here were included in a previous commit.
This commit seeks to separate out the refactoring from more
the material changes.
Two #define control flags have been added for experimentation.
ONE_SHOT_Q_ESTIMATE force the two pass encoder to
use its initial Q range estimate for the whole clip even if this results
in a miss on the target data rate. In effect this tightens the Q range
seen at the expense of rate control accuracy.
DISABLE_RC_LONG_TERM_MEM is a related flag that disables the
long term memory in the rate control. Local adjustments are still
made to try and better hit the rate target on a per frame basis but
the impact of rate control misses is not propagated to the remainder
of the clip. This means that for example an overshoot early on will not
cause frames later in the clip to be starved of bits. Again the result
of this relaxation amy be less rate control accuracy especially on short
clips.
Yaowu Xu [Sat, 23 Feb 2013 00:18:08 +0000 (16:18 -0800)]
optimize forward 16x16 DCT for accuracy
This commit added pre/post scaling for first half of fDCT16x16 to
reduce error, by simulation of 100,000 blocks for random inputs,
the average sse reduced from 2.1/block to 0.0498/block.
Paul Wilkins [Tue, 19 Feb 2013 18:12:00 +0000 (10:12 -0800)]
Further changes to coefficient contexts.
This patch alters the balance of context between the
coefficient bands (reflecting the position of coefficients
within a transform blocks) and the energy of the previous
token (or tokens) within a block.
In this case the number of coefficient bands is reduced
but more previous token energy bands are supported.
Some initial rebalancing of the default tables has been
by running multiple derf clips at multiple data rates using
the ENTOPY_STATS macro. Further balancing needs to be
done using larger image formatsd especially in regard to
the bigger transform sizes which are not as well represented
in encodings of smaller image formats.
Yaowu Xu [Fri, 22 Feb 2013 19:14:04 +0000 (11:14 -0800)]
optimize 8x8 fdct rounding for accuracy
The commit added a final rounding choice for 8x8 forward dct to get
rid of a sign bias at DC position and improve the accuracry in term
of round trip error for 8x8 fDCT/iDCT.
Dmitry Kovalev [Fri, 22 Feb 2013 19:03:14 +0000 (11:03 -0800)]
Code cleanup.
Removing redundant 'extern' keywords and parentheses, fixing indentation,
making variable names lower case, using short expressions x *= c
instead of x = x * c, minor code simplifications.
Yaowu Xu [Fri, 22 Feb 2013 18:09:40 +0000 (10:09 -0800)]
changes related fdct/idct tests
1. changed 4x4 test name to Vp9Fdct4x4Test to be consistent
2. remove forward 8x8 dct test code from idct8x8_test.cc
3. temporarily disable other forward dct tests to allow fdct work in
progress
Jingning Han [Wed, 13 Feb 2013 17:03:21 +0000 (09:03 -0800)]
Forward butterfly hybrid transform
This patch includes 4x4, 8x8, and 16x16 forward butterfly ADST/DCT
hybrid transform. The kernel of 4x4 ADST is sin((2k+1)*(n+1)/(2N+1)).
The kernel of 8x8/16x16 ADST is of the form sin((2k+1)*(2n+1)/4N).
Deb Mukherjee [Tue, 12 Feb 2013 01:08:52 +0000 (17:08 -0800)]
Refactoring of switchable filter search for speed
Refactors the switchable filter search in the rd loop to
improve encode speed.
Uses a piecewise approximation to a closed form expression to estimate
rd cost for a Laplacian source with a given variance and quantization
step-size.
About 40% encode time reduction is achieved.
Results (on a feb 12 baseline) show a slight drop:
Jingning Han [Wed, 20 Feb 2013 23:32:17 +0000 (15:32 -0800)]
Fixed the buffer overflow issue
The issue that potentially broke the encoding process was due to the fact
that the length of token link is calculated from the total number of tokens
coded, while it is possible, in high bit-rate setting, this length is
greater than the buffer length initially assigned to the cpi->tok.
This patch increases the initially allocated buffer length assigned to
cpi->tok from
(mb_rows * mb_cols * 24 * 16) to (mb_rows * mb_cols * (1 + 24 * 16)).
Tero Rintaluoma [Wed, 13 Feb 2013 13:18:41 +0000 (15:18 +0200)]
Avoid division in intra prediction
- Using multiplication and shifting instead of division in
intra prediction.
- Maximum absolute difference is 1 for division statements
in d45, d27, d63 prediction modes. However, errors can
cumulate for large block sizes when using already predicted
values.
- Maximum number of non-matching result values in loops using
division are:
4x4 0/16
8x8 0/64
16x16 10/256
32x32 13/1024
64x64 122/4096
Jingning Han [Sat, 16 Feb 2013 22:08:36 +0000 (14:08 -0800)]
16x16 butterfly inverse ADST/DCT hybrid transform
rebased.
This patch includes 16x16 butterfly inverse ADST/DCT hybrid
transform. It uses the variant ADST of kernel
sin((2k+1)*(2n+1)/4N),
which allows a butterfly implementation.
The coding gains as compared to DCT 16x16 are about 0.1% for
both derf and std-hd. It is noteworthy that for std-hd sets
many sequences gains about 0.5%, some 0.2%. There are also few
points that provides -1% to -3% performance. Hence the average
goes to about 0.1%.
Yaowu Xu [Wed, 13 Feb 2013 22:22:15 +0000 (14:22 -0800)]
Use lossless for Q0
The commit changes the coding mode to lossless whenever the lowest
quantizer is choosen.
As expected, test results showed no difference for cif and std-hd
set where Q0 is rarely used. For yt and yt-hd set, Q0 is used for
a number of clips, where this commit helped a lot in the high end.
Average over all clips in the sets:
yt: 2.391% 1.017% 1.066%
hd: 1.937% .764% .787%
Ronald S. Bultje [Fri, 15 Feb 2013 23:55:31 +0000 (15:55 -0800)]
Prevent filling transform size cache with uninitialized values.
The 32x32 value in case of splitmv was uninitialized. this leads to
all kind of erratic behaviour down the line. Also fill in dummy values
for superblocks in keyframes (the values are currently unused, but we
run into integer overflows anyway, which makes detecting bad cases
harder). Lastly, in case we did not find any RD value at all, don't
set tx_diff to INT_MIN, but instead set it to zero (since if we couldn't
find a mode, it's unlikely that any particular transform would have made
that worse or better; rather, it's likely equally bad for all tx_sizes).
These allow sending partial bitstream packets over the network before
encoding a complete frame is completed, thus lowering end-to-end
latency. The tile-rows are not independent.
Ronald S. Bultje [Wed, 13 Feb 2013 20:28:19 +0000 (12:28 -0800)]
Remove 2nd-order transform for first-order DC coefficients.
Since addition of the larger-scale transforms (16x16, 32x32), these
don't give a benefit at macroblock-sizes anymore. At superblock-sizes,
2nd-order transform was never used over the larger transforms. Future
work should test whether there is a benefit for that use case.
Paul Wilkins [Mon, 11 Feb 2013 20:44:53 +0000 (20:44 +0000)]
Abstract selection of coef band.
This patch abstracts the selection of the coefficient band
context into a function as a precursor to further experiments
with the coefficient context.
It also removes the large per TX size coefficient band structures
and uses a single matrix for all block sizes within the test function.
This may have an impact on quality (results to follow) but is only an
intermediate step in the process of redefining the context. Also the
quality impact will be larger initially because the default tables will
be out of step with the new banding.
In particular the 4x4 will in this case only use 7 bands. If needed we
can add back block size dependency localized within the function, but
this can follow on after the other changes to the definition of the
context.
Paul Wilkins [Mon, 11 Feb 2013 19:19:21 +0000 (19:19 +0000)]
Abstract the selection of coefficient context.
This is an initial step to facilitate experimentation
with changes to the prior token context used to code
coefficients to take better account of the energy of
preceding tokens.
This patch merely abstracts the selection of context into
two functions and does not alter the output.
Yaowu Xu [Tue, 12 Feb 2013 05:14:46 +0000 (21:14 -0800)]
enable bitstream lossless support
1. Added a bit in frame header to to indicate if a frame is encoded
in lossless mode, so decoder does not make the decision based on Q0
2. Minor changes to make sure that lossy coding works same as when
the lossless experiment is not enabled.
3. Renamed function pointers for transforms to be consistent, using
prefix fwd_txm and inv_txm for forward and inverse respectively
To encode in lossless mode, using "--lossless=1 --min-q=0 --max-q=0"
with vpxenc.
Scott LaVarnway [Wed, 13 Feb 2013 17:15:38 +0000 (09:15 -0800)]
WIP: ssse3 version of convolve avg functions
Initial ssse3 convolve avg functions and is one step closer
to using x86inc.asm. The decoder performance improved by 8% for
the test clip used. This should be revisited later to see if
averaging outside the loop is better than having many similar
filter functions.
Paul Wilkins [Mon, 11 Feb 2013 12:56:02 +0000 (12:56 +0000)]
Remove NEWCOEFCONTEXT experiment.
Removal of the NEWCOEFCONTEXT experiment to
reduce code clutter and make it easier to experiment with
some other changes to the coefficient coding context.
This is after discussion with the hardware team. Update the unit test
to take these sizes into account. Split out some duplicate code into
a separate file so it can be shared.
Implement convolve8_avg using common functions which are already optimized
instead of using more obscure ones which have only C versions. Encoder
overall speed-up of about 12%.
Jingning Han [Sat, 9 Feb 2013 00:19:42 +0000 (16:19 -0800)]
butterfly inverse 4x4 ADST
fixed format issues.
Implement the inverse 4x4 ADST using 9 multiplications. For this
particular dimension, the original ADST transform can be
factorized into simpler operations, hence is retained.
Scott LaVarnway [Sat, 9 Feb 2013 23:15:14 +0000 (15:15 -0800)]
Bug fix: ssse3 version of subpixel did not match C code
A 16 bit overflow condition occurs when using the EIGHTTAP_SMOOTH filters.
(vp9_sub_pel_filters_8lp) Changed the order of the adds to fix this problem.
Also added ssse3 support for 4x4 subpixel filtering.
Also port the 4x4, 16x16, 8x16 and 16x8 versions to x86inc.asm; this
makes them all slightly faster, particularly on x86-64. Remove SSE3
sad16x16 version, since the SSE2 version is now faster.
Cache the constant offset in one variable to prevent re-loading that
in each loop iteration, and mark the function as inline so we can use
the fact that the transform size is always known in the caller.
John Koleszar [Thu, 7 Feb 2013 18:09:05 +0000 (10:09 -0800)]
Pass macroblock index to pick inter functions
Pass the current mb row and column around rather than the
recon_yoffset and recon_uvoffset, since those offsets will
change from predictor to predictor, based on the reference
frame selection.
John Koleszar [Fri, 8 Feb 2013 22:20:05 +0000 (14:20 -0800)]
Merge changes Icd1a2a5a,I204d17a1,I3ed92117 into experimental
* changes:
Initial support for resolution changes on P-frames
Avoid allocating memory when resizing frames
Adds a test for the VP8E_SET_SCALEMODE control