Commit a5fa6d9c authored by thestig's avatar thestig Committed by Commit bot

Cleanup: Remove unneeded media/ SSE2 checks and unused code. (try 2)

This is the media/ portion of a reverted CL: https://codereview.chromium.org/459603003/

BUG=349320

Review URL: https://codereview.chromium.org/516543004

Cr-Commit-Position: refs/heads/master@{#292294}
parent 388cc928
...@@ -209,7 +209,6 @@ source_set("base") { ...@@ -209,7 +209,6 @@ source_set("base") {
sources += [ "simd/convert_yuv_to_rgb_x86.cc" ] sources += [ "simd/convert_yuv_to_rgb_x86.cc" ]
deps += [ deps += [
":media_yasm", ":media_yasm",
":media_mmx",
":media_sse2", ":media_sse2",
] ]
} }
...@@ -351,14 +350,6 @@ source_set("perftests") { ...@@ -351,14 +350,6 @@ source_set("perftests") {
} }
if (cpu_arch == "x86" || cpu_arch == "x64") { if (cpu_arch == "x86" || cpu_arch == "x64") {
source_set("media_mmx") {
sources = [ "simd/filter_yuv_mmx.cc" ]
configs += [ "//media:media_config" ]
if (!is_win) {
cflags = [ "-mmmx" ]
}
}
source_set("media_sse2") { source_set("media_sse2") {
sources = [ sources = [
"simd/convert_rgb_to_yuv_sse2.cc", "simd/convert_rgb_to_yuv_sse2.cc",
...@@ -375,7 +366,6 @@ if (cpu_arch == "x86" || cpu_arch == "x64") { ...@@ -375,7 +366,6 @@ if (cpu_arch == "x86" || cpu_arch == "x64") {
yasm_assemble("media_yasm") { yasm_assemble("media_yasm") {
sources = [ sources = [
"simd/convert_rgb_to_yuv_ssse3.asm", "simd/convert_rgb_to_yuv_ssse3.asm",
"simd/convert_yuv_to_rgb_mmx.asm",
"simd/convert_yuv_to_rgb_sse.asm", "simd/convert_yuv_to_rgb_sse.asm",
"simd/convert_yuva_to_argb_mmx.asm", "simd/convert_yuva_to_argb_mmx.asm",
"simd/empty_register_state_mmx.asm", "simd/empty_register_state_mmx.asm",
......
...@@ -63,17 +63,6 @@ MEDIA_EXPORT void ConvertYUVToRGB32_SSE(const uint8* yplane, ...@@ -63,17 +63,6 @@ MEDIA_EXPORT void ConvertYUVToRGB32_SSE(const uint8* yplane,
int rgbstride, int rgbstride,
YUVType yuv_type); YUVType yuv_type);
MEDIA_EXPORT void ConvertYUVToRGB32_MMX(const uint8* yplane,
const uint8* uplane,
const uint8* vplane,
uint8* rgbframe,
int width,
int height,
int ystride,
int uvstride,
int rgbstride,
YUVType yuv_type);
MEDIA_EXPORT void ConvertYUVAToARGB_MMX(const uint8* yplane, MEDIA_EXPORT void ConvertYUVAToARGB_MMX(const uint8* yplane,
const uint8* uplane, const uint8* uplane,
const uint8* vplane, const uint8* vplane,
...@@ -126,13 +115,6 @@ extern "C" { ...@@ -126,13 +115,6 @@ extern "C" {
// issue on at least Win64. The C-equivalent RowProc versions' prototypes // issue on at least Win64. The C-equivalent RowProc versions' prototypes
// include the same change to ptrdiff_t to reuse the typedefs. // include the same change to ptrdiff_t to reuse the typedefs.
MEDIA_EXPORT void ConvertYUVToRGB32Row_MMX(const uint8* yplane,
const uint8* uplane,
const uint8* vplane,
uint8* rgbframe,
ptrdiff_t width,
const int16 convert_table[1024][4]);
MEDIA_EXPORT void ConvertYUVAToARGBRow_MMX(const uint8* yplane, MEDIA_EXPORT void ConvertYUVAToARGBRow_MMX(const uint8* yplane,
const uint8* uplane, const uint8* uplane,
const uint8* vplane, const uint8* vplane,
...@@ -148,14 +130,6 @@ MEDIA_EXPORT void ConvertYUVToRGB32Row_SSE(const uint8* yplane, ...@@ -148,14 +130,6 @@ MEDIA_EXPORT void ConvertYUVToRGB32Row_SSE(const uint8* yplane,
ptrdiff_t width, ptrdiff_t width,
const int16 convert_table[1024][4]); const int16 convert_table[1024][4]);
MEDIA_EXPORT void ScaleYUVToRGB32Row_MMX(const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
ptrdiff_t width,
ptrdiff_t source_dx,
const int16 convert_table[1024][4]);
MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE(const uint8* y_buf, MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE(const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
const uint8* v_buf, const uint8* v_buf,
...@@ -173,15 +147,6 @@ MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE2_X64( ...@@ -173,15 +147,6 @@ MEDIA_EXPORT void ScaleYUVToRGB32Row_SSE2_X64(
ptrdiff_t source_dx, ptrdiff_t source_dx,
const int16 convert_table[1024][4]); const int16 convert_table[1024][4]);
MEDIA_EXPORT void LinearScaleYUVToRGB32Row_MMX(
const uint8* y_buf,
const uint8* u_buf,
const uint8* v_buf,
uint8* rgb_buf,
ptrdiff_t width,
ptrdiff_t source_dx,
const int16 convert_table[1024][4]);
MEDIA_EXPORT void LinearScaleYUVToRGB32Row_SSE( MEDIA_EXPORT void LinearScaleYUVToRGB32Row_SSE(
const uint8* y_buf, const uint8* y_buf,
const uint8* u_buf, const uint8* u_buf,
......
; Copyright (c) 2011 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 "third_party/x86inc/x86inc.asm"
;
; This file uses MMX instructions.
;
SECTION_TEXT
CPU MMX
; Use movq to save the output.
%define MOVQ movq
; extern "C" void ConvertYUVToRGB32Row_MMX(const uint8* y_buf,
; const uint8* u_buf,
; const uint8* v_buf,
; uint8* rgb_buf,
; ptrdiff_t width,
; const int16 convert_table[1024][4]);
%define SYMBOL ConvertYUVToRGB32Row_MMX
%include "convert_yuv_to_rgb_mmx.inc"
...@@ -14,34 +14,6 @@ ...@@ -14,34 +14,6 @@
namespace media { namespace media {
void ConvertYUVToRGB32_MMX(const uint8* yplane,
const uint8* uplane,
const uint8* vplane,
uint8* rgbframe,
int width,
int height,
int ystride,
int uvstride,
int rgbstride,
YUVType yuv_type) {
unsigned int y_shift = GetVerticalShift(yuv_type);
for (int y = 0; y < height; ++y) {
uint8* rgb_row = rgbframe + y * rgbstride;
const uint8* y_ptr = yplane + y * ystride;
const uint8* u_ptr = uplane + (y >> y_shift) * uvstride;
const uint8* v_ptr = vplane + (y >> y_shift) * uvstride;
ConvertYUVToRGB32Row_MMX(y_ptr,
u_ptr,
v_ptr,
rgb_row,
width,
GetLookupTable(yuv_type));
}
EmptyRegisterState();
}
void ConvertYUVAToARGB_MMX(const uint8* yplane, void ConvertYUVAToARGB_MMX(const uint8* yplane,
const uint8* uplane, const uint8* uplane,
const uint8* vplane, const uint8* vplane,
......
...@@ -19,12 +19,6 @@ MEDIA_EXPORT void FilterYUVRows_C(uint8* ybuf, ...@@ -19,12 +19,6 @@ MEDIA_EXPORT void FilterYUVRows_C(uint8* ybuf,
int source_width, int source_width,
int source_y_fraction); int source_y_fraction);
MEDIA_EXPORT void FilterYUVRows_MMX(uint8* ybuf,
const uint8* y0_ptr,
const uint8* y1_ptr,
int source_width,
int source_y_fraction);
MEDIA_EXPORT void FilterYUVRows_SSE2(uint8* ybuf, MEDIA_EXPORT void FilterYUVRows_SSE2(uint8* ybuf,
const uint8* y0_ptr, const uint8* y0_ptr,
const uint8* y1_ptr, const uint8* y1_ptr,
......
// Copyright (c) 2011 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.
#if defined(_MSC_VER)
#include <intrin.h>
#else
#include <mmintrin.h>
#endif
#include "build/build_config.h"
#include "media/base/simd/filter_yuv.h"
namespace media {
#if defined(COMPILER_MSVC)
// Warning 4799 is about calling emms before the function exits.
// We calls emms in a frame level so suppress this warning.
#pragma warning(push)
#pragma warning(disable: 4799)
#endif
void FilterYUVRows_MMX(uint8* dest,
const uint8* src0,
const uint8* src1,
int width,
int fraction) {
int pixel = 0;
// Process the unaligned bytes first.
int unaligned_width =
(8 - (reinterpret_cast<uintptr_t>(dest) & 7)) & 7;
while (pixel < width && pixel < unaligned_width) {
dest[pixel] = (src0[pixel] * (256 - fraction) +
src1[pixel] * fraction) >> 8;
++pixel;
}
__m64 zero = _mm_setzero_si64();
__m64 src1_fraction = _mm_set1_pi16(fraction);
__m64 src0_fraction = _mm_set1_pi16(256 - fraction);
const __m64* src0_64 = reinterpret_cast<const __m64*>(src0 + pixel);
const __m64* src1_64 = reinterpret_cast<const __m64*>(src1 + pixel);
__m64* dest64 = reinterpret_cast<__m64*>(dest + pixel);
__m64* end64 = reinterpret_cast<__m64*>(
reinterpret_cast<uintptr_t>(dest + width) & ~7);
while (dest64 < end64) {
__m64 src0 = *src0_64++;
__m64 src1 = *src1_64++;
__m64 src2 = _mm_unpackhi_pi8(src0, zero);
__m64 src3 = _mm_unpackhi_pi8(src1, zero);
src0 = _mm_unpacklo_pi8(src0, zero);
src1 = _mm_unpacklo_pi8(src1, zero);
src0 = _mm_mullo_pi16(src0, src0_fraction);
src1 = _mm_mullo_pi16(src1, src1_fraction);
src2 = _mm_mullo_pi16(src2, src0_fraction);
src3 = _mm_mullo_pi16(src3, src1_fraction);
src0 = _mm_add_pi16(src0, src1);
src2 = _mm_add_pi16(src2, src3);
src0 = _mm_srli_pi16(src0, 8);
src2 = _mm_srli_pi16(src2, 8);
src0 = _mm_packs_pu16(src0, src2);
*dest64++ = src0;
pixel += 8;
}
while (pixel < width) {
dest[pixel] = (src0[pixel] * (256 - fraction) +
src1[pixel] * fraction) >> 8;
++pixel;
}
}
#if defined(COMPILER_MSVC)
#pragma warning(pop)
#endif
} // namespace media
...@@ -164,44 +164,34 @@ void InitializeCPUSpecificYUVConversions() { ...@@ -164,44 +164,34 @@ void InitializeCPUSpecificYUVConversions() {
// Assembly code confuses MemorySanitizer. // Assembly code confuses MemorySanitizer.
#if defined(ARCH_CPU_X86_FAMILY) && !defined(MEMORY_SANITIZER) #if defined(ARCH_CPU_X86_FAMILY) && !defined(MEMORY_SANITIZER)
base::CPU cpu; g_convert_yuva_to_argb_proc_ = ConvertYUVAToARGB_MMX;
if (cpu.has_mmx()) {
g_convert_yuv_to_rgb32_row_proc_ = ConvertYUVToRGB32Row_MMX;
g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_MMX;
g_convert_yuv_to_rgb32_proc_ = ConvertYUVToRGB32_MMX;
g_convert_yuva_to_argb_proc_ = ConvertYUVAToARGB_MMX;
g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_MMX;
#if defined(MEDIA_MMX_INTRINSICS_AVAILABLE) #if defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
g_filter_yuv_rows_proc_ = FilterYUVRows_MMX; g_empty_register_state_proc_ = EmptyRegisterStateIntrinsic;
g_empty_register_state_proc_ = EmptyRegisterStateIntrinsic;
#else #else
g_empty_register_state_proc_ = EmptyRegisterState_MMX; g_empty_register_state_proc_ = EmptyRegisterState_MMX;
#endif #endif
}
if (cpu.has_sse()) { g_convert_yuv_to_rgb32_row_proc_ = ConvertYUVToRGB32Row_SSE;
g_convert_yuv_to_rgb32_row_proc_ = ConvertYUVToRGB32Row_SSE; g_convert_yuv_to_rgb32_proc_ = ConvertYUVToRGB32_SSE;
g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_SSE;
g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_SSE;
g_convert_yuv_to_rgb32_proc_ = ConvertYUVToRGB32_SSE;
}
if (cpu.has_sse2()) { g_filter_yuv_rows_proc_ = FilterYUVRows_SSE2;
g_filter_yuv_rows_proc_ = FilterYUVRows_SSE2; g_convert_rgb32_to_yuv_proc_ = ConvertRGB32ToYUV_SSE2;
g_convert_rgb32_to_yuv_proc_ = ConvertRGB32ToYUV_SSE2;
#if defined(ARCH_CPU_X86_64) #if defined(ARCH_CPU_X86_64)
g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_SSE2_X64; g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_SSE2_X64;
// Technically this should be in the MMX section, but MSVC will optimize out // Technically this should be in the MMX section, but MSVC will optimize out
// the export of LinearScaleYUVToRGB32Row_MMX, which is required by the unit // the export of LinearScaleYUVToRGB32Row_MMX, which is required by the unit
// tests, if that decision can be made at compile time. Since all X64 CPUs // tests, if that decision can be made at compile time. Since all X64 CPUs
// have SSE2, we can hack around this by making the selection here. // have SSE2, we can hack around this by making the selection here.
g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_MMX_X64; g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_MMX_X64;
#else
g_scale_yuv_to_rgb32_row_proc_ = ScaleYUVToRGB32Row_SSE;
g_linear_scale_yuv_to_rgb32_row_proc_ = LinearScaleYUVToRGB32Row_SSE;
#endif #endif
}
base::CPU cpu;
if (cpu.has_ssse3()) { if (cpu.has_ssse3()) {
g_convert_rgb24_to_yuv_proc_ = &ConvertRGB24ToYUV_SSSE3; g_convert_rgb24_to_yuv_proc_ = &ConvertRGB24ToYUV_SSSE3;
......
...@@ -64,31 +64,6 @@ class YUVConvertPerfTest : public testing::Test { ...@@ -64,31 +64,6 @@ class YUVConvertPerfTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(YUVConvertPerfTest); DISALLOW_COPY_AND_ASSIGN(YUVConvertPerfTest);
}; };
TEST_F(YUVConvertPerfTest, ConvertYUVToRGB32Row_MMX) {
ASSERT_TRUE(base::CPU().has_mmx());
base::TimeTicks start = base::TimeTicks::HighResNow();
for (int i = 0; i < kPerfTestIterations; ++i) {
for (int row = 0; row < kSourceHeight; ++row) {
int chroma_row = row / 2;
ConvertYUVToRGB32Row_MMX(
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(),
kWidth,
GetLookupTable(YV12));
}
}
double total_time_seconds =
(base::TimeTicks::HighResNow() - start).InSecondsF();
perf_test::PrintResult(
"yuv_convert_perftest", "", "ConvertYUVToRGB32Row_MMX",
kPerfTestIterations / total_time_seconds, "runs/s", true);
media::EmptyRegisterState();
}
TEST_F(YUVConvertPerfTest, ConvertYUVToRGB32Row_SSE) { TEST_F(YUVConvertPerfTest, ConvertYUVToRGB32Row_SSE) {
ASSERT_TRUE(base::CPU().has_sse()); ASSERT_TRUE(base::CPU().has_sse());
...@@ -113,33 +88,9 @@ TEST_F(YUVConvertPerfTest, ConvertYUVToRGB32Row_SSE) { ...@@ -113,33 +88,9 @@ TEST_F(YUVConvertPerfTest, ConvertYUVToRGB32Row_SSE) {
media::EmptyRegisterState(); media::EmptyRegisterState();
} }
TEST_F(YUVConvertPerfTest, ScaleYUVToRGB32Row_MMX) { // 64-bit release + component builds on Windows are too smart and optimizes
ASSERT_TRUE(base::CPU().has_mmx()); // away the function being tested.
#if defined(OS_WIN) && (defined(ARCH_CPU_X86) || !defined(COMPONENT_BUILD))
const int kSourceDx = 80000; // This value means a scale down.
base::TimeTicks start = base::TimeTicks::HighResNow();
for (int i = 0; i < kPerfTestIterations; ++i) {
for (int row = 0; row < kSourceHeight; ++row) {
int chroma_row = row / 2;
ScaleYUVToRGB32Row_MMX(
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(),
kWidth,
kSourceDx,
GetLookupTable(YV12));
}
}
double total_time_seconds =
(base::TimeTicks::HighResNow() - start).InSecondsF();
perf_test::PrintResult(
"yuv_convert_perftest", "", "ScaleYUVToRGB32Row_MMX",
kPerfTestIterations / total_time_seconds, "runs/s", true);
media::EmptyRegisterState();
}
TEST_F(YUVConvertPerfTest, ScaleYUVToRGB32Row_SSE) { TEST_F(YUVConvertPerfTest, ScaleYUVToRGB32Row_SSE) {
ASSERT_TRUE(base::CPU().has_sse()); ASSERT_TRUE(base::CPU().has_sse());
...@@ -167,33 +118,6 @@ TEST_F(YUVConvertPerfTest, ScaleYUVToRGB32Row_SSE) { ...@@ -167,33 +118,6 @@ TEST_F(YUVConvertPerfTest, ScaleYUVToRGB32Row_SSE) {
media::EmptyRegisterState(); media::EmptyRegisterState();
} }
TEST_F(YUVConvertPerfTest, LinearScaleYUVToRGB32Row_MMX) {
ASSERT_TRUE(base::CPU().has_mmx());
const int kSourceDx = 80000; // This value means a scale down.
base::TimeTicks start = base::TimeTicks::HighResNow();
for (int i = 0; i < kPerfTestIterations; ++i) {
for (int row = 0; row < kSourceHeight; ++row) {
int chroma_row = row / 2;
LinearScaleYUVToRGB32Row_MMX(
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(),
kWidth,
kSourceDx,
GetLookupTable(YV12));
}
}
double total_time_seconds =
(base::TimeTicks::HighResNow() - start).InSecondsF();
perf_test::PrintResult(
"yuv_convert_perftest", "", "LinearScaleYUVToRGB32Row_MMX",
kPerfTestIterations / total_time_seconds, "runs/s", true);
media::EmptyRegisterState();
}
TEST_F(YUVConvertPerfTest, LinearScaleYUVToRGB32Row_SSE) { TEST_F(YUVConvertPerfTest, LinearScaleYUVToRGB32Row_SSE) {
ASSERT_TRUE(base::CPU().has_sse()); ASSERT_TRUE(base::CPU().has_sse());
...@@ -220,6 +144,7 @@ TEST_F(YUVConvertPerfTest, LinearScaleYUVToRGB32Row_SSE) { ...@@ -220,6 +144,7 @@ TEST_F(YUVConvertPerfTest, LinearScaleYUVToRGB32Row_SSE) {
kPerfTestIterations / total_time_seconds, "runs/s", true); kPerfTestIterations / total_time_seconds, "runs/s", true);
media::EmptyRegisterState(); media::EmptyRegisterState();
} }
#endif // defined(OS_WIN) && (ARCH_CPU_X86 || COMPONENT_BUILD)
#endif // !defined(ARCH_CPU_ARM_FAMILY) && !defined(ARCH_CPU_MIPS_FAMILY) #endif // !defined(ARCH_CPU_ARM_FAMILY) && !defined(ARCH_CPU_MIPS_FAMILY)
......
...@@ -657,37 +657,6 @@ TEST(YUVConvertTest, RGB32ToYUV_SSE2_MatchReference) { ...@@ -657,37 +657,6 @@ TEST(YUVConvertTest, RGB32ToYUV_SSE2_MatchReference) {
EXPECT_EQ(0, error); EXPECT_EQ(0, error);
} }
TEST(YUVConvertTest, ConvertYUVToRGB32Row_MMX) {
base::CPU cpu;
if (!cpu.has_mmx()) {
LOG(WARNING) << "System not supported. Test skipped.";
return;
}
scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]);
scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]);
scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]);
ReadYV12Data(&yuv_bytes);
const int kWidth = 167;
ConvertYUVToRGB32Row_C(yuv_bytes.get(),
yuv_bytes.get() + kSourceUOffset,
yuv_bytes.get() + kSourceVOffset,
rgb_bytes_reference.get(),
kWidth,
GetLookupTable(YV12));
ConvertYUVToRGB32Row_MMX(yuv_bytes.get(),
yuv_bytes.get() + kSourceUOffset,
yuv_bytes.get() + kSourceVOffset,
rgb_bytes_converted.get(),
kWidth,
GetLookupTable(YV12));
media::EmptyRegisterState();
EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
rgb_bytes_converted.get(),
kWidth * kBpp));
}
TEST(YUVConvertTest, ConvertYUVToRGB32Row_SSE) { TEST(YUVConvertTest, ConvertYUVToRGB32Row_SSE) {
base::CPU cpu; base::CPU cpu;
if (!cpu.has_sse()) { if (!cpu.has_sse()) {
...@@ -719,40 +688,9 @@ TEST(YUVConvertTest, ConvertYUVToRGB32Row_SSE) { ...@@ -719,40 +688,9 @@ TEST(YUVConvertTest, ConvertYUVToRGB32Row_SSE) {
kWidth * kBpp)); kWidth * kBpp));
} }
TEST(YUVConvertTest, ScaleYUVToRGB32Row_MMX) { // 64-bit release + component builds on Windows are too smart and optimizes
base::CPU cpu; // away the function being tested.
if (!cpu.has_mmx()) { #if defined(OS_WIN) && (defined(ARCH_CPU_X86) || !defined(COMPONENT_BUILD))
LOG(WARNING) << "System not supported. Test skipped.";
return;
}
scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]);
scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]);
scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]);
ReadYV12Data(&yuv_bytes);
const int kWidth = 167;
const int kSourceDx = 80000; // This value means a scale down.
ScaleYUVToRGB32Row_C(yuv_bytes.get(),
yuv_bytes.get() + kSourceUOffset,
yuv_bytes.get() + kSourceVOffset,
rgb_bytes_reference.get(),
kWidth,
kSourceDx,
GetLookupTable(YV12));
ScaleYUVToRGB32Row_MMX(yuv_bytes.get(),
yuv_bytes.get() + kSourceUOffset,
yuv_bytes.get() + kSourceVOffset,
rgb_bytes_converted.get(),
kWidth,
kSourceDx,
GetLookupTable(YV12));
media::EmptyRegisterState();
EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
rgb_bytes_converted.get(),
kWidth * kBpp));
}
TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE) { TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE) {
base::CPU cpu; base::CPU cpu;
if (!cpu.has_sse()) { if (!cpu.has_sse()) {
...@@ -787,40 +725,6 @@ TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE) { ...@@ -787,40 +725,6 @@ TEST(YUVConvertTest, ScaleYUVToRGB32Row_SSE) {
kWidth * kBpp)); kWidth * kBpp));
} }
TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_MMX) {
base::CPU cpu;
if (!cpu.has_mmx()) {
LOG(WARNING) << "System not supported. Test skipped.";
return;
}
scoped_ptr<uint8[]> yuv_bytes(new uint8[kYUV12Size]);
scoped_ptr<uint8[]> rgb_bytes_reference(new uint8[kRGBSize]);
scoped_ptr<uint8[]> rgb_bytes_converted(new uint8[kRGBSize]);
ReadYV12Data(&yuv_bytes);
const int kWidth = 167;
const int kSourceDx = 80000; // This value means a scale down.
LinearScaleYUVToRGB32Row_C(yuv_bytes.get(),
yuv_bytes.get() + kSourceUOffset,
yuv_bytes.get() + kSourceVOffset,
rgb_bytes_reference.get(),
kWidth,
kSourceDx,
GetLookupTable(YV12));
LinearScaleYUVToRGB32Row_MMX(yuv_bytes.get(),
yuv_bytes.get() + kSourceUOffset,
yuv_bytes.get() + kSourceVOffset,
rgb_bytes_converted.get(),
kWidth,
kSourceDx,
GetLookupTable(YV12));
media::EmptyRegisterState();
EXPECT_EQ(0, memcmp(rgb_bytes_reference.get(),
rgb_bytes_converted.get(),
kWidth * kBpp));
}
TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_SSE) { TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_SSE) {
base::CPU cpu; base::CPU cpu;
if (!cpu.has_sse()) { if (!cpu.has_sse()) {
...@@ -854,6 +758,7 @@ TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_SSE) { ...@@ -854,6 +758,7 @@ TEST(YUVConvertTest, LinearScaleYUVToRGB32Row_SSE) {
rgb_bytes_converted.get(), rgb_bytes_converted.get(),
kWidth * kBpp)); kWidth * kBpp));
} }
#endif // defined(OS_WIN) && (ARCH_CPU_X86 || COMPONENT_BUILD)
TEST(YUVConvertTest, FilterYUVRows_C_OutOfBounds) { TEST(YUVConvertTest, FilterYUVRows_C_OutOfBounds) {
scoped_ptr<uint8[]> src(new uint8[16]); scoped_ptr<uint8[]> src(new uint8[16]);
...@@ -870,30 +775,6 @@ TEST(YUVConvertTest, FilterYUVRows_C_OutOfBounds) { ...@@ -870,30 +775,6 @@ TEST(YUVConvertTest, FilterYUVRows_C_OutOfBounds) {
} }
} }
#if defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
TEST(YUVConvertTest, FilterYUVRows_MMX_OutOfBounds) {
base::CPU cpu;
if (!cpu.has_mmx()) {
LOG(WARNING) << "System not supported. Test skipped.";
return;
}
scoped_ptr<uint8[]> src(new uint8[16]);
scoped_ptr<uint8[]> dst(new uint8[16]);
memset(src.get(), 0xff, 16);
memset(dst.get(), 0, 16);
media::FilterYUVRows_MMX(dst.get(), src.get(), src.get(), 1, 255);
media::EmptyRegisterState();
EXPECT_EQ(255u, dst[0]);
for (int i = 1; i < 16; ++i) {
EXPECT_EQ(0u, dst[i]);
}
}
#endif // defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
TEST(YUVConvertTest, FilterYUVRows_SSE2_OutOfBounds) { TEST(YUVConvertTest, FilterYUVRows_SSE2_OutOfBounds) {
base::CPU cpu; base::CPU cpu;
if (!cpu.has_sse2()) { if (!cpu.has_sse2()) {
...@@ -915,38 +796,6 @@ TEST(YUVConvertTest, FilterYUVRows_SSE2_OutOfBounds) { ...@@ -915,38 +796,6 @@ TEST(YUVConvertTest, FilterYUVRows_SSE2_OutOfBounds) {
} }
} }
#if defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
TEST(YUVConvertTest, FilterYUVRows_MMX_UnalignedDestination) {
base::CPU cpu;
if (!cpu.has_mmx()) {
LOG(WARNING) << "System not supported. Test skipped.";
return;
}
const int kSize = 32;
scoped_ptr<uint8[]> src(new uint8[kSize]);
scoped_ptr<uint8[]> dst_sample(new uint8[kSize]);
scoped_ptr<uint8[]> dst(new uint8[kSize]);
memset(dst_sample.get(), 0, kSize);
memset(dst.get(), 0, kSize);
for (int i = 0; i < kSize; ++i)
src[i] = 100 + i;
media::FilterYUVRows_C(dst_sample.get(),
src.get(), src.get(), 17, 128);
// Generate an unaligned output address.
uint8* dst_ptr =
reinterpret_cast<uint8*>(
(reinterpret_cast<uintptr_t>(dst.get() + 8) & ~7) + 1);
media::FilterYUVRows_MMX(dst_ptr, src.get(), src.get(), 17, 128);
media::EmptyRegisterState();
EXPECT_EQ(0, memcmp(dst_sample.get(), dst_ptr, 17));
}
#endif // defined(MEDIA_MMX_INTRINSICS_AVAILABLE)
TEST(YUVConvertTest, FilterYUVRows_SSE2_UnalignedDestination) { TEST(YUVConvertTest, FilterYUVRows_SSE2_UnalignedDestination) {
base::CPU cpu; base::CPU cpu;
if (!cpu.has_sse2()) { if (!cpu.has_sse2()) {
......
...@@ -978,7 +978,6 @@ ...@@ -978,7 +978,6 @@
['target_arch=="ia32" or target_arch=="x64"', { ['target_arch=="ia32" or target_arch=="x64"', {
'dependencies': [ 'dependencies': [
'media_asm', 'media_asm',
'media_mmx',
'media_sse2', 'media_sse2',
], ],
'sources': [ 'sources': [
...@@ -1414,7 +1413,6 @@ ...@@ -1414,7 +1413,6 @@
'type': 'static_library', 'type': 'static_library',
'sources': [ 'sources': [
'base/simd/convert_rgb_to_yuv_ssse3.asm', 'base/simd/convert_rgb_to_yuv_ssse3.asm',
'base/simd/convert_yuv_to_rgb_mmx.asm',
'base/simd/convert_yuv_to_rgb_sse.asm', 'base/simd/convert_yuv_to_rgb_sse.asm',
'base/simd/convert_yuva_to_argb_mmx.asm', 'base/simd/convert_yuva_to_argb_mmx.asm',
'base/simd/empty_register_state_mmx.asm', 'base/simd/empty_register_state_mmx.asm',
...@@ -1495,22 +1493,6 @@ ...@@ -1495,22 +1493,6 @@
'../third_party/yasm/yasm_compile.gypi', '../third_party/yasm/yasm_compile.gypi',
], ],
}, },
{
'target_name': 'media_mmx',
'type': 'static_library',
'cflags': [
'-mmmx',
],
'defines': [
'MEDIA_IMPLEMENTATION',
],
'include_dirs': [
'..',
],
'sources': [
'base/simd/filter_yuv_mmx.cc',
],
},
{ {
'target_name': 'media_sse2', 'target_name': 'media_sse2',
'type': 'static_library', 'type': 'static_library',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment