Commit Graph

127 Commits

Author SHA1 Message Date
Deb Mukherjee
eb6ef2417f 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.

TODO:
Training the default probs/counts for nzcs

Change-Id: I951bc1e22f47885077a7453a09b0493daa77883d
2013-03-07 07:20:30 -08:00
Ronald S. Bultje
4209bba462 Merge changes Ifacbf5a0,Ibad7c3dd into experimental
* changes:
  vpxenc: actually report mismatch on stderr.
  Make superblocks independent of macroblock code and data.
2013-03-05 11:17:14 -08:00
Ronald S. Bultje
111ca42133 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.

Change-Id: Ibad7c3ddfe1acfc52771dfc27c03e9783e054430
2013-03-04 16:34:36 -08:00
Dmitry Kovalev
49b697d327 Merge "Code cleanup." into experimental 2013-03-04 15:41:15 -08:00
Dmitry Kovalev
135428e954 Code cleanup.
Removing redundant 'extern' keyword, lowercase variable names.

Change-Id: I608e8d8579aba8981f5fac3493f77b4481b13808
2013-03-01 17:39:31 -08:00
John Koleszar
69c67c9531 Merge master branch into experimental
Picks up some build system changes, compiler warning fixes, etc.

Change-Id: I2712f99e653502818a101a72696ad54018152d4e
2013-03-01 11:06:05 -08:00
Ronald S. Bultje
90932399b4 Merge "Move eob from BLOCKD to MACROBLOCKD." into experimental 2013-02-27 11:39:16 -08:00
Ronald S. Bultje
e8c74e2b70 Move eob from BLOCKD to MACROBLOCKD.
Consistent with VP8.

Change-Id: I8c316ee49f072e15abbb033a80e9c36617891f07
2013-02-27 11:00:55 -08:00
John Koleszar
800ad0b886 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.

Change-Id: Id3728f6d77cffcd27c248903bf51f9c3e594287e
2013-02-27 08:22:40 -08:00
John Koleszar
77f88e97fa 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.

Change-Id: Id4dc3e5e6692de98d9857fd56bfad3ac57e944ac
2013-02-27 08:22:39 -08:00
John Koleszar
eb939f45b8 Spatial resamping of ZEROMV predictors
This patch allows coding frames using references of different
resolution, in ZEROMV mode. For compound prediction, either
reference may be scaled.

To test, I use the resize_test and enable WRITE_RECON_BUFFER
in vp9_onyxd_if.c. It's also useful to apply this patch to
test/i420_video_source.h:

  --- a/test/i420_video_source.h
  +++ b/test/i420_video_source.h
  @@ -93,6 +93,7 @@ class I420VideoSource : public VideoSource {

     virtual void FillFrame() {
       // Read a frame from input_file.
  +    if (frame_ != 3)
       if (fread(img_->img_data, raw_sz_, 1, input_file_) == 0) {
         limit_ = frame_;
       }

This forces the frame that the resolution changes on to be coded
with no motion, only scaling, and improves the quality of the
result.

Change-Id: I1ee75d19a437ff801192f767fd02a36bcbd1d496
2013-02-26 23:54:23 -08:00
Ronald S. Bultje
96d260515a Merge "Merge cnvcontext experiment." into experimental 2013-02-26 19:39:39 -08:00
Ronald S. Bultje
db54e6774f Merge "Minor cosmetics in rdopt." into experimental 2013-02-26 19:39:28 -08:00
John Koleszar
25686fc22d Merge "Refactor inter recon functions to support scaling" into experimental 2013-02-26 11:45:28 -08:00
Dmitry Kovalev
998bed1d2c Merge "Changing pitch value meaning for fht and iht transforms." into experimental 2013-02-26 10:44:15 -08:00
Ronald S. Bultje
b1641150b1 Merge cnvcontext experiment.
Change-Id: I35e64998b25694a3bb4a62164bba3c03c1db4bc7
2013-02-26 10:40:15 -08:00
Ronald S. Bultje
71539eae2a Minor cosmetics in rdopt.
Change-Id: I62497dcf2074b4bb4787bf660e727e5cf1bf3472
2013-02-26 10:40:11 -08:00
Ronald S. Bultje
c4ae97911a Merge "make cost_coeffs to use combined context" into experimental 2013-02-26 10:32:01 -08:00
John Koleszar
6a4f708c25 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.

Change-Id: Ia053e823a8bc616a988a0af30452e1e75a739cba
2013-02-26 10:03:29 -08:00
Dmitry Kovalev
9bf3f75168 Changing pitch value meaning for fht and iht transforms.
Pitch now means the number of elements, not the number of bytes.

Change-Id: Idb9f2f012e39b09d596a3cc1802305a80b7c13af
2013-02-25 18:19:55 -08:00
Yaowu Xu
ecb03e9a3f make cost_coeffs to use combined context
Change-Id: Ia15f4244595fab49bffda0c651a750a8a9481d28
2013-02-25 17:01:33 -08:00
Jingning Han
77a3becf92 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.

Change-Id: Icab2dbd18538987e1dc4e88c45abfc4cfc6e133f
2013-02-25 09:16:12 -08:00
Ronald S. Bultje
0c9e2e9a1d Split coefficient token tables intra vs. inter.
Change-Id: I5416455f8f129ca0f450d00e48358d2012605072
2013-02-23 07:33:46 -08:00
Paul Wilkins
c17672a33d 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.

Change-Id: If9736e95c391e711b04aef6393d26f60f36e1f8a
2013-02-23 07:29:09 -08:00
Jingning Han
c67a20994f Merge "Forward butterfly hybrid transform" into experimental 2013-02-22 09:20:26 -08:00
Paul Wilkins
b5f3cb6e37 Merge "Experimental removal of over quant code" into experimental 2013-02-22 08:44:40 -08:00
Paul Wilkins
dbf4942046 Experimental removal of over quant code
The over quant code was added in VP8 post
bitstream freeze to allow compression to lower
data rates

In VP9 the real qualtizer range has been greatly
extended anyway.

Change-Id: I5d384fa5e9a83ef75a3df34ee30627bd21901526
2013-02-22 14:00:51 +00:00
Jingning Han
babbd5d170 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).

Change-Id: I8f1ab3843ce32eb287ab766f92e0611e1c5cb4c1
2013-02-21 18:24:28 -08:00
Deb Mukherjee
048f593703 Merge "Refactoring of switchable filter search for speed" into experimental 2013-02-21 09:23:50 -08:00
Deb Mukherjee
28b1db9278 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:

derf: -0.019%
yt: +0.010%
std-hd: -0.162%
hd: -0.050%

Change-Id: Ie861badf5bba1e3b1052e29a0ef1b7e256edbcd0
2013-02-20 18:34:42 -08:00
Ronald S. Bultje
aa84c16da2 Minor cosmetic cleanups.
Change-Id: I13d8ae754827368755575dd699a087b3b11f5b16
2013-02-15 17:21:16 -08:00
Ronald S. Bultje
ebfdaa0e0b 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).

Change-Id: If236fd3aa2037e5b398d03f3b1978fbbc5ce740e
2013-02-15 17:21:16 -08:00
Ronald S. Bultje
5bb103c486 Merge "Remove Y2 and Y-no-DC token types from the bitstream." into experimental 2013-02-15 17:11:20 -08:00
Jingning Han
e343732a92 Fixed a subtle issue that breaks encoding process
This issue breaks the encoding process of the codebase. The effect
emerges only in particular test sequence at certain bit-rates and
frame limits.

Change-Id: I02e080f2a49624eef9a21c424053dc2a1d902452
2013-02-15 14:49:30 -08:00
Ronald S. Bultje
3af36ea8cc Remove Y2 and Y-no-DC token types from the bitstream.
Change-Id: I7a5314daca993d46b8666ba1ec2ff3766c1e5042
2013-02-15 14:06:30 -08:00
Ronald S. Bultje
46dff5d233 Remove some Y2-related code.
Change-Id: I4f46d142c2a8d1e8a880cfac63702dcbfb999b78
2013-02-15 14:06:25 -08:00
Scott LaVarnway
ae886d6bff Moved vp9_get_coef_band to header file
allowing the compiler to inline.

Change-Id: I66e5caf5e7fefa68a223ff0603aa3f9e11e35dbb
2013-02-14 12:27:25 -08:00
Paul Wilkins
9255ad107f 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.

Change-Id: Id7009c2f4f9bb1d02b861af85fd8223d4285bde5
2013-02-13 19:01:25 +00:00
Paul Wilkins
0d284ffed1 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.

Change-Id: I117fff0b49c61da83aed641e36620442f86def86
2013-02-13 18:56:30 +00:00
Paul Wilkins
afa57bfc97 Merge "Remove NEWCOEFCONTEXT experiment." into experimental 2013-02-13 10:41:13 -08:00
Yaowu Xu
f01b08c96c Merge "enable bitstream lossless support" into experimental 2013-02-13 10:26:58 -08:00
Yaowu Xu
d3de97794f Merge "fix the lossless experiment" into experimental 2013-02-13 09:54:35 -08:00
Yaowu Xu
17db5d00be 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.

Change-Id: Ifae53b26d2ffbe378d707e29d96817b8a5e6c068
2013-02-13 09:24:39 -08:00
Yaowu Xu
16f25f9dc8 fix the lossless experiment
Change-Id: I95acfc1417634b52d344586ab97f0abaa9a4b256
2013-02-13 09:20:26 -08:00
Paul Wilkins
6a9f0c61a4 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.

Change-Id: Icd17b421384c354df6117cc714747647c5eb7e98
2013-02-13 15:12:17 +00:00
Paul Wilkins
649be94cf0 Removal of Hybrid DWT/DCT experiment.
Removal of experiment to simplify code base for other
changes.

Change-Id: If0a33952504558511926ad212bc311fc2bffb19a
2013-02-13 15:08:48 +00:00
John Koleszar
1d60b6bcb5 Merge "Replace as_mv struct with array" into experimental 2013-02-12 13:59:04 -08:00
Jingning Han
57e995ff9c 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.

Change-Id: Ie5d9749942468df299ab74e90d92cd899569e960
2013-02-11 10:42:39 -08:00
John Koleszar
7ca517f755 Replace as_mv struct with array
Replace as_mv.{first, second} with a two element array, so that they
can easily be processed with an index variable.

Change-Id: I1e429155544d2a94a5b72a5b467c53d8b8728190
2013-02-08 20:23:35 -08:00
John Koleszar
dc836109e4 Merge "Pass macroblock index to pick inter functions" into experimental 2013-02-08 20:20:37 -08:00