| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 The WebRTC 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 } | 446 } |
| 447 r1 += pitch1; | 447 r1 += pitch1; |
| 448 r2 += pitch2; | 448 r2 += pitch2; |
| 449 } | 449 } |
| 450 return true; | 450 return true; |
| 451 } | 451 } |
| 452 | 452 |
| 453 static bool IsEqual(const cricket::VideoFrame& frame, | 453 static bool IsEqual(const cricket::VideoFrame& frame, |
| 454 int width, | 454 int width, |
| 455 int height, | 455 int height, |
| 456 int64_t timestamp_us, | |
| 457 const uint8_t* y, | 456 const uint8_t* y, |
| 458 uint32_t ypitch, | 457 uint32_t ypitch, |
| 459 const uint8_t* u, | 458 const uint8_t* u, |
| 460 uint32_t upitch, | 459 uint32_t upitch, |
| 461 const uint8_t* v, | 460 const uint8_t* v, |
| 462 uint32_t vpitch, | 461 uint32_t vpitch, |
| 463 int max_error) { | 462 int max_error) { |
| 464 return IsSize(frame, width, height) && | 463 return IsSize(frame, width, height) && |
| 465 frame.timestamp_us() == timestamp_us && | |
| 466 IsPlaneEqual("y", frame.video_frame_buffer()->DataY(), | 464 IsPlaneEqual("y", frame.video_frame_buffer()->DataY(), |
| 467 frame.video_frame_buffer()->StrideY(), y, ypitch, | 465 frame.video_frame_buffer()->StrideY(), y, ypitch, |
| 468 static_cast<uint32_t>(width), | 466 static_cast<uint32_t>(width), |
| 469 static_cast<uint32_t>(height), max_error) && | 467 static_cast<uint32_t>(height), max_error) && |
| 470 IsPlaneEqual("u", frame.video_frame_buffer()->DataU(), | 468 IsPlaneEqual("u", frame.video_frame_buffer()->DataU(), |
| 471 frame.video_frame_buffer()->StrideU(), u, upitch, | 469 frame.video_frame_buffer()->StrideU(), u, upitch, |
| 472 static_cast<uint32_t>((width + 1) / 2), | 470 static_cast<uint32_t>((width + 1) / 2), |
| 473 static_cast<uint32_t>((height + 1) / 2), max_error) && | 471 static_cast<uint32_t>((height + 1) / 2), max_error) && |
| 474 IsPlaneEqual("v", frame.video_frame_buffer()->DataV(), | 472 IsPlaneEqual("v", frame.video_frame_buffer()->DataV(), |
| 475 frame.video_frame_buffer()->StrideV(), v, vpitch, | 473 frame.video_frame_buffer()->StrideV(), v, vpitch, |
| 476 static_cast<uint32_t>((width + 1) / 2), | 474 static_cast<uint32_t>((width + 1) / 2), |
| 477 static_cast<uint32_t>((height + 1) / 2), max_error); | 475 static_cast<uint32_t>((height + 1) / 2), max_error); |
| 478 } | 476 } |
| 479 | 477 |
| 480 static bool IsEqual(const cricket::VideoFrame& frame1, | 478 static bool IsEqual(const cricket::VideoFrame& frame1, |
| 481 const cricket::VideoFrame& frame2, | 479 const cricket::VideoFrame& frame2, |
| 482 int max_error) { | 480 int max_error) { |
| 483 return IsEqual(frame1, | 481 return frame1.timestamp_us() == frame2.timestamp_us() && |
| 482 IsEqual(frame1, |
| 484 frame2.width(), frame2.height(), | 483 frame2.width(), frame2.height(), |
| 485 frame2.timestamp_us(), | |
| 486 frame2.video_frame_buffer()->DataY(), | 484 frame2.video_frame_buffer()->DataY(), |
| 487 frame2.video_frame_buffer()->StrideY(), | 485 frame2.video_frame_buffer()->StrideY(), |
| 488 frame2.video_frame_buffer()->DataU(), | 486 frame2.video_frame_buffer()->DataU(), |
| 489 frame2.video_frame_buffer()->StrideU(), | 487 frame2.video_frame_buffer()->StrideU(), |
| 490 frame2.video_frame_buffer()->DataV(), | 488 frame2.video_frame_buffer()->DataV(), |
| 491 frame2.video_frame_buffer()->StrideV(), | 489 frame2.video_frame_buffer()->StrideV(), max_error); |
| 490 } |
| 491 |
| 492 static bool IsEqual( |
| 493 const cricket::VideoFrame& frame1, |
| 494 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& buffer, |
| 495 int max_error) { |
| 496 return IsEqual(frame1, buffer->width(), buffer->height(), |
| 497 buffer->DataY(), buffer->StrideY(), |
| 498 buffer->DataU(), buffer->StrideU(), |
| 499 buffer->DataV(), buffer->StrideV(), |
| 492 max_error); | 500 max_error); |
| 493 } | 501 } |
| 494 | 502 |
| 495 static bool IsEqualWithCrop(const cricket::VideoFrame& frame1, | 503 static bool IsEqualWithCrop(const cricket::VideoFrame& frame1, |
| 496 const cricket::VideoFrame& frame2, | 504 const cricket::VideoFrame& frame2, |
| 497 int hcrop, int vcrop, int max_error) { | 505 int hcrop, int vcrop, int max_error) { |
| 498 return frame1.width() <= frame2.width() && | 506 return frame1.width() <= frame2.width() && |
| 499 frame1.height() <= frame2.height() && | 507 frame1.height() <= frame2.height() && |
| 508 frame1.timestamp_us() == frame2.timestamp_us() && |
| 500 IsEqual(frame1, | 509 IsEqual(frame1, |
| 501 frame2.width() - hcrop * 2, | 510 frame2.width() - hcrop * 2, |
| 502 frame2.height() - vcrop * 2, | 511 frame2.height() - vcrop * 2, |
| 503 frame2.timestamp_us(), | |
| 504 frame2.video_frame_buffer()->DataY() | 512 frame2.video_frame_buffer()->DataY() |
| 505 + vcrop * frame2.video_frame_buffer()->StrideY() | 513 + vcrop * frame2.video_frame_buffer()->StrideY() |
| 506 + hcrop, | 514 + hcrop, |
| 507 frame2.video_frame_buffer()->StrideY(), | 515 frame2.video_frame_buffer()->StrideY(), |
| 508 frame2.video_frame_buffer()->DataU() | 516 frame2.video_frame_buffer()->DataU() |
| 509 + vcrop * frame2.video_frame_buffer()->StrideU() / 2 | 517 + vcrop * frame2.video_frame_buffer()->StrideU() / 2 |
| 510 + hcrop / 2, | 518 + hcrop / 2, |
| 511 frame2.video_frame_buffer()->StrideU(), | 519 frame2.video_frame_buffer()->StrideU(), |
| 512 frame2.video_frame_buffer()->DataV() | 520 frame2.video_frame_buffer()->DataV() |
| 513 + vcrop * frame2.video_frame_buffer()->StrideV() / 2 | 521 + vcrop * frame2.video_frame_buffer()->StrideV() / 2 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 532 T frame; | 540 T frame; |
| 533 EXPECT_TRUE(IsNull(frame)); | 541 EXPECT_TRUE(IsNull(frame)); |
| 534 std::unique_ptr<rtc::MemoryStream> ms( | 542 std::unique_ptr<rtc::MemoryStream> ms( |
| 535 CreateYuvSample(kWidth, kHeight, 12)); | 543 CreateYuvSample(kWidth, kHeight, 12)); |
| 536 EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_I420, | 544 EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_I420, |
| 537 kWidth, kHeight, &frame)); | 545 kWidth, kHeight, &frame)); |
| 538 | 546 |
| 539 const uint8_t* y = reinterpret_cast<uint8_t*>(ms.get()->GetBuffer()); | 547 const uint8_t* y = reinterpret_cast<uint8_t*>(ms.get()->GetBuffer()); |
| 540 const uint8_t* u = y + kWidth * kHeight; | 548 const uint8_t* u = y + kWidth * kHeight; |
| 541 const uint8_t* v = u + kWidth * kHeight / 4; | 549 const uint8_t* v = u + kWidth * kHeight / 4; |
| 542 EXPECT_TRUE(IsEqual(frame, kWidth, kHeight, 0, y, kWidth, u, | 550 EXPECT_TRUE(IsEqual(frame, kWidth, kHeight, y, kWidth, u, kWidth / 2, v, |
| 543 kWidth / 2, v, kWidth / 2, 0)); | 551 kWidth / 2, 0)); |
| 544 } | 552 } |
| 545 | 553 |
| 546 // Test constructing an image from a YV12 buffer. | 554 // Test constructing an image from a YV12 buffer. |
| 547 void ConstructYV12() { | 555 void ConstructYV12() { |
| 548 T frame; | 556 T frame; |
| 549 std::unique_ptr<rtc::MemoryStream> ms( | 557 std::unique_ptr<rtc::MemoryStream> ms( |
| 550 CreateYuvSample(kWidth, kHeight, 12)); | 558 CreateYuvSample(kWidth, kHeight, 12)); |
| 551 EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YV12, | 559 EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_YV12, |
| 552 kWidth, kHeight, &frame)); | 560 kWidth, kHeight, &frame)); |
| 553 | 561 |
| 554 const uint8_t* y = reinterpret_cast<uint8_t*>(ms.get()->GetBuffer()); | 562 const uint8_t* y = reinterpret_cast<uint8_t*>(ms.get()->GetBuffer()); |
| 555 const uint8_t* v = y + kWidth * kHeight; | 563 const uint8_t* v = y + kWidth * kHeight; |
| 556 const uint8_t* u = v + kWidth * kHeight / 4; | 564 const uint8_t* u = v + kWidth * kHeight / 4; |
| 557 EXPECT_TRUE(IsEqual(frame, kWidth, kHeight, 0, y, kWidth, u, | 565 EXPECT_TRUE(IsEqual(frame, kWidth, kHeight, y, kWidth, u, kWidth / 2, v, |
| 558 kWidth / 2, v, kWidth / 2, 0)); | 566 kWidth / 2, 0)); |
| 559 } | 567 } |
| 560 | 568 |
| 561 // Test constructing an image from a I422 buffer. | 569 // Test constructing an image from a I422 buffer. |
| 562 void ConstructI422() { | 570 void ConstructI422() { |
| 563 T frame1, frame2; | 571 T frame1, frame2; |
| 564 ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); | 572 ASSERT_TRUE(LoadFrameNoRepeat(&frame1)); |
| 565 size_t buf_size = kWidth * kHeight * 2; | 573 size_t buf_size = kWidth * kHeight * 2; |
| 566 std::unique_ptr<uint8_t[]> buf(new uint8_t[buf_size + kAlignment]); | 574 std::unique_ptr<uint8_t[]> buf(new uint8_t[buf_size + kAlignment]); |
| 567 uint8_t* y = ALIGNP(buf.get(), kAlignment); | 575 uint8_t* y = ALIGNP(buf.get(), kAlignment); |
| 568 uint8_t* u = y + kWidth * kHeight; | 576 uint8_t* u = y + kWidth * kHeight; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 ASSERT_TRUE(frame1); | 773 ASSERT_TRUE(frame1); |
| 766 T frame2; | 774 T frame2; |
| 767 EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_RAW, | 775 EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_RAW, |
| 768 kWidth, kHeight, &frame2)); | 776 kWidth, kHeight, &frame2)); |
| 769 EXPECT_TRUE(IsEqual(*frame1, frame2, 2)); | 777 EXPECT_TRUE(IsEqual(*frame1, frame2, 2)); |
| 770 } | 778 } |
| 771 | 779 |
| 772 // Macro to help test different rotations | 780 // Macro to help test different rotations |
| 773 #define TEST_MIRROR(FOURCC, BPP) \ | 781 #define TEST_MIRROR(FOURCC, BPP) \ |
| 774 void Construct##FOURCC##Mirror() { \ | 782 void Construct##FOURCC##Mirror() { \ |
| 775 T frame1, frame2, frame3; \ | 783 T frame1, frame2; \ |
| 784 rtc::scoped_refptr<webrtc::I420Buffer> res_buffer; \ |
| 776 std::unique_ptr<rtc::MemoryStream> ms( \ | 785 std::unique_ptr<rtc::MemoryStream> ms( \ |
| 777 CreateYuvSample(kWidth, kHeight, BPP)); \ | 786 CreateYuvSample(kWidth, kHeight, BPP)); \ |
| 778 ASSERT_TRUE(ms.get() != NULL); \ | 787 ASSERT_TRUE(ms.get() != NULL); \ |
| 779 EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_##FOURCC, kWidth, \ | 788 EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_##FOURCC, kWidth, \ |
| 780 -kHeight, kWidth, kHeight, \ | 789 -kHeight, kWidth, kHeight, \ |
| 781 webrtc::kVideoRotation_180, &frame1)); \ | 790 webrtc::kVideoRotation_180, &frame1)); \ |
| 782 size_t data_size; \ | 791 size_t data_size; \ |
| 783 bool ret = ms->GetSize(&data_size); \ | 792 bool ret = ms->GetSize(&data_size); \ |
| 784 EXPECT_TRUE(ret); \ | 793 EXPECT_TRUE(ret); \ |
| 785 EXPECT_TRUE(frame2.Init(cricket::FOURCC_##FOURCC, kWidth, kHeight, kWidth, \ | 794 EXPECT_TRUE(frame2.Init(cricket::FOURCC_##FOURCC, kWidth, kHeight, kWidth, \ |
| 786 kHeight, \ | 795 kHeight, \ |
| 787 reinterpret_cast<uint8_t*>(ms->GetBuffer()), \ | 796 reinterpret_cast<uint8_t*>(ms->GetBuffer()), \ |
| 788 data_size, 0, webrtc::kVideoRotation_0)); \ | 797 data_size, 0, webrtc::kVideoRotation_0)); \ |
| 789 int width_rotate = frame1.width(); \ | 798 int width_rotate = frame1.width(); \ |
| 790 int height_rotate = frame1.height(); \ | 799 int height_rotate = frame1.height(); \ |
| 791 frame3.InitToEmptyBuffer(width_rotate, height_rotate); \ | 800 res_buffer = webrtc::I420Buffer::Create(width_rotate, height_rotate); \ |
| 792 libyuv::I420Mirror(frame2.video_frame_buffer()->DataY(), \ | 801 libyuv::I420Mirror(frame2.video_frame_buffer()->DataY(), \ |
| 793 frame2.video_frame_buffer()->StrideY(), \ | 802 frame2.video_frame_buffer()->StrideY(), \ |
| 794 frame2.video_frame_buffer()->DataU(), \ | 803 frame2.video_frame_buffer()->DataU(), \ |
| 795 frame2.video_frame_buffer()->StrideU(), \ | 804 frame2.video_frame_buffer()->StrideU(), \ |
| 796 frame2.video_frame_buffer()->DataV(), \ | 805 frame2.video_frame_buffer()->DataV(), \ |
| 797 frame2.video_frame_buffer()->StrideV(), \ | 806 frame2.video_frame_buffer()->StrideV(), \ |
| 798 frame3.video_frame_buffer()->MutableDataY(), \ | 807 res_buffer->MutableDataY(), res_buffer->StrideY(), \ |
| 799 frame3.video_frame_buffer()->StrideY(), \ | 808 res_buffer->MutableDataU(), res_buffer->StrideU(), \ |
| 800 frame3.video_frame_buffer()->MutableDataU(), \ | 809 res_buffer->MutableDataV(), res_buffer->StrideV(), \ |
| 801 frame3.video_frame_buffer()->StrideU(), \ | 810 kWidth, kHeight); \ |
| 802 frame3.video_frame_buffer()->MutableDataV(), \ | 811 EXPECT_TRUE(IsEqual(frame1, res_buffer, 0)); \ |
| 803 frame3.video_frame_buffer()->StrideV(), kWidth, \ | |
| 804 kHeight); \ | |
| 805 EXPECT_TRUE(IsEqual(frame1, frame3, 0)); \ | |
| 806 } | 812 } |
| 807 | 813 |
| 808 TEST_MIRROR(I420, 420) | 814 TEST_MIRROR(I420, 420) |
| 809 | 815 |
| 810 // Macro to help test different rotations | 816 // Macro to help test different rotations |
| 811 #define TEST_ROTATE(FOURCC, BPP, ROTATE) \ | 817 #define TEST_ROTATE(FOURCC, BPP, ROTATE) \ |
| 812 void Construct##FOURCC##Rotate##ROTATE() { \ | 818 void Construct##FOURCC##Rotate##ROTATE() { \ |
| 813 T frame1, frame2, frame3; \ | 819 T frame1, frame2; \ |
| 820 rtc::scoped_refptr<webrtc::I420Buffer> res_buffer; \ |
| 814 std::unique_ptr<rtc::MemoryStream> ms( \ | 821 std::unique_ptr<rtc::MemoryStream> ms( \ |
| 815 CreateYuvSample(kWidth, kHeight, BPP)); \ | 822 CreateYuvSample(kWidth, kHeight, BPP)); \ |
| 816 ASSERT_TRUE(ms.get() != NULL); \ | 823 ASSERT_TRUE(ms.get() != NULL); \ |
| 817 EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_##FOURCC, kWidth, kHeight, \ | 824 EXPECT_TRUE(LoadFrame(ms.get(), cricket::FOURCC_##FOURCC, kWidth, kHeight, \ |
| 818 kWidth, kHeight, webrtc::kVideoRotation_##ROTATE, \ | 825 kWidth, kHeight, webrtc::kVideoRotation_##ROTATE, \ |
| 819 &frame1)); \ | 826 &frame1)); \ |
| 820 size_t data_size; \ | 827 size_t data_size; \ |
| 821 bool ret = ms->GetSize(&data_size); \ | 828 bool ret = ms->GetSize(&data_size); \ |
| 822 EXPECT_TRUE(ret); \ | 829 EXPECT_TRUE(ret); \ |
| 823 EXPECT_TRUE(frame2.Init(cricket::FOURCC_##FOURCC, kWidth, kHeight, kWidth, \ | 830 EXPECT_TRUE(frame2.Init(cricket::FOURCC_##FOURCC, kWidth, kHeight, kWidth, \ |
| 824 kHeight, \ | 831 kHeight, \ |
| 825 reinterpret_cast<uint8_t*>(ms->GetBuffer()), \ | 832 reinterpret_cast<uint8_t*>(ms->GetBuffer()), \ |
| 826 data_size, 0, webrtc::kVideoRotation_0)); \ | 833 data_size, 0, webrtc::kVideoRotation_0)); \ |
| 827 int width_rotate = frame1.width(); \ | 834 int width_rotate = frame1.width(); \ |
| 828 int height_rotate = frame1.height(); \ | 835 int height_rotate = frame1.height(); \ |
| 829 frame3.InitToEmptyBuffer(width_rotate, height_rotate); \ | 836 res_buffer = webrtc::I420Buffer::Create(width_rotate, height_rotate); \ |
| 830 libyuv::I420Rotate(frame2.video_frame_buffer()->DataY(), \ | 837 libyuv::I420Rotate(frame2.video_frame_buffer()->DataY(), \ |
| 831 frame2.video_frame_buffer()->StrideY(), \ | 838 frame2.video_frame_buffer()->StrideY(), \ |
| 832 frame2.video_frame_buffer()->DataU(), \ | 839 frame2.video_frame_buffer()->DataU(), \ |
| 833 frame2.video_frame_buffer()->StrideU(), \ | 840 frame2.video_frame_buffer()->StrideU(), \ |
| 834 frame2.video_frame_buffer()->DataV(), \ | 841 frame2.video_frame_buffer()->DataV(), \ |
| 835 frame2.video_frame_buffer()->StrideV(), \ | 842 frame2.video_frame_buffer()->StrideV(), \ |
| 836 frame3.video_frame_buffer()->MutableDataY(), \ | 843 res_buffer->MutableDataY(), res_buffer->StrideY(), \ |
| 837 frame3.video_frame_buffer()->StrideY(), \ | 844 res_buffer->MutableDataU(), res_buffer->StrideU(), \ |
| 838 frame3.video_frame_buffer()->MutableDataU(), \ | 845 res_buffer->MutableDataV(), res_buffer->StrideV(), \ |
| 839 frame3.video_frame_buffer()->StrideU(), \ | 846 kWidth, kHeight, libyuv::kRotate##ROTATE); \ |
| 840 frame3.video_frame_buffer()->MutableDataV(), \ | 847 EXPECT_TRUE(IsEqual(frame1, res_buffer, 0)); \ |
| 841 frame3.video_frame_buffer()->StrideV(), kWidth, \ | |
| 842 kHeight, libyuv::kRotate##ROTATE); \ | |
| 843 EXPECT_TRUE(IsEqual(frame1, frame3, 0)); \ | |
| 844 } | 848 } |
| 845 | 849 |
| 846 // Test constructing an image with rotation. | 850 // Test constructing an image with rotation. |
| 847 TEST_ROTATE(I420, 12, 0) | 851 TEST_ROTATE(I420, 12, 0) |
| 848 TEST_ROTATE(I420, 12, 90) | 852 TEST_ROTATE(I420, 12, 90) |
| 849 TEST_ROTATE(I420, 12, 180) | 853 TEST_ROTATE(I420, 12, 180) |
| 850 TEST_ROTATE(I420, 12, 270) | 854 TEST_ROTATE(I420, 12, 270) |
| 851 TEST_ROTATE(YV12, 12, 0) | 855 TEST_ROTATE(YV12, 12, 0) |
| 852 TEST_ROTATE(YV12, 12, 90) | 856 TEST_ROTATE(YV12, 12, 90) |
| 853 TEST_ROTATE(YV12, 12, 180) | 857 TEST_ROTATE(YV12, 12, 180) |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 void ConstructI4201Pixel() { | 941 void ConstructI4201Pixel() { |
| 938 T frame; | 942 T frame; |
| 939 uint8_t pixel[3] = {1, 2, 3}; | 943 uint8_t pixel[3] = {1, 2, 3}; |
| 940 for (int i = 0; i < repeat_; ++i) { | 944 for (int i = 0; i < repeat_; ++i) { |
| 941 EXPECT_TRUE(frame.Init(cricket::FOURCC_I420, 1, 1, 1, 1, pixel, | 945 EXPECT_TRUE(frame.Init(cricket::FOURCC_I420, 1, 1, 1, 1, pixel, |
| 942 sizeof(pixel), 0, webrtc::kVideoRotation_0)); | 946 sizeof(pixel), 0, webrtc::kVideoRotation_0)); |
| 943 } | 947 } |
| 944 const uint8_t* y = pixel; | 948 const uint8_t* y = pixel; |
| 945 const uint8_t* u = y + 1; | 949 const uint8_t* u = y + 1; |
| 946 const uint8_t* v = u + 1; | 950 const uint8_t* v = u + 1; |
| 947 EXPECT_TRUE(IsEqual(frame, 1, 1, 0, y, 1, u, 1, v, 1, 0)); | 951 EXPECT_TRUE(IsEqual(frame, 1, 1, y, 1, u, 1, v, 1, 0)); |
| 948 } | 952 } |
| 949 | 953 |
| 950 // Test 5 pixel edge case image. | 954 // Test 5 pixel edge case image. |
| 951 void ConstructI4205Pixel() { | 955 void ConstructI4205Pixel() { |
| 952 T frame; | 956 T frame; |
| 953 uint8_t pixels5x5[5 * 5 + ((5 + 1) / 2 * (5 + 1) / 2) * 2]; | 957 uint8_t pixels5x5[5 * 5 + ((5 + 1) / 2 * (5 + 1) / 2) * 2]; |
| 954 memset(pixels5x5, 1, 5 * 5 + ((5 + 1) / 2 * (5 + 1) / 2) * 2); | 958 memset(pixels5x5, 1, 5 * 5 + ((5 + 1) / 2 * (5 + 1) / 2) * 2); |
| 955 for (int i = 0; i < repeat_; ++i) { | 959 for (int i = 0; i < repeat_; ++i) { |
| 956 EXPECT_TRUE(frame.Init(cricket::FOURCC_I420, 5, 5, 5, 5, pixels5x5, | 960 EXPECT_TRUE(frame.Init(cricket::FOURCC_I420, 5, 5, 5, 5, pixels5x5, |
| 957 sizeof(pixels5x5), 0, | 961 sizeof(pixels5x5), 0, |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 EXPECT_TRUE(frame2.Init(cricket::FOURCC_I422, kWidth, kHeight, kWidth, | 1360 EXPECT_TRUE(frame2.Init(cricket::FOURCC_I422, kWidth, kHeight, kWidth, |
| 1357 kHeight, y, out_size, 1, 1, 0, | 1361 kHeight, y, out_size, 1, 1, 0, |
| 1358 webrtc::kVideoRotation_0)); | 1362 webrtc::kVideoRotation_0)); |
| 1359 EXPECT_TRUE(IsEqual(frame1, frame2, 1)); | 1363 EXPECT_TRUE(IsEqual(frame1, frame2, 1)); |
| 1360 } | 1364 } |
| 1361 | 1365 |
| 1362 int repeat_; | 1366 int repeat_; |
| 1363 }; | 1367 }; |
| 1364 | 1368 |
| 1365 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_UNITTEST_H_ | 1369 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_UNITTEST_H_ |
| OLD | NEW |