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

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

Issue 1738863002: Replace scoped_ptr with unique_ptr in webrtc/modules/video_*/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@up4
Patch Set: rebase Created 4 years, 9 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) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 <memory>
12
11 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 13 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
12 #include "webrtc/modules/video_processing/include/video_processing.h" 14 #include "webrtc/modules/video_processing/include/video_processing.h"
13 #include "webrtc/modules/video_processing/test/video_processing_unittest.h" 15 #include "webrtc/modules/video_processing/test/video_processing_unittest.h"
14 16
15 namespace webrtc { 17 namespace webrtc {
16 18
17 #if defined(WEBRTC_IOS) 19 #if defined(WEBRTC_IOS)
18 #define MAYBE_BrightnessDetection DISABLED_BrightnessDetection 20 #define MAYBE_BrightnessDetection DISABLED_BrightnessDetection
19 #else 21 #else
20 #define MAYBE_BrightnessDetection BrightnessDetection 22 #define MAYBE_BrightnessDetection BrightnessDetection
21 #endif 23 #endif
22 TEST_F(VideoProcessingTest, MAYBE_BrightnessDetection) { 24 TEST_F(VideoProcessingTest, MAYBE_BrightnessDetection) {
23 uint32_t frameNum = 0; 25 uint32_t frameNum = 0;
24 int32_t brightnessWarning = 0; 26 int32_t brightnessWarning = 0;
25 uint32_t warningCount = 0; 27 uint32_t warningCount = 0;
26 rtc::scoped_ptr<uint8_t[]> video_buffer(new uint8_t[frame_length_]); 28 std::unique_ptr<uint8_t[]> video_buffer(new uint8_t[frame_length_]);
27 while (fread(video_buffer.get(), 1, frame_length_, source_file_) == 29 while (fread(video_buffer.get(), 1, frame_length_, source_file_) ==
28 frame_length_) { 30 frame_length_) {
29 EXPECT_EQ(0, ConvertToI420(kI420, video_buffer.get(), 0, 0, width_, height_, 31 EXPECT_EQ(0, ConvertToI420(kI420, video_buffer.get(), 0, 0, width_, height_,
30 0, kVideoRotation_0, &video_frame_)); 32 0, kVideoRotation_0, &video_frame_));
31 frameNum++; 33 frameNum++;
32 VideoProcessing::FrameStats stats; 34 VideoProcessing::FrameStats stats;
33 vp_->GetFrameStats(video_frame_, &stats); 35 vp_->GetFrameStats(video_frame_, &stats);
34 EXPECT_GT(stats.num_pixels, 0u); 36 EXPECT_GT(stats.num_pixels, 0u);
35 ASSERT_GE(brightnessWarning = vp_->BrightnessDetection(video_frame_, stats), 37 ASSERT_GE(brightnessWarning = vp_->BrightnessDetection(video_frame_, stats),
36 0); 38 0);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 113 }
112 } 114 }
113 ASSERT_NE(0, feof(source_file_)) << "Error reading source file"; 115 ASSERT_NE(0, feof(source_file_)) << "Error reading source file";
114 116
115 // Expect many darkness warnings 117 // Expect many darkness warnings
116 warningProportion = static_cast<float>(warningCount) / frameNum * 100; 118 warningProportion = static_cast<float>(warningCount) / frameNum * 100;
117 printf("Dark foreman: %.1f %%\n\n", warningProportion); 119 printf("Dark foreman: %.1f %%\n\n", warningProportion);
118 EXPECT_GT(warningProportion, 90); 120 EXPECT_GT(warningProportion, 90);
119 } 121 }
120 } // namespace webrtc 122 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_processing/frame_preprocessor.h ('k') | webrtc/modules/video_processing/test/content_metrics_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698