John Koleszar [Sun, 10 Mar 2013 20:39:30 +0000 (13:39 -0700)]
Optimize vp9_tree_probs_from_distribution
The previous implementation visited each node in the tree multiple times
because it used each symbol's encoding to revisit the branches taken and
increment its count. Instead, we can traverse the tree depth first and
calculate the probabilities and branch counts as we walk back up. The
complexity goes from somewhere between O(nlogn) and O(n^2) (depending on
how balanced the tree is) to O(n).
Only tested one clip (256kbps, CIF), saw 13% decoding perf improvement.
Note that this optimization should port trivially to VP8 as well. In VP8,
the decoder doesn't use this function, but it does routinely show up
on the profile for realtime encoding.
Yunqing Wang [Fri, 8 Mar 2013 18:54:30 +0000 (10:54 -0800)]
Add vp9_idct4_1d_sse2
Added SSE2 idct4_1d which is called by vp9_short_iht4x4. Also,
modified the parameter type passed to vp9_short_iht functions to
make it work with rtcd prototype.
Jingning Han [Wed, 6 Mar 2013 20:02:15 +0000 (12:02 -0800)]
Extend diff MV limit from +/-256 to +/-1024
Increase the motion search range by 4x. Change MV_CLASS tree of the
entropy coding to allow two additional mv classes to cover the
extended motion vector limit. The codec determines the effective
motion search range conditioned on the actual frame dimension.
It provides coding gains:
stdhd 0.39%
yt 0.56%
hd 0.47%
Major coding performance gains are packed in several sequences with
intense motion activities, e.g., ped_1080p gains 7% at high bit-rates,
and on average 3%.
TODO: Need to further tune the rate control and motion search units.
This also changes the RD search to take account of the correct block
index when searching (this is required for ADST positioning to work
correctly in combination with tx_select).
Yunqing Wang [Thu, 7 Mar 2013 17:15:32 +0000 (09:15 -0800)]
Fix issue in add_residual intrinsic function
Yaowu found this function had a compiling issue with MSVC because
of using _mm_storel_pi((__m64 *)(dest + 0 * stride), (__m128)p0).
To be safe, changed back to use integer store instruction.
Also, for some build, diff could not always be 16-byte aligned.
Changed that in the code.
Deb Mukherjee [Wed, 20 Feb 2013 18:16:24 +0000 (10:16 -0800)]
Coding con-zero count rather than EOB for coeffs
This patch revamps the entropy coding of coefficients to code first
a non-zero count per coded block and correspondingly remove the EOB
token from the token set.
STATUS:
Main encode/decode code achieving encode/decode sync - done.
Forward and backward probability updates to the nzcs - done.
Rd costing updates for nzcs - done.
Note: The dynamic progrmaming apporach used in trellis quantization
is not exactly compatible with nzcs. A suboptimal approach has been
used instead where branch costs are updated to account for changes
in the nzcs.
Paul Wilkins [Tue, 26 Feb 2013 16:53:03 +0000 (16:53 +0000)]
Added stricter Q control flag.
Added a variant of the one shot maxQ flag
for two pass that forces a fixed Q for the
normal inter frames. Disabled by default.
Also small adjustment to the Bits per MB
estimation.
Change-Id: I87efdfb2d094fe1340ca9ddae37470d7b278c8b8
Make superblocks independent of macroblock code and data.
Split macroblock and superblock tokenization and detokenization
functions and coefficient-related data structs so that the bitstream
layout and related code of superblock coefficients looks less like it's
a hack to fit macroblocks in superblocks.
In addition, unify chroma transform size selection from luma transform
size (i.e. always use the same size, as long as it fits the predictor);
in practice, this means 32x32 and 64x64 superblocks using the 16x16 luma
transform will now use the 16x16 (instead of the 8x8) chroma transform,
and 64x64 superblocks using the 32x32 luma transform will now use the
32x32 (instead of the 16x16) chroma transform.
Lastly, add a trellis optimize function for 32x32 transform blocks.
HD gains about 0.3%, STDHD about 0.15% and derf about 0.1%. There's
a few negative points here and there that I might want to analyze
a little closer.
Jingning Han [Thu, 28 Feb 2013 01:09:12 +0000 (17:09 -0800)]
Support 16K sequence coding
Fixed a couple of variable/function definitions, as well as header
handling to support 16K sequence coding at high bit-rates.
The width and height are each specified by two bytes in the header.
Use an extra byte to explicitly indicate the scaling factors in
both directions, each ranging from 0 to 15.
John Koleszar [Thu, 28 Feb 2013 18:52:04 +0000 (10:52 -0800)]
Fix incorrect comparison of frame size
The width and height stored in the reference frames are padded out to
a multiple of 16. The Width and Height variables in common are the
displayed size, which may be smaller. The incorrect comparison was
causing scaling related code to be called when it shouldn't have
been. A notable case where this happens is 1080p, since 1088 != 1080.
Jim Bankoski [Thu, 28 Feb 2013 16:32:14 +0000 (08:32 -0800)]
this commit converts all sad ptrs to uint32
sse4_1 code used uint16_t for returning sad, but that
won't work for 32x32 or 64x64. This code fixes the
assembly for those and also reenables sse4_1 on linux
Dmitry Kovalev [Wed, 27 Feb 2013 19:17:38 +0000 (11:17 -0800)]
Code cleanup.
Fixing code style, using array lookup instead of switch statements for
forward hybrid transforms (in the same way as for their inverses).
Consistent usage of ROUND_POWER_OF_TWO macro in appropriate places.
John Koleszar [Thu, 21 Feb 2013 00:32:02 +0000 (16:32 -0800)]
convolve test: validate 1D filters are 1D
Since the 8-tap lowpass filter is non-interpolating, the results are
different between applying it at whole-pel values and not. This
means that 1D-only versions are requried to be implemented, as
opposed to being an optimization of the 2D case. Calling the 2D
filter instead of the horizontal-only filter is not equivalent
in this case. Update the test to pass invalid filters to the
unused stage of the 1D-only calls, to verify they're unused.
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 [Wed, 27 Feb 2013 18:23:06 +0000 (10:23 -0800)]
Remove unused vp9_copy32xn
This function was part of an optimization used in VP8 that required
caching two macroblocks. This is unused in VP9, and might not
survive refactoring to support superblocks, so removing it for now.
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.