32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2012 The WebM project authors. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2015-07-28 01:05:15 +02:00
|
|
|
#include "third_party/googletest/src/include/gtest/gtest.h"
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
|
|
|
|
#include "./vp9_rtcd.h"
|
2015-07-28 01:05:15 +02:00
|
|
|
#include "./vpx_config.h"
|
|
|
|
#include "./vpx_dsp_rtcd.h"
|
2015-07-29 23:51:36 +02:00
|
|
|
#include "test/acm_random.h"
|
|
|
|
#include "test/clear_system_state.h"
|
|
|
|
#include "test/register_state_check.h"
|
|
|
|
#include "test/util.h"
|
2014-01-18 22:03:31 +01:00
|
|
|
#include "vp9/common/vp9_entropy.h"
|
2014-09-03 01:34:09 +02:00
|
|
|
#include "vpx/vpx_codec.h"
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
#include "vpx/vpx_integer.h"
|
2015-05-12 04:09:22 +02:00
|
|
|
#include "vpx_ports/mem.h"
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
|
|
|
|
using libvpx_test::ACMRandom;
|
|
|
|
|
|
|
|
namespace {
|
2012-12-13 23:51:27 +01:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
static int round(double x) {
|
|
|
|
if (x < 0)
|
2013-09-05 17:45:56 +02:00
|
|
|
return static_cast<int>(ceil(x - 0.5));
|
2012-12-13 23:51:27 +01:00
|
|
|
else
|
2013-09-05 17:45:56 +02:00
|
|
|
return static_cast<int>(floor(x + 0.5));
|
2012-12-13 23:51:27 +01:00
|
|
|
}
|
|
|
|
#endif
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
|
2013-09-03 20:57:34 +02:00
|
|
|
const int kNumCoeffs = 1024;
|
|
|
|
const double kPi = 3.141592653589793238462643383279502884;
|
2014-08-22 21:29:37 +02:00
|
|
|
void reference_32x32_dct_1d(const double in[32], double out[32]) {
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
const double kInvSqrt2 = 0.707106781186547524400844362104;
|
|
|
|
for (int k = 0; k < 32; k++) {
|
|
|
|
out[k] = 0.0;
|
|
|
|
for (int n = 0; n < 32; n++)
|
|
|
|
out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 64.0);
|
|
|
|
if (k == 0)
|
|
|
|
out[k] = out[k] * kInvSqrt2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-03 20:57:34 +02:00
|
|
|
void reference_32x32_dct_2d(const int16_t input[kNumCoeffs],
|
|
|
|
double output[kNumCoeffs]) {
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
// First transform columns
|
|
|
|
for (int i = 0; i < 32; ++i) {
|
|
|
|
double temp_in[32], temp_out[32];
|
|
|
|
for (int j = 0; j < 32; ++j)
|
|
|
|
temp_in[j] = input[j*32 + i];
|
2014-08-22 21:29:37 +02:00
|
|
|
reference_32x32_dct_1d(temp_in, temp_out);
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
for (int j = 0; j < 32; ++j)
|
|
|
|
output[j * 32 + i] = temp_out[j];
|
|
|
|
}
|
|
|
|
// Then transform rows
|
|
|
|
for (int i = 0; i < 32; ++i) {
|
|
|
|
double temp_in[32], temp_out[32];
|
|
|
|
for (int j = 0; j < 32; ++j)
|
|
|
|
temp_in[j] = output[j + i*32];
|
2014-08-22 21:29:37 +02:00
|
|
|
reference_32x32_dct_1d(temp_in, temp_out);
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
// Scale by some magic number
|
|
|
|
for (int j = 0; j < 32; ++j)
|
|
|
|
output[j + i * 32] = temp_out[j] / 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-03 01:34:09 +02:00
|
|
|
typedef void (*FwdTxfmFunc)(const int16_t *in, tran_low_t *out, int stride);
|
|
|
|
typedef void (*InvTxfmFunc)(const tran_low_t *in, uint8_t *out, int stride);
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
|
2014-09-03 01:34:09 +02:00
|
|
|
typedef std::tr1::tuple<FwdTxfmFunc, InvTxfmFunc, int, vpx_bit_depth_t>
|
|
|
|
Trans32x32Param;
|
|
|
|
|
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
2014-10-24 09:48:02 +02:00
|
|
|
void idct32x32_8(const tran_low_t *in, uint8_t *out, int stride) {
|
2015-08-03 23:51:10 +02:00
|
|
|
vpx_highbd_idct32x32_1024_add_c(in, out, stride, 8);
|
2014-10-24 09:48:02 +02:00
|
|
|
}
|
|
|
|
|
2014-09-03 01:34:09 +02:00
|
|
|
void idct32x32_10(const tran_low_t *in, uint8_t *out, int stride) {
|
2015-08-03 23:51:10 +02:00
|
|
|
vpx_highbd_idct32x32_1024_add_c(in, out, stride, 10);
|
2014-09-03 01:34:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void idct32x32_12(const tran_low_t *in, uint8_t *out, int stride) {
|
2015-08-03 23:51:10 +02:00
|
|
|
vpx_highbd_idct32x32_1024_add_c(in, out, stride, 12);
|
2014-09-03 01:34:09 +02:00
|
|
|
}
|
2014-10-24 09:48:02 +02:00
|
|
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
2013-11-19 02:07:55 +01:00
|
|
|
|
2014-07-17 03:54:31 +02:00
|
|
|
class Trans32x32Test : public ::testing::TestWithParam<Trans32x32Param> {
|
2013-09-03 20:57:34 +02:00
|
|
|
public:
|
|
|
|
virtual ~Trans32x32Test() {}
|
|
|
|
virtual void SetUp() {
|
|
|
|
fwd_txfm_ = GET_PARAM(0);
|
|
|
|
inv_txfm_ = GET_PARAM(1);
|
|
|
|
version_ = GET_PARAM(2); // 0: high precision forward transform
|
|
|
|
// 1: low precision version for rd loop
|
2014-09-03 01:34:09 +02:00
|
|
|
bit_depth_ = GET_PARAM(3);
|
|
|
|
mask_ = (1 << bit_depth_) - 1;
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
}
|
2013-02-11 13:35:28 +01:00
|
|
|
|
2013-09-03 20:57:34 +02:00
|
|
|
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int version_;
|
2014-09-03 01:34:09 +02:00
|
|
|
vpx_bit_depth_t bit_depth_;
|
|
|
|
int mask_;
|
2014-07-17 03:54:31 +02:00
|
|
|
FwdTxfmFunc fwd_txfm_;
|
|
|
|
InvTxfmFunc inv_txfm_;
|
2013-09-03 20:57:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
TEST_P(Trans32x32Test, AccuracyCheck) {
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
2013-09-03 20:57:34 +02:00
|
|
|
uint32_t max_error = 0;
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
int64_t total_error = 0;
|
2014-10-24 09:48:02 +02:00
|
|
|
const int count_test_block = 10000;
|
2015-05-02 22:24:16 +02:00
|
|
|
DECLARE_ALIGNED(16, int16_t, test_input_block[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, tran_low_t, test_temp_block[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, uint8_t, src[kNumCoeffs]);
|
2014-09-03 01:34:09 +02:00
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
2015-05-02 22:24:16 +02:00
|
|
|
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, uint16_t, src16[kNumCoeffs]);
|
2014-09-03 01:34:09 +02:00
|
|
|
#endif
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
|
2013-09-03 20:57:34 +02:00
|
|
|
for (int i = 0; i < count_test_block; ++i) {
|
2014-09-03 01:34:09 +02:00
|
|
|
// Initialize a test block with input range [-mask_, mask_].
|
2013-09-03 20:57:34 +02:00
|
|
|
for (int j = 0; j < kNumCoeffs; ++j) {
|
2014-10-24 09:48:02 +02:00
|
|
|
if (bit_depth_ == VPX_BITS_8) {
|
2014-09-03 01:34:09 +02:00
|
|
|
src[j] = rnd.Rand8();
|
|
|
|
dst[j] = rnd.Rand8();
|
|
|
|
test_input_block[j] = src[j] - dst[j];
|
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
|
|
|
} else {
|
|
|
|
src16[j] = rnd.Rand16() & mask_;
|
|
|
|
dst16[j] = rnd.Rand16() & mask_;
|
|
|
|
test_input_block[j] = src16[j] - dst16[j];
|
|
|
|
#endif
|
|
|
|
}
|
2013-09-03 20:57:34 +02:00
|
|
|
}
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
|
2014-07-10 06:02:02 +02:00
|
|
|
ASM_REGISTER_STATE_CHECK(fwd_txfm_(test_input_block, test_temp_block, 32));
|
2014-09-03 01:34:09 +02:00
|
|
|
if (bit_depth_ == VPX_BITS_8) {
|
|
|
|
ASM_REGISTER_STATE_CHECK(inv_txfm_(test_temp_block, dst, 32));
|
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
|
|
|
} else {
|
|
|
|
ASM_REGISTER_STATE_CHECK(inv_txfm_(test_temp_block,
|
|
|
|
CONVERT_TO_BYTEPTR(dst16), 32));
|
|
|
|
#endif
|
|
|
|
}
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
|
2013-09-03 20:57:34 +02:00
|
|
|
for (int j = 0; j < kNumCoeffs; ++j) {
|
2014-09-03 01:34:09 +02:00
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
|
|
|
const uint32_t diff =
|
|
|
|
bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
|
|
|
|
#else
|
2013-09-03 20:57:34 +02:00
|
|
|
const uint32_t diff = dst[j] - src[j];
|
2014-09-03 01:34:09 +02:00
|
|
|
#endif
|
2013-09-03 20:57:34 +02:00
|
|
|
const uint32_t error = diff * diff;
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
if (max_error < error)
|
|
|
|
max_error = error;
|
|
|
|
total_error += error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-03 20:57:34 +02:00
|
|
|
if (version_ == 1) {
|
|
|
|
max_error /= 2;
|
|
|
|
total_error /= 45;
|
|
|
|
}
|
|
|
|
|
2014-09-03 01:34:09 +02:00
|
|
|
EXPECT_GE(1u << 2 * (bit_depth_ - 8), max_error)
|
2013-09-03 20:57:34 +02:00
|
|
|
<< "Error: 32x32 FDCT/IDCT has an individual round-trip error > 1";
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
|
2014-09-03 01:34:09 +02:00
|
|
|
EXPECT_GE(count_test_block << 2 * (bit_depth_ - 8), total_error)
|
2013-09-03 20:57:34 +02:00
|
|
|
<< "Error: 32x32 FDCT/IDCT has average round-trip error > 1 per block";
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
}
|
|
|
|
|
2013-09-03 20:57:34 +02:00
|
|
|
TEST_P(Trans32x32Test, CoeffCheck) {
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
|
|
|
const int count_test_block = 1000;
|
2013-09-03 20:57:34 +02:00
|
|
|
|
2015-05-02 22:24:16 +02:00
|
|
|
DECLARE_ALIGNED(16, int16_t, input_block[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, tran_low_t, output_ref_block[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, tran_low_t, output_block[kNumCoeffs]);
|
2013-09-03 20:57:34 +02:00
|
|
|
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
for (int i = 0; i < count_test_block; ++i) {
|
2013-09-03 20:57:34 +02:00
|
|
|
for (int j = 0; j < kNumCoeffs; ++j)
|
2014-09-03 01:34:09 +02:00
|
|
|
input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_);
|
2013-09-03 20:57:34 +02:00
|
|
|
|
2013-10-17 22:02:28 +02:00
|
|
|
const int stride = 32;
|
2015-07-29 00:57:40 +02:00
|
|
|
vpx_fdct32x32_c(input_block, output_ref_block, stride);
|
2014-07-10 06:02:02 +02:00
|
|
|
ASM_REGISTER_STATE_CHECK(fwd_txfm_(input_block, output_block, stride));
|
2013-09-03 20:57:34 +02:00
|
|
|
|
|
|
|
if (version_ == 0) {
|
|
|
|
for (int j = 0; j < kNumCoeffs; ++j)
|
|
|
|
EXPECT_EQ(output_block[j], output_ref_block[j])
|
|
|
|
<< "Error: 32x32 FDCT versions have mismatched coefficients";
|
|
|
|
} else {
|
|
|
|
for (int j = 0; j < kNumCoeffs; ++j)
|
|
|
|
EXPECT_GE(6, abs(output_block[j] - output_ref_block[j]))
|
|
|
|
<< "Error: 32x32 FDCT rd has mismatched coefficients";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_P(Trans32x32Test, MemCheck) {
|
|
|
|
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
|
|
|
const int count_test_block = 2000;
|
|
|
|
|
2015-05-02 22:24:16 +02:00
|
|
|
DECLARE_ALIGNED(16, int16_t, input_extreme_block[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, tran_low_t, output_ref_block[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, tran_low_t, output_block[kNumCoeffs]);
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
|
2013-09-03 20:57:34 +02:00
|
|
|
for (int i = 0; i < count_test_block; ++i) {
|
2014-09-03 01:34:09 +02:00
|
|
|
// Initialize a test block with input range [-mask_, mask_].
|
2013-09-03 20:57:34 +02:00
|
|
|
for (int j = 0; j < kNumCoeffs; ++j) {
|
2014-09-03 01:34:09 +02:00
|
|
|
input_extreme_block[j] = rnd.Rand8() & 1 ? mask_ : -mask_;
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
}
|
2014-06-03 01:40:01 +02:00
|
|
|
if (i == 0) {
|
2013-09-03 20:57:34 +02:00
|
|
|
for (int j = 0; j < kNumCoeffs; ++j)
|
2014-09-03 01:34:09 +02:00
|
|
|
input_extreme_block[j] = mask_;
|
2014-06-03 01:40:01 +02:00
|
|
|
} else if (i == 1) {
|
2013-09-03 20:57:34 +02:00
|
|
|
for (int j = 0; j < kNumCoeffs; ++j)
|
2014-09-03 01:34:09 +02:00
|
|
|
input_extreme_block[j] = -mask_;
|
2014-06-03 01:40:01 +02:00
|
|
|
}
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
|
2013-10-17 22:02:28 +02:00
|
|
|
const int stride = 32;
|
2015-07-29 00:57:40 +02:00
|
|
|
vpx_fdct32x32_c(input_extreme_block, output_ref_block, stride);
|
2014-07-10 06:02:02 +02:00
|
|
|
ASM_REGISTER_STATE_CHECK(
|
|
|
|
fwd_txfm_(input_extreme_block, output_block, stride));
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
|
|
|
|
// The minimum quant value is 4.
|
2013-09-03 20:57:34 +02:00
|
|
|
for (int j = 0; j < kNumCoeffs; ++j) {
|
|
|
|
if (version_ == 0) {
|
|
|
|
EXPECT_EQ(output_block[j], output_ref_block[j])
|
|
|
|
<< "Error: 32x32 FDCT versions have mismatched coefficients";
|
|
|
|
} else {
|
|
|
|
EXPECT_GE(6, abs(output_block[j] - output_ref_block[j]))
|
|
|
|
<< "Error: 32x32 FDCT rd has mismatched coefficients";
|
|
|
|
}
|
2014-09-03 01:34:09 +02:00
|
|
|
EXPECT_GE(4 * DCT_MAX_VALUE << (bit_depth_ - 8), abs(output_ref_block[j]))
|
2013-09-03 20:57:34 +02:00
|
|
|
<< "Error: 32x32 FDCT C has coefficient larger than 4*DCT_MAX_VALUE";
|
2014-09-03 01:34:09 +02:00
|
|
|
EXPECT_GE(4 * DCT_MAX_VALUE << (bit_depth_ - 8), abs(output_block[j]))
|
2013-09-03 20:57:34 +02:00
|
|
|
<< "Error: 32x32 FDCT has coefficient larger than "
|
|
|
|
<< "4*DCT_MAX_VALUE";
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-09-03 20:57:34 +02:00
|
|
|
|
|
|
|
TEST_P(Trans32x32Test, InverseAccuracy) {
|
|
|
|
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
|
|
|
const int count_test_block = 1000;
|
2015-05-02 22:24:16 +02:00
|
|
|
DECLARE_ALIGNED(16, int16_t, in[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, uint8_t, src[kNumCoeffs]);
|
2014-09-03 01:34:09 +02:00
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
2015-05-02 22:24:16 +02:00
|
|
|
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, uint16_t, src16[kNumCoeffs]);
|
2014-09-03 01:34:09 +02:00
|
|
|
#endif
|
2013-09-03 20:57:34 +02:00
|
|
|
|
|
|
|
for (int i = 0; i < count_test_block; ++i) {
|
|
|
|
double out_r[kNumCoeffs];
|
|
|
|
|
|
|
|
// Initialize a test block with input range [-255, 255]
|
|
|
|
for (int j = 0; j < kNumCoeffs; ++j) {
|
2014-09-03 01:34:09 +02:00
|
|
|
if (bit_depth_ == VPX_BITS_8) {
|
|
|
|
src[j] = rnd.Rand8();
|
|
|
|
dst[j] = rnd.Rand8();
|
|
|
|
in[j] = src[j] - dst[j];
|
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
|
|
|
} else {
|
|
|
|
src16[j] = rnd.Rand16() & mask_;
|
|
|
|
dst16[j] = rnd.Rand16() & mask_;
|
|
|
|
in[j] = src16[j] - dst16[j];
|
|
|
|
#endif
|
|
|
|
}
|
2013-09-03 20:57:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
reference_32x32_dct_2d(in, out_r);
|
|
|
|
for (int j = 0; j < kNumCoeffs; ++j)
|
2014-10-24 09:48:02 +02:00
|
|
|
coeff[j] = static_cast<tran_low_t>(round(out_r[j]));
|
2014-09-03 01:34:09 +02:00
|
|
|
if (bit_depth_ == VPX_BITS_8) {
|
|
|
|
ASM_REGISTER_STATE_CHECK(inv_txfm_(coeff, dst, 32));
|
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
|
|
|
} else {
|
|
|
|
ASM_REGISTER_STATE_CHECK(inv_txfm_(coeff, CONVERT_TO_BYTEPTR(dst16), 32));
|
|
|
|
#endif
|
|
|
|
}
|
2013-09-03 20:57:34 +02:00
|
|
|
for (int j = 0; j < kNumCoeffs; ++j) {
|
2014-09-03 01:34:09 +02:00
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
|
|
|
const int diff =
|
|
|
|
bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
|
|
|
|
#else
|
2013-09-03 20:57:34 +02:00
|
|
|
const int diff = dst[j] - src[j];
|
2014-09-03 01:34:09 +02:00
|
|
|
#endif
|
2013-09-03 20:57:34 +02:00
|
|
|
const int error = diff * diff;
|
|
|
|
EXPECT_GE(1, error)
|
|
|
|
<< "Error: 32x32 IDCT has error " << error
|
|
|
|
<< " at index " << j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
using std::tr1::make_tuple;
|
|
|
|
|
2014-09-03 01:34:09 +02:00
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
C, Trans32x32Test,
|
|
|
|
::testing::Values(
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_highbd_fdct32x32_c,
|
2014-09-03 01:34:09 +02:00
|
|
|
&idct32x32_10, 0, VPX_BITS_10),
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_highbd_fdct32x32_rd_c,
|
2014-09-03 01:34:09 +02:00
|
|
|
&idct32x32_10, 1, VPX_BITS_10),
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_highbd_fdct32x32_c,
|
2014-09-03 01:34:09 +02:00
|
|
|
&idct32x32_12, 0, VPX_BITS_12),
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_highbd_fdct32x32_rd_c,
|
2014-09-03 01:34:09 +02:00
|
|
|
&idct32x32_12, 1, VPX_BITS_12),
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_fdct32x32_c,
|
2015-08-03 23:51:10 +02:00
|
|
|
&vpx_idct32x32_1024_add_c, 0, VPX_BITS_8),
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_fdct32x32_rd_c,
|
2015-08-03 23:51:10 +02:00
|
|
|
&vpx_idct32x32_1024_add_c, 1, VPX_BITS_8)));
|
2014-09-03 01:34:09 +02:00
|
|
|
#else
|
2013-09-03 20:57:34 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
C, Trans32x32Test,
|
|
|
|
::testing::Values(
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_fdct32x32_c,
|
2015-08-03 23:51:10 +02:00
|
|
|
&vpx_idct32x32_1024_add_c, 0, VPX_BITS_8),
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_fdct32x32_rd_c,
|
2015-08-03 23:51:10 +02:00
|
|
|
&vpx_idct32x32_1024_add_c, 1, VPX_BITS_8)));
|
2014-10-24 09:48:02 +02:00
|
|
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
2013-09-03 20:57:34 +02:00
|
|
|
|
2014-10-03 00:43:27 +02:00
|
|
|
#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
2014-02-26 08:11:49 +01:00
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
NEON, Trans32x32Test,
|
|
|
|
::testing::Values(
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_fdct32x32_c,
|
2015-08-03 23:51:10 +02:00
|
|
|
&vpx_idct32x32_1024_add_neon, 0, VPX_BITS_8),
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_fdct32x32_rd_c,
|
2015-08-03 23:51:10 +02:00
|
|
|
&vpx_idct32x32_1024_add_neon, 1, VPX_BITS_8)));
|
2014-10-24 09:48:02 +02:00
|
|
|
#endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
2014-02-26 08:11:49 +01:00
|
|
|
|
2014-10-03 00:43:27 +02:00
|
|
|
#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
2013-09-03 20:57:34 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
SSE2, Trans32x32Test,
|
|
|
|
::testing::Values(
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_fdct32x32_sse2,
|
2015-08-03 23:51:10 +02:00
|
|
|
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_fdct32x32_rd_sse2,
|
2015-08-03 23:51:10 +02:00
|
|
|
&vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
|
2014-10-24 09:48:02 +02:00
|
|
|
#endif // HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
|
|
|
|
|
|
|
#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
SSE2, Trans32x32Test,
|
|
|
|
::testing::Values(
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_highbd_fdct32x32_sse2, &idct32x32_10, 0, VPX_BITS_10),
|
|
|
|
make_tuple(&vpx_highbd_fdct32x32_rd_sse2, &idct32x32_10, 1,
|
2014-10-24 09:48:02 +02:00
|
|
|
VPX_BITS_10),
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_highbd_fdct32x32_sse2, &idct32x32_12, 0, VPX_BITS_12),
|
|
|
|
make_tuple(&vpx_highbd_fdct32x32_rd_sse2, &idct32x32_12, 1,
|
2014-10-24 09:48:02 +02:00
|
|
|
VPX_BITS_12),
|
2015-08-03 23:51:10 +02:00
|
|
|
make_tuple(&vpx_fdct32x32_sse2, &vpx_idct32x32_1024_add_c, 0,
|
2014-10-24 09:48:02 +02:00
|
|
|
VPX_BITS_8),
|
2015-08-03 23:51:10 +02:00
|
|
|
make_tuple(&vpx_fdct32x32_rd_sse2, &vpx_idct32x32_1024_add_c, 1,
|
2014-10-24 09:48:02 +02:00
|
|
|
VPX_BITS_8)));
|
|
|
|
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
2013-11-21 20:31:10 +01:00
|
|
|
|
2014-10-03 00:43:27 +02:00
|
|
|
#if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
2013-11-21 20:31:10 +01:00
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
AVX2, Trans32x32Test,
|
|
|
|
::testing::Values(
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_fdct32x32_avx2,
|
2015-08-03 23:51:10 +02:00
|
|
|
&vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_fdct32x32_rd_avx2,
|
2015-08-03 23:51:10 +02:00
|
|
|
&vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
|
2014-10-24 09:48:02 +02:00
|
|
|
#endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
2015-05-06 09:07:38 +02:00
|
|
|
|
2015-06-01 05:49:01 +02:00
|
|
|
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
2015-05-06 09:07:38 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
MSA, Trans32x32Test,
|
|
|
|
::testing::Values(
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_fdct32x32_msa,
|
2015-08-03 23:51:10 +02:00
|
|
|
&vpx_idct32x32_1024_add_msa, 0, VPX_BITS_8),
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_fdct32x32_rd_msa,
|
2015-08-03 23:51:10 +02:00
|
|
|
&vpx_idct32x32_1024_add_msa, 1, VPX_BITS_8)));
|
2015-05-06 09:07:38 +02:00
|
|
|
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
32x32 transform for superblocks.
This adds Debargha's DCT/DWT hybrid and a regular 32x32 DCT, and adds
code all over the place to wrap that in the bitstream/encoder/decoder/RD.
Some implementation notes (these probably need careful review):
- token range is extended by 1 bit, since the value range out of this
transform is [-16384,16383].
- the coefficients coming out of the FDCT are manually scaled back by
1 bit, or else they won't fit in int16_t (they are 17 bits). Because
of this, the RD error scoring does not right-shift the MSE score by
two (unlike for 4x4/8x8/16x16).
- to compensate for this loss in precision, the quantizer is halved
also. This is currently a little hacky.
- FDCT and IDCT is double-only right now. Needs a fixed-point impl.
- There are no default probabilities for the 32x32 transform yet; I'm
simply using the 16x16 luma ones. A future commit will add newly
generated probabilities for all transforms.
- No ADST version. I don't think we'll add one for this level; if an
ADST is desired, transform-size selection can scale back to 16x16
or lower, and use an ADST at that level.
Additional notes specific to Debargha's DWT/DCT hybrid:
- coefficient scale is different for the top/left 16x16 (DCT-over-DWT)
block than for the rest (DWT pixel differences) of the block. Therefore,
RD error scoring isn't easily scalable between coefficient and pixel
domain. Thus, unfortunately, we need to compute the RD distortion in
the pixel domain until we figure out how to scale these appropriately.
Change-Id: I00386f20f35d7fabb19aba94c8162f8aee64ef2b
2012-12-07 23:45:05 +01:00
|
|
|
} // namespace
|