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

Side by Side Diff: webrtc/test/testsupport/metrics/video_metrics.cc

Issue 1749103003: Replace scoped_ptr with unique_ptr in webrtc/common_video/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@up6
Patch Set: 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
« no previous file with comments | « webrtc/test/linux/glx_renderer.cc ('k') | webrtc/video_decoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/test/testsupport/metrics/video_metrics.h" 11 #include "webrtc/test/testsupport/metrics/video_metrics.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 #include <stdio.h> 14 #include <stdio.h>
15 15
16 #include <algorithm> // min_element, max_element 16 #include <algorithm> // min_element, max_element
17 #include <memory>
17 18
18 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
19 #include "webrtc/video_frame.h" 20 #include "webrtc/video_frame.h"
20 21
21 namespace webrtc { 22 namespace webrtc {
22 namespace test { 23 namespace test {
23 24
24 // Copy here so our callers won't need to include libyuv for this constant. 25 // Copy here so our callers won't need to include libyuv for this constant.
25 double kMetricsPerfectPSNR = kPerfectPSNR; 26 double kMetricsPerfectPSNR = kPerfectPSNR;
26 27
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 fprintf(stderr, "Cannot open file %s\n", test_filename); 105 fprintf(stderr, "Cannot open file %s\n", test_filename);
105 fclose(ref_fp); 106 fclose(ref_fp);
106 return -2; 107 return -2;
107 } 108 }
108 int frame_number = 0; 109 int frame_number = 0;
109 110
110 // Read reference and test frames. 111 // Read reference and test frames.
111 const size_t frame_length = 3 * width * height >> 1; 112 const size_t frame_length = 3 * width * height >> 1;
112 VideoFrame ref_frame; 113 VideoFrame ref_frame;
113 VideoFrame test_frame; 114 VideoFrame test_frame;
114 rtc::scoped_ptr<uint8_t[]> ref_buffer(new uint8_t[frame_length]); 115 std::unique_ptr<uint8_t[]> ref_buffer(new uint8_t[frame_length]);
115 rtc::scoped_ptr<uint8_t[]> test_buffer(new uint8_t[frame_length]); 116 std::unique_ptr<uint8_t[]> test_buffer(new uint8_t[frame_length]);
116 117
117 // Set decoded image parameters. 118 // Set decoded image parameters.
118 int half_width = (width + 1) / 2; 119 int half_width = (width + 1) / 2;
119 ref_frame.CreateEmptyFrame(width, height, width, half_width, half_width); 120 ref_frame.CreateEmptyFrame(width, height, width, half_width, half_width);
120 test_frame.CreateEmptyFrame(width, height, width, half_width, half_width); 121 test_frame.CreateEmptyFrame(width, height, width, half_width, half_width);
121 122
122 size_t ref_bytes = fread(ref_buffer.get(), 1, frame_length, ref_fp); 123 size_t ref_bytes = fread(ref_buffer.get(), 1, frame_length, ref_fp);
123 size_t test_bytes = fread(test_buffer.get(), 1, frame_length, test_fp); 124 size_t test_bytes = fread(test_buffer.get(), 1, frame_length, test_fp);
124 while (ref_bytes == frame_length && test_bytes == frame_length) { 125 while (ref_bytes == frame_length && test_bytes == frame_length) {
125 // Converting from buffer to plane representation. 126 // Converting from buffer to plane representation.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 int width, 190 int width,
190 int height, 191 int height,
191 QualityMetricsResult* result) { 192 QualityMetricsResult* result) {
192 assert(result != NULL); 193 assert(result != NULL);
193 return CalculateMetrics(kSSIM, ref_filename, test_filename, width, height, 194 return CalculateMetrics(kSSIM, ref_filename, test_filename, width, height,
194 NULL, result); 195 NULL, result);
195 } 196 }
196 197
197 } // namespace test 198 } // namespace test
198 } // namespace webrtc 199 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/test/linux/glx_renderer.cc ('k') | webrtc/video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698