| OLD | NEW |
| 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 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 if (FLAGS_input_filename.empty() || FLAGS_width == -1 || FLAGS_height == -1) { | 148 if (FLAGS_input_filename.empty() || FLAGS_width == -1 || FLAGS_height == -1) { |
| 149 printf("%s\n", google::ProgramUsage()); | 149 printf("%s\n", google::ProgramUsage()); |
| 150 return 1; | 150 return 1; |
| 151 } | 151 } |
| 152 config->name = FLAGS_test_name; | 152 config->name = FLAGS_test_name; |
| 153 config->description = FLAGS_test_description; | 153 config->description = FLAGS_test_description; |
| 154 | 154 |
| 155 // Verify the input file exists and is readable. | 155 // Verify the input file exists and is readable. |
| 156 FILE* test_file; | 156 FILE* test_file; |
| 157 test_file = fopen(FLAGS_input_filename.c_str(), "rb"); | 157 test_file = fopen(FLAGS_input_filename.c_str(), "rb"); |
| 158 if (test_file == NULL) { | 158 if (test_file == nullptr) { |
| 159 fprintf(stderr, "Cannot read the specified input file: %s\n", | 159 fprintf(stderr, "Cannot read the specified input file: %s\n", |
| 160 FLAGS_input_filename.c_str()); | 160 FLAGS_input_filename.c_str()); |
| 161 return 2; | 161 return 2; |
| 162 } | 162 } |
| 163 fclose(test_file); | 163 fclose(test_file); |
| 164 config->input_filename = FLAGS_input_filename; | 164 config->input_filename = FLAGS_input_filename; |
| 165 | 165 |
| 166 // Verify the output dir exists. | 166 // Verify the output dir exists. |
| 167 struct stat dir_info; | 167 struct stat dir_info; |
| 168 if (!(stat(FLAGS_output_dir.c_str(), &dir_info) == 0 && | 168 if (!(stat(FLAGS_output_dir.c_str(), &dir_info) == 0 && |
| (...skipping 18 matching lines...) Expand all Loading... |
| 187 "_out.yuv"; | 187 "_out.yuv"; |
| 188 } | 188 } |
| 189 | 189 |
| 190 // Verify output file can be written. | 190 // Verify output file can be written. |
| 191 if (FLAGS_output_dir == ".") { | 191 if (FLAGS_output_dir == ".") { |
| 192 config->output_filename = FLAGS_output_filename; | 192 config->output_filename = FLAGS_output_filename; |
| 193 } else { | 193 } else { |
| 194 config->output_filename = FLAGS_output_dir + "/" + FLAGS_output_filename; | 194 config->output_filename = FLAGS_output_dir + "/" + FLAGS_output_filename; |
| 195 } | 195 } |
| 196 test_file = fopen(config->output_filename.c_str(), "wb"); | 196 test_file = fopen(config->output_filename.c_str(), "wb"); |
| 197 if (test_file == NULL) { | 197 if (test_file == nullptr) { |
| 198 fprintf(stderr, "Cannot write output file: %s\n", | 198 fprintf(stderr, "Cannot write output file: %s\n", |
| 199 config->output_filename.c_str()); | 199 config->output_filename.c_str()); |
| 200 return 4; | 200 return 4; |
| 201 } | 201 } |
| 202 fclose(test_file); | 202 fclose(test_file); |
| 203 | 203 |
| 204 // Check single core flag. | 204 // Check single core flag. |
| 205 config->use_single_core = FLAGS_use_single_core; | 205 config->use_single_core = FLAGS_use_single_core; |
| 206 | 206 |
| 207 // Get codec specific configuration. | 207 // Get codec specific configuration. |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 config.frame_length_in_bytes); | 497 config.frame_length_in_bytes); |
| 498 frame_reader.Init(); | 498 frame_reader.Init(); |
| 499 frame_writer.Init(); | 499 frame_writer.Init(); |
| 500 webrtc::test::PacketReader packet_reader; | 500 webrtc::test::PacketReader packet_reader; |
| 501 | 501 |
| 502 webrtc::test::PacketManipulatorImpl packet_manipulator( | 502 webrtc::test::PacketManipulatorImpl packet_manipulator( |
| 503 &packet_reader, config.networking_config, config.verbose); | 503 &packet_reader, config.networking_config, config.verbose); |
| 504 // By default the packet manipulator is seeded with a fixed random. | 504 // By default the packet manipulator is seeded with a fixed random. |
| 505 // If disabled we must generate a new seed. | 505 // If disabled we must generate a new seed. |
| 506 if (FLAGS_disable_fixed_random_seed) { | 506 if (FLAGS_disable_fixed_random_seed) { |
| 507 packet_manipulator.InitializeRandomSeed(time(NULL)); | 507 packet_manipulator.InitializeRandomSeed(time(nullptr)); |
| 508 } | 508 } |
| 509 webrtc::test::VideoProcessor* processor = | 509 webrtc::test::VideoProcessor* processor = |
| 510 new webrtc::test::VideoProcessorImpl(encoder, decoder, &frame_reader, | 510 new webrtc::test::VideoProcessorImpl(encoder, decoder, &frame_reader, |
| 511 &frame_writer, &packet_manipulator, | 511 &frame_writer, &packet_manipulator, |
| 512 config, &stats); | 512 config, &stats); |
| 513 processor->Init(); | 513 processor->Init(); |
| 514 | 514 |
| 515 int frame_number = 0; | 515 int frame_number = 0; |
| 516 while (processor->ProcessFrame(frame_number)) { | 516 while (processor->ProcessFrame(frame_number)) { |
| 517 if (frame_number % 80 == 0) { | 517 if (frame_number % 80 == 0) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 546 } | 546 } |
| 547 if (FLAGS_python) { | 547 if (FLAGS_python) { |
| 548 PrintPythonOutput(config, stats, ssim_result, psnr_result); | 548 PrintPythonOutput(config, stats, ssim_result, psnr_result); |
| 549 } | 549 } |
| 550 delete processor; | 550 delete processor; |
| 551 delete encoder; | 551 delete encoder; |
| 552 delete decoder; | 552 delete decoder; |
| 553 Log("Quality test finished!"); | 553 Log("Quality test finished!"); |
| 554 return 0; | 554 return 0; |
| 555 } | 555 } |
| OLD | NEW |