summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-14 21:30:09 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-14 21:30:09 +0000
commitc480832def8f3153e59d491e5f95ca298e2ecdbe (patch)
tree85e4f8371a09d2309d315a4bb6cc4fc32b4d2c20 /media
parent8a7d8ddc0ba75454f55803bc7eaae79dacc23f61 (diff)
downloadchromium_src-c480832def8f3153e59d491e5f95ca298e2ecdbe.zip
chromium_src-c480832def8f3153e59d491e5f95ca298e2ecdbe.tar.gz
chromium_src-c480832def8f3153e59d491e5f95ca298e2ecdbe.tar.bz2
Reverting 29019.
Reverting due to test_shell_tests Linux 64 release failures TBR: fbarchard Review URL: http://codereview.chromium.org/275021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29031 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/base/yuv_convert_unittest.cc55
-rw-r--r--media/base/yuv_row.h3
-rw-r--r--media/base/yuv_row_linux.cc78
3 files changed, 66 insertions, 70 deletions
diff --git a/media/base/yuv_convert_unittest.cc b/media/base/yuv_convert_unittest.cc
index 00152b6..d75488a 100644
--- a/media/base/yuv_convert_unittest.cc
+++ b/media/base/yuv_convert_unittest.cc
@@ -33,6 +33,7 @@ static const size_t kRGBSize = kWidth * kHeight * kBpp;
static const size_t kRGBSizeConverted = kWidth * kHeight * kBpp;
// Set to 100 to time ConvertYUVToRGB32.
+// This will take approximately 40 to 200 ms.
static const int kTestTimes = 1;
TEST(YUVConvertTest, YV12) {
@@ -98,18 +99,16 @@ TEST(YUVConvertTest, YV16) {
reinterpret_cast<char*>(yuv_bytes.get()),
static_cast<int>(kYUV16Size)));
- for (int i = 0; i < kTestTimes; ++i) {
- // Convert a frame of YUV to 32 bit ARGB.
- media::ConvertYUVToRGB32(yuv_bytes.get(), // Y
- yuv_bytes.get() + kWidth * kHeight, // U
- yuv_bytes.get() + kWidth * kHeight * 3 / 2, // V
- rgb_converted_bytes.get(), // RGB output
- kWidth, kHeight, // Dimensions
- kWidth, // YStride
- kWidth / 2, // UVStride
- kWidth * kBpp, // RGBStride
- media::YV16);
- }
+ // Convert a frame of YUV to 32 bit ARGB.
+ media::ConvertYUVToRGB32(yuv_bytes.get(), // Y
+ yuv_bytes.get() + kWidth * kHeight, // U
+ yuv_bytes.get() + kWidth * kHeight * 3 / 2, // V
+ rgb_converted_bytes.get(), // RGB output
+ kWidth, kHeight, // Dimensions
+ kWidth, // YStride
+ kWidth / 2, // UVStride
+ kWidth * kBpp, // RGBStride
+ media::YV16);
unsigned int rgb_hash = DJB2Hash(rgb_converted_bytes.get(), kRGBSizeConverted,
kDJB2HashSeed);
@@ -144,19 +143,17 @@ TEST(YuvScaleTest, YV12) {
const size_t size_of_rgb_scaled = kScaledWidth * kScaledHeight * kBpp;
scoped_array<uint8> rgb_scaled_bytes(new uint8[size_of_rgb_scaled]);
- for (int i = 0; i < kTestTimes; ++i) {
- media::ScaleYUVToRGB32(yuv_bytes.get(), // Y
+ media::ScaleYUVToRGB32(yuv_bytes.get(), // Y
yuv_bytes.get() + kWidth * kHeight, // U
yuv_bytes.get() + kWidth * kHeight * 5 / 4, // V
- rgb_scaled_bytes.get(), // Rgb output
- kWidth, kHeight, // Dimensions
- kScaledWidth, kScaledHeight, // Dimensions
- kWidth, // YStride
- kWidth / 2, // UvStride
- kScaledWidth * kBpp, // RgbStride
+ rgb_scaled_bytes.get(), // Rgb output
+ kWidth, kHeight, // Dimensions
+ kScaledWidth, kScaledHeight, // Dimensions
+ kWidth, // YStride
+ kWidth / 2, // UvStride
+ kScaledWidth * kBpp, // RgbStride
media::YV12,
media::ROTATE_0);
- }
unsigned int rgb_hash = DJB2Hash(rgb_scaled_bytes.get(), size_of_rgb_scaled,
kDJB2HashSeed);
@@ -191,19 +188,17 @@ TEST(YuvScaleTest, YV16) {
const size_t size_of_rgb_scaled = kScaledWidth * kScaledHeight * kBpp;
scoped_array<uint8> rgb_scaled_bytes(new uint8[size_of_rgb_scaled]);
- for (int i = 0; i < kTestTimes; ++i) {
- media::ScaleYUVToRGB32(yuv_bytes.get(), // Y
+ media::ScaleYUVToRGB32(yuv_bytes.get(), // Y
yuv_bytes.get() + kWidth * kHeight, // U
yuv_bytes.get() + kWidth * kHeight * 3 / 2, // V
- rgb_scaled_bytes.get(), // Rgb output
- kWidth, kHeight, // Dimensions
- kScaledWidth, kScaledHeight, // Dimensions
- kWidth, // YStride
- kWidth / 2, // UvStride
- kScaledWidth * kBpp, // RgbStride
+ rgb_scaled_bytes.get(), // Rgb output
+ kWidth, kHeight, // Dimensions
+ kScaledWidth, kScaledHeight, // Dimensions
+ kWidth, // YStride
+ kWidth / 2, // UvStride
+ kScaledWidth * kBpp, // RgbStride
media::YV16,
media::ROTATE_0);
- }
unsigned int rgb_hash = DJB2Hash(rgb_scaled_bytes.get(), size_of_rgb_scaled,
kDJB2HashSeed);
diff --git a/media/base/yuv_row.h b/media/base/yuv_row.h
index 36f8f6e..31f1788 100644
--- a/media/base/yuv_row.h
+++ b/media/base/yuv_row.h
@@ -71,8 +71,7 @@ void ScaleYUVToRGB32Row(const uint8* y_buf,
#endif
#endif
-// x64 uses MMX2 (SSE) so emms is not required.
-#if USE_MMX && !defined(ARCH_CPU_X86_64)
+#if USE_MMX
#if defined(_MSC_VER)
#define EMMS() __asm emms
#else
diff --git a/media/base/yuv_row_linux.cc b/media/base/yuv_row_linux.cc
index b99c7bf..5825960 100644
--- a/media/base/yuv_row_linux.cc
+++ b/media/base/yuv_row_linux.cc
@@ -263,19 +263,19 @@ void FastConvertYUVToRGB32Row(const uint8* y_buf, // rdi
"add $0x1,%rsi\n"
"movzb (%rdx),%r11\n"
"add $0x1,%rdx\n"
- "movq kCoefficientsRgbU(,%r10,8),%xmm0\n"
+ "movq kCoefficientsRgbU(,%r10,8),%mm0\n"
"movzb (%rdi),%r10\n"
- "paddsw kCoefficientsRgbV(,%r11,8),%xmm0\n"
+ "paddsw kCoefficientsRgbV(,%r11,8),%mm0\n"
"movzb 0x1(%rdi),%r11\n"
- "movq kCoefficientsRgbY(,%r10,8),%xmm1\n"
+ "movq kCoefficientsRgbY(,%r10,8),%mm1\n"
"add $0x2,%rdi\n"
- "movq kCoefficientsRgbY(,%r11,8),%xmm2\n"
- "paddsw %xmm0,%xmm1\n"
- "paddsw %xmm0,%xmm2\n"
- "psraw $0x6,%xmm1\n"
- "psraw $0x6,%xmm2\n"
- "packuswb %xmm2,%xmm1\n"
- "movq %xmm1,0x0(%rcx)\n"
+ "movq kCoefficientsRgbY(,%r11,8),%mm2\n"
+ "paddsw %mm0,%mm1\n"
+ "paddsw %mm0,%mm2\n"
+ "psraw $0x6,%mm1\n"
+ "psraw $0x6,%mm2\n"
+ "packuswb %mm2,%mm1\n"
+ "movntq %mm1,0x0(%rcx)\n"
"add $0x8,%rcx\n"
"convertend:"
"sub $0x2,%r8\n"
@@ -285,15 +285,15 @@ void FastConvertYUVToRGB32Row(const uint8* y_buf, // rdi
"je convertdone\n"
"movzb (%rsi),%r10\n"
- "movq kCoefficientsRgbU(,%r10,8),%xmm0\n"
+ "movq kCoefficientsRgbU(,%r10,8),%mm0\n"
"movzb (%rdx),%r10\n"
- "paddsw kCoefficientsRgbV(,%r10,8),%xmm0\n"
+ "paddsw kCoefficientsRgbV(,%r10,8),%mm0\n"
"movzb (%rdi),%r10\n"
- "movq kCoefficientsRgbY(,%r10,8),%xmm1\n"
- "paddsw %xmm0,%xmm1\n"
- "psraw $0x6,%xmm1\n"
- "packuswb %xmm1,%xmm1\n"
- "movd %xmm1,0x0(%rcx)\n"
+ "movq kCoefficientsRgbY(,%r10,8),%mm1\n"
+ "paddsw %mm0,%mm1\n"
+ "psraw $0x6,%mm1\n"
+ "packuswb %mm1,%mm1\n"
+ "movd %mm1,0x0(%rcx)\n"
"convertdone:"
"ret\n"
);
@@ -316,23 +316,25 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, // rdi
"mov %r11,%r10\n"
"sar $0x5,%r10\n"
"movzb (%rsi,%r10,1),%rax\n"
- "movq kCoefficientsRgbU(,%rax,8),%xmm0\n"
+ "movq kCoefficientsRgbU(,%rax,8),%mm0\n"
"movzb (%rdx,%r10,1),%rax\n"
- "paddsw kCoefficientsRgbV(,%rax,8),%xmm0\n"
- "lea (%r11,%r9),%r10\n"
- "sar $0x4,%r11\n"
- "movzb (%rdi,%r11,1),%rax\n"
- "movq kCoefficientsRgbY(,%rax,8),%xmm1\n"
- "lea (%r10,%r9),%r11\n"
+ "paddsw kCoefficientsRgbV(,%rax,8),%mm0\n"
+ "mov %r11,%r10\n"
+ "add %r9,%r11\n"
"sar $0x4,%r10\n"
"movzb (%rdi,%r10,1),%rax\n"
- "movq kCoefficientsRgbY(,%rax,8),%xmm2\n"
- "paddsw %xmm0,%xmm1\n"
- "paddsw %xmm0,%xmm2\n"
- "psraw $0x6,%xmm1\n"
- "psraw $0x6,%xmm2\n"
- "packuswb %xmm2,%xmm1\n"
- "movq %xmm1,0x0(%rcx)\n"
+ "movq kCoefficientsRgbY(,%rax,8),%mm1\n"
+ "mov %r11,%r10\n"
+ "add %r9,%r11\n"
+ "sar $0x4,%r10\n"
+ "movzb (%rdi,%r10,1),%rax\n"
+ "movq kCoefficientsRgbY(,%rax,8),%mm2\n"
+ "paddsw %mm0,%mm1\n"
+ "paddsw %mm0,%mm2\n"
+ "psraw $0x6,%mm1\n"
+ "psraw $0x6,%mm2\n"
+ "packuswb %mm2,%mm1\n"
+ "movntq %mm1,0x0(%rcx)\n"
"add $0x8,%rcx\n"
"scaleend:"
"sub $0x2,%r8\n"
@@ -344,16 +346,16 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, // rdi
"mov %r11,%r10\n"
"sar $0x5,%r10\n"
"movzb (%rsi,%r10,1),%rax\n"
- "movq kCoefficientsRgbU(,%rax,8),%xmm0\n"
+ "movq kCoefficientsRgbU(,%rax,8),%mm0\n"
"movzb (%rdx,%r10,1),%rax\n"
- "paddsw kCoefficientsRgbV(,%rax,8),%xmm0\n"
+ "paddsw kCoefficientsRgbV(,%rax,8),%mm0\n"
"sar $0x4,%r11\n"
"movzb (%rdi,%r11,1),%rax\n"
- "movq kCoefficientsRgbY(,%rax,8),%xmm1\n"
- "paddsw %xmm0,%xmm1\n"
- "psraw $0x6,%xmm1\n"
- "packuswb %xmm1,%xmm1\n"
- "movd %xmm1,0x0(%rcx)\n"
+ "movq kCoefficientsRgbY(,%rax,8),%mm1\n"
+ "paddsw %mm0,%mm1\n"
+ "psraw $0x6,%mm1\n"
+ "packuswb %mm1,%mm1\n"
+ "movd %mm1,0x0(%rcx)\n"
"scaledone:"
"ret\n"