From 7041eed59f389036cdbd2bbb8a55004bbefea393 Mon Sep 17 00:00:00 2001 From: asapersson Date: Mon, 13 Feb 2017 01:37:57 -0800 Subject: [PATCH] Add possibility to plot statistics from integration tests per codec type/implementation. BUG=webrtc:6634 Review-Url: https://codereview.webrtc.org/2688863002 Cr-Commit-Position: refs/heads/master@{#16571} --- .../plot_videoprocessor_integrationtest.cc | 39 ++++++++++--------- .../codecs/test/plot_webrtc_test_logs.py | 17 +++++--- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc b/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc index b87286dc6d..9061495568 100644 --- a/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc +++ b/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc @@ -20,7 +20,7 @@ const bool kErrorConcealmentOn = false; const bool kDenoisingOn = false; const bool kFrameDropperOn = true; const bool kSpatialResizeOn = false; -const VideoCodecType kVideoCodecType = kVideoCodecVP8; +const VideoCodecType kVideoCodecType[] = {kVideoCodecVP8}; // Packet loss probability [0.0, 1.0]. const float kPacketLoss = 0.0f; @@ -31,30 +31,28 @@ const bool kVerboseLogging = true; // Tests for plotting statistics from logs. class PlotVideoProcessorIntegrationTest : public VideoProcessorIntegrationTest, - public ::testing::WithParamInterface<::testing::tuple> { + public ::testing::WithParamInterface< + ::testing::tuple> { protected: PlotVideoProcessorIntegrationTest() : bitrate_(::testing::get<0>(GetParam())), - framerate_(::testing::get<1>(GetParam())) {} + framerate_(::testing::get<1>(GetParam())), + codec_type_(::testing::get<2>(GetParam())) {} virtual ~PlotVideoProcessorIntegrationTest() {} - void RunTest(int bitrate, - int framerate, - int width, - int height, - const std::string& filename) { + void RunTest(int width, int height, const std::string& filename) { // Bitrate and frame rate profile. RateProfile rate_profile; SetRateProfilePars(&rate_profile, 0, // update_index - bitrate, framerate, + bitrate_, framerate_, 0); // frame_index_rate_update rate_profile.frame_index_rate_update[1] = kNbrFramesLong + 1; rate_profile.num_frames = kNbrFramesLong; // Codec/network settings. CodecConfigPars process_settings; - SetCodecParameters(&process_settings, kVideoCodecType, kPacketLoss, + SetCodecParameters(&process_settings, codec_type_, kPacketLoss, -1, // key_frame_interval 1, // num_temporal_layers kErrorConcealmentOn, kDenoisingOn, kFrameDropperOn, @@ -79,31 +77,34 @@ class PlotVideoProcessorIntegrationTest } const int bitrate_; const int framerate_; + const VideoCodecType codec_type_; }; -INSTANTIATE_TEST_CASE_P(CodecSettings, - PlotVideoProcessorIntegrationTest, - ::testing::Combine(::testing::ValuesIn(kBitrates), - ::testing::ValuesIn(kFps))); +INSTANTIATE_TEST_CASE_P( + CodecSettings, + PlotVideoProcessorIntegrationTest, + ::testing::Combine(::testing::ValuesIn(kBitrates), + ::testing::ValuesIn(kFps), + ::testing::ValuesIn(kVideoCodecType))); TEST_P(PlotVideoProcessorIntegrationTest, ProcessSQCif) { - RunTest(bitrate_, framerate_, 128, 96, "foreman_128x96"); + RunTest(128, 96, "foreman_128x96"); } TEST_P(PlotVideoProcessorIntegrationTest, ProcessQQVga) { - RunTest(bitrate_, framerate_, 160, 120, "foreman_160x120"); + RunTest(160, 120, "foreman_160x120"); } TEST_P(PlotVideoProcessorIntegrationTest, ProcessQCif) { - RunTest(bitrate_, framerate_, 176, 144, "foreman_176x144"); + RunTest(176, 144, "foreman_176x144"); } TEST_P(PlotVideoProcessorIntegrationTest, ProcessQVga) { - RunTest(bitrate_, framerate_, 320, 240, "foreman_320x240"); + RunTest(320, 240, "foreman_320x240"); } TEST_P(PlotVideoProcessorIntegrationTest, ProcessCif) { - RunTest(bitrate_, framerate_, 352, 288, "foreman_cif"); + RunTest(352, 288, "foreman_cif"); } } // namespace test diff --git a/webrtc/modules/video_coding/codecs/test/plot_webrtc_test_logs.py b/webrtc/modules/video_coding/codecs/test/plot_webrtc_test_logs.py index 85f7afb1e5..46b50ebc8b 100755 --- a/webrtc/modules/video_coding/codecs/test/plot_webrtc_test_logs.py +++ b/webrtc/modules/video_coding/codecs/test/plot_webrtc_test_logs.py @@ -56,10 +56,7 @@ SETTINGS = [ WIDTH, HEIGHT, FILENAME, - CODEC_TYPE, NUM_FRAMES, - ENCODER_IMPLEMENTATION_NAME, - DECODER_IMPLEMENTATION_NAME, ENCODE_TIME, DECODE_TIME, FRAME_SIZE, @@ -75,6 +72,13 @@ X_SETTINGS = [ BITRATE, # TODO(asapersson): Needs to be last. ] +# Settings, options for subplots. +SUBPLOT_SETTINGS = [ + CODEC_TYPE, + ENCODER_IMPLEMENTATION_NAME, + DECODER_IMPLEMENTATION_NAME, +] + X_SETTINGS + # Results. RESULTS = [ PSNR, @@ -88,7 +92,7 @@ RESULTS = [ AVG_NON_KEY_FRAME_SIZE, ] -METRICS_TO_PARSE = SETTINGS + X_SETTINGS + RESULTS +METRICS_TO_PARSE = SETTINGS + SUBPLOT_SETTINGS + RESULTS Y_METRICS = [res[1] for res in RESULTS] @@ -393,8 +397,9 @@ def main(): resolutions = ParseSetting(filename, WIDTH[1]) idx = GetIdx("Select metric for x-axis:\n%s" % ToString(X_SETTINGS)) if X_SETTINGS[idx] == BITRATE: - idx = GetIdx("Plot per:\n%s" % ToStringWithoutMetric(X_SETTINGS, BITRATE)) - idx_setting = METRICS_TO_PARSE.index(X_SETTINGS[idx]) + idx = GetIdx("Plot per:\n%s" % ToStringWithoutMetric(SUBPLOT_SETTINGS, + BITRATE)) + idx_setting = METRICS_TO_PARSE.index(SUBPLOT_SETTINGS[idx]) # Plot one metric. One subplot for each resolution. # Per subplot: metric vs bitrate (per setting). setting1 = WIDTH[1]