OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2011 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 |
11 #include <stdlib.h> | 11 #include <stdlib.h> |
12 #include <time.h> | 12 #include <time.h> |
13 | 13 |
14 #include "libyuv/compare.h" | 14 #include "libyuv/compare.h" |
15 #include "libyuv/convert.h" | 15 #include "libyuv/convert.h" |
16 #include "libyuv/convert_argb.h" | 16 #include "libyuv/convert_argb.h" |
17 #include "libyuv/convert_from.h" | 17 #include "libyuv/convert_from.h" |
18 #include "libyuv/convert_from_argb.h" | 18 #include "libyuv/convert_from_argb.h" |
19 #include "libyuv/cpu_id.h" | 19 #include "libyuv/cpu_id.h" |
20 #include "libyuv/planar_functions.h" | 20 #include "libyuv/planar_functions.h" |
21 #include "libyuv/rotate.h" | 21 #include "libyuv/rotate.h" |
22 #include "libyuv/row.h" // For Sobel | 22 #include "libyuv/row.h" // For Sobel |
23 #include "../unit_test/unit_test.h" | 23 #include "../unit_test/unit_test.h" |
24 | 24 |
25 namespace libyuv { | 25 namespace libyuv { |
26 | 26 |
27 TEST_F(libyuvTest, TestAttenuate) { | 27 TEST_F(LibYUVPlanarTest, TestAttenuate) { |
28 const int kSize = 1280 * 4; | 28 const int kSize = 1280 * 4; |
29 align_buffer_64(orig_pixels, kSize); | 29 align_buffer_64(orig_pixels, kSize); |
30 align_buffer_64(atten_pixels, kSize); | 30 align_buffer_64(atten_pixels, kSize); |
31 align_buffer_64(unatten_pixels, kSize); | 31 align_buffer_64(unatten_pixels, kSize); |
32 align_buffer_64(atten2_pixels, kSize); | 32 align_buffer_64(atten2_pixels, kSize); |
33 | 33 |
34 // Test unattenuation clamps | 34 // Test unattenuation clamps |
35 orig_pixels[0 * 4 + 0] = 200u; | 35 orig_pixels[0 * 4 + 0] = 200u; |
36 orig_pixels[0 * 4 + 1] = 129u; | 36 orig_pixels[0 * 4 + 1] = 129u; |
37 orig_pixels[0 * 4 + 2] = 127u; | 37 orig_pixels[0 * 4 + 2] = 127u; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 if (abs_diff > max_diff) { | 138 if (abs_diff > max_diff) { |
139 max_diff = abs_diff; | 139 max_diff = abs_diff; |
140 } | 140 } |
141 } | 141 } |
142 free_aligned_buffer_64(src_argb); | 142 free_aligned_buffer_64(src_argb); |
143 free_aligned_buffer_64(dst_argb_c); | 143 free_aligned_buffer_64(dst_argb_c); |
144 free_aligned_buffer_64(dst_argb_opt); | 144 free_aligned_buffer_64(dst_argb_opt); |
145 return max_diff; | 145 return max_diff; |
146 } | 146 } |
147 | 147 |
148 TEST_F(libyuvTest, ARGBAttenuate_Any) { | 148 TEST_F(LibYUVPlanarTest, ARGBAttenuate_Any) { |
149 int max_diff = TestAttenuateI(benchmark_width_ - 1, benchmark_height_, | 149 int max_diff = TestAttenuateI(benchmark_width_ - 1, benchmark_height_, |
150 benchmark_iterations_, disable_cpu_flags_, +1, 0
); | 150 benchmark_iterations_, disable_cpu_flags_, |
| 151 +1, 0); |
151 EXPECT_LE(max_diff, 2); | 152 EXPECT_LE(max_diff, 2); |
152 } | 153 } |
153 | 154 |
154 TEST_F(libyuvTest, ARGBAttenuate_Unaligned) { | 155 TEST_F(LibYUVPlanarTest, ARGBAttenuate_Unaligned) { |
155 int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_, | 156 int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_, |
156 benchmark_iterations_, disable_cpu_flags_, +1, 1
); | 157 benchmark_iterations_, disable_cpu_flags_, |
| 158 +1, 1); |
157 EXPECT_LE(max_diff, 2); | 159 EXPECT_LE(max_diff, 2); |
158 } | 160 } |
159 | 161 |
160 TEST_F(libyuvTest, ARGBAttenuate_Invert) { | 162 TEST_F(LibYUVPlanarTest, ARGBAttenuate_Invert) { |
161 int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_, | 163 int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_, |
162 benchmark_iterations_, disable_cpu_flags_, -1, 0
); | 164 benchmark_iterations_, disable_cpu_flags_, |
| 165 -1, 0); |
163 EXPECT_LE(max_diff, 2); | 166 EXPECT_LE(max_diff, 2); |
164 } | 167 } |
165 | 168 |
166 TEST_F(libyuvTest, ARGBAttenuate_Opt) { | 169 TEST_F(LibYUVPlanarTest, ARGBAttenuate_Opt) { |
167 int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_, | 170 int max_diff = TestAttenuateI(benchmark_width_, benchmark_height_, |
168 benchmark_iterations_, disable_cpu_flags_, +1, 0
); | 171 benchmark_iterations_, disable_cpu_flags_, |
| 172 +1, 0); |
169 EXPECT_LE(max_diff, 2); | 173 EXPECT_LE(max_diff, 2); |
170 } | 174 } |
171 | 175 |
172 static int TestUnattenuateI(int width, int height, int benchmark_iterations, | 176 static int TestUnattenuateI(int width, int height, int benchmark_iterations, |
173 int disable_cpu_flags, int invert, int off) { | 177 int disable_cpu_flags, int invert, int off) { |
174 if (width < 1) { | 178 if (width < 1) { |
175 width = 1; | 179 width = 1; |
176 } | 180 } |
177 const int kBpp = 4; | 181 const int kBpp = 4; |
178 const int kStride = width * kBpp; | 182 const int kStride = width * kBpp; |
(...skipping 27 matching lines...) Expand all Loading... |
206 if (abs_diff > max_diff) { | 210 if (abs_diff > max_diff) { |
207 max_diff = abs_diff; | 211 max_diff = abs_diff; |
208 } | 212 } |
209 } | 213 } |
210 free_aligned_buffer_64(src_argb); | 214 free_aligned_buffer_64(src_argb); |
211 free_aligned_buffer_64(dst_argb_c); | 215 free_aligned_buffer_64(dst_argb_c); |
212 free_aligned_buffer_64(dst_argb_opt); | 216 free_aligned_buffer_64(dst_argb_opt); |
213 return max_diff; | 217 return max_diff; |
214 } | 218 } |
215 | 219 |
216 TEST_F(libyuvTest, ARGBUnattenuate_Any) { | 220 TEST_F(LibYUVPlanarTest, ARGBUnattenuate_Any) { |
217 int max_diff = TestUnattenuateI(benchmark_width_ - 1, benchmark_height_, | 221 int max_diff = TestUnattenuateI(benchmark_width_ - 1, benchmark_height_, |
218 benchmark_iterations_, disable_cpu_flags_, +1,
0); | 222 benchmark_iterations_, disable_cpu_flags_, |
| 223 +1, 0); |
219 EXPECT_LE(max_diff, 2); | 224 EXPECT_LE(max_diff, 2); |
220 } | 225 } |
221 | 226 |
222 TEST_F(libyuvTest, ARGBUnattenuate_Unaligned) { | 227 TEST_F(LibYUVPlanarTest, ARGBUnattenuate_Unaligned) { |
223 int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_, | 228 int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_, |
224 benchmark_iterations_, disable_cpu_flags_, +1,
1); | 229 benchmark_iterations_, disable_cpu_flags_, |
| 230 +1, 1); |
225 EXPECT_LE(max_diff, 2); | 231 EXPECT_LE(max_diff, 2); |
226 } | 232 } |
227 | 233 |
228 TEST_F(libyuvTest, ARGBUnattenuate_Invert) { | 234 TEST_F(LibYUVPlanarTest, ARGBUnattenuate_Invert) { |
229 int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_, | 235 int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_, |
230 benchmark_iterations_, disable_cpu_flags_, -1,
0); | 236 benchmark_iterations_, disable_cpu_flags_, |
| 237 -1, 0); |
231 EXPECT_LE(max_diff, 2); | 238 EXPECT_LE(max_diff, 2); |
232 } | 239 } |
233 | 240 |
234 TEST_F(libyuvTest, ARGBUnattenuate_Opt) { | 241 TEST_F(LibYUVPlanarTest, ARGBUnattenuate_Opt) { |
235 int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_, | 242 int max_diff = TestUnattenuateI(benchmark_width_, benchmark_height_, |
236 benchmark_iterations_, disable_cpu_flags_, +1,
0); | 243 benchmark_iterations_, disable_cpu_flags_, |
| 244 +1, 0); |
237 EXPECT_LE(max_diff, 2); | 245 EXPECT_LE(max_diff, 2); |
238 } | 246 } |
239 | 247 |
240 TEST_F(libyuvTest, TestARGBComputeCumulativeSum) { | 248 TEST_F(LibYUVPlanarTest, TestARGBComputeCumulativeSum) { |
241 SIMD_ALIGNED(uint8 orig_pixels[16][16][4]); | 249 SIMD_ALIGNED(uint8 orig_pixels[16][16][4]); |
242 SIMD_ALIGNED(int32 added_pixels[16][16][4]); | 250 SIMD_ALIGNED(int32 added_pixels[16][16][4]); |
243 | 251 |
244 for (int y = 0; y < 16; ++y) { | 252 for (int y = 0; y < 16; ++y) { |
245 for (int x = 0; x < 16; ++x) { | 253 for (int x = 0; x < 16; ++x) { |
246 orig_pixels[y][x][0] = 1u; | 254 orig_pixels[y][x][0] = 1u; |
247 orig_pixels[y][x][1] = 2u; | 255 orig_pixels[y][x][1] = 2u; |
248 orig_pixels[y][x][2] = 3u; | 256 orig_pixels[y][x][2] = 3u; |
249 orig_pixels[y][x][3] = 255u; | 257 orig_pixels[y][x][3] = 255u; |
250 } | 258 } |
251 } | 259 } |
252 | 260 |
253 ARGBComputeCumulativeSum(&orig_pixels[0][0][0], 16 * 4, | 261 ARGBComputeCumulativeSum(&orig_pixels[0][0][0], 16 * 4, |
254 &added_pixels[0][0][0], 16 * 4, | 262 &added_pixels[0][0][0], 16 * 4, |
255 16, 16); | 263 16, 16); |
256 | 264 |
257 for (int y = 0; y < 16; ++y) { | 265 for (int y = 0; y < 16; ++y) { |
258 for (int x = 0; x < 16; ++x) { | 266 for (int x = 0; x < 16; ++x) { |
259 EXPECT_EQ((x + 1) * (y + 1), added_pixels[y][x][0]); | 267 EXPECT_EQ((x + 1) * (y + 1), added_pixels[y][x][0]); |
260 EXPECT_EQ((x + 1) * (y + 1) * 2, added_pixels[y][x][1]); | 268 EXPECT_EQ((x + 1) * (y + 1) * 2, added_pixels[y][x][1]); |
261 EXPECT_EQ((x + 1) * (y + 1) * 3, added_pixels[y][x][2]); | 269 EXPECT_EQ((x + 1) * (y + 1) * 3, added_pixels[y][x][2]); |
262 EXPECT_EQ((x + 1) * (y + 1) * 255, added_pixels[y][x][3]); | 270 EXPECT_EQ((x + 1) * (y + 1) * 255, added_pixels[y][x][3]); |
263 } | 271 } |
264 } | 272 } |
265 } | 273 } |
266 | 274 |
267 TEST_F(libyuvTest, TestARGBGray) { | 275 TEST_F(LibYUVPlanarTest, TestARGBGray) { |
268 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); | 276 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); |
269 memset(orig_pixels, 0, sizeof(orig_pixels)); | 277 memset(orig_pixels, 0, sizeof(orig_pixels)); |
270 | 278 |
271 // Test blue | 279 // Test blue |
272 orig_pixels[0][0] = 255u; | 280 orig_pixels[0][0] = 255u; |
273 orig_pixels[0][1] = 0u; | 281 orig_pixels[0][1] = 0u; |
274 orig_pixels[0][2] = 0u; | 282 orig_pixels[0][2] = 0u; |
275 orig_pixels[0][3] = 128u; | 283 orig_pixels[0][3] = 128u; |
276 // Test green | 284 // Test green |
277 orig_pixels[1][0] = 0u; | 285 orig_pixels[1][0] = 0u; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 orig_pixels[i][0] = i; | 336 orig_pixels[i][0] = i; |
329 orig_pixels[i][1] = i / 2; | 337 orig_pixels[i][1] = i / 2; |
330 orig_pixels[i][2] = i / 3; | 338 orig_pixels[i][2] = i / 3; |
331 orig_pixels[i][3] = i; | 339 orig_pixels[i][3] = i; |
332 } | 340 } |
333 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 341 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
334 ARGBGray(&orig_pixels[0][0], 0, 0, 0, 1280, 1); | 342 ARGBGray(&orig_pixels[0][0], 0, 0, 0, 1280, 1); |
335 } | 343 } |
336 } | 344 } |
337 | 345 |
338 TEST_F(libyuvTest, TestARGBGrayTo) { | 346 TEST_F(LibYUVPlanarTest, TestARGBGrayTo) { |
339 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); | 347 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); |
340 SIMD_ALIGNED(uint8 gray_pixels[1280][4]); | 348 SIMD_ALIGNED(uint8 gray_pixels[1280][4]); |
341 memset(orig_pixels, 0, sizeof(orig_pixels)); | 349 memset(orig_pixels, 0, sizeof(orig_pixels)); |
342 | 350 |
343 // Test blue | 351 // Test blue |
344 orig_pixels[0][0] = 255u; | 352 orig_pixels[0][0] = 255u; |
345 orig_pixels[0][1] = 0u; | 353 orig_pixels[0][1] = 0u; |
346 orig_pixels[0][2] = 0u; | 354 orig_pixels[0][2] = 0u; |
347 orig_pixels[0][3] = 128u; | 355 orig_pixels[0][3] = 128u; |
348 // Test green | 356 // Test green |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 orig_pixels[i][0] = i; | 408 orig_pixels[i][0] = i; |
401 orig_pixels[i][1] = i / 2; | 409 orig_pixels[i][1] = i / 2; |
402 orig_pixels[i][2] = i / 3; | 410 orig_pixels[i][2] = i / 3; |
403 orig_pixels[i][3] = i; | 411 orig_pixels[i][3] = i; |
404 } | 412 } |
405 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 413 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
406 ARGBGrayTo(&orig_pixels[0][0], 0, &gray_pixels[0][0], 0, 1280, 1); | 414 ARGBGrayTo(&orig_pixels[0][0], 0, &gray_pixels[0][0], 0, 1280, 1); |
407 } | 415 } |
408 } | 416 } |
409 | 417 |
410 TEST_F(libyuvTest, TestARGBSepia) { | 418 TEST_F(LibYUVPlanarTest, TestARGBSepia) { |
411 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); | 419 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); |
412 memset(orig_pixels, 0, sizeof(orig_pixels)); | 420 memset(orig_pixels, 0, sizeof(orig_pixels)); |
413 | 421 |
414 // Test blue | 422 // Test blue |
415 orig_pixels[0][0] = 255u; | 423 orig_pixels[0][0] = 255u; |
416 orig_pixels[0][1] = 0u; | 424 orig_pixels[0][1] = 0u; |
417 orig_pixels[0][2] = 0u; | 425 orig_pixels[0][2] = 0u; |
418 orig_pixels[0][3] = 128u; | 426 orig_pixels[0][3] = 128u; |
419 // Test green | 427 // Test green |
420 orig_pixels[1][0] = 0u; | 428 orig_pixels[1][0] = 0u; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 orig_pixels[i][0] = i; | 480 orig_pixels[i][0] = i; |
473 orig_pixels[i][1] = i / 2; | 481 orig_pixels[i][1] = i / 2; |
474 orig_pixels[i][2] = i / 3; | 482 orig_pixels[i][2] = i / 3; |
475 orig_pixels[i][3] = i; | 483 orig_pixels[i][3] = i; |
476 } | 484 } |
477 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 485 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
478 ARGBSepia(&orig_pixels[0][0], 0, 0, 0, 1280, 1); | 486 ARGBSepia(&orig_pixels[0][0], 0, 0, 0, 1280, 1); |
479 } | 487 } |
480 } | 488 } |
481 | 489 |
482 TEST_F(libyuvTest, TestARGBColorMatrix) { | 490 TEST_F(LibYUVPlanarTest, TestARGBColorMatrix) { |
483 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); | 491 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); |
484 SIMD_ALIGNED(uint8 dst_pixels_opt[1280][4]); | 492 SIMD_ALIGNED(uint8 dst_pixels_opt[1280][4]); |
485 SIMD_ALIGNED(uint8 dst_pixels_c[1280][4]); | 493 SIMD_ALIGNED(uint8 dst_pixels_c[1280][4]); |
486 | 494 |
487 // Matrix for Sepia. | 495 // Matrix for Sepia. |
488 SIMD_ALIGNED(static const int8 kRGBToSepia[]) = { | 496 SIMD_ALIGNED(static const int8 kRGBToSepia[]) = { |
489 17 / 2, 68 / 2, 35 / 2, 0, | 497 17 / 2, 68 / 2, 35 / 2, 0, |
490 22 / 2, 88 / 2, 45 / 2, 0, | 498 22 / 2, 88 / 2, 45 / 2, 0, |
491 24 / 2, 98 / 2, 50 / 2, 0, | 499 24 / 2, 98 / 2, 50 / 2, 0, |
492 0, 0, 0, 64, // Copy alpha. | 500 0, 0, 0, 64, // Copy alpha. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } | 558 } |
551 | 559 |
552 for (int i = 0; i < 1280; ++i) { | 560 for (int i = 0; i < 1280; ++i) { |
553 EXPECT_EQ(dst_pixels_c[i][0], dst_pixels_opt[i][0]); | 561 EXPECT_EQ(dst_pixels_c[i][0], dst_pixels_opt[i][0]); |
554 EXPECT_EQ(dst_pixels_c[i][1], dst_pixels_opt[i][1]); | 562 EXPECT_EQ(dst_pixels_c[i][1], dst_pixels_opt[i][1]); |
555 EXPECT_EQ(dst_pixels_c[i][2], dst_pixels_opt[i][2]); | 563 EXPECT_EQ(dst_pixels_c[i][2], dst_pixels_opt[i][2]); |
556 EXPECT_EQ(dst_pixels_c[i][3], dst_pixels_opt[i][3]); | 564 EXPECT_EQ(dst_pixels_c[i][3], dst_pixels_opt[i][3]); |
557 } | 565 } |
558 } | 566 } |
559 | 567 |
560 TEST_F(libyuvTest, TestRGBColorMatrix) { | 568 TEST_F(LibYUVPlanarTest, TestRGBColorMatrix) { |
561 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); | 569 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); |
562 | 570 |
563 // Matrix for Sepia. | 571 // Matrix for Sepia. |
564 SIMD_ALIGNED(static const int8 kRGBToSepia[]) = { | 572 SIMD_ALIGNED(static const int8 kRGBToSepia[]) = { |
565 17, 68, 35, 0, | 573 17, 68, 35, 0, |
566 22, 88, 45, 0, | 574 22, 88, 45, 0, |
567 24, 98, 50, 0, | 575 24, 98, 50, 0, |
568 0, 0, 0, 0, // Unused but makes matrix 16 bytes. | 576 0, 0, 0, 0, // Unused but makes matrix 16 bytes. |
569 }; | 577 }; |
570 memset(orig_pixels, 0, sizeof(orig_pixels)); | 578 memset(orig_pixels, 0, sizeof(orig_pixels)); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 orig_pixels[i][0] = i; | 620 orig_pixels[i][0] = i; |
613 orig_pixels[i][1] = i / 2; | 621 orig_pixels[i][1] = i / 2; |
614 orig_pixels[i][2] = i / 3; | 622 orig_pixels[i][2] = i / 3; |
615 orig_pixels[i][3] = i; | 623 orig_pixels[i][3] = i; |
616 } | 624 } |
617 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 625 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
618 RGBColorMatrix(&orig_pixels[0][0], 0, &kRGBToSepia[0], 0, 0, 1280, 1); | 626 RGBColorMatrix(&orig_pixels[0][0], 0, &kRGBToSepia[0], 0, 0, 1280, 1); |
619 } | 627 } |
620 } | 628 } |
621 | 629 |
622 TEST_F(libyuvTest, TestARGBColorTable) { | 630 TEST_F(LibYUVPlanarTest, TestARGBColorTable) { |
623 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); | 631 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); |
624 memset(orig_pixels, 0, sizeof(orig_pixels)); | 632 memset(orig_pixels, 0, sizeof(orig_pixels)); |
625 | 633 |
626 // Matrix for Sepia. | 634 // Matrix for Sepia. |
627 static const uint8 kARGBTable[256 * 4] = { | 635 static const uint8 kARGBTable[256 * 4] = { |
628 1u, 2u, 3u, 4u, | 636 1u, 2u, 3u, 4u, |
629 5u, 6u, 7u, 8u, | 637 5u, 6u, 7u, 8u, |
630 9u, 10u, 11u, 12u, | 638 9u, 10u, 11u, 12u, |
631 13u, 14u, 15u, 16u, | 639 13u, 14u, 15u, 16u, |
632 }; | 640 }; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 orig_pixels[i][1] = i / 2; | 679 orig_pixels[i][1] = i / 2; |
672 orig_pixels[i][2] = i / 3; | 680 orig_pixels[i][2] = i / 3; |
673 orig_pixels[i][3] = i; | 681 orig_pixels[i][3] = i; |
674 } | 682 } |
675 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 683 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
676 ARGBColorTable(&orig_pixels[0][0], 0, &kARGBTable[0], 0, 0, 1280, 1); | 684 ARGBColorTable(&orig_pixels[0][0], 0, &kARGBTable[0], 0, 0, 1280, 1); |
677 } | 685 } |
678 } | 686 } |
679 | 687 |
680 // Same as TestARGBColorTable except alpha does not change. | 688 // Same as TestARGBColorTable except alpha does not change. |
681 TEST_F(libyuvTest, TestRGBColorTable) { | 689 TEST_F(LibYUVPlanarTest, TestRGBColorTable) { |
682 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); | 690 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); |
683 memset(orig_pixels, 0, sizeof(orig_pixels)); | 691 memset(orig_pixels, 0, sizeof(orig_pixels)); |
684 | 692 |
685 // Matrix for Sepia. | 693 // Matrix for Sepia. |
686 static const uint8 kARGBTable[256 * 4] = { | 694 static const uint8 kARGBTable[256 * 4] = { |
687 1u, 2u, 3u, 4u, | 695 1u, 2u, 3u, 4u, |
688 5u, 6u, 7u, 8u, | 696 5u, 6u, 7u, 8u, |
689 9u, 10u, 11u, 12u, | 697 9u, 10u, 11u, 12u, |
690 13u, 14u, 15u, 16u, | 698 13u, 14u, 15u, 16u, |
691 }; | 699 }; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 orig_pixels[i][0] = i; | 737 orig_pixels[i][0] = i; |
730 orig_pixels[i][1] = i / 2; | 738 orig_pixels[i][1] = i / 2; |
731 orig_pixels[i][2] = i / 3; | 739 orig_pixels[i][2] = i / 3; |
732 orig_pixels[i][3] = i; | 740 orig_pixels[i][3] = i; |
733 } | 741 } |
734 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 742 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
735 RGBColorTable(&orig_pixels[0][0], 0, &kARGBTable[0], 0, 0, 1280, 1); | 743 RGBColorTable(&orig_pixels[0][0], 0, &kARGBTable[0], 0, 0, 1280, 1); |
736 } | 744 } |
737 } | 745 } |
738 | 746 |
739 TEST_F(libyuvTest, TestARGBQuantize) { | 747 TEST_F(LibYUVPlanarTest, TestARGBQuantize) { |
740 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); | 748 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); |
741 | 749 |
742 for (int i = 0; i < 1280; ++i) { | 750 for (int i = 0; i < 1280; ++i) { |
743 orig_pixels[i][0] = i; | 751 orig_pixels[i][0] = i; |
744 orig_pixels[i][1] = i / 2; | 752 orig_pixels[i][1] = i / 2; |
745 orig_pixels[i][2] = i / 3; | 753 orig_pixels[i][2] = i / 3; |
746 orig_pixels[i][3] = i; | 754 orig_pixels[i][3] = i; |
747 } | 755 } |
748 ARGBQuantize(&orig_pixels[0][0], 0, | 756 ARGBQuantize(&orig_pixels[0][0], 0, |
749 (65536 + (8 / 2)) / 8, 8, 8 / 2, 0, 0, 1280, 1); | 757 (65536 + (8 / 2)) / 8, 8, 8 / 2, 0, 0, 1280, 1); |
750 | 758 |
751 for (int i = 0; i < 1280; ++i) { | 759 for (int i = 0; i < 1280; ++i) { |
752 EXPECT_EQ((i / 8 * 8 + 8 / 2) & 255, orig_pixels[i][0]); | 760 EXPECT_EQ((i / 8 * 8 + 8 / 2) & 255, orig_pixels[i][0]); |
753 EXPECT_EQ((i / 2 / 8 * 8 + 8 / 2) & 255, orig_pixels[i][1]); | 761 EXPECT_EQ((i / 2 / 8 * 8 + 8 / 2) & 255, orig_pixels[i][1]); |
754 EXPECT_EQ((i / 3 / 8 * 8 + 8 / 2) & 255, orig_pixels[i][2]); | 762 EXPECT_EQ((i / 3 / 8 * 8 + 8 / 2) & 255, orig_pixels[i][2]); |
755 EXPECT_EQ(i & 255, orig_pixels[i][3]); | 763 EXPECT_EQ(i & 255, orig_pixels[i][3]); |
756 } | 764 } |
757 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 765 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
758 ARGBQuantize(&orig_pixels[0][0], 0, | 766 ARGBQuantize(&orig_pixels[0][0], 0, |
759 (65536 + (8 / 2)) / 8, 8, 8 / 2, 0, 0, 1280, 1); | 767 (65536 + (8 / 2)) / 8, 8, 8 / 2, 0, 0, 1280, 1); |
760 } | 768 } |
761 } | 769 } |
762 | 770 |
763 TEST_F(libyuvTest, TestARGBMirror) { | 771 TEST_F(LibYUVPlanarTest, TestARGBMirror) { |
764 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); | 772 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); |
765 SIMD_ALIGNED(uint8 dst_pixels[1280][4]); | 773 SIMD_ALIGNED(uint8 dst_pixels[1280][4]); |
766 | 774 |
767 for (int i = 0; i < 1280; ++i) { | 775 for (int i = 0; i < 1280; ++i) { |
768 orig_pixels[i][0] = i; | 776 orig_pixels[i][0] = i; |
769 orig_pixels[i][1] = i / 2; | 777 orig_pixels[i][1] = i / 2; |
770 orig_pixels[i][2] = i / 3; | 778 orig_pixels[i][2] = i / 3; |
771 orig_pixels[i][3] = i / 4; | 779 orig_pixels[i][3] = i / 4; |
772 } | 780 } |
773 ARGBMirror(&orig_pixels[0][0], 0, &dst_pixels[0][0], 0, 1280, 1); | 781 ARGBMirror(&orig_pixels[0][0], 0, &dst_pixels[0][0], 0, 1280, 1); |
774 | 782 |
775 for (int i = 0; i < 1280; ++i) { | 783 for (int i = 0; i < 1280; ++i) { |
776 EXPECT_EQ(i & 255, dst_pixels[1280 - 1 - i][0]); | 784 EXPECT_EQ(i & 255, dst_pixels[1280 - 1 - i][0]); |
777 EXPECT_EQ((i / 2) & 255, dst_pixels[1280 - 1 - i][1]); | 785 EXPECT_EQ((i / 2) & 255, dst_pixels[1280 - 1 - i][1]); |
778 EXPECT_EQ((i / 3) & 255, dst_pixels[1280 - 1 - i][2]); | 786 EXPECT_EQ((i / 3) & 255, dst_pixels[1280 - 1 - i][2]); |
779 EXPECT_EQ((i / 4) & 255, dst_pixels[1280 - 1 - i][3]); | 787 EXPECT_EQ((i / 4) & 255, dst_pixels[1280 - 1 - i][3]); |
780 } | 788 } |
781 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 789 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
782 ARGBMirror(&orig_pixels[0][0], 0, &dst_pixels[0][0], 0, 1280, 1); | 790 ARGBMirror(&orig_pixels[0][0], 0, &dst_pixels[0][0], 0, 1280, 1); |
783 } | 791 } |
784 } | 792 } |
785 | 793 |
786 TEST_F(libyuvTest, TestShade) { | 794 TEST_F(LibYUVPlanarTest, TestShade) { |
787 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); | 795 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); |
788 SIMD_ALIGNED(uint8 shade_pixels[1280][4]); | 796 SIMD_ALIGNED(uint8 shade_pixels[1280][4]); |
789 memset(orig_pixels, 0, sizeof(orig_pixels)); | 797 memset(orig_pixels, 0, sizeof(orig_pixels)); |
790 | 798 |
791 orig_pixels[0][0] = 10u; | 799 orig_pixels[0][0] = 10u; |
792 orig_pixels[0][1] = 20u; | 800 orig_pixels[0][1] = 20u; |
793 orig_pixels[0][2] = 40u; | 801 orig_pixels[0][2] = 40u; |
794 orig_pixels[0][3] = 80u; | 802 orig_pixels[0][3] = 80u; |
795 orig_pixels[1][0] = 0u; | 803 orig_pixels[1][0] = 0u; |
796 orig_pixels[1][1] = 0u; | 804 orig_pixels[1][1] = 0u; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 EXPECT_EQ(5u, shade_pixels[0][1]); | 842 EXPECT_EQ(5u, shade_pixels[0][1]); |
835 EXPECT_EQ(5u, shade_pixels[0][2]); | 843 EXPECT_EQ(5u, shade_pixels[0][2]); |
836 EXPECT_EQ(5u, shade_pixels[0][3]); | 844 EXPECT_EQ(5u, shade_pixels[0][3]); |
837 | 845 |
838 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 846 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
839 ARGBShade(&orig_pixels[0][0], 0, &shade_pixels[0][0], 0, 1280, 1, | 847 ARGBShade(&orig_pixels[0][0], 0, &shade_pixels[0][0], 0, 1280, 1, |
840 0x80808080); | 848 0x80808080); |
841 } | 849 } |
842 } | 850 } |
843 | 851 |
844 TEST_F(libyuvTest, TestInterpolate) { | 852 TEST_F(LibYUVPlanarTest, TestInterpolate) { |
845 SIMD_ALIGNED(uint8 orig_pixels_0[1280][4]); | 853 SIMD_ALIGNED(uint8 orig_pixels_0[1280][4]); |
846 SIMD_ALIGNED(uint8 orig_pixels_1[1280][4]); | 854 SIMD_ALIGNED(uint8 orig_pixels_1[1280][4]); |
847 SIMD_ALIGNED(uint8 interpolate_pixels[1280][4]); | 855 SIMD_ALIGNED(uint8 interpolate_pixels[1280][4]); |
848 memset(orig_pixels_0, 0, sizeof(orig_pixels_0)); | 856 memset(orig_pixels_0, 0, sizeof(orig_pixels_0)); |
849 memset(orig_pixels_1, 0, sizeof(orig_pixels_1)); | 857 memset(orig_pixels_1, 0, sizeof(orig_pixels_1)); |
850 | 858 |
851 orig_pixels_0[0][0] = 16u; | 859 orig_pixels_0[0][0] = 16u; |
852 orig_pixels_0[0][1] = 32u; | 860 orig_pixels_0[0][1] = 32u; |
853 orig_pixels_0[0][2] = 64u; | 861 orig_pixels_0[0][2] = 64u; |
854 orig_pixels_0[0][3] = 128u; | 862 orig_pixels_0[0][3] = 128u; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 | 926 |
919 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 927 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
920 ARGBInterpolate(&orig_pixels_0[0][0], 0, &orig_pixels_1[0][0], 0, | 928 ARGBInterpolate(&orig_pixels_0[0][0], 0, &orig_pixels_1[0][0], 0, |
921 &interpolate_pixels[0][0], 0, 1280, 1, 128); | 929 &interpolate_pixels[0][0], 0, 1280, 1, 128); |
922 } | 930 } |
923 } | 931 } |
924 | 932 |
925 #define TESTTERP(FMT_A, BPP_A, STRIDE_A, \ | 933 #define TESTTERP(FMT_A, BPP_A, STRIDE_A, \ |
926 FMT_B, BPP_B, STRIDE_B, \ | 934 FMT_B, BPP_B, STRIDE_B, \ |
927 W1280, TERP, DIFF, N, NEG, OFF) \ | 935 W1280, TERP, DIFF, N, NEG, OFF) \ |
928 TEST_F(libyuvTest, ARGBInterpolate##TERP##N) { \ | 936 TEST_F(LibYUVPlanarTest, ARGBInterpolate##TERP##N) { \ |
929 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ | 937 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ |
930 const int kHeight = benchmark_height_; \ | 938 const int kHeight = benchmark_height_; \ |
931 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A; \ | 939 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A; \ |
932 const int kStrideB = (kWidth * BPP_B + STRIDE_B - 1) / STRIDE_B * STRIDE_B; \ | 940 const int kStrideB = (kWidth * BPP_B + STRIDE_B - 1) / STRIDE_B * STRIDE_B; \ |
933 align_buffer_64(src_argb_a, kStrideA * kHeight + OFF); \ | 941 align_buffer_64(src_argb_a, kStrideA * kHeight + OFF); \ |
934 align_buffer_64(src_argb_b, kStrideA * kHeight + OFF); \ | 942 align_buffer_64(src_argb_b, kStrideA * kHeight + OFF); \ |
935 align_buffer_64(dst_argb_c, kStrideB * kHeight); \ | 943 align_buffer_64(dst_argb_c, kStrideB * kHeight); \ |
936 align_buffer_64(dst_argb_opt, kStrideB * kHeight); \ | 944 align_buffer_64(dst_argb_opt, kStrideB * kHeight); \ |
937 for (int i = 0; i < kStrideA * kHeight; ++i) { \ | 945 for (int i = 0; i < kStrideA * kHeight; ++i) { \ |
938 src_argb_a[i + OFF] = (fastrand() & 0xff);
\ | 946 src_argb_a[i + OFF] = (fastrand() & 0xff); \ |
939 src_argb_b[i + OFF] = (fastrand() & 0xff);
\ | 947 src_argb_b[i + OFF] = (fastrand() & 0xff); \ |
940 } \ | 948 } \ |
941 MaskCpuFlags(disable_cpu_flags_);
\ | 949 MaskCpuFlags(disable_cpu_flags_); \ |
942 ARGBInterpolate(src_argb_a + OFF, kStrideA, \ | 950 ARGBInterpolate(src_argb_a + OFF, kStrideA, \ |
943 src_argb_b + OFF, kStrideA, \ | 951 src_argb_b + OFF, kStrideA, \ |
944 dst_argb_c, kStrideB, \ | 952 dst_argb_c, kStrideB, \ |
945 kWidth, NEG kHeight, TERP); \ | 953 kWidth, NEG kHeight, TERP); \ |
946 MaskCpuFlags(-1); \ | 954 MaskCpuFlags(-1); \ |
947 for (int i = 0; i < benchmark_iterations_; ++i) { \ | 955 for (int i = 0; i < benchmark_iterations_; ++i) { \ |
948 ARGBInterpolate(src_argb_a + OFF, kStrideA, \ | 956 ARGBInterpolate(src_argb_a + OFF, kStrideA, \ |
949 src_argb_b + OFF, kStrideA, \ | 957 src_argb_b + OFF, kStrideA, \ |
950 dst_argb_opt, kStrideB, \ | 958 dst_argb_opt, kStrideB, \ |
951 kWidth, NEG kHeight, TERP); \ | 959 kWidth, NEG kHeight, TERP); \ |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 max_diff = abs_diff; | 1035 max_diff = abs_diff; |
1028 } | 1036 } |
1029 } | 1037 } |
1030 free_aligned_buffer_64(src_argb_a); | 1038 free_aligned_buffer_64(src_argb_a); |
1031 free_aligned_buffer_64(src_argb_b); | 1039 free_aligned_buffer_64(src_argb_b); |
1032 free_aligned_buffer_64(dst_argb_c); | 1040 free_aligned_buffer_64(dst_argb_c); |
1033 free_aligned_buffer_64(dst_argb_opt); | 1041 free_aligned_buffer_64(dst_argb_opt); |
1034 return max_diff; | 1042 return max_diff; |
1035 } | 1043 } |
1036 | 1044 |
1037 TEST_F(libyuvTest, ARGBBlend_Any) { | 1045 TEST_F(LibYUVPlanarTest, ARGBBlend_Any) { |
1038 int max_diff = TestBlend(benchmark_width_ - 4, benchmark_height_, | 1046 int max_diff = TestBlend(benchmark_width_ - 4, benchmark_height_, |
1039 benchmark_iterations_, disable_cpu_flags_, +1, 0); | 1047 benchmark_iterations_, disable_cpu_flags_, +1, 0); |
1040 EXPECT_LE(max_diff, 1); | 1048 EXPECT_LE(max_diff, 1); |
1041 } | 1049 } |
1042 | 1050 |
1043 TEST_F(libyuvTest, ARGBBlend_Unaligned) { | 1051 TEST_F(LibYUVPlanarTest, ARGBBlend_Unaligned) { |
1044 int max_diff = TestBlend(benchmark_width_, benchmark_height_, | 1052 int max_diff = TestBlend(benchmark_width_, benchmark_height_, |
1045 benchmark_iterations_, disable_cpu_flags_, +1, 1); | 1053 benchmark_iterations_, disable_cpu_flags_, +1, 1); |
1046 EXPECT_LE(max_diff, 1); | 1054 EXPECT_LE(max_diff, 1); |
1047 } | 1055 } |
1048 | 1056 |
1049 TEST_F(libyuvTest, ARGBBlend_Invert) { | 1057 TEST_F(LibYUVPlanarTest, ARGBBlend_Invert) { |
1050 int max_diff = TestBlend(benchmark_width_, benchmark_height_, | 1058 int max_diff = TestBlend(benchmark_width_, benchmark_height_, |
1051 benchmark_iterations_, disable_cpu_flags_, -1, 0); | 1059 benchmark_iterations_, disable_cpu_flags_, -1, 0); |
1052 EXPECT_LE(max_diff, 1); | 1060 EXPECT_LE(max_diff, 1); |
1053 } | 1061 } |
1054 | 1062 |
1055 TEST_F(libyuvTest, ARGBBlend_Opt) { | 1063 TEST_F(LibYUVPlanarTest, ARGBBlend_Opt) { |
1056 int max_diff = TestBlend(benchmark_width_, benchmark_height_, | 1064 int max_diff = TestBlend(benchmark_width_, benchmark_height_, |
1057 benchmark_iterations_, disable_cpu_flags_, +1, 0); | 1065 benchmark_iterations_, disable_cpu_flags_, +1, 0); |
1058 EXPECT_LE(max_diff, 1); | 1066 EXPECT_LE(max_diff, 1); |
1059 } | 1067 } |
1060 | 1068 |
1061 TEST_F(libyuvTest, TestAffine) { | 1069 TEST_F(LibYUVPlanarTest, TestAffine) { |
1062 SIMD_ALIGNED(uint8 orig_pixels_0[1280][4]); | 1070 SIMD_ALIGNED(uint8 orig_pixels_0[1280][4]); |
1063 SIMD_ALIGNED(uint8 interpolate_pixels_C[1280][4]); | 1071 SIMD_ALIGNED(uint8 interpolate_pixels_C[1280][4]); |
1064 | 1072 |
1065 for (int i = 0; i < 1280; ++i) { | 1073 for (int i = 0; i < 1280; ++i) { |
1066 for (int j = 0; j < 4; ++j) { | 1074 for (int j = 0; j < 4; ++j) { |
1067 orig_pixels_0[i][j] = i; | 1075 orig_pixels_0[i][j] = i; |
1068 } | 1076 } |
1069 } | 1077 } |
1070 | 1078 |
1071 float uv_step[4] = { 0.f, 0.f, 0.75f, 0.f }; | 1079 float uv_step[4] = { 0.f, 0.f, 0.75f, 0.f }; |
(...skipping 13 matching lines...) Expand all Loading... |
1085 int has_sse2 = TestCpuFlag(kCpuHasSSE2); | 1093 int has_sse2 = TestCpuFlag(kCpuHasSSE2); |
1086 if (has_sse2) { | 1094 if (has_sse2) { |
1087 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 1095 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
1088 ARGBAffineRow_SSE2(&orig_pixels_0[0][0], 0, &interpolate_pixels_Opt[0][0], | 1096 ARGBAffineRow_SSE2(&orig_pixels_0[0][0], 0, &interpolate_pixels_Opt[0][0], |
1089 uv_step, 1280); | 1097 uv_step, 1280); |
1090 } | 1098 } |
1091 } | 1099 } |
1092 #endif | 1100 #endif |
1093 } | 1101 } |
1094 | 1102 |
1095 TEST_F(libyuvTest, TestSobelX) { | 1103 TEST_F(LibYUVPlanarTest, TestSobelX) { |
1096 SIMD_ALIGNED(uint8 orig_pixels_0[1280 + 2]); | 1104 SIMD_ALIGNED(uint8 orig_pixels_0[1280 + 2]); |
1097 SIMD_ALIGNED(uint8 orig_pixels_1[1280 + 2]); | 1105 SIMD_ALIGNED(uint8 orig_pixels_1[1280 + 2]); |
1098 SIMD_ALIGNED(uint8 orig_pixels_2[1280 + 2]); | 1106 SIMD_ALIGNED(uint8 orig_pixels_2[1280 + 2]); |
1099 SIMD_ALIGNED(uint8 sobel_pixels_c[1280]); | 1107 SIMD_ALIGNED(uint8 sobel_pixels_c[1280]); |
1100 SIMD_ALIGNED(uint8 sobel_pixels_opt[1280]); | 1108 SIMD_ALIGNED(uint8 sobel_pixels_opt[1280]); |
1101 | 1109 |
1102 for (int i = 0; i < 1280 + 2; ++i) { | 1110 for (int i = 0; i < 1280 + 2; ++i) { |
1103 orig_pixels_0[i] = i; | 1111 orig_pixels_0[i] = i; |
1104 orig_pixels_1[i] = i * 2; | 1112 orig_pixels_1[i] = i * 2; |
1105 orig_pixels_2[i] = i * 3; | 1113 orig_pixels_2[i] = i * 3; |
(...skipping 21 matching lines...) Expand all Loading... |
1127 #endif | 1135 #endif |
1128 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 1136 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
1129 SobelXRow(orig_pixels_0, orig_pixels_1, orig_pixels_2, | 1137 SobelXRow(orig_pixels_0, orig_pixels_1, orig_pixels_2, |
1130 sobel_pixels_opt, 1280); | 1138 sobel_pixels_opt, 1280); |
1131 } | 1139 } |
1132 for (int i = 0; i < 1280; ++i) { | 1140 for (int i = 0; i < 1280; ++i) { |
1133 EXPECT_EQ(sobel_pixels_c[i], sobel_pixels_opt[i]); | 1141 EXPECT_EQ(sobel_pixels_c[i], sobel_pixels_opt[i]); |
1134 } | 1142 } |
1135 } | 1143 } |
1136 | 1144 |
1137 TEST_F(libyuvTest, TestSobelY) { | 1145 TEST_F(LibYUVPlanarTest, TestSobelY) { |
1138 SIMD_ALIGNED(uint8 orig_pixels_0[1280 + 2]); | 1146 SIMD_ALIGNED(uint8 orig_pixels_0[1280 + 2]); |
1139 SIMD_ALIGNED(uint8 orig_pixels_1[1280 + 2]); | 1147 SIMD_ALIGNED(uint8 orig_pixels_1[1280 + 2]); |
1140 SIMD_ALIGNED(uint8 sobel_pixels_c[1280]); | 1148 SIMD_ALIGNED(uint8 sobel_pixels_c[1280]); |
1141 SIMD_ALIGNED(uint8 sobel_pixels_opt[1280]); | 1149 SIMD_ALIGNED(uint8 sobel_pixels_opt[1280]); |
1142 | 1150 |
1143 for (int i = 0; i < 1280 + 2; ++i) { | 1151 for (int i = 0; i < 1280 + 2; ++i) { |
1144 orig_pixels_0[i] = i; | 1152 orig_pixels_0[i] = i; |
1145 orig_pixels_1[i] = i * 2; | 1153 orig_pixels_1[i] = i * 2; |
1146 } | 1154 } |
1147 | 1155 |
(...skipping 15 matching lines...) Expand all Loading... |
1163 } | 1171 } |
1164 #endif | 1172 #endif |
1165 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 1173 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
1166 SobelYRow(orig_pixels_0, orig_pixels_1, sobel_pixels_opt, 1280); | 1174 SobelYRow(orig_pixels_0, orig_pixels_1, sobel_pixels_opt, 1280); |
1167 } | 1175 } |
1168 for (int i = 0; i < 1280; ++i) { | 1176 for (int i = 0; i < 1280; ++i) { |
1169 EXPECT_EQ(sobel_pixels_c[i], sobel_pixels_opt[i]); | 1177 EXPECT_EQ(sobel_pixels_c[i], sobel_pixels_opt[i]); |
1170 } | 1178 } |
1171 } | 1179 } |
1172 | 1180 |
1173 TEST_F(libyuvTest, TestSobel) { | 1181 TEST_F(LibYUVPlanarTest, TestSobel) { |
1174 SIMD_ALIGNED(uint8 orig_sobelx[1280]); | 1182 SIMD_ALIGNED(uint8 orig_sobelx[1280]); |
1175 SIMD_ALIGNED(uint8 orig_sobely[1280]); | 1183 SIMD_ALIGNED(uint8 orig_sobely[1280]); |
1176 SIMD_ALIGNED(uint8 sobel_pixels_c[1280 * 4]); | 1184 SIMD_ALIGNED(uint8 sobel_pixels_c[1280 * 4]); |
1177 SIMD_ALIGNED(uint8 sobel_pixels_opt[1280 * 4]); | 1185 SIMD_ALIGNED(uint8 sobel_pixels_opt[1280 * 4]); |
1178 | 1186 |
1179 for (int i = 0; i < 1280; ++i) { | 1187 for (int i = 0; i < 1280; ++i) { |
1180 orig_sobelx[i] = i; | 1188 orig_sobelx[i] = i; |
1181 orig_sobely[i] = i * 2; | 1189 orig_sobely[i] = i * 2; |
1182 } | 1190 } |
1183 | 1191 |
(...skipping 23 matching lines...) Expand all Loading... |
1207 } | 1215 } |
1208 #endif | 1216 #endif |
1209 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 1217 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
1210 SobelRow(orig_sobelx, orig_sobely, sobel_pixels_opt, 1280); | 1218 SobelRow(orig_sobelx, orig_sobely, sobel_pixels_opt, 1280); |
1211 } | 1219 } |
1212 for (int i = 0; i < 1280 * 4; ++i) { | 1220 for (int i = 0; i < 1280 * 4; ++i) { |
1213 EXPECT_EQ(sobel_pixels_c[i], sobel_pixels_opt[i]); | 1221 EXPECT_EQ(sobel_pixels_c[i], sobel_pixels_opt[i]); |
1214 } | 1222 } |
1215 } | 1223 } |
1216 | 1224 |
1217 TEST_F(libyuvTest, TestSobelToPlane) { | 1225 TEST_F(LibYUVPlanarTest, TestSobelToPlane) { |
1218 SIMD_ALIGNED(uint8 orig_sobelx[1280]); | 1226 SIMD_ALIGNED(uint8 orig_sobelx[1280]); |
1219 SIMD_ALIGNED(uint8 orig_sobely[1280]); | 1227 SIMD_ALIGNED(uint8 orig_sobely[1280]); |
1220 SIMD_ALIGNED(uint8 sobel_pixels_c[1280]); | 1228 SIMD_ALIGNED(uint8 sobel_pixels_c[1280]); |
1221 SIMD_ALIGNED(uint8 sobel_pixels_opt[1280]); | 1229 SIMD_ALIGNED(uint8 sobel_pixels_opt[1280]); |
1222 | 1230 |
1223 for (int i = 0; i < 1280; ++i) { | 1231 for (int i = 0; i < 1280; ++i) { |
1224 orig_sobelx[i] = i; | 1232 orig_sobelx[i] = i; |
1225 orig_sobely[i] = i * 2; | 1233 orig_sobely[i] = i * 2; |
1226 } | 1234 } |
1227 | 1235 |
(...skipping 17 matching lines...) Expand all Loading... |
1245 } | 1253 } |
1246 #endif | 1254 #endif |
1247 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 1255 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
1248 SobelToPlaneRow(orig_sobelx, orig_sobely, sobel_pixels_opt, 1280); | 1256 SobelToPlaneRow(orig_sobelx, orig_sobely, sobel_pixels_opt, 1280); |
1249 } | 1257 } |
1250 for (int i = 0; i < 1280; ++i) { | 1258 for (int i = 0; i < 1280; ++i) { |
1251 EXPECT_EQ(sobel_pixels_c[i], sobel_pixels_opt[i]); | 1259 EXPECT_EQ(sobel_pixels_c[i], sobel_pixels_opt[i]); |
1252 } | 1260 } |
1253 } | 1261 } |
1254 | 1262 |
1255 TEST_F(libyuvTest, TestSobelXY) { | 1263 TEST_F(LibYUVPlanarTest, TestSobelXY) { |
1256 SIMD_ALIGNED(uint8 orig_sobelx[1280]); | 1264 SIMD_ALIGNED(uint8 orig_sobelx[1280]); |
1257 SIMD_ALIGNED(uint8 orig_sobely[1280]); | 1265 SIMD_ALIGNED(uint8 orig_sobely[1280]); |
1258 SIMD_ALIGNED(uint8 sobel_pixels_c[1280 * 4]); | 1266 SIMD_ALIGNED(uint8 sobel_pixels_c[1280 * 4]); |
1259 SIMD_ALIGNED(uint8 sobel_pixels_opt[1280 * 4]); | 1267 SIMD_ALIGNED(uint8 sobel_pixels_opt[1280 * 4]); |
1260 | 1268 |
1261 for (int i = 0; i < 1280; ++i) { | 1269 for (int i = 0; i < 1280; ++i) { |
1262 orig_sobelx[i] = i; | 1270 orig_sobelx[i] = i; |
1263 orig_sobely[i] = i * 2; | 1271 orig_sobely[i] = i * 2; |
1264 } | 1272 } |
1265 | 1273 |
(...skipping 19 matching lines...) Expand all Loading... |
1285 } | 1293 } |
1286 #endif | 1294 #endif |
1287 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { | 1295 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { |
1288 SobelXYRow(orig_sobelx, orig_sobely, sobel_pixels_opt, 1280); | 1296 SobelXYRow(orig_sobelx, orig_sobely, sobel_pixels_opt, 1280); |
1289 } | 1297 } |
1290 for (int i = 0; i < 1280 * 4; ++i) { | 1298 for (int i = 0; i < 1280 * 4; ++i) { |
1291 EXPECT_EQ(sobel_pixels_c[i], sobel_pixels_opt[i]); | 1299 EXPECT_EQ(sobel_pixels_c[i], sobel_pixels_opt[i]); |
1292 } | 1300 } |
1293 } | 1301 } |
1294 | 1302 |
1295 TEST_F(libyuvTest, TestCopyPlane) { | 1303 TEST_F(LibYUVPlanarTest, TestCopyPlane) { |
1296 int err = 0; | 1304 int err = 0; |
1297 int yw = benchmark_width_; | 1305 int yw = benchmark_width_; |
1298 int yh = benchmark_height_; | 1306 int yh = benchmark_height_; |
1299 int b = 12; | 1307 int b = 12; |
1300 int i, j; | 1308 int i, j; |
1301 | 1309 |
1302 int y_plane_size = (yw + b * 2) * (yh + b * 2); | 1310 int y_plane_size = (yw + b * 2) * (yh + b * 2); |
1303 align_buffer_64(orig_y, y_plane_size); | 1311 align_buffer_64(orig_y, y_plane_size); |
1304 align_buffer_64(dst_c, y_plane_size); | 1312 align_buffer_64(dst_c, y_plane_size); |
1305 align_buffer_64(dst_opt, y_plane_size); | 1313 align_buffer_64(dst_opt, y_plane_size); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 max_diff = abs_diff; | 1402 max_diff = abs_diff; |
1395 } | 1403 } |
1396 } | 1404 } |
1397 free_aligned_buffer_64(src_argb_a); | 1405 free_aligned_buffer_64(src_argb_a); |
1398 free_aligned_buffer_64(src_argb_b); | 1406 free_aligned_buffer_64(src_argb_b); |
1399 free_aligned_buffer_64(dst_argb_c); | 1407 free_aligned_buffer_64(dst_argb_c); |
1400 free_aligned_buffer_64(dst_argb_opt); | 1408 free_aligned_buffer_64(dst_argb_opt); |
1401 return max_diff; | 1409 return max_diff; |
1402 } | 1410 } |
1403 | 1411 |
1404 TEST_F(libyuvTest, ARGBMultiply_Any) { | 1412 TEST_F(LibYUVPlanarTest, ARGBMultiply_Any) { |
1405 int max_diff = TestMultiply(benchmark_width_ - 1, benchmark_height_, | 1413 int max_diff = TestMultiply(benchmark_width_ - 1, benchmark_height_, |
1406 benchmark_iterations_, disable_cpu_flags_, +1, 0); | 1414 benchmark_iterations_, disable_cpu_flags_, +1, 0); |
1407 EXPECT_LE(max_diff, 1); | 1415 EXPECT_LE(max_diff, 1); |
1408 } | 1416 } |
1409 | 1417 |
1410 TEST_F(libyuvTest, ARGBMultiply_Unaligned) { | 1418 TEST_F(LibYUVPlanarTest, ARGBMultiply_Unaligned) { |
1411 int max_diff = TestMultiply(benchmark_width_, benchmark_height_, | 1419 int max_diff = TestMultiply(benchmark_width_, benchmark_height_, |
1412 benchmark_iterations_, disable_cpu_flags_, +1, 1); | 1420 benchmark_iterations_, disable_cpu_flags_, +1, 1); |
1413 EXPECT_LE(max_diff, 1); | 1421 EXPECT_LE(max_diff, 1); |
1414 } | 1422 } |
1415 | 1423 |
1416 TEST_F(libyuvTest, ARGBMultiply_Invert) { | 1424 TEST_F(LibYUVPlanarTest, ARGBMultiply_Invert) { |
1417 int max_diff = TestMultiply(benchmark_width_, benchmark_height_, | 1425 int max_diff = TestMultiply(benchmark_width_, benchmark_height_, |
1418 benchmark_iterations_, disable_cpu_flags_, -1, 0); | 1426 benchmark_iterations_, disable_cpu_flags_, -1, 0); |
1419 EXPECT_LE(max_diff, 1); | 1427 EXPECT_LE(max_diff, 1); |
1420 } | 1428 } |
1421 | 1429 |
1422 TEST_F(libyuvTest, ARGBMultiply_Opt) { | 1430 TEST_F(LibYUVPlanarTest, ARGBMultiply_Opt) { |
1423 int max_diff = TestMultiply(benchmark_width_, benchmark_height_, | 1431 int max_diff = TestMultiply(benchmark_width_, benchmark_height_, |
1424 benchmark_iterations_, disable_cpu_flags_, +1, 0); | 1432 benchmark_iterations_, disable_cpu_flags_, +1, 0); |
1425 EXPECT_LE(max_diff, 1); | 1433 EXPECT_LE(max_diff, 1); |
1426 } | 1434 } |
1427 | 1435 |
1428 static int TestAdd(int width, int height, int benchmark_iterations, | 1436 static int TestAdd(int width, int height, int benchmark_iterations, |
1429 int disable_cpu_flags, int invert, int off) { | 1437 int disable_cpu_flags, int invert, int off) { |
1430 if (width < 1) { | 1438 if (width < 1) { |
1431 width = 1; | 1439 width = 1; |
1432 } | 1440 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 max_diff = abs_diff; | 1472 max_diff = abs_diff; |
1465 } | 1473 } |
1466 } | 1474 } |
1467 free_aligned_buffer_64(src_argb_a); | 1475 free_aligned_buffer_64(src_argb_a); |
1468 free_aligned_buffer_64(src_argb_b); | 1476 free_aligned_buffer_64(src_argb_b); |
1469 free_aligned_buffer_64(dst_argb_c); | 1477 free_aligned_buffer_64(dst_argb_c); |
1470 free_aligned_buffer_64(dst_argb_opt); | 1478 free_aligned_buffer_64(dst_argb_opt); |
1471 return max_diff; | 1479 return max_diff; |
1472 } | 1480 } |
1473 | 1481 |
1474 TEST_F(libyuvTest, ARGBAdd_Any) { | 1482 TEST_F(LibYUVPlanarTest, ARGBAdd_Any) { |
1475 int max_diff = TestAdd(benchmark_width_ - 1, benchmark_height_, | 1483 int max_diff = TestAdd(benchmark_width_ - 1, benchmark_height_, |
1476 benchmark_iterations_, disable_cpu_flags_, +1, 0); | 1484 benchmark_iterations_, disable_cpu_flags_, +1, 0); |
1477 EXPECT_LE(max_diff, 1); | 1485 EXPECT_LE(max_diff, 1); |
1478 } | 1486 } |
1479 | 1487 |
1480 TEST_F(libyuvTest, ARGBAdd_Unaligned) { | 1488 TEST_F(LibYUVPlanarTest, ARGBAdd_Unaligned) { |
1481 int max_diff = TestAdd(benchmark_width_, benchmark_height_, | 1489 int max_diff = TestAdd(benchmark_width_, benchmark_height_, |
1482 benchmark_iterations_, disable_cpu_flags_, +1, 1); | 1490 benchmark_iterations_, disable_cpu_flags_, +1, 1); |
1483 EXPECT_LE(max_diff, 1); | 1491 EXPECT_LE(max_diff, 1); |
1484 } | 1492 } |
1485 | 1493 |
1486 TEST_F(libyuvTest, ARGBAdd_Invert) { | 1494 TEST_F(LibYUVPlanarTest, ARGBAdd_Invert) { |
1487 int max_diff = TestAdd(benchmark_width_, benchmark_height_, | 1495 int max_diff = TestAdd(benchmark_width_, benchmark_height_, |
1488 benchmark_iterations_, disable_cpu_flags_, -1, 0); | 1496 benchmark_iterations_, disable_cpu_flags_, -1, 0); |
1489 EXPECT_LE(max_diff, 1); | 1497 EXPECT_LE(max_diff, 1); |
1490 } | 1498 } |
1491 | 1499 |
1492 TEST_F(libyuvTest, ARGBAdd_Opt) { | 1500 TEST_F(LibYUVPlanarTest, ARGBAdd_Opt) { |
1493 int max_diff = TestAdd(benchmark_width_, benchmark_height_, | 1501 int max_diff = TestAdd(benchmark_width_, benchmark_height_, |
1494 benchmark_iterations_, disable_cpu_flags_, +1, 0); | 1502 benchmark_iterations_, disable_cpu_flags_, +1, 0); |
1495 EXPECT_LE(max_diff, 1); | 1503 EXPECT_LE(max_diff, 1); |
1496 } | 1504 } |
1497 | 1505 |
1498 static int TestSubtract(int width, int height, int benchmark_iterations, | 1506 static int TestSubtract(int width, int height, int benchmark_iterations, |
1499 int disable_cpu_flags, int invert, int off) { | 1507 int disable_cpu_flags, int invert, int off) { |
1500 if (width < 1) { | 1508 if (width < 1) { |
1501 width = 1; | 1509 width = 1; |
1502 } | 1510 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 max_diff = abs_diff; | 1542 max_diff = abs_diff; |
1535 } | 1543 } |
1536 } | 1544 } |
1537 free_aligned_buffer_64(src_argb_a); | 1545 free_aligned_buffer_64(src_argb_a); |
1538 free_aligned_buffer_64(src_argb_b); | 1546 free_aligned_buffer_64(src_argb_b); |
1539 free_aligned_buffer_64(dst_argb_c); | 1547 free_aligned_buffer_64(dst_argb_c); |
1540 free_aligned_buffer_64(dst_argb_opt); | 1548 free_aligned_buffer_64(dst_argb_opt); |
1541 return max_diff; | 1549 return max_diff; |
1542 } | 1550 } |
1543 | 1551 |
1544 TEST_F(libyuvTest, ARGBSubtract_Any) { | 1552 TEST_F(LibYUVPlanarTest, ARGBSubtract_Any) { |
1545 int max_diff = TestSubtract(benchmark_width_ - 1, benchmark_height_, | 1553 int max_diff = TestSubtract(benchmark_width_ - 1, benchmark_height_, |
1546 benchmark_iterations_, disable_cpu_flags_, +1, 0); | 1554 benchmark_iterations_, disable_cpu_flags_, +1, 0); |
1547 EXPECT_LE(max_diff, 1); | 1555 EXPECT_LE(max_diff, 1); |
1548 } | 1556 } |
1549 | 1557 |
1550 TEST_F(libyuvTest, ARGBSubtract_Unaligned) { | 1558 TEST_F(LibYUVPlanarTest, ARGBSubtract_Unaligned) { |
1551 int max_diff = TestSubtract(benchmark_width_, benchmark_height_, | 1559 int max_diff = TestSubtract(benchmark_width_, benchmark_height_, |
1552 benchmark_iterations_, disable_cpu_flags_, +1, 1); | 1560 benchmark_iterations_, disable_cpu_flags_, +1, 1); |
1553 EXPECT_LE(max_diff, 1); | 1561 EXPECT_LE(max_diff, 1); |
1554 } | 1562 } |
1555 | 1563 |
1556 TEST_F(libyuvTest, ARGBSubtract_Invert) { | 1564 TEST_F(LibYUVPlanarTest, ARGBSubtract_Invert) { |
1557 int max_diff = TestSubtract(benchmark_width_, benchmark_height_, | 1565 int max_diff = TestSubtract(benchmark_width_, benchmark_height_, |
1558 benchmark_iterations_, disable_cpu_flags_, -1, 0); | 1566 benchmark_iterations_, disable_cpu_flags_, -1, 0); |
1559 EXPECT_LE(max_diff, 1); | 1567 EXPECT_LE(max_diff, 1); |
1560 } | 1568 } |
1561 | 1569 |
1562 TEST_F(libyuvTest, ARGBSubtract_Opt) { | 1570 TEST_F(LibYUVPlanarTest, ARGBSubtract_Opt) { |
1563 int max_diff = TestSubtract(benchmark_width_, benchmark_height_, | 1571 int max_diff = TestSubtract(benchmark_width_, benchmark_height_, |
1564 benchmark_iterations_, disable_cpu_flags_, +1, 0); | 1572 benchmark_iterations_, disable_cpu_flags_, +1, 0); |
1565 EXPECT_LE(max_diff, 1); | 1573 EXPECT_LE(max_diff, 1); |
1566 } | 1574 } |
1567 | 1575 |
1568 static int TestSobel(int width, int height, int benchmark_iterations, | 1576 static int TestSobel(int width, int height, int benchmark_iterations, |
1569 int disable_cpu_flags, int invert, int off) { | 1577 int disable_cpu_flags, int invert, int off) { |
1570 if (width < 1) { | 1578 if (width < 1) { |
1571 width = 1; | 1579 width = 1; |
1572 } | 1580 } |
(...skipping 27 matching lines...) Expand all Loading... |
1600 if (abs_diff > max_diff) { | 1608 if (abs_diff > max_diff) { |
1601 max_diff = abs_diff; | 1609 max_diff = abs_diff; |
1602 } | 1610 } |
1603 } | 1611 } |
1604 free_aligned_buffer_64(src_argb_a); | 1612 free_aligned_buffer_64(src_argb_a); |
1605 free_aligned_buffer_64(dst_argb_c); | 1613 free_aligned_buffer_64(dst_argb_c); |
1606 free_aligned_buffer_64(dst_argb_opt); | 1614 free_aligned_buffer_64(dst_argb_opt); |
1607 return max_diff; | 1615 return max_diff; |
1608 } | 1616 } |
1609 | 1617 |
1610 TEST_F(libyuvTest, ARGBSobel_Any) { | 1618 TEST_F(LibYUVPlanarTest, ARGBSobel_Any) { |
1611 int max_diff = TestSobel(benchmark_width_ - 1, benchmark_height_, | 1619 int max_diff = TestSobel(benchmark_width_ - 1, benchmark_height_, |
1612 benchmark_iterations_, disable_cpu_flags_, +1, 0); | 1620 benchmark_iterations_, disable_cpu_flags_, +1, 0); |
1613 EXPECT_EQ(0, max_diff); | 1621 EXPECT_EQ(0, max_diff); |
1614 } | 1622 } |
1615 | 1623 |
1616 TEST_F(libyuvTest, ARGBSobel_Unaligned) { | 1624 TEST_F(LibYUVPlanarTest, ARGBSobel_Unaligned) { |
1617 int max_diff = TestSobel(benchmark_width_, benchmark_height_, | 1625 int max_diff = TestSobel(benchmark_width_, benchmark_height_, |
1618 benchmark_iterations_, disable_cpu_flags_, +1, 1); | 1626 benchmark_iterations_, disable_cpu_flags_, +1, 1); |
1619 EXPECT_EQ(0, max_diff); | 1627 EXPECT_EQ(0, max_diff); |
1620 } | 1628 } |
1621 | 1629 |
1622 TEST_F(libyuvTest, ARGBSobel_Invert) { | 1630 TEST_F(LibYUVPlanarTest, ARGBSobel_Invert) { |
1623 int max_diff = TestSobel(benchmark_width_, benchmark_height_, | 1631 int max_diff = TestSobel(benchmark_width_, benchmark_height_, |
1624 benchmark_iterations_, disable_cpu_flags_, -1, 0); | 1632 benchmark_iterations_, disable_cpu_flags_, -1, 0); |
1625 EXPECT_EQ(0, max_diff); | 1633 EXPECT_EQ(0, max_diff); |
1626 } | 1634 } |
1627 | 1635 |
1628 TEST_F(libyuvTest, ARGBSobel_Opt) { | 1636 TEST_F(LibYUVPlanarTest, ARGBSobel_Opt) { |
1629 int max_diff = TestSobel(benchmark_width_, benchmark_height_, | 1637 int max_diff = TestSobel(benchmark_width_, benchmark_height_, |
1630 benchmark_iterations_, disable_cpu_flags_, +1, 0); | 1638 benchmark_iterations_, disable_cpu_flags_, +1, 0); |
1631 EXPECT_EQ(0, max_diff); | 1639 EXPECT_EQ(0, max_diff); |
1632 } | 1640 } |
1633 | 1641 |
1634 static int TestSobelToPlane(int width, int height, int benchmark_iterations, | 1642 static int TestSobelToPlane(int width, int height, int benchmark_iterations, |
1635 int disable_cpu_flags, int invert, int off) { | 1643 int disable_cpu_flags, int invert, int off) { |
1636 if (width < 1) { | 1644 if (width < 1) { |
1637 width = 1; | 1645 width = 1; |
1638 } | 1646 } |
(...skipping 29 matching lines...) Expand all Loading... |
1668 if (abs_diff > max_diff) { | 1676 if (abs_diff > max_diff) { |
1669 max_diff = abs_diff; | 1677 max_diff = abs_diff; |
1670 } | 1678 } |
1671 } | 1679 } |
1672 free_aligned_buffer_64(src_argb_a); | 1680 free_aligned_buffer_64(src_argb_a); |
1673 free_aligned_buffer_64(dst_argb_c); | 1681 free_aligned_buffer_64(dst_argb_c); |
1674 free_aligned_buffer_64(dst_argb_opt); | 1682 free_aligned_buffer_64(dst_argb_opt); |
1675 return max_diff; | 1683 return max_diff; |
1676 } | 1684 } |
1677 | 1685 |
1678 TEST_F(libyuvTest, ARGBSobelToPlane_Any) { | 1686 TEST_F(LibYUVPlanarTest, ARGBSobelToPlane_Any) { |
1679 int max_diff = TestSobelToPlane(benchmark_width_ - 1, benchmark_height_, | 1687 int max_diff = TestSobelToPlane(benchmark_width_ - 1, benchmark_height_, |
1680 benchmark_iterations_, disable_cpu_flags_, +1,
0); | 1688 benchmark_iterations_, disable_cpu_flags_, |
| 1689 +1, 0); |
1681 EXPECT_EQ(0, max_diff); | 1690 EXPECT_EQ(0, max_diff); |
1682 } | 1691 } |
1683 | 1692 |
1684 TEST_F(libyuvTest, ARGBSobelToPlane_Unaligned) { | 1693 TEST_F(LibYUVPlanarTest, ARGBSobelToPlane_Unaligned) { |
1685 int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_, | 1694 int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_, |
1686 benchmark_iterations_, disable_cpu_flags_, +1,
1); | 1695 benchmark_iterations_, disable_cpu_flags_, |
| 1696 +1, 1); |
1687 EXPECT_EQ(0, max_diff); | 1697 EXPECT_EQ(0, max_diff); |
1688 } | 1698 } |
1689 | 1699 |
1690 TEST_F(libyuvTest, ARGBSobelToPlane_Invert) { | 1700 TEST_F(LibYUVPlanarTest, ARGBSobelToPlane_Invert) { |
1691 int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_, | 1701 int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_, |
1692 benchmark_iterations_, disable_cpu_flags_, -1,
0); | 1702 benchmark_iterations_, disable_cpu_flags_, |
| 1703 -1, 0); |
1693 EXPECT_EQ(0, max_diff); | 1704 EXPECT_EQ(0, max_diff); |
1694 } | 1705 } |
1695 | 1706 |
1696 TEST_F(libyuvTest, ARGBSobelToPlane_Opt) { | 1707 TEST_F(LibYUVPlanarTest, ARGBSobelToPlane_Opt) { |
1697 int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_, | 1708 int max_diff = TestSobelToPlane(benchmark_width_, benchmark_height_, |
1698 benchmark_iterations_, disable_cpu_flags_, +1,
0); | 1709 benchmark_iterations_, disable_cpu_flags_, |
| 1710 +1, 0); |
1699 EXPECT_EQ(0, max_diff); | 1711 EXPECT_EQ(0, max_diff); |
1700 } | 1712 } |
1701 | 1713 |
1702 static int TestSobelXY(int width, int height, int benchmark_iterations, | 1714 static int TestSobelXY(int width, int height, int benchmark_iterations, |
1703 int disable_cpu_flags, int invert, int off) { | 1715 int disable_cpu_flags, int invert, int off) { |
1704 if (width < 1) { | 1716 if (width < 1) { |
1705 width = 1; | 1717 width = 1; |
1706 } | 1718 } |
1707 const int kBpp = 4; | 1719 const int kBpp = 4; |
1708 const int kStride = width * kBpp; | 1720 const int kStride = width * kBpp; |
(...skipping 25 matching lines...) Expand all Loading... |
1734 if (abs_diff > max_diff) { | 1746 if (abs_diff > max_diff) { |
1735 max_diff = abs_diff; | 1747 max_diff = abs_diff; |
1736 } | 1748 } |
1737 } | 1749 } |
1738 free_aligned_buffer_64(src_argb_a); | 1750 free_aligned_buffer_64(src_argb_a); |
1739 free_aligned_buffer_64(dst_argb_c); | 1751 free_aligned_buffer_64(dst_argb_c); |
1740 free_aligned_buffer_64(dst_argb_opt); | 1752 free_aligned_buffer_64(dst_argb_opt); |
1741 return max_diff; | 1753 return max_diff; |
1742 } | 1754 } |
1743 | 1755 |
1744 TEST_F(libyuvTest, ARGBSobelXY_Any) { | 1756 TEST_F(LibYUVPlanarTest, ARGBSobelXY_Any) { |
1745 int max_diff = TestSobelXY(benchmark_width_ - 1, benchmark_height_, | 1757 int max_diff = TestSobelXY(benchmark_width_ - 1, benchmark_height_, |
1746 benchmark_iterations_, disable_cpu_flags_, +1, 0); | 1758 benchmark_iterations_, disable_cpu_flags_, +1, 0); |
1747 EXPECT_EQ(0, max_diff); | 1759 EXPECT_EQ(0, max_diff); |
1748 } | 1760 } |
1749 | 1761 |
1750 TEST_F(libyuvTest, ARGBSobelXY_Unaligned) { | 1762 TEST_F(LibYUVPlanarTest, ARGBSobelXY_Unaligned) { |
1751 int max_diff = TestSobelXY(benchmark_width_, benchmark_height_, | 1763 int max_diff = TestSobelXY(benchmark_width_, benchmark_height_, |
1752 benchmark_iterations_, disable_cpu_flags_, +1, 1); | 1764 benchmark_iterations_, disable_cpu_flags_, +1, 1); |
1753 EXPECT_EQ(0, max_diff); | 1765 EXPECT_EQ(0, max_diff); |
1754 } | 1766 } |
1755 | 1767 |
1756 TEST_F(libyuvTest, ARGBSobelXY_Invert) { | 1768 TEST_F(LibYUVPlanarTest, ARGBSobelXY_Invert) { |
1757 int max_diff = TestSobelXY(benchmark_width_, benchmark_height_, | 1769 int max_diff = TestSobelXY(benchmark_width_, benchmark_height_, |
1758 benchmark_iterations_, disable_cpu_flags_, -1, 0); | 1770 benchmark_iterations_, disable_cpu_flags_, -1, 0); |
1759 EXPECT_EQ(0, max_diff); | 1771 EXPECT_EQ(0, max_diff); |
1760 } | 1772 } |
1761 | 1773 |
1762 TEST_F(libyuvTest, ARGBSobelXY_Opt) { | 1774 TEST_F(LibYUVPlanarTest, ARGBSobelXY_Opt) { |
1763 int max_diff = TestSobelXY(benchmark_width_, benchmark_height_, | 1775 int max_diff = TestSobelXY(benchmark_width_, benchmark_height_, |
1764 benchmark_iterations_, disable_cpu_flags_, +1, 0); | 1776 benchmark_iterations_, disable_cpu_flags_, +1, 0); |
1765 EXPECT_EQ(0, max_diff); | 1777 EXPECT_EQ(0, max_diff); |
1766 } | 1778 } |
1767 | 1779 |
1768 static int TestBlur(int width, int height, int benchmark_iterations, | 1780 static int TestBlur(int width, int height, int benchmark_iterations, |
1769 int disable_cpu_flags, int invert, int off, int radius) { | 1781 int disable_cpu_flags, int invert, int off, int radius) { |
1770 if (width < 1) { | 1782 if (width < 1) { |
1771 width = 1; | 1783 width = 1; |
1772 } | 1784 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 } | 1817 } |
1806 } | 1818 } |
1807 free_aligned_buffer_64(src_argb_a); | 1819 free_aligned_buffer_64(src_argb_a); |
1808 free_aligned_buffer_64(dst_cumsum); | 1820 free_aligned_buffer_64(dst_cumsum); |
1809 free_aligned_buffer_64(dst_argb_c); | 1821 free_aligned_buffer_64(dst_argb_c); |
1810 free_aligned_buffer_64(dst_argb_opt); | 1822 free_aligned_buffer_64(dst_argb_opt); |
1811 return max_diff; | 1823 return max_diff; |
1812 } | 1824 } |
1813 | 1825 |
1814 static const int kBlurSize = 55; | 1826 static const int kBlurSize = 55; |
1815 TEST_F(libyuvTest, ARGBBlur_Any) { | 1827 TEST_F(LibYUVPlanarTest, ARGBBlur_Any) { |
1816 int max_diff = TestBlur(benchmark_width_ - 1, benchmark_height_, | 1828 int max_diff = TestBlur(benchmark_width_ - 1, benchmark_height_, |
1817 benchmark_iterations_, disable_cpu_flags_, +1, 0, kBlu
rSize); | 1829 benchmark_iterations_, disable_cpu_flags_, |
| 1830 +1, 0, kBlurSize); |
1818 EXPECT_LE(max_diff, 1); | 1831 EXPECT_LE(max_diff, 1); |
1819 } | 1832 } |
1820 | 1833 |
1821 TEST_F(libyuvTest, ARGBBlur_Unaligned) { | 1834 TEST_F(LibYUVPlanarTest, ARGBBlur_Unaligned) { |
1822 int max_diff = TestBlur(benchmark_width_, benchmark_height_, | 1835 int max_diff = TestBlur(benchmark_width_, benchmark_height_, |
1823 benchmark_iterations_, disable_cpu_flags_, +1, 1, kBlu
rSize); | 1836 benchmark_iterations_, disable_cpu_flags_, |
| 1837 +1, 1, kBlurSize); |
1824 EXPECT_LE(max_diff, 1); | 1838 EXPECT_LE(max_diff, 1); |
1825 } | 1839 } |
1826 | 1840 |
1827 TEST_F(libyuvTest, ARGBBlur_Invert) { | 1841 TEST_F(LibYUVPlanarTest, ARGBBlur_Invert) { |
1828 int max_diff = TestBlur(benchmark_width_, benchmark_height_, | 1842 int max_diff = TestBlur(benchmark_width_, benchmark_height_, |
1829 benchmark_iterations_, disable_cpu_flags_, -1, 0, kBlu
rSize); | 1843 benchmark_iterations_, disable_cpu_flags_, |
| 1844 -1, 0, kBlurSize); |
1830 EXPECT_LE(max_diff, 1); | 1845 EXPECT_LE(max_diff, 1); |
1831 } | 1846 } |
1832 | 1847 |
1833 TEST_F(libyuvTest, ARGBBlur_Opt) { | 1848 TEST_F(LibYUVPlanarTest, ARGBBlur_Opt) { |
1834 int max_diff = TestBlur(benchmark_width_, benchmark_height_, | 1849 int max_diff = TestBlur(benchmark_width_, benchmark_height_, |
1835 benchmark_iterations_, disable_cpu_flags_, +1, 0, kBlu
rSize); | 1850 benchmark_iterations_, disable_cpu_flags_, |
| 1851 +1, 0, kBlurSize); |
1836 EXPECT_LE(max_diff, 1); | 1852 EXPECT_LE(max_diff, 1); |
1837 } | 1853 } |
1838 | 1854 |
1839 static const int kBlurSmallSize = 5; | 1855 static const int kBlurSmallSize = 5; |
1840 TEST_F(libyuvTest, ARGBBlurSmall_Any) { | 1856 TEST_F(LibYUVPlanarTest, ARGBBlurSmall_Any) { |
1841 int max_diff = TestBlur(benchmark_width_ - 1, benchmark_height_, | 1857 int max_diff = TestBlur(benchmark_width_ - 1, benchmark_height_, |
1842 benchmark_iterations_, disable_cpu_flags_, +1, 0, kBlu
rSmallSize); | 1858 benchmark_iterations_, disable_cpu_flags_, |
| 1859 +1, 0, kBlurSmallSize); |
1843 EXPECT_LE(max_diff, 1); | 1860 EXPECT_LE(max_diff, 1); |
1844 } | 1861 } |
1845 | 1862 |
1846 TEST_F(libyuvTest, ARGBBlurSmall_Unaligned) { | 1863 TEST_F(LibYUVPlanarTest, ARGBBlurSmall_Unaligned) { |
1847 int max_diff = TestBlur(benchmark_width_, benchmark_height_, | 1864 int max_diff = TestBlur(benchmark_width_, benchmark_height_, |
1848 benchmark_iterations_, disable_cpu_flags_, +1, 1, kBlu
rSmallSize); | 1865 benchmark_iterations_, disable_cpu_flags_, |
| 1866 +1, 1, kBlurSmallSize); |
1849 EXPECT_LE(max_diff, 1); | 1867 EXPECT_LE(max_diff, 1); |
1850 } | 1868 } |
1851 | 1869 |
1852 TEST_F(libyuvTest, ARGBBlurSmall_Invert) { | 1870 TEST_F(LibYUVPlanarTest, ARGBBlurSmall_Invert) { |
1853 int max_diff = TestBlur(benchmark_width_, benchmark_height_, | 1871 int max_diff = TestBlur(benchmark_width_, benchmark_height_, |
1854 benchmark_iterations_, disable_cpu_flags_, -1, 0, kBlu
rSmallSize); | 1872 benchmark_iterations_, disable_cpu_flags_, |
| 1873 -1, 0, kBlurSmallSize); |
1855 EXPECT_LE(max_diff, 1); | 1874 EXPECT_LE(max_diff, 1); |
1856 } | 1875 } |
1857 | 1876 |
1858 TEST_F(libyuvTest, ARGBBlurSmall_Opt) { | 1877 TEST_F(LibYUVPlanarTest, ARGBBlurSmall_Opt) { |
1859 int max_diff = TestBlur(benchmark_width_, benchmark_height_, | 1878 int max_diff = TestBlur(benchmark_width_, benchmark_height_, |
1860 benchmark_iterations_, disable_cpu_flags_, +1, 0, kBlu
rSmallSize); | 1879 benchmark_iterations_, disable_cpu_flags_, |
| 1880 +1, 0, kBlurSmallSize); |
1861 EXPECT_LE(max_diff, 1); | 1881 EXPECT_LE(max_diff, 1); |
1862 } | 1882 } |
1863 | 1883 |
1864 TEST_F(libyuvTest, TestARGBPolynomial) { | 1884 TEST_F(LibYUVPlanarTest, TestARGBPolynomial) { |
1865 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); | 1885 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); |
1866 SIMD_ALIGNED(uint8 dst_pixels_opt[1280][4]); | 1886 SIMD_ALIGNED(uint8 dst_pixels_opt[1280][4]); |
1867 SIMD_ALIGNED(uint8 dst_pixels_c[1280][4]); | 1887 SIMD_ALIGNED(uint8 dst_pixels_c[1280][4]); |
1868 memset(orig_pixels, 0, sizeof(orig_pixels)); | 1888 memset(orig_pixels, 0, sizeof(orig_pixels)); |
1869 | 1889 |
1870 SIMD_ALIGNED(static const float kWarmifyPolynomial[16]) = { | 1890 SIMD_ALIGNED(static const float kWarmifyPolynomial[16]) = { |
1871 0.94230f, -3.03300f, -2.92500f, 0.f, // C0 | 1891 0.94230f, -3.03300f, -2.92500f, 0.f, // C0 |
1872 0.584500f, 1.112000f, 1.535000f, 1.f, // C1 x | 1892 0.584500f, 1.112000f, 1.535000f, 1.f, // C1 x |
1873 0.001313f, -0.002503f, -0.004496f, 0.f, // C2 x * x | 1893 0.001313f, -0.002503f, -0.004496f, 0.f, // C2 x * x |
1874 0.0f, 0.000006965f, 0.000008781f, 0.f, // C3 x * x * x | 1894 0.0f, 0.000006965f, 0.000008781f, 0.f, // C3 x * x * x |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1941 } | 1961 } |
1942 | 1962 |
1943 for (int i = 0; i < 1280; ++i) { | 1963 for (int i = 0; i < 1280; ++i) { |
1944 EXPECT_EQ(dst_pixels_c[i][0], dst_pixels_opt[i][0]); | 1964 EXPECT_EQ(dst_pixels_c[i][0], dst_pixels_opt[i][0]); |
1945 EXPECT_EQ(dst_pixels_c[i][1], dst_pixels_opt[i][1]); | 1965 EXPECT_EQ(dst_pixels_c[i][1], dst_pixels_opt[i][1]); |
1946 EXPECT_EQ(dst_pixels_c[i][2], dst_pixels_opt[i][2]); | 1966 EXPECT_EQ(dst_pixels_c[i][2], dst_pixels_opt[i][2]); |
1947 EXPECT_EQ(dst_pixels_c[i][3], dst_pixels_opt[i][3]); | 1967 EXPECT_EQ(dst_pixels_c[i][3], dst_pixels_opt[i][3]); |
1948 } | 1968 } |
1949 } | 1969 } |
1950 | 1970 |
1951 TEST_F(libyuvTest, TestARGBLumaColorTable) { | 1971 TEST_F(LibYUVPlanarTest, TestARGBLumaColorTable) { |
1952 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); | 1972 SIMD_ALIGNED(uint8 orig_pixels[1280][4]); |
1953 SIMD_ALIGNED(uint8 dst_pixels_opt[1280][4]); | 1973 SIMD_ALIGNED(uint8 dst_pixels_opt[1280][4]); |
1954 SIMD_ALIGNED(uint8 dst_pixels_c[1280][4]); | 1974 SIMD_ALIGNED(uint8 dst_pixels_c[1280][4]); |
1955 memset(orig_pixels, 0, sizeof(orig_pixels)); | 1975 memset(orig_pixels, 0, sizeof(orig_pixels)); |
1956 | 1976 |
1957 align_buffer_64(lumacolortable, 32768); | 1977 align_buffer_64(lumacolortable, 32768); |
1958 int v = 0; | 1978 int v = 0; |
1959 for (int i = 0; i < 32768; ++i) { | 1979 for (int i = 0; i < 32768; ++i) { |
1960 lumacolortable[i] = v; | 1980 lumacolortable[i] = v; |
1961 v += 3; | 1981 v += 3; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2019 for (int i = 0; i < 1280; ++i) { | 2039 for (int i = 0; i < 1280; ++i) { |
2020 EXPECT_EQ(dst_pixels_c[i][0], dst_pixels_opt[i][0]); | 2040 EXPECT_EQ(dst_pixels_c[i][0], dst_pixels_opt[i][0]); |
2021 EXPECT_EQ(dst_pixels_c[i][1], dst_pixels_opt[i][1]); | 2041 EXPECT_EQ(dst_pixels_c[i][1], dst_pixels_opt[i][1]); |
2022 EXPECT_EQ(dst_pixels_c[i][2], dst_pixels_opt[i][2]); | 2042 EXPECT_EQ(dst_pixels_c[i][2], dst_pixels_opt[i][2]); |
2023 EXPECT_EQ(dst_pixels_c[i][3], dst_pixels_opt[i][3]); | 2043 EXPECT_EQ(dst_pixels_c[i][3], dst_pixels_opt[i][3]); |
2024 } | 2044 } |
2025 | 2045 |
2026 free_aligned_buffer_64(lumacolortable); | 2046 free_aligned_buffer_64(lumacolortable); |
2027 } | 2047 } |
2028 | 2048 |
2029 TEST_F(libyuvTest, TestARGBCopyAlpha) { | 2049 TEST_F(LibYUVPlanarTest, TestARGBCopyAlpha) { |
2030 const int kSize = benchmark_width_ * benchmark_height_ * 4; | 2050 const int kSize = benchmark_width_ * benchmark_height_ * 4; |
2031 align_buffer_64(orig_pixels, kSize); | 2051 align_buffer_64(orig_pixels, kSize); |
2032 align_buffer_64(dst_pixels_opt, kSize); | 2052 align_buffer_64(dst_pixels_opt, kSize); |
2033 align_buffer_64(dst_pixels_c, kSize); | 2053 align_buffer_64(dst_pixels_c, kSize); |
2034 | 2054 |
2035 MemRandomize(orig_pixels, kSize); | 2055 MemRandomize(orig_pixels, kSize); |
2036 MemRandomize(dst_pixels_opt, kSize); | 2056 MemRandomize(dst_pixels_opt, kSize); |
2037 memcpy(dst_pixels_c, dst_pixels_opt, kSize); | 2057 memcpy(dst_pixels_c, dst_pixels_opt, kSize); |
2038 | 2058 |
2039 MaskCpuFlags(disable_cpu_flags_); | 2059 MaskCpuFlags(disable_cpu_flags_); |
2040 ARGBCopyAlpha(orig_pixels, benchmark_width_ * 4, | 2060 ARGBCopyAlpha(orig_pixels, benchmark_width_ * 4, |
2041 dst_pixels_c, benchmark_width_ * 4, | 2061 dst_pixels_c, benchmark_width_ * 4, |
2042 benchmark_width_, benchmark_height_); | 2062 benchmark_width_, benchmark_height_); |
2043 MaskCpuFlags(-1); | 2063 MaskCpuFlags(-1); |
2044 | 2064 |
2045 for (int i = 0; i < benchmark_iterations_; ++i) { | 2065 for (int i = 0; i < benchmark_iterations_; ++i) { |
2046 ARGBCopyAlpha(orig_pixels, benchmark_width_ * 4, | 2066 ARGBCopyAlpha(orig_pixels, benchmark_width_ * 4, |
2047 dst_pixels_opt, benchmark_width_ * 4, | 2067 dst_pixels_opt, benchmark_width_ * 4, |
2048 benchmark_width_, benchmark_height_); | 2068 benchmark_width_, benchmark_height_); |
2049 } | 2069 } |
2050 for (int i = 0; i < kSize; ++i) { | 2070 for (int i = 0; i < kSize; ++i) { |
2051 EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); | 2071 EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); |
2052 } | 2072 } |
2053 | 2073 |
2054 free_aligned_buffer_64(dst_pixels_c); | 2074 free_aligned_buffer_64(dst_pixels_c); |
2055 free_aligned_buffer_64(dst_pixels_opt); | 2075 free_aligned_buffer_64(dst_pixels_opt); |
2056 free_aligned_buffer_64(orig_pixels); | 2076 free_aligned_buffer_64(orig_pixels); |
2057 } | 2077 } |
2058 | 2078 |
2059 TEST_F(libyuvTest, TestARGBCopyYToAlpha) { | 2079 TEST_F(LibYUVPlanarTest, TestARGBCopyYToAlpha) { |
2060 const int kPixels = benchmark_width_ * benchmark_height_; | 2080 const int kPixels = benchmark_width_ * benchmark_height_; |
2061 align_buffer_64(orig_pixels, kPixels); | 2081 align_buffer_64(orig_pixels, kPixels); |
2062 align_buffer_64(dst_pixels_opt, kPixels * 4); | 2082 align_buffer_64(dst_pixels_opt, kPixels * 4); |
2063 align_buffer_64(dst_pixels_c, kPixels * 4); | 2083 align_buffer_64(dst_pixels_c, kPixels * 4); |
2064 | 2084 |
2065 MemRandomize(orig_pixels, kPixels); | 2085 MemRandomize(orig_pixels, kPixels); |
2066 MemRandomize(dst_pixels_opt, kPixels * 4); | 2086 MemRandomize(dst_pixels_opt, kPixels * 4); |
2067 memcpy(dst_pixels_c, dst_pixels_opt, kPixels * 4); | 2087 memcpy(dst_pixels_c, dst_pixels_opt, kPixels * 4); |
2068 | 2088 |
2069 MaskCpuFlags(disable_cpu_flags_); | 2089 MaskCpuFlags(disable_cpu_flags_); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2123 static_cast<int>(dst_argb_opt[i + off])); | 2143 static_cast<int>(dst_argb_opt[i + off])); |
2124 if (abs_diff > max_diff) { | 2144 if (abs_diff > max_diff) { |
2125 max_diff = abs_diff; | 2145 max_diff = abs_diff; |
2126 } | 2146 } |
2127 } | 2147 } |
2128 free_aligned_buffer_64(dst_argb_c); | 2148 free_aligned_buffer_64(dst_argb_c); |
2129 free_aligned_buffer_64(dst_argb_opt); | 2149 free_aligned_buffer_64(dst_argb_opt); |
2130 return max_diff; | 2150 return max_diff; |
2131 } | 2151 } |
2132 | 2152 |
2133 TEST_F(libyuvTest, ARGBRect_Any) { | 2153 TEST_F(LibYUVPlanarTest, ARGBRect_Any) { |
2134 int max_diff = TestARGBRect(benchmark_width_ - 1, benchmark_height_, | 2154 int max_diff = TestARGBRect(benchmark_width_ - 1, benchmark_height_, |
2135 benchmark_iterations_, disable_cpu_flags_, | 2155 benchmark_iterations_, disable_cpu_flags_, |
2136 +1, 0, 4); | 2156 +1, 0, 4); |
2137 EXPECT_EQ(0, max_diff); | 2157 EXPECT_EQ(0, max_diff); |
2138 } | 2158 } |
2139 | 2159 |
2140 TEST_F(libyuvTest, ARGBRect_Unaligned) { | 2160 TEST_F(LibYUVPlanarTest, ARGBRect_Unaligned) { |
2141 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, | 2161 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, |
2142 benchmark_iterations_, disable_cpu_flags_, | 2162 benchmark_iterations_, disable_cpu_flags_, |
2143 +1, 1, 4); | 2163 +1, 1, 4); |
2144 EXPECT_EQ(0, max_diff); | 2164 EXPECT_EQ(0, max_diff); |
2145 } | 2165 } |
2146 | 2166 |
2147 TEST_F(libyuvTest, ARGBRect_Invert) { | 2167 TEST_F(LibYUVPlanarTest, ARGBRect_Invert) { |
2148 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, | 2168 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, |
2149 benchmark_iterations_, disable_cpu_flags_, | 2169 benchmark_iterations_, disable_cpu_flags_, |
2150 -1, 0, 4); | 2170 -1, 0, 4); |
2151 EXPECT_EQ(0, max_diff); | 2171 EXPECT_EQ(0, max_diff); |
2152 } | 2172 } |
2153 | 2173 |
2154 TEST_F(libyuvTest, ARGBRect_Opt) { | 2174 TEST_F(LibYUVPlanarTest, ARGBRect_Opt) { |
2155 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, | 2175 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, |
2156 benchmark_iterations_, disable_cpu_flags_, | 2176 benchmark_iterations_, disable_cpu_flags_, |
2157 +1, 0, 4); | 2177 +1, 0, 4); |
2158 EXPECT_EQ(0, max_diff); | 2178 EXPECT_EQ(0, max_diff); |
2159 } | 2179 } |
2160 | 2180 |
2161 TEST_F(libyuvTest, SetPlane_Any) { | 2181 TEST_F(LibYUVPlanarTest, SetPlane_Any) { |
2162 int max_diff = TestARGBRect(benchmark_width_ - 1, benchmark_height_, | 2182 int max_diff = TestARGBRect(benchmark_width_ - 1, benchmark_height_, |
2163 benchmark_iterations_, disable_cpu_flags_, | 2183 benchmark_iterations_, disable_cpu_flags_, |
2164 +1, 0, 1); | 2184 +1, 0, 1); |
2165 EXPECT_EQ(0, max_diff); | 2185 EXPECT_EQ(0, max_diff); |
2166 } | 2186 } |
2167 | 2187 |
2168 TEST_F(libyuvTest, SetPlane_Unaligned) { | 2188 TEST_F(LibYUVPlanarTest, SetPlane_Unaligned) { |
2169 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, | 2189 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, |
2170 benchmark_iterations_, disable_cpu_flags_, | 2190 benchmark_iterations_, disable_cpu_flags_, |
2171 +1, 1, 1); | 2191 +1, 1, 1); |
2172 EXPECT_EQ(0, max_diff); | 2192 EXPECT_EQ(0, max_diff); |
2173 } | 2193 } |
2174 | 2194 |
2175 TEST_F(libyuvTest, SetPlane_Invert) { | 2195 TEST_F(LibYUVPlanarTest, SetPlane_Invert) { |
2176 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, | 2196 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, |
2177 benchmark_iterations_, disable_cpu_flags_, | 2197 benchmark_iterations_, disable_cpu_flags_, |
2178 -1, 0, 1); | 2198 -1, 0, 1); |
2179 EXPECT_EQ(0, max_diff); | 2199 EXPECT_EQ(0, max_diff); |
2180 } | 2200 } |
2181 | 2201 |
2182 TEST_F(libyuvTest, SetPlane_Opt) { | 2202 TEST_F(LibYUVPlanarTest, SetPlane_Opt) { |
2183 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, | 2203 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, |
2184 benchmark_iterations_, disable_cpu_flags_, | 2204 benchmark_iterations_, disable_cpu_flags_, |
2185 +1, 0, 1); | 2205 +1, 0, 1); |
2186 EXPECT_EQ(0, max_diff); | 2206 EXPECT_EQ(0, max_diff); |
2187 } | 2207 } |
2188 | 2208 |
2189 } // namespace libyuv | 2209 } // namespace libyuv |
OLD | NEW |