2012-06-29 01:26:31 +02: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>
|
|
|
|
|
|
|
|
#include "third_party/googletest/src/include/gtest/gtest.h"
|
2015-07-29 23:51:36 +02:00
|
|
|
|
|
|
|
#include "./vp9_rtcd.h"
|
|
|
|
#include "./vpx_dsp_rtcd.h"
|
2013-09-17 01:01:50 +02:00
|
|
|
#include "test/acm_random.h"
|
2013-09-03 22:50:17 +02:00
|
|
|
#include "test/clear_system_state.h"
|
|
|
|
#include "test/register_state_check.h"
|
2013-09-17 01:01:50 +02:00
|
|
|
#include "test/util.h"
|
2014-01-18 22:03:31 +01:00
|
|
|
#include "vp9/common/vp9_entropy.h"
|
2015-05-22 20:19:51 +02:00
|
|
|
#include "vp9/common/vp9_scan.h"
|
2014-09-03 01:34:09 +02:00
|
|
|
#include "vpx/vpx_codec.h"
|
2014-01-18 22:03:31 +01:00
|
|
|
#include "vpx/vpx_integer.h"
|
2015-05-12 04:09:22 +02:00
|
|
|
#include "vpx_ports/mem.h"
|
2014-01-18 22:03:31 +01:00
|
|
|
|
2015-05-15 04:38:34 +02:00
|
|
|
using libvpx_test::ACMRandom;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2014-09-03 01:34:09 +02:00
|
|
|
const int kNumCoeffs = 64;
|
|
|
|
const double kPi = 3.141592653589793238462643383279502884;
|
2015-05-15 04:38:34 +02:00
|
|
|
|
|
|
|
const int kSignBiasMaxDiff255 = 1500;
|
|
|
|
const int kSignBiasMaxDiff15 = 10000;
|
|
|
|
|
|
|
|
typedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride);
|
|
|
|
typedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride);
|
|
|
|
typedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride,
|
|
|
|
int tx_type);
|
|
|
|
typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride,
|
|
|
|
int tx_type);
|
|
|
|
|
|
|
|
typedef std::tr1::tuple<FdctFunc, IdctFunc, int, vpx_bit_depth_t> Dct8x8Param;
|
|
|
|
typedef std::tr1::tuple<FhtFunc, IhtFunc, int, vpx_bit_depth_t> Ht8x8Param;
|
|
|
|
typedef std::tr1::tuple<IdctFunc, IdctFunc, int, vpx_bit_depth_t> Idct8x8Param;
|
|
|
|
|
2016-02-12 03:27:00 +01:00
|
|
|
void reference_8x8_dct_1d(const double in[8], double out[8]) {
|
2014-09-03 01:34:09 +02:00
|
|
|
const double kInvSqrt2 = 0.707106781186547524400844362104;
|
|
|
|
for (int k = 0; k < 8; k++) {
|
|
|
|
out[k] = 0.0;
|
2016-08-05 04:28:34 +02:00
|
|
|
for (int n = 0; n < 8; n++) {
|
2014-09-03 01:34:09 +02:00
|
|
|
out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 16.0);
|
2016-08-05 04:28:34 +02:00
|
|
|
}
|
2016-07-26 07:50:48 +02:00
|
|
|
if (k == 0) out[k] = out[k] * kInvSqrt2;
|
2014-09-03 01:34:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void reference_8x8_dct_2d(const int16_t input[kNumCoeffs],
|
|
|
|
double output[kNumCoeffs]) {
|
|
|
|
// First transform columns
|
|
|
|
for (int i = 0; i < 8; ++i) {
|
|
|
|
double temp_in[8], temp_out[8];
|
2016-07-26 07:50:48 +02:00
|
|
|
for (int j = 0; j < 8; ++j) temp_in[j] = input[j * 8 + i];
|
2016-02-12 03:27:00 +01:00
|
|
|
reference_8x8_dct_1d(temp_in, temp_out);
|
2016-07-26 07:50:48 +02:00
|
|
|
for (int j = 0; j < 8; ++j) output[j * 8 + i] = temp_out[j];
|
2014-09-03 01:34:09 +02:00
|
|
|
}
|
|
|
|
// Then transform rows
|
|
|
|
for (int i = 0; i < 8; ++i) {
|
|
|
|
double temp_in[8], temp_out[8];
|
2016-07-26 07:50:48 +02:00
|
|
|
for (int j = 0; j < 8; ++j) temp_in[j] = output[j + i * 8];
|
2016-02-12 03:27:00 +01:00
|
|
|
reference_8x8_dct_1d(temp_in, temp_out);
|
2014-09-03 01:34:09 +02:00
|
|
|
// Scale by some magic number
|
2016-07-26 07:50:48 +02:00
|
|
|
for (int j = 0; j < 8; ++j) output[j + i * 8] = temp_out[j] * 2;
|
2014-09-03 01:34:09 +02:00
|
|
|
}
|
2012-06-29 01:26:31 +02:00
|
|
|
}
|
|
|
|
|
2016-02-12 03:27:00 +01:00
|
|
|
void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride,
|
|
|
|
int /*tx_type*/) {
|
2015-07-29 00:57:40 +02:00
|
|
|
vpx_fdct8x8_c(in, out, stride);
|
2013-06-21 20:45:47 +02:00
|
|
|
}
|
2013-09-17 01:01:50 +02:00
|
|
|
|
2014-09-03 01:34:09 +02:00
|
|
|
void fht8x8_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
|
2014-02-06 20:54:15 +01:00
|
|
|
vp9_fht8x8_c(in, out, stride, tx_type);
|
2013-06-21 20:45:47 +02:00
|
|
|
}
|
|
|
|
|
2014-09-03 01:34:09 +02:00
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
|
|
|
void idct8x8_10(const tran_low_t *in, uint8_t *out, int stride) {
|
2015-08-03 23:51:10 +02:00
|
|
|
vpx_highbd_idct8x8_64_add_c(in, out, stride, 10);
|
2014-09-03 01:34:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void idct8x8_12(const tran_low_t *in, uint8_t *out, int stride) {
|
2015-08-03 23:51:10 +02:00
|
|
|
vpx_highbd_idct8x8_64_add_c(in, out, stride, 12);
|
2014-09-03 01:34:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void iht8x8_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
|
2014-10-08 21:43:22 +02:00
|
|
|
vp9_highbd_iht8x8_64_add_c(in, out, stride, tx_type, 10);
|
2014-09-03 01:34:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void iht8x8_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) {
|
2014-10-08 21:43:22 +02:00
|
|
|
vp9_highbd_iht8x8_64_add_c(in, out, stride, tx_type, 12);
|
2014-09-03 01:34:09 +02:00
|
|
|
}
|
2014-10-24 09:48:02 +02:00
|
|
|
|
2016-02-04 08:04:42 +01:00
|
|
|
#if HAVE_SSE2
|
|
|
|
|
2016-11-04 17:44:22 +01:00
|
|
|
void idct8x8_12_add_10_c(const tran_low_t *in, uint8_t *out, int stride) {
|
|
|
|
vpx_highbd_idct8x8_12_add_c(in, out, stride, 10);
|
2014-10-24 09:48:02 +02:00
|
|
|
}
|
|
|
|
|
2016-11-04 17:44:22 +01:00
|
|
|
void idct8x8_12_add_12_c(const tran_low_t *in, uint8_t *out, int stride) {
|
|
|
|
vpx_highbd_idct8x8_12_add_c(in, out, stride, 12);
|
2014-10-24 09:48:02 +02:00
|
|
|
}
|
|
|
|
|
2016-11-04 17:44:22 +01:00
|
|
|
void idct8x8_12_add_10_sse2(const tran_low_t *in, uint8_t *out, int stride) {
|
|
|
|
vpx_highbd_idct8x8_12_add_sse2(in, out, stride, 10);
|
2014-10-24 09:48:02 +02:00
|
|
|
}
|
|
|
|
|
2016-11-04 17:44:22 +01:00
|
|
|
void idct8x8_12_add_12_sse2(const tran_low_t *in, uint8_t *out, int stride) {
|
|
|
|
vpx_highbd_idct8x8_12_add_sse2(in, out, stride, 12);
|
2014-10-24 09:48:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void idct8x8_64_add_10_sse2(const tran_low_t *in, uint8_t *out, int stride) {
|
2015-08-03 23:51:10 +02:00
|
|
|
vpx_highbd_idct8x8_64_add_sse2(in, out, stride, 10);
|
2014-10-24 09:48:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void idct8x8_64_add_12_sse2(const tran_low_t *in, uint8_t *out, int stride) {
|
2015-08-03 23:51:10 +02:00
|
|
|
vpx_highbd_idct8x8_64_add_sse2(in, out, stride, 12);
|
2014-10-24 09:48:02 +02:00
|
|
|
}
|
|
|
|
#endif // HAVE_SSE2
|
|
|
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
2014-09-03 01:34:09 +02:00
|
|
|
|
2013-09-17 01:01:50 +02:00
|
|
|
class FwdTrans8x8TestBase {
|
2013-06-21 20:45:47 +02:00
|
|
|
public:
|
2013-09-17 01:01:50 +02:00
|
|
|
virtual ~FwdTrans8x8TestBase() {}
|
2013-06-21 20:45:47 +02:00
|
|
|
|
|
|
|
protected:
|
2014-09-03 01:34:09 +02:00
|
|
|
virtual void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) = 0;
|
|
|
|
virtual void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) = 0;
|
2013-06-21 20:45:47 +02:00
|
|
|
|
2013-09-17 01:01:50 +02:00
|
|
|
void RunSignBiasCheck() {
|
|
|
|
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
2015-05-02 22:24:16 +02:00
|
|
|
DECLARE_ALIGNED(16, int16_t, test_input_block[64]);
|
|
|
|
DECLARE_ALIGNED(16, tran_low_t, test_output_block[64]);
|
2013-09-17 01:01:50 +02:00
|
|
|
int count_sign_block[64][2];
|
|
|
|
const int count_test_block = 100000;
|
2012-06-29 01:26:31 +02:00
|
|
|
|
2013-09-17 01:01:50 +02:00
|
|
|
memset(count_sign_block, 0, sizeof(count_sign_block));
|
2012-06-29 01:26:31 +02:00
|
|
|
|
2013-09-17 01:01:50 +02:00
|
|
|
for (int i = 0; i < count_test_block; ++i) {
|
|
|
|
// Initialize a test block with input range [-255, 255].
|
2016-08-05 04:28:34 +02:00
|
|
|
for (int j = 0; j < 64; ++j) {
|
2014-09-03 01:34:09 +02:00
|
|
|
test_input_block[j] = ((rnd.Rand16() >> (16 - bit_depth_)) & mask_) -
|
|
|
|
((rnd.Rand16() >> (16 - bit_depth_)) & mask_);
|
2016-08-05 04:28:34 +02:00
|
|
|
}
|
2014-07-10 06:02:02 +02:00
|
|
|
ASM_REGISTER_STATE_CHECK(
|
2013-09-17 01:01:50 +02:00
|
|
|
RunFwdTxfm(test_input_block, test_output_block, pitch_));
|
2012-06-29 01:26:31 +02:00
|
|
|
|
2013-09-17 01:01:50 +02:00
|
|
|
for (int j = 0; j < 64; ++j) {
|
2016-08-05 04:28:34 +02:00
|
|
|
if (test_output_block[j] < 0) {
|
2013-09-17 01:01:50 +02:00
|
|
|
++count_sign_block[j][0];
|
2016-08-05 04:28:34 +02:00
|
|
|
} else if (test_output_block[j] > 0) {
|
2013-09-17 01:01:50 +02:00
|
|
|
++count_sign_block[j][1];
|
2016-08-05 04:28:34 +02:00
|
|
|
}
|
2013-09-17 01:01:50 +02:00
|
|
|
}
|
|
|
|
}
|
2012-06-29 01:26:31 +02:00
|
|
|
|
|
|
|
for (int j = 0; j < 64; ++j) {
|
2013-09-17 01:01:50 +02:00
|
|
|
const int diff = abs(count_sign_block[j][0] - count_sign_block[j][1]);
|
2014-12-05 01:46:06 +01:00
|
|
|
const int max_diff = kSignBiasMaxDiff255;
|
2014-09-03 01:34:09 +02:00
|
|
|
EXPECT_LT(diff, max_diff << (bit_depth_ - 8))
|
2013-09-17 01:01:50 +02:00
|
|
|
<< "Error: 8x8 FDCT/FHT has a sign bias > "
|
|
|
|
<< 1. * max_diff / count_test_block * 100 << "%"
|
|
|
|
<< " for input range [-255, 255] at index " << j
|
|
|
|
<< " count0: " << count_sign_block[j][0]
|
2016-07-26 07:50:48 +02:00
|
|
|
<< " count1: " << count_sign_block[j][1] << " diff: " << diff;
|
2012-06-29 01:26:31 +02:00
|
|
|
}
|
|
|
|
|
2013-09-17 01:01:50 +02:00
|
|
|
memset(count_sign_block, 0, sizeof(count_sign_block));
|
2012-06-29 01:26:31 +02:00
|
|
|
|
2013-09-17 01:01:50 +02:00
|
|
|
for (int i = 0; i < count_test_block; ++i) {
|
2014-10-24 09:48:02 +02:00
|
|
|
// Initialize a test block with input range [-mask_ / 16, mask_ / 16].
|
2016-08-05 04:28:34 +02:00
|
|
|
for (int j = 0; j < 64; ++j) {
|
2016-07-26 07:50:48 +02:00
|
|
|
test_input_block[j] =
|
|
|
|
((rnd.Rand16() & mask_) >> 4) - ((rnd.Rand16() & mask_) >> 4);
|
2016-08-05 04:28:34 +02:00
|
|
|
}
|
2014-07-10 06:02:02 +02:00
|
|
|
ASM_REGISTER_STATE_CHECK(
|
2013-09-17 01:01:50 +02:00
|
|
|
RunFwdTxfm(test_input_block, test_output_block, pitch_));
|
2012-06-29 01:26:31 +02:00
|
|
|
|
2013-09-17 01:01:50 +02:00
|
|
|
for (int j = 0; j < 64; ++j) {
|
2016-08-05 04:28:34 +02:00
|
|
|
if (test_output_block[j] < 0) {
|
2013-09-17 01:01:50 +02:00
|
|
|
++count_sign_block[j][0];
|
2016-08-05 04:28:34 +02:00
|
|
|
} else if (test_output_block[j] > 0) {
|
2013-09-17 01:01:50 +02:00
|
|
|
++count_sign_block[j][1];
|
2016-08-05 04:28:34 +02:00
|
|
|
}
|
2013-09-17 01:01:50 +02:00
|
|
|
}
|
|
|
|
}
|
2012-06-29 01:26:31 +02:00
|
|
|
|
|
|
|
for (int j = 0; j < 64; ++j) {
|
2013-09-17 01:01:50 +02:00
|
|
|
const int diff = abs(count_sign_block[j][0] - count_sign_block[j][1]);
|
2014-12-05 01:46:06 +01:00
|
|
|
const int max_diff = kSignBiasMaxDiff15;
|
2014-09-03 01:34:09 +02:00
|
|
|
EXPECT_LT(diff, max_diff << (bit_depth_ - 8))
|
2014-12-05 01:46:06 +01:00
|
|
|
<< "Error: 8x8 FDCT/FHT has a sign bias > "
|
2013-09-17 01:01:50 +02:00
|
|
|
<< 1. * max_diff / count_test_block * 100 << "%"
|
|
|
|
<< " for input range [-15, 15] at index " << j
|
|
|
|
<< " count0: " << count_sign_block[j][0]
|
2016-07-26 07:50:48 +02:00
|
|
|
<< " count1: " << count_sign_block[j][1] << " diff: " << diff;
|
2012-06-29 01:26:31 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-17 01:01:50 +02:00
|
|
|
void RunRoundTripErrorCheck() {
|
|
|
|
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
|
|
|
int max_error = 0;
|
|
|
|
int total_error = 0;
|
|
|
|
const int count_test_block = 100000;
|
2015-05-02 22:24:16 +02:00
|
|
|
DECLARE_ALIGNED(16, int16_t, test_input_block[64]);
|
|
|
|
DECLARE_ALIGNED(16, tran_low_t, test_temp_block[64]);
|
|
|
|
DECLARE_ALIGNED(16, uint8_t, dst[64]);
|
|
|
|
DECLARE_ALIGNED(16, uint8_t, src[64]);
|
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[64]);
|
|
|
|
DECLARE_ALIGNED(16, uint16_t, src16[64]);
|
2014-09-03 01:34:09 +02:00
|
|
|
#endif
|
2012-06-29 01:26:31 +02:00
|
|
|
|
2013-09-17 01:01:50 +02:00
|
|
|
for (int i = 0; i < count_test_block; ++i) {
|
2014-10-24 09:48:02 +02:00
|
|
|
// Initialize a test block with input range [-mask_, mask_].
|
2013-09-17 01:01:50 +02:00
|
|
|
for (int j = 0; j < 64; ++j) {
|
2014-09-03 01:34:09 +02:00
|
|
|
if (bit_depth_ == VPX_BITS_8) {
|
|
|
|
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-17 01:01:50 +02:00
|
|
|
}
|
2012-06-29 01:26:31 +02:00
|
|
|
|
2014-07-10 06:02:02 +02:00
|
|
|
ASM_REGISTER_STATE_CHECK(
|
2013-09-17 01:01:50 +02:00
|
|
|
RunFwdTxfm(test_input_block, test_temp_block, pitch_));
|
|
|
|
for (int j = 0; j < 64; ++j) {
|
2016-07-26 07:50:48 +02:00
|
|
|
if (test_temp_block[j] > 0) {
|
|
|
|
test_temp_block[j] += 2;
|
|
|
|
test_temp_block[j] /= 4;
|
|
|
|
test_temp_block[j] *= 4;
|
|
|
|
} else {
|
|
|
|
test_temp_block[j] -= 2;
|
|
|
|
test_temp_block[j] /= 4;
|
|
|
|
test_temp_block[j] *= 4;
|
|
|
|
}
|
2013-09-17 01:01:50 +02:00
|
|
|
}
|
2014-09-03 01:34:09 +02:00
|
|
|
if (bit_depth_ == VPX_BITS_8) {
|
2016-07-26 07:50:48 +02:00
|
|
|
ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
|
2014-09-03 01:34:09 +02:00
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
|
|
|
} else {
|
|
|
|
ASM_REGISTER_STATE_CHECK(
|
|
|
|
RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
|
|
|
|
#endif
|
|
|
|
}
|
2013-09-17 01:01:50 +02:00
|
|
|
|
|
|
|
for (int j = 0; j < 64; ++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-17 01:01:50 +02:00
|
|
|
const int diff = dst[j] - src[j];
|
2014-09-03 01:34:09 +02:00
|
|
|
#endif
|
2013-09-17 01:01:50 +02:00
|
|
|
const int error = diff * diff;
|
2016-07-26 07:50:48 +02:00
|
|
|
if (max_error < error) max_error = error;
|
2013-09-17 01:01:50 +02:00
|
|
|
total_error += error;
|
|
|
|
}
|
2012-06-29 01:26:31 +02:00
|
|
|
}
|
|
|
|
|
2014-09-03 01:34:09 +02:00
|
|
|
EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error)
|
2016-07-26 07:50:48 +02:00
|
|
|
<< "Error: 8x8 FDCT/IDCT or FHT/IHT has an individual"
|
|
|
|
<< " roundtrip error > 1";
|
2012-06-29 01:26:31 +02:00
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
|
|
|
|
<< "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip "
|
|
|
|
<< "error > 1/5 per block";
|
2013-09-17 01:01:50 +02:00
|
|
|
}
|
2012-06-29 01:26:31 +02:00
|
|
|
|
2013-09-17 01:01:50 +02:00
|
|
|
void RunExtremalCheck() {
|
|
|
|
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
|
|
|
int max_error = 0;
|
|
|
|
int total_error = 0;
|
2014-06-03 01:40:01 +02:00
|
|
|
int total_coeff_error = 0;
|
2013-09-17 01:01:50 +02:00
|
|
|
const int count_test_block = 100000;
|
2015-05-02 22:24:16 +02:00
|
|
|
DECLARE_ALIGNED(16, int16_t, test_input_block[64]);
|
|
|
|
DECLARE_ALIGNED(16, tran_low_t, test_temp_block[64]);
|
|
|
|
DECLARE_ALIGNED(16, tran_low_t, ref_temp_block[64]);
|
|
|
|
DECLARE_ALIGNED(16, uint8_t, dst[64]);
|
|
|
|
DECLARE_ALIGNED(16, uint8_t, src[64]);
|
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[64]);
|
|
|
|
DECLARE_ALIGNED(16, uint16_t, src16[64]);
|
2014-09-03 01:34:09 +02:00
|
|
|
#endif
|
2012-06-29 01:26:31 +02:00
|
|
|
|
2013-09-17 01:01:50 +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-17 01:01:50 +02:00
|
|
|
for (int j = 0; j < 64; ++j) {
|
2014-09-03 01:34:09 +02:00
|
|
|
if (bit_depth_ == VPX_BITS_8) {
|
|
|
|
if (i == 0) {
|
|
|
|
src[j] = 255;
|
|
|
|
dst[j] = 0;
|
|
|
|
} else if (i == 1) {
|
|
|
|
src[j] = 0;
|
|
|
|
dst[j] = 255;
|
|
|
|
} else {
|
|
|
|
src[j] = rnd.Rand8() % 2 ? 255 : 0;
|
|
|
|
dst[j] = rnd.Rand8() % 2 ? 255 : 0;
|
|
|
|
}
|
|
|
|
test_input_block[j] = src[j] - dst[j];
|
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
2014-06-04 01:45:22 +02:00
|
|
|
} else {
|
2014-09-03 01:34:09 +02:00
|
|
|
if (i == 0) {
|
|
|
|
src16[j] = mask_;
|
|
|
|
dst16[j] = 0;
|
|
|
|
} else if (i == 1) {
|
|
|
|
src16[j] = 0;
|
|
|
|
dst16[j] = mask_;
|
|
|
|
} else {
|
|
|
|
src16[j] = rnd.Rand8() % 2 ? mask_ : 0;
|
|
|
|
dst16[j] = rnd.Rand8() % 2 ? mask_ : 0;
|
|
|
|
}
|
|
|
|
test_input_block[j] = src16[j] - dst16[j];
|
|
|
|
#endif
|
2014-06-03 01:40:01 +02:00
|
|
|
}
|
2013-09-17 01:01:50 +02:00
|
|
|
}
|
2012-06-29 01:26:31 +02:00
|
|
|
|
2014-07-10 06:02:02 +02:00
|
|
|
ASM_REGISTER_STATE_CHECK(
|
2013-09-17 01:01:50 +02:00
|
|
|
RunFwdTxfm(test_input_block, test_temp_block, pitch_));
|
2014-07-10 06:02:02 +02:00
|
|
|
ASM_REGISTER_STATE_CHECK(
|
2014-06-03 01:40:01 +02:00
|
|
|
fwd_txfm_ref(test_input_block, ref_temp_block, pitch_, tx_type_));
|
2014-09-03 01:34:09 +02:00
|
|
|
if (bit_depth_ == VPX_BITS_8) {
|
2016-07-26 07:50:48 +02:00
|
|
|
ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
|
2014-09-03 01:34:09 +02:00
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
|
|
|
} else {
|
|
|
|
ASM_REGISTER_STATE_CHECK(
|
|
|
|
RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
|
|
|
|
#endif
|
|
|
|
}
|
2013-09-17 01:01:50 +02:00
|
|
|
|
|
|
|
for (int j = 0; j < 64; ++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-17 01:01:50 +02:00
|
|
|
const int diff = dst[j] - src[j];
|
2014-09-03 01:34:09 +02:00
|
|
|
#endif
|
2013-09-17 01:01:50 +02:00
|
|
|
const int error = diff * diff;
|
2016-07-26 07:50:48 +02:00
|
|
|
if (max_error < error) max_error = error;
|
2013-09-17 01:01:50 +02:00
|
|
|
total_error += error;
|
2014-06-03 01:40:01 +02:00
|
|
|
|
|
|
|
const int coeff_diff = test_temp_block[j] - ref_temp_block[j];
|
|
|
|
total_coeff_error += abs(coeff_diff);
|
2013-09-17 01:01:50 +02:00
|
|
|
}
|
|
|
|
|
2014-09-03 01:34:09 +02:00
|
|
|
EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error)
|
2013-09-17 01:01:50 +02:00
|
|
|
<< "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has"
|
|
|
|
<< "an individual roundtrip error > 1";
|
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
|
2013-09-17 01:01:50 +02:00
|
|
|
<< "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has average"
|
|
|
|
<< " roundtrip error > 1/5 per block";
|
2014-06-03 01:40:01 +02:00
|
|
|
|
|
|
|
EXPECT_EQ(0, total_coeff_error)
|
|
|
|
<< "Error: Extremal 8x8 FDCT/FHT has"
|
|
|
|
<< "overflow issues in the intermediate steps > 1";
|
2012-06-29 01:26:31 +02:00
|
|
|
}
|
2013-09-17 01:01:50 +02:00
|
|
|
}
|
2012-06-29 01:26:31 +02:00
|
|
|
|
2014-09-03 01:34:09 +02:00
|
|
|
void RunInvAccuracyCheck() {
|
|
|
|
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, src16[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, uint16_t, dst16[kNumCoeffs]);
|
2014-09-03 01:34:09 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
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) {
|
|
|
|
if (bit_depth_ == VPX_BITS_8) {
|
|
|
|
src[j] = rnd.Rand8() % 2 ? 255 : 0;
|
|
|
|
dst[j] = src[j] > 0 ? 0 : 255;
|
|
|
|
in[j] = src[j] - dst[j];
|
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
|
|
|
} else {
|
|
|
|
src16[j] = rnd.Rand8() % 2 ? mask_ : 0;
|
|
|
|
dst16[j] = src16[j] > 0 ? 0 : mask_;
|
|
|
|
in[j] = src16[j] - dst16[j];
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
reference_8x8_dct_2d(in, out_r);
|
2016-08-05 04:28:34 +02:00
|
|
|
for (int j = 0; j < kNumCoeffs; ++j) {
|
2014-09-13 13:11:50 +02:00
|
|
|
coeff[j] = static_cast<tran_low_t>(round(out_r[j]));
|
2016-08-05 04:28:34 +02:00
|
|
|
}
|
2014-09-03 01:34:09 +02:00
|
|
|
|
|
|
|
if (bit_depth_ == VPX_BITS_8) {
|
|
|
|
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
|
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
|
|
|
} else {
|
2016-07-26 07:50:48 +02:00
|
|
|
ASM_REGISTER_STATE_CHECK(
|
|
|
|
RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
|
2014-09-03 01:34:09 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int j = 0; j < kNumCoeffs; ++j) {
|
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
2016-06-09 02:33:34 +02:00
|
|
|
const int diff =
|
2014-09-03 01:34:09 +02:00
|
|
|
bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
|
|
|
|
#else
|
2016-06-09 02:33:34 +02:00
|
|
|
const int diff = dst[j] - src[j];
|
2014-09-03 01:34:09 +02:00
|
|
|
#endif
|
|
|
|
const uint32_t error = diff * diff;
|
|
|
|
EXPECT_GE(1u << 2 * (bit_depth_ - 8), error)
|
2016-07-26 07:50:48 +02:00
|
|
|
<< "Error: 8x8 IDCT has error " << error << " at index " << j;
|
2014-09-03 01:34:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void RunFwdAccuracyCheck() {
|
|
|
|
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_r[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
|
2014-09-03 01:34:09 +02:00
|
|
|
|
|
|
|
for (int i = 0; i < count_test_block; ++i) {
|
|
|
|
double out_r[kNumCoeffs];
|
|
|
|
|
|
|
|
// Initialize a test block with input range [-mask_, mask_].
|
2016-08-05 04:28:34 +02:00
|
|
|
for (int j = 0; j < kNumCoeffs; ++j) {
|
2014-09-03 01:34:09 +02:00
|
|
|
in[j] = rnd.Rand8() % 2 == 0 ? mask_ : -mask_;
|
2016-08-05 04:28:34 +02:00
|
|
|
}
|
2014-09-03 01:34:09 +02:00
|
|
|
|
|
|
|
RunFwdTxfm(in, coeff, pitch_);
|
|
|
|
reference_8x8_dct_2d(in, out_r);
|
2016-08-05 04:28:34 +02:00
|
|
|
for (int j = 0; j < kNumCoeffs; ++j) {
|
2014-09-13 13:11:50 +02:00
|
|
|
coeff_r[j] = static_cast<tran_low_t>(round(out_r[j]));
|
2016-08-05 04:28:34 +02:00
|
|
|
}
|
2014-09-03 01:34:09 +02:00
|
|
|
|
|
|
|
for (int j = 0; j < kNumCoeffs; ++j) {
|
2016-06-01 01:54:58 +02:00
|
|
|
const int32_t diff = coeff[j] - coeff_r[j];
|
2014-09-03 01:34:09 +02:00
|
|
|
const uint32_t error = diff * diff;
|
|
|
|
EXPECT_GE(9u << 2 * (bit_depth_ - 8), error)
|
2016-07-26 07:50:48 +02:00
|
|
|
<< "Error: 8x8 DCT has error " << error << " at index " << j;
|
2014-09-03 01:34:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-10-24 09:48:02 +02:00
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
void CompareInvReference(IdctFunc ref_txfm, int thresh) {
|
2014-10-24 09:48:02 +02:00
|
|
|
ACMRandom rnd(ACMRandom::DeterministicSeed());
|
|
|
|
const int count_test_block = 10000;
|
|
|
|
const int eob = 12;
|
2015-05-02 22:24:16 +02:00
|
|
|
DECLARE_ALIGNED(16, tran_low_t, coeff[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, uint8_t, dst[kNumCoeffs]);
|
|
|
|
DECLARE_ALIGNED(16, uint8_t, ref[kNumCoeffs]);
|
2014-10-24 09:48:02 +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, ref16[kNumCoeffs]);
|
2014-10-24 09:48:02 +02:00
|
|
|
#endif
|
|
|
|
const int16_t *scan = vp9_default_scan_orders[TX_8X8].scan;
|
|
|
|
|
|
|
|
for (int i = 0; i < count_test_block; ++i) {
|
|
|
|
for (int j = 0; j < kNumCoeffs; ++j) {
|
|
|
|
if (j < eob) {
|
|
|
|
// Random values less than the threshold, either positive or negative
|
2016-07-26 07:50:48 +02:00
|
|
|
coeff[scan[j]] = rnd(thresh) * (1 - 2 * (i % 2));
|
2014-10-24 09:48:02 +02:00
|
|
|
} else {
|
|
|
|
coeff[scan[j]] = 0;
|
|
|
|
}
|
|
|
|
if (bit_depth_ == VPX_BITS_8) {
|
|
|
|
dst[j] = 0;
|
|
|
|
ref[j] = 0;
|
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
|
|
|
} else {
|
|
|
|
dst16[j] = 0;
|
|
|
|
ref16[j] = 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bit_depth_ == VPX_BITS_8) {
|
|
|
|
ref_txfm(coeff, ref, pitch_);
|
|
|
|
ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
|
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
|
|
|
} else {
|
|
|
|
ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_);
|
2016-07-26 07:50:48 +02:00
|
|
|
ASM_REGISTER_STATE_CHECK(
|
|
|
|
RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
|
2014-10-24 09:48:02 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int j = 0; j < kNumCoeffs; ++j) {
|
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
2016-06-09 02:33:34 +02:00
|
|
|
const int diff =
|
2014-10-24 09:48:02 +02:00
|
|
|
bit_depth_ == VPX_BITS_8 ? dst[j] - ref[j] : dst16[j] - ref16[j];
|
|
|
|
#else
|
2016-06-09 02:33:34 +02:00
|
|
|
const int diff = dst[j] - ref[j];
|
2014-10-24 09:48:02 +02:00
|
|
|
#endif
|
|
|
|
const uint32_t error = diff * diff;
|
2016-07-26 07:50:48 +02:00
|
|
|
EXPECT_EQ(0u, error) << "Error: 8x8 IDCT has error " << error
|
|
|
|
<< " at index " << j;
|
2014-10-24 09:48:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-09-17 01:01:50 +02:00
|
|
|
int pitch_;
|
|
|
|
int tx_type_;
|
2014-07-17 03:56:22 +02:00
|
|
|
FhtFunc fwd_txfm_ref;
|
2014-09-03 01:34:09 +02:00
|
|
|
vpx_bit_depth_t bit_depth_;
|
|
|
|
int mask_;
|
2013-09-17 01:01:50 +02:00
|
|
|
};
|
2012-06-29 01:26:31 +02:00
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
class FwdTrans8x8DCT : public FwdTrans8x8TestBase,
|
|
|
|
public ::testing::TestWithParam<Dct8x8Param> {
|
2013-09-17 01:01:50 +02:00
|
|
|
public:
|
|
|
|
virtual ~FwdTrans8x8DCT() {}
|
|
|
|
|
|
|
|
virtual void SetUp() {
|
|
|
|
fwd_txfm_ = GET_PARAM(0);
|
|
|
|
inv_txfm_ = GET_PARAM(1);
|
2016-07-26 07:50:48 +02:00
|
|
|
tx_type_ = GET_PARAM(2);
|
|
|
|
pitch_ = 8;
|
2013-09-17 01:01:50 +02:00
|
|
|
fwd_txfm_ref = fdct8x8_ref;
|
2014-09-03 01:34:09 +02:00
|
|
|
bit_depth_ = GET_PARAM(3);
|
|
|
|
mask_ = (1 << bit_depth_) - 1;
|
2013-09-17 01:01:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
|
|
|
|
|
|
|
protected:
|
2014-09-03 01:34:09 +02:00
|
|
|
void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
|
2013-09-17 01:01:50 +02:00
|
|
|
fwd_txfm_(in, out, stride);
|
|
|
|
}
|
2014-09-03 01:34:09 +02:00
|
|
|
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
|
2013-10-18 21:20:26 +02:00
|
|
|
inv_txfm_(out, dst, stride);
|
2012-06-29 01:26:31 +02:00
|
|
|
}
|
2013-09-17 01:01:50 +02:00
|
|
|
|
2014-07-17 03:56:22 +02:00
|
|
|
FdctFunc fwd_txfm_;
|
|
|
|
IdctFunc inv_txfm_;
|
2013-09-17 01:01:50 +02:00
|
|
|
};
|
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
TEST_P(FwdTrans8x8DCT, SignBiasCheck) { RunSignBiasCheck(); }
|
2012-06-29 01:26:31 +02:00
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); }
|
2013-09-17 01:01:50 +02:00
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
TEST_P(FwdTrans8x8DCT, ExtremalCheck) { RunExtremalCheck(); }
|
2013-09-17 01:01:50 +02:00
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
TEST_P(FwdTrans8x8DCT, FwdAccuracyCheck) { RunFwdAccuracyCheck(); }
|
2014-09-03 01:34:09 +02:00
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
TEST_P(FwdTrans8x8DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); }
|
2014-09-03 01:34:09 +02:00
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
class FwdTrans8x8HT : public FwdTrans8x8TestBase,
|
|
|
|
public ::testing::TestWithParam<Ht8x8Param> {
|
2013-09-17 01:01:50 +02:00
|
|
|
public:
|
|
|
|
virtual ~FwdTrans8x8HT() {}
|
|
|
|
|
|
|
|
virtual void SetUp() {
|
|
|
|
fwd_txfm_ = GET_PARAM(0);
|
|
|
|
inv_txfm_ = GET_PARAM(1);
|
2016-07-26 07:50:48 +02:00
|
|
|
tx_type_ = GET_PARAM(2);
|
|
|
|
pitch_ = 8;
|
2013-09-17 01:01:50 +02:00
|
|
|
fwd_txfm_ref = fht8x8_ref;
|
2014-09-03 01:34:09 +02:00
|
|
|
bit_depth_ = GET_PARAM(3);
|
|
|
|
mask_ = (1 << bit_depth_) - 1;
|
2013-09-17 01:01:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
|
|
|
|
|
|
|
protected:
|
2014-09-03 01:34:09 +02:00
|
|
|
void RunFwdTxfm(int16_t *in, tran_low_t *out, int stride) {
|
2013-09-17 01:01:50 +02:00
|
|
|
fwd_txfm_(in, out, stride, tx_type_);
|
|
|
|
}
|
2014-09-03 01:34:09 +02:00
|
|
|
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
|
2013-09-17 01:01:50 +02:00
|
|
|
inv_txfm_(out, dst, stride, tx_type_);
|
|
|
|
}
|
|
|
|
|
2014-07-17 03:56:22 +02:00
|
|
|
FhtFunc fwd_txfm_;
|
|
|
|
IhtFunc inv_txfm_;
|
2013-09-17 01:01:50 +02:00
|
|
|
};
|
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
TEST_P(FwdTrans8x8HT, SignBiasCheck) { RunSignBiasCheck(); }
|
2013-09-17 01:01:50 +02:00
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); }
|
2013-09-17 01:01:50 +02:00
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
TEST_P(FwdTrans8x8HT, ExtremalCheck) { RunExtremalCheck(); }
|
2013-09-17 01:01:50 +02:00
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
class InvTrans8x8DCT : public FwdTrans8x8TestBase,
|
|
|
|
public ::testing::TestWithParam<Idct8x8Param> {
|
2014-10-24 09:48:02 +02:00
|
|
|
public:
|
|
|
|
virtual ~InvTrans8x8DCT() {}
|
|
|
|
|
|
|
|
virtual void SetUp() {
|
|
|
|
ref_txfm_ = GET_PARAM(0);
|
|
|
|
inv_txfm_ = GET_PARAM(1);
|
|
|
|
thresh_ = GET_PARAM(2);
|
|
|
|
pitch_ = 8;
|
|
|
|
bit_depth_ = GET_PARAM(3);
|
|
|
|
mask_ = (1 << bit_depth_) - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void TearDown() { libvpx_test::ClearSystemState(); }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void RunInvTxfm(tran_low_t *out, uint8_t *dst, int stride) {
|
|
|
|
inv_txfm_(out, dst, stride);
|
|
|
|
}
|
2016-02-12 03:27:00 +01:00
|
|
|
void RunFwdTxfm(int16_t * /*out*/, tran_low_t * /*dst*/, int /*stride*/) {}
|
2014-10-24 09:48:02 +02:00
|
|
|
|
|
|
|
IdctFunc ref_txfm_;
|
|
|
|
IdctFunc inv_txfm_;
|
|
|
|
int thresh_;
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_P(InvTrans8x8DCT, CompareReference) {
|
|
|
|
CompareInvReference(ref_txfm_, thresh_);
|
|
|
|
}
|
|
|
|
|
2013-09-17 01:01:50 +02:00
|
|
|
using std::tr1::make_tuple;
|
|
|
|
|
2014-09-03 01:34:09 +02:00
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
2013-09-17 01:01:50 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
C, FwdTrans8x8DCT,
|
|
|
|
::testing::Values(
|
2015-08-03 23:51:10 +02:00
|
|
|
make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c, 0, VPX_BITS_8),
|
2015-07-29 00:57:40 +02:00
|
|
|
make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_10, 0, VPX_BITS_10),
|
|
|
|
make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_12, 0, VPX_BITS_12)));
|
2014-09-03 01:34:09 +02:00
|
|
|
#else
|
2016-07-26 07:50:48 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(C, FwdTrans8x8DCT,
|
|
|
|
::testing::Values(make_tuple(&vpx_fdct8x8_c,
|
|
|
|
&vpx_idct8x8_64_add_c, 0,
|
|
|
|
VPX_BITS_8)));
|
2014-10-24 09:48:02 +02:00
|
|
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
2014-09-03 01:34:09 +02:00
|
|
|
|
|
|
|
#if CONFIG_VP9_HIGHBITDEPTH
|
2013-09-17 01:01:50 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
C, FwdTrans8x8HT,
|
|
|
|
::testing::Values(
|
2014-12-05 01:46:06 +01:00
|
|
|
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8),
|
2014-10-08 21:43:22 +02:00
|
|
|
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_10, 0, VPX_BITS_10),
|
|
|
|
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_10, 1, VPX_BITS_10),
|
|
|
|
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_10, 2, VPX_BITS_10),
|
|
|
|
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_10, 3, VPX_BITS_10),
|
|
|
|
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_12, 0, VPX_BITS_12),
|
|
|
|
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_12, 1, VPX_BITS_12),
|
|
|
|
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_12, 2, VPX_BITS_12),
|
|
|
|
make_tuple(&vp9_highbd_fht8x8_c, &iht8x8_12, 3, VPX_BITS_12),
|
2014-09-03 01:34:09 +02:00
|
|
|
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 1, VPX_BITS_8),
|
|
|
|
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 2, VPX_BITS_8),
|
|
|
|
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 3, VPX_BITS_8)));
|
|
|
|
#else
|
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
C, FwdTrans8x8HT,
|
|
|
|
::testing::Values(
|
2014-12-05 01:46:06 +01:00
|
|
|
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8),
|
2014-09-03 01:34:09 +02:00
|
|
|
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 1, VPX_BITS_8),
|
|
|
|
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 2, VPX_BITS_8),
|
|
|
|
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_c, 3, VPX_BITS_8)));
|
2014-10-24 09:48:02 +02:00
|
|
|
#endif // CONFIG_VP9_HIGHBITDEPTH
|
2013-09-17 01:01:50 +02:00
|
|
|
|
2014-10-03 00:43:27 +02:00
|
|
|
#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
2016-07-26 07:50:48 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(NEON, FwdTrans8x8DCT,
|
|
|
|
::testing::Values(make_tuple(&vpx_fdct8x8_neon,
|
|
|
|
&vpx_idct8x8_64_add_neon,
|
|
|
|
0, VPX_BITS_8)));
|
2014-01-28 18:31:07 +01:00
|
|
|
#endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
|
|
|
|
|
|
|
#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
2014-02-26 08:11:49 +01:00
|
|
|
INSTANTIATE_TEST_CASE_P(
|
2014-12-05 01:46:06 +01:00
|
|
|
NEON, FwdTrans8x8HT,
|
2014-02-26 08:11:49 +01:00
|
|
|
::testing::Values(
|
2014-09-03 01:34:09 +02:00
|
|
|
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 0, VPX_BITS_8),
|
|
|
|
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 1, VPX_BITS_8),
|
|
|
|
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 2, VPX_BITS_8),
|
|
|
|
make_tuple(&vp9_fht8x8_c, &vp9_iht8x8_64_add_neon, 3, VPX_BITS_8)));
|
2014-01-28 18:31:07 +01:00
|
|
|
#endif // HAVE_NEON && !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
|
2016-07-26 07:50:48 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(SSE2, FwdTrans8x8DCT,
|
|
|
|
::testing::Values(make_tuple(&vpx_fdct8x8_sse2,
|
|
|
|
&vpx_idct8x8_64_add_sse2,
|
|
|
|
0, VPX_BITS_8)));
|
2013-09-17 01:01:50 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
SSE2, FwdTrans8x8HT,
|
|
|
|
::testing::Values(
|
2014-12-05 01:46:06 +01:00
|
|
|
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 0, VPX_BITS_8),
|
2014-09-03 01:34:09 +02:00
|
|
|
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 1, VPX_BITS_8),
|
|
|
|
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 2, VPX_BITS_8),
|
|
|
|
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_sse2, 3, 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, FwdTrans8x8DCT,
|
2016-07-26 07:50:48 +02:00
|
|
|
::testing::Values(make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_c, 0,
|
|
|
|
VPX_BITS_8),
|
|
|
|
make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_64_add_10_sse2,
|
|
|
|
12, VPX_BITS_10),
|
|
|
|
make_tuple(&vpx_highbd_fdct8x8_sse2,
|
|
|
|
&idct8x8_64_add_10_sse2, 12, VPX_BITS_10),
|
|
|
|
make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_64_add_12_sse2,
|
|
|
|
12, VPX_BITS_12),
|
|
|
|
make_tuple(&vpx_highbd_fdct8x8_sse2,
|
|
|
|
&idct8x8_64_add_12_sse2, 12, VPX_BITS_12)));
|
2014-10-24 09:48:02 +02:00
|
|
|
|
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
SSE2, FwdTrans8x8HT,
|
|
|
|
::testing::Values(
|
2014-12-05 01:46:06 +01:00
|
|
|
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_c, 0, VPX_BITS_8),
|
2014-10-24 09:48:02 +02:00
|
|
|
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_c, 1, VPX_BITS_8),
|
|
|
|
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_c, 2, VPX_BITS_8),
|
|
|
|
make_tuple(&vp9_fht8x8_sse2, &vp9_iht8x8_64_add_c, 3, VPX_BITS_8)));
|
|
|
|
|
|
|
|
// Optimizations take effect at a threshold of 6201, so we use a value close to
|
|
|
|
// that to test both branches.
|
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
SSE2, InvTrans8x8DCT,
|
|
|
|
::testing::Values(
|
2016-11-04 17:44:22 +01:00
|
|
|
make_tuple(&idct8x8_12_add_10_c, &idct8x8_12_add_10_sse2, 6225,
|
2016-07-26 07:50:48 +02:00
|
|
|
VPX_BITS_10),
|
|
|
|
make_tuple(&idct8x8_10, &idct8x8_64_add_10_sse2, 6225, VPX_BITS_10),
|
2016-11-04 17:44:22 +01:00
|
|
|
make_tuple(&idct8x8_12_add_12_c, &idct8x8_12_add_12_sse2, 6225,
|
2016-07-26 07:50:48 +02:00
|
|
|
VPX_BITS_12),
|
|
|
|
make_tuple(&idct8x8_12, &idct8x8_64_add_12_sse2, 6225, VPX_BITS_12)));
|
2014-10-24 09:48:02 +02:00
|
|
|
#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
2014-05-08 18:56:38 +02:00
|
|
|
|
2016-07-26 07:50:48 +02:00
|
|
|
#if HAVE_SSSE3 && ARCH_X86_64 && !CONFIG_VP9_HIGHBITDEPTH && \
|
|
|
|
!CONFIG_EMULATE_HARDWARE
|
|
|
|
INSTANTIATE_TEST_CASE_P(SSSE3, FwdTrans8x8DCT,
|
|
|
|
::testing::Values(make_tuple(&vpx_fdct8x8_ssse3,
|
|
|
|
&vpx_idct8x8_64_add_ssse3,
|
|
|
|
0, VPX_BITS_8)));
|
2014-05-08 18:56:38 +02:00
|
|
|
#endif
|
2015-05-08 08:53:27 +02:00
|
|
|
|
2015-07-22 20:53:21 +02:00
|
|
|
#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
2016-07-26 07:50:48 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(MSA, FwdTrans8x8DCT,
|
|
|
|
::testing::Values(make_tuple(&vpx_fdct8x8_msa,
|
|
|
|
&vpx_idct8x8_64_add_msa, 0,
|
|
|
|
VPX_BITS_8)));
|
2015-05-08 08:53:27 +02:00
|
|
|
INSTANTIATE_TEST_CASE_P(
|
|
|
|
MSA, FwdTrans8x8HT,
|
|
|
|
::testing::Values(
|
2015-06-18 08:33:30 +02:00
|
|
|
make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 0, VPX_BITS_8),
|
|
|
|
make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 1, VPX_BITS_8),
|
|
|
|
make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 2, VPX_BITS_8),
|
|
|
|
make_tuple(&vp9_fht8x8_msa, &vp9_iht8x8_64_add_msa, 3, VPX_BITS_8)));
|
2015-05-08 08:53:27 +02:00
|
|
|
#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
|
2012-06-29 01:26:31 +02:00
|
|
|
} // namespace
|