blob: 72522785cf08367ba0afa55bed4cc3cd72615a3a [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
13namespace webrtc {
14namespace test {
15
16std::string VideoCodecTestStats::FrameStatistics::ToString() const {
17 std::stringstream ss;
18 ss << "frame_number " << frame_number;
19 ss << " decoded_width " << decoded_width;
20 ss << " decoded_height " << decoded_height;
21 ss << " spatial_idx " << spatial_idx;
22 ss << " temporal_idx " << temporal_idx;
23 ss << " inter_layer_predicted " << inter_layer_predicted;
24 ss << " non_ref_for_inter_layer_pred " << non_ref_for_inter_layer_pred;
25 ss << " frame_type " << frame_type;
26 ss << " length_bytes " << length_bytes;
27 ss << " qp " << qp;
28 ss << " psnr " << psnr;
29 ss << " psnr_y " << psnr_y;
30 ss << " psnr_u " << psnr_u;
31 ss << " psnr_v " << psnr_v;
32 ss << " ssim " << ssim;
33 ss << " encode_time_us " << encode_time_us;
34 ss << " decode_time_us " << decode_time_us;
35 ss << " rtp_timestamp " << rtp_timestamp;
36 ss << " target_bitrate_kbps " << target_bitrate_kbps;
37 return ss.str();
38}
39
40VideoCodecTestStats::VideoStatistics::VideoStatistics() = default;
41VideoCodecTestStats::VideoStatistics::VideoStatistics(const VideoStatistics&) =
42 default;
43
44std::string VideoCodecTestStats::VideoStatistics::ToString(
45 std::string prefix) const {
46 std::stringstream ss;
47 ss << prefix << "target_bitrate_kbps: " << target_bitrate_kbps;
48 ss << "\n" << prefix << "input_framerate_fps: " << input_framerate_fps;
49 ss << "\n" << prefix << "spatial_idx: " << spatial_idx;
50 ss << "\n" << prefix << "temporal_idx: " << temporal_idx;
51 ss << "\n" << prefix << "width: " << width;
52 ss << "\n" << prefix << "height: " << height;
53 ss << "\n" << prefix << "length_bytes: " << length_bytes;
54 ss << "\n" << prefix << "bitrate_kbps: " << bitrate_kbps;
55 ss << "\n" << prefix << "framerate_fps: " << framerate_fps;
56 ss << "\n" << prefix << "enc_speed_fps: " << enc_speed_fps;
57 ss << "\n" << prefix << "dec_speed_fps: " << dec_speed_fps;
58 ss << "\n" << prefix << "avg_delay_sec: " << avg_delay_sec;
59 ss << "\n"
60 << prefix << "max_key_frame_delay_sec: " << max_key_frame_delay_sec;
61 ss << "\n"
62 << prefix << "max_delta_frame_delay_sec: " << max_delta_frame_delay_sec;
63 ss << "\n"
64 << prefix << "time_to_reach_target_bitrate_sec: "
65 << time_to_reach_target_bitrate_sec;
66 ss << "\n"
67 << prefix << "avg_key_frame_size_bytes: " << avg_key_frame_size_bytes;
68 ss << "\n"
69 << prefix << "avg_delta_frame_size_bytes: " << avg_delta_frame_size_bytes;
70 ss << "\n" << prefix << "avg_qp: " << avg_qp;
71 ss << "\n" << prefix << "avg_psnr: " << avg_psnr;
72 ss << "\n" << prefix << "min_psnr: " << min_psnr;
73 ss << "\n" << prefix << "avg_ssim: " << avg_ssim;
74 ss << "\n" << prefix << "min_ssim: " << min_ssim;
75 ss << "\n" << prefix << "num_input_frames: " << num_input_frames;
76 ss << "\n" << prefix << "num_encoded_frames: " << num_encoded_frames;
77 ss << "\n" << prefix << "num_decoded_frames: " << num_decoded_frames;
78 ss << "\n"
79 << prefix
80 << "num_dropped_frames: " << num_input_frames - num_encoded_frames;
81 ss << "\n" << prefix << "num_key_frames: " << num_key_frames;
82 ss << "\n" << prefix << "num_spatial_resizes: " << num_spatial_resizes;
83 ss << "\n" << prefix << "max_nalu_size_bytes: " << max_nalu_size_bytes;
84 return ss.str();
85}
86
87VideoCodecTestStats::FrameStatistics::FrameStatistics(size_t frame_number,
88 size_t rtp_timestamp)
89 : frame_number(frame_number), rtp_timestamp(rtp_timestamp) {}
90
91VideoCodecTestStats::FrameStatistics::FrameStatistics(
92 const FrameStatistics& rhs) = default;
93
94} // namespace test
95} // namespace webrtc