/* * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include #include #include #include #include #include "absl/flags/flag.h" #include "absl/flags/parse.h" #include "absl/strings/match.h" #include "api/scoped_refptr.h" #include "api/test/metrics/chrome_perf_dashboard_metrics_exporter.h" #include "api/test/metrics/global_metrics_logger_and_exporter.h" #include "api/test/metrics/metrics_exporter.h" #include "api/test/metrics/stdout_metrics_exporter.h" #include "rtc_base/strings/string_builder.h" #include "rtc_tools/frame_analyzer/video_color_aligner.h" #include "rtc_tools/frame_analyzer/video_geometry_aligner.h" #include "rtc_tools/frame_analyzer/video_quality_analysis.h" #include "rtc_tools/frame_analyzer/video_temporal_aligner.h" #include "rtc_tools/video_file_reader.h" #include "rtc_tools/video_file_writer.h" ABSL_FLAG(int32_t, width, -1, "The width of the reference and test files"); ABSL_FLAG(int32_t, height, -1, "The height of the reference and test files"); ABSL_FLAG(std::string, label, "MY_TEST", "The label to use for the perf output"); ABSL_FLAG(std::string, reference_file, "ref.yuv", "The reference YUV file to run the analysis against"); ABSL_FLAG(std::string, test_file, "test.yuv", "The test YUV file to run the analysis for"); ABSL_FLAG(std::string, aligned_output_file, "", "Where to write aligned YUV/Y4M output file, f not present, no files " "will be written"); ABSL_FLAG(std::string, yuv_directory, "", "Where to write aligned YUV ref+test output files, if not present, " "no files will be written"); ABSL_FLAG(std::string, chartjson_result_file, "", "Where to store perf result in chartjson format, if not present, no " "perf result will be stored"); namespace { #ifdef WIN32 const char* const kPathDelimiter = "\\"; #else const char* const kPathDelimiter = "/"; #endif std::string JoinFilename(std::string directory, std::string filename) { return directory + kPathDelimiter + filename; } } // namespace /* * A command line tool running PSNR and SSIM on a reference video and a test * video. The test video is a record of the reference video which can start at * an arbitrary point. It is possible that there will be repeated frames or * skipped frames as well. The video files should be I420 .y4m or .yuv videos. * If both files are .y4m, it's not needed to specify width/height. The tool * prints the result to standard output in the Chromium perf format: * RESULT :