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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 // If disabled we must generate a new seed. | 503 // If disabled we must generate a new seed. |
504 if (FLAGS_disable_fixed_random_seed) { | 504 if (FLAGS_disable_fixed_random_seed) { |
505 packet_manipulator.InitializeRandomSeed(time(NULL)); | 505 packet_manipulator.InitializeRandomSeed(time(NULL)); |
506 } | 506 } |
507 webrtc::test::VideoProcessor* processor = new webrtc::test::VideoProcessor( | 507 webrtc::test::VideoProcessor* processor = new webrtc::test::VideoProcessor( |
508 encoder, decoder, &frame_reader, &frame_writer, &packet_manipulator, | 508 encoder, decoder, &frame_reader, &frame_writer, &packet_manipulator, |
509 config, &stats, nullptr /* encoded_frame_writer */, | 509 config, &stats, nullptr /* encoded_frame_writer */, |
510 nullptr /* decoded_frame_writer */); | 510 nullptr /* decoded_frame_writer */); |
511 processor->Init(); | 511 processor->Init(); |
512 | 512 |
| 513 const int num_frames = frame_reader.NumberOfFrames(); |
513 int frame_number = 0; | 514 int frame_number = 0; |
514 while (processor->ProcessFrame(frame_number)) { | 515 while (frame_number < num_frames) { |
| 516 processor->ProcessFrame(frame_number); |
515 if (frame_number % 80 == 0) { | 517 if (frame_number % 80 == 0) { |
516 Log("\n"); // make the output a bit nicer. | 518 Log("\n"); // make the output a bit nicer. |
517 } | 519 } |
518 Log("."); | 520 Log("."); |
519 frame_number++; | 521 frame_number++; |
520 } | 522 } |
521 Log("\n"); | 523 Log("\n"); |
522 Log("Processed %d frames\n", frame_number); | 524 Log("Processed %d frames\n", frame_number); |
523 | 525 |
524 // Release encoder and decoder to make sure they have finished processing. | 526 // Release encoder and decoder to make sure they have finished processing. |
525 encoder->Release(); | 527 processor->Release(); |
526 decoder->Release(); | |
527 | 528 |
528 // Verify statistics are correct: | 529 // Verify statistics are correct: |
529 assert(frame_number == static_cast<int>(stats.stats_.size())); | 530 assert(frame_number == static_cast<int>(stats.stats_.size())); |
530 | 531 |
531 // Close the files before we start using them for SSIM/PSNR calculations. | 532 // Close the files before we start using them for SSIM/PSNR calculations. |
532 frame_reader.Close(); | 533 frame_reader.Close(); |
533 frame_writer.Close(); | 534 frame_writer.Close(); |
534 | 535 |
535 stats.PrintSummary(); | 536 stats.PrintSummary(); |
536 | 537 |
537 webrtc::test::QualityMetricsResult ssim_result; | 538 webrtc::test::QualityMetricsResult ssim_result; |
538 CalculateSsimVideoMetrics(&config, &ssim_result); | 539 CalculateSsimVideoMetrics(&config, &ssim_result); |
539 webrtc::test::QualityMetricsResult psnr_result; | 540 webrtc::test::QualityMetricsResult psnr_result; |
540 CalculatePsnrVideoMetrics(&config, &psnr_result); | 541 CalculatePsnrVideoMetrics(&config, &psnr_result); |
541 | 542 |
542 if (FLAGS_csv) { | 543 if (FLAGS_csv) { |
543 PrintCsvOutput(stats, ssim_result, psnr_result); | 544 PrintCsvOutput(stats, ssim_result, psnr_result); |
544 } | 545 } |
545 if (FLAGS_python) { | 546 if (FLAGS_python) { |
546 PrintPythonOutput(config, stats, ssim_result, psnr_result); | 547 PrintPythonOutput(config, stats, ssim_result, psnr_result); |
547 } | 548 } |
548 delete processor; | 549 delete processor; |
549 delete encoder; | 550 delete encoder; |
550 delete decoder; | 551 delete decoder; |
551 Log("Quality test finished!"); | 552 Log("Quality test finished!"); |
552 return 0; | 553 return 0; |
553 } | 554 } |
OLD | NEW |