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 <mbonadei@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29131}
This commit is contained in:
Artem Titov
2019-09-10 11:50:55 +02:00
committed by Commit Bot
parent f7b1aa440d
commit 2486aeb194
2 changed files with 9 additions and 4 deletions

View File

@ -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);
}

View File

@ -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<uint16_t> next_frame_id_{0};