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

Side by Side Diff: webrtc/tools/converter/converter.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 years, 2 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 #include <stdio.h> 10 #include <stdio.h>
(...skipping 27 matching lines...) Expand all
38 FILE* output_file = fopen(output_file_name.c_str(), "wb"); 38 FILE* output_file = fopen(output_file_name.c_str(), "wb");
39 39
40 // Open output file in append mode. 40 // Open output file in append mode.
41 if (output_file == NULL) { 41 if (output_file == NULL) {
42 fprintf(stderr, "Couldn't open input file for reading: %s\n", 42 fprintf(stderr, "Couldn't open input file for reading: %s\n",
43 output_file_name.c_str()); 43 output_file_name.c_str());
44 return false; 44 return false;
45 } 45 }
46 46
47 int input_frame_size = InputFrameSize(); 47 int input_frame_size = InputFrameSize();
48 uint8* rgba_buffer = new uint8[input_frame_size]; 48 uint8_t* rgba_buffer = new uint8_t[input_frame_size];
49 int y_plane_size = YPlaneSize(); 49 int y_plane_size = YPlaneSize();
50 uint8* dst_y = new uint8[y_plane_size]; 50 uint8_t* dst_y = new uint8_t[y_plane_size];
51 int u_plane_size = UPlaneSize(); 51 int u_plane_size = UPlaneSize();
52 uint8* dst_u = new uint8[u_plane_size]; 52 uint8_t* dst_u = new uint8_t[u_plane_size];
53 int v_plane_size = VPlaneSize(); 53 int v_plane_size = VPlaneSize();
54 uint8* dst_v = new uint8[v_plane_size]; 54 uint8_t* dst_v = new uint8_t[v_plane_size];
55 55
56 int counter = 0; // Counter to form frame names. 56 int counter = 0; // Counter to form frame names.
57 bool success = false; // Is conversion successful. 57 bool success = false; // Is conversion successful.
58 58
59 while (true) { 59 while (true) {
60 std::string file_name = FormFrameName(4, counter); 60 std::string file_name = FormFrameName(4, counter);
61 // Get full path file name. 61 // Get full path file name.
62 std::string input_file_name = FindFullFileName(frames_dir, file_name); 62 std::string input_file_name = FindFullFileName(frames_dir, file_name);
63 63
64 if (FileExists(input_file_name)) { 64 if (FileExists(input_file_name)) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 delete[] rgba_buffer; 99 delete[] rgba_buffer;
100 delete[] dst_y; 100 delete[] dst_y;
101 delete[] dst_u; 101 delete[] dst_u;
102 delete[] dst_v; 102 delete[] dst_v;
103 103
104 fclose(output_file); 104 fclose(output_file);
105 105
106 return success; 106 return success;
107 } 107 }
108 108
109 bool Converter::AddYUVToFile(uint8* y_plane, int y_plane_size, 109 bool Converter::AddYUVToFile(uint8_t* y_plane,
110 uint8* u_plane, int u_plane_size, 110 int y_plane_size,
111 uint8* v_plane, int v_plane_size, 111 uint8_t* u_plane,
112 int u_plane_size,
113 uint8_t* v_plane,
114 int v_plane_size,
112 FILE* output_file) { 115 FILE* output_file) {
113 bool success = AddYUVPlaneToFile(y_plane, y_plane_size, output_file) && 116 bool success = AddYUVPlaneToFile(y_plane, y_plane_size, output_file) &&
114 AddYUVPlaneToFile(u_plane, u_plane_size, output_file) && 117 AddYUVPlaneToFile(u_plane, u_plane_size, output_file) &&
115 AddYUVPlaneToFile(v_plane, v_plane_size, output_file); 118 AddYUVPlaneToFile(v_plane, v_plane_size, output_file);
116 return success; 119 return success;
117 } 120 }
118 121
119 bool Converter::AddYUVPlaneToFile(uint8* yuv_plane, int yuv_plane_size, 122 bool Converter::AddYUVPlaneToFile(uint8_t* yuv_plane,
123 int yuv_plane_size,
120 FILE* file) { 124 FILE* file) {
121 size_t bytes_written = fwrite(yuv_plane, 1, yuv_plane_size, file); 125 size_t bytes_written = fwrite(yuv_plane, 1, yuv_plane_size, file);
122 126
123 if (bytes_written != static_cast<size_t>(yuv_plane_size)) { 127 if (bytes_written != static_cast<size_t>(yuv_plane_size)) {
124 fprintf(stderr, "Number of bytes written (%d) doesn't match size of y plane" 128 fprintf(stderr, "Number of bytes written (%d) doesn't match size of y plane"
125 " (%d)\n", static_cast<int>(bytes_written), yuv_plane_size); 129 " (%d)\n", static_cast<int>(bytes_written), yuv_plane_size);
126 return false; 130 return false;
127 } 131 }
128 return true; 132 return true;
129 } 133 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 std::stringstream tmp; 167 std::stringstream tmp;
164 168
165 // Zero-pad number to a string. 169 // Zero-pad number to a string.
166 tmp << std::setfill('0') << std::setw(width) << number; 170 tmp << std::setfill('0') << std::setw(width) << number;
167 171
168 return "frame_" + tmp.str(); 172 return "frame_" + tmp.str();
169 } 173 }
170 174
171 } // namespace test 175 } // namespace test
172 } // namespace webrtc 176 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/tools/converter/converter.h ('k') | webrtc/tools/frame_analyzer/video_quality_analysis.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698