diff --git a/modules/video_coding/codecs/test/stats.cc b/modules/video_coding/codecs/test/stats.cc index 7024764a97..b07a1f77d0 100644 --- a/modules/video_coding/codecs/test/stats.cc +++ b/modules/video_coding/codecs/test/stats.cc @@ -66,6 +66,8 @@ void Stats::PrintSummary() const { return; } + printf("Encode/decode statistics\n==\n"); + // Calculate min, max, average and total encoding time. int total_encoding_time_us = 0; int total_decoding_time_us = 0; @@ -179,6 +181,7 @@ void Stats::PrintSummary() const { } int avg_qp = (total_qp_count > 0) ? (total_qp / total_qp_count) : -1; printf("Average QP: %d\n", avg_qp); + printf("\n"); } } // namespace test diff --git a/modules/video_coding/codecs/test/test_config.cc b/modules/video_coding/codecs/test/test_config.cc index d0d46de69b..bc7f063bbb 100644 --- a/modules/video_coding/codecs/test/test_config.cc +++ b/modules/video_coding/codecs/test/test_config.cc @@ -161,13 +161,12 @@ std::vector TestConfig::FrameTypeForFrame(int frame_idx) const { } std::string TestConfig::ToString() const { + std::string codec_type = CodecTypeToPayloadString(codec_settings.codecType); std::stringstream ss; - ss << "Video config:"; ss << "\n Filename : " << filename; ss << "\n # CPU cores used : " << NumberOfCores(); - ss << "\n Codec settings:"; - ss << "\n Codec type : " - << CodecTypeToPayloadString(codec_settings.codecType); + ss << "\n General:"; + ss << "\n Codec type : " << codec_type; ss << "\n Start bitrate : " << codec_settings.startBitrate << " kbps"; ss << "\n Max bitrate : " << codec_settings.maxBitrate << " kbps"; ss << "\n Min bitrate : " << codec_settings.minBitrate << " kbps"; @@ -175,6 +174,7 @@ std::string TestConfig::ToString() const { ss << "\n Height : " << codec_settings.height; ss << "\n Max frame rate : " << codec_settings.maxFramerate; ss << "\n QPmax : " << codec_settings.qpMax; + ss << "\n " << codec_type << " specific: "; ss << CodecSpecificToString(codec_settings); return ss.str(); } diff --git a/modules/video_coding/codecs/test/test_config.h b/modules/video_coding/codecs/test/test_config.h index 9c1ef1b68c..1b17305a0b 100644 --- a/modules/video_coding/codecs/test/test_config.h +++ b/modules/video_coding/codecs/test/test_config.h @@ -99,9 +99,6 @@ struct TestConfig { // Codec settings to use. webrtc::VideoCodec codec_settings; - // If printing of information to stdout shall be performed during processing. - bool verbose = true; - // Should hardware accelerated codecs be used? bool hw_encoder = false; bool hw_decoder = false; diff --git a/modules/video_coding/codecs/test/test_config_unittest.cc b/modules/video_coding/codecs/test/test_config_unittest.cc index c2253a2fd3..1083249683 100644 --- a/modules/video_coding/codecs/test/test_config_unittest.cc +++ b/modules/video_coding/codecs/test/test_config_unittest.cc @@ -126,10 +126,9 @@ TEST(TestConfig, ToString_Vp8) { config.codec_settings.VP8()->keyFrameInterval = 999; EXPECT_EQ( - "Video config:" "\n Filename : yuvfile" "\n # CPU cores used : 1" - "\n Codec settings:" + "\n General:" "\n Codec type : VP8" "\n Start bitrate : 400 kbps" "\n Max bitrate : 500 kbps" @@ -138,6 +137,7 @@ TEST(TestConfig, ToString_Vp8) { "\n Height : 180" "\n Max frame rate : 35" "\n QPmax : 66" + "\n VP8 specific: " "\n Complexity : 0" "\n Resilience : 0" "\n # temporal layers : 2" diff --git a/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc b/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc index 08b64deada..8baa963fcf 100644 --- a/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc +++ b/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc @@ -60,6 +60,7 @@ void VerifyQuality(const QualityMetricsResult& psnr_result, void PrintQualityMetrics(const QualityMetricsResult& psnr_result, const QualityMetricsResult& ssim_result) { + printf("Quality statistics\n==\n"); printf("PSNR avg: %f, min: %f\n", psnr_result.average, psnr_result.min); printf("SSIM avg: %f, min: %f\n", ssim_result.average, ssim_result.min); printf("\n"); @@ -133,6 +134,7 @@ class VideoProcessorIntegrationTest::CpuProcessTime final { void Print() const { if (config_.measure_cpu) { printf("CPU usage %%: %f\n", GetUsagePercent() / config_.NumberOfCores()); + printf("\n"); } } @@ -169,7 +171,7 @@ void VideoProcessorIntegrationTest::ProcessFramesAndMaybeVerify( SetUpAndInitObjects(&task_queue, rate_profiles[0].target_kbps, rate_profiles[0].input_fps, visualization_params); - MaybePrintSettings(); + PrintSettings(); // Set initial rates. int rate_update_index = 0; @@ -405,7 +407,7 @@ void VideoProcessorIntegrationTest::SetUpAndInitObjects( cpu_process_time_.reset(new CpuProcessTime(config_)); packet_manipulator_.reset(new PacketManipulatorImpl( - &packet_reader_, config_.networking_config, config_.verbose)); + &packet_reader_, config_.networking_config, false)); config_.codec_settings.minBitrate = 0; config_.codec_settings.startBitrate = initial_bitrate_kbps; @@ -528,46 +530,51 @@ void VideoProcessorIntegrationTest::PrintRateControlMetrics( int rate_update_index, const std::vector& num_dropped_frames, const std::vector& num_spatial_resizes) const { + if (rate_update_index == 0) { + printf("Rate control statistics\n==\n"); + } + printf("Rate update #%d:\n", rate_update_index); - printf(" Target bitrate : %d\n", target_.kbps); - printf(" Encoded bitrate : %f\n", actual_.kbps); - printf(" Frame rate : %d\n", target_.fps); - printf(" # processed frames : %d\n", actual_.num_frames); - printf(" # frames to convergence: %d\n", actual_.num_frames_to_hit_target); - printf(" # dropped frames : %d\n", + printf(" Target bitrate : %d\n", target_.kbps); + printf(" Encoded bitrate : %f\n", actual_.kbps); + printf(" Frame rate : %d\n", target_.fps); + printf(" # processed frames : %d\n", actual_.num_frames); + printf(" # frames to convergence : %d\n", actual_.num_frames_to_hit_target); + printf(" # dropped frames : %d\n", num_dropped_frames[rate_update_index]); - printf(" # spatial resizes : %d\n", + printf(" # spatial resizes : %d\n", num_spatial_resizes[rate_update_index]); - printf(" # key frames : %d\n", actual_.num_key_frames); - printf(" Key frame rate mismatch: %d\n", + printf(" # key frames : %d\n", actual_.num_key_frames); + printf(" Key frame rate mismatch : %d\n", actual_.KeyFrameSizeMismatchPercent()); const int num_temporal_layers = config_.NumberOfTemporalLayers(); for (int i = 0; i < num_temporal_layers; ++i) { printf(" Temporal layer #%d:\n", i); - printf(" Layer target bitrate : %f\n", target_.kbps_layer[i]); - printf(" Layer frame rate : %f\n", target_.fps_layer[i]); - printf(" Layer per frame bandwidth : %f\n", - target_.framesize_kbits_layer[i]); - printf(" Layer encoded bitrate : %f\n", actual_.kbps_layer[i]); - printf(" Layer frame size %% mismatch : %d\n", + printf(" TL%d target bitrate : %f\n", i, target_.kbps_layer[i]); + printf(" TL%d encoded bitrate : %f\n", i, actual_.kbps_layer[i]); + printf(" TL%d frame rate : %f\n", i, target_.fps_layer[i]); + printf(" TL%d # processed frames : %d\n", i, + actual_.num_frames_layer[i]); + printf(" TL%d frame size %% mismatch : %d\n", i, actual_.DeltaFrameSizeMismatchPercent(i)); - printf(" Layer bitrate %% mismatch : %d\n", + printf(" TL%d bitrate %% mismatch : %d\n", i, actual_.BitrateMismatchPercent(i, target_.kbps_layer[i])); - printf(" # processed frames per layer: %d\n", actual_.num_frames_layer[i]); + printf(" TL%d per-frame bitrate : %f\n", i, + target_.framesize_kbits_layer[i]); } printf("\n"); } -void VideoProcessorIntegrationTest::MaybePrintSettings() const { - if (!config_.verbose) - return; - +void VideoProcessorIntegrationTest::PrintSettings() const { + printf("VideoProcessor settings\n==\n"); + printf(" Total # of frames: %d", analysis_frame_reader_->NumberOfFrames()); printf("%s\n", config_.ToString().c_str()); - printf(" Total # of frames: %d\n", analysis_frame_reader_->NumberOfFrames()); + + printf("VideoProcessorIntegrationTest settings\n==\n"); const char* encoder_name = encoder_->ImplementationName(); - const char* decoder_name = decoder_->ImplementationName(); printf(" Encoder implementation name: %s\n", encoder_name); + const char* decoder_name = decoder_->ImplementationName(); printf(" Decoder implementation name: %s\n", decoder_name); if (strcmp(encoder_name, decoder_name) == 0) { printf(" Codec implementation name : %s_%s\n", diff --git a/modules/video_coding/codecs/test/videoprocessor_integrationtest.h b/modules/video_coding/codecs/test/videoprocessor_integrationtest.h index 511b7d9439..ccbe16eed1 100644 --- a/modules/video_coding/codecs/test/videoprocessor_integrationtest.h +++ b/modules/video_coding/codecs/test/videoprocessor_integrationtest.h @@ -183,7 +183,7 @@ class VideoProcessorIntegrationTest : public testing::Test { void VerifyBitstream(int frame_number, const BitstreamThresholds& bs_thresholds); - void MaybePrintSettings() const; + void PrintSettings() const; // Codecs. std::unique_ptr encoder_; diff --git a/modules/video_coding/codecs/test/videoprocessor_integrationtest_libvpx.cc b/modules/video_coding/codecs/test/videoprocessor_integrationtest_libvpx.cc index d7c383ed20..fb117f69d1 100644 --- a/modules/video_coding/codecs/test/videoprocessor_integrationtest_libvpx.cc +++ b/modules/video_coding/codecs/test/videoprocessor_integrationtest_libvpx.cc @@ -46,7 +46,6 @@ class VideoProcessorIntegrationTestLibvpx config_.networking_config.packet_loss_probability = 0.0; // Only allow encoder/decoder to use single core, for predictability. config_.use_single_core = true; - config_.verbose = false; config_.hw_encoder = false; config_.hw_decoder = false; config_.encoded_frame_checker = &qp_frame_checker_; diff --git a/modules/video_coding/codecs/test/videoprocessor_integrationtest_mediacodec.cc b/modules/video_coding/codecs/test/videoprocessor_integrationtest_mediacodec.cc index 0bdf347bb1..3cb078cbd4 100644 --- a/modules/video_coding/codecs/test/videoprocessor_integrationtest_mediacodec.cc +++ b/modules/video_coding/codecs/test/videoprocessor_integrationtest_mediacodec.cc @@ -34,7 +34,6 @@ class VideoProcessorIntegrationTestMediaCodec config_.output_filename = TempFilename(OutputPath(), "videoprocessor_integrationtest_mediacodec"); config_.num_frames = kForemanNumFrames; - config_.verbose = false; config_.hw_encoder = true; config_.hw_decoder = true; } diff --git a/modules/video_coding/codecs/test/videoprocessor_integrationtest_openh264.cc b/modules/video_coding/codecs/test/videoprocessor_integrationtest_openh264.cc index 85a776d011..d3122dafe7 100644 --- a/modules/video_coding/codecs/test/videoprocessor_integrationtest_openh264.cc +++ b/modules/video_coding/codecs/test/videoprocessor_integrationtest_openh264.cc @@ -43,7 +43,6 @@ class VideoProcessorIntegrationTestOpenH264 config_.networking_config.packet_loss_probability = 0.0; // Only allow encoder/decoder to use single core, for predictability. config_.use_single_core = true; - config_.verbose = false; config_.hw_encoder = false; config_.hw_decoder = false; config_.encoded_frame_checker = &h264_keyframe_checker_; diff --git a/modules/video_coding/codecs/test/videoprocessor_integrationtest_parameterized.cc b/modules/video_coding/codecs/test/videoprocessor_integrationtest_parameterized.cc index a4c3cbc7e7..b058e2992a 100644 --- a/modules/video_coding/codecs/test/videoprocessor_integrationtest_parameterized.cc +++ b/modules/video_coding/codecs/test/videoprocessor_integrationtest_parameterized.cc @@ -64,7 +64,6 @@ class VideoProcessorIntegrationTestParameterized TempFilename(OutputPath(), "plot_videoprocessor_integrationtest"); config_.use_single_core = kUseSingleCore; config_.measure_cpu = kMeasureCpu; - config_.verbose = true; config_.hw_encoder = hw_codec_; config_.hw_decoder = hw_codec_; config_.num_frames = kNumFrames; diff --git a/modules/video_coding/codecs/test/videoprocessor_integrationtest_videotoolbox.cc b/modules/video_coding/codecs/test/videoprocessor_integrationtest_videotoolbox.cc index 225624ce3b..7e139c626d 100644 --- a/modules/video_coding/codecs/test/videoprocessor_integrationtest_videotoolbox.cc +++ b/modules/video_coding/codecs/test/videoprocessor_integrationtest_videotoolbox.cc @@ -33,7 +33,6 @@ class VideoProcessorIntegrationTestVideoToolbox config_.output_filename = TempFilename( OutputPath(), "videoprocessor_integrationtest_videotoolbox"); config_.num_frames = kForemanNumFrames; - config_.verbose = false; config_.hw_encoder = true; config_.hw_decoder = true; config_.encoded_frame_checker = &h264_keyframe_checker_;