Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: webrtc/modules/video_coding/codecs/test/stats.h

Issue 3011923002: Clean up Stats class used in VideoProcessor tests. (Closed)
Patch Set: Fix VS compile. Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/test/stats.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 processed frame. 21 // Statistics for one processed frame.
22 struct FrameStatistic { 22 struct FrameStatistic {
23 explicit FrameStatistic(int frame_number) : frame_number(frame_number) {}
24 const int frame_number = 0;
25
26 // Encoding.
27 int64_t encode_start_ns = 0;
28 int encode_return_code = 0;
23 bool encoding_successful = false; 29 bool encoding_successful = false;
30 int encode_time_us = 0;
31 int bitrate_kbps = 0;
32 size_t encoded_frame_size_bytes = 0;
33 webrtc::FrameType frame_type = kVideoFrameDelta;
34
35 // Decoding.
36 int64_t decode_start_ns = 0;
37 int decode_return_code = 0;
24 bool decoding_successful = false; 38 bool decoding_successful = false;
25 int encode_return_code = 0; 39 int decode_time_us = 0;
26 int decode_return_code = 0; 40 int decoded_width = 0;
27 int encode_time_in_us = 0; 41 int decoded_height = 0;
28 int decode_time_in_us = 0; 42
43 // Quantization.
29 int qp = -1; 44 int qp = -1;
30 int frame_number = 0; 45
31 // How many packets were discarded of the encoded frame data (if any). 46 // How many packets were discarded of the encoded frame data (if any).
32 int packets_dropped = 0; 47 int packets_dropped = 0;
33 size_t total_packets = 0; 48 size_t total_packets = 0;
34 49 size_t manipulated_length = 0;
35 // Current bit rate. Calculated out of the size divided with the time
36 // interval per frame.
37 int bit_rate_in_kbps = 0;
38
39 // Copied from EncodedImage.
40 size_t encoded_frame_length_in_bytes = 0;
41 webrtc::FrameType frame_type = kVideoFrameDelta;
42 }; 50 };
43 51
44 // Handles statistics from a single video processing run. 52 // Statistics for a sequence of processed frames. This class is not thread safe.
45 // Contains calculation methods for interesting metrics from these stats.
46 class Stats { 53 class Stats {
47 public: 54 public:
48 typedef std::vector<FrameStatistic>::iterator FrameStatisticsIterator; 55 Stats() = default;
56 ~Stats() = default;
49 57
50 Stats(); 58 // Creates a FrameStatistic for the next frame to be processed.
51 virtual ~Stats(); 59 FrameStatistic* AddFrame();
52 60
53 // Add a new statistic data object. 61 // Returns the FrameStatistic corresponding to |frame_number|.
54 // The |frame_number| must be incrementing and start at zero in order to use 62 FrameStatistic* GetFrame(int frame_number);
55 // it as an index for the FrameStatistic vector.
56 // Returns the newly created statistic object.
57 FrameStatistic& NewFrame(int frame_number);
58 63
59 // Prints a summary of all the statistics that have been gathered during the 64 size_t size() const;
60 // processing.
61 void PrintSummary();
62 65
66 // TODO(brandtr): Add output as CSV.
67 void PrintSummary() const;
68
69 private:
63 std::vector<FrameStatistic> stats_; 70 std::vector<FrameStatistic> stats_;
64 }; 71 };
65 72
66 } // namespace test 73 } // namespace test
67 } // namespace webrtc 74 } // namespace webrtc
68 75
69 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_STATS_H_ 76 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_STATS_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/test/stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698