blob: 78c39d0a54a4cf2da205648ed3391012b9f986fa [file] [log] [blame]
Kári Tristan Helgason169005d2018-05-22 13:34:14 +02001/*
2 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "api/test/videocodec_test_stats.h"
12
Jonas Olsson366a50c2018-09-06 13:41:30 +020013#include "rtc_base/strings/string_builder.h"
14
Kári Tristan Helgason169005d2018-05-22 13:34:14 +020015namespace webrtc {
16namespace test {
17
18std::string VideoCodecTestStats::FrameStatistics::ToString() const {
Jonas Olsson366a50c2018-09-06 13:41:30 +020019 rtc::StringBuilder ss;
Kári Tristan Helgason169005d2018-05-22 13:34:14 +020020 ss << "frame_number " << frame_number;
21 ss << " decoded_width " << decoded_width;
22 ss << " decoded_height " << decoded_height;
23 ss << " spatial_idx " << spatial_idx;
24 ss << " temporal_idx " << temporal_idx;
25 ss << " inter_layer_predicted " << inter_layer_predicted;
26 ss << " non_ref_for_inter_layer_pred " << non_ref_for_inter_layer_pred;
27 ss << " frame_type " << frame_type;
28 ss << " length_bytes " << length_bytes;
29 ss << " qp " << qp;
30 ss << " psnr " << psnr;
31 ss << " psnr_y " << psnr_y;
32 ss << " psnr_u " << psnr_u;
33 ss << " psnr_v " << psnr_v;
34 ss << " ssim " << ssim;
35 ss << " encode_time_us " << encode_time_us;
36 ss << " decode_time_us " << decode_time_us;
37 ss << " rtp_timestamp " << rtp_timestamp;
38 ss << " target_bitrate_kbps " << target_bitrate_kbps;
39 return ss.str();
40}
41
42VideoCodecTestStats::VideoStatistics::VideoStatistics() = default;
43VideoCodecTestStats::VideoStatistics::VideoStatistics(const VideoStatistics&) =
44 default;
45
46std::string VideoCodecTestStats::VideoStatistics::ToString(
47 std::string prefix) const {
Jonas Olsson366a50c2018-09-06 13:41:30 +020048 rtc::StringBuilder ss;
Kári Tristan Helgason169005d2018-05-22 13:34:14 +020049 ss << prefix << "target_bitrate_kbps: " << target_bitrate_kbps;
50 ss << "\n" << prefix << "input_framerate_fps: " << input_framerate_fps;
51 ss << "\n" << prefix << "spatial_idx: " << spatial_idx;
52 ss << "\n" << prefix << "temporal_idx: " << temporal_idx;
53 ss << "\n" << prefix << "width: " << width;
54 ss << "\n" << prefix << "height: " << height;
55 ss << "\n" << prefix << "length_bytes: " << length_bytes;
56 ss << "\n" << prefix << "bitrate_kbps: " << bitrate_kbps;
57 ss << "\n" << prefix << "framerate_fps: " << framerate_fps;
58 ss << "\n" << prefix << "enc_speed_fps: " << enc_speed_fps;
59 ss << "\n" << prefix << "dec_speed_fps: " << dec_speed_fps;
60 ss << "\n" << prefix << "avg_delay_sec: " << avg_delay_sec;
61 ss << "\n"
62 << prefix << "max_key_frame_delay_sec: " << max_key_frame_delay_sec;
63 ss << "\n"
64 << prefix << "max_delta_frame_delay_sec: " << max_delta_frame_delay_sec;
65 ss << "\n"
66 << prefix << "time_to_reach_target_bitrate_sec: "
67 << time_to_reach_target_bitrate_sec;
68 ss << "\n"
69 << prefix << "avg_key_frame_size_bytes: " << avg_key_frame_size_bytes;
70 ss << "\n"
71 << prefix << "avg_delta_frame_size_bytes: " << avg_delta_frame_size_bytes;
72 ss << "\n" << prefix << "avg_qp: " << avg_qp;
73 ss << "\n" << prefix << "avg_psnr: " << avg_psnr;
74 ss << "\n" << prefix << "min_psnr: " << min_psnr;
75 ss << "\n" << prefix << "avg_ssim: " << avg_ssim;
76 ss << "\n" << prefix << "min_ssim: " << min_ssim;
77 ss << "\n" << prefix << "num_input_frames: " << num_input_frames;
78 ss << "\n" << prefix << "num_encoded_frames: " << num_encoded_frames;
79 ss << "\n" << prefix << "num_decoded_frames: " << num_decoded_frames;
80 ss << "\n"
81 << prefix
82 << "num_dropped_frames: " << num_input_frames - num_encoded_frames;
83 ss << "\n" << prefix << "num_key_frames: " << num_key_frames;
84 ss << "\n" << prefix << "num_spatial_resizes: " << num_spatial_resizes;
85 ss << "\n" << prefix << "max_nalu_size_bytes: " << max_nalu_size_bytes;
86 return ss.str();
87}
88
89VideoCodecTestStats::FrameStatistics::FrameStatistics(size_t frame_number,
90 size_t rtp_timestamp)
91 : frame_number(frame_number), rtp_timestamp(rtp_timestamp) {}
92
93VideoCodecTestStats::FrameStatistics::FrameStatistics(
94 const FrameStatistics& rhs) = default;
95
96} // namespace test
97} // namespace webrtc