2011-10-06 06:44:54 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
2011-12-08 07:42:18 +00:00
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_VIDEO_CODING_CODECS_TEST_STATS_H_
|
|
|
|
|
#define MODULES_VIDEO_CODING_CODECS_TEST_STATS_H_
|
2011-10-06 06:44:54 +00:00
|
|
|
|
2018-01-19 14:57:10 +01:00
|
|
|
#include <map>
|
2018-01-17 15:11:44 +01:00
|
|
|
#include <string>
|
2011-10-06 06:44:54 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
2017-09-15 13:58:09 +02:00
|
|
|
#include "common_types.h" // NOLINT(build/include)
|
2011-10-06 06:44:54 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
namespace test {
|
|
|
|
|
|
2017-09-06 01:53:22 -07:00
|
|
|
// Statistics for one processed frame.
|
2011-10-06 06:44:54 +00:00
|
|
|
struct FrameStatistic {
|
2018-01-19 14:57:10 +01:00
|
|
|
FrameStatistic(size_t frame_number, size_t rtp_timestamp)
|
|
|
|
|
: frame_number(frame_number), rtp_timestamp(rtp_timestamp) {}
|
2018-01-17 15:11:44 +01:00
|
|
|
|
|
|
|
|
std::string ToString() const;
|
|
|
|
|
|
|
|
|
|
size_t frame_number = 0;
|
|
|
|
|
size_t rtp_timestamp = 0;
|
2017-09-06 01:53:22 -07:00
|
|
|
|
|
|
|
|
// Encoding.
|
|
|
|
|
int64_t encode_start_ns = 0;
|
2017-06-04 23:43:41 -07:00
|
|
|
int encode_return_code = 0;
|
2017-09-06 01:53:22 -07:00
|
|
|
bool encoding_successful = false;
|
2018-01-17 15:11:44 +01:00
|
|
|
size_t encode_time_us = 0;
|
|
|
|
|
size_t target_bitrate_kbps = 0;
|
2017-09-06 01:53:22 -07:00
|
|
|
size_t encoded_frame_size_bytes = 0;
|
|
|
|
|
webrtc::FrameType frame_type = kVideoFrameDelta;
|
|
|
|
|
|
2018-01-17 15:11:44 +01:00
|
|
|
// Layering.
|
|
|
|
|
size_t temporal_layer_idx = 0;
|
|
|
|
|
size_t simulcast_svc_idx = 0;
|
|
|
|
|
|
2017-09-28 09:23:17 -07:00
|
|
|
// H264 specific.
|
2018-01-17 15:11:44 +01:00
|
|
|
size_t max_nalu_size_bytes = 0;
|
2017-09-28 09:23:17 -07:00
|
|
|
|
2017-09-06 01:53:22 -07:00
|
|
|
// Decoding.
|
|
|
|
|
int64_t decode_start_ns = 0;
|
2017-06-04 23:43:41 -07:00
|
|
|
int decode_return_code = 0;
|
2017-09-06 01:53:22 -07:00
|
|
|
bool decoding_successful = false;
|
2018-01-17 15:11:44 +01:00
|
|
|
size_t decode_time_us = 0;
|
|
|
|
|
size_t decoded_width = 0;
|
|
|
|
|
size_t decoded_height = 0;
|
2017-09-06 01:53:22 -07:00
|
|
|
|
|
|
|
|
// Quantization.
|
2017-06-04 23:43:41 -07:00
|
|
|
int qp = -1;
|
2017-09-06 01:53:22 -07:00
|
|
|
|
2017-11-17 14:47:32 +01:00
|
|
|
// Quality.
|
|
|
|
|
float psnr = 0.0;
|
|
|
|
|
float ssim = 0.0;
|
2011-10-06 06:44:54 +00:00
|
|
|
};
|
|
|
|
|
|
2017-09-06 01:53:22 -07:00
|
|
|
// Statistics for a sequence of processed frames. This class is not thread safe.
|
2011-10-06 06:44:54 +00:00
|
|
|
class Stats {
|
|
|
|
|
public:
|
2017-09-06 01:53:22 -07:00
|
|
|
Stats() = default;
|
|
|
|
|
~Stats() = default;
|
|
|
|
|
|
|
|
|
|
// Creates a FrameStatistic for the next frame to be processed.
|
2018-01-19 14:57:10 +01:00
|
|
|
FrameStatistic* AddFrame(size_t timestamp);
|
2011-10-06 06:44:54 +00:00
|
|
|
|
2018-01-19 14:57:10 +01:00
|
|
|
// Returns the FrameStatistic corresponding to |frame_number| or |timestamp|.
|
2018-01-17 15:11:44 +01:00
|
|
|
FrameStatistic* GetFrame(size_t frame_number);
|
2018-01-19 14:57:10 +01:00
|
|
|
FrameStatistic* GetFrameWithTimestamp(size_t timestamp);
|
2011-10-06 06:44:54 +00:00
|
|
|
|
2017-09-06 01:53:22 -07:00
|
|
|
size_t size() const;
|
2011-10-06 06:44:54 +00:00
|
|
|
|
2017-09-06 01:53:22 -07:00
|
|
|
private:
|
2011-10-06 06:44:54 +00:00
|
|
|
std::vector<FrameStatistic> stats_;
|
2018-01-19 14:57:10 +01:00
|
|
|
std::map<size_t, size_t> rtp_timestamp_to_frame_num_;
|
2011-10-06 06:44:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace test
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_VIDEO_CODING_CODECS_TEST_STATS_H_
|