blob: 3f67ec19c98b725915e26a71fcc8bab865d49f18 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:251/*
marpan@webrtc.org9d76b4e2012-02-28 23:39:312 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:253 *
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#ifndef WEBRTC_MODULES_VIDEO_CODING_CONTENT_METRICS_PROCESSING_H_
12#define WEBRTC_MODULES_VIDEO_CODING_CONTENT_METRICS_PROCESSING_H_
13
pbos@webrtc.orga4407322013-07-16 12:32:0514#include "webrtc/typedefs.h"
niklase@google.com470e71d2011-07-07 08:21:2515
marpan@webrtc.org9d76b4e2012-02-28 23:39:3116namespace webrtc {
niklase@google.com470e71d2011-07-07 08:21:2517
18struct VideoContentMetrics;
19
20// QM interval time (in ms)
philipel9d3ab612015-12-21 12:12:3921enum { kQmMinIntervalMs = 10000 };
niklase@google.com470e71d2011-07-07 08:21:2522
23// Flag for NFD metric vs motion metric
philipel9d3ab612015-12-21 12:12:3924enum { kNfdMetric = 1 };
niklase@google.com470e71d2011-07-07 08:21:2525
26/**********************************/
27/* Content Metrics Processing */
28/**********************************/
marpan@webrtc.org9d76b4e2012-02-28 23:39:3129class VCMContentMetricsProcessing {
30 public:
31 VCMContentMetricsProcessing();
32 ~VCMContentMetricsProcessing();
niklase@google.com470e71d2011-07-07 08:21:2533
marpan@webrtc.org9d76b4e2012-02-28 23:39:3134 // Update class with latest metrics.
philipel9d3ab612015-12-21 12:12:3935 int UpdateContentData(const VideoContentMetrics* contentMetrics);
niklase@google.com470e71d2011-07-07 08:21:2536
marpan@webrtc.org9d76b4e2012-02-28 23:39:3137 // Reset the short-term averaged content data.
38 void ResetShortTermAvgData();
niklase@google.com470e71d2011-07-07 08:21:2539
marpan@webrtc.org9d76b4e2012-02-28 23:39:3140 // Initialize.
41 int Reset();
niklase@google.com470e71d2011-07-07 08:21:2542
marpan@webrtc.org9d76b4e2012-02-28 23:39:3143 // Inform class of current frame rate.
44 void UpdateFrameRate(uint32_t frameRate);
niklase@google.com470e71d2011-07-07 08:21:2545
marpan@webrtc.org9d76b4e2012-02-28 23:39:3146 // Returns the long-term averaged content data: recursive average over longer
47 // time scale.
48 VideoContentMetrics* LongTermAvgData();
niklase@google.com470e71d2011-07-07 08:21:2549
marpan@webrtc.org9d76b4e2012-02-28 23:39:3150 // Returns the short-term averaged content data: uniform average over
51 // shorter time scalE.
52 VideoContentMetrics* ShortTermAvgData();
niklase@google.com470e71d2011-07-07 08:21:2553
marpan@webrtc.org9d76b4e2012-02-28 23:39:3154 private:
55 // Compute working average.
philipel9d3ab612015-12-21 12:12:3956 int ProcessContent(const VideoContentMetrics* contentMetrics);
niklase@google.com470e71d2011-07-07 08:21:2557
marpan@webrtc.org9d76b4e2012-02-28 23:39:3158 // Update the recursive averaged metrics: longer time average (~5/10 secs).
philipel9d3ab612015-12-21 12:12:3959 void UpdateRecursiveAvg(const VideoContentMetrics* contentMetrics);
niklase@google.com470e71d2011-07-07 08:21:2560
marpan@webrtc.org9d76b4e2012-02-28 23:39:3161 // Update the uniform averaged metrics: shorter time average (~RTCP report).
philipel9d3ab612015-12-21 12:12:3962 void UpdateUniformAvg(const VideoContentMetrics* contentMetrics);
niklase@google.com470e71d2011-07-07 08:21:2563
marpan@webrtc.org9d76b4e2012-02-28 23:39:3164 VideoContentMetrics* recursive_avg_;
65 VideoContentMetrics* uniform_avg_;
66 float recursive_avg_factor_;
67 uint32_t frame_cnt_uniform_avg_;
68 float avg_motion_level_;
69 float avg_spatial_level_;
niklase@google.com470e71d2011-07-07 08:21:2570};
marpan@webrtc.org9d76b4e2012-02-28 23:39:3171} // namespace webrtc
72#endif // WEBRTC_MODULES_VIDEO_CODING_CONTENT_METRICS_PROCESSING_H_