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