summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2018-06-01 23:22:48 -0700
committerJames Zern <jzern@google.com>2018-06-04 16:14:33 -0700
commit3a0dc0e4b74d83644e687ef84c8314ce56f87816 (patch)
tree37960e6625f93e89b8a45323dd130f406d305ad8 /test
parent3f7e6cc020446ee29439f1cd7d3d5c39adaf64c0 (diff)
downloadlibvpx-3a0dc0e4b74d83644e687ef84c8314ce56f87816.tar
libvpx-3a0dc0e4b74d83644e687ef84c8314ce56f87816.tar.gz
libvpx-3a0dc0e4b74d83644e687ef84c8314ce56f87816.tar.bz2
libvpx-3a0dc0e4b74d83644e687ef84c8314ce56f87816.zip
test,cosmetics: fix func/member naming, decl order
functions: upper camelcase members: lowercase with trailing '_' decl order: functions (overrides marked virtual), members after: 656e8ac61 VSX version of vpx_post_proc_down_and_across_mb_row 766d875b9 VSX version of vpx_mbpost_proc_ip 35e98a70b VSX version of vpx_mbpost_proc_down b2898a9ad Bench Class For More Robust Speed Tests Change-Id: Ib257bd607c5c1248d30e619ec9e8a47cc629825b
Diffstat (limited to 'test')
-rw-r--r--test/bench.cc14
-rw-r--r--test/bench.h8
-rw-r--r--test/pp_filter_test.cc282
-rw-r--r--test/vp9_quantize_test.cc141
4 files changed, 227 insertions, 218 deletions
diff --git a/test/bench.cc b/test/bench.cc
index 281b7411d..4b883d825 100644
--- a/test/bench.cc
+++ b/test/bench.cc
@@ -14,24 +14,24 @@
#include "test/bench.h"
#include "vpx_ports/vpx_timer.h"
-void AbstractBench::runNTimes(int n) {
+void AbstractBench::RunNTimes(int n) {
for (int r = 0; r < VPX_BENCH_ROBUST_ITER; r++) {
vpx_usec_timer timer;
vpx_usec_timer_start(&timer);
for (int j = 0; j < n; ++j) {
- run();
+ Run();
}
vpx_usec_timer_mark(&timer);
- times[r] = static_cast<int>(vpx_usec_timer_elapsed(&timer));
+ times_[r] = static_cast<int>(vpx_usec_timer_elapsed(&timer));
}
}
-void AbstractBench::printMedian(const char *title) {
- std::sort(times, times + VPX_BENCH_ROBUST_ITER);
- const int med = times[VPX_BENCH_ROBUST_ITER >> 1];
+void AbstractBench::PrintMedian(const char *title) {
+ std::sort(times_, times_ + VPX_BENCH_ROBUST_ITER);
+ const int med = times_[VPX_BENCH_ROBUST_ITER >> 1];
int sad = 0;
for (int t = 0; t < VPX_BENCH_ROBUST_ITER; t++) {
- sad += abs(times[t] - med);
+ sad += abs(times_[t] - med);
}
printf("[%10s] %s %.1f ms ( ±%.1f ms )\n", "BENCH ", title, med / 1000.0,
sad / (VPX_BENCH_ROBUST_ITER * 1000.0));
diff --git a/test/bench.h b/test/bench.h
index 0b0cf10a4..6fe5e0b03 100644
--- a/test/bench.h
+++ b/test/bench.h
@@ -16,15 +16,15 @@
class AbstractBench {
public:
- void runNTimes(int n);
- void printMedian(const char *title);
+ void RunNTimes(int n);
+ void PrintMedian(const char *title);
protected:
// Implement this method and put the code to benchmark in it.
- virtual void run() = 0;
+ virtual void Run() = 0;
private:
- int times[VPX_BENCH_ROBUST_ITER];
+ int times_[VPX_BENCH_ROBUST_ITER];
};
#endif // TEST_BENCH_H_
diff --git a/test/pp_filter_test.cc b/test/pp_filter_test.cc
index 1fe0348fc..1ed261bf9 100644
--- a/test/pp_filter_test.cc
+++ b/test/pp_filter_test.cc
@@ -45,24 +45,26 @@ class VpxPostProcDownAndAcrossMbRowTest
: public AbstractBench,
public ::testing::TestWithParam<VpxPostProcDownAndAcrossMbRowFunc> {
public:
- VpxPostProcDownAndAcrossMbRowTest() : mbPostProcDownAndAcross(GetParam()) {}
+ VpxPostProcDownAndAcrossMbRowTest()
+ : mb_post_proc_down_and_across_(GetParam()) {}
virtual void TearDown() { libvpx_test::ClearSystemState(); }
protected:
- const VpxPostProcDownAndAcrossMbRowFunc mbPostProcDownAndAcross;
+ virtual void Run();
+
+ const VpxPostProcDownAndAcrossMbRowFunc mb_post_proc_down_and_across_;
// Size of the underlying data block that will be filtered.
- int block_width;
- int block_height;
- Buffer<uint8_t> *src_image;
- Buffer<uint8_t> *dst_image;
- uint8_t *flimits;
- void run();
+ int block_width_;
+ int block_height_;
+ Buffer<uint8_t> *src_image_;
+ Buffer<uint8_t> *dst_image_;
+ uint8_t *flimits_;
};
-void VpxPostProcDownAndAcrossMbRowTest::run() {
- mbPostProcDownAndAcross(src_image->TopLeftPixel(), dst_image->TopLeftPixel(),
- src_image->stride(), dst_image->stride(), block_width,
- flimits, 16);
+void VpxPostProcDownAndAcrossMbRowTest::Run() {
+ mb_post_proc_down_and_across_(
+ src_image_->TopLeftPixel(), dst_image_->TopLeftPixel(),
+ src_image_->stride(), dst_image_->stride(), block_width_, flimits_, 16);
}
// Test routine for the VPx post-processing function
@@ -70,22 +72,22 @@ void VpxPostProcDownAndAcrossMbRowTest::run() {
TEST_P(VpxPostProcDownAndAcrossMbRowTest, CheckFilterOutput) {
// Size of the underlying data block that will be filtered.
- block_width = 16;
- block_height = 16;
+ block_width_ = 16;
+ block_height_ = 16;
// 5-tap filter needs 2 padding rows above and below the block in the input.
- Buffer<uint8_t> src_image = Buffer<uint8_t>(block_width, block_height, 2);
+ Buffer<uint8_t> src_image = Buffer<uint8_t>(block_width_, block_height_, 2);
ASSERT_TRUE(src_image.Init());
// Filter extends output block by 8 samples at left and right edges.
// Though the left padding is only 8 bytes, the assembly code tries to
// read 16 bytes before the pointer.
Buffer<uint8_t> dst_image =
- Buffer<uint8_t>(block_width, block_height, 8, 16, 8, 8);
+ Buffer<uint8_t>(block_width_, block_height_, 8, 16, 8, 8);
ASSERT_TRUE(dst_image.Init());
- flimits = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_width));
- (void)memset(flimits, 255, block_width);
+ flimits_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_width_));
+ (void)memset(flimits_, 255, block_width_);
// Initialize pixels in the input:
// block pixels to value 1,
@@ -96,36 +98,36 @@ TEST_P(VpxPostProcDownAndAcrossMbRowTest, CheckFilterOutput) {
// Initialize pixels in the output to 99.
dst_image.Set(99);
- ASM_REGISTER_STATE_CHECK(mbPostProcDownAndAcross(
+ ASM_REGISTER_STATE_CHECK(mb_post_proc_down_and_across_(
src_image.TopLeftPixel(), dst_image.TopLeftPixel(), src_image.stride(),
- dst_image.stride(), block_width, flimits, 16));
+ dst_image.stride(), block_width_, flimits_, 16));
static const uint8_t kExpectedOutput[] = { 4, 3, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 3, 4 };
uint8_t *pixel_ptr = dst_image.TopLeftPixel();
- for (int i = 0; i < block_height; ++i) {
- for (int j = 0; j < block_width; ++j) {
+ for (int i = 0; i < block_height_; ++i) {
+ for (int j = 0; j < block_width_; ++j) {
ASSERT_EQ(kExpectedOutput[i], pixel_ptr[j])
<< "at (" << i << ", " << j << ")";
}
pixel_ptr += dst_image.stride();
}
- vpx_free(flimits);
+ vpx_free(flimits_);
};
TEST_P(VpxPostProcDownAndAcrossMbRowTest, CheckCvsAssembly) {
// Size of the underlying data block that will be filtered.
// Y blocks are always a multiple of 16 wide and exactly 16 high. U and V
// blocks are always a multiple of 8 wide and exactly 8 high.
- block_width = 136;
- block_height = 16;
+ block_width_ = 136;
+ block_height_ = 16;
// 5-tap filter needs 2 padding rows above and below the block in the input.
// SSE2 reads in blocks of 16. Pad an extra 8 in case the width is not %16.
Buffer<uint8_t> src_image =
- Buffer<uint8_t>(block_width, block_height, 2, 2, 10, 2);
+ Buffer<uint8_t>(block_width_, block_height_, 2, 2, 10, 2);
ASSERT_TRUE(src_image.Init());
// Filter extends output block by 8 samples at left and right edges.
@@ -134,16 +136,17 @@ TEST_P(VpxPostProcDownAndAcrossMbRowTest, CheckCvsAssembly) {
// not a problem.
// SSE2 reads in blocks of 16. Pad an extra 8 in case the width is not %16.
Buffer<uint8_t> dst_image =
- Buffer<uint8_t>(block_width, block_height, 8, 8, 16, 8);
+ Buffer<uint8_t>(block_width_, block_height_, 8, 8, 16, 8);
ASSERT_TRUE(dst_image.Init());
- Buffer<uint8_t> dst_image_ref = Buffer<uint8_t>(block_width, block_height, 8);
+ Buffer<uint8_t> dst_image_ref =
+ Buffer<uint8_t>(block_width_, block_height_, 8);
ASSERT_TRUE(dst_image_ref.Init());
// Filter values are set in blocks of 16 for Y and 8 for U/V. Each macroblock
// can have a different filter. SSE2 assembly reads flimits in blocks of 16 so
// it must be padded out.
- const int flimits_width = block_width % 16 ? block_width + 8 : block_width;
- flimits = reinterpret_cast<uint8_t *>(vpx_memalign(16, flimits_width));
+ const int flimits_width = block_width_ % 16 ? block_width_ + 8 : block_width_;
+ flimits_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, flimits_width));
ACMRandom rnd;
rnd.Reset(ACMRandom::DeterministicSeed());
@@ -153,50 +156,50 @@ TEST_P(VpxPostProcDownAndAcrossMbRowTest, CheckCvsAssembly) {
src_image.SetPadding(10);
src_image.Set(&rnd, &ACMRandom::Rand8);
- for (int blocks = 0; blocks < block_width; blocks += 8) {
- (void)memset(flimits, 0, sizeof(*flimits) * flimits_width);
+ for (int blocks = 0; blocks < block_width_; blocks += 8) {
+ (void)memset(flimits_, 0, sizeof(*flimits_) * flimits_width);
for (int f = 0; f < 255; f++) {
- (void)memset(flimits + blocks, f, sizeof(*flimits) * 8);
+ (void)memset(flimits_ + blocks, f, sizeof(*flimits_) * 8);
dst_image.Set(0);
dst_image_ref.Set(0);
vpx_post_proc_down_and_across_mb_row_c(
src_image.TopLeftPixel(), dst_image_ref.TopLeftPixel(),
- src_image.stride(), dst_image_ref.stride(), block_width, flimits,
- block_height);
- ASM_REGISTER_STATE_CHECK(mbPostProcDownAndAcross(
+ src_image.stride(), dst_image_ref.stride(), block_width_, flimits_,
+ block_height_);
+ ASM_REGISTER_STATE_CHECK(mb_post_proc_down_and_across_(
src_image.TopLeftPixel(), dst_image.TopLeftPixel(),
- src_image.stride(), dst_image.stride(), block_width, flimits,
- block_height));
+ src_image.stride(), dst_image.stride(), block_width_, flimits_,
+ block_height_));
ASSERT_TRUE(dst_image.CheckValues(dst_image_ref));
}
}
- vpx_free(flimits);
+ vpx_free(flimits_);
}
TEST_P(VpxPostProcDownAndAcrossMbRowTest, DISABLED_Speed) {
// Size of the underlying data block that will be filtered.
- block_width = 16;
- block_height = 16;
+ block_width_ = 16;
+ block_height_ = 16;
// 5-tap filter needs 2 padding rows above and below the block in the input.
- Buffer<uint8_t> src_image = Buffer<uint8_t>(block_width, block_height, 2);
+ Buffer<uint8_t> src_image = Buffer<uint8_t>(block_width_, block_height_, 2);
ASSERT_TRUE(src_image.Init());
- this->src_image = &src_image;
+ this->src_image_ = &src_image;
// Filter extends output block by 8 samples at left and right edges.
// Though the left padding is only 8 bytes, the assembly code tries to
// read 16 bytes before the pointer.
Buffer<uint8_t> dst_image =
- Buffer<uint8_t>(block_width, block_height, 8, 16, 8, 8);
+ Buffer<uint8_t>(block_width_, block_height_, 8, 16, 8, 8);
ASSERT_TRUE(dst_image.Init());
- this->dst_image = &dst_image;
+ this->dst_image_ = &dst_image;
- flimits = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_width));
- (void)memset(flimits, 255, block_width);
+ flimits_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_width_));
+ (void)memset(flimits_, 255, block_width_);
// Initialize pixels in the input:
// block pixels to value 1,
@@ -207,10 +210,10 @@ TEST_P(VpxPostProcDownAndAcrossMbRowTest, DISABLED_Speed) {
// Initialize pixels in the output to 99.
dst_image.Set(99);
- runNTimes(INT16_MAX);
- printMedian("16x16");
+ RunNTimes(INT16_MAX);
+ PrintMedian("16x16");
- vpx_free(flimits);
+ vpx_free(flimits_);
};
class VpxMbPostProcAcrossIpTest
@@ -218,16 +221,12 @@ class VpxMbPostProcAcrossIpTest
public ::testing::TestWithParam<VpxMbPostProcAcrossIpFunc> {
public:
VpxMbPostProcAcrossIpTest()
- : rows(16), cols(16), mbPostProcAcrossIp(GetParam()),
- src(Buffer<uint8_t>(rows, cols, 8, 8, 17, 8)) {}
+ : rows_(16), cols_(16), mb_post_proc_across_ip_(GetParam()),
+ src_(Buffer<uint8_t>(rows_, cols_, 8, 8, 17, 8)) {}
virtual void TearDown() { libvpx_test::ClearSystemState(); }
protected:
- const int rows;
- const int cols;
- const VpxMbPostProcAcrossIpFunc mbPostProcAcrossIp;
- Buffer<uint8_t> src;
- void run();
+ virtual void Run();
void SetCols(unsigned char *s, int rows, int cols, int src_width) {
for (int r = 0; r < rows; r++) {
@@ -255,60 +254,67 @@ class VpxMbPostProcAcrossIpTest
GetParam()(s, src_width, rows, cols, filter_level));
RunComparison(expected_output, s, rows, cols, src_width);
}
+
+ const int rows_;
+ const int cols_;
+ const VpxMbPostProcAcrossIpFunc mb_post_proc_across_ip_;
+ Buffer<uint8_t> src_;
};
-void VpxMbPostProcAcrossIpTest::run() {
- mbPostProcAcrossIp(src.TopLeftPixel(), src.stride(), rows, cols, q2mbl(0));
+void VpxMbPostProcAcrossIpTest::Run() {
+ mb_post_proc_across_ip_(src_.TopLeftPixel(), src_.stride(), rows_, cols_,
+ q2mbl(0));
}
TEST_P(VpxMbPostProcAcrossIpTest, CheckLowFilterOutput) {
- ASSERT_TRUE(src.Init());
- src.SetPadding(10);
- SetCols(src.TopLeftPixel(), rows, cols, src.stride());
+ ASSERT_TRUE(src_.Init());
+ src_.SetPadding(10);
+ SetCols(src_.TopLeftPixel(), rows_, cols_, src_.stride());
- Buffer<uint8_t> expected_output = Buffer<uint8_t>(cols, rows, 0);
+ Buffer<uint8_t> expected_output = Buffer<uint8_t>(cols_, rows_, 0);
ASSERT_TRUE(expected_output.Init());
- SetCols(expected_output.TopLeftPixel(), rows, cols, expected_output.stride());
+ SetCols(expected_output.TopLeftPixel(), rows_, cols_,
+ expected_output.stride());
- RunFilterLevel(src.TopLeftPixel(), rows, cols, src.stride(), q2mbl(0),
+ RunFilterLevel(src_.TopLeftPixel(), rows_, cols_, src_.stride(), q2mbl(0),
expected_output.TopLeftPixel());
}
TEST_P(VpxMbPostProcAcrossIpTest, CheckMediumFilterOutput) {
- ASSERT_TRUE(src.Init());
- src.SetPadding(10);
- SetCols(src.TopLeftPixel(), rows, cols, src.stride());
+ ASSERT_TRUE(src_.Init());
+ src_.SetPadding(10);
+ SetCols(src_.TopLeftPixel(), rows_, cols_, src_.stride());
static const unsigned char kExpectedOutput[] = {
2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 13
};
- RunFilterLevel(src.TopLeftPixel(), rows, cols, src.stride(), q2mbl(70),
+ RunFilterLevel(src_.TopLeftPixel(), rows_, cols_, src_.stride(), q2mbl(70),
kExpectedOutput);
}
TEST_P(VpxMbPostProcAcrossIpTest, CheckHighFilterOutput) {
- ASSERT_TRUE(src.Init());
- src.SetPadding(10);
- SetCols(src.TopLeftPixel(), rows, cols, src.stride());
+ ASSERT_TRUE(src_.Init());
+ src_.SetPadding(10);
+ SetCols(src_.TopLeftPixel(), rows_, cols_, src_.stride());
static const unsigned char kExpectedOutput[] = {
2, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12, 13, 13
};
- RunFilterLevel(src.TopLeftPixel(), rows, cols, src.stride(), INT_MAX,
+ RunFilterLevel(src_.TopLeftPixel(), rows_, cols_, src_.stride(), INT_MAX,
kExpectedOutput);
- SetCols(src.TopLeftPixel(), rows, cols, src.stride());
+ SetCols(src_.TopLeftPixel(), rows_, cols_, src_.stride());
- RunFilterLevel(src.TopLeftPixel(), rows, cols, src.stride(), q2mbl(100),
+ RunFilterLevel(src_.TopLeftPixel(), rows_, cols_, src_.stride(), q2mbl(100),
kExpectedOutput);
}
TEST_P(VpxMbPostProcAcrossIpTest, CheckCvsAssembly) {
- Buffer<uint8_t> c_mem = Buffer<uint8_t>(cols, rows, 8, 8, 17, 8);
+ Buffer<uint8_t> c_mem = Buffer<uint8_t>(cols_, rows_, 8, 8, 17, 8);
ASSERT_TRUE(c_mem.Init());
- Buffer<uint8_t> asm_mem = Buffer<uint8_t>(cols, rows, 8, 8, 17, 8);
+ Buffer<uint8_t> asm_mem = Buffer<uint8_t>(cols_, rows_, 8, 8, 17, 8);
ASSERT_TRUE(asm_mem.Init());
// When level >= 100, the filter behaves the same as the level = INT_MAX
@@ -316,26 +322,26 @@ TEST_P(VpxMbPostProcAcrossIpTest, CheckCvsAssembly) {
for (int level = 0; level < 100; level++) {
c_mem.SetPadding(10);
asm_mem.SetPadding(10);
- SetCols(c_mem.TopLeftPixel(), rows, cols, c_mem.stride());
- SetCols(asm_mem.TopLeftPixel(), rows, cols, asm_mem.stride());
+ SetCols(c_mem.TopLeftPixel(), rows_, cols_, c_mem.stride());
+ SetCols(asm_mem.TopLeftPixel(), rows_, cols_, asm_mem.stride());
- vpx_mbpost_proc_across_ip_c(c_mem.TopLeftPixel(), c_mem.stride(), rows,
- cols, q2mbl(level));
+ vpx_mbpost_proc_across_ip_c(c_mem.TopLeftPixel(), c_mem.stride(), rows_,
+ cols_, q2mbl(level));
ASM_REGISTER_STATE_CHECK(GetParam()(
- asm_mem.TopLeftPixel(), asm_mem.stride(), rows, cols, q2mbl(level)));
+ asm_mem.TopLeftPixel(), asm_mem.stride(), rows_, cols_, q2mbl(level)));
ASSERT_TRUE(asm_mem.CheckValues(c_mem));
}
}
TEST_P(VpxMbPostProcAcrossIpTest, DISABLED_Speed) {
- ASSERT_TRUE(src.Init());
- src.SetPadding(10);
+ ASSERT_TRUE(src_.Init());
+ src_.SetPadding(10);
- SetCols(src.TopLeftPixel(), rows, cols, src.stride());
+ SetCols(src_.TopLeftPixel(), rows_, cols_, src_.stride());
- runNTimes(100000);
- printMedian("16x16");
+ RunNTimes(100000);
+ PrintMedian("16x16");
}
class VpxMbPostProcDownTest
@@ -343,17 +349,13 @@ class VpxMbPostProcDownTest
public ::testing::TestWithParam<VpxMbPostProcDownFunc> {
public:
VpxMbPostProcDownTest()
- : rows(16), cols(16), mbPostProcDown(GetParam()),
- src_c(Buffer<uint8_t>(rows, cols, 8, 8, 8, 17)) {}
+ : rows_(16), cols_(16), mb_post_proc_down_(GetParam()),
+ src_c_(Buffer<uint8_t>(rows_, cols_, 8, 8, 8, 17)) {}
virtual void TearDown() { libvpx_test::ClearSystemState(); }
protected:
- const int rows;
- const int cols;
- const VpxMbPostProcDownFunc mbPostProcDown;
- Buffer<uint8_t> src_c;
- void run();
+ virtual void Run();
void SetRows(unsigned char *src_c, int rows, int cols, int src_width) {
for (int r = 0; r < rows; r++) {
@@ -376,20 +378,26 @@ class VpxMbPostProcDownTest
void RunFilterLevel(unsigned char *s, int rows, int cols, int src_width,
int filter_level, const unsigned char *expected_output) {
ASM_REGISTER_STATE_CHECK(
- mbPostProcDown(s, src_width, rows, cols, filter_level));
+ mb_post_proc_down_(s, src_width, rows, cols, filter_level));
RunComparison(expected_output, s, rows, cols, src_width);
}
+
+ const int rows_;
+ const int cols_;
+ const VpxMbPostProcDownFunc mb_post_proc_down_;
+ Buffer<uint8_t> src_c_;
};
-void VpxMbPostProcDownTest::run() {
- mbPostProcDown(src_c.TopLeftPixel(), src_c.stride(), rows, cols, q2mbl(0));
+void VpxMbPostProcDownTest::Run() {
+ mb_post_proc_down_(src_c_.TopLeftPixel(), src_c_.stride(), rows_, cols_,
+ q2mbl(0));
}
TEST_P(VpxMbPostProcDownTest, CheckHighFilterOutput) {
- ASSERT_TRUE(src_c.Init());
- src_c.SetPadding(10);
+ ASSERT_TRUE(src_c_.Init());
+ src_c_.SetPadding(10);
- SetRows(src_c.TopLeftPixel(), rows, cols, src_c.stride());
+ SetRows(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride());
static const unsigned char kExpectedOutput[] = {
2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2,
@@ -408,20 +416,20 @@ TEST_P(VpxMbPostProcDownTest, CheckHighFilterOutput) {
13, 13, 13, 13, 14, 13, 13, 13, 13
};
- RunFilterLevel(src_c.TopLeftPixel(), rows, cols, src_c.stride(), INT_MAX,
+ RunFilterLevel(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride(), INT_MAX,
kExpectedOutput);
- src_c.SetPadding(10);
- SetRows(src_c.TopLeftPixel(), rows, cols, src_c.stride());
- RunFilterLevel(src_c.TopLeftPixel(), rows, cols, src_c.stride(), q2mbl(100),
- kExpectedOutput);
+ src_c_.SetPadding(10);
+ SetRows(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride());
+ RunFilterLevel(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride(),
+ q2mbl(100), kExpectedOutput);
}
TEST_P(VpxMbPostProcDownTest, CheckMediumFilterOutput) {
- ASSERT_TRUE(src_c.Init());
- src_c.SetPadding(10);
+ ASSERT_TRUE(src_c_.Init());
+ src_c_.SetPadding(10);
- SetRows(src_c.TopLeftPixel(), rows, cols, src_c.stride());
+ SetRows(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride());
static const unsigned char kExpectedOutput[] = {
2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2,
@@ -440,21 +448,21 @@ TEST_P(VpxMbPostProcDownTest, CheckMediumFilterOutput) {
13, 13, 13, 13, 14, 13, 13, 13, 13
};
- RunFilterLevel(src_c.TopLeftPixel(), rows, cols, src_c.stride(), q2mbl(70),
- kExpectedOutput);
+ RunFilterLevel(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride(),
+ q2mbl(70), kExpectedOutput);
}
TEST_P(VpxMbPostProcDownTest, CheckLowFilterOutput) {
- ASSERT_TRUE(src_c.Init());
- src_c.SetPadding(10);
+ ASSERT_TRUE(src_c_.Init());
+ src_c_.SetPadding(10);
- SetRows(src_c.TopLeftPixel(), rows, cols, src_c.stride());
+ SetRows(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride());
- unsigned char *expected_output = new unsigned char[rows * cols];
+ unsigned char *expected_output = new unsigned char[rows_ * cols_];
ASSERT_TRUE(expected_output != NULL);
- SetRows(expected_output, rows, cols, cols);
+ SetRows(expected_output, rows_, cols_, cols_);
- RunFilterLevel(src_c.TopLeftPixel(), rows, cols, src_c.stride(), q2mbl(0),
+ RunFilterLevel(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride(), q2mbl(0),
expected_output);
delete[] expected_output;
@@ -464,43 +472,43 @@ TEST_P(VpxMbPostProcDownTest, CheckCvsAssembly) {
ACMRandom rnd;
rnd.Reset(ACMRandom::DeterministicSeed());
- ASSERT_TRUE(src_c.Init());
- Buffer<uint8_t> src_asm = Buffer<uint8_t>(cols, rows, 8, 8, 8, 17);
+ ASSERT_TRUE(src_c_.Init());
+ Buffer<uint8_t> src_asm = Buffer<uint8_t>(cols_, rows_, 8, 8, 8, 17);
ASSERT_TRUE(src_asm.Init());
for (int level = 0; level < 100; level++) {
- src_c.SetPadding(10);
+ src_c_.SetPadding(10);
src_asm.SetPadding(10);
- src_c.Set(&rnd, &ACMRandom::Rand8);
- src_asm.CopyFrom(src_c);
+ src_c_.Set(&rnd, &ACMRandom::Rand8);
+ src_asm.CopyFrom(src_c_);
- vpx_mbpost_proc_down_c(src_c.TopLeftPixel(), src_c.stride(), rows, cols,
+ vpx_mbpost_proc_down_c(src_c_.TopLeftPixel(), src_c_.stride(), rows_, cols_,
q2mbl(level));
- ASM_REGISTER_STATE_CHECK(mbPostProcDown(
- src_asm.TopLeftPixel(), src_asm.stride(), rows, cols, q2mbl(level)));
- ASSERT_TRUE(src_asm.CheckValues(src_c));
+ ASM_REGISTER_STATE_CHECK(mb_post_proc_down_(
+ src_asm.TopLeftPixel(), src_asm.stride(), rows_, cols_, q2mbl(level)));
+ ASSERT_TRUE(src_asm.CheckValues(src_c_));
- src_c.SetPadding(10);
+ src_c_.SetPadding(10);
src_asm.SetPadding(10);
- src_c.Set(&rnd, &ACMRandom::Rand8Extremes);
- src_asm.CopyFrom(src_c);
+ src_c_.Set(&rnd, &ACMRandom::Rand8Extremes);
+ src_asm.CopyFrom(src_c_);
- vpx_mbpost_proc_down_c(src_c.TopLeftPixel(), src_c.stride(), rows, cols,
+ vpx_mbpost_proc_down_c(src_c_.TopLeftPixel(), src_c_.stride(), rows_, cols_,
q2mbl(level));
- ASM_REGISTER_STATE_CHECK(mbPostProcDown(
- src_asm.TopLeftPixel(), src_asm.stride(), rows, cols, q2mbl(level)));
- ASSERT_TRUE(src_asm.CheckValues(src_c));
+ ASM_REGISTER_STATE_CHECK(mb_post_proc_down_(
+ src_asm.TopLeftPixel(), src_asm.stride(), rows_, cols_, q2mbl(level)));
+ ASSERT_TRUE(src_asm.CheckValues(src_c_));
}
}
TEST_P(VpxMbPostProcDownTest, DISABLED_Speed) {
- ASSERT_TRUE(src_c.Init());
- src_c.SetPadding(10);
+ ASSERT_TRUE(src_c_.Init());
+ src_c_.SetPadding(10);
- SetRows(src_c.TopLeftPixel(), rows, cols, src_c.stride());
+ SetRows(src_c_.TopLeftPixel(), rows_, cols_, src_c_.stride());
- runNTimes(100000);
- printMedian("16x16");
+ RunNTimes(100000);
+ PrintMedian("16x16");
}
INSTANTIATE_TEST_CASE_P(
diff --git a/test/vp9_quantize_test.cc b/test/vp9_quantize_test.cc
index c39267faa..aa6aa6275 100644
--- a/test/vp9_quantize_test.cc
+++ b/test/vp9_quantize_test.cc
@@ -72,9 +72,9 @@ class VP9QuantizeBase : public AbstractBench {
public:
VP9QuantizeBase(vpx_bit_depth_t bit_depth, int max_size, bool is_fp)
: bit_depth_(bit_depth), max_size_(max_size), is_fp_(is_fp),
- coeff(Buffer<tran_low_t>(max_size_, max_size_, 0, 16)),
- qcoeff(Buffer<tran_low_t>(max_size_, max_size_, 0, 32)),
- dqcoeff(Buffer<tran_low_t>(max_size_, max_size_, 0, 32)) {
+ coeff_(Buffer<tran_low_t>(max_size_, max_size_, 0, 16)),
+ qcoeff_(Buffer<tran_low_t>(max_size_, max_size_, 0, 32)),
+ dqcoeff_(Buffer<tran_low_t>(max_size_, max_size_, 0, 32)) {
max_value_ = (1 << bit_depth_) - 1;
zbin_ptr_ =
reinterpret_cast<int16_t *>(vpx_memalign(16, 8 * sizeof(*zbin_ptr_)));
@@ -91,8 +91,8 @@ class VP9QuantizeBase : public AbstractBench {
dequant_ptr_ = reinterpret_cast<int16_t *>(
vpx_memalign(16, 8 * sizeof(*dequant_ptr_)));
- r_ptr = (is_fp_) ? round_fp_ptr_ : round_ptr_;
- q_ptr = (is_fp_) ? quant_fp_ptr_ : quant_ptr_;
+ r_ptr_ = (is_fp_) ? round_fp_ptr_ : round_ptr_;
+ q_ptr_ = (is_fp_) ? quant_fp_ptr_ : quant_ptr_;
}
~VP9QuantizeBase() {
@@ -125,15 +125,15 @@ class VP9QuantizeBase : public AbstractBench {
int max_value_;
const int max_size_;
const bool is_fp_;
- Buffer<tran_low_t> coeff;
- Buffer<tran_low_t> qcoeff;
- Buffer<tran_low_t> dqcoeff;
- int16_t *r_ptr;
- int16_t *q_ptr;
- int count;
- int skip_block;
- const scan_order *scan;
- uint16_t eob;
+ Buffer<tran_low_t> coeff_;
+ Buffer<tran_low_t> qcoeff_;
+ Buffer<tran_low_t> dqcoeff_;
+ int16_t *r_ptr_;
+ int16_t *q_ptr_;
+ int count_;
+ int skip_block_;
+ const scan_order *scan_;
+ uint16_t eob_;
};
class VP9QuantizeTest : public VP9QuantizeBase,
@@ -144,15 +144,16 @@ class VP9QuantizeTest : public VP9QuantizeBase,
quantize_op_(GET_PARAM(0)), ref_quantize_op_(GET_PARAM(1)) {}
protected:
- void run();
+ virtual void Run();
const QuantizeFunc quantize_op_;
const QuantizeFunc ref_quantize_op_;
};
-void VP9QuantizeTest::run() {
- quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr, q_ptr,
- quant_shift_ptr_, qcoeff.TopLeftPixel(), dqcoeff.TopLeftPixel(),
- dequant_ptr_, &eob, scan->scan, scan->iscan);
+void VP9QuantizeTest::Run() {
+ quantize_op_(coeff_.TopLeftPixel(), count_, skip_block_, zbin_ptr_, r_ptr_,
+ q_ptr_, quant_shift_ptr_, qcoeff_.TopLeftPixel(),
+ dqcoeff_.TopLeftPixel(), dequant_ptr_, &eob_, scan_->scan,
+ scan_->iscan);
}
// This quantizer compares the AC coefficients to the quantization step size to
@@ -292,9 +293,9 @@ void GenerateHelperArrays(ACMRandom *rnd, int16_t *zbin, int16_t *round,
TEST_P(VP9QuantizeTest, OperationCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
- ASSERT_TRUE(coeff.Init());
- ASSERT_TRUE(qcoeff.Init());
- ASSERT_TRUE(dqcoeff.Init());
+ ASSERT_TRUE(coeff_.Init());
+ ASSERT_TRUE(qcoeff_.Init());
+ ASSERT_TRUE(dqcoeff_.Init());
Buffer<tran_low_t> ref_qcoeff =
Buffer<tran_low_t>(max_size_, max_size_, 0, 32);
ASSERT_TRUE(ref_qcoeff.Init());
@@ -302,7 +303,7 @@ TEST_P(VP9QuantizeTest, OperationCheck) {
Buffer<tran_low_t>(max_size_, max_size_, 0, 32);
ASSERT_TRUE(ref_dqcoeff.Init());
uint16_t ref_eob = 0;
- eob = 0;
+ eob_ = 0;
for (int i = 0; i < number_of_iterations; ++i) {
// Test skip block for the first three iterations to catch all the different
@@ -315,31 +316,31 @@ TEST_P(VP9QuantizeTest, OperationCheck) {
sz = TX_32X32;
}
const TX_TYPE tx_type = static_cast<TX_TYPE>((i >> 2) % 3);
- scan = &vp9_scan_orders[sz][tx_type];
- count = (4 << sz) * (4 << sz);
- coeff.Set(&rnd, -max_value_, max_value_);
+ scan_ = &vp9_scan_orders[sz][tx_type];
+ count_ = (4 << sz) * (4 << sz);
+ coeff_.Set(&rnd, -max_value_, max_value_);
GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_,
quant_shift_ptr_, dequant_ptr_, round_fp_ptr_,
quant_fp_ptr_);
- ref_quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr,
- q_ptr, quant_shift_ptr_, ref_qcoeff.TopLeftPixel(),
- ref_dqcoeff.TopLeftPixel(), dequant_ptr_, &ref_eob,
- scan->scan, scan->iscan);
+ ref_quantize_op_(coeff_.TopLeftPixel(), count_, skip_block, zbin_ptr_,
+ r_ptr_, q_ptr_, quant_shift_ptr_,
+ ref_qcoeff.TopLeftPixel(), ref_dqcoeff.TopLeftPixel(),
+ dequant_ptr_, &ref_eob, scan_->scan, scan_->iscan);
ASM_REGISTER_STATE_CHECK(quantize_op_(
- coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr, q_ptr,
- quant_shift_ptr_, qcoeff.TopLeftPixel(), dqcoeff.TopLeftPixel(),
- dequant_ptr_, &eob, scan->scan, scan->iscan));
+ coeff_.TopLeftPixel(), count_, skip_block, zbin_ptr_, r_ptr_, q_ptr_,
+ quant_shift_ptr_, qcoeff_.TopLeftPixel(), dqcoeff_.TopLeftPixel(),
+ dequant_ptr_, &eob_, scan_->scan, scan_->iscan));
- EXPECT_TRUE(qcoeff.CheckValues(ref_qcoeff));
- EXPECT_TRUE(dqcoeff.CheckValues(ref_dqcoeff));
+ EXPECT_TRUE(qcoeff_.CheckValues(ref_qcoeff));
+ EXPECT_TRUE(dqcoeff_.CheckValues(ref_dqcoeff));
- EXPECT_EQ(eob, ref_eob);
+ EXPECT_EQ(eob_, ref_eob);
if (HasFailure()) {
printf("Failure on iteration %d.\n", i);
- qcoeff.PrintDifference(ref_qcoeff);
- dqcoeff.PrintDifference(ref_dqcoeff);
+ qcoeff_.PrintDifference(ref_qcoeff);
+ dqcoeff_.PrintDifference(ref_dqcoeff);
return;
}
}
@@ -347,9 +348,9 @@ TEST_P(VP9QuantizeTest, OperationCheck) {
TEST_P(VP9QuantizeTest, EOBCheck) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
- ASSERT_TRUE(coeff.Init());
- ASSERT_TRUE(qcoeff.Init());
- ASSERT_TRUE(dqcoeff.Init());
+ ASSERT_TRUE(coeff_.Init());
+ ASSERT_TRUE(qcoeff_.Init());
+ ASSERT_TRUE(dqcoeff_.Init());
Buffer<tran_low_t> ref_qcoeff =
Buffer<tran_low_t>(max_size_, max_size_, 0, 32);
ASSERT_TRUE(ref_qcoeff.Init());
@@ -357,11 +358,11 @@ TEST_P(VP9QuantizeTest, EOBCheck) {
Buffer<tran_low_t>(max_size_, max_size_, 0, 32);
ASSERT_TRUE(ref_dqcoeff.Init());
uint16_t ref_eob = 0;
- eob = 0;
+ eob_ = 0;
const uint32_t max_index = max_size_ * max_size_ - 1;
for (int i = 0; i < number_of_iterations; ++i) {
- skip_block = 0;
+ skip_block_ = 0;
TX_SIZE sz;
if (max_size_ == 16) {
sz = static_cast<TX_SIZE>(i % 3); // TX_4X4, TX_8X8 TX_16X16
@@ -369,36 +370,36 @@ TEST_P(VP9QuantizeTest, EOBCheck) {
sz = TX_32X32;
}
const TX_TYPE tx_type = static_cast<TX_TYPE>((i >> 2) % 3);
- scan = &vp9_scan_orders[sz][tx_type];
- count = (4 << sz) * (4 << sz);
+ scan_ = &vp9_scan_orders[sz][tx_type];
+ count_ = (4 << sz) * (4 << sz);
// Two random entries
- coeff.Set(0);
- coeff.TopLeftPixel()[rnd.RandRange(count) & max_index] =
+ coeff_.Set(0);
+ coeff_.TopLeftPixel()[rnd.RandRange(count_) & max_index] =
static_cast<int>(rnd.RandRange(max_value_ * 2)) - max_value_;
- coeff.TopLeftPixel()[rnd.RandRange(count) & max_index] =
+ coeff_.TopLeftPixel()[rnd.RandRange(count_) & max_index] =
static_cast<int>(rnd.RandRange(max_value_ * 2)) - max_value_;
GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_,
quant_shift_ptr_, dequant_ptr_, round_fp_ptr_,
quant_fp_ptr_);
- ref_quantize_op_(coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr,
- q_ptr, quant_shift_ptr_, ref_qcoeff.TopLeftPixel(),
- ref_dqcoeff.TopLeftPixel(), dequant_ptr_, &ref_eob,
- scan->scan, scan->iscan);
+ ref_quantize_op_(coeff_.TopLeftPixel(), count_, skip_block_, zbin_ptr_,
+ r_ptr_, q_ptr_, quant_shift_ptr_,
+ ref_qcoeff.TopLeftPixel(), ref_dqcoeff.TopLeftPixel(),
+ dequant_ptr_, &ref_eob, scan_->scan, scan_->iscan);
ASM_REGISTER_STATE_CHECK(quantize_op_(
- coeff.TopLeftPixel(), count, skip_block, zbin_ptr_, r_ptr, q_ptr,
- quant_shift_ptr_, qcoeff.TopLeftPixel(), dqcoeff.TopLeftPixel(),
- dequant_ptr_, &eob, scan->scan, scan->iscan));
+ coeff_.TopLeftPixel(), count_, skip_block_, zbin_ptr_, r_ptr_, q_ptr_,
+ quant_shift_ptr_, qcoeff_.TopLeftPixel(), dqcoeff_.TopLeftPixel(),
+ dequant_ptr_, &eob_, scan_->scan, scan_->iscan));
- EXPECT_TRUE(qcoeff.CheckValues(ref_qcoeff));
- EXPECT_TRUE(dqcoeff.CheckValues(ref_dqcoeff));
+ EXPECT_TRUE(qcoeff_.CheckValues(ref_qcoeff));
+ EXPECT_TRUE(dqcoeff_.CheckValues(ref_dqcoeff));
- EXPECT_EQ(eob, ref_eob);
+ EXPECT_EQ(eob_, ref_eob);
if (HasFailure()) {
printf("Failure on iteration %d.\n", i);
- qcoeff.PrintDifference(ref_qcoeff);
- dqcoeff.PrintDifference(ref_dqcoeff);
+ qcoeff_.PrintDifference(ref_qcoeff);
+ dqcoeff_.PrintDifference(ref_dqcoeff);
return;
}
}
@@ -406,9 +407,9 @@ TEST_P(VP9QuantizeTest, EOBCheck) {
TEST_P(VP9QuantizeTest, DISABLED_Speed) {
ACMRandom rnd(ACMRandom::DeterministicSeed());
- ASSERT_TRUE(coeff.Init());
- ASSERT_TRUE(qcoeff.Init());
- ASSERT_TRUE(dqcoeff.Init());
+ ASSERT_TRUE(coeff_.Init());
+ ASSERT_TRUE(qcoeff_.Init());
+ ASSERT_TRUE(dqcoeff_.Init());
TX_SIZE starting_sz, ending_sz;
if (max_size_ == 16) {
@@ -422,12 +423,12 @@ TEST_P(VP9QuantizeTest, DISABLED_Speed) {
for (TX_SIZE sz = starting_sz; sz <= ending_sz; ++sz) {
// zbin > coeff, zbin < coeff.
for (int i = 0; i < 2; ++i) {
- skip_block = 0;
+ skip_block_ = 0;
// TX_TYPE defines the scan order. That is not relevant to the speed test.
// Pick the first one.
const TX_TYPE tx_type = DCT_DCT;
- count = (4 << sz) * (4 << sz);
- scan = &vp9_scan_orders[sz][tx_type];
+ count_ = (4 << sz) * (4 << sz);
+ scan_ = &vp9_scan_orders[sz][tx_type];
GenerateHelperArrays(&rnd, zbin_ptr_, round_ptr_, quant_ptr_,
quant_shift_ptr_, dequant_ptr_, round_fp_ptr_,
@@ -442,20 +443,20 @@ TEST_P(VP9QuantizeTest, DISABLED_Speed) {
threshold = 200;
}
for (int j = 0; j < 8; ++j) zbin_ptr_[j] = threshold;
- coeff.Set(&rnd, -99, 99);
+ coeff_.Set(&rnd, -99, 99);
} else if (i == 1) {
for (int j = 0; j < 8; ++j) zbin_ptr_[j] = 50;
- coeff.Set(&rnd, -500, 500);
+ coeff_.Set(&rnd, -500, 500);
}
- runNTimes(10000000 / count);
+ RunNTimes(10000000 / count_);
const char *type =
(i == 0) ? "Bypass calculations " : "Full calculations ";
char block_size[16];
snprintf(block_size, sizeof(block_size), "%dx%d", 4 << sz, 4 << sz);
char title[100];
snprintf(title, sizeof(title), "%25s %8s ", type, block_size);
- printMedian(title);
+ PrintMedian(title);
}
}
}