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

Side by Side Diff: webrtc/tools/frame_analyzer/video_quality_analysis.cc

Issue 2675723002: Remove all occurrences of "using std::string". (Closed)
Patch Set: Created 3 years, 10 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/tools/frame_analyzer/video_quality_analysis.h" 11 #include "webrtc/tools/frame_analyzer/video_quality_analysis.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 #include <stdio.h> 14 #include <stdio.h>
15 #include <stdlib.h> 15 #include <stdlib.h>
16 #include <algorithm> 16 #include <algorithm>
17 #include <string> 17 #include <string>
18 #include <map> 18 #include <map>
19 #include <utility> 19 #include <utility>
20 20
21 #define STATS_LINE_LENGTH 32 21 #define STATS_LINE_LENGTH 32
22 #define Y4M_FILE_HEADER_MAX_SIZE 200 22 #define Y4M_FILE_HEADER_MAX_SIZE 200
23 #define Y4M_FRAME_DELIMITER "FRAME" 23 #define Y4M_FRAME_DELIMITER "FRAME"
24 #define Y4M_FRAME_HEADER_SIZE 6 24 #define Y4M_FRAME_HEADER_SIZE 6
25 25
26 namespace webrtc { 26 namespace webrtc {
27 namespace test { 27 namespace test {
28 28
29 using std::string;
30
31 ResultsContainer::ResultsContainer() {} 29 ResultsContainer::ResultsContainer() {}
32 ResultsContainer::~ResultsContainer() {} 30 ResultsContainer::~ResultsContainer() {}
33 31
34 int GetI420FrameSize(int width, int height) { 32 int GetI420FrameSize(int width, int height) {
35 int half_width = (width + 1) >> 1; 33 int half_width = (width + 1) >> 1;
36 int half_height = (height + 1) >> 1; 34 int half_height = (height + 1) >> 1;
37 35
38 int y_plane = width * height; // I420 Y plane. 36 int y_plane = width * height; // I420 Y plane.
39 int u_plane = half_width * half_height; // I420 U plane. 37 int u_plane = half_width * half_height; // I420 U plane.
40 int v_plane = half_width * half_height; // I420 V plane. 38 int v_plane = half_width * half_height; // I420 V plane.
41 39
42 return y_plane + u_plane + v_plane; 40 return y_plane + u_plane + v_plane;
43 } 41 }
44 42
45 int ExtractFrameSequenceNumber(std::string line) { 43 int ExtractFrameSequenceNumber(std::string line) {
46 size_t space_position = line.find(' '); 44 size_t space_position = line.find(' ');
47 if (space_position == string::npos) { 45 if (space_position == std::string::npos) {
48 return -1; 46 return -1;
49 } 47 }
50 std::string frame = line.substr(0, space_position); 48 std::string frame = line.substr(0, space_position);
51 49
52 size_t underscore_position = frame.find('_'); 50 size_t underscore_position = frame.find('_');
53 if (underscore_position == string::npos) { 51 if (underscore_position == std::string::npos) {
54 return -1; 52 return -1;
55 } 53 }
56 std::string frame_number = frame.substr(underscore_position + 1); 54 std::string frame_number = frame.substr(underscore_position + 1);
57 55
58 return strtol(frame_number.c_str(), NULL, 10); 56 return strtol(frame_number.c_str(), NULL, 10);
59 } 57 }
60 58
61 int ExtractDecodedFrameNumber(std::string line) { 59 int ExtractDecodedFrameNumber(std::string line) {
62 size_t space_position = line.find(' '); 60 size_t space_position = line.find(' ');
63 if (space_position == string::npos) { 61 if (space_position == std::string::npos) {
64 return -1; 62 return -1;
65 } 63 }
66 std::string decoded_number = line.substr(space_position + 1); 64 std::string decoded_number = line.substr(space_position + 1);
67 65
68 return strtol(decoded_number.c_str(), NULL, 10); 66 return strtol(decoded_number.c_str(), NULL, 10);
69 } 67 }
70 68
71 bool IsThereBarcodeError(std::string line) { 69 bool IsThereBarcodeError(std::string line) {
72 size_t barcode_error_position = line.find("Barcode error"); 70 size_t barcode_error_position = line.find("Barcode error");
73 if (barcode_error_position != string::npos) { 71 if (barcode_error_position != std::string::npos) {
74 return true; 72 return true;
75 } 73 }
76 return false; 74 return false;
77 } 75 }
78 76
79 bool GetNextStatsLine(FILE* stats_file, char* line) { 77 bool GetNextStatsLine(FILE* stats_file, char* line) {
80 int chars = 0; 78 int chars = 0;
81 char buf = 0; 79 char buf = 0;
82 80
83 while (buf != '\n') { 81 while (buf != '\n') {
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 for (iter = results->frames.begin(); iter != results->frames.end() - 1; 455 for (iter = results->frames.begin(); iter != results->frames.end() - 1;
458 ++iter) { 456 ++iter) {
459 fprintf(output, "%f,", iter->ssim_value); 457 fprintf(output, "%f,", iter->ssim_value);
460 } 458 }
461 fprintf(output, "%f] score\n", iter->ssim_value); 459 fprintf(output, "%f] score\n", iter->ssim_value);
462 } 460 }
463 } 461 }
464 462
465 } // namespace test 463 } // namespace test
466 } // namespace webrtc 464 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc ('k') | webrtc/tools/frame_editing/frame_editing_lib.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698