| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #include "webrtc/test/frame_utils.h" | |
| 12 #include "webrtc/video_frame.h" | |
| 13 | |
| 14 namespace webrtc { | |
| 15 namespace test { | |
| 16 | |
| 17 bool EqualPlane(const uint8_t* data1, | |
| 18 const uint8_t* data2, | |
| 19 int stride, | |
| 20 int width, | |
| 21 int height) { | |
| 22 for (int y = 0; y < height; ++y) { | |
| 23 if (memcmp(data1, data2, width) != 0) | |
| 24 return false; | |
| 25 data1 += stride; | |
| 26 data2 += stride; | |
| 27 } | |
| 28 return true; | |
| 29 } | |
| 30 bool FramesEqual(const webrtc::VideoFrame& f1, const webrtc::VideoFrame& f2) { | |
| 31 if (f1.width() != f2.width() || f1.height() != f2.height() || | |
| 32 f1.stride(webrtc::kYPlane) != f2.stride(webrtc::kYPlane) || | |
| 33 f1.stride(webrtc::kUPlane) != f2.stride(webrtc::kUPlane) || | |
| 34 f1.stride(webrtc::kVPlane) != f2.stride(webrtc::kVPlane) || | |
| 35 f1.timestamp() != f2.timestamp() || | |
| 36 f1.ntp_time_ms() != f2.ntp_time_ms() || | |
| 37 f1.render_time_ms() != f2.render_time_ms()) { | |
| 38 return false; | |
| 39 } | |
| 40 const int half_width = (f1.width() + 1) / 2; | |
| 41 const int half_height = (f1.height() + 1) / 2; | |
| 42 return EqualPlane(f1.buffer(webrtc::kYPlane), f2.buffer(webrtc::kYPlane), | |
| 43 f1.stride(webrtc::kYPlane), f1.width(), f1.height()) && | |
| 44 EqualPlane(f1.buffer(webrtc::kUPlane), f2.buffer(webrtc::kUPlane), | |
| 45 f1.stride(webrtc::kUPlane), half_width, half_height) && | |
| 46 EqualPlane(f1.buffer(webrtc::kVPlane), f2.buffer(webrtc::kVPlane), | |
| 47 f1.stride(webrtc::kVPlane), half_width, half_height); | |
| 48 } | |
| 49 | |
| 50 } // namespace test | |
| 51 } // namespace webrtc | |
| OLD | NEW |