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/djb2.h" | 7 #include "media/base/djb2.h" |
8 #include "media/base/yuv_convert.h" | 8 #include "media/base/yuv_convert.h" |
9 #include "media/base/yuv_row.h" | 9 #include "media/base/yuv_row.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 static const int kScaledHeight = 768; | 26 static const int kScaledHeight = 768; |
27 static const int kBpp = 4; | 27 static const int kBpp = 4; |
28 | 28 |
29 // Surface sizes. | 29 // Surface sizes. |
30 static const size_t kYUV12Size = kWidth * kHeight * 12 / 8; | 30 static const size_t kYUV12Size = kWidth * kHeight * 12 / 8; |
31 static const size_t kYUV16Size = kWidth * kHeight * 16 / 8; | 31 static const size_t kYUV16Size = kWidth * kHeight * 16 / 8; |
32 static const size_t kRGBSize = kWidth * kHeight * kBpp; | 32 static const size_t kRGBSize = kWidth * kHeight * kBpp; |
33 static const size_t kRGBSizeConverted = kWidth * kHeight * kBpp; | 33 static const size_t kRGBSizeConverted = kWidth * kHeight * kBpp; |
34 | 34 |
35 // Set to 100 to time ConvertYUVToRGB32. | 35 // Set to 100 to time ConvertYUVToRGB32. |
36 static const int kTestTimes = 100; | 36 static const int kTestTimes = 1; |
37 | 37 |
38 TEST(YUVConvertTest, YV12) { | 38 TEST(YUVConvertTest, YV12) { |
39 // Allocate all surfaces. | 39 // Allocate all surfaces. |
40 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); | 40 scoped_array<uint8> yuv_bytes(new uint8[kYUV12Size]); |
41 scoped_array<uint8> rgb_bytes(new uint8[kRGBSize]); | 41 scoped_array<uint8> rgb_bytes(new uint8[kRGBSize]); |
42 scoped_array<uint8> rgb_converted_bytes(new uint8[kRGBSizeConverted]); | 42 scoped_array<uint8> rgb_converted_bytes(new uint8[kRGBSizeConverted]); |
43 | 43 |
44 // Read YUV reference data from file. | 44 // Read YUV reference data from file. |
45 FilePath yuv_url; | 45 FilePath yuv_url; |
46 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &yuv_url)); | 46 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &yuv_url)); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 1, 1, // Dimensions | 248 1, 1, // Dimensions |
249 0, // YStride | 249 0, // YStride |
250 0, // UVStride | 250 0, // UVStride |
251 0, // RGBStride | 251 0, // RGBStride |
252 media::YV12); | 252 media::YV12); |
253 | 253 |
254 int expected_test = memcmp(rgb, expected, sizeof(expected)); | 254 int expected_test = memcmp(rgb, expected, sizeof(expected)); |
255 EXPECT_EQ(0, expected_test); | 255 EXPECT_EQ(0, expected_test); |
256 } | 256 } |
257 | 257 |
OLD | NEW |