diff options
author | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-14 20:46:29 +0000 |
---|---|---|
committer | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-14 20:46:29 +0000 |
commit | 61fc302c4fda79bf3fcc5572c5fa5163a2590e08 (patch) | |
tree | 693f419f3893249e7a6db051655353c7b970a982 /media/base/yuv_convert_unittest.cc | |
parent | 2c6b40896d0e00da22bb251a63b504e9e28c97a3 (diff) | |
download | chromium_src-61fc302c4fda79bf3fcc5572c5fa5163a2590e08.zip chromium_src-61fc302c4fda79bf3fcc5572c5fa5163a2590e08.tar.gz chromium_src-61fc302c4fda79bf3fcc5572c5fa5163a2590e08.tar.bz2 |
Use lea to remove 2 instructions from the inner loop of YUV Scale.
Use MMX2 to remove emms.
unittest has code to time yuv scale and convert 100 times so it takes about 1 second... useful for catching performance issues. But the code is disabled.
BUG=23263
TEST=media_unittest should pass and run much faster: 28% faster than 32 bit version.
Review URL: http://codereview.chromium.org/273047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29019 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/yuv_convert_unittest.cc')
-rw-r--r-- | media/base/yuv_convert_unittest.cc | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/media/base/yuv_convert_unittest.cc b/media/base/yuv_convert_unittest.cc index d75488a..00152b6 100644 --- a/media/base/yuv_convert_unittest.cc +++ b/media/base/yuv_convert_unittest.cc @@ -33,7 +33,6 @@ 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) { @@ -99,16 +98,18 @@ TEST(YUVConvertTest, YV16) { reinterpret_cast<char*>(yuv_bytes.get()), static_cast<int>(kYUV16Size))); - // 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); + 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); + } unsigned int rgb_hash = DJB2Hash(rgb_converted_bytes.get(), kRGBSizeConverted, kDJB2HashSeed); @@ -143,17 +144,19 @@ 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]); - media::ScaleYUVToRGB32(yuv_bytes.get(), // Y + for (int i = 0; i < kTestTimes; ++i) { + 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); @@ -188,17 +191,19 @@ 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]); - media::ScaleYUVToRGB32(yuv_bytes.get(), // Y + for (int i = 0; i < kTestTimes; ++i) { + 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); |