• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3  *
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 
14 #include "webrtc/typedefs.h"
15 
16 namespace webrtc {
17 
18 struct VideoContentMetrics;
19 
20 // QM interval time (in ms)
21 enum { kQmMinIntervalMs = 10000 };
22 
23 // Flag for NFD metric vs motion metric
24 enum { kNfdMetric = 1 };
25 
26 /**********************************/
27 /* Content Metrics Processing     */
28 /**********************************/
29 class VCMContentMetricsProcessing {
30  public:
31   VCMContentMetricsProcessing();
32   ~VCMContentMetricsProcessing();
33 
34   // Update class with latest metrics.
35   int UpdateContentData(const VideoContentMetrics* contentMetrics);
36 
37   // Reset the short-term averaged content data.
38   void ResetShortTermAvgData();
39 
40   // Initialize.
41   int Reset();
42 
43   // Inform class of current frame rate.
44   void UpdateFrameRate(uint32_t frameRate);
45 
46   // Returns the long-term averaged content data: recursive average over longer
47   // time scale.
48   VideoContentMetrics* LongTermAvgData();
49 
50   // Returns the short-term averaged content data: uniform average over
51   // shorter time scalE.
52   VideoContentMetrics* ShortTermAvgData();
53 
54  private:
55   // Compute working average.
56   int ProcessContent(const VideoContentMetrics* contentMetrics);
57 
58   // Update the recursive averaged metrics: longer time average (~5/10 secs).
59   void UpdateRecursiveAvg(const VideoContentMetrics* contentMetrics);
60 
61   // Update the uniform averaged metrics: shorter time average (~RTCP report).
62   void UpdateUniformAvg(const VideoContentMetrics* contentMetrics);
63 
64   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_;
70 };
71 }  // namespace webrtc
72 #endif  // WEBRTC_MODULES_VIDEO_CODING_CONTENT_METRICS_PROCESSING_H_
73