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

Unified Diff: cc/resources/texture_compress/texture_compress_perftest.cc

Issue 793693003: Tile Compression (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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_compress/texture_compress.cc ('k') | cc/resources/texture_uploader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/texture_compress/texture_compress_perftest.cc
diff --git a/cc/resources/texture_compress/texture_compress_perftest.cc b/cc/resources/texture_compress/texture_compress_perftest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b36b6a83b8403a1c194fb478d2a2cc3c8aa7d20c
--- /dev/null
+++ b/cc/resources/texture_compress/texture_compress_perftest.cc
@@ -0,0 +1,175 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/logging.h"
+#if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
+#include <cpu-features.h>
+#include "cc/resources/texture_compress/arm/atc_dxt_neon.h"
+#include "cc/resources/texture_compress/arm/etc1_neon.h"
+#endif
+#include "cc/debug/lap_timer.h"
+#include "cc/resources/texture_compress/atc_dxt.h"
+#include "cc/resources/texture_compress/etc1.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "testing/perf/perf_test.h"
+
+namespace cc {
+namespace {
+
+static const int kTimeLimitMillis = 2000;
+static const int kWarmupRuns = 5;
+static const int kTimeCheckInterval = 10;
+
+class TextureCompressionPerfTest : public testing::Test {
+ public:
+ TextureCompressionPerfTest()
+ : timer_(kWarmupRuns,
+ base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
+ kTimeCheckInterval) {}
+
+ void SetUp() override { texture_compress::Init_ATC_DXT(); }
+
+ protected:
+ LapTimer timer_;
+};
+
+TEST_F(TextureCompressionPerfTest, Compress256x256Image) {
+ const int kImageWidth = 256;
+ const int kImageHeight = 256;
+ const int kImageSizeInBytes = kImageWidth * kImageHeight * 4;
+ uint8_t src[kImageSizeInBytes];
+ uint8_t dst[kImageSizeInBytes / 4];
+
+ for (int i = 0; i < kImageSizeInBytes; ++i)
+ src[i] = i % 256;
+
+ timer_.Reset();
+ do {
+ texture_compress::CompressDXT1_Generic(src, dst, kImageWidth, kImageHeight);
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ perf_test::PrintResult("compress_256x256_image", "", "DXT1 Generic",
+ timer_.MsPerLap(), "us", true);
+
+ timer_.Reset();
+ do {
+ texture_compress::CompressDXT5_Generic(src, dst, kImageWidth, kImageHeight);
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ perf_test::PrintResult("compress_256x256_image", "", "DXT5 Generic",
+ timer_.MsPerLap(), "us", true);
+
+ timer_.Reset();
+ do {
+ etc1::CompressTexture(src, dst, kImageWidth, kImageHeight);
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ perf_test::PrintResult("compress_256x256_image", "", "ETC1 Generic",
+ timer_.MsPerLap(), "us", true);
+
+#if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
+ if ((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0) {
+ timer_.Reset();
+ do {
+ texture_compress::CompressDXT1_NEON(src, dst, kImageWidth, kImageHeight);
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ perf_test::PrintResult("compress_256x256_image", "", "DXT1 NEON",
+ timer_.MsPerLap(), "us", true);
+
+ timer_.Reset();
+ do {
+ texture_compress::CompressDXT5_NEON(src, dst, kImageWidth, kImageHeight);
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ perf_test::PrintResult("compress_256x256_image", "", "DXT5 NEON",
+ timer_.MsPerLap(), "us", true);
+
+ timer_.Reset();
+ do {
+ etc1_neon::CompressTexture(src, dst, kImageWidth, kImageHeight);
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ perf_test::PrintResult("compress_256x256_image", "", "ETC1 NEON",
+ timer_.MsPerLap(), "us", true);
+ }
+#endif
+}
+
+TEST_F(TextureCompressionPerfTest, Compress256x256SolidImage) {
+ const int kImageWidth = 256;
+ const int kImageHeight = 256;
+ const int kImageSizeInBytes = kImageWidth * kImageHeight * 4;
+ uint8_t src[kImageSizeInBytes];
+ uint8_t dst[kImageSizeInBytes / 4];
+
+ memset(src, 0, sizeof(src));
+
+ timer_.Reset();
+ do {
+ texture_compress::CompressDXT1_Generic(src, dst, kImageWidth, kImageHeight);
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ perf_test::PrintResult("compress_256x256_solid_image", "", "DXT1",
+ timer_.MsPerLap(), "us", true);
+
+ timer_.Reset();
+ do {
+ texture_compress::CompressDXT5_Generic(src, dst, kImageWidth, kImageHeight);
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ perf_test::PrintResult("compress_256x256_solid_image", "", "DXT5",
+ timer_.MsPerLap(), "us", true);
+
+ timer_.Reset();
+ do {
+ etc1::CompressTexture(src, dst, kImageWidth, kImageHeight);
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ perf_test::PrintResult("compress_256x256_solid_image", "", "ETC1 Generic",
+ timer_.MsPerLap(), "us", true);
+
+#if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
+ if ((android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0) {
+ timer_.Reset();
+ do {
+ texture_compress::CompressDXT1_NEON(src, dst, kImageWidth, kImageHeight);
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ perf_test::PrintResult("compress_256x256_solid_image", "", "DXT1 NEON",
+ timer_.MsPerLap(), "us", true);
+
+ timer_.Reset();
+ do {
+ texture_compress::CompressDXT5_NEON(src, dst, kImageWidth, kImageHeight);
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ perf_test::PrintResult("compress_256x256_solid_image", "", "DXT5 NEON",
+ timer_.MsPerLap(), "us", true);
+
+ timer_.Reset();
+ do {
+ etc1_neon::CompressTexture(src, dst, kImageWidth, kImageHeight);
+ timer_.NextLap();
+ } while (!timer_.HasTimeLimitExpired());
+
+ perf_test::PrintResult("compress_256x256_solid_image", "", "ETC1 NEON",
+ timer_.MsPerLap(), "us", true);
+ }
+#endif
+}
+
+} // namespace
+} // namespace cc
« no previous file with comments | « cc/resources/texture_compress/texture_compress.cc ('k') | cc/resources/texture_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698