198 lines
7.5 KiB
C++
Raw Normal View History

/*
* 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 <stdio.h>
#include <stdlib.h>
#include <cstddef>
#include <string>
#include <vector>
#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"
Reland "Reland "Update video_quality_analysis to align videos instead of using barcodes"" This is a reland of 9bb55fc09b6bfa00cba7779c37ad6c39b4206f7a Original change's description: > Reland "Update video_quality_analysis to align videos instead of using barcodes" > > This is a reland of d65e143801a7aaa9affdb939ea836aec1955cdcc > > The binary for frame_analyzer.cpp is precompiled and stored in the cloud, so it > won't automatically pick up change to the source file. Therefore, restore all > old code to be backwards compatible. > > Original change's description: > > Update video_quality_analysis to align videos instead of using barcodes > > > > This CL is a follow-up to the previous CL > > https://webrtc-review.googlesource.com/c/src/+/94773 that added generic > > logic for aligning videos. This will allow us to easily extend > > video_quality_analysis with new sophisticated video quality metrics. > > Also, we can use any kind of video that does not necessarily need to > > contain bar codes. Removing the need to decode barcodes also leads to a > > big speedup for the tests. > > > > Bug: webrtc:9642 > > Change-Id: I74b0d630b3e1ed44781ad024115ded3143e28f50 > > Reviewed-on: https://webrtc-review.googlesource.com/94845 > > Reviewed-by: Paulina Hensman <phensman@webrtc.org> > > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#24423} > > TBR=phensman@webrtc.org,phoglund@webrtc.org > > Bug: webrtc:9642 > Change-Id: Id8d129ce103284504c67690f8363c03eaae3eee7 > Reviewed-on: https://webrtc-review.googlesource.com/96000 > Reviewed-by: Magnus Jedvert <magjed@webrtc.org> > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24429} TBR=phensman,phoglund Bug: webrtc:9642 Change-Id: Ic248b7831ae148251a1a4ebeec5d154286f91a0a Reviewed-on: https://webrtc-review.googlesource.com/98080 Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24583}
2018-09-05 16:11:48 +02:00
#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
Reland "Reland "Update video_quality_analysis to align videos instead of using barcodes"" This is a reland of 9bb55fc09b6bfa00cba7779c37ad6c39b4206f7a Original change's description: > Reland "Update video_quality_analysis to align videos instead of using barcodes" > > This is a reland of d65e143801a7aaa9affdb939ea836aec1955cdcc > > The binary for frame_analyzer.cpp is precompiled and stored in the cloud, so it > won't automatically pick up change to the source file. Therefore, restore all > old code to be backwards compatible. > > Original change's description: > > Update video_quality_analysis to align videos instead of using barcodes > > > > This CL is a follow-up to the previous CL > > https://webrtc-review.googlesource.com/c/src/+/94773 that added generic > > logic for aligning videos. This will allow us to easily extend > > video_quality_analysis with new sophisticated video quality metrics. > > Also, we can use any kind of video that does not necessarily need to > > contain bar codes. Removing the need to decode barcodes also leads to a > > big speedup for the tests. > > > > Bug: webrtc:9642 > > Change-Id: I74b0d630b3e1ed44781ad024115ded3143e28f50 > > Reviewed-on: https://webrtc-review.googlesource.com/94845 > > Reviewed-by: Paulina Hensman <phensman@webrtc.org> > > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#24423} > > TBR=phensman@webrtc.org,phoglund@webrtc.org > > Bug: webrtc:9642 > Change-Id: Id8d129ce103284504c67690f8363c03eaae3eee7 > Reviewed-on: https://webrtc-review.googlesource.com/96000 > Reviewed-by: Magnus Jedvert <magjed@webrtc.org> > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24429} TBR=phensman,phoglund Bug: webrtc:9642 Change-Id: Ic248b7831ae148251a1a4ebeec5d154286f91a0a Reviewed-on: https://webrtc-review.googlesource.com/98080 Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24583}
2018-09-05 16:11:48 +02:00
* 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 <metric>:<label>= <values>
*
* The max value for PSNR is 48.0 (between equal frames), as for SSIM it is 1.0.
*
* Usage:
* frame_analyzer --label=<test_label> --reference_file=<name_of_file>
Reland "Reland "Update video_quality_analysis to align videos instead of using barcodes"" This is a reland of 9bb55fc09b6bfa00cba7779c37ad6c39b4206f7a Original change's description: > Reland "Update video_quality_analysis to align videos instead of using barcodes" > > This is a reland of d65e143801a7aaa9affdb939ea836aec1955cdcc > > The binary for frame_analyzer.cpp is precompiled and stored in the cloud, so it > won't automatically pick up change to the source file. Therefore, restore all > old code to be backwards compatible. > > Original change's description: > > Update video_quality_analysis to align videos instead of using barcodes > > > > This CL is a follow-up to the previous CL > > https://webrtc-review.googlesource.com/c/src/+/94773 that added generic > > logic for aligning videos. This will allow us to easily extend > > video_quality_analysis with new sophisticated video quality metrics. > > Also, we can use any kind of video that does not necessarily need to > > contain bar codes. Removing the need to decode barcodes also leads to a > > big speedup for the tests. > > > > Bug: webrtc:9642 > > Change-Id: I74b0d630b3e1ed44781ad024115ded3143e28f50 > > Reviewed-on: https://webrtc-review.googlesource.com/94845 > > Reviewed-by: Paulina Hensman <phensman@webrtc.org> > > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#24423} > > TBR=phensman@webrtc.org,phoglund@webrtc.org > > Bug: webrtc:9642 > Change-Id: Id8d129ce103284504c67690f8363c03eaae3eee7 > Reviewed-on: https://webrtc-review.googlesource.com/96000 > Reviewed-by: Magnus Jedvert <magjed@webrtc.org> > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24429} TBR=phensman,phoglund Bug: webrtc:9642 Change-Id: Ic248b7831ae148251a1a4ebeec5d154286f91a0a Reviewed-on: https://webrtc-review.googlesource.com/98080 Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24583}
2018-09-05 16:11:48 +02:00
* --test_file_ref=<name_of_file> --width=<frame_width> --height=<frame_height>
*/
int main(int argc, char* argv[]) {
absl::ParseCommandLine(argc, argv);
int width = absl::GetFlag(FLAGS_width);
int height = absl::GetFlag(FLAGS_height);
const std::string reference_file_name = absl::GetFlag(FLAGS_reference_file);
const std::string test_file_name = absl::GetFlag(FLAGS_test_file);
Reland "Reland "Update video_quality_analysis to align videos instead of using barcodes"" This is a reland of 9bb55fc09b6bfa00cba7779c37ad6c39b4206f7a Original change's description: > Reland "Update video_quality_analysis to align videos instead of using barcodes" > > This is a reland of d65e143801a7aaa9affdb939ea836aec1955cdcc > > The binary for frame_analyzer.cpp is precompiled and stored in the cloud, so it > won't automatically pick up change to the source file. Therefore, restore all > old code to be backwards compatible. > > Original change's description: > > Update video_quality_analysis to align videos instead of using barcodes > > > > This CL is a follow-up to the previous CL > > https://webrtc-review.googlesource.com/c/src/+/94773 that added generic > > logic for aligning videos. This will allow us to easily extend > > video_quality_analysis with new sophisticated video quality metrics. > > Also, we can use any kind of video that does not necessarily need to > > contain bar codes. Removing the need to decode barcodes also leads to a > > big speedup for the tests. > > > > Bug: webrtc:9642 > > Change-Id: I74b0d630b3e1ed44781ad024115ded3143e28f50 > > Reviewed-on: https://webrtc-review.googlesource.com/94845 > > Reviewed-by: Paulina Hensman <phensman@webrtc.org> > > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#24423} > > TBR=phensman@webrtc.org,phoglund@webrtc.org > > Bug: webrtc:9642 > Change-Id: Id8d129ce103284504c67690f8363c03eaae3eee7 > Reviewed-on: https://webrtc-review.googlesource.com/96000 > Reviewed-by: Magnus Jedvert <magjed@webrtc.org> > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24429} TBR=phensman,phoglund Bug: webrtc:9642 Change-Id: Ic248b7831ae148251a1a4ebeec5d154286f91a0a Reviewed-on: https://webrtc-review.googlesource.com/98080 Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24583}
2018-09-05 16:11:48 +02:00
// .yuv files require explicit resolution.
if ((absl::EndsWith(reference_file_name, ".yuv") ||
absl::EndsWith(test_file_name, ".yuv")) &&
Reland "Reland "Update video_quality_analysis to align videos instead of using barcodes"" This is a reland of 9bb55fc09b6bfa00cba7779c37ad6c39b4206f7a Original change's description: > Reland "Update video_quality_analysis to align videos instead of using barcodes" > > This is a reland of d65e143801a7aaa9affdb939ea836aec1955cdcc > > The binary for frame_analyzer.cpp is precompiled and stored in the cloud, so it > won't automatically pick up change to the source file. Therefore, restore all > old code to be backwards compatible. > > Original change's description: > > Update video_quality_analysis to align videos instead of using barcodes > > > > This CL is a follow-up to the previous CL > > https://webrtc-review.googlesource.com/c/src/+/94773 that added generic > > logic for aligning videos. This will allow us to easily extend > > video_quality_analysis with new sophisticated video quality metrics. > > Also, we can use any kind of video that does not necessarily need to > > contain bar codes. Removing the need to decode barcodes also leads to a > > big speedup for the tests. > > > > Bug: webrtc:9642 > > Change-Id: I74b0d630b3e1ed44781ad024115ded3143e28f50 > > Reviewed-on: https://webrtc-review.googlesource.com/94845 > > Reviewed-by: Paulina Hensman <phensman@webrtc.org> > > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#24423} > > TBR=phensman@webrtc.org,phoglund@webrtc.org > > Bug: webrtc:9642 > Change-Id: Id8d129ce103284504c67690f8363c03eaae3eee7 > Reviewed-on: https://webrtc-review.googlesource.com/96000 > Reviewed-by: Magnus Jedvert <magjed@webrtc.org> > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24429} TBR=phensman,phoglund Bug: webrtc:9642 Change-Id: Ic248b7831ae148251a1a4ebeec5d154286f91a0a Reviewed-on: https://webrtc-review.googlesource.com/98080 Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24583}
2018-09-05 16:11:48 +02:00
(width <= 0 || height <= 0)) {
fprintf(stderr,
"Error: You need to specify width and height when using .yuv "
"files\n");
return -1;
}
webrtc::test::ResultsContainer results;
Reland "Update video_quality_analysis to align videos instead of using barcodes" This is a reland of d65e143801a7aaa9affdb939ea836aec1955cdcc The binary for frame_analyzer.cpp is precompiled and stored in the cloud, so it won't automatically pick up change to the source file. Therefore, restore all old code to be backwards compatible. Original change's description: > Update video_quality_analysis to align videos instead of using barcodes > > This CL is a follow-up to the previous CL > https://webrtc-review.googlesource.com/c/src/+/94773 that added generic > logic for aligning videos. This will allow us to easily extend > video_quality_analysis with new sophisticated video quality metrics. > Also, we can use any kind of video that does not necessarily need to > contain bar codes. Removing the need to decode barcodes also leads to a > big speedup for the tests. > > Bug: webrtc:9642 > Change-Id: I74b0d630b3e1ed44781ad024115ded3143e28f50 > Reviewed-on: https://webrtc-review.googlesource.com/94845 > Reviewed-by: Paulina Hensman <phensman@webrtc.org> > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24423} TBR=phensman@webrtc.org,phoglund@webrtc.org Bug: webrtc:9642 Change-Id: Id8d129ce103284504c67690f8363c03eaae3eee7 Reviewed-on: https://webrtc-review.googlesource.com/96000 Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24429}
2018-08-24 14:56:03 +02:00
rtc::scoped_refptr<webrtc::test::Video> reference_video =
Reland "Reland "Update video_quality_analysis to align videos instead of using barcodes"" This is a reland of 9bb55fc09b6bfa00cba7779c37ad6c39b4206f7a Original change's description: > Reland "Update video_quality_analysis to align videos instead of using barcodes" > > This is a reland of d65e143801a7aaa9affdb939ea836aec1955cdcc > > The binary for frame_analyzer.cpp is precompiled and stored in the cloud, so it > won't automatically pick up change to the source file. Therefore, restore all > old code to be backwards compatible. > > Original change's description: > > Update video_quality_analysis to align videos instead of using barcodes > > > > This CL is a follow-up to the previous CL > > https://webrtc-review.googlesource.com/c/src/+/94773 that added generic > > logic for aligning videos. This will allow us to easily extend > > video_quality_analysis with new sophisticated video quality metrics. > > Also, we can use any kind of video that does not necessarily need to > > contain bar codes. Removing the need to decode barcodes also leads to a > > big speedup for the tests. > > > > Bug: webrtc:9642 > > Change-Id: I74b0d630b3e1ed44781ad024115ded3143e28f50 > > Reviewed-on: https://webrtc-review.googlesource.com/94845 > > Reviewed-by: Paulina Hensman <phensman@webrtc.org> > > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#24423} > > TBR=phensman@webrtc.org,phoglund@webrtc.org > > Bug: webrtc:9642 > Change-Id: Id8d129ce103284504c67690f8363c03eaae3eee7 > Reviewed-on: https://webrtc-review.googlesource.com/96000 > Reviewed-by: Magnus Jedvert <magjed@webrtc.org> > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24429} TBR=phensman,phoglund Bug: webrtc:9642 Change-Id: Ic248b7831ae148251a1a4ebeec5d154286f91a0a Reviewed-on: https://webrtc-review.googlesource.com/98080 Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24583}
2018-09-05 16:11:48 +02:00
webrtc::test::OpenYuvOrY4mFile(reference_file_name, width, height);
rtc::scoped_refptr<webrtc::test::Video> test_video =
Reland "Reland "Update video_quality_analysis to align videos instead of using barcodes"" This is a reland of 9bb55fc09b6bfa00cba7779c37ad6c39b4206f7a Original change's description: > Reland "Update video_quality_analysis to align videos instead of using barcodes" > > This is a reland of d65e143801a7aaa9affdb939ea836aec1955cdcc > > The binary for frame_analyzer.cpp is precompiled and stored in the cloud, so it > won't automatically pick up change to the source file. Therefore, restore all > old code to be backwards compatible. > > Original change's description: > > Update video_quality_analysis to align videos instead of using barcodes > > > > This CL is a follow-up to the previous CL > > https://webrtc-review.googlesource.com/c/src/+/94773 that added generic > > logic for aligning videos. This will allow us to easily extend > > video_quality_analysis with new sophisticated video quality metrics. > > Also, we can use any kind of video that does not necessarily need to > > contain bar codes. Removing the need to decode barcodes also leads to a > > big speedup for the tests. > > > > Bug: webrtc:9642 > > Change-Id: I74b0d630b3e1ed44781ad024115ded3143e28f50 > > Reviewed-on: https://webrtc-review.googlesource.com/94845 > > Reviewed-by: Paulina Hensman <phensman@webrtc.org> > > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#24423} > > TBR=phensman@webrtc.org,phoglund@webrtc.org > > Bug: webrtc:9642 > Change-Id: Id8d129ce103284504c67690f8363c03eaae3eee7 > Reviewed-on: https://webrtc-review.googlesource.com/96000 > Reviewed-by: Magnus Jedvert <magjed@webrtc.org> > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24429} TBR=phensman,phoglund Bug: webrtc:9642 Change-Id: Ic248b7831ae148251a1a4ebeec5d154286f91a0a Reviewed-on: https://webrtc-review.googlesource.com/98080 Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24583}
2018-09-05 16:11:48 +02:00
webrtc::test::OpenYuvOrY4mFile(test_file_name, width, height);
if (!reference_video || !test_video) {
fprintf(stderr, "Error opening video files\n");
return 1;
}
Reland "Reland "Update video_quality_analysis to align videos instead of using barcodes"" This is a reland of 9bb55fc09b6bfa00cba7779c37ad6c39b4206f7a Original change's description: > Reland "Update video_quality_analysis to align videos instead of using barcodes" > > This is a reland of d65e143801a7aaa9affdb939ea836aec1955cdcc > > The binary for frame_analyzer.cpp is precompiled and stored in the cloud, so it > won't automatically pick up change to the source file. Therefore, restore all > old code to be backwards compatible. > > Original change's description: > > Update video_quality_analysis to align videos instead of using barcodes > > > > This CL is a follow-up to the previous CL > > https://webrtc-review.googlesource.com/c/src/+/94773 that added generic > > logic for aligning videos. This will allow us to easily extend > > video_quality_analysis with new sophisticated video quality metrics. > > Also, we can use any kind of video that does not necessarily need to > > contain bar codes. Removing the need to decode barcodes also leads to a > > big speedup for the tests. > > > > Bug: webrtc:9642 > > Change-Id: I74b0d630b3e1ed44781ad024115ded3143e28f50 > > Reviewed-on: https://webrtc-review.googlesource.com/94845 > > Reviewed-by: Paulina Hensman <phensman@webrtc.org> > > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#24423} > > TBR=phensman@webrtc.org,phoglund@webrtc.org > > Bug: webrtc:9642 > Change-Id: Id8d129ce103284504c67690f8363c03eaae3eee7 > Reviewed-on: https://webrtc-review.googlesource.com/96000 > Reviewed-by: Magnus Jedvert <magjed@webrtc.org> > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24429} TBR=phensman,phoglund Bug: webrtc:9642 Change-Id: Ic248b7831ae148251a1a4ebeec5d154286f91a0a Reviewed-on: https://webrtc-review.googlesource.com/98080 Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24583}
2018-09-05 16:11:48 +02:00
const std::vector<size_t> matching_indices =
webrtc::test::FindMatchingFrameIndices(reference_video, test_video);
// Align the reference video both temporally and geometrically. I.e. align the
// frames to match up in order to the test video, and align a crop region of
// the reference video to match up to the test video.
const rtc::scoped_refptr<webrtc::test::Video> aligned_reference_video =
AdjustCropping(ReorderVideo(reference_video, matching_indices),
test_video);
// Calculate if there is any systematic color difference between the reference
// and test video.
const webrtc::test::ColorTransformationMatrix color_transformation =
CalculateColorTransformationMatrix(aligned_reference_video, test_video);
char buf[256];
webrtc::SimpleStringBuilder string_builder(buf);
for (int i = 0; i < 3; ++i) {
string_builder << "\n";
for (int j = 0; j < 4; ++j)
string_builder.AppendFormat("%6.2f ", color_transformation[i][j]);
}
printf("Adjusting test video with color transformation: %s\n",
string_builder.str());
// Adjust all frames in the test video with the calculated color
// transformation.
const rtc::scoped_refptr<webrtc::test::Video> color_adjusted_test_video =
AdjustColors(color_transformation, test_video);
results.frames = webrtc::test::RunAnalysis(
aligned_reference_video, color_adjusted_test_video, matching_indices);
Reland "Reland "Update video_quality_analysis to align videos instead of using barcodes"" This is a reland of 9bb55fc09b6bfa00cba7779c37ad6c39b4206f7a Original change's description: > Reland "Update video_quality_analysis to align videos instead of using barcodes" > > This is a reland of d65e143801a7aaa9affdb939ea836aec1955cdcc > > The binary for frame_analyzer.cpp is precompiled and stored in the cloud, so it > won't automatically pick up change to the source file. Therefore, restore all > old code to be backwards compatible. > > Original change's description: > > Update video_quality_analysis to align videos instead of using barcodes > > > > This CL is a follow-up to the previous CL > > https://webrtc-review.googlesource.com/c/src/+/94773 that added generic > > logic for aligning videos. This will allow us to easily extend > > video_quality_analysis with new sophisticated video quality metrics. > > Also, we can use any kind of video that does not necessarily need to > > contain bar codes. Removing the need to decode barcodes also leads to a > > big speedup for the tests. > > > > Bug: webrtc:9642 > > Change-Id: I74b0d630b3e1ed44781ad024115ded3143e28f50 > > Reviewed-on: https://webrtc-review.googlesource.com/94845 > > Reviewed-by: Paulina Hensman <phensman@webrtc.org> > > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > > Cr-Commit-Position: refs/heads/master@{#24423} > > TBR=phensman@webrtc.org,phoglund@webrtc.org > > Bug: webrtc:9642 > Change-Id: Id8d129ce103284504c67690f8363c03eaae3eee7 > Reviewed-on: https://webrtc-review.googlesource.com/96000 > Reviewed-by: Magnus Jedvert <magjed@webrtc.org> > Reviewed-by: Patrik Höglund <phoglund@webrtc.org> > Commit-Queue: Magnus Jedvert <magjed@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#24429} TBR=phensman,phoglund Bug: webrtc:9642 Change-Id: Ic248b7831ae148251a1a4ebeec5d154286f91a0a Reviewed-on: https://webrtc-review.googlesource.com/98080 Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24583}
2018-09-05 16:11:48 +02:00
const std::vector<webrtc::test::Cluster> clusters =
webrtc::test::CalculateFrameClusters(matching_indices);
results.max_repeated_frames = webrtc::test::GetMaxRepeatedFrames(clusters);
results.max_skipped_frames = webrtc::test::GetMaxSkippedFrames(clusters);
results.total_skipped_frames =
webrtc::test::GetTotalNumberOfSkippedFrames(clusters);
results.decode_errors_ref = 0;
results.decode_errors_test = 0;
webrtc::test::PrintAnalysisResults(absl::GetFlag(FLAGS_label), results,
*webrtc::test::GetGlobalMetricsLogger());
std::vector<std::unique_ptr<webrtc::test::MetricsExporter>> exporters;
exporters.push_back(std::make_unique<webrtc::test::StdoutMetricsExporter>());
std::string chartjson_result_file =
absl::GetFlag(FLAGS_chartjson_result_file);
if (!chartjson_result_file.empty()) {
exporters.push_back(
std::make_unique<webrtc::test::ChromePerfDashboardMetricsExporter>(
chartjson_result_file));
}
if (!webrtc::test::ExportPerfMetric(*webrtc::test::GetGlobalMetricsLogger(),
std::move(exporters))) {
return 1;
}
std::string aligned_output_file = absl::GetFlag(FLAGS_aligned_output_file);
if (!aligned_output_file.empty()) {
webrtc::test::WriteVideoToFile(aligned_reference_video, aligned_output_file,
/*fps=*/30);
}
std::string yuv_directory = absl::GetFlag(FLAGS_yuv_directory);
if (!yuv_directory.empty()) {
webrtc::test::WriteVideoToFile(aligned_reference_video,
JoinFilename(yuv_directory, "ref.yuv"),
/*fps=*/30);
webrtc::test::WriteVideoToFile(color_adjusted_test_video,
JoinFilename(yuv_directory, "test.yuv"),
/*fps=*/30);
}
return 0;
}