John Koleszar [Thu, 21 Feb 2013 00:13:01 +0000 (16:13 -0800)]
Run all filters through convolve test
Updates the convolve test to verify that all filters match the
reference implementation. This verifies commit 30f866f, which
fixed some problems with the SSE3 version of the filters for
the vp9_sub_pel_filters_8s and vp9_sub_pel_filters_8lp banks
due to overflow and order of operations.
John Koleszar [Tue, 26 Feb 2013 00:58:47 +0000 (16:58 -0800)]
vpxdec: support scaling output
Adds an option, --scale, that will rescale any frames produced by
the decoder that don't match the resolution of the first frame to
that resolution. This is useful for playback of files that use
spatial resampling.
John Koleszar [Thu, 1 Mar 2012 20:50:40 +0000 (12:50 -0800)]
vpxenc: support scaling prior to encoding
Scales the input of the encoder using libyuv's "box filter". Each stream
may have a different width and height specified. If the width (or
height) parameter is missing (or is explicitly set to 0) then the value
will be calculated based on the specified height (or width) and the
input file's dimensions, preserving its aspect ratio. Leaving the height
unspecified behaves similarly.
John Koleszar [Fri, 22 Feb 2013 19:22:03 +0000 (11:22 -0800)]
Use ref_frame_map vice active_ref_idx on the encoder
This patch makes the encoder's use of ref_frame_map and active_ref_idx
consistent with the decoder. ref_frame_map[] maps a reference buffer
index to its actual location in the yv12_fb array, since many
references may share an underlying buffer. active_ref_idx[] mirrors
cpi->{lst,gld,alt}_fb_idx, holding the active references in each
slot.
This also fixes a bug in setup_buffer_inter() where the incorrect
reference was used to populate the scaling factors.
John Koleszar [Thu, 21 Feb 2013 18:38:27 +0000 (10:38 -0800)]
Test upscaling as well as downscaling
Fixes a bug in vp9_set_internal_size() that prevented returning to
the unscaled state. Updated the ResizeInternalTest to scale both
down and up. Added a check that all frames are within 2.5% of the
quality of the initial keyframe.
John Koleszar [Wed, 20 Feb 2013 20:34:31 +0000 (12:34 -0800)]
Combined motion compensation with scaled predictors
This patch extends the previous support for using references of a
different resolution in ZEROMV mode to all inter prediction modes.
Subpixel based best-mv scoring is disabled when the reference frame
differs in resolution from the current frame.
John Koleszar [Wed, 20 Feb 2013 21:46:55 +0000 (13:46 -0800)]
Set scale factors consistently for SPLITMV
This commit updates the 4x4 prediction to consistently use the
build_2x1_inter_predictor() method. That function is updated to
calculate the scale offset, rather than relying on the caller
to calculate it. In the case that the 2x1 prediction can not
be used, the scale offset is recalculated for each 1x1 block.
The idea here is that the offsets are calculated before each
call to vp9_build_scaled_inter_predictor().
John Koleszar [Sat, 9 Feb 2013 01:49:44 +0000 (17:49 -0800)]
Refactor inter recon functions to support scaling
Ensure that all inter prediction goes through a common code path
that takes scaling into account. Removes a bunch of duplicate
1st/2nd predictor code. Also introduces a 16x8 mode for 8x8
MVs, similar to the 8x4 trick we were doing before. This has an
unexpected effect with EIGHTTAP_SMOOTH, so it's disabled in that
case for now.
Yaowu Xu [Tue, 26 Feb 2013 17:07:49 +0000 (09:07 -0800)]
Enable 32x32 dct tests
Also
1. Removed the test code for fDCT from the iDCT test.
2. changed the criteria of round trip error to be below 1/block, this
is quite strict comparing to smaller transforms when size differences
are accounted for.
Yaowu Xu [Mon, 25 Feb 2013 23:21:01 +0000 (15:21 -0800)]
Improve 32x32 forward dct
The commit improves the 32x32 forward dct implementation:
1. change to use same constants and rounding as other forward dcts
2. select rounding to specifically minimize the roundtrip error, which
improved average 19/block to .77/block using 100000 random input.
Test showed a small but consistent gain on all test sets, about .15%
Dmitry Kovalev [Mon, 25 Feb 2013 23:14:01 +0000 (15:14 -0800)]
Code cleanup.
Removing switch statements for inverse hybrid transforms. Making code style
consistent for all similar transform implementations. Renaming shortpitch
and short_pitch variables to half_pitch.
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.