OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 size_uv_(half_width_ * ((height_ + 1) / 2)), | 64 size_uv_(half_width_ * ((height_ + 1) / 2)), |
65 frame_length_(CalcBufferSize(kI420, width_, height_)) {} | 65 frame_length_(CalcBufferSize(kI420, width_, height_)) {} |
66 | 66 |
67 void VideoProcessingTest::SetUp() { | 67 void VideoProcessingTest::SetUp() { |
68 vp_ = VideoProcessing::Create(); | 68 vp_ = VideoProcessing::Create(); |
69 ASSERT_TRUE(vp_ != NULL); | 69 ASSERT_TRUE(vp_ != NULL); |
70 | 70 |
71 video_frame_.CreateEmptyFrame(width_, height_, width_, | 71 video_frame_.CreateEmptyFrame(width_, height_, width_, |
72 half_width_, half_width_); | 72 half_width_, half_width_); |
73 // Clear video frame so DrMemory/Valgrind will allow reads of the buffer. | 73 // Clear video frame so DrMemory/Valgrind will allow reads of the buffer. |
74 memset(video_frame_.video_frame_buffer()->MutableDataY(), 0, | 74 memset(video_frame_.buffer(kYPlane), 0, video_frame_.allocated_size(kYPlane)); |
75 video_frame_.allocated_size(kYPlane)); | 75 memset(video_frame_.buffer(kUPlane), 0, video_frame_.allocated_size(kUPlane)); |
76 memset(video_frame_.video_frame_buffer()->MutableDataU(), 0, | 76 memset(video_frame_.buffer(kVPlane), 0, video_frame_.allocated_size(kVPlane)); |
77 video_frame_.allocated_size(kUPlane)); | |
78 memset(video_frame_.video_frame_buffer()->MutableDataV(), 0, | |
79 video_frame_.allocated_size(kVPlane)); | |
80 const std::string video_file = | 77 const std::string video_file = |
81 webrtc::test::ResourcePath("foreman_cif", "yuv"); | 78 webrtc::test::ResourcePath("foreman_cif", "yuv"); |
82 source_file_ = fopen(video_file.c_str(), "rb"); | 79 source_file_ = fopen(video_file.c_str(), "rb"); |
83 ASSERT_TRUE(source_file_ != NULL) | 80 ASSERT_TRUE(source_file_ != NULL) |
84 << "Cannot read source file: " + video_file + "\n"; | 81 << "Cannot read source file: " + video_file + "\n"; |
85 } | 82 } |
86 | 83 |
87 void VideoProcessingTest::TearDown() { | 84 void VideoProcessingTest::TearDown() { |
88 if (source_file_ != NULL) { | 85 if (source_file_ != NULL) { |
89 ASSERT_EQ(0, fclose(source_file_)); | 86 ASSERT_EQ(0, fclose(source_file_)); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 std::cout << "Watch " << filename.str() << " and verify that it is okay." | 287 std::cout << "Watch " << filename.str() << " and verify that it is okay." |
291 << std::endl; | 288 << std::endl; |
292 FILE* stand_alone_file = fopen(filename.str().c_str(), "wb"); | 289 FILE* stand_alone_file = fopen(filename.str().c_str(), "wb"); |
293 if (PrintVideoFrame(processed, stand_alone_file) < 0) | 290 if (PrintVideoFrame(processed, stand_alone_file) < 0) |
294 std::cerr << "Failed to write: " << filename.str() << std::endl; | 291 std::cerr << "Failed to write: " << filename.str() << std::endl; |
295 if (stand_alone_file) | 292 if (stand_alone_file) |
296 fclose(stand_alone_file); | 293 fclose(stand_alone_file); |
297 } | 294 } |
298 | 295 |
299 } // namespace webrtc | 296 } // namespace webrtc |
OLD | NEW |