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 454539a65d..80728f5a4d 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 @@ -34,6 +34,7 @@ CORES = ('#CPU cores used', 'CPU cores used') DENOISING = ('Denoising', 'denoising') RESILIENCE = ('Resilience', 'resilience') ERROR_CONCEALMENT = ('Error concealment', 'error concealment') +QP = ('Average QP', 'avg QP') PSNR = ('PSNR avg', 'PSNR (dB)') SSIM = ('SSIM avg', 'SSIM') ENC_BITRATE = ('Encoding bitrate', 'encoded bitrate (kbps)') @@ -88,6 +89,7 @@ RESULTS = [ NUM_FRAMES_TO_TARGET, ENCODE_TIME_AVG, DECODE_TIME_AVG, + QP, AVG_KEY_FRAME_SIZE, AVG_NON_KEY_FRAME_SIZE, ] diff --git a/webrtc/modules/video_coding/codecs/test/stats.cc b/webrtc/modules/video_coding/codecs/test/stats.cc index 478b2f4901..31d9f3166d 100644 --- a/webrtc/modules/video_coding/codecs/test/stats.cc +++ b/webrtc/modules/video_coding/codecs/test/stats.cc @@ -27,6 +27,7 @@ FrameStatistic::FrameStatistic() decode_return_code(0), encode_time_in_us(0), decode_time_in_us(0), + qp(-1), frame_number(0), packets_dropped(0), total_packets(0), @@ -72,6 +73,8 @@ void Stats::PrintSummary() { // Calculate min, max, average and total encoding time int total_encoding_time_in_us = 0; int total_decoding_time_in_us = 0; + int total_qp = 0; + int total_qp_count = 0; size_t total_encoded_frames_lengths = 0; size_t total_encoded_key_frames_lengths = 0; size_t total_encoded_nonkey_frames_lengths = 0; @@ -89,6 +92,10 @@ void Stats::PrintSummary() { total_encoded_nonkey_frames_lengths += it->encoded_frame_length_in_bytes; nbr_nonkeyframes++; } + if (it->qp >= 0) { + total_qp += it->qp; + ++total_qp_count; + } } FrameStatisticsIterator frame; @@ -170,6 +177,9 @@ void Stats::PrintSummary() { printf(" Max bit rate: %7d kbps (frame %d)\n", frame->bit_rate_in_kbps, frame->frame_number); + int avg_qp = (total_qp_count > 0) ? (total_qp / total_qp_count) : -1; + printf("Average QP: %d\n", avg_qp); + printf("\n"); printf("Total encoding time : %7d ms.\n", total_encoding_time_in_us / 1000); printf("Total decoding time : %7d ms.\n", total_decoding_time_in_us / 1000); diff --git a/webrtc/modules/video_coding/codecs/test/stats.h b/webrtc/modules/video_coding/codecs/test/stats.h index 9092631ca1..d2dd303ee0 100644 --- a/webrtc/modules/video_coding/codecs/test/stats.h +++ b/webrtc/modules/video_coding/codecs/test/stats.h @@ -28,6 +28,7 @@ struct FrameStatistic { int decode_return_code; int encode_time_in_us; int decode_time_in_us; + int qp; int frame_number; // How many packets were discarded of the encoded frame data (if any). int packets_dropped; diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor.cc index c7c152d161..d6d2c0ca63 100644 --- a/webrtc/modules/video_coding/codecs/test/videoprocessor.cc +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor.cc @@ -314,6 +314,7 @@ void VideoProcessorImpl::FrameEncoded( stat.encoded_frame_length_in_bytes = encoded_image._length; stat.frame_number = frame_number; stat.frame_type = encoded_image._frameType; + stat.qp = encoded_image.qp_; stat.bit_rate_in_kbps = encoded_image._length * bit_rate_factor_; stat.total_packets = encoded_image._length / config_.networking_config.packet_size_in_bytes +