Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2032)

Unified Diff: cc/resources/texture_compressor_perftest.cc

Issue 1096703002: Reland: Add ETC1 powered SSE encoder for tile texture compression (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reland: Change ia32 to x86 in Build.gn Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/texture_compressor_etc1_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/texture_compressor_perftest.cc
diff --git a/cc/resources/texture_compressor_perftest.cc b/cc/resources/texture_compressor_perftest.cc
index 7d68bd6f5f3d9415e2d14de53de87fd4f860935f..d2ad5bcc21aea0142a7390351dcb9c4a7994fcd9 100644
--- a/cc/resources/texture_compressor_perftest.cc
+++ b/cc/resources/texture_compressor_perftest.cc
@@ -17,12 +17,8 @@ const int kTimeCheckInterval = 10;
const int kImageWidth = 256;
const int kImageHeight = 256;
-const int kImageSizeInBytes = kImageWidth * kImageHeight * 4;
-
-const TextureCompressor::Quality kQualities[] = {
- TextureCompressor::kQualityLow,
- TextureCompressor::kQualityMedium,
- TextureCompressor::kQualityHigh};
+const int kImageChannels = 4;
+const int kImageSizeInBytes = kImageWidth * kImageHeight * kImageChannels;
std::string FormatName(TextureCompressor::Format format) {
switch (format) {
@@ -49,7 +45,9 @@ std::string QualityName(TextureCompressor::Quality quality) {
}
class TextureCompressorPerfTest
- : public testing::TestWithParam<TextureCompressor::Format> {
+ : public testing::TestWithParam<
+ ::testing::tuple<TextureCompressor::Quality,
+ TextureCompressor::Format>> {
public:
TextureCompressorPerfTest()
: timer_(kWarmupRuns,
@@ -57,18 +55,20 @@ class TextureCompressorPerfTest
kTimeCheckInterval) {}
void SetUp() override {
- TextureCompressor::Format format = GetParam();
+ TextureCompressor::Format format = ::testing::get<1>(GetParam());
compressor_ = TextureCompressor::Create(format);
}
- void RunTest(const std::string& name, TextureCompressor::Quality quality) {
+ void RunTest(const std::string& name) {
+ TextureCompressor::Quality quality = ::testing::get<0>(GetParam());
timer_.Reset();
do {
compressor_->Compress(src_, dst_, kImageWidth, kImageHeight, quality);
timer_.NextLap();
} while (!timer_.HasTimeLimitExpired());
- std::string str = FormatName(GetParam()) + " " + QualityName(quality);
+ TextureCompressor::Format format = ::testing::get<1>(GetParam());
+ std::string str = FormatName(format) + " " + QualityName(quality);
perf_test::PrintResult("Compress256x256", name, str, timer_.MsPerLap(),
"us", true);
}
@@ -80,24 +80,42 @@ class TextureCompressorPerfTest
uint8_t dst_[kImageSizeInBytes];
};
-TEST_P(TextureCompressorPerfTest, Compress256x256Image) {
+TEST_P(TextureCompressorPerfTest, Compress256x256BlackAndWhiteGradientImage) {
for (int i = 0; i < kImageSizeInBytes; ++i)
src_[i] = i % 256;
- for (auto& quality : kQualities)
- RunTest("Image", quality);
+ RunTest("BlackAndWhiteGradientImage");
}
-TEST_P(TextureCompressorPerfTest, Compress256x256SolidImage) {
+TEST_P(TextureCompressorPerfTest, Compress256x256SolidBlackImage) {
memset(src_, 0, kImageSizeInBytes);
- for (auto& quality : kQualities)
- RunTest("SolidImage", quality);
+ RunTest("SolidBlackImage");
+}
+
+TEST_P(TextureCompressorPerfTest, Compress256x256SolidColorImage) {
+ for (int i = 0; i < kImageSizeInBytes; ++i)
+ src_[i] = (4 - i % 4) * 50;
+
+ RunTest("SolidColorImage");
+}
+
+TEST_P(TextureCompressorPerfTest, Compress256x256RandomColorImage) {
+ unsigned int kImageSeed = 1234567890;
+ srand(kImageSeed);
Lei Zhang 2015/05/25 22:31:58 Why not just use the appropriate functions from ba
reveman 2015/05/26 15:50:21 I think we want pseudo random numbers here as real
+ for (int i = 0; i < kImageSizeInBytes; ++i)
+ src_[i] = rand() % 256; // NOLINT
+
+ RunTest("RandomColorImage");
}
-INSTANTIATE_TEST_CASE_P(TextureCompressorPerfTests,
- TextureCompressorPerfTest,
- ::testing::Values(TextureCompressor::kFormatETC1));
+INSTANTIATE_TEST_CASE_P(
+ TextureCompressorPerfTests,
+ TextureCompressorPerfTest,
+ ::testing::Combine(::testing::Values(TextureCompressor::kQualityLow,
+ TextureCompressor::kQualityMedium,
+ TextureCompressor::kQualityHigh),
+ ::testing::Values(TextureCompressor::kFormatETC1)));
} // namespace
} // namespace cc
« no previous file with comments | « cc/resources/texture_compressor_etc1_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698