OLD | NEW |
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 Loading... |
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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 EXPECT_EQ(r0, r1); | 551 EXPECT_EQ(r0, r1); |
552 EXPECT_EQ(g0, g1); | 552 EXPECT_EQ(g0, g1); |
553 EXPECT_EQ(b0, b1); | 553 EXPECT_EQ(b0, b1); |
554 EXPECT_EQ(r0, r2); | 554 EXPECT_EQ(r0, r2); |
555 EXPECT_EQ(g0, g2); | 555 EXPECT_EQ(g0, g2); |
556 EXPECT_EQ(b0, b2); | 556 EXPECT_EQ(b0, b2); |
557 } | 557 } |
558 } | 558 } |
559 | 559 |
560 } // namespace libyuv | 560 } // namespace libyuv |
OLD | NEW |