summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorfbarchard <fbarchard@google.com>2015-11-02 19:35:48 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-03 03:36:36 +0000
commitc44db295a5529b608de334b0413e5b49b2387898 (patch)
treeb2e1692f2536103680259edec40713dd3a1aa753 /media
parentfa1f6182af9df39ba618a3214a9f529e23796bb4 (diff)
downloadchromium_src-c44db295a5529b608de334b0413e5b49b2387898.zip
chromium_src-c44db295a5529b608de334b0413e5b49b2387898.tar.gz
chromium_src-c44db295a5529b608de334b0413e5b49b2387898.tar.bz2
add ConvertYUVAToARGBRow_MMX to media_perftests
Add YUVConvertPerfTest.ConvertYUVAToARGBRow_MMX and YUVConvertPerfTest.I422ToARGBRow_SSSE3 to media_perftests. Fix math error when printing results by clearing the MMX state before doing float math. BUG=libyuv:473 Review URL: https://codereview.chromium.org/1425263002 Cr-Commit-Position: refs/heads/master@{#357525}
Diffstat (limited to 'media')
-rw-r--r--media/BUILD.gn1
-rw-r--r--media/base/yuv_convert_perftest.cc66
-rw-r--r--media/media.gyp3
3 files changed, 68 insertions, 2 deletions
diff --git a/media/BUILD.gn b/media/BUILD.gn
index f15e590..52af493 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -791,6 +791,7 @@ test("media_perftests") {
"//testing/gtest",
"//testing/perf",
"//third_party/widevine/cdm:version_h",
+ "//third_party/libyuv",
"//ui/gfx:test_support",
]
if (is_android) {
diff --git a/media/base/yuv_convert_perftest.cc b/media/base/yuv_convert_perftest.cc
index d676e4e..20a0da8 100644
--- a/media/base/yuv_convert_perftest.cc
+++ b/media/base/yuv_convert_perftest.cc
@@ -12,6 +12,7 @@
#include "media/base/yuv_convert.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/perf/perf_test.h"
+#include "third_party/libyuv/include/libyuv/row.h"
namespace media {
#if !defined(ARCH_CPU_ARM_FAMILY) && !defined(ARCH_CPU_MIPS_FAMILY)
@@ -87,6 +88,69 @@ TEST_F(YUVConvertPerfTest, ConvertYUVToRGB32Row_SSE) {
kPerfTestIterations / total_time_seconds, "runs/s", true);
}
+TEST_F(YUVConvertPerfTest, I422ToARGBRow_SSSE3) {
+ ASSERT_TRUE(base::CPU().has_ssse3());
+
+ base::TimeTicks start = base::TimeTicks::Now();
+ for (int i = 0; i < kPerfTestIterations; ++i) {
+ for (int row = 0; row < kSourceHeight; ++row) {
+ int chroma_row = row / 2;
+ libyuv::I422ToARGBRow_SSSE3(
+ yuv_bytes_.get() + row * kSourceWidth,
+ yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2),
+ yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2),
+ rgb_bytes_converted_.get(), &libyuv::kYuvIConstants, kWidth);
+ }
+ }
+ double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF();
+ perf_test::PrintResult("yuv_convert_perftest", "", "I422ToARGBRow_SSSE3",
+ kPerfTestIterations / total_time_seconds, "runs/s",
+ true);
+}
+
+TEST_F(YUVConvertPerfTest, ConvertYUVAToARGBRow_MMX) {
+ ASSERT_TRUE(base::CPU().has_sse());
+
+ base::TimeTicks start = base::TimeTicks::Now();
+ for (int i = 0; i < kPerfTestIterations; ++i) {
+ for (int row = 0; row < kSourceHeight; ++row) {
+ int chroma_row = row / 2;
+ ConvertYUVAToARGBRow_MMX(
+ yuv_bytes_.get() + row * kSourceWidth,
+ yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2),
+ yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2),
+ yuv_bytes_.get() + row * kSourceWidth, // hack: use luma for alpha
+ rgb_bytes_converted_.get(), kWidth, GetLookupTable(YV12));
+ }
+ }
+ media::EmptyRegisterState();
+ double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF();
+ perf_test::PrintResult("yuv_convert_perftest", "", "ConvertYUVAToARGBRow_MMX",
+ kPerfTestIterations / total_time_seconds, "runs/s",
+ true);
+}
+
+TEST_F(YUVConvertPerfTest, I422AlphaToARGBRow_SSSE3) {
+ ASSERT_TRUE(base::CPU().has_ssse3());
+
+ base::TimeTicks start = base::TimeTicks::Now();
+ for (int i = 0; i < kPerfTestIterations; ++i) {
+ for (int row = 0; row < kSourceHeight; ++row) {
+ int chroma_row = row / 2;
+ libyuv::I422AlphaToARGBRow_SSSE3(
+ yuv_bytes_.get() + row * kSourceWidth,
+ yuv_bytes_.get() + kSourceUOffset + (chroma_row * kSourceWidth / 2),
+ yuv_bytes_.get() + kSourceVOffset + (chroma_row * kSourceWidth / 2),
+ yuv_bytes_.get() + row * kSourceWidth, // hack: use luma for alpha
+ rgb_bytes_converted_.get(), &libyuv::kYuvIConstants, kWidth);
+ }
+ }
+ double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF();
+ perf_test::PrintResult("yuv_convert_perftest", "", "I422AlphaToARGBRow_SSSE3",
+ kPerfTestIterations / total_time_seconds, "runs/s",
+ true);
+}
+
// 64-bit release + component builds on Windows are too smart and optimizes
// away the function being tested.
#if defined(OS_WIN) && (defined(ARCH_CPU_X86) || !defined(COMPONENT_BUILD))
@@ -135,11 +199,11 @@ TEST_F(YUVConvertPerfTest, LinearScaleYUVToRGB32Row_SSE) {
GetLookupTable(YV12));
}
}
+ media::EmptyRegisterState();
double total_time_seconds = (base::TimeTicks::Now() - start).InSecondsF();
perf_test::PrintResult(
"yuv_convert_perftest", "", "LinearScaleYUVToRGB32Row_SSE",
kPerfTestIterations / total_time_seconds, "runs/s", true);
- media::EmptyRegisterState();
}
#endif // defined(OS_WIN) && (ARCH_CPU_X86 || COMPONENT_BUILD)
diff --git a/media/media.gyp b/media/media.gyp
index 9acf41e..661e8e7 100644
--- a/media/media.gyp
+++ b/media/media.gyp
@@ -1447,9 +1447,10 @@
'../testing/gmock.gyp:gmock',
'../testing/gtest.gyp:gtest',
'../testing/perf/perf_test.gyp:perf_test',
+ '../third_party/libyuv/libyuv.gyp:libyuv',
'../ui/gfx/gfx.gyp:gfx',
- '../ui/gfx/gfx.gyp:gfx_test_support',
'../ui/gfx/gfx.gyp:gfx_geometry',
+ '../ui/gfx/gfx.gyp:gfx_test_support',
'media',
'media_test_support',
'shared_memory_support',