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

Side by Side Diff: unit_test/convert_test.cc

Issue 1399523004: break up unittests into categories (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: bump version 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/compare_test.cc ('k') | unit_test/cpu_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 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
(...skipping 14 matching lines...) Expand all
25 #include "libyuv/row.h" 25 #include "libyuv/row.h"
26 #include "libyuv/video_common.h" 26 #include "libyuv/video_common.h"
27 #include "../unit_test/unit_test.h" 27 #include "../unit_test/unit_test.h"
28 28
29 namespace libyuv { 29 namespace libyuv {
30 30
31 #define SUBSAMPLE(v, a) ((((v) + (a) - 1)) / (a)) 31 #define SUBSAMPLE(v, a) ((((v) + (a) - 1)) / (a))
32 32
33 #define TESTPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ 33 #define TESTPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \
34 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, W1280, N, NEG, OFF) \ 34 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, W1280, N, NEG, OFF) \
35 TEST_F(libyuvTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \ 35 TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
36 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 36 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
37 const int kHeight = benchmark_height_; \ 37 const int kHeight = benchmark_height_; \
38 align_buffer_64(src_y, kWidth * kHeight + OFF); \ 38 align_buffer_64(src_y, kWidth * kHeight + OFF); \
39 align_buffer_64(src_u, \ 39 align_buffer_64(src_u, \
40 SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \ 40 SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \
41 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + OFF); \ 41 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + OFF); \
42 align_buffer_64(src_v, \ 42 align_buffer_64(src_v, \
43 SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \ 43 SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \
44 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + OFF); \ 44 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + OFF); \
45 align_buffer_64(dst_y_c, kWidth * kHeight); \ 45 align_buffer_64(dst_y_c, kWidth * kHeight); \
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 TESTPLANARTOP(I411, 4, 1, I420, 2, 2) 169 TESTPLANARTOP(I411, 4, 1, I420, 2, 2)
170 TESTPLANARTOP(I420, 2, 2, I422, 2, 1) 170 TESTPLANARTOP(I420, 2, 2, I422, 2, 1)
171 TESTPLANARTOP(I420, 2, 2, I444, 1, 1) 171 TESTPLANARTOP(I420, 2, 2, I444, 1, 1)
172 TESTPLANARTOP(I420, 2, 2, I411, 4, 1) 172 TESTPLANARTOP(I420, 2, 2, I411, 4, 1)
173 TESTPLANARTOP(I420, 2, 2, I420Mirror, 2, 2) 173 TESTPLANARTOP(I420, 2, 2, I420Mirror, 2, 2)
174 TESTPLANARTOP(I422, 2, 1, I422, 2, 1) 174 TESTPLANARTOP(I422, 2, 1, I422, 2, 1)
175 TESTPLANARTOP(I444, 1, 1, I444, 1, 1) 175 TESTPLANARTOP(I444, 1, 1, I444, 1, 1)
176 176
177 #define TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ 177 #define TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \
178 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, W1280, N, NEG, OFF) \ 178 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, W1280, N, NEG, OFF) \
179 TEST_F(libyuvTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \ 179 TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
180 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 180 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
181 const int kHeight = benchmark_height_; \ 181 const int kHeight = benchmark_height_; \
182 align_buffer_64(src_y, kWidth * kHeight + OFF); \ 182 align_buffer_64(src_y, kWidth * kHeight + OFF); \
183 align_buffer_64(src_u, \ 183 align_buffer_64(src_u, \
184 SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \ 184 SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \
185 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + OFF); \ 185 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + OFF); \
186 align_buffer_64(src_v, \ 186 align_buffer_64(src_v, \
187 SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \ 187 SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \
188 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + OFF); \ 188 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + OFF); \
189 align_buffer_64(dst_y_c, kWidth * kHeight); \ 189 align_buffer_64(dst_y_c, kWidth * kHeight); \
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 benchmark_width_, _Invert, -, 0) \ 277 benchmark_width_, _Invert, -, 0) \
278 TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ 278 TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \
279 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ 279 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \
280 benchmark_width_, _Opt, +, 0) 280 benchmark_width_, _Opt, +, 0)
281 281
282 TESTPLANARTOBP(I420, 2, 2, NV12, 2, 2) 282 TESTPLANARTOBP(I420, 2, 2, NV12, 2, 2)
283 TESTPLANARTOBP(I420, 2, 2, NV21, 2, 2) 283 TESTPLANARTOBP(I420, 2, 2, NV21, 2, 2)
284 284
285 #define TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ 285 #define TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \
286 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, W1280, N, NEG, OFF) \ 286 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, W1280, N, NEG, OFF) \
287 TEST_F(libyuvTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \ 287 TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \
288 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 288 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
289 const int kHeight = benchmark_height_; \ 289 const int kHeight = benchmark_height_; \
290 align_buffer_64(src_y, kWidth * kHeight + OFF); \ 290 align_buffer_64(src_y, kWidth * kHeight + OFF); \
291 align_buffer_64(src_uv, 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \ 291 align_buffer_64(src_uv, 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \
292 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + OFF); \ 292 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + OFF); \
293 align_buffer_64(dst_y_c, kWidth * kHeight); \ 293 align_buffer_64(dst_y_c, kWidth * kHeight); \
294 align_buffer_64(dst_u_c, \ 294 align_buffer_64(dst_u_c, \
295 SUBSAMPLE(kWidth, SUBSAMP_X) * \ 295 SUBSAMPLE(kWidth, SUBSAMP_X) * \
296 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 296 SUBSAMPLE(kHeight, SUBSAMP_Y)); \
297 align_buffer_64(dst_v_c, \ 297 align_buffer_64(dst_v_c, \
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ 404 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \
405 benchmark_width_, _Opt, +, 0) 405 benchmark_width_, _Opt, +, 0)
406 406
407 TESTBIPLANARTOP(NV12, 2, 2, I420, 2, 2) 407 TESTBIPLANARTOP(NV12, 2, 2, I420, 2, 2)
408 TESTBIPLANARTOP(NV21, 2, 2, I420, 2, 2) 408 TESTBIPLANARTOP(NV21, 2, 2, I420, 2, 2)
409 409
410 #define ALIGNINT(V, ALIGN) (((V) + (ALIGN) - 1) / (ALIGN) * (ALIGN)) 410 #define ALIGNINT(V, ALIGN) (((V) + (ALIGN) - 1) / (ALIGN) * (ALIGN))
411 411
412 #define TESTPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \ 412 #define TESTPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \
413 YALIGN, W1280, DIFF, N, NEG, OFF, FMT_C, BPP_C) \ 413 YALIGN, W1280, DIFF, N, NEG, OFF, FMT_C, BPP_C) \
414 TEST_F(libyuvTest, FMT_PLANAR##To##FMT_B##N) { \ 414 TEST_F(LibYUVConvertTest, FMT_PLANAR##To##FMT_B##N) { \
415 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 415 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
416 const int kHeight = ALIGNINT(benchmark_height_, YALIGN); \ 416 const int kHeight = ALIGNINT(benchmark_height_, YALIGN); \
417 const int kStrideB = ALIGNINT(kWidth * BPP_B, ALIGN); \ 417 const int kStrideB = ALIGNINT(kWidth * BPP_B, ALIGN); \
418 const int kSizeUV = \ 418 const int kSizeUV = \
419 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y); \ 419 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y); \
420 align_buffer_64(src_y, kWidth * kHeight + OFF); \ 420 align_buffer_64(src_y, kWidth * kHeight + OFF); \
421 align_buffer_64(src_u, kSizeUV + OFF); \ 421 align_buffer_64(src_u, kSizeUV + OFF); \
422 align_buffer_64(src_v, kSizeUV + OFF); \ 422 align_buffer_64(src_v, kSizeUV + OFF); \
423 align_buffer_64(dst_argb_c, kStrideB * kHeight + OFF); \ 423 align_buffer_64(dst_argb_c, kStrideB * kHeight + OFF); \
424 align_buffer_64(dst_argb_opt, kStrideB * kHeight + OFF); \ 424 align_buffer_64(dst_argb_opt, kStrideB * kHeight + OFF); \
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 TESTPLANARTOB(I444, 1, 1, ABGR, 4, 4, 1, 2, ARGB, 4) 513 TESTPLANARTOB(I444, 1, 1, ABGR, 4, 4, 1, 2, ARGB, 4)
514 TESTPLANARTOB(I420, 2, 2, YUY2, 2, 4, 1, 1, ARGB, 4) 514 TESTPLANARTOB(I420, 2, 2, YUY2, 2, 4, 1, 1, ARGB, 4)
515 TESTPLANARTOB(I420, 2, 2, UYVY, 2, 4, 1, 1, ARGB, 4) 515 TESTPLANARTOB(I420, 2, 2, UYVY, 2, 4, 1, 1, ARGB, 4)
516 TESTPLANARTOB(I422, 2, 1, YUY2, 2, 4, 1, 0, ARGB, 4) 516 TESTPLANARTOB(I422, 2, 1, YUY2, 2, 4, 1, 0, ARGB, 4)
517 TESTPLANARTOB(I422, 2, 1, UYVY, 2, 4, 1, 0, ARGB, 4) 517 TESTPLANARTOB(I422, 2, 1, UYVY, 2, 4, 1, 0, ARGB, 4)
518 TESTPLANARTOB(I420, 2, 2, I400, 1, 1, 1, 0, ARGB, 4) 518 TESTPLANARTOB(I420, 2, 2, I400, 1, 1, 1, 0, ARGB, 4)
519 TESTPLANARTOB(J420, 2, 2, J400, 1, 1, 1, 0, ARGB, 4) 519 TESTPLANARTOB(J420, 2, 2, J400, 1, 1, 1, 0, ARGB, 4)
520 520
521 #define TESTQPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \ 521 #define TESTQPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \
522 YALIGN, W1280, DIFF, N, NEG, OFF, ATTEN) \ 522 YALIGN, W1280, DIFF, N, NEG, OFF, ATTEN) \
523 TEST_F(libyuvTest, FMT_PLANAR##To##FMT_B##N) { \ 523 TEST_F(LibYUVConvertTest, FMT_PLANAR##To##FMT_B##N) { \
524 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 524 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
525 const int kHeight = ALIGNINT(benchmark_height_, YALIGN); \ 525 const int kHeight = ALIGNINT(benchmark_height_, YALIGN); \
526 const int kStrideB = ALIGNINT(kWidth * BPP_B, ALIGN); \ 526 const int kStrideB = ALIGNINT(kWidth * BPP_B, ALIGN); \
527 const int kSizeUV = \ 527 const int kSizeUV = \
528 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y); \ 528 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y); \
529 align_buffer_64(src_y, kWidth * kHeight + OFF); \ 529 align_buffer_64(src_y, kWidth * kHeight + OFF); \
530 align_buffer_64(src_u, kSizeUV + OFF); \ 530 align_buffer_64(src_u, kSizeUV + OFF); \
531 align_buffer_64(src_v, kSizeUV + OFF); \ 531 align_buffer_64(src_v, kSizeUV + OFF); \
532 align_buffer_64(src_a, kWidth * kHeight + OFF); \ 532 align_buffer_64(src_a, kWidth * kHeight + OFF); \
533 align_buffer_64(dst_argb_c, kStrideB * kHeight + OFF); \ 533 align_buffer_64(dst_argb_c, kStrideB * kHeight + OFF); \
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 TESTQPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \ 587 TESTQPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \
588 YALIGN, benchmark_width_, DIFF, _Opt, +, 0, 0) \ 588 YALIGN, benchmark_width_, DIFF, _Opt, +, 0, 0) \
589 TESTQPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \ 589 TESTQPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \
590 YALIGN, benchmark_width_, DIFF, _Premult, +, 0, 1) 590 YALIGN, benchmark_width_, DIFF, _Premult, +, 0, 1)
591 591
592 TESTQPLANARTOB(I420Alpha, 2, 2, ARGB, 4, 4, 1, 2) 592 TESTQPLANARTOB(I420Alpha, 2, 2, ARGB, 4, 4, 1, 2)
593 TESTQPLANARTOB(I420Alpha, 2, 2, ABGR, 4, 4, 1, 2) 593 TESTQPLANARTOB(I420Alpha, 2, 2, ABGR, 4, 4, 1, 2)
594 594
595 #define TESTBIPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, \ 595 #define TESTBIPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, \
596 W1280, DIFF, N, NEG, OFF) \ 596 W1280, DIFF, N, NEG, OFF) \
597 TEST_F(libyuvTest, FMT_PLANAR##To##FMT_B##N) { \ 597 TEST_F(LibYUVConvertTest, FMT_PLANAR##To##FMT_B##N) { \
598 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 598 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
599 const int kHeight = benchmark_height_; \ 599 const int kHeight = benchmark_height_; \
600 const int kStrideB = kWidth * BPP_B; \ 600 const int kStrideB = kWidth * BPP_B; \
601 align_buffer_64(src_y, kWidth * kHeight + OFF); \ 601 align_buffer_64(src_y, kWidth * kHeight + OFF); \
602 align_buffer_64(src_uv, \ 602 align_buffer_64(src_uv, \
603 SUBSAMPLE(kWidth, SUBSAMP_X) * \ 603 SUBSAMPLE(kWidth, SUBSAMP_X) * \
604 SUBSAMPLE(kHeight, SUBSAMP_Y) * 2 + OFF); \ 604 SUBSAMPLE(kHeight, SUBSAMP_Y) * 2 + OFF); \
605 align_buffer_64(dst_argb_c, kStrideB * kHeight); \ 605 align_buffer_64(dst_argb_c, kStrideB * kHeight); \
606 align_buffer_64(dst_argb_opt, kStrideB * kHeight); \ 606 align_buffer_64(dst_argb_opt, kStrideB * kHeight); \
607 for (int i = 0; i < kHeight; ++i) \ 607 for (int i = 0; i < kHeight; ++i) \
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 benchmark_width_, DIFF, _Invert, -, 0) \ 667 benchmark_width_, DIFF, _Invert, -, 0) \
668 TESTBIPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, \ 668 TESTBIPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, \
669 benchmark_width_, DIFF, _Opt, +, 0) 669 benchmark_width_, DIFF, _Opt, +, 0)
670 670
671 TESTBIPLANARTOB(NV12, 2, 2, ARGB, 4, 2) 671 TESTBIPLANARTOB(NV12, 2, 2, ARGB, 4, 2)
672 TESTBIPLANARTOB(NV21, 2, 2, ARGB, 4, 2) 672 TESTBIPLANARTOB(NV21, 2, 2, ARGB, 4, 2)
673 TESTBIPLANARTOB(NV12, 2, 2, RGB565, 2, 9) 673 TESTBIPLANARTOB(NV12, 2, 2, RGB565, 2, 9)
674 674
675 #define TESTATOPLANARI(FMT_A, BPP_A, YALIGN, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ 675 #define TESTATOPLANARI(FMT_A, BPP_A, YALIGN, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \
676 W1280, DIFF, N, NEG, OFF) \ 676 W1280, DIFF, N, NEG, OFF) \
677 TEST_F(libyuvTest, FMT_A##To##FMT_PLANAR##N) { \ 677 TEST_F(LibYUVConvertTest, FMT_A##To##FMT_PLANAR##N) { \
678 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 678 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
679 const int kHeight = ALIGNINT(benchmark_height_, YALIGN); \ 679 const int kHeight = ALIGNINT(benchmark_height_, YALIGN); \
680 const int kStride = \ 680 const int kStride = \
681 (SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMP_X * 8 * BPP_A + 7) / 8; \ 681 (SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMP_X * 8 * BPP_A + 7) / 8; \
682 align_buffer_64(src_argb, kStride * kHeight + OFF); \ 682 align_buffer_64(src_argb, kStride * kHeight + OFF); \
683 align_buffer_64(dst_y_c, kWidth * kHeight); \ 683 align_buffer_64(dst_y_c, kWidth * kHeight); \
684 align_buffer_64(dst_u_c, \ 684 align_buffer_64(dst_u_c, \
685 SUBSAMPLE(kWidth, SUBSAMP_X) * \ 685 SUBSAMPLE(kWidth, SUBSAMP_X) * \
686 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 686 SUBSAMPLE(kHeight, SUBSAMP_Y)); \
687 align_buffer_64(dst_v_c, \ 687 align_buffer_64(dst_v_c, \
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 TESTATOPLANAR(ARGB, 4, 1, I444, 1, 1, 2) 785 TESTATOPLANAR(ARGB, 4, 1, I444, 1, 1, 2)
786 TESTATOPLANAR(YUY2, 2, 1, I420, 2, 2, 2) 786 TESTATOPLANAR(YUY2, 2, 1, I420, 2, 2, 2)
787 TESTATOPLANAR(UYVY, 2, 1, I420, 2, 2, 2) 787 TESTATOPLANAR(UYVY, 2, 1, I420, 2, 2, 2)
788 TESTATOPLANAR(YUY2, 2, 1, I422, 2, 1, 2) 788 TESTATOPLANAR(YUY2, 2, 1, I422, 2, 1, 2)
789 TESTATOPLANAR(UYVY, 2, 1, I422, 2, 1, 2) 789 TESTATOPLANAR(UYVY, 2, 1, I422, 2, 1, 2)
790 TESTATOPLANAR(I400, 1, 1, I420, 2, 2, 2) 790 TESTATOPLANAR(I400, 1, 1, I420, 2, 2, 2)
791 TESTATOPLANAR(J400, 1, 1, J420, 2, 2, 2) 791 TESTATOPLANAR(J400, 1, 1, J420, 2, 2, 2)
792 792
793 #define TESTATOBIPLANARI(FMT_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ 793 #define TESTATOBIPLANARI(FMT_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \
794 W1280, N, NEG, OFF) \ 794 W1280, N, NEG, OFF) \
795 TEST_F(libyuvTest, FMT_A##To##FMT_PLANAR##N) { \ 795 TEST_F(LibYUVConvertTest, FMT_A##To##FMT_PLANAR##N) { \
796 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 796 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
797 const int kHeight = benchmark_height_; \ 797 const int kHeight = benchmark_height_; \
798 const int kStride = (kWidth * 8 * BPP_A + 7) / 8; \ 798 const int kStride = (kWidth * 8 * BPP_A + 7) / 8; \
799 align_buffer_64(src_argb, kStride * kHeight + OFF); \ 799 align_buffer_64(src_argb, kStride * kHeight + OFF); \
800 align_buffer_64(dst_y_c, kWidth * kHeight); \ 800 align_buffer_64(dst_y_c, kWidth * kHeight); \
801 align_buffer_64(dst_uv_c, \ 801 align_buffer_64(dst_uv_c, \
802 SUBSAMPLE(kWidth, SUBSAMP_X) * 2 * \ 802 SUBSAMPLE(kWidth, SUBSAMP_X) * 2 * \
803 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ 803 SUBSAMPLE(kHeight, SUBSAMP_Y)); \
804 align_buffer_64(dst_y_opt, kWidth * kHeight); \ 804 align_buffer_64(dst_y_opt, kWidth * kHeight); \
805 align_buffer_64(dst_uv_opt, \ 805 align_buffer_64(dst_uv_opt, \
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 benchmark_width_, _Opt, +, 0) 869 benchmark_width_, _Opt, +, 0)
870 870
871 TESTATOBIPLANAR(ARGB, 4, NV12, 2, 2) 871 TESTATOBIPLANAR(ARGB, 4, NV12, 2, 2)
872 TESTATOBIPLANAR(ARGB, 4, NV21, 2, 2) 872 TESTATOBIPLANAR(ARGB, 4, NV21, 2, 2)
873 TESTATOBIPLANAR(YUY2, 2, NV12, 2, 2) 873 TESTATOBIPLANAR(YUY2, 2, NV12, 2, 2)
874 TESTATOBIPLANAR(UYVY, 2, NV12, 2, 2) 874 TESTATOBIPLANAR(UYVY, 2, NV12, 2, 2)
875 875
876 #define TESTATOBI(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \ 876 #define TESTATOBI(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \
877 FMT_B, BPP_B, STRIDE_B, HEIGHT_B, \ 877 FMT_B, BPP_B, STRIDE_B, HEIGHT_B, \
878 W1280, DIFF, N, NEG, OFF) \ 878 W1280, DIFF, N, NEG, OFF) \
879 TEST_F(libyuvTest, FMT_A##To##FMT_B##N) { \ 879 TEST_F(LibYUVConvertTest, FMT_A##To##FMT_B##N) { \
880 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 880 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
881 const int kHeight = benchmark_height_; \ 881 const int kHeight = benchmark_height_; \
882 const int kHeightA = (kHeight + HEIGHT_A - 1) / HEIGHT_A * HEIGHT_A; \ 882 const int kHeightA = (kHeight + HEIGHT_A - 1) / HEIGHT_A * HEIGHT_A; \
883 const int kHeightB = (kHeight + HEIGHT_B - 1) / HEIGHT_B * HEIGHT_B; \ 883 const int kHeightB = (kHeight + HEIGHT_B - 1) / HEIGHT_B * HEIGHT_B; \
884 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A; \ 884 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A; \
885 const int kStrideB = (kWidth * BPP_B + STRIDE_B - 1) / STRIDE_B * STRIDE_B; \ 885 const int kStrideB = (kWidth * BPP_B + STRIDE_B - 1) / STRIDE_B * STRIDE_B; \
886 align_buffer_64(src_argb, kStrideA * kHeightA + OFF); \ 886 align_buffer_64(src_argb, kStrideA * kHeightA + OFF); \
887 align_buffer_64(dst_argb_c, kStrideB * kHeightB); \ 887 align_buffer_64(dst_argb_c, kStrideB * kHeightB); \
888 align_buffer_64(dst_argb_opt, kStrideB * kHeightB); \ 888 align_buffer_64(dst_argb_opt, kStrideB * kHeightB); \
889 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ 889 for (int i = 0; i < kStrideA * kHeightA; ++i) { \
(...skipping 21 matching lines...) Expand all
911 } \ 911 } \
912 } \ 912 } \
913 EXPECT_LE(max_diff, DIFF); \ 913 EXPECT_LE(max_diff, DIFF); \
914 free_aligned_buffer_64(src_argb); \ 914 free_aligned_buffer_64(src_argb); \
915 free_aligned_buffer_64(dst_argb_c); \ 915 free_aligned_buffer_64(dst_argb_c); \
916 free_aligned_buffer_64(dst_argb_opt); \ 916 free_aligned_buffer_64(dst_argb_opt); \
917 } 917 }
918 918
919 #define TESTATOBRANDOM(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \ 919 #define TESTATOBRANDOM(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \
920 FMT_B, BPP_B, STRIDE_B, HEIGHT_B, DIFF) \ 920 FMT_B, BPP_B, STRIDE_B, HEIGHT_B, DIFF) \
921 TEST_F(libyuvTest, FMT_A##To##FMT_B##_Random) { \ 921 TEST_F(LibYUVConvertTest, FMT_A##To##FMT_B##_Random) { \
922 for (int times = 0; times < benchmark_iterations_; ++times) { \ 922 for (int times = 0; times < benchmark_iterations_; ++times) { \
923 const int kWidth = (fastrand() & 63) + 1; \ 923 const int kWidth = (fastrand() & 63) + 1; \
924 const int kHeight = (fastrand() & 31) + 1; \ 924 const int kHeight = (fastrand() & 31) + 1; \
925 const int kHeightA = (kHeight + HEIGHT_A - 1) / HEIGHT_A * HEIGHT_A; \ 925 const int kHeightA = (kHeight + HEIGHT_A - 1) / HEIGHT_A * HEIGHT_A; \
926 const int kHeightB = (kHeight + HEIGHT_B - 1) / HEIGHT_B * HEIGHT_B; \ 926 const int kHeightB = (kHeight + HEIGHT_B - 1) / HEIGHT_B * HEIGHT_B; \
927 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A;\ 927 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A;\
928 const int kStrideB = (kWidth * BPP_B + STRIDE_B - 1) / STRIDE_B * STRIDE_B;\ 928 const int kStrideB = (kWidth * BPP_B + STRIDE_B - 1) / STRIDE_B * STRIDE_B;\
929 align_buffer_page_end(src_argb, kStrideA * kHeightA); \ 929 align_buffer_page_end(src_argb, kStrideA * kHeightA); \
930 align_buffer_page_end(dst_argb_c, kStrideB * kHeightB); \ 930 align_buffer_page_end(dst_argb_c, kStrideB * kHeightB); \
931 align_buffer_page_end(dst_argb_opt, kStrideB * kHeightB); \ 931 align_buffer_page_end(dst_argb_opt, kStrideB * kHeightB); \
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 TESTATOB(I400, 1, 1, 1, ARGB, 4, 4, 1, 0) 1001 TESTATOB(I400, 1, 1, 1, ARGB, 4, 4, 1, 0)
1002 TESTATOB(J400, 1, 1, 1, ARGB, 4, 4, 1, 0) 1002 TESTATOB(J400, 1, 1, 1, ARGB, 4, 4, 1, 0)
1003 TESTATOB(I400, 1, 1, 1, I400, 1, 1, 1, 0) 1003 TESTATOB(I400, 1, 1, 1, I400, 1, 1, 1, 0)
1004 TESTATOB(J400, 1, 1, 1, J400, 1, 1, 1, 0) 1004 TESTATOB(J400, 1, 1, 1, J400, 1, 1, 1, 0)
1005 TESTATOB(I400, 1, 1, 1, I400Mirror, 1, 1, 1, 0) 1005 TESTATOB(I400, 1, 1, 1, I400Mirror, 1, 1, 1, 0)
1006 TESTATOB(ARGB, 4, 4, 1, ARGBMirror, 4, 4, 1, 0) 1006 TESTATOB(ARGB, 4, 4, 1, ARGBMirror, 4, 4, 1, 0)
1007 1007
1008 #define TESTATOBDI(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \ 1008 #define TESTATOBDI(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \
1009 FMT_B, BPP_B, STRIDE_B, HEIGHT_B, \ 1009 FMT_B, BPP_B, STRIDE_B, HEIGHT_B, \
1010 W1280, DIFF, N, NEG, OFF) \ 1010 W1280, DIFF, N, NEG, OFF) \
1011 TEST_F(libyuvTest, FMT_A##To##FMT_B##Dither##N) { \ 1011 TEST_F(LibYUVConvertTest, FMT_A##To##FMT_B##Dither##N) { \
1012 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 1012 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
1013 const int kHeight = benchmark_height_; \ 1013 const int kHeight = benchmark_height_; \
1014 const int kHeightA = (kHeight + HEIGHT_A - 1) / HEIGHT_A * HEIGHT_A; \ 1014 const int kHeightA = (kHeight + HEIGHT_A - 1) / HEIGHT_A * HEIGHT_A; \
1015 const int kHeightB = (kHeight + HEIGHT_B - 1) / HEIGHT_B * HEIGHT_B; \ 1015 const int kHeightB = (kHeight + HEIGHT_B - 1) / HEIGHT_B * HEIGHT_B; \
1016 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A; \ 1016 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A; \
1017 const int kStrideB = (kWidth * BPP_B + STRIDE_B - 1) / STRIDE_B * STRIDE_B; \ 1017 const int kStrideB = (kWidth * BPP_B + STRIDE_B - 1) / STRIDE_B * STRIDE_B; \
1018 align_buffer_64(src_argb, kStrideA * kHeightA + OFF); \ 1018 align_buffer_64(src_argb, kStrideA * kHeightA + OFF); \
1019 align_buffer_64(dst_argb_c, kStrideB * kHeightB); \ 1019 align_buffer_64(dst_argb_c, kStrideB * kHeightB); \
1020 align_buffer_64(dst_argb_opt, kStrideB * kHeightB); \ 1020 align_buffer_64(dst_argb_opt, kStrideB * kHeightB); \
1021 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ 1021 for (int i = 0; i < kStrideA * kHeightA; ++i) { \
(...skipping 21 matching lines...) Expand all
1043 } \ 1043 } \
1044 } \ 1044 } \
1045 EXPECT_LE(max_diff, DIFF); \ 1045 EXPECT_LE(max_diff, DIFF); \
1046 free_aligned_buffer_64(src_argb); \ 1046 free_aligned_buffer_64(src_argb); \
1047 free_aligned_buffer_64(dst_argb_c); \ 1047 free_aligned_buffer_64(dst_argb_c); \
1048 free_aligned_buffer_64(dst_argb_opt); \ 1048 free_aligned_buffer_64(dst_argb_opt); \
1049 } 1049 }
1050 1050
1051 #define TESTATOBDRANDOM(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \ 1051 #define TESTATOBDRANDOM(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \
1052 FMT_B, BPP_B, STRIDE_B, HEIGHT_B, DIFF) \ 1052 FMT_B, BPP_B, STRIDE_B, HEIGHT_B, DIFF) \
1053 TEST_F(libyuvTest, FMT_A##To##FMT_B##Dither_Random) { \ 1053 TEST_F(LibYUVConvertTest, FMT_A##To##FMT_B##Dither_Random) { \
1054 for (int times = 0; times < benchmark_iterations_; ++times) { \ 1054 for (int times = 0; times < benchmark_iterations_; ++times) { \
1055 const int kWidth = (fastrand() & 63) + 1; \ 1055 const int kWidth = (fastrand() & 63) + 1; \
1056 const int kHeight = (fastrand() & 31) + 1; \ 1056 const int kHeight = (fastrand() & 31) + 1; \
1057 const int kHeightA = (kHeight + HEIGHT_A - 1) / HEIGHT_A * HEIGHT_A; \ 1057 const int kHeightA = (kHeight + HEIGHT_A - 1) / HEIGHT_A * HEIGHT_A; \
1058 const int kHeightB = (kHeight + HEIGHT_B - 1) / HEIGHT_B * HEIGHT_B; \ 1058 const int kHeightB = (kHeight + HEIGHT_B - 1) / HEIGHT_B * HEIGHT_B; \
1059 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A;\ 1059 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A;\
1060 const int kStrideB = (kWidth * BPP_B + STRIDE_B - 1) / STRIDE_B * STRIDE_B;\ 1060 const int kStrideB = (kWidth * BPP_B + STRIDE_B - 1) / STRIDE_B * STRIDE_B;\
1061 align_buffer_page_end(src_argb, kStrideA * kHeightA); \ 1061 align_buffer_page_end(src_argb, kStrideA * kHeightA); \
1062 align_buffer_page_end(dst_argb_c, kStrideB * kHeightB); \ 1062 align_buffer_page_end(dst_argb_c, kStrideB * kHeightB); \
1063 align_buffer_page_end(dst_argb_opt, kStrideB * kHeightB); \ 1063 align_buffer_page_end(dst_argb_opt, kStrideB * kHeightB); \
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 TESTATOBDI(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \ 1104 TESTATOBDI(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \
1105 FMT_B, BPP_B, STRIDE_B, HEIGHT_B, \ 1105 FMT_B, BPP_B, STRIDE_B, HEIGHT_B, \
1106 benchmark_width_, DIFF, _Opt, +, 0) \ 1106 benchmark_width_, DIFF, _Opt, +, 0) \
1107 TESTATOBDRANDOM(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \ 1107 TESTATOBDRANDOM(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \
1108 FMT_B, BPP_B, STRIDE_B, HEIGHT_B, DIFF) 1108 FMT_B, BPP_B, STRIDE_B, HEIGHT_B, DIFF)
1109 1109
1110 TESTATOBD(ARGB, 4, 4, 1, RGB565, 2, 2, 1, 0) 1110 TESTATOBD(ARGB, 4, 4, 1, RGB565, 2, 2, 1, 0)
1111 1111
1112 #define TESTSYMI(FMT_ATOB, BPP_A, STRIDE_A, HEIGHT_A, \ 1112 #define TESTSYMI(FMT_ATOB, BPP_A, STRIDE_A, HEIGHT_A, \
1113 W1280, N, NEG, OFF) \ 1113 W1280, N, NEG, OFF) \
1114 TEST_F(libyuvTest, FMT_ATOB##_Symetric##N) { \ 1114 TEST_F(LibYUVConvertTest, FMT_ATOB##_Symetric##N) { \
1115 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 1115 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
1116 const int kHeight = benchmark_height_; \ 1116 const int kHeight = benchmark_height_; \
1117 const int kHeightA = (kHeight + HEIGHT_A - 1) / HEIGHT_A * HEIGHT_A; \ 1117 const int kHeightA = (kHeight + HEIGHT_A - 1) / HEIGHT_A * HEIGHT_A; \
1118 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A; \ 1118 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A; \
1119 align_buffer_64(src_argb, kStrideA * kHeightA + OFF); \ 1119 align_buffer_64(src_argb, kStrideA * kHeightA + OFF); \
1120 align_buffer_64(dst_argb_c, kStrideA * kHeightA); \ 1120 align_buffer_64(dst_argb_c, kStrideA * kHeightA); \
1121 align_buffer_64(dst_argb_opt, kStrideA * kHeightA); \ 1121 align_buffer_64(dst_argb_opt, kStrideA * kHeightA); \
1122 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ 1122 for (int i = 0; i < kStrideA * kHeightA; ++i) { \
1123 src_argb[i + OFF] = (fastrand() & 0xff); \ 1123 src_argb[i + OFF] = (fastrand() & 0xff); \
1124 } \ 1124 } \
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 benchmark_width_, _Unaligned, +, 1) \ 1158 benchmark_width_, _Unaligned, +, 1) \
1159 TESTSYMI(FMT_ATOB, BPP_A, STRIDE_A, HEIGHT_A, \ 1159 TESTSYMI(FMT_ATOB, BPP_A, STRIDE_A, HEIGHT_A, \
1160 benchmark_width_, _Opt, +, 0) 1160 benchmark_width_, _Opt, +, 0)
1161 1161
1162 TESTSYM(ARGBToARGB, 4, 4, 1) 1162 TESTSYM(ARGBToARGB, 4, 4, 1)
1163 TESTSYM(ARGBToBGRA, 4, 4, 1) 1163 TESTSYM(ARGBToBGRA, 4, 4, 1)
1164 TESTSYM(ARGBToABGR, 4, 4, 1) 1164 TESTSYM(ARGBToABGR, 4, 4, 1)
1165 TESTSYM(BGRAToARGB, 4, 4, 1) 1165 TESTSYM(BGRAToARGB, 4, 4, 1)
1166 TESTSYM(ABGRToARGB, 4, 4, 1) 1166 TESTSYM(ABGRToARGB, 4, 4, 1)
1167 1167
1168 TEST_F(libyuvTest, Test565) { 1168 TEST_F(LibYUVConvertTest, Test565) {
1169 SIMD_ALIGNED(uint8 orig_pixels[256][4]); 1169 SIMD_ALIGNED(uint8 orig_pixels[256][4]);
1170 SIMD_ALIGNED(uint8 pixels565[256][2]); 1170 SIMD_ALIGNED(uint8 pixels565[256][2]);
1171 1171
1172 for (int i = 0; i < 256; ++i) { 1172 for (int i = 0; i < 256; ++i) {
1173 for (int j = 0; j < 4; ++j) { 1173 for (int j = 0; j < 4; ++j) {
1174 orig_pixels[i][j] = i; 1174 orig_pixels[i][j] = i;
1175 } 1175 }
1176 } 1176 }
1177 ARGBToRGB565(&orig_pixels[0][0], 0, &pixels565[0][0], 0, 256, 1); 1177 ARGBToRGB565(&orig_pixels[0][0], 0, &pixels565[0][0], 0, 256, 1);
1178 uint32 checksum = HashDjb2(&pixels565[0][0], sizeof(pixels565), 5381); 1178 uint32 checksum = HashDjb2(&pixels565[0][0], sizeof(pixels565), 5381);
1179 EXPECT_EQ(610919429u, checksum); 1179 EXPECT_EQ(610919429u, checksum);
1180 } 1180 }
1181 1181
1182 #ifdef HAVE_JPEG 1182 #ifdef HAVE_JPEG
1183 TEST_F(libyuvTest, ValidateJpeg) { 1183 TEST_F(LibYUVConvertTest, ValidateJpeg) {
1184 const int kOff = 10; 1184 const int kOff = 10;
1185 const int kMinJpeg = 64; 1185 const int kMinJpeg = 64;
1186 const int kImageSize = benchmark_width_ * benchmark_height_ >= kMinJpeg ? 1186 const int kImageSize = benchmark_width_ * benchmark_height_ >= kMinJpeg ?
1187 benchmark_width_ * benchmark_height_ : kMinJpeg; 1187 benchmark_width_ * benchmark_height_ : kMinJpeg;
1188 const int kSize = kImageSize + kOff; 1188 const int kSize = kImageSize + kOff;
1189 align_buffer_page_end(orig_pixels, kSize); 1189 align_buffer_page_end(orig_pixels, kSize);
1190 1190
1191 // No SOI or EOI. Expect fail. 1191 // No SOI or EOI. Expect fail.
1192 memset(orig_pixels, 0, kSize); 1192 memset(orig_pixels, 0, kSize);
1193 EXPECT_FALSE(ValidateJpeg(orig_pixels, kSize)); 1193 EXPECT_FALSE(ValidateJpeg(orig_pixels, kSize));
1194 1194
1195 // Test special value that matches marker start. 1195 // Test special value that matches marker start.
1196 memset(orig_pixels, 0xff, kSize); 1196 memset(orig_pixels, 0xff, kSize);
1197 EXPECT_FALSE(ValidateJpeg(orig_pixels, kSize)); 1197 EXPECT_FALSE(ValidateJpeg(orig_pixels, kSize));
1198 1198
1199 // EOI, SOI. Expect pass. 1199 // EOI, SOI. Expect pass.
1200 orig_pixels[0] = 0xff; 1200 orig_pixels[0] = 0xff;
1201 orig_pixels[1] = 0xd8; // SOI. 1201 orig_pixels[1] = 0xd8; // SOI.
1202 orig_pixels[kSize - kOff + 0] = 0xff; 1202 orig_pixels[kSize - kOff + 0] = 0xff;
1203 orig_pixels[kSize - kOff + 1] = 0xd9; // EOI. 1203 orig_pixels[kSize - kOff + 1] = 0xd9; // EOI.
1204 for (int times = 0; times < benchmark_iterations_; ++times) { 1204 for (int times = 0; times < benchmark_iterations_; ++times) {
1205 EXPECT_TRUE(ValidateJpeg(orig_pixels, kSize)); 1205 EXPECT_TRUE(ValidateJpeg(orig_pixels, kSize));
1206 } 1206 }
1207 free_aligned_buffer_page_end(orig_pixels); 1207 free_aligned_buffer_page_end(orig_pixels);
1208 } 1208 }
1209 1209
1210 TEST_F(libyuvTest, ValidateJpegLarge) { 1210 TEST_F(LibYUVConvertTest, ValidateJpegLarge) {
1211 const int kOff = 10; 1211 const int kOff = 10;
1212 const int kMinJpeg = 64; 1212 const int kMinJpeg = 64;
1213 const int kImageSize = benchmark_width_ * benchmark_height_ >= kMinJpeg ? 1213 const int kImageSize = benchmark_width_ * benchmark_height_ >= kMinJpeg ?
1214 benchmark_width_ * benchmark_height_ : kMinJpeg; 1214 benchmark_width_ * benchmark_height_ : kMinJpeg;
1215 const int kSize = kImageSize + kOff; 1215 const int kSize = kImageSize + kOff;
1216 const int kMultiple = 10; 1216 const int kMultiple = 10;
1217 const int kBufSize = kImageSize * kMultiple + kOff; 1217 const int kBufSize = kImageSize * kMultiple + kOff;
1218 align_buffer_page_end(orig_pixels, kBufSize); 1218 align_buffer_page_end(orig_pixels, kBufSize);
1219 1219
1220 // No SOI or EOI. Expect fail. 1220 // No SOI or EOI. Expect fail.
1221 memset(orig_pixels, 0, kBufSize); 1221 memset(orig_pixels, 0, kBufSize);
1222 EXPECT_FALSE(ValidateJpeg(orig_pixels, kBufSize)); 1222 EXPECT_FALSE(ValidateJpeg(orig_pixels, kBufSize));
1223 1223
1224 // EOI, SOI. Expect pass. 1224 // EOI, SOI. Expect pass.
1225 orig_pixels[0] = 0xff; 1225 orig_pixels[0] = 0xff;
1226 orig_pixels[1] = 0xd8; // SOI. 1226 orig_pixels[1] = 0xd8; // SOI.
1227 orig_pixels[kSize - kOff + 0] = 0xff; 1227 orig_pixels[kSize - kOff + 0] = 0xff;
1228 orig_pixels[kSize - kOff + 1] = 0xd9; // EOI. 1228 orig_pixels[kSize - kOff + 1] = 0xd9; // EOI.
1229 for (int times = 0; times < benchmark_iterations_; ++times) { 1229 for (int times = 0; times < benchmark_iterations_; ++times) {
1230 EXPECT_TRUE(ValidateJpeg(orig_pixels, kBufSize)); 1230 EXPECT_TRUE(ValidateJpeg(orig_pixels, kBufSize));
1231 } 1231 }
1232 free_aligned_buffer_page_end(orig_pixels); 1232 free_aligned_buffer_page_end(orig_pixels);
1233 } 1233 }
1234 1234
1235 TEST_F(libyuvTest, InvalidateJpeg) { 1235 TEST_F(LibYUVConvertTest, InvalidateJpeg) {
1236 const int kOff = 10; 1236 const int kOff = 10;
1237 const int kMinJpeg = 64; 1237 const int kMinJpeg = 64;
1238 const int kImageSize = benchmark_width_ * benchmark_height_ >= kMinJpeg ? 1238 const int kImageSize = benchmark_width_ * benchmark_height_ >= kMinJpeg ?
1239 benchmark_width_ * benchmark_height_ : kMinJpeg; 1239 benchmark_width_ * benchmark_height_ : kMinJpeg;
1240 const int kSize = kImageSize + kOff; 1240 const int kSize = kImageSize + kOff;
1241 align_buffer_page_end(orig_pixels, kSize); 1241 align_buffer_page_end(orig_pixels, kSize);
1242 1242
1243 // NULL pointer. Expect fail. 1243 // NULL pointer. Expect fail.
1244 EXPECT_FALSE(ValidateJpeg(NULL, kSize)); 1244 EXPECT_FALSE(ValidateJpeg(NULL, kSize));
1245 1245
(...skipping 17 matching lines...) Expand all
1263 // EOI but no SOI. Expect fail. 1263 // EOI but no SOI. Expect fail.
1264 orig_pixels[0] = 0; 1264 orig_pixels[0] = 0;
1265 orig_pixels[1] = 0; 1265 orig_pixels[1] = 0;
1266 orig_pixels[kSize - kOff + 0] = 0xff; 1266 orig_pixels[kSize - kOff + 0] = 0xff;
1267 orig_pixels[kSize - kOff + 1] = 0xd9; // EOI. 1267 orig_pixels[kSize - kOff + 1] = 0xd9; // EOI.
1268 EXPECT_FALSE(ValidateJpeg(orig_pixels, kSize)); 1268 EXPECT_FALSE(ValidateJpeg(orig_pixels, kSize));
1269 1269
1270 free_aligned_buffer_page_end(orig_pixels); 1270 free_aligned_buffer_page_end(orig_pixels);
1271 } 1271 }
1272 1272
1273 TEST_F(libyuvTest, FuzzJpeg) { 1273 TEST_F(LibYUVConvertTest, FuzzJpeg) {
1274 // SOI but no EOI. Expect fail. 1274 // SOI but no EOI. Expect fail.
1275 for (int times = 0; times < benchmark_iterations_; ++times) { 1275 for (int times = 0; times < benchmark_iterations_; ++times) {
1276 const int kSize = fastrand() % 5000 + 2; 1276 const int kSize = fastrand() % 5000 + 2;
1277 align_buffer_page_end(orig_pixels, kSize); 1277 align_buffer_page_end(orig_pixels, kSize);
1278 MemRandomize(orig_pixels, kSize); 1278 MemRandomize(orig_pixels, kSize);
1279 1279
1280 // Add SOI so frame will be scanned. 1280 // Add SOI so frame will be scanned.
1281 orig_pixels[0] = 0xff; 1281 orig_pixels[0] = 0xff;
1282 orig_pixels[1] = 0xd8; // SOI. 1282 orig_pixels[1] = 0xd8; // SOI.
1283 orig_pixels[kSize - 1] = 0xff; 1283 orig_pixels[kSize - 1] = 0xff;
1284 ValidateJpeg(orig_pixels, kSize); // Failure normally expected. 1284 ValidateJpeg(orig_pixels, kSize); // Failure normally expected.
1285 free_aligned_buffer_page_end(orig_pixels); 1285 free_aligned_buffer_page_end(orig_pixels);
1286 } 1286 }
1287 } 1287 }
1288 1288
1289 TEST_F(libyuvTest, MJPGToI420) { 1289 TEST_F(LibYUVConvertTest, MJPGToI420) {
1290 const int kOff = 10; 1290 const int kOff = 10;
1291 const int kMinJpeg = 64; 1291 const int kMinJpeg = 64;
1292 const int kImageSize = benchmark_width_ * benchmark_height_ >= kMinJpeg ? 1292 const int kImageSize = benchmark_width_ * benchmark_height_ >= kMinJpeg ?
1293 benchmark_width_ * benchmark_height_ : kMinJpeg; 1293 benchmark_width_ * benchmark_height_ : kMinJpeg;
1294 const int kSize = kImageSize + kOff; 1294 const int kSize = kImageSize + kOff;
1295 align_buffer_page_end(orig_pixels, kSize); 1295 align_buffer_page_end(orig_pixels, kSize);
1296 align_buffer_page_end(dst_y_opt, benchmark_width_ * benchmark_height_); 1296 align_buffer_page_end(dst_y_opt, benchmark_width_ * benchmark_height_);
1297 align_buffer_page_end(dst_u_opt, 1297 align_buffer_page_end(dst_u_opt,
1298 SUBSAMPLE(benchmark_width_, 2) * 1298 SUBSAMPLE(benchmark_width_, 2) *
1299 SUBSAMPLE(benchmark_height_, 2)); 1299 SUBSAMPLE(benchmark_height_, 2));
(...skipping 18 matching lines...) Expand all
1318 // Expect failure because image is not really valid. 1318 // Expect failure because image is not really valid.
1319 EXPECT_EQ(1, ret); 1319 EXPECT_EQ(1, ret);
1320 } 1320 }
1321 1321
1322 free_aligned_buffer_page_end(dst_y_opt); 1322 free_aligned_buffer_page_end(dst_y_opt);
1323 free_aligned_buffer_page_end(dst_u_opt); 1323 free_aligned_buffer_page_end(dst_u_opt);
1324 free_aligned_buffer_page_end(dst_v_opt); 1324 free_aligned_buffer_page_end(dst_v_opt);
1325 free_aligned_buffer_page_end(orig_pixels); 1325 free_aligned_buffer_page_end(orig_pixels);
1326 } 1326 }
1327 1327
1328 TEST_F(libyuvTest, MJPGToARGB) { 1328 TEST_F(LibYUVConvertTest, MJPGToARGB) {
1329 const int kOff = 10; 1329 const int kOff = 10;
1330 const int kMinJpeg = 64; 1330 const int kMinJpeg = 64;
1331 const int kImageSize = benchmark_width_ * benchmark_height_ >= kMinJpeg ? 1331 const int kImageSize = benchmark_width_ * benchmark_height_ >= kMinJpeg ?
1332 benchmark_width_ * benchmark_height_ : kMinJpeg; 1332 benchmark_width_ * benchmark_height_ : kMinJpeg;
1333 const int kSize = kImageSize + kOff; 1333 const int kSize = kImageSize + kOff;
1334 align_buffer_page_end(orig_pixels, kSize); 1334 align_buffer_page_end(orig_pixels, kSize);
1335 align_buffer_page_end(dst_argb_opt, benchmark_width_ * benchmark_height_ * 4); 1335 align_buffer_page_end(dst_argb_opt, benchmark_width_ * benchmark_height_ * 4);
1336 1336
1337 // EOI, SOI to make MJPG appear valid. 1337 // EOI, SOI to make MJPG appear valid.
1338 memset(orig_pixels, 0, kSize); 1338 memset(orig_pixels, 0, kSize);
(...skipping 10 matching lines...) Expand all
1349 // Expect failure because image is not really valid. 1349 // Expect failure because image is not really valid.
1350 EXPECT_EQ(1, ret); 1350 EXPECT_EQ(1, ret);
1351 } 1351 }
1352 1352
1353 free_aligned_buffer_page_end(dst_argb_opt); 1353 free_aligned_buffer_page_end(dst_argb_opt);
1354 free_aligned_buffer_page_end(orig_pixels); 1354 free_aligned_buffer_page_end(orig_pixels);
1355 } 1355 }
1356 1356
1357 #endif // HAVE_JPEG 1357 #endif // HAVE_JPEG
1358 1358
1359 TEST_F(libyuvTest, CropNV12) { 1359 TEST_F(LibYUVConvertTest, CropNV12) {
1360 const int SUBSAMP_X = 2; 1360 const int SUBSAMP_X = 2;
1361 const int SUBSAMP_Y = 2; 1361 const int SUBSAMP_Y = 2;
1362 const int kWidth = benchmark_width_; 1362 const int kWidth = benchmark_width_;
1363 const int kHeight = benchmark_height_; 1363 const int kHeight = benchmark_height_;
1364 const int crop_y = 1364 const int crop_y =
1365 ((benchmark_height_ - (benchmark_height_ * 360 / 480)) / 2 + 1) & ~1; 1365 ((benchmark_height_ - (benchmark_height_ * 360 / 480)) / 2 + 1) & ~1;
1366 const int kDestWidth = benchmark_width_; 1366 const int kDestWidth = benchmark_width_;
1367 const int kDestHeight = benchmark_height_ - crop_y * 2; 1367 const int kDestHeight = benchmark_height_ - crop_y * 2;
1368 const int sample_size = kWidth * kHeight + 1368 const int sample_size = kWidth * kHeight +
1369 SUBSAMPLE(kWidth, SUBSAMP_X) * 1369 SUBSAMPLE(kWidth, SUBSAMP_X) *
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 } 1441 }
1442 free_aligned_buffer_64(dst_y); 1442 free_aligned_buffer_64(dst_y);
1443 free_aligned_buffer_64(dst_u); 1443 free_aligned_buffer_64(dst_u);
1444 free_aligned_buffer_64(dst_v); 1444 free_aligned_buffer_64(dst_v);
1445 free_aligned_buffer_64(dst_y_2); 1445 free_aligned_buffer_64(dst_y_2);
1446 free_aligned_buffer_64(dst_u_2); 1446 free_aligned_buffer_64(dst_u_2);
1447 free_aligned_buffer_64(dst_v_2); 1447 free_aligned_buffer_64(dst_v_2);
1448 free_aligned_buffer_64(src_y); 1448 free_aligned_buffer_64(src_y);
1449 } 1449 }
1450 1450
1451 TEST_F(libyuvTest, HaveJPEG) { 1451 TEST_F(LibYUVConvertTest, HaveJPEG) {
1452 #ifdef HAVE_JPEG 1452 #ifdef HAVE_JPEG
1453 printf("JPEG enabled\n."); 1453 printf("JPEG enabled\n.");
1454 #else 1454 #else
1455 printf("JPEG disabled\n."); 1455 printf("JPEG disabled\n.");
1456 #endif 1456 #endif
1457 } 1457 }
1458 1458
1459 TEST_F(libyuvTest, TestYToARGB) { 1459 TEST_F(LibYUVConvertTest, TestYToARGB) {
1460 uint8 y[32]; 1460 uint8 y[32];
1461 uint8 expectedg[32]; 1461 uint8 expectedg[32];
1462 for (int i = 0; i < 32; ++i) { 1462 for (int i = 0; i < 32; ++i) {
1463 y[i] = i * 5 + 17; 1463 y[i] = i * 5 + 17;
1464 expectedg[i] = static_cast<int>((y[i] - 16) * 1.164f + 0.5f); 1464 expectedg[i] = static_cast<int>((y[i] - 16) * 1.164f + 0.5f);
1465 } 1465 }
1466 uint8 argb[32 * 4]; 1466 uint8 argb[32 * 4];
1467 YToARGB(y, 0, argb, 0, 32, 1); 1467 YToARGB(y, 0, argb, 0, 32, 1);
1468 1468
1469 for (int i = 0; i < 32; ++i) { 1469 for (int i = 0; i < 32; ++i) {
1470 printf("%2d %d: %d <-> %d,%d,%d,%d\n", i, y[i], expectedg[i], 1470 printf("%2d %d: %d <-> %d,%d,%d,%d\n", i, y[i], expectedg[i],
1471 argb[i * 4 + 0], 1471 argb[i * 4 + 0],
1472 argb[i * 4 + 1], 1472 argb[i * 4 + 1],
1473 argb[i * 4 + 2], 1473 argb[i * 4 + 2],
1474 argb[i * 4 + 3]); 1474 argb[i * 4 + 3]);
1475 } 1475 }
1476 for (int i = 0; i < 32; ++i) { 1476 for (int i = 0; i < 32; ++i) {
1477 EXPECT_EQ(expectedg[i], argb[i * 4 + 0]); 1477 EXPECT_EQ(expectedg[i], argb[i * 4 + 0]);
1478 } 1478 }
1479 } 1479 }
1480 1480
1481 static const uint8 kNoDither4x4[16] = { 1481 static const uint8 kNoDither4x4[16] = {
1482 0, 0, 0, 0, 1482 0, 0, 0, 0,
1483 0, 0, 0, 0, 1483 0, 0, 0, 0,
1484 0, 0, 0, 0, 1484 0, 0, 0, 0,
1485 0, 0, 0, 0, 1485 0, 0, 0, 0,
1486 }; 1486 };
1487 1487
1488 TEST_F(libyuvTest, TestNoDither) { 1488 TEST_F(LibYUVConvertTest, TestNoDither) {
1489 align_buffer_64(src_argb, benchmark_width_ * benchmark_height_ * 4); 1489 align_buffer_64(src_argb, benchmark_width_ * benchmark_height_ * 4);
1490 align_buffer_64(dst_rgb565, benchmark_width_ * benchmark_height_ * 2); 1490 align_buffer_64(dst_rgb565, benchmark_width_ * benchmark_height_ * 2);
1491 align_buffer_64(dst_rgb565dither, benchmark_width_ * benchmark_height_ * 2); 1491 align_buffer_64(dst_rgb565dither, benchmark_width_ * benchmark_height_ * 2);
1492 MemRandomize(src_argb, benchmark_width_ * benchmark_height_ * 4); 1492 MemRandomize(src_argb, benchmark_width_ * benchmark_height_ * 4);
1493 MemRandomize(dst_rgb565, benchmark_width_ * benchmark_height_ * 2); 1493 MemRandomize(dst_rgb565, benchmark_width_ * benchmark_height_ * 2);
1494 MemRandomize(dst_rgb565dither, benchmark_width_ * benchmark_height_ * 2); 1494 MemRandomize(dst_rgb565dither, benchmark_width_ * benchmark_height_ * 2);
1495 ARGBToRGB565(src_argb, benchmark_width_ * 4, 1495 ARGBToRGB565(src_argb, benchmark_width_ * 4,
1496 dst_rgb565, benchmark_width_ * 2, 1496 dst_rgb565, benchmark_width_ * 2,
1497 benchmark_width_, benchmark_height_); 1497 benchmark_width_, benchmark_height_);
1498 ARGBToRGB565Dither(src_argb, benchmark_width_ * 4, 1498 ARGBToRGB565Dither(src_argb, benchmark_width_ * 4,
1499 dst_rgb565dither, benchmark_width_ * 2, 1499 dst_rgb565dither, benchmark_width_ * 2,
1500 kNoDither4x4, benchmark_width_, benchmark_height_); 1500 kNoDither4x4, benchmark_width_, benchmark_height_);
1501 for (int i = 0; i < benchmark_width_ * benchmark_height_ * 2; ++i) { 1501 for (int i = 0; i < benchmark_width_ * benchmark_height_ * 2; ++i) {
1502 EXPECT_EQ(dst_rgb565[i], dst_rgb565dither[i]); 1502 EXPECT_EQ(dst_rgb565[i], dst_rgb565dither[i]);
1503 } 1503 }
1504 1504
1505 free_aligned_buffer_64(src_argb); 1505 free_aligned_buffer_64(src_argb);
1506 free_aligned_buffer_64(dst_rgb565); 1506 free_aligned_buffer_64(dst_rgb565);
1507 free_aligned_buffer_64(dst_rgb565dither); 1507 free_aligned_buffer_64(dst_rgb565dither);
1508 } 1508 }
1509 1509
1510 // Ordered 4x4 dither for 888 to 565. Values from 0 to 7. 1510 // Ordered 4x4 dither for 888 to 565. Values from 0 to 7.
1511 static const uint8 kDither565_4x4[16] = { 1511 static const uint8 kDither565_4x4[16] = {
1512 0, 4, 1, 5, 1512 0, 4, 1, 5,
1513 6, 2, 7, 3, 1513 6, 2, 7, 3,
1514 1, 5, 0, 4, 1514 1, 5, 0, 4,
1515 7, 3, 6, 2, 1515 7, 3, 6, 2,
1516 }; 1516 };
1517 1517
1518 TEST_F(libyuvTest, TestDither) { 1518 TEST_F(LibYUVConvertTest, TestDither) {
1519 align_buffer_64(src_argb, benchmark_width_ * benchmark_height_ * 4); 1519 align_buffer_64(src_argb, benchmark_width_ * benchmark_height_ * 4);
1520 align_buffer_64(dst_rgb565, benchmark_width_ * benchmark_height_ * 2); 1520 align_buffer_64(dst_rgb565, benchmark_width_ * benchmark_height_ * 2);
1521 align_buffer_64(dst_rgb565dither, benchmark_width_ * benchmark_height_ * 2); 1521 align_buffer_64(dst_rgb565dither, benchmark_width_ * benchmark_height_ * 2);
1522 align_buffer_64(dst_argb, benchmark_width_ * benchmark_height_ * 4); 1522 align_buffer_64(dst_argb, benchmark_width_ * benchmark_height_ * 4);
1523 align_buffer_64(dst_argbdither, benchmark_width_ * benchmark_height_ * 4); 1523 align_buffer_64(dst_argbdither, benchmark_width_ * benchmark_height_ * 4);
1524 MemRandomize(src_argb, benchmark_width_ * benchmark_height_ * 4); 1524 MemRandomize(src_argb, benchmark_width_ * benchmark_height_ * 4);
1525 MemRandomize(dst_rgb565, benchmark_width_ * benchmark_height_ * 2); 1525 MemRandomize(dst_rgb565, benchmark_width_ * benchmark_height_ * 2);
1526 MemRandomize(dst_rgb565dither, benchmark_width_ * benchmark_height_ * 2); 1526 MemRandomize(dst_rgb565dither, benchmark_width_ * benchmark_height_ * 2);
1527 MemRandomize(dst_argb, benchmark_width_ * benchmark_height_ * 4); 1527 MemRandomize(dst_argb, benchmark_width_ * benchmark_height_ * 4);
1528 MemRandomize(dst_argbdither, benchmark_width_ * benchmark_height_ * 4); 1528 MemRandomize(dst_argbdither, benchmark_width_ * benchmark_height_ * 4);
(...skipping 15 matching lines...) Expand all
1544 } 1544 }
1545 free_aligned_buffer_64(src_argb); 1545 free_aligned_buffer_64(src_argb);
1546 free_aligned_buffer_64(dst_rgb565); 1546 free_aligned_buffer_64(dst_rgb565);
1547 free_aligned_buffer_64(dst_rgb565dither); 1547 free_aligned_buffer_64(dst_rgb565dither);
1548 free_aligned_buffer_64(dst_argb); 1548 free_aligned_buffer_64(dst_argb);
1549 free_aligned_buffer_64(dst_argbdither); 1549 free_aligned_buffer_64(dst_argbdither);
1550 } 1550 }
1551 1551
1552 #define TESTPLANARTOBID(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \ 1552 #define TESTPLANARTOBID(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \
1553 YALIGN, W1280, DIFF, N, NEG, OFF, FMT_C, BPP_C) \ 1553 YALIGN, W1280, DIFF, N, NEG, OFF, FMT_C, BPP_C) \
1554 TEST_F(libyuvTest, FMT_PLANAR##To##FMT_B##Dither##N) { \ 1554 TEST_F(LibYUVConvertTest, FMT_PLANAR##To##FMT_B##Dither##N) { \
1555 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 1555 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
1556 const int kHeight = ALIGNINT(benchmark_height_, YALIGN); \ 1556 const int kHeight = ALIGNINT(benchmark_height_, YALIGN); \
1557 const int kStrideB = ALIGNINT(kWidth * BPP_B, ALIGN); \ 1557 const int kStrideB = ALIGNINT(kWidth * BPP_B, ALIGN); \
1558 const int kSizeUV = \ 1558 const int kSizeUV = \
1559 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y); \ 1559 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y); \
1560 align_buffer_64(src_y, kWidth * kHeight + OFF); \ 1560 align_buffer_64(src_y, kWidth * kHeight + OFF); \
1561 align_buffer_64(src_u, kSizeUV + OFF); \ 1561 align_buffer_64(src_u, kSizeUV + OFF); \
1562 align_buffer_64(src_v, kSizeUV + OFF); \ 1562 align_buffer_64(src_v, kSizeUV + OFF); \
1563 align_buffer_64(dst_argb_c, kStrideB * kHeight + OFF); \ 1563 align_buffer_64(dst_argb_c, kStrideB * kHeight + OFF); \
1564 align_buffer_64(dst_argb_opt, kStrideB * kHeight + OFF); \ 1564 align_buffer_64(dst_argb_opt, kStrideB * kHeight + OFF); \
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 TESTPLANARTOBID(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \ 1622 TESTPLANARTOBID(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \
1623 YALIGN, benchmark_width_, DIFF, _Unaligned, +, 1, FMT_C, BPP_C) \ 1623 YALIGN, benchmark_width_, DIFF, _Unaligned, +, 1, FMT_C, BPP_C) \
1624 TESTPLANARTOBID(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \ 1624 TESTPLANARTOBID(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \
1625 YALIGN, benchmark_width_, DIFF, _Invert, -, 0, FMT_C, BPP_C) \ 1625 YALIGN, benchmark_width_, DIFF, _Invert, -, 0, FMT_C, BPP_C) \
1626 TESTPLANARTOBID(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \ 1626 TESTPLANARTOBID(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \
1627 YALIGN, benchmark_width_, DIFF, _Opt, +, 0, FMT_C, BPP_C) 1627 YALIGN, benchmark_width_, DIFF, _Opt, +, 0, FMT_C, BPP_C)
1628 1628
1629 TESTPLANARTOBD(I420, 2, 2, RGB565, 2, 2, 1, 9, ARGB, 4) 1629 TESTPLANARTOBD(I420, 2, 2, RGB565, 2, 2, 1, 9, ARGB, 4)
1630 1630
1631 #define TESTPTOB(NAME, UYVYTOI420, UYVYTONV12) \ 1631 #define TESTPTOB(NAME, UYVYTOI420, UYVYTONV12) \
1632 TEST_F(libyuvTest, NAME) { \ 1632 TEST_F(LibYUVConvertTest, NAME) { \
1633 const int kWidth = benchmark_width_; \ 1633 const int kWidth = benchmark_width_; \
1634 const int kHeight = benchmark_height_; \ 1634 const int kHeight = benchmark_height_; \
1635 \ 1635 \
1636 align_buffer_64(orig_uyvy, \ 1636 align_buffer_64(orig_uyvy, \
1637 4 * SUBSAMPLE(kWidth, 2) * kHeight); \ 1637 4 * SUBSAMPLE(kWidth, 2) * kHeight); \
1638 align_buffer_64(orig_y, kWidth * kHeight); \ 1638 align_buffer_64(orig_y, kWidth * kHeight); \
1639 align_buffer_64(orig_u, \ 1639 align_buffer_64(orig_u, \
1640 SUBSAMPLE(kWidth, 2) * \ 1640 SUBSAMPLE(kWidth, 2) * \
1641 SUBSAMPLE(kHeight, 2)); \ 1641 SUBSAMPLE(kHeight, 2)); \
1642 align_buffer_64(orig_v, \ 1642 align_buffer_64(orig_v, \
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 free_aligned_buffer_64(dst_y_orig); \ 1693 free_aligned_buffer_64(dst_y_orig); \
1694 free_aligned_buffer_64(dst_uv_orig); \ 1694 free_aligned_buffer_64(dst_uv_orig); \
1695 free_aligned_buffer_64(dst_y); \ 1695 free_aligned_buffer_64(dst_y); \
1696 free_aligned_buffer_64(dst_uv); \ 1696 free_aligned_buffer_64(dst_uv); \
1697 } 1697 }
1698 1698
1699 TESTPTOB(TestYUY2ToNV12, YUY2ToI420, YUY2ToNV12) 1699 TESTPTOB(TestYUY2ToNV12, YUY2ToI420, YUY2ToNV12)
1700 TESTPTOB(TestUYVYToNV12, UYVYToI420, UYVYToNV12) 1700 TESTPTOB(TestUYVYToNV12, UYVYToI420, UYVYToNV12)
1701 1701
1702 } // namespace libyuv 1702 } // namespace libyuv
OLDNEW
« no previous file with comments | « unit_test/compare_test.cc ('k') | unit_test/cpu_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698