OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 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_NOISE_ESTIMATION_H_ |
| 12 #define WEBRTC_MODULES_VIDEO_PROCESSING_UTIL_NOISE_ESTIMATION_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 #include "webrtc/modules/video_processing/util/denoiser_filter.h" |
| 18 |
| 19 namespace webrtc { |
| 20 |
| 21 #define EXPERIMENTAL 0 |
| 22 #define DISPLAY 0 |
| 23 |
| 24 const int kNoiseThreshold = 200; |
| 25 const int kNoiseThresholdNeon = 70; |
| 26 const int kConsecLowVarFrame = 6; |
| 27 const int kAverageLumaMin = 20; |
| 28 const int kAverageLumaMax = 220; |
| 29 const int kBlockSelectionVarMax = kNoiseThreshold << 1; |
| 30 |
| 31 class NoiseEstimation { |
| 32 public: |
| 33 void Init(int width, int height, CpuType cpu_type); |
| 34 void GetNoise(int mb_index, uint32_t var, uint32_t luma); |
| 35 void ResetConsecLowVar(int mb_index); |
| 36 void UpdateNoiseLevel(); |
| 37 // 0: low noise, 1: high noise |
| 38 uint8_t GetNoiseLevel(); |
| 39 |
| 40 private: |
| 41 int width_; |
| 42 int height_; |
| 43 int mb_rows_; |
| 44 int mb_cols_; |
| 45 CpuType cpu_type_; |
| 46 uint32_t noise_var_; |
| 47 double noise_var_accum_; |
| 48 int num_noisy_block_; |
| 49 int num_static_block_; |
| 50 double percent_static_block_; |
| 51 rtc::scoped_ptr<uint32_t[]> consec_low_var_; |
| 52 }; |
| 53 |
| 54 } // namespace webrtc |
| 55 |
| 56 #endif // WEBRTC_MODULES_VIDEO_PROCESSING_UTIL_NOISE_ESTIMATION_H_ |
OLD | NEW |