From 2486aeb194e3300a316bdff1dcb7ea2df827c132 Mon Sep 17 00:00:00 2001 From: Artem Titov Date: Tue, 10 Sep 2019 11:50:55 +0200 Subject: [PATCH] Add ability to disable PSNR and SSIM computation in DVQA Bug: webrtc:10138 Change-Id: I0216519db9d291f61a524bada9a77490957ad8c2 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/152285 Reviewed-by: Mirko Bonadei Reviewed-by: Ilya Nikolaevskiy Commit-Queue: Artem Titov Cr-Commit-Position: refs/heads/master@{#29131} --- .../e2e/analyzer/video/default_video_quality_analyzer.cc | 9 ++++++--- .../e2e/analyzer/video/default_video_quality_analyzer.h | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc index d6bef2b1d6..b11fb970df 100644 --- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc +++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.cc @@ -63,8 +63,10 @@ double RateCounter::GetEventsPerSecond() const { (event_last_time_ - event_first_time_).us() * kMicrosPerSecond; } -DefaultVideoQualityAnalyzer::DefaultVideoQualityAnalyzer() - : clock_(Clock::GetRealTimeClock()) {} +DefaultVideoQualityAnalyzer::DefaultVideoQualityAnalyzer( + bool heavy_metrics_computation_enabled) + : heavy_metrics_computation_enabled_(heavy_metrics_computation_enabled), + clock_(Clock::GetRealTimeClock()) {} DefaultVideoQualityAnalyzer::~DefaultVideoQualityAnalyzer() { Stop(); } @@ -497,7 +499,8 @@ void DefaultVideoQualityAnalyzer::ProcessComparison( // Perform expensive psnr and ssim calculations while not holding lock. double psnr = -1.0; double ssim = -1.0; - if (comparison.captured && !comparison.dropped) { + if (heavy_metrics_computation_enabled_ && comparison.captured && + !comparison.dropped) { psnr = I420PSNR(&*comparison.captured, &*comparison.rendered); ssim = I420SSIM(&*comparison.captured, &*comparison.rendered); } diff --git a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h index 8d7f8c0d8c..30efdf61e6 100644 --- a/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h +++ b/test/pc/e2e/analyzer/video/default_video_quality_analyzer.h @@ -122,7 +122,8 @@ struct VideoBweStats { class DefaultVideoQualityAnalyzer : public VideoQualityAnalyzerInterface { public: - DefaultVideoQualityAnalyzer(); + explicit DefaultVideoQualityAnalyzer( + bool heavy_metrics_computation_enabled = true); ~DefaultVideoQualityAnalyzer() override; void Start(std::string test_case_name, int max_threads_count) override; @@ -248,6 +249,7 @@ class DefaultVideoQualityAnalyzer : public VideoQualityAnalyzerInterface { std::string GetTestCaseName(const std::string& stream_label) const; Timestamp Now(); + const bool heavy_metrics_computation_enabled_; webrtc::Clock* const clock_; std::atomic next_frame_id_{0};