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