Moved analysis to Stats.
Slicing, aggregation and analysis has been moved to Stats class. Data of all spatial layers is stored in single Stats object. Bug: webrtc:8524 Change-Id: Ic9a64859a36a1ccda661942a201cdeeed470686a Reviewed-on: https://webrtc-review.googlesource.com/50301 Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22094}
This commit is contained in:
committed by
Commit Bot
parent
45d725d501
commit
06a8f304ef
@ -21,8 +21,8 @@ namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
// Statistics for one processed frame.
|
||||
struct FrameStatistic {
|
||||
FrameStatistic(size_t frame_number, size_t rtp_timestamp)
|
||||
struct FrameStatistics {
|
||||
FrameStatistics(size_t frame_number, size_t rtp_timestamp)
|
||||
: frame_number(frame_number), rtp_timestamp(rtp_timestamp) {}
|
||||
|
||||
std::string ToString() const;
|
||||
@ -42,6 +42,7 @@ struct FrameStatistic {
|
||||
// Layering.
|
||||
size_t temporal_layer_idx = 0;
|
||||
size_t simulcast_svc_idx = 0;
|
||||
bool inter_layer_predicted = false;
|
||||
|
||||
// H264 specific.
|
||||
size_t max_nalu_size_bytes = 0;
|
||||
@ -62,24 +63,96 @@ struct FrameStatistic {
|
||||
float ssim = 0.0;
|
||||
};
|
||||
|
||||
struct VideoStatistics {
|
||||
std::string ToString(std::string prefix) const;
|
||||
|
||||
size_t target_bitrate_kbps = 0;
|
||||
float input_framerate_fps = 0.0f;
|
||||
|
||||
size_t spatial_layer_idx = 0;
|
||||
size_t temporal_layer_idx = 0;
|
||||
|
||||
size_t width = 0;
|
||||
size_t height = 0;
|
||||
|
||||
size_t length_bytes = 0;
|
||||
size_t bitrate_kbps = 0;
|
||||
float framerate_fps = 0;
|
||||
|
||||
float enc_speed_fps = 0.0f;
|
||||
float dec_speed_fps = 0.0f;
|
||||
|
||||
float avg_delay_sec = 0.0f;
|
||||
float max_key_frame_delay_sec = 0.0f;
|
||||
float max_delta_frame_delay_sec = 0.0f;
|
||||
float time_to_reach_target_bitrate_sec = 0.0f;
|
||||
|
||||
float avg_key_frame_size_bytes = 0.0f;
|
||||
float avg_delta_frame_size_bytes = 0.0f;
|
||||
float avg_qp = 0.0f;
|
||||
|
||||
float avg_psnr = 0.0f;
|
||||
float min_psnr = 0.0f;
|
||||
float avg_ssim = 0.0f;
|
||||
float min_ssim = 0.0f;
|
||||
|
||||
size_t num_input_frames = 0;
|
||||
size_t num_encoded_frames = 0;
|
||||
size_t num_decoded_frames = 0;
|
||||
size_t num_key_frames = 0;
|
||||
size_t num_spatial_resizes = 0;
|
||||
size_t max_nalu_size_bytes = 0;
|
||||
};
|
||||
|
||||
// Statistics for a sequence of processed frames. This class is not thread safe.
|
||||
class Stats {
|
||||
public:
|
||||
Stats() = default;
|
||||
~Stats() = default;
|
||||
|
||||
// Creates a FrameStatistic for the next frame to be processed.
|
||||
FrameStatistic* AddFrame(size_t timestamp);
|
||||
// Creates a FrameStatistics for the next frame to be processed.
|
||||
FrameStatistics* AddFrame(size_t timestamp, size_t spatial_layer_idx);
|
||||
|
||||
// Returns the FrameStatistic corresponding to |frame_number| or |timestamp|.
|
||||
FrameStatistic* GetFrame(size_t frame_number);
|
||||
FrameStatistic* GetFrameWithTimestamp(size_t timestamp);
|
||||
// Returns the FrameStatistics corresponding to |frame_number| or |timestamp|.
|
||||
FrameStatistics* GetFrame(size_t frame_number, size_t spatial_layer_idx);
|
||||
FrameStatistics* GetFrameWithTimestamp(size_t timestamp,
|
||||
size_t spatial_layer_idx);
|
||||
|
||||
size_t size() const;
|
||||
std::vector<VideoStatistics> SliceAndCalcLayerVideoStatistic(
|
||||
size_t first_frame_num,
|
||||
size_t last_frame_num);
|
||||
|
||||
VideoStatistics SliceAndCalcAggregatedVideoStatistic(size_t first_frame_num,
|
||||
size_t last_frame_num);
|
||||
|
||||
size_t Size(size_t spatial_layer_idx);
|
||||
|
||||
void Clear();
|
||||
|
||||
private:
|
||||
std::vector<FrameStatistic> stats_;
|
||||
std::map<size_t, size_t> rtp_timestamp_to_frame_num_;
|
||||
FrameStatistics AggregateFrameStatistic(size_t frame_num,
|
||||
size_t spatial_layer_idx,
|
||||
bool aggregate_independent_layers);
|
||||
|
||||
size_t CalcLayerTargetBitrateKbps(size_t first_frame_num,
|
||||
size_t last_frame_num,
|
||||
size_t spatial_layer_idx,
|
||||
size_t temporal_layer_idx,
|
||||
bool aggregate_independent_layers);
|
||||
|
||||
VideoStatistics SliceAndCalcVideoStatistic(size_t first_frame_num,
|
||||
size_t last_frame_num,
|
||||
size_t spatial_layer_idx,
|
||||
size_t temporal_layer_idx,
|
||||
bool aggregate_independent_layers);
|
||||
|
||||
void GetNumberOfEncodedLayers(size_t first_frame_num,
|
||||
size_t last_frame_num,
|
||||
size_t* num_encoded_spatial_layers,
|
||||
size_t* num_encoded_temporal_layers);
|
||||
|
||||
std::map<size_t, std::vector<FrameStatistics>> layer_idx_to_stats_;
|
||||
std::map<size_t, std::map<size_t, size_t>> rtp_timestamp_to_frame_num_;
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
|
||||
Reference in New Issue
Block a user