Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Side by Side Diff: webrtc/modules/video_processing/test/video_processing_unittest.cc

Issue 1900673002: Delete webrtc::VideoFrame methods buffer and stride. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include "webrtc/modules/video_processing/test/video_processing_unittest.h" 11 #include "webrtc/modules/video_processing/test/video_processing_unittest.h"
12 12
13 #include <gflags/gflags.h> 13 #include <gflags/gflags.h>
14 14
15 #include <memory> 15 #include <memory>
16 #include <string> 16 #include <string>
17 17
18 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 18 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
19 #include "webrtc/system_wrappers/include/tick_util.h" 19 #include "webrtc/system_wrappers/include/tick_util.h"
20 #include "webrtc/test/frame_utils.h"
20 #include "webrtc/test/testsupport/fileutils.h" 21 #include "webrtc/test/testsupport/fileutils.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 namespace { 25 namespace {
25 26
26 // Define command line flag 'gen_files' (default value: false). 27 // Define command line flag 'gen_files' (default value: false).
27 DEFINE_bool(gen_files, false, "Output files for visual inspection."); 28 DEFINE_bool(gen_files, false, "Output files for visual inspection.");
28 29
29 } // namespace 30 } // namespace
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 size_uv_(half_width_ * ((height_ + 1) / 2)), 65 size_uv_(half_width_ * ((height_ + 1) / 2)),
65 frame_length_(CalcBufferSize(kI420, width_, height_)) {} 66 frame_length_(CalcBufferSize(kI420, width_, height_)) {}
66 67
67 void VideoProcessingTest::SetUp() { 68 void VideoProcessingTest::SetUp() {
68 vp_ = VideoProcessing::Create(); 69 vp_ = VideoProcessing::Create();
69 ASSERT_TRUE(vp_ != NULL); 70 ASSERT_TRUE(vp_ != NULL);
70 71
71 video_frame_.CreateEmptyFrame(width_, height_, width_, 72 video_frame_.CreateEmptyFrame(width_, height_, width_,
72 half_width_, half_width_); 73 half_width_, half_width_);
73 // Clear video frame so DrMemory/Valgrind will allow reads of the buffer. 74 // Clear video frame so DrMemory/Valgrind will allow reads of the buffer.
74 memset(video_frame_.buffer(kYPlane), 0, video_frame_.allocated_size(kYPlane)); 75 memset(video_frame_.video_frame_buffer()->MutableDataY(), 0,
75 memset(video_frame_.buffer(kUPlane), 0, video_frame_.allocated_size(kUPlane)); 76 video_frame_.allocated_size(kYPlane));
76 memset(video_frame_.buffer(kVPlane), 0, video_frame_.allocated_size(kVPlane)); 77 memset(video_frame_.video_frame_buffer()->MutableDataU(), 0,
78 video_frame_.allocated_size(kUPlane));
79 memset(video_frame_.video_frame_buffer()->MutableDataV(), 0,
80 video_frame_.allocated_size(kVPlane));
77 const std::string video_file = 81 const std::string video_file =
78 webrtc::test::ResourcePath("foreman_cif", "yuv"); 82 webrtc::test::ResourcePath("foreman_cif", "yuv");
79 source_file_ = fopen(video_file.c_str(), "rb"); 83 source_file_ = fopen(video_file.c_str(), "rb");
80 ASSERT_TRUE(source_file_ != NULL) 84 ASSERT_TRUE(source_file_ != NULL)
81 << "Cannot read source file: " + video_file + "\n"; 85 << "Cannot read source file: " + video_file + "\n";
82 } 86 }
83 87
84 void VideoProcessingTest::TearDown() { 88 void VideoProcessingTest::TearDown() {
85 if (source_file_ != NULL) { 89 if (source_file_ != NULL) {
86 ASSERT_EQ(0, fclose(source_file_)); 90 ASSERT_EQ(0, fclose(source_file_));
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 std::cout << "Watch " << filename.str() << " and verify that it is okay." 291 std::cout << "Watch " << filename.str() << " and verify that it is okay."
288 << std::endl; 292 << std::endl;
289 FILE* stand_alone_file = fopen(filename.str().c_str(), "wb"); 293 FILE* stand_alone_file = fopen(filename.str().c_str(), "wb");
290 if (PrintVideoFrame(processed, stand_alone_file) < 0) 294 if (PrintVideoFrame(processed, stand_alone_file) < 0)
291 std::cerr << "Failed to write: " << filename.str() << std::endl; 295 std::cerr << "Failed to write: " << filename.str() << std::endl;
292 if (stand_alone_file) 296 if (stand_alone_file)
293 fclose(stand_alone_file); 297 fclose(stand_alone_file);
294 } 298 }
295 299
296 } // namespace webrtc 300 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_processing/content_analysis.cc ('k') | webrtc/modules/video_processing/video_denoiser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698