2010-05-18 17:58:33 +02:00
|
|
|
/*
|
2010-09-09 14:16:39 +02:00
|
|
|
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
2010-05-18 17:58:33 +02:00
|
|
|
*
|
2010-06-18 18:39:21 +02:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
2010-06-04 22:19:40 +02:00
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
2010-06-18 18:39:21 +02:00
|
|
|
* in the file PATENTS. All contributing project authors may
|
2010-06-04 22:19:40 +02:00
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2010-05-18 17:58:33 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef DEQUANTIZE_H
|
|
|
|
#define DEQUANTIZE_H
|
2011-02-10 20:41:38 +01:00
|
|
|
#include "vp8/common/blockd.h"
|
2010-05-18 17:58:33 +02:00
|
|
|
|
|
|
|
#define prototype_dequant_block(sym) \
|
2012-07-14 00:21:29 +02:00
|
|
|
void sym(BLOCKD *x)
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2010-05-28 20:28:12 +02:00
|
|
|
#define prototype_dequant_idct_add(sym) \
|
2012-07-14 00:21:29 +02:00
|
|
|
void sym(short *input, short *dq, \
|
|
|
|
unsigned char *pred, unsigned char *output, \
|
|
|
|
int pitch, int stride)
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2010-07-23 19:42:30 +02:00
|
|
|
#define prototype_dequant_dc_idct_add(sym) \
|
2012-07-14 00:21:29 +02:00
|
|
|
void sym(short *input, short *dq, \
|
|
|
|
unsigned char *pred, unsigned char *output, \
|
|
|
|
int pitch, int stride, \
|
|
|
|
int dc)
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2010-08-20 19:58:19 +02:00
|
|
|
#define prototype_dequant_dc_idct_add_y_block(sym) \
|
2012-07-14 00:21:29 +02:00
|
|
|
void sym(short *q, short *dq, \
|
|
|
|
unsigned char *pre, unsigned char *dst, \
|
|
|
|
int stride, char *eobs, short *dc)
|
2010-08-20 19:58:19 +02:00
|
|
|
|
|
|
|
#define prototype_dequant_idct_add_y_block(sym) \
|
2012-07-14 00:21:29 +02:00
|
|
|
void sym(short *q, short *dq, \
|
|
|
|
unsigned char *pre, unsigned char *dst, \
|
|
|
|
int stride, char *eobs)
|
2010-08-20 19:58:19 +02:00
|
|
|
|
|
|
|
#define prototype_dequant_idct_add_uv_block(sym) \
|
2012-07-14 00:21:29 +02:00
|
|
|
void sym(short *q, short *dq, \
|
|
|
|
unsigned char *pre, unsigned char *dst_u, \
|
|
|
|
unsigned char *dst_v, int stride, char *eobs)
|
2010-08-20 19:58:19 +02:00
|
|
|
|
2011-02-14 23:18:18 +01:00
|
|
|
#define prototype_dequant_dc_idct_add_y_block_8x8(sym) \
|
2012-07-14 00:21:29 +02:00
|
|
|
void sym(short *q, short *dq, \
|
|
|
|
unsigned char *pre, unsigned char *dst, \
|
|
|
|
int stride, char *eobs, short *dc, MACROBLOCKD *xd)
|
2011-02-14 23:18:18 +01:00
|
|
|
|
|
|
|
#define prototype_dequant_idct_add_y_block_8x8(sym) \
|
2012-07-14 00:21:29 +02:00
|
|
|
void sym(short *q, short *dq, \
|
|
|
|
unsigned char *pre, unsigned char *dst, \
|
|
|
|
int stride, char *eobs, MACROBLOCKD *xd)
|
2011-02-14 23:18:18 +01:00
|
|
|
|
|
|
|
#define prototype_dequant_idct_add_uv_block_8x8(sym) \
|
2012-07-14 00:21:29 +02:00
|
|
|
void sym(short *q, short *dq, \
|
|
|
|
unsigned char *pre, unsigned char *dst_u, \
|
|
|
|
unsigned char *dst_v, int stride, char *eobs, \
|
|
|
|
MACROBLOCKD *xd)
|
2011-02-14 23:18:18 +01:00
|
|
|
|
2010-05-18 17:58:33 +02:00
|
|
|
#if ARCH_X86 || ARCH_X86_64
|
|
|
|
#include "x86/dequantize_x86.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if ARCH_ARM
|
|
|
|
#include "arm/dequantize_arm.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef vp8_dequant_block
|
|
|
|
#define vp8_dequant_block vp8_dequantize_b_c
|
|
|
|
#endif
|
|
|
|
extern prototype_dequant_block(vp8_dequant_block);
|
|
|
|
|
2010-05-28 20:28:12 +02:00
|
|
|
#ifndef vp8_dequant_idct_add
|
|
|
|
#define vp8_dequant_idct_add vp8_dequant_idct_add_c
|
2010-05-18 17:58:33 +02:00
|
|
|
#endif
|
2010-05-28 20:28:12 +02:00
|
|
|
extern prototype_dequant_idct_add(vp8_dequant_idct_add);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-06-25 21:26:09 +02:00
|
|
|
#if CONFIG_HYBRIDTRANSFORM
|
|
|
|
// declare dequantization and inverse transform module of hybrid transform decoder
|
|
|
|
#ifndef vp8_ht_dequant_idct_add
|
|
|
|
#define vp8_ht_dequant_idct_add vp8_ht_dequant_idct_add_c
|
|
|
|
#endif
|
|
|
|
extern void vp8_ht_dequant_idct_add(TX_TYPE tx_type, short *input, short *dq,
|
|
|
|
unsigned char *pred, unsigned char *dest,
|
|
|
|
int pitch, int stride);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2010-07-23 19:42:30 +02:00
|
|
|
#ifndef vp8_dequant_dc_idct_add
|
|
|
|
#define vp8_dequant_dc_idct_add vp8_dequant_dc_idct_add_c
|
2010-05-18 17:58:33 +02:00
|
|
|
#endif
|
2010-07-23 19:42:30 +02:00
|
|
|
extern prototype_dequant_dc_idct_add(vp8_dequant_dc_idct_add);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2010-08-20 19:58:19 +02:00
|
|
|
#ifndef vp8_dequant_dc_idct_add_y_block
|
|
|
|
#define vp8_dequant_dc_idct_add_y_block vp8_dequant_dc_idct_add_y_block_c
|
|
|
|
#endif
|
|
|
|
extern prototype_dequant_dc_idct_add_y_block(vp8_dequant_dc_idct_add_y_block);
|
|
|
|
|
|
|
|
#ifndef vp8_dequant_idct_add_y_block
|
|
|
|
#define vp8_dequant_idct_add_y_block vp8_dequant_idct_add_y_block_c
|
|
|
|
#endif
|
|
|
|
extern prototype_dequant_idct_add_y_block(vp8_dequant_idct_add_y_block);
|
|
|
|
|
|
|
|
#ifndef vp8_dequant_idct_add_uv_block
|
|
|
|
#define vp8_dequant_idct_add_uv_block vp8_dequant_idct_add_uv_block_c
|
|
|
|
#endif
|
|
|
|
extern prototype_dequant_idct_add_uv_block(vp8_dequant_idct_add_uv_block);
|
|
|
|
|
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
2012-06-14 04:03:31 +02:00
|
|
|
#if CONFIG_LOSSLESS
|
|
|
|
extern prototype_dequant_idct_add(vp8_dequant_idct_add_lossless_c);
|
|
|
|
extern prototype_dequant_dc_idct_add(vp8_dequant_dc_idct_add_lossless_c);
|
|
|
|
extern prototype_dequant_dc_idct_add_y_block(vp8_dequant_dc_idct_add_y_block_lossless_c);
|
|
|
|
extern prototype_dequant_idct_add_y_block(vp8_dequant_idct_add_y_block_lossless_c);
|
|
|
|
extern prototype_dequant_idct_add_uv_block(vp8_dequant_idct_add_uv_block_lossless_c);
|
|
|
|
#endif
|
2012-02-29 02:11:12 +01:00
|
|
|
|
2011-11-10 21:54:22 +01:00
|
|
|
#ifndef vp8_dequant_block_2x2
|
|
|
|
#define vp8_dequant_block_2x2 vp8_dequantize_b_2x2_c
|
2011-02-14 23:18:18 +01:00
|
|
|
#endif
|
2011-11-10 21:54:22 +01:00
|
|
|
extern prototype_dequant_block(vp8_dequant_block_2x2);
|
2011-02-14 23:18:18 +01:00
|
|
|
|
|
|
|
#ifndef vp8_dequant_idct_add_8x8
|
|
|
|
#define vp8_dequant_idct_add_8x8 vp8_dequant_idct_add_8x8_c
|
|
|
|
#endif
|
|
|
|
extern prototype_dequant_idct_add(vp8_dequant_idct_add_8x8);
|
|
|
|
|
|
|
|
#ifndef vp8_dequant_dc_idct_add_8x8
|
|
|
|
#define vp8_dequant_dc_idct_add_8x8 vp8_dequant_dc_idct_add_8x8_c
|
|
|
|
#endif
|
|
|
|
extern prototype_dequant_dc_idct_add(vp8_dequant_dc_idct_add_8x8);
|
|
|
|
|
|
|
|
#ifndef vp8_dequant_dc_idct_add_y_block_8x8
|
|
|
|
#define vp8_dequant_dc_idct_add_y_block_8x8 vp8_dequant_dc_idct_add_y_block_8x8_c
|
|
|
|
#endif
|
|
|
|
extern prototype_dequant_dc_idct_add_y_block_8x8(vp8_dequant_dc_idct_add_y_block_8x8);
|
|
|
|
|
|
|
|
#ifndef vp8_dequant_idct_add_y_block_8x8
|
|
|
|
#define vp8_dequant_idct_add_y_block_8x8 vp8_dequant_idct_add_y_block_8x8_c
|
|
|
|
#endif
|
|
|
|
extern prototype_dequant_idct_add_y_block_8x8(vp8_dequant_idct_add_y_block_8x8);
|
|
|
|
|
|
|
|
#ifndef vp8_dequant_idct_add_uv_block_8x8
|
|
|
|
#define vp8_dequant_idct_add_uv_block_8x8 vp8_dequant_idct_add_uv_block_8x8_c
|
|
|
|
#endif
|
|
|
|
extern prototype_dequant_idct_add_uv_block_8x8(vp8_dequant_idct_add_uv_block_8x8);
|
|
|
|
|
2012-08-03 02:03:14 +02:00
|
|
|
#if CONFIG_TX16X16
|
|
|
|
#ifndef vp8_dequant_idct_add_16x16
|
|
|
|
#define vp8_dequant_idct_add_16x16 vp8_dequant_idct_add_16x16_c
|
|
|
|
#endif
|
|
|
|
extern prototype_dequant_idct_add(vp8_dequant_idct_add_16x16);
|
|
|
|
#endif
|
2012-02-29 02:11:12 +01:00
|
|
|
|
2010-08-20 19:58:19 +02:00
|
|
|
|
2010-05-18 17:58:33 +02:00
|
|
|
typedef prototype_dequant_block((*vp8_dequant_block_fn_t));
|
2010-05-28 20:28:12 +02:00
|
|
|
|
|
|
|
typedef prototype_dequant_idct_add((*vp8_dequant_idct_add_fn_t));
|
2010-08-20 19:58:19 +02:00
|
|
|
|
2010-07-23 19:42:30 +02:00
|
|
|
typedef prototype_dequant_dc_idct_add((*vp8_dequant_dc_idct_add_fn_t));
|
2010-05-28 20:28:12 +02:00
|
|
|
|
2010-08-20 19:58:19 +02:00
|
|
|
typedef prototype_dequant_dc_idct_add_y_block((*vp8_dequant_dc_idct_add_y_block_fn_t));
|
|
|
|
|
|
|
|
typedef prototype_dequant_idct_add_y_block((*vp8_dequant_idct_add_y_block_fn_t));
|
|
|
|
|
|
|
|
typedef prototype_dequant_idct_add_uv_block((*vp8_dequant_idct_add_uv_block_fn_t));
|
|
|
|
|
2011-02-14 23:18:18 +01:00
|
|
|
typedef prototype_dequant_dc_idct_add_y_block_8x8((*vp8_dequant_dc_idct_add_y_block_fn_t_8x8));
|
|
|
|
|
|
|
|
typedef prototype_dequant_idct_add_y_block_8x8((*vp8_dequant_idct_add_y_block_fn_t_8x8));
|
|
|
|
|
|
|
|
typedef prototype_dequant_idct_add_uv_block_8x8((*vp8_dequant_idct_add_uv_block_fn_t_8x8));
|
2012-02-29 02:11:12 +01:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
typedef struct {
|
|
|
|
vp8_dequant_block_fn_t block;
|
|
|
|
vp8_dequant_idct_add_fn_t idct_add;
|
|
|
|
vp8_dequant_dc_idct_add_fn_t dc_idct_add;
|
|
|
|
vp8_dequant_dc_idct_add_y_block_fn_t dc_idct_add_y_block;
|
|
|
|
vp8_dequant_idct_add_y_block_fn_t idct_add_y_block;
|
|
|
|
vp8_dequant_idct_add_uv_block_fn_t idct_add_uv_block;
|
|
|
|
vp8_dequant_block_fn_t block_2x2;
|
|
|
|
vp8_dequant_idct_add_fn_t idct_add_8x8;
|
|
|
|
vp8_dequant_dc_idct_add_fn_t dc_idct_add_8x8;
|
|
|
|
vp8_dequant_dc_idct_add_y_block_fn_t_8x8 dc_idct_add_y_block_8x8;
|
|
|
|
vp8_dequant_idct_add_y_block_fn_t_8x8 idct_add_y_block_8x8;
|
|
|
|
vp8_dequant_idct_add_uv_block_fn_t_8x8 idct_add_uv_block_8x8;
|
2012-08-03 02:03:14 +02:00
|
|
|
#if CONFIG_TX16X16
|
|
|
|
vp8_dequant_idct_add_fn_t idct_add_16x16;
|
|
|
|
#endif
|
2010-05-18 17:58:33 +02:00
|
|
|
} vp8_dequant_rtcd_vtable_t;
|
|
|
|
|
|
|
|
#if CONFIG_RUNTIME_CPU_DETECT
|
|
|
|
#define DEQUANT_INVOKE(ctx,fn) (ctx)->fn
|
|
|
|
#else
|
|
|
|
#define DEQUANT_INVOKE(ctx,fn) vp8_dequant_##fn
|
|
|
|
#endif
|
|
|
|
|
2012-08-18 00:37:51 +02:00
|
|
|
#if CONFIG_HYBRIDTRANSFORM8X8
|
|
|
|
void vp8_ht_dequant_idct_add_8x8_c(TX_TYPE tx_type, short *input, short *dq,
|
|
|
|
unsigned char *pred, unsigned char *dest,
|
|
|
|
int pitch, int stride);
|
|
|
|
#endif
|
|
|
|
|
2012-08-21 02:45:36 +02:00
|
|
|
#if CONFIG_SUPERBLOCKS
|
|
|
|
void vp8_dequant_dc_idct_add_y_block_8x8_inplace_c(short *q, short *dq,
|
|
|
|
unsigned char *dst,
|
|
|
|
int stride, char *eobs,
|
|
|
|
short *dc, MACROBLOCKD *xd);
|
|
|
|
void vp8_dequant_idct_add_uv_block_8x8_inplace_c(short *q, short *dq,
|
|
|
|
unsigned char *dstu,
|
|
|
|
unsigned char *dstv,
|
|
|
|
int stride, char *eobs,
|
|
|
|
MACROBLOCKD *xd);
|
|
|
|
#endif
|
2012-08-18 00:37:51 +02:00
|
|
|
|
2010-05-18 17:58:33 +02:00
|
|
|
#endif
|