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
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "vpx_ports/config.h"
|
|
|
|
#include "dequantize.h"
|
2011-02-10 20:41:38 +01:00
|
|
|
#include "vp8/common/idct.h"
|
2010-05-18 17:58:33 +02:00
|
|
|
#include "vpx_mem/vpx_mem.h"
|
2011-02-14 23:18:18 +01:00
|
|
|
#include "onyxd_int.h"
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
extern void vp8_short_idct4x4llm_c(short *input, short *output, int pitch);
|
2010-05-18 17:58:33 +02:00
|
|
|
extern void vp8_short_idct4x4llm_1_c(short *input, short *output, int pitch);
|
2011-02-14 23:18:18 +01:00
|
|
|
extern void vp8_short_idct8x8_c(short *input, short *output, int pitch);
|
|
|
|
extern void vp8_short_idct8x8_1_c(short *input, short *output, int pitch);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
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 void vp8_short_inv_walsh4x4_x8_c(short *input, short *output, int pitch);
|
|
|
|
extern void vp8_short_inv_walsh4x4_1_x8_c(short *input, short *output, int pitch);
|
|
|
|
#endif
|
|
|
|
|
2011-02-14 23:18:18 +01:00
|
|
|
#ifdef DEC_DEBUG
|
|
|
|
extern int dec_debug;
|
|
|
|
#endif
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
void vp8_dequantize_b_c(BLOCKD *d) {
|
2011-02-14 23:18:18 +01:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
int i;
|
|
|
|
short *DQ = d->dqcoeff;
|
|
|
|
short *Q = d->qcoeff;
|
|
|
|
short *DQC = d->dequant;
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
DQ[i] = Q[i] * DQC[i];
|
|
|
|
}
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-23 19:42:30 +02:00
|
|
|
void vp8_dequant_idct_add_c(short *input, short *dq, unsigned char *pred,
|
2012-07-14 00:21:29 +02:00
|
|
|
unsigned char *dest, int pitch, int stride) {
|
|
|
|
short output[16];
|
|
|
|
short *diff_ptr = output;
|
|
|
|
int r, c;
|
|
|
|
int i;
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
input[i] = dq[i] * input[i];
|
|
|
|
}
|
2011-07-20 23:21:24 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
/* the idct halves ( >> 1) the pitch */
|
|
|
|
vp8_short_idct4x4llm_c(input, output, 4 << 1);
|
2010-05-28 20:28:12 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
vpx_memset(input, 0, 32);
|
2010-05-28 20:28:12 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (r = 0; r < 4; r++) {
|
|
|
|
for (c = 0; c < 4; c++) {
|
|
|
|
int a = diff_ptr[c] + pred[c];
|
2010-05-28 20:28:12 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
2010-05-28 20:28:12 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
2010-05-28 20:28:12 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
dest[c] = (unsigned char) a;
|
2010-05-28 20:28:12 +02:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
|
|
|
|
dest += stride;
|
|
|
|
diff_ptr += 4;
|
|
|
|
pred += pitch;
|
|
|
|
}
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
|
|
|
|
2010-07-23 19:42:30 +02:00
|
|
|
void vp8_dequant_dc_idct_add_c(short *input, short *dq, unsigned char *pred,
|
|
|
|
unsigned char *dest, int pitch, int stride,
|
2012-07-14 00:21:29 +02:00
|
|
|
int Dc) {
|
|
|
|
int i;
|
|
|
|
short output[16];
|
|
|
|
short *diff_ptr = output;
|
|
|
|
int r, c;
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
input[0] = (short)Dc;
|
2011-07-20 23:21:24 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (i = 1; i < 16; i++) {
|
|
|
|
input[i] = dq[i] * input[i];
|
|
|
|
}
|
2011-07-20 23:21:24 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
/* the idct halves ( >> 1) the pitch */
|
|
|
|
vp8_short_idct4x4llm_c(input, output, 4 << 1);
|
2010-05-28 20:28:12 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
vpx_memset(input, 0, 32);
|
2010-05-28 20:28:12 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (r = 0; r < 4; r++) {
|
|
|
|
for (c = 0; c < 4; c++) {
|
|
|
|
int a = diff_ptr[c] + pred[c];
|
2010-05-28 20:28:12 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
2010-05-28 20:28:12 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
|
|
|
|
|
|
|
dest[c] = (unsigned char) a;
|
2010-05-28 20:28:12 +02:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
|
|
|
|
dest += stride;
|
|
|
|
diff_ptr += 4;
|
|
|
|
pred += pitch;
|
|
|
|
}
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
|
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
|
|
|
|
void vp8_dequant_idct_add_lossless_c(short *input, short *dq, unsigned char *pred,
|
2012-07-14 00:21:29 +02:00
|
|
|
unsigned char *dest, int pitch, int stride) {
|
|
|
|
short output[16];
|
|
|
|
short *diff_ptr = output;
|
|
|
|
int r, c;
|
|
|
|
int i;
|
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
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
input[i] = dq[i] * input[i];
|
|
|
|
}
|
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
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
vp8_short_inv_walsh4x4_x8_c(input, output, 4 << 1);
|
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
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
vpx_memset(input, 0, 32);
|
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
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (r = 0; r < 4; r++) {
|
|
|
|
for (c = 0; c < 4; c++) {
|
|
|
|
int a = diff_ptr[c] + pred[c];
|
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
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
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
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
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
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
dest[c] = (unsigned char) a;
|
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
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
|
|
|
|
dest += stride;
|
|
|
|
diff_ptr += 4;
|
|
|
|
pred += pitch;
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
|
|
void vp8_dequant_dc_idct_add_lossless_c(short *input, short *dq, unsigned char *pred,
|
2012-07-14 00:21:29 +02:00
|
|
|
unsigned char *dest, int pitch, int stride,
|
|
|
|
int Dc) {
|
|
|
|
int i;
|
|
|
|
short output[16];
|
|
|
|
short *diff_ptr = output;
|
|
|
|
int r, c;
|
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
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
input[0] = (short)Dc;
|
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
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (i = 1; i < 16; i++) {
|
|
|
|
input[i] = dq[i] * input[i];
|
|
|
|
}
|
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
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
vp8_short_inv_walsh4x4_x8_c(input, output, 4 << 1);
|
|
|
|
vpx_memset(input, 0, 32);
|
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
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (r = 0; r < 4; r++) {
|
|
|
|
for (c = 0; c < 4; c++) {
|
|
|
|
int a = diff_ptr[c] + pred[c];
|
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
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
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
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
|
|
|
|
|
|
|
dest[c] = (unsigned char) a;
|
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
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
|
|
|
|
dest += stride;
|
|
|
|
diff_ptr += 4;
|
|
|
|
pred += pitch;
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
void vp8_dequantize_b_2x2_c(BLOCKD *d) {
|
|
|
|
int i;
|
|
|
|
short *DQ = d->dqcoeff;
|
|
|
|
short *Q = d->qcoeff;
|
|
|
|
short *DQC = d->dequant;
|
2011-02-14 23:18:18 +01:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
DQ[i] = (short)((Q[i] * DQC[i]));
|
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
#ifdef DEC_DEBUG
|
2012-07-14 00:21:29 +02:00
|
|
|
if (dec_debug) {
|
|
|
|
int j;
|
|
|
|
printf("Dequantize 2x2\n");
|
|
|
|
for (j = 0; j < 16; j++) printf("%d ", Q[j]);
|
|
|
|
printf("\n");
|
|
|
|
for (j = 0; j < 16; j++) printf("%d ", DQ[j]);
|
|
|
|
printf("\n");
|
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void vp8_dequant_idct_add_8x8_c(short *input, short *dq, unsigned char *pred,
|
2012-07-14 00:21:29 +02:00
|
|
|
unsigned char *dest, int pitch, int stride) { // , MACROBLOCKD *xd, short blk_idx
|
|
|
|
short output[64];
|
|
|
|
short *diff_ptr = output;
|
|
|
|
int r, c, b;
|
|
|
|
int i;
|
|
|
|
unsigned char *origdest = dest;
|
|
|
|
unsigned char *origpred = pred;
|
2011-02-14 23:18:18 +01:00
|
|
|
|
|
|
|
#ifdef DEC_DEBUG
|
2012-07-14 00:21:29 +02:00
|
|
|
if (dec_debug) {
|
|
|
|
int j;
|
|
|
|
printf("Input 8x8\n");
|
|
|
|
for (j = 0; j < 64; j++) {
|
|
|
|
printf("%d ", input[j]);
|
|
|
|
if (j % 8 == 7) printf("\n");
|
2011-02-14 23:18:18 +01:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
#endif
|
2011-11-10 21:54:22 +01:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
input[0] = input[0] * dq[0];
|
2011-11-10 21:54:22 +01:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
// recover quantizer for 4 4x4 blocks
|
|
|
|
for (i = 1; i < 64; i++) {
|
|
|
|
input[i] = input[i] * dq[1];
|
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
#ifdef DEC_DEBUG
|
2012-07-14 00:21:29 +02:00
|
|
|
if (dec_debug) {
|
|
|
|
int j;
|
|
|
|
printf("Input DQ 8x8\n");
|
|
|
|
for (j = 0; j < 64; j++) {
|
|
|
|
printf("%d ", input[j]);
|
|
|
|
if (j % 8 == 7) printf("\n");
|
2011-02-14 23:18:18 +01:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
#endif
|
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
// the idct halves ( >> 1) the pitch
|
|
|
|
vp8_short_idct8x8_c(input, output, 16);
|
2011-02-14 23:18:18 +01:00
|
|
|
#ifdef DEC_DEBUG
|
2012-07-14 00:21:29 +02:00
|
|
|
if (dec_debug) {
|
|
|
|
int j;
|
|
|
|
printf("Output 8x8\n");
|
|
|
|
for (j = 0; j < 64; j++) {
|
|
|
|
printf("%d ", output[j]);
|
|
|
|
if (j % 8 == 7) printf("\n");
|
2011-02-14 23:18:18 +01:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
#endif
|
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
vpx_memset(input, 0, 128);// test what should i put here
|
2011-02-14 23:18:18 +01:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (b = 0; b < 4; b++) {
|
|
|
|
for (r = 0; r < 4; r++) {
|
|
|
|
for (c = 0; c < 4; c++) {
|
|
|
|
int a = diff_ptr[c] + pred[c];
|
2011-02-14 23:18:18 +01:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
2011-02-14 23:18:18 +01:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
2011-02-14 23:18:18 +01:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
dest[c] = (unsigned char) a;
|
2011-02-14 23:18:18 +01:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
|
|
|
|
dest += stride;
|
|
|
|
diff_ptr += 8;
|
|
|
|
pred += pitch;
|
|
|
|
}
|
|
|
|
diff_ptr = output + (b + 1) / 2 * 4 * 8 + (b + 1) % 2 * 4;
|
|
|
|
dest = origdest + (b + 1) / 2 * 4 * stride + (b + 1) % 2 * 4;
|
|
|
|
pred = origpred + (b + 1) / 2 * 4 * pitch + (b + 1) % 2 * 4;
|
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
#ifdef DEC_DEBUG
|
2012-07-14 00:21:29 +02:00
|
|
|
if (dec_debug) {
|
|
|
|
int k, j;
|
|
|
|
printf("Final 8x8\n");
|
|
|
|
for (j = 0; j < 8; j++) {
|
|
|
|
for (k = 0; k < 8; k++) {
|
|
|
|
printf("%d ", origdest[k]);
|
2011-02-14 23:18:18 +01:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
printf("\n");
|
|
|
|
origdest += stride;
|
2011-02-14 23:18:18 +01:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void vp8_dequant_dc_idct_add_8x8_c(short *input, short *dq, unsigned char *pred,
|
2012-07-14 00:21:29 +02:00
|
|
|
unsigned char *dest, int pitch, int stride,
|
|
|
|
int Dc) { // Dc for 1st order T in some rear case
|
|
|
|
short output[64];
|
|
|
|
short *diff_ptr = output;
|
|
|
|
int r, c, b;
|
|
|
|
int i;
|
|
|
|
unsigned char *origdest = dest;
|
|
|
|
unsigned char *origpred = pred;
|
|
|
|
|
|
|
|
input[0] = (short)Dc;// Dc is the reconstructed value, do not need dequantization
|
|
|
|
// dc value is recovered after dequantization, since dc need not quantization
|
2011-02-14 23:18:18 +01:00
|
|
|
#ifdef DEC_DEBUG
|
2012-07-14 00:21:29 +02:00
|
|
|
if (dec_debug) {
|
|
|
|
int j;
|
|
|
|
printf("Input 8x8\n");
|
|
|
|
for (j = 0; j < 64; j++) {
|
|
|
|
printf("%d ", input[j]);
|
|
|
|
if (j % 8 == 7) printf("\n");
|
2011-02-14 23:18:18 +01:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
#endif
|
2012-07-14 00:21:29 +02:00
|
|
|
for (i = 1; i < 64; i++) {
|
|
|
|
input[i] = input[i] * dq[1];
|
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
|
|
|
|
#ifdef DEC_DEBUG
|
2012-07-14 00:21:29 +02:00
|
|
|
if (dec_debug) {
|
|
|
|
int j;
|
|
|
|
printf("Input DQ 8x8\n");
|
|
|
|
for (j = 0; j < 64; j++) {
|
|
|
|
printf("%d ", input[j]);
|
|
|
|
if (j % 8 == 7) printf("\n");
|
2011-02-14 23:18:18 +01:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
#endif
|
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
// the idct halves ( >> 1) the pitch
|
|
|
|
vp8_short_idct8x8_c(input, output, 16);
|
2011-02-14 23:18:18 +01:00
|
|
|
#ifdef DEC_DEBUG
|
2012-07-14 00:21:29 +02:00
|
|
|
if (dec_debug) {
|
|
|
|
int j;
|
|
|
|
printf("Output 8x8\n");
|
|
|
|
for (j = 0; j < 64; j++) {
|
|
|
|
printf("%d ", output[j]);
|
|
|
|
if (j % 8 == 7) printf("\n");
|
2011-02-14 23:18:18 +01:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
#endif
|
2012-07-14 00:21:29 +02:00
|
|
|
vpx_memset(input, 0, 128);
|
2011-02-14 23:18:18 +01:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (b = 0; b < 4; b++) {
|
|
|
|
for (r = 0; r < 4; r++) {
|
|
|
|
for (c = 0; c < 4; c++) {
|
|
|
|
int a = diff_ptr[c] + pred[c];
|
2011-02-14 23:18:18 +01:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
2011-02-14 23:18:18 +01:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
2011-02-14 23:18:18 +01:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
dest[c] = (unsigned char) a;
|
2011-02-14 23:18:18 +01:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
|
|
|
|
dest += stride;
|
|
|
|
diff_ptr += 8;
|
|
|
|
pred += pitch;
|
|
|
|
}
|
|
|
|
diff_ptr = output + (b + 1) / 2 * 4 * 8 + (b + 1) % 2 * 4;
|
|
|
|
dest = origdest + (b + 1) / 2 * 4 * stride + (b + 1) % 2 * 4;
|
|
|
|
pred = origpred + (b + 1) / 2 * 4 * pitch + (b + 1) % 2 * 4;
|
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
#ifdef DEC_DEBUG
|
2012-07-14 00:21:29 +02:00
|
|
|
if (dec_debug) {
|
|
|
|
int k, j;
|
|
|
|
printf("Final 8x8\n");
|
|
|
|
for (j = 0; j < 8; j++) {
|
|
|
|
for (k = 0; k < 8; k++) {
|
|
|
|
printf("%d ", origdest[k]);
|
2011-02-14 23:18:18 +01:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
printf("\n");
|
|
|
|
origdest += stride;
|
2011-02-14 23:18:18 +01:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
2011-02-14 23:18:18 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|