Use color aligning in video quality analysis tool
Bug: webrtc:9642 Change-Id: I217e054c20f26cf788dd97f42e7e4ade1a879fe7 Reviewed-on: https://webrtc-review.googlesource.com/c/98980 Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25209}
This commit is contained in:

committed by
Commit Bot

parent
3e7b7b154b
commit
3100fc1f05
@ -13,6 +13,10 @@
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "rtc_tools/frame_analyzer/video_color_aligner.h"
|
||||
#include "rtc_tools/frame_analyzer/video_temporal_aligner.h"
|
||||
#include "test/testsupport/perf_test.h"
|
||||
#include "third_party/libyuv/include/libyuv/compare.h"
|
||||
#include "third_party/libyuv/include/libyuv/convert.h"
|
||||
@ -55,17 +59,32 @@ std::vector<AnalysisResult> RunAnalysis(
|
||||
const rtc::scoped_refptr<webrtc::test::Video>& reference_video,
|
||||
const rtc::scoped_refptr<webrtc::test::Video>& test_video,
|
||||
const std::vector<size_t>& test_frame_indices) {
|
||||
std::vector<AnalysisResult> results;
|
||||
for (size_t i = 0; i < test_frame_indices.size(); ++i) {
|
||||
// Ignore duplicated frames in the test video.
|
||||
if (i > 0 && test_frame_indices[i] == test_frame_indices[i - 1])
|
||||
continue;
|
||||
const rtc::scoped_refptr<Video> temporally_aligned_reference_video =
|
||||
ReorderVideo(reference_video, test_frame_indices);
|
||||
|
||||
const ColorTransformationMatrix color_transformation =
|
||||
CalculateColorTransformationMatrix(temporally_aligned_reference_video,
|
||||
test_video);
|
||||
|
||||
char buf[256];
|
||||
rtc::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]);
|
||||
}
|
||||
RTC_LOG(LS_INFO) << "Adjusting test video with color transformation: "
|
||||
<< string_builder.str();
|
||||
|
||||
const rtc::scoped_refptr<Video> color_adjusted_test_video =
|
||||
AdjustColors(color_transformation, test_video);
|
||||
|
||||
std::vector<AnalysisResult> results;
|
||||
for (size_t i = 0; i < color_adjusted_test_video->number_of_frames(); ++i) {
|
||||
const rtc::scoped_refptr<I420BufferInterface>& test_frame =
|
||||
test_video->GetFrame(i);
|
||||
color_adjusted_test_video->GetFrame(i);
|
||||
const rtc::scoped_refptr<I420BufferInterface>& reference_frame =
|
||||
reference_video->GetFrame(test_frame_indices[i] %
|
||||
reference_video->number_of_frames());
|
||||
temporally_aligned_reference_video->GetFrame(i);
|
||||
|
||||
// Fill in the result struct.
|
||||
AnalysisResult result;
|
||||
|
@ -215,7 +215,7 @@ std::vector<size_t> FindMatchingFrameIndices(
|
||||
|
||||
rtc::scoped_refptr<Video> ReorderVideo(const rtc::scoped_refptr<Video>& video,
|
||||
const std::vector<size_t>& indices) {
|
||||
return new ReorderedVideo(video, indices);
|
||||
return new ReorderedVideo(new LoopingVideo(video), indices);
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<Video> GenerateAlignedReferenceVideo(
|
||||
@ -228,7 +228,7 @@ rtc::scoped_refptr<Video> GenerateAlignedReferenceVideo(
|
||||
rtc::scoped_refptr<Video> GenerateAlignedReferenceVideo(
|
||||
const rtc::scoped_refptr<Video>& reference_video,
|
||||
const std::vector<size_t>& indices) {
|
||||
return ReorderVideo(new LoopingVideo(reference_video), indices);
|
||||
return ReorderVideo(reference_video, indices);
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
|
Reference in New Issue
Block a user