| 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, | 456 int64_t time_stamp, |
| 457 const uint8_t* y, | 457 const uint8_t* y, |
| 458 uint32_t ypitch, | 458 uint32_t ypitch, |
| 459 const uint8_t* u, | 459 const uint8_t* u, |
| 460 uint32_t upitch, | 460 uint32_t upitch, |
| 461 const uint8_t* v, | 461 const uint8_t* v, |
| 462 uint32_t vpitch, | 462 uint32_t vpitch, |
| 463 int max_error) { | 463 int max_error) { |
| 464 return IsSize(frame, width, height) && | 464 return IsSize(frame, width, height) && frame.GetTimeStamp() == time_stamp && |
| 465 frame.timestamp_us() == timestamp_us && | |
| 466 IsPlaneEqual("y", frame.video_frame_buffer()->DataY(), | 465 IsPlaneEqual("y", frame.video_frame_buffer()->DataY(), |
| 467 frame.video_frame_buffer()->StrideY(), y, ypitch, | 466 frame.video_frame_buffer()->StrideY(), y, ypitch, |
| 468 static_cast<uint32_t>(width), | 467 static_cast<uint32_t>(width), |
| 469 static_cast<uint32_t>(height), max_error) && | 468 static_cast<uint32_t>(height), max_error) && |
| 470 IsPlaneEqual("u", frame.video_frame_buffer()->DataU(), | 469 IsPlaneEqual("u", frame.video_frame_buffer()->DataU(), |
| 471 frame.video_frame_buffer()->StrideU(), u, upitch, | 470 frame.video_frame_buffer()->StrideU(), u, upitch, |
| 472 static_cast<uint32_t>((width + 1) / 2), | 471 static_cast<uint32_t>((width + 1) / 2), |
| 473 static_cast<uint32_t>((height + 1) / 2), max_error) && | 472 static_cast<uint32_t>((height + 1) / 2), max_error) && |
| 474 IsPlaneEqual("v", frame.video_frame_buffer()->DataV(), | 473 IsPlaneEqual("v", frame.video_frame_buffer()->DataV(), |
| 475 frame.video_frame_buffer()->StrideV(), v, vpitch, | 474 frame.video_frame_buffer()->StrideV(), v, vpitch, |
| 476 static_cast<uint32_t>((width + 1) / 2), | 475 static_cast<uint32_t>((width + 1) / 2), |
| 477 static_cast<uint32_t>((height + 1) / 2), max_error); | 476 static_cast<uint32_t>((height + 1) / 2), max_error); |
| 478 } | 477 } |
| 479 | 478 |
| 480 static bool IsEqual(const cricket::VideoFrame& frame1, | 479 static bool IsEqual(const cricket::VideoFrame& frame1, |
| 481 const cricket::VideoFrame& frame2, | 480 const cricket::VideoFrame& frame2, |
| 482 int max_error) { | 481 int max_error) { |
| 483 return IsEqual(frame1, | 482 return IsEqual(frame1, |
| 484 frame2.width(), frame2.height(), | 483 frame2.width(), frame2.height(), |
| 485 frame2.timestamp_us(), | 484 frame2.GetTimeStamp(), |
| 486 frame2.video_frame_buffer()->DataY(), | 485 frame2.video_frame_buffer()->DataY(), |
| 487 frame2.video_frame_buffer()->StrideY(), | 486 frame2.video_frame_buffer()->StrideY(), |
| 488 frame2.video_frame_buffer()->DataU(), | 487 frame2.video_frame_buffer()->DataU(), |
| 489 frame2.video_frame_buffer()->StrideU(), | 488 frame2.video_frame_buffer()->StrideU(), |
| 490 frame2.video_frame_buffer()->DataV(), | 489 frame2.video_frame_buffer()->DataV(), |
| 491 frame2.video_frame_buffer()->StrideV(), | 490 frame2.video_frame_buffer()->StrideV(), |
| 492 max_error); | 491 max_error); |
| 493 } | 492 } |
| 494 | 493 |
| 495 static bool IsEqualWithCrop(const cricket::VideoFrame& frame1, | 494 static bool IsEqualWithCrop(const cricket::VideoFrame& frame1, |
| 496 const cricket::VideoFrame& frame2, | 495 const cricket::VideoFrame& frame2, |
| 497 int hcrop, int vcrop, int max_error) { | 496 int hcrop, int vcrop, int max_error) { |
| 498 return frame1.width() <= frame2.width() && | 497 return frame1.width() <= frame2.width() && |
| 499 frame1.height() <= frame2.height() && | 498 frame1.height() <= frame2.height() && |
| 500 IsEqual(frame1, | 499 IsEqual(frame1, |
| 501 frame2.width() - hcrop * 2, | 500 frame2.width() - hcrop * 2, |
| 502 frame2.height() - vcrop * 2, | 501 frame2.height() - vcrop * 2, |
| 503 frame2.timestamp_us(), | 502 frame2.GetTimeStamp(), |
| 504 frame2.video_frame_buffer()->DataY() | 503 frame2.video_frame_buffer()->DataY() |
| 505 + vcrop * frame2.video_frame_buffer()->StrideY() | 504 + vcrop * frame2.video_frame_buffer()->StrideY() |
| 506 + hcrop, | 505 + hcrop, |
| 507 frame2.video_frame_buffer()->StrideY(), | 506 frame2.video_frame_buffer()->StrideY(), |
| 508 frame2.video_frame_buffer()->DataU() | 507 frame2.video_frame_buffer()->DataU() |
| 509 + vcrop * frame2.video_frame_buffer()->StrideU() / 2 | 508 + vcrop * frame2.video_frame_buffer()->StrideU() / 2 |
| 510 + hcrop / 2, | 509 + hcrop / 2, |
| 511 frame2.video_frame_buffer()->StrideU(), | 510 frame2.video_frame_buffer()->StrideU(), |
| 512 frame2.video_frame_buffer()->DataV() | 511 frame2.video_frame_buffer()->DataV() |
| 513 + vcrop * frame2.video_frame_buffer()->StrideV() / 2 | 512 + vcrop * frame2.video_frame_buffer()->StrideV() / 2 |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 EXPECT_TRUE(frame2.Init(cricket::FOURCC_I422, kWidth, kHeight, kWidth, | 1355 EXPECT_TRUE(frame2.Init(cricket::FOURCC_I422, kWidth, kHeight, kWidth, |
| 1357 kHeight, y, out_size, 1, 1, 0, | 1356 kHeight, y, out_size, 1, 1, 0, |
| 1358 webrtc::kVideoRotation_0)); | 1357 webrtc::kVideoRotation_0)); |
| 1359 EXPECT_TRUE(IsEqual(frame1, frame2, 1)); | 1358 EXPECT_TRUE(IsEqual(frame1, frame2, 1)); |
| 1360 } | 1359 } |
| 1361 | 1360 |
| 1362 int repeat_; | 1361 int repeat_; |
| 1363 }; | 1362 }; |
| 1364 | 1363 |
| 1365 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_UNITTEST_H_ | 1364 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_UNITTEST_H_ |
| OLD | NEW |