Calculate bitrate and frame rate mismatches in video codec tests
Bug: webrtc:10812 Change-Id: I3408c0d7adefc37d088a5c6e10fce4f95aa1b668 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228943 Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34782}
This commit is contained in:
parent
773a222667
commit
1fdafaeb21
@ -91,6 +91,9 @@ std::map<std::string, std::string> VideoCodecTestStats::VideoStatistics::ToMap()
|
||||
map["max_delta_frame_delay_sec"] = std::to_string(max_delta_frame_delay_sec);
|
||||
map["time_to_reach_target_bitrate_sec"] =
|
||||
std::to_string(time_to_reach_target_bitrate_sec);
|
||||
map["avg_bitrate_mismatch_pct"] = std::to_string(avg_bitrate_mismatch_pct);
|
||||
map["avg_framerate_mismatch_pct"] =
|
||||
std::to_string(avg_framerate_mismatch_pct);
|
||||
map["avg_key_frame_size_bytes"] = std::to_string(avg_key_frame_size_bytes);
|
||||
map["avg_delta_frame_size_bytes"] =
|
||||
std::to_string(avg_delta_frame_size_bytes);
|
||||
|
||||
@ -105,6 +105,8 @@ class VideoCodecTestStats {
|
||||
float max_key_frame_delay_sec = 0.0f;
|
||||
float max_delta_frame_delay_sec = 0.0f;
|
||||
float time_to_reach_target_bitrate_sec = 0.0f;
|
||||
float avg_bitrate_mismatch_pct = 0.0f;
|
||||
float avg_framerate_mismatch_pct = 0.0f;
|
||||
|
||||
float avg_key_frame_size_bytes = 0.0f;
|
||||
float avg_delta_frame_size_bytes = 0.0f;
|
||||
|
||||
@ -202,6 +202,7 @@ VideoStatistics VideoCodecTestStatsImpl::SliceAndCalcVideoStatistic(
|
||||
const size_t target_bitrate_kbps =
|
||||
CalcLayerTargetBitrateKbps(first_frame_num, last_frame_num, spatial_idx,
|
||||
temporal_idx, aggregate_independent_layers);
|
||||
const size_t target_bitrate_bps = 1000 * target_bitrate_kbps;
|
||||
RTC_CHECK_GT(target_bitrate_kbps, 0); // We divide by `target_bitrate_kbps`.
|
||||
|
||||
for (size_t frame_num = first_frame_num; frame_num <= last_frame_num;
|
||||
@ -313,8 +314,8 @@ VideoStatistics VideoCodecTestStatsImpl::SliceAndCalcVideoStatistic(
|
||||
video_stat.temporal_idx = temporal_idx;
|
||||
|
||||
RTC_CHECK_GT(duration_sec, 0);
|
||||
video_stat.bitrate_kbps =
|
||||
static_cast<size_t>(8 * video_stat.length_bytes / 1000 / duration_sec);
|
||||
const float bitrate_bps = 8 * video_stat.length_bytes / duration_sec;
|
||||
video_stat.bitrate_kbps = static_cast<size_t>((bitrate_bps + 500) / 1000);
|
||||
video_stat.framerate_fps = video_stat.num_encoded_frames / duration_sec;
|
||||
|
||||
// http://bugs.webrtc.org/10400: On Windows, we only get millisecond
|
||||
@ -340,6 +341,12 @@ VideoStatistics VideoCodecTestStatsImpl::SliceAndCalcVideoStatistic(
|
||||
video_stat.max_key_frame_delay_sec = MaxDelaySec(key_frame_size_bytes);
|
||||
video_stat.max_delta_frame_delay_sec = MaxDelaySec(key_frame_size_bytes);
|
||||
|
||||
video_stat.avg_bitrate_mismatch_pct =
|
||||
100 * (bitrate_bps - target_bitrate_bps) / target_bitrate_bps;
|
||||
video_stat.avg_framerate_mismatch_pct =
|
||||
100 * (video_stat.framerate_fps - input_framerate_fps) /
|
||||
input_framerate_fps;
|
||||
|
||||
video_stat.avg_key_frame_size_bytes =
|
||||
key_frame_size_bytes.GetMean().value_or(0);
|
||||
video_stat.avg_delta_frame_size_bytes =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user