Add lossless compression mode.
authorHui Su <huisu@google.com>
Thu, 14 Jun 2012 02:03:31 +0000 (19:03 -0700)
committerHui Su <huisu@google.com>
Fri, 29 Jun 2012 00:09:47 +0000 (17:09 -0700)
commite44ee38aef85e48601e54a13939f2a299bb583e0
tree9a4b27e1b2a663fb4c852f4768c6fef91d785018
parent0e734a63e87c9f87a5ed3dc8c2c698f0cdb1dad7
Add lossless compression mode.

This commit adds lossless compression capability to the experimental
branch. The lossless experiment can be enabled using --enable-lossless
in configure. When the experiment is enabled, the encoder will use
lossless compression mode by command line option --lossless, and the
decoder automatically recognizes a losslessly encoded clip and decodes
accordingly.

To achieve the lossless coding, this commit has changed the following:
    1. To encode at lossless mode, encoder forces the use of unit
quantizer, i.e, Q 0, where effective quantization is 1. Encoder also
disables the usage of 8x8 transform and allows only 4x4 transform;
    2. At Q 0, the first order 4x4  DCT/IDCT have been switched over
to a pair of forward and inverse Walsh-Hadamard Transform
(http://goo.gl/EIsfy),  with proper scaling applied to match the range
of the original 4x4 DCT/IDCT pair;
    3. At Q 0, the second order remains to use the previous
walsh-hadamard transform pair. However, to maintain the reversibility
in second order transform at Q 0, scaling down is applied to first
order DC coefficients prior to forward transform, and scaling up is
applied to the second order output prior to quantization. Symmetric
upscaling and downscaling are added around inverse second order
transform;
    4. At lossless mode, encoder also disables a number of minor
features to ensure no loss is introduced, these features includes:
        a. Trellis quantization optimization
        b. Loop filtering
        c. Aggressive zero-binning, rounding and zero-bin boosting
        d. Mode based zero-bin boosting

Lossless coding test was performed on all clips within the derf set,
to verify that the commit has achieved lossless compression for all
clips. The average compression ratio is around 2.57 to 1.
(http://goo.gl/dEShs)

Change-Id: Ia3aba7dd09df40dd590f93b9aba134defbc64e34
16 files changed:
configure
vp8/common/idct.h
vp8/common/idctllm.c
vp8/common/onyx.h
vp8/decoder/decodframe.c
vp8/decoder/dequantize.c
vp8/decoder/dequantize.h
vp8/decoder/idct_blk.c
vp8/encoder/dct.c
vp8/encoder/dct.h
vp8/encoder/onyx_if.c
vp8/encoder/quantize.c
vp8/encoder/ratectrl.c
vp8/vp8_cx_iface.c
vpx/vpx_encoder.h
vpxenc.c