| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/base_paths.h" | 5 #include "base/base_paths.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "media/base/yuv_convert.h" | 7 #include "media/base/yuv_convert.h" |
| 8 #include "media/base/yuv_row.h" | 8 #include "media/base/yuv_row.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // DJB2 hash | 35 // DJB2 hash |
| 36 unsigned int hash(unsigned char *s, size_t len, unsigned int hash = 5381) { | 36 unsigned int hash(unsigned char *s, size_t len, unsigned int hash = 5381) { |
| 37 while (len--) | 37 while (len--) |
| 38 hash = hash * 33 + *s++; | 38 hash = hash * 33 + *s++; |
| 39 return hash; | 39 return hash; |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 // Set to 100 to time ConvertYUVToRGB32. | 43 // Set to 100 to time ConvertYUVToRGB32. |
| 44 // This will take approximately 40 to 200 ms. | 44 // This will take approximately 40 to 200 ms. |
| 45 static const int kTestTimes = 1; | 45 static const int kTestTimes = 100; |
| 46 | 46 |
| 47 TEST(YUVConvertTest, YV12) { | 47 TEST(YUVConvertTest, YV12) { |
| 48 // Allocate all surfaces. | 48 // Allocate all surfaces. |
| 49 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); | 49 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); |
| 50 scoped_array<uint8> rgb_bytes(new uint8[kRGBSize]); | 50 scoped_array<uint8> rgb_bytes(new uint8[kRGBSize]); |
| 51 scoped_array<uint8> rgb_converted_bytes(new uint8[kRGBSizeConverted]); | 51 scoped_array<uint8> rgb_converted_bytes(new uint8[kRGBSizeConverted]); |
| 52 | 52 |
| 53 // Read YUV reference data from file. | 53 // Read YUV reference data from file. |
| 54 FilePath yuv_url; | 54 FilePath yuv_url; |
| 55 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &yuv_url)); | 55 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &yuv_url)); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 1, 1, // Dimensions | 247 1, 1, // Dimensions |
| 248 0, // YStride | 248 0, // YStride |
| 249 0, // UVStride | 249 0, // UVStride |
| 250 0, // RGBStride | 250 0, // RGBStride |
| 251 media::YV12); | 251 media::YV12); |
| 252 | 252 |
| 253 int expected_test = memcmp(rgb, expected, sizeof(expected)); | 253 int expected_test = memcmp(rgb, expected, sizeof(expected)); |
| 254 EXPECT_EQ(0, expected_test); | 254 EXPECT_EQ(0, expected_test); |
| 255 } | 255 } |
| 256 | 256 |
| OLD | NEW |