Remove verbose setting and reorder some print statements in VideoProcessor.

Always enabling verbose mode means about 100% more text is printed,
but this should not be a problem as the only time that we explicitly
look at the logs is when the bots are failing, or when we want to save
all output for plotting.

BUG=webrtc:8448

Change-Id: Ia5feab5220d047440d15cddb7d3fbca1c5a4aaf5
Reviewed-on: https://webrtc-review.googlesource.com/16140
Commit-Queue: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20461}
This commit is contained in:
Rasmus Brandt
2017-10-27 11:11:50 +02:00
committed by Commit Bot
parent fd9149f842
commit e4c6915b87
11 changed files with 42 additions and 40 deletions

View File

@ -66,6 +66,8 @@ void Stats::PrintSummary() const {
return; return;
} }
printf("Encode/decode statistics\n==\n");
// Calculate min, max, average and total encoding time. // Calculate min, max, average and total encoding time.
int total_encoding_time_us = 0; int total_encoding_time_us = 0;
int total_decoding_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; int avg_qp = (total_qp_count > 0) ? (total_qp / total_qp_count) : -1;
printf("Average QP: %d\n", avg_qp); printf("Average QP: %d\n", avg_qp);
printf("\n");
} }
} // namespace test } // namespace test

View File

@ -161,13 +161,12 @@ std::vector<FrameType> TestConfig::FrameTypeForFrame(int frame_idx) const {
} }
std::string TestConfig::ToString() const { std::string TestConfig::ToString() const {
std::string codec_type = CodecTypeToPayloadString(codec_settings.codecType);
std::stringstream ss; std::stringstream ss;
ss << "Video config:";
ss << "\n Filename : " << filename; ss << "\n Filename : " << filename;
ss << "\n # CPU cores used : " << NumberOfCores(); ss << "\n # CPU cores used : " << NumberOfCores();
ss << "\n Codec settings:"; ss << "\n General:";
ss << "\n Codec type : " ss << "\n Codec type : " << codec_type;
<< CodecTypeToPayloadString(codec_settings.codecType);
ss << "\n Start bitrate : " << codec_settings.startBitrate << " kbps"; ss << "\n Start bitrate : " << codec_settings.startBitrate << " kbps";
ss << "\n Max bitrate : " << codec_settings.maxBitrate << " kbps"; ss << "\n Max bitrate : " << codec_settings.maxBitrate << " kbps";
ss << "\n Min bitrate : " << codec_settings.minBitrate << " 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 Height : " << codec_settings.height;
ss << "\n Max frame rate : " << codec_settings.maxFramerate; ss << "\n Max frame rate : " << codec_settings.maxFramerate;
ss << "\n QPmax : " << codec_settings.qpMax; ss << "\n QPmax : " << codec_settings.qpMax;
ss << "\n " << codec_type << " specific: ";
ss << CodecSpecificToString(codec_settings); ss << CodecSpecificToString(codec_settings);
return ss.str(); return ss.str();
} }

View File

@ -99,9 +99,6 @@ struct TestConfig {
// Codec settings to use. // Codec settings to use.
webrtc::VideoCodec codec_settings; webrtc::VideoCodec codec_settings;
// If printing of information to stdout shall be performed during processing.
bool verbose = true;
// Should hardware accelerated codecs be used? // Should hardware accelerated codecs be used?
bool hw_encoder = false; bool hw_encoder = false;
bool hw_decoder = false; bool hw_decoder = false;

View File

@ -126,10 +126,9 @@ TEST(TestConfig, ToString_Vp8) {
config.codec_settings.VP8()->keyFrameInterval = 999; config.codec_settings.VP8()->keyFrameInterval = 999;
EXPECT_EQ( EXPECT_EQ(
"Video config:"
"\n Filename : yuvfile" "\n Filename : yuvfile"
"\n # CPU cores used : 1" "\n # CPU cores used : 1"
"\n Codec settings:" "\n General:"
"\n Codec type : VP8" "\n Codec type : VP8"
"\n Start bitrate : 400 kbps" "\n Start bitrate : 400 kbps"
"\n Max bitrate : 500 kbps" "\n Max bitrate : 500 kbps"
@ -138,6 +137,7 @@ TEST(TestConfig, ToString_Vp8) {
"\n Height : 180" "\n Height : 180"
"\n Max frame rate : 35" "\n Max frame rate : 35"
"\n QPmax : 66" "\n QPmax : 66"
"\n VP8 specific: "
"\n Complexity : 0" "\n Complexity : 0"
"\n Resilience : 0" "\n Resilience : 0"
"\n # temporal layers : 2" "\n # temporal layers : 2"

View File

@ -60,6 +60,7 @@ void VerifyQuality(const QualityMetricsResult& psnr_result,
void PrintQualityMetrics(const QualityMetricsResult& psnr_result, void PrintQualityMetrics(const QualityMetricsResult& psnr_result,
const QualityMetricsResult& ssim_result) { const QualityMetricsResult& ssim_result) {
printf("Quality statistics\n==\n");
printf("PSNR avg: %f, min: %f\n", psnr_result.average, psnr_result.min); 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("SSIM avg: %f, min: %f\n", ssim_result.average, ssim_result.min);
printf("\n"); printf("\n");
@ -133,6 +134,7 @@ class VideoProcessorIntegrationTest::CpuProcessTime final {
void Print() const { void Print() const {
if (config_.measure_cpu) { if (config_.measure_cpu) {
printf("CPU usage %%: %f\n", GetUsagePercent() / config_.NumberOfCores()); 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, SetUpAndInitObjects(&task_queue, rate_profiles[0].target_kbps,
rate_profiles[0].input_fps, visualization_params); rate_profiles[0].input_fps, visualization_params);
MaybePrintSettings(); PrintSettings();
// Set initial rates. // Set initial rates.
int rate_update_index = 0; int rate_update_index = 0;
@ -405,7 +407,7 @@ void VideoProcessorIntegrationTest::SetUpAndInitObjects(
cpu_process_time_.reset(new CpuProcessTime(config_)); cpu_process_time_.reset(new CpuProcessTime(config_));
packet_manipulator_.reset(new PacketManipulatorImpl( 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.minBitrate = 0;
config_.codec_settings.startBitrate = initial_bitrate_kbps; config_.codec_settings.startBitrate = initial_bitrate_kbps;
@ -528,46 +530,51 @@ void VideoProcessorIntegrationTest::PrintRateControlMetrics(
int rate_update_index, int rate_update_index,
const std::vector<int>& num_dropped_frames, const std::vector<int>& num_dropped_frames,
const std::vector<int>& num_spatial_resizes) const { const std::vector<int>& num_spatial_resizes) const {
if (rate_update_index == 0) {
printf("Rate control statistics\n==\n");
}
printf("Rate update #%d:\n", rate_update_index); printf("Rate update #%d:\n", rate_update_index);
printf(" Target bitrate : %d\n", target_.kbps); printf(" Target bitrate : %d\n", target_.kbps);
printf(" Encoded bitrate : %f\n", actual_.kbps); printf(" Encoded bitrate : %f\n", actual_.kbps);
printf(" Frame rate : %d\n", target_.fps); printf(" Frame rate : %d\n", target_.fps);
printf(" # processed frames : %d\n", actual_.num_frames); printf(" # processed frames : %d\n", actual_.num_frames);
printf(" # frames to convergence: %d\n", actual_.num_frames_to_hit_target); printf(" # frames to convergence : %d\n", actual_.num_frames_to_hit_target);
printf(" # dropped frames : %d\n", printf(" # dropped frames : %d\n",
num_dropped_frames[rate_update_index]); num_dropped_frames[rate_update_index]);
printf(" # spatial resizes : %d\n", printf(" # spatial resizes : %d\n",
num_spatial_resizes[rate_update_index]); num_spatial_resizes[rate_update_index]);
printf(" # key frames : %d\n", actual_.num_key_frames); printf(" # key frames : %d\n", actual_.num_key_frames);
printf(" Key frame rate mismatch: %d\n", printf(" Key frame rate mismatch : %d\n",
actual_.KeyFrameSizeMismatchPercent()); actual_.KeyFrameSizeMismatchPercent());
const int num_temporal_layers = config_.NumberOfTemporalLayers(); const int num_temporal_layers = config_.NumberOfTemporalLayers();
for (int i = 0; i < num_temporal_layers; ++i) { for (int i = 0; i < num_temporal_layers; ++i) {
printf(" Temporal layer #%d:\n", i); printf(" Temporal layer #%d:\n", i);
printf(" Layer target bitrate : %f\n", target_.kbps_layer[i]); printf(" TL%d target bitrate : %f\n", i, target_.kbps_layer[i]);
printf(" Layer frame rate : %f\n", target_.fps_layer[i]); printf(" TL%d encoded bitrate : %f\n", i, actual_.kbps_layer[i]);
printf(" Layer per frame bandwidth : %f\n", printf(" TL%d frame rate : %f\n", i, target_.fps_layer[i]);
target_.framesize_kbits_layer[i]); printf(" TL%d # processed frames : %d\n", i,
printf(" Layer encoded bitrate : %f\n", actual_.kbps_layer[i]); actual_.num_frames_layer[i]);
printf(" Layer frame size %% mismatch : %d\n", printf(" TL%d frame size %% mismatch : %d\n", i,
actual_.DeltaFrameSizeMismatchPercent(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])); 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"); printf("\n");
} }
void VideoProcessorIntegrationTest::MaybePrintSettings() const { void VideoProcessorIntegrationTest::PrintSettings() const {
if (!config_.verbose) printf("VideoProcessor settings\n==\n");
return; printf(" Total # of frames: %d", analysis_frame_reader_->NumberOfFrames());
printf("%s\n", config_.ToString().c_str()); 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* encoder_name = encoder_->ImplementationName();
const char* decoder_name = decoder_->ImplementationName();
printf(" Encoder implementation name: %s\n", encoder_name); printf(" Encoder implementation name: %s\n", encoder_name);
const char* decoder_name = decoder_->ImplementationName();
printf(" Decoder implementation name: %s\n", decoder_name); printf(" Decoder implementation name: %s\n", decoder_name);
if (strcmp(encoder_name, decoder_name) == 0) { if (strcmp(encoder_name, decoder_name) == 0) {
printf(" Codec implementation name : %s_%s\n", printf(" Codec implementation name : %s_%s\n",

View File

@ -183,7 +183,7 @@ class VideoProcessorIntegrationTest : public testing::Test {
void VerifyBitstream(int frame_number, void VerifyBitstream(int frame_number,
const BitstreamThresholds& bs_thresholds); const BitstreamThresholds& bs_thresholds);
void MaybePrintSettings() const; void PrintSettings() const;
// Codecs. // Codecs.
std::unique_ptr<VideoEncoder> encoder_; std::unique_ptr<VideoEncoder> encoder_;

View File

@ -46,7 +46,6 @@ class VideoProcessorIntegrationTestLibvpx
config_.networking_config.packet_loss_probability = 0.0; config_.networking_config.packet_loss_probability = 0.0;
// Only allow encoder/decoder to use single core, for predictability. // Only allow encoder/decoder to use single core, for predictability.
config_.use_single_core = true; config_.use_single_core = true;
config_.verbose = false;
config_.hw_encoder = false; config_.hw_encoder = false;
config_.hw_decoder = false; config_.hw_decoder = false;
config_.encoded_frame_checker = &qp_frame_checker_; config_.encoded_frame_checker = &qp_frame_checker_;

View File

@ -34,7 +34,6 @@ class VideoProcessorIntegrationTestMediaCodec
config_.output_filename = config_.output_filename =
TempFilename(OutputPath(), "videoprocessor_integrationtest_mediacodec"); TempFilename(OutputPath(), "videoprocessor_integrationtest_mediacodec");
config_.num_frames = kForemanNumFrames; config_.num_frames = kForemanNumFrames;
config_.verbose = false;
config_.hw_encoder = true; config_.hw_encoder = true;
config_.hw_decoder = true; config_.hw_decoder = true;
} }

View File

@ -43,7 +43,6 @@ class VideoProcessorIntegrationTestOpenH264
config_.networking_config.packet_loss_probability = 0.0; config_.networking_config.packet_loss_probability = 0.0;
// Only allow encoder/decoder to use single core, for predictability. // Only allow encoder/decoder to use single core, for predictability.
config_.use_single_core = true; config_.use_single_core = true;
config_.verbose = false;
config_.hw_encoder = false; config_.hw_encoder = false;
config_.hw_decoder = false; config_.hw_decoder = false;
config_.encoded_frame_checker = &h264_keyframe_checker_; config_.encoded_frame_checker = &h264_keyframe_checker_;

View File

@ -64,7 +64,6 @@ class VideoProcessorIntegrationTestParameterized
TempFilename(OutputPath(), "plot_videoprocessor_integrationtest"); TempFilename(OutputPath(), "plot_videoprocessor_integrationtest");
config_.use_single_core = kUseSingleCore; config_.use_single_core = kUseSingleCore;
config_.measure_cpu = kMeasureCpu; config_.measure_cpu = kMeasureCpu;
config_.verbose = true;
config_.hw_encoder = hw_codec_; config_.hw_encoder = hw_codec_;
config_.hw_decoder = hw_codec_; config_.hw_decoder = hw_codec_;
config_.num_frames = kNumFrames; config_.num_frames = kNumFrames;

View File

@ -33,7 +33,6 @@ class VideoProcessorIntegrationTestVideoToolbox
config_.output_filename = TempFilename( config_.output_filename = TempFilename(
OutputPath(), "videoprocessor_integrationtest_videotoolbox"); OutputPath(), "videoprocessor_integrationtest_videotoolbox");
config_.num_frames = kForemanNumFrames; config_.num_frames = kForemanNumFrames;
config_.verbose = false;
config_.hw_encoder = true; config_.hw_encoder = true;
config_.hw_decoder = true; config_.hw_decoder = true;
config_.encoded_frame_checker = &h264_keyframe_checker_; config_.encoded_frame_checker = &h264_keyframe_checker_;