John Koleszar [Wed, 17 Oct 2012 23:47:38 +0000 (16:47 -0700)]
Remove bc, bc2 from pbi,cpi,xd
Pass the bool coder to be used explicitly. This avoids cases where two
different bool coders can be addressed from the same function. Also be
more consistent with bool coder variable naming, start to standardize
on 'bc'.
Deb Mukherjee [Mon, 15 Oct 2012 23:41:41 +0000 (16:41 -0700)]
Some cleanups and fixes.
Separates the logic on transform type selection previously spread out
over a number of files into a separate function. Currently the tx_type
field in b_mode_info is not used, but still left in there to eventually
use for signaling the transform type in the bitstream.
Also, now for tx_type = DCT_DCT, the regular integer DCT is used, as
opposed to the floating point DCT used in conjuction with hybrid
transform.
Results change somewhat due to the transform change, but are within
reasonable limits. The hd/std-hd sets are slightly up, while derf/yt
are slightly down.
John Koleszar [Thu, 18 Oct 2012 04:43:18 +0000 (21:43 -0700)]
lint-hunks: exit status for only affected lines
Prior to this patch, if there were any lint errors, this script would
exit with an error, even if those errors were not in the hunks being
tested by this script. This change makes it so that if any lint lines
are printed, an error is returned.
John Koleszar [Wed, 17 Oct 2012 16:38:13 +0000 (09:38 -0700)]
Move remaining per-frame data into partition 0
This commit moves a bit of data that ended up packed with the
modes/mv/residual partition during the change to interleaved encoding
into partition 0 where it belongs.
John Koleszar [Tue, 16 Oct 2012 20:52:39 +0000 (13:52 -0700)]
Interleave modes/residual per macroblock
Packs the bitstream with each mb's residual following its mode/mv
information.
TODO: There are still a few fields that should be packed into partition
0 but are included in partition 1, due to them being serialized from
write_kfmodes/pack_inter_mode_mvs, which execute after the first
partition is finalized. These need to be separated out into a separate
function, similar to mb_mode_mv_init() in decodemv.c.
John Koleszar [Tue, 16 Oct 2012 21:08:40 +0000 (14:08 -0700)]
Force interleaved decoding
Rather than decoding all modes/mvs separately, decode them per MB. This
forces the mode which was already used form the CONFIG_NEWBESTREFMV and
CONFIG_SUPERBLOCKS experiments, and is a precursor to changing to
interleaved encoding.
Ronald S. Bultje [Mon, 15 Oct 2012 20:49:45 +0000 (13:49 -0700)]
Remove mode_rdopt from MB_MODE_INFO.
The variable is essentially a duplicate of mode for RD-only purposes.
Removing it gives identical results, and saves 4 bytes per macroblock
(i.e. 32.5kB for a 1080p HD video encode).
Ronald S. Bultje [Mon, 15 Oct 2012 17:52:13 +0000 (10:52 -0700)]
Add a new token stuffing function vp8_stuff_mb().
This way a caller doesn't need to implement the logic for which (and how
many) tokens to write out to stuff one macroblock worth of EOBs. Make
the actual function implementations static, since they are now only used
in tokenize.c; also do some minor stylistic changes so it follows the
style guide a little more closely; use PLANE_TYPE where appropriate,
remove old (stale) frame_type function arguments; hardcode plane type
where only a single one is possible (2nd order DC or U/V EOB stuffing);
support stuffing 8x8/4x4 transform EOBs with no 2nd order DC.
Ronald S. Bultje [Sun, 14 Oct 2012 22:29:56 +0000 (15:29 -0700)]
Add and consistently use PLANE_TYPE.
Change the macros PLANE_TYPE_{Y_NO_DC,Y2,UV,Y_WITH_DC} to a typed enum,
and use this typed enum consistently across all places where relevant.
In places where the type is implied (e.g. in functions that only handle
second order planes or chroma planes), remove it as a function argument
and instead hardcode the proper enum in the code directly.
Ronald S. Bultje [Sat, 13 Oct 2012 18:46:21 +0000 (11:46 -0700)]
Merge duplicate loops in tokenization code.
Also merge the three occurrences of 4x4 chroma block writing into a
single function, and call that function instead of duplicating the
4x4 chroma tokenization code in 3 places.
Ronald S. Bultje [Sat, 13 Oct 2012 16:27:54 +0000 (09:27 -0700)]
Minor refactoring in encodeintra.c.
Merge code blocks for different transform sizes; use MACROBLOCKD as a
temp variable where that leads to smaller overall source code; remove
duplicate code under #if CONFIG_HYBRIDTRANSFORM/#else blocks. Some style
changes to make it follow the style guide a little better.
Ronald S. Bultje [Sat, 13 Oct 2012 15:15:51 +0000 (08:15 -0700)]
Remove duplicate or unused code in encoder/encodemb.c.
Also make some minor stylistic changes to bring the code closer to
the style guide. Remove distinction between inter and intra transform
functions, since both do exactly the same thing except for the check
against SPLITMV for the second-order transform. Remove some commented
out debug code. Remove 8x8/16x16 transform code in encode_inter16x16y(),
since the first-pass only uses 4x4 anyway.
Ronald S. Bultje [Sat, 13 Oct 2012 05:42:06 +0000 (22:42 -0700)]
Remove duplicate or unused code in encoder/quantize.c.
Also make some minor stylistic changes to bring the code closer to
the style guide. Remove checks against i8x8/bpred in the mb-codepath,
since these do individual block reconstruction and thus don't go through
this codepath.
Ronald S. Bultje [Fri, 12 Oct 2012 01:19:20 +0000 (18:19 -0700)]
Remove reverting of tx-select if only a single txfm-size is used.
Entropy coding takes care of this anyway, and this causes changes to
the txfm size assigned to skip blocks, which can affect the loopfilter
output, thus causing encoder/decoding mismatches.
John Koleszar [Fri, 12 Oct 2012 05:15:33 +0000 (22:15 -0700)]
consolidate update_mb_segmentation_map data
The update_mb_segmentation_map flag was being signalled earlier than
other data dependent on that flag. Consolidate this data so it's
parsed within the same if-scope as the flag is originally parsed in.
Results: derf (vanilla or +hybridtx) +0.2% and (+hybrid16x16
or +tx16x16) +0.7%-0.8%; HD (vanilla or +hybridtx) +0.1-0.2%
and (+hybrid16x16 or +tx16x16) +1.4%, STD/HD (vanilla or +hybridtx)
about even, and (+hybrid16x16 or +tx16x16) +0.8-1.0%.
Paul Wilkins [Fri, 5 Oct 2012 10:16:46 +0000 (11:16 +0100)]
Fix SIMD unsafe use of floating point.
This commit fixes unsafe simd / floating point interactions arising
from the current hybrid and 16x16 transform implementation.
These led to a raft of bugs and issues when the project was
built using VS2008 for Win32 though they did not show up with
the unix builds.
Gerrit makes a meal out of presenting the fix but all I have actually
done is indent the body of each function that uses floating point by
one level and bracket with emms instructions using the function
vp8_clear_system_state(). See below.
function () {
vp8_clear_system_state();
{
... function body
}
vp8_clear_system_state();
}
This is almost certainly over the top in terms of number of emms
instructions but is a temporary measure pending implementation of
integer variants of each function to replace the floating point.
Limited testing suggests that this fixes the problems that arose for
Win32 VS2008 when the hybrid or 16x16 transforms were enabled.
Deb Mukherjee [Mon, 10 Sep 2012 05:42:35 +0000 (22:42 -0700)]
Entropy coding for hybrid transform
Separates the entropy coding context models for 4x4, 8x8 and 16x16
ADST variants.
There is a small improvement for HD (hd/std-hd) by about 0.1-0.2%.
Results on derf/yt are about the same, probably because there is not
enough statistics.
Results may improve somewhat once the initial probability tables are
updated for the hybrid transforms which is coming soon.
Deb Mukherjee [Fri, 21 Sep 2012 21:20:15 +0000 (14:20 -0700)]
Separating 8x8DCT use from hybridtransform8x8
With this change, even if hybridtransform8x8 experiment is off,
8x8 dct is used for the I8x8 mode. However note that the gains
observed with the hybridtransform8x8 experiment will now be less,
since part of the gain is now merged in.
The commit changed to use 3 rows above and 3 cols from left for SAD
scoring for selecting the best reference motion vector. The change
helped std-hd set by >.2% on psnr/ssim metrics.
Deb Mukherjee [Thu, 6 Sep 2012 16:07:42 +0000 (09:07 -0700)]
Adds feature for companded MV encoding
The high-precision (1/8) pel bit is turned off if the reference
MV is larger than a threshold. The motivation for this patch is
the intuition that if motion is likely large (as indicated by
the reference), there is likley to be more motion blur, and as
a result 1/8 pel precision would be wasteful both in rd sense
as well as computationally.
The feature is incorporated as part of the newmventropy experiment.
There is a modest RD improvement with the patch. Overall the
results with the newmventropy experiment with the threshold being
16 integer pels are:
Paul Wilkins [Fri, 7 Sep 2012 13:21:22 +0000 (14:21 +0100)]
Partial merge of NEWBESTREFMV and NEW_MVREF.
This commit merges those parts of the CONFIG_NEW_MVREF
that specifically relate to choosing a better set of candidate
MV references into the NEWBESTREFMV experiment.
CONFIG_NEW_MVREF will then be used for changes relating
to the explicit coding of a cost optimized MV reference in the
bitstream as part of MV coding.
Deb Mukherjee [Thu, 26 Jul 2012 20:42:07 +0000 (13:42 -0700)]
New motion vector entropy coding
Adds a new experiment with redesigned/refactored motion vector entropy
coding. The patch also takes a first step towards separating the
integer and fractional pel components of a MV. However the fractional
pel encoding still depends on the integer pel part and so they are
not fully independent. Further experiments are in progress to see
how much they can be decoupled without affecting performance.
All components including entropy coding/decoding, costing for MV
search, forward updates and backward updates to probability tables,
have been implemented.
Jingning Han [Wed, 29 Aug 2012 18:25:38 +0000 (11:25 -0700)]
hybrid transform of 16x16 dimension
Enable ADST/DCT of dimension 16x16 for I16X16 modes. This change provides
benefits mostly for hd sequences.
Set up the framework for selectable transform dimension.
Also allowing quantization parameter threshold to control the use
of hybrid transform (This is currently disabled by setting threshold
always above the quantization parameter. Adaptive thresholding can
be built upon this, which will further improve the coding performance.)
The coding performance gains (with respect to the codec that has all
other configuration settings turned on) are
Yaowu Xu [Fri, 24 Aug 2012 16:59:49 +0000 (09:59 -0700)]
change to properly account for coef scaling in unit tests
The transform functions in experimental branch absorbed a scaling
factor of 4 to allow quantization steps closer to unit quantizer.
This commit added scaling code in between forward and inverse
transform to properly account for the scaling factor.
Paul Wilkins [Fri, 24 Aug 2012 14:44:01 +0000 (15:44 +0100)]
New Motion Reference Search
Alternative strategy for finding a list of candidate motion
vectors to use as reference values in mv coding and as
nearest and near.
Sort by sad in vp8_find_best_ref_mvs() rather than just
pick the best. Allow 0,0 as a best ref option but not a
nearest or near unless there are no alternatives.
Encode/Decode verified on at least some clips.
Some commented out experimental and stats code still in place.
Gain over existing code averages about 1% on derf (alll metrics)
with improvement on all clips. Other test results pending.
The entropy coding of the mode (nearest/near etc) still
depends upon and requires the old "findnear" code so
this needs looking at and may provide room for further gains.