OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "media/base/djb2.h" | 8 #include "media/base/djb2.h" |
9 #include "media/base/yuv_convert.h" | 9 #include "media/base/yuv_convert.h" |
10 #include "media/base/yuv_row.h" | 10 #include "media/base/yuv_row.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 yuv_converted_bytes.get(), | 295 yuv_converted_bytes.get(), |
296 yuv_converted_bytes.get() + kSourceYSize, | 296 yuv_converted_bytes.get() + kSourceYSize, |
297 yuv_converted_bytes.get() + kSourceYSize * 5 / 4, | 297 yuv_converted_bytes.get() + kSourceYSize * 5 / 4, |
298 kSourceWidth, kSourceHeight, // Dimensions | 298 kSourceWidth, kSourceHeight, // Dimensions |
299 kSourceWidth * 3, // RGBStride | 299 kSourceWidth * 3, // RGBStride |
300 kSourceWidth, // YStride | 300 kSourceWidth, // YStride |
301 kSourceWidth / 2); // UVStride | 301 kSourceWidth / 2); // UVStride |
302 | 302 |
303 uint32 rgb_hash = DJB2Hash(yuv_converted_bytes.get(), kYUV12Size, | 303 uint32 rgb_hash = DJB2Hash(yuv_converted_bytes.get(), kYUV12Size, |
304 kDJB2HashSeed); | 304 kDJB2HashSeed); |
305 EXPECT_EQ(1802801079u, rgb_hash); | 305 EXPECT_EQ(320824432u, rgb_hash); |
306 } | 306 } |
307 | 307 |
308 TEST(YUVConvertTest, YUY2ToYUV) { | 308 TEST(YUVConvertTest, YUY2ToYUV) { |
309 // Allocate all surfaces. | 309 // Allocate all surfaces. |
310 scoped_array<uint8> yuy_bytes(new uint8[kYUY2Size]); | 310 scoped_array<uint8> yuy_bytes(new uint8[kYUY2Size]); |
311 scoped_array<uint8> yuv_converted_bytes(new uint8[kYUV12Size]); | 311 scoped_array<uint8> yuv_converted_bytes(new uint8[kYUV12Size]); |
312 | 312 |
313 // Read YUY reference data from file. | 313 // Read YUY reference data from file. |
314 FilePath yuy_url; | 314 FilePath yuy_url; |
315 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &yuy_url)); | 315 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &yuy_url)); |
(...skipping 10 matching lines...) Expand all Loading... |
326 media::ConvertYUY2ToYUV(yuy_bytes.get(), | 326 media::ConvertYUY2ToYUV(yuy_bytes.get(), |
327 yuv_converted_bytes.get(), | 327 yuv_converted_bytes.get(), |
328 yuv_converted_bytes.get() + kSourceYSize, | 328 yuv_converted_bytes.get() + kSourceYSize, |
329 yuv_converted_bytes.get() + kSourceYSize * 5 / 4, | 329 yuv_converted_bytes.get() + kSourceYSize * 5 / 4, |
330 kSourceWidth, kSourceHeight); | 330 kSourceWidth, kSourceHeight); |
331 | 331 |
332 uint32 yuy_hash = DJB2Hash(yuv_converted_bytes.get(), kYUV12Size, | 332 uint32 yuy_hash = DJB2Hash(yuv_converted_bytes.get(), kYUV12Size, |
333 kDJB2HashSeed); | 333 kDJB2HashSeed); |
334 EXPECT_EQ(666823187u, yuy_hash); | 334 EXPECT_EQ(666823187u, yuy_hash); |
335 } | 335 } |
OLD | NEW |