OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_STATS_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_STATS_H_ |
12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_STATS_H_ | 12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_STATS_H_ |
13 | 13 |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "webrtc/common_types.h" | 16 #include "webrtc/common_types.h" |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 namespace test { | 19 namespace test { |
20 | 20 |
21 // Contains statistics of a single frame that has been processed. | 21 // Contains statistics of a single processed frame. |
22 struct FrameStatistic { | 22 struct FrameStatistic { |
23 FrameStatistic(); | 23 bool encoding_successful = false; |
24 | 24 bool decoding_successful = false; |
25 bool encoding_successful; | 25 int encode_return_code = 0; |
26 bool decoding_successful; | 26 int decode_return_code = 0; |
27 int encode_return_code; | 27 int encode_time_in_us = 0; |
28 int decode_return_code; | 28 int decode_time_in_us = 0; |
29 int encode_time_in_us; | 29 int qp = -1; |
30 int decode_time_in_us; | 30 int frame_number = 0; |
31 int qp; | |
32 int frame_number; | |
33 // How many packets were discarded of the encoded frame data (if any). | 31 // How many packets were discarded of the encoded frame data (if any). |
34 int packets_dropped; | 32 int packets_dropped = 0; |
35 size_t total_packets; | 33 size_t total_packets = 0; |
36 | 34 |
37 // Current bit rate. Calculated out of the size divided with the time | 35 // Current bit rate. Calculated out of the size divided with the time |
38 // interval per frame. | 36 // interval per frame. |
39 int bit_rate_in_kbps; | 37 int bit_rate_in_kbps = 0; |
40 | 38 |
41 // Copied from EncodedImage | 39 // Copied from EncodedImage. |
42 size_t encoded_frame_length_in_bytes; | 40 size_t encoded_frame_length_in_bytes = 0; |
43 webrtc::FrameType frame_type; | 41 webrtc::FrameType frame_type = kVideoFrameDelta; |
44 }; | 42 }; |
45 | 43 |
46 // Handles statistics from a single video processing run. | 44 // Handles statistics from a single video processing run. |
47 // Contains calculation methods for interesting metrics from these stats. | 45 // Contains calculation methods for interesting metrics from these stats. |
48 class Stats { | 46 class Stats { |
49 public: | 47 public: |
50 typedef std::vector<FrameStatistic>::iterator FrameStatisticsIterator; | 48 typedef std::vector<FrameStatistic>::iterator FrameStatisticsIterator; |
51 | 49 |
52 Stats(); | 50 Stats(); |
53 virtual ~Stats(); | 51 virtual ~Stats(); |
54 | 52 |
55 // Add a new statistic data object. | 53 // Add a new statistic data object. |
56 // The frame number must be incrementing and start at zero in order to use | 54 // The |frame_number| must be incrementing and start at zero in order to use |
57 // it as an index for the frame_statistics_ vector. | 55 // it as an index for the FrameStatistic vector. |
58 // Returns the newly created statistic object. | 56 // Returns the newly created statistic object. |
59 FrameStatistic& NewFrame(int frame_number); | 57 FrameStatistic& NewFrame(int frame_number); |
60 | 58 |
61 // Prints a summary of all the statistics that have been gathered during the | 59 // Prints a summary of all the statistics that have been gathered during the |
62 // processing | 60 // processing. |
63 void PrintSummary(); | 61 void PrintSummary(); |
64 | 62 |
65 std::vector<FrameStatistic> stats_; | 63 std::vector<FrameStatistic> stats_; |
66 }; | 64 }; |
67 | 65 |
68 } // namespace test | 66 } // namespace test |
69 } // namespace webrtc | 67 } // namespace webrtc |
70 | 68 |
71 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_STATS_H_ | 69 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_STATS_H_ |
OLD | NEW |