Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(932)

Side by Side Diff: unit_test/scale_color_test.cc

Issue 1361813002: replace random with fastrand (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: remove win32 version of random Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « unit_test/scale_argb_test.cc ('k') | unit_test/scale_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The LibYuv Project Authors. All rights reserved. 2 * Copyright 2015 The LibYuv Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 MemRandomize(temp_u, kHalfPixels); \ 59 MemRandomize(temp_u, kHalfPixels); \
60 MemRandomize(temp_v, kHalfPixels); \ 60 MemRandomize(temp_v, kHalfPixels); \
61 MemRandomize(dst_pixels_opt, kPixels * 4); \ 61 MemRandomize(dst_pixels_opt, kPixels * 4); \
62 MemRandomize(dst_pixels_c, kPixels * 4); \ 62 MemRandomize(dst_pixels_c, kPixels * 4); \
63 \ 63 \
64 /* The test is overall for color conversion matrix being reversible, so */ \ 64 /* The test is overall for color conversion matrix being reversible, so */ \
65 /* this initializes the pixel with 2x2 blocks to eliminate subsampling. */ \ 65 /* this initializes the pixel with 2x2 blocks to eliminate subsampling. */ \
66 uint8* p = orig_y; \ 66 uint8* p = orig_y; \
67 for (int y = 0; y < benchmark_height_ - HS1; y += HS) { \ 67 for (int y = 0; y < benchmark_height_ - HS1; y += HS) { \
68 for (int x = 0; x < benchmark_width_ - 1; x += 2) { \ 68 for (int x = 0; x < benchmark_width_ - 1; x += 2) { \
69 uint8 r = static_cast<uint8>(random()); \ 69 uint8 r = static_cast<uint8>(fastrand()); \
70 p[0] = r; \ 70 p[0] = r; \
71 p[1] = r; \ 71 p[1] = r; \
72 p[HN] = r; \ 72 p[HN] = r; \
73 p[HN + 1] = r; \ 73 p[HN + 1] = r; \
74 p += 2; \ 74 p += 2; \
75 } \ 75 } \
76 if (benchmark_width_ & 1) { \ 76 if (benchmark_width_ & 1) { \
77 uint8 r = static_cast<uint8>(random()); \ 77 uint8 r = static_cast<uint8>(fastrand()); \
78 p[0] = r; \ 78 p[0] = r; \
79 p[HN] = r; \ 79 p[HN] = r; \
80 p += 1; \ 80 p += 1; \
81 } \ 81 } \
82 p += HN; \ 82 p += HN; \
83 } \ 83 } \
84 \ 84 \
85 /* Start with YUV converted to ARGB. */ \ 85 /* Start with YUV converted to ARGB. */ \
86 YUVTOARGB(orig_y, benchmark_width_, \ 86 YUVTOARGB(orig_y, benchmark_width_, \
87 orig_u, (benchmark_width_ + 1) / 2, \ 87 orig_u, (benchmark_width_ + 1) / 2, \
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 EXPECT_EQ(r0, r1); 461 EXPECT_EQ(r0, r1);
462 EXPECT_EQ(g0, g1); 462 EXPECT_EQ(g0, g1);
463 EXPECT_EQ(b0, b1); 463 EXPECT_EQ(b0, b1);
464 EXPECT_EQ(r0, r2); 464 EXPECT_EQ(r0, r2);
465 EXPECT_EQ(g0, g2); 465 EXPECT_EQ(g0, g2);
466 EXPECT_EQ(b0, b2); 466 EXPECT_EQ(b0, b2);
467 } 467 }
468 } 468 }
469 469
470 } // namespace libyuv 470 } // namespace libyuv
OLDNEW
« no previous file with comments | « unit_test/scale_argb_test.cc ('k') | unit_test/scale_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698