From c528410d2c4a988ce2e8ca49e709c41ba1c744e8 Mon Sep 17 00:00:00 2001 From: Rasmus Brandt Date: Thu, 21 Mar 2019 12:06:30 +0100 Subject: [PATCH] Improve VideoCodecTest perf stats output. - Output verbose send stats before verbose recv stats. - Add |rate_profile_idx| to output names. - Only report encode framerate and keyframe size for the entire stream. - Add encoded bitrate/framerate stats per layer. Remove # dropped frames. - Add U/V quality stats (mainly to compare to HW codecs) Bug: webrtc:10349 Change-Id: I8f0d05e0fdf96ea998a06732462a080245b61221 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128614 Reviewed-by: Mirta Dvornicic Commit-Queue: Rasmus Brandt Cr-Commit-Position: refs/heads/master@{#27223} --- .../test/videocodec_test_fixture_impl.cc | 62 ++++++++++--------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc b/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc index f49b0ce361..0eaee37586 100644 --- a/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc +++ b/modules/video_coding/codecs/test/videocodec_test_fixture_impl.cc @@ -475,6 +475,11 @@ void VideoCodecTestFixtureImpl::AnalyzeAllFrames( : config_.num_frames - 1; RTC_CHECK(last_frame_num >= first_frame_num); + VideoStatistics send_stat = stats_.SliceAndCalcAggregatedVideoStatistic( + first_frame_num, last_frame_num); + printf("==> Send stats\n"); + printf("%s\n\n", send_stat.ToString("send_").c_str()); + std::vector layer_stats = stats_.SliceAndCalcLayerVideoStatistic(first_frame_num, last_frame_num); printf("==> Receive stats\n"); @@ -484,37 +489,38 @@ void VideoCodecTestFixtureImpl::AnalyzeAllFrames( // For perf dashboard. char modifier_buf[256]; rtc::SimpleStringBuilder modifier(modifier_buf); - modifier << "_sl" << layer_stat.spatial_idx << "tl" - << layer_stat.temporal_idx; - PrintResult("enc_speed", modifier.str(), config_.test_name, - layer_stat.enc_speed_fps, "fps", /*important=*/false); - PrintResult("dec_speed", modifier.str(), config_.test_name, - layer_stat.dec_speed_fps, "fps", /*important=*/false); - PrintResult("avg_key_frame_size", modifier.str(), config_.test_name, - layer_stat.avg_key_frame_size_bytes, "bytes", - /*important=*/false); - PrintResult("avg_delta_frame_size", modifier.str(), config_.test_name, - layer_stat.avg_delta_frame_size_bytes, "bytes", - /*important=*/false); - PrintResult("avg_qp", modifier.str(), config_.test_name, - layer_stat.avg_qp, "", /*important=*/false); - PrintResult("avg_psnr_y", modifier.str(), config_.test_name, - layer_stat.avg_psnr_y, "dB", /*important=*/false); - PrintResult("min_psnr", modifier.str(), config_.test_name, - layer_stat.min_psnr, "dB", /*important=*/false); - PrintResult("num_dropped_frames", modifier.str(), config_.test_name, - layer_stat.num_input_frames - layer_stat.num_encoded_frames, - "frames", /*important=*/false); - PrintResult("num_key_frames", modifier.str(), config_.test_name, - layer_stat.num_key_frames, "frames", /*important=*/false); + modifier << "_r" << rate_profile_idx << "_sl" << layer_stat.spatial_idx; + + auto PrintResultHelper = [&modifier, this](const std::string& measurement, + double value, + const std::string& units) { + PrintResult(measurement, modifier.str(), config_.test_name, value, + units, /*important=*/false); + }; + + if (layer_stat.temporal_idx == config_.NumberOfTemporalLayers() - 1) { + PrintResultHelper("enc_speed", layer_stat.enc_speed_fps, "fps"); + PrintResultHelper("avg_key_frame_size", + layer_stat.avg_key_frame_size_bytes, "bytes"); + PrintResultHelper("num_key_frames", layer_stat.num_key_frames, + "frames"); + printf("\n"); + } + + modifier << "tl" << layer_stat.temporal_idx; + PrintResultHelper("dec_speed", layer_stat.dec_speed_fps, "fps"); + PrintResultHelper("avg_delta_frame_size", + layer_stat.avg_delta_frame_size_bytes, "bytes"); + PrintResultHelper("bitrate", layer_stat.bitrate_kbps, "kbps"); + PrintResultHelper("framerate", layer_stat.framerate_fps, "fps"); + PrintResultHelper("avg_psnr_y", layer_stat.avg_psnr_y, "dB"); + PrintResultHelper("avg_psnr_u", layer_stat.avg_psnr_u, "dB"); + PrintResultHelper("avg_psnr_v", layer_stat.avg_psnr_v, "dB"); + PrintResultHelper("min_psnr_yuv", layer_stat.min_psnr, "dB"); + PrintResultHelper("avg_qp", layer_stat.avg_qp, ""); printf("\n"); } - VideoStatistics send_stat = stats_.SliceAndCalcAggregatedVideoStatistic( - first_frame_num, last_frame_num); - printf("==> Send stats\n"); - printf("%s\n", send_stat.ToString("send_").c_str()); - const RateControlThresholds* rc_threshold = rc_thresholds ? &(*rc_thresholds)[rate_profile_idx] : nullptr; const QualityThresholds* quality_threshold =