Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Unified Diff: webrtc/video/video_quality_test.cc

Issue 2976373002: Report minimum PSNR in VideoQualityTest and save corresponding frame to file (Closed)
Patch Set: cleanup Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/video_quality_test.cc
diff --git a/webrtc/video/video_quality_test.cc b/webrtc/video/video_quality_test.cc
index 1719595d3a7e2fa3094ffae43918d8b7306a92ed..aa5ff7121d9359e378cace1941a080e480a6a2d1 100644
--- a/webrtc/video/video_quality_test.cc
+++ b/webrtc/video/video_quality_test.cc
@@ -45,6 +45,7 @@
#include "webrtc/test/run_loop.h"
#include "webrtc/test/statistics.h"
#include "webrtc/test/testsupport/fileutils.h"
+#include "webrtc/test/testsupport/frame_writer.h"
#include "webrtc/test/vcm_capturer.h"
#include "webrtc/test/video_renderer.h"
#include "webrtc/voice_engine/include/voe_base.h"
@@ -803,6 +804,11 @@ class VideoAnalyzer : public PacketReceiver,
PrintResult("fec_bitrate", fec_bitrate_bps_, " bps");
PrintResult("send_bandwidth", send_bandwidth_bps_, " bps");
+ if (worst_frame_) {
+ printf("RESULT min_psnr: %s = %lf dB\n", test_label_.c_str(),
+ worst_frame_->psnr);
+ }
+
if (receive_stream_ != nullptr) {
PrintResult("decode_time", decode_time_ms_, " ms");
}
@@ -818,6 +824,29 @@ class VideoAnalyzer : public PacketReceiver,
// will be flaky.
PrintResult("memory_usage", memory_usage_, " bytes");
#endif
+ // TODO(ilnik): enable frame writing for android, once jpeg frame writer
+ // is implemented.
+
+#if !defined(WEBRTC_ANDROID)
+ if (worst_frame_) {
+ test::Y4mFrameWriterImpl frame_writer(test_label_ + ".y4m",
stefan-webrtc 2017/08/22 11:32:18 Isn't it better to write this to some directory ot
ilnik 2017/08/22 12:07:42 Yes, this problem is acknowledged. As Erik stated,
+ worst_frame_->frame.width(),
+ worst_frame_->frame.height(), 1);
+ bool res = frame_writer.Init();
+ RTC_DCHECK(res);
+ size_t length =
+ CalcBufferSize(VideoType::kI420, worst_frame_->frame.width(),
+ worst_frame_->frame.height());
+ rtc::Buffer extracted_buffer(length);
+ size_t extracted_length =
+ ExtractBuffer(worst_frame_->frame.video_frame_buffer()->ToI420(),
+ length, extracted_buffer.data());
+ RTC_DCHECK_EQ(extracted_length, frame_writer.FrameLength());
+ res = frame_writer.WriteFrame(extracted_buffer.data());
+ RTC_DCHECK(res);
+ frame_writer.Close();
+ }
+#endif
// Disable quality check for quick test, as quality checks may fail
// because too few samples were collected.
@@ -837,6 +866,11 @@ class VideoAnalyzer : public PacketReceiver,
}
rtc::CritScope crit(&comparison_lock_);
+
+ if (psnr >= 0.0 && (!worst_frame_ || worst_frame_->psnr > psnr)) {
+ worst_frame_.emplace(FrameWithPsnr{psnr, *comparison.render});
+ }
+
if (graph_data_output_file_) {
samples_.push_back(Sample(
comparison.dropped, comparison.input_time_ms, comparison.send_time_ms,
@@ -1040,6 +1074,14 @@ class VideoAnalyzer : public PacketReceiver,
test::Statistics send_bandwidth_bps_ GUARDED_BY(comparison_lock_);
test::Statistics memory_usage_ GUARDED_BY(comparison_lock_);
+ struct FrameWithPsnr {
+ double psnr;
+ VideoFrame frame;
+ };
+
+ // Rendered frame with worst PSNR is saved for further analysis.
+ rtc::Optional<FrameWithPsnr> worst_frame_ GUARDED_BY(comparison_lock_);
+
size_t last_fec_bytes_;
const int frames_to_process_;
« no previous file with comments | « webrtc/video/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698