Home | History | Annotate | Download | only in util
      1 /*
      2  *  Copyright (c) 2015 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_PROCESSING_UTIL_DENOISER_FILTER_H_
     12 #define WEBRTC_MODULES_VIDEO_PROCESSING_UTIL_DENOISER_FILTER_H_
     13 
     14 #include "webrtc/base/scoped_ptr.h"
     15 #include "webrtc/modules/include/module_common_types.h"
     16 #include "webrtc/modules/video_processing/include/video_processing_defines.h"
     17 
     18 namespace webrtc {
     19 
     20 extern const int kMotionMagnitudeThreshold;
     21 extern const int kSumDiffThreshold;
     22 extern const int kSumDiffThresholdHigh;
     23 
     24 enum DenoiserDecision { COPY_BLOCK, FILTER_BLOCK };
     25 struct DenoiseMetrics {
     26   uint32_t var;
     27   uint32_t sad;
     28   uint8_t denoise;
     29   bool is_skin;
     30 };
     31 
     32 class DenoiserFilter {
     33  public:
     34   static rtc::scoped_ptr<DenoiserFilter> Create(bool runtime_cpu_detection);
     35 
     36   virtual ~DenoiserFilter() {}
     37 
     38   virtual void CopyMem16x16(const uint8_t* src,
     39                             int src_stride,
     40                             uint8_t* dst,
     41                             int dst_stride) = 0;
     42   virtual void CopyMem8x8(const uint8_t* src,
     43                           int src_stride,
     44                           uint8_t* dst,
     45                           int dst_stride) = 0;
     46   virtual uint32_t Variance16x8(const uint8_t* a,
     47                                 int a_stride,
     48                                 const uint8_t* b,
     49                                 int b_stride,
     50                                 unsigned int* sse) = 0;
     51   virtual DenoiserDecision MbDenoise(uint8_t* mc_running_avg_y,
     52                                      int mc_avg_y_stride,
     53                                      uint8_t* running_avg_y,
     54                                      int avg_y_stride,
     55                                      const uint8_t* sig,
     56                                      int sig_stride,
     57                                      uint8_t motion_magnitude,
     58                                      int increase_denoising) = 0;
     59 };
     60 
     61 }  // namespace webrtc
     62 
     63 #endif  // WEBRTC_MODULES_VIDEO_PROCESSING_UTIL_DENOISER_FILTER_H_
     64