Revert "Switch frame_analyzer to ABSL_FLAG."
This reverts commit 3668e9b56198eb8112562d017c47a52050be3561. Reason for revert: Breaks downstream project. Original change's description: > Switch frame_analyzer to ABSL_FLAG. > > Bug: webrtc:10616 > Change-Id: I34473632431569406b9086f57caac12434862005 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/136801 > Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#28358} TBR=danilchap@webrtc.org,mbonadei@webrtc.org,kwiberg@webrtc.org Change-Id: Ic72981eb2b35f2911f4ec7678fa73bd56cc6fa9f No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:10616 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/143680 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28360}
This commit is contained in:

committed by
Commit Bot

parent
2923d768f0
commit
90c6d1bdc3
@ -125,20 +125,18 @@ rtc_static_library("video_quality_analysis") {
|
|||||||
|
|
||||||
rtc_executable("frame_analyzer") {
|
rtc_executable("frame_analyzer") {
|
||||||
visibility = [ "*" ]
|
visibility = [ "*" ]
|
||||||
testonly = true
|
|
||||||
sources = [
|
sources = [
|
||||||
"frame_analyzer/frame_analyzer.cc",
|
"frame_analyzer/frame_analyzer.cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
|
":command_line_parser",
|
||||||
":video_file_reader",
|
":video_file_reader",
|
||||||
":video_file_writer",
|
":video_file_writer",
|
||||||
":video_quality_analysis",
|
":video_quality_analysis",
|
||||||
"../api:scoped_refptr",
|
"../api:scoped_refptr",
|
||||||
"../rtc_base:stringutils",
|
"../rtc_base:stringutils",
|
||||||
"../test:perf_test",
|
"../test:perf_test",
|
||||||
"//third_party/abseil-cpp/absl/flags:flag",
|
|
||||||
"//third_party/abseil-cpp/absl/flags:parse",
|
|
||||||
"//third_party/abseil-cpp/absl/strings",
|
"//third_party/abseil-cpp/absl/strings",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,5 @@ include_rules = [
|
|||||||
"+system_wrappers",
|
"+system_wrappers",
|
||||||
"+p2p",
|
"+p2p",
|
||||||
"+third_party/libyuv",
|
"+third_party/libyuv",
|
||||||
|
|
||||||
# Abseil flags are allowed in tests and tools.
|
|
||||||
"+absl/flags",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "absl/flags/flag.h"
|
|
||||||
#include "absl/flags/parse.h"
|
|
||||||
#include "absl/strings/match.h"
|
#include "absl/strings/match.h"
|
||||||
#include "api/scoped_refptr.h"
|
#include "api/scoped_refptr.h"
|
||||||
#include "rtc_base/strings/string_builder.h"
|
#include "rtc_base/strings/string_builder.h"
|
||||||
@ -23,40 +21,11 @@
|
|||||||
#include "rtc_tools/frame_analyzer/video_geometry_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_quality_analysis.h"
|
||||||
#include "rtc_tools/frame_analyzer/video_temporal_aligner.h"
|
#include "rtc_tools/frame_analyzer/video_temporal_aligner.h"
|
||||||
|
#include "rtc_tools/simple_command_line_parser.h"
|
||||||
#include "rtc_tools/video_file_reader.h"
|
#include "rtc_tools/video_file_reader.h"
|
||||||
#include "rtc_tools/video_file_writer.h"
|
#include "rtc_tools/video_file_writer.h"
|
||||||
#include "test/testsupport/perf_test.h"
|
#include "test/testsupport/perf_test.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 {
|
namespace {
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@ -87,12 +56,60 @@ std::string JoinFilename(std::string directory, std::string filename) {
|
|||||||
* --test_file_ref=<name_of_file> --width=<frame_width> --height=<frame_height>
|
* --test_file_ref=<name_of_file> --width=<frame_width> --height=<frame_height>
|
||||||
*/
|
*/
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
absl::ParseCommandLine(argc, argv);
|
std::string program_name = argv[0];
|
||||||
|
std::string usage =
|
||||||
|
"Compares the output video with the initially sent video."
|
||||||
|
"\nExample usage:\n" +
|
||||||
|
program_name +
|
||||||
|
" --reference_file=ref.yuv --test_file=test.yuv --width=320 "
|
||||||
|
"--height=240\n"
|
||||||
|
"Command line flags:\n"
|
||||||
|
" - width(int): The width of the reference and test files. Default: -1\n"
|
||||||
|
" - height(int): The height of the reference and test files. "
|
||||||
|
" Default: -1\n"
|
||||||
|
" - label(string): The label to use for the perf output."
|
||||||
|
" Default: MY_TEST\n"
|
||||||
|
" Default: ref.yuv\n"
|
||||||
|
" - test_file(string): The test YUV file to run the analysis for."
|
||||||
|
" Default: test_file.yuv\n"
|
||||||
|
" - chartjson_result_file: Where to store perf result in chartjson"
|
||||||
|
" format. If not present, no perf result will be stored."
|
||||||
|
" Default: None\n"
|
||||||
|
" - aligned_output_file: Where to write aligned YUV/Y4M output file."
|
||||||
|
" If not present, no file will be written."
|
||||||
|
" Default: None\n"
|
||||||
|
" - yuv_directory: Where to write aligned YUV ref+test output files."
|
||||||
|
" If not present, no files will be written."
|
||||||
|
" Default: None\n";
|
||||||
|
|
||||||
int width = absl::GetFlag(FLAGS_width);
|
webrtc::test::CommandLineParser parser;
|
||||||
int height = absl::GetFlag(FLAGS_height);
|
|
||||||
const std::string reference_file_name = absl::GetFlag(FLAGS_reference_file);
|
// Init the parser and set the usage message
|
||||||
const std::string test_file_name = absl::GetFlag(FLAGS_test_file);
|
parser.Init(argc, argv);
|
||||||
|
parser.SetUsageMessage(usage);
|
||||||
|
|
||||||
|
parser.SetFlag("width", "-1");
|
||||||
|
parser.SetFlag("height", "-1");
|
||||||
|
parser.SetFlag("label", "MY_TEST");
|
||||||
|
parser.SetFlag("reference_file", "ref.yuv");
|
||||||
|
parser.SetFlag("test_file", "test.yuv");
|
||||||
|
parser.SetFlag("aligned_output_file", "");
|
||||||
|
parser.SetFlag("yuv_directory", "");
|
||||||
|
parser.SetFlag("chartjson_result_file", "");
|
||||||
|
parser.SetFlag("help", "false");
|
||||||
|
|
||||||
|
parser.ProcessFlags();
|
||||||
|
if (parser.GetFlag("help") == "true") {
|
||||||
|
parser.PrintUsageMessage();
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
parser.PrintEnteredFlags();
|
||||||
|
|
||||||
|
int width = strtol((parser.GetFlag("width")).c_str(), nullptr, 10);
|
||||||
|
int height = strtol((parser.GetFlag("height")).c_str(), nullptr, 10);
|
||||||
|
|
||||||
|
const std::string reference_file_name = parser.GetFlag("reference_file");
|
||||||
|
const std::string test_file_name = parser.GetFlag("test_file");
|
||||||
|
|
||||||
// .yuv files require explicit resolution.
|
// .yuv files require explicit resolution.
|
||||||
if ((absl::EndsWith(reference_file_name, ".yuv") ||
|
if ((absl::EndsWith(reference_file_name, ".yuv") ||
|
||||||
@ -158,19 +175,18 @@ int main(int argc, char* argv[]) {
|
|||||||
results.decode_errors_ref = 0;
|
results.decode_errors_ref = 0;
|
||||||
results.decode_errors_test = 0;
|
results.decode_errors_test = 0;
|
||||||
|
|
||||||
webrtc::test::PrintAnalysisResults(absl::GetFlag(FLAGS_label), &results);
|
webrtc::test::PrintAnalysisResults(parser.GetFlag("label"), &results);
|
||||||
|
|
||||||
std::string chartjson_result_file =
|
std::string chartjson_result_file = parser.GetFlag("chartjson_result_file");
|
||||||
absl::GetFlag(FLAGS_chartjson_result_file);
|
|
||||||
if (!chartjson_result_file.empty()) {
|
if (!chartjson_result_file.empty()) {
|
||||||
webrtc::test::WritePerfResults(chartjson_result_file);
|
webrtc::test::WritePerfResults(chartjson_result_file);
|
||||||
}
|
}
|
||||||
std::string aligned_output_file = absl::GetFlag(FLAGS_aligned_output_file);
|
std::string aligned_output_file = parser.GetFlag("aligned_output_file");
|
||||||
if (!aligned_output_file.empty()) {
|
if (!aligned_output_file.empty()) {
|
||||||
webrtc::test::WriteVideoToFile(aligned_reference_video, aligned_output_file,
|
webrtc::test::WriteVideoToFile(aligned_reference_video, aligned_output_file,
|
||||||
/*fps=*/30);
|
/*fps=*/30);
|
||||||
}
|
}
|
||||||
std::string yuv_directory = absl::GetFlag(FLAGS_yuv_directory);
|
std::string yuv_directory = parser.GetFlag("yuv_directory");
|
||||||
if (!yuv_directory.empty()) {
|
if (!yuv_directory.empty()) {
|
||||||
webrtc::test::WriteVideoToFile(aligned_reference_video,
|
webrtc::test::WriteVideoToFile(aligned_reference_video,
|
||||||
JoinFilename(yuv_directory, "ref.yuv"),
|
JoinFilename(yuv_directory, "ref.yuv"),
|
||||||
|
Reference in New Issue
Block a user