1 /*
2  *  Copyright (c) 2012 The WebM 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 VPX_VP9_ENCODER_VP9_NOISE_ESTIMATE_H_
12 #define VPX_VP9_ENCODER_VP9_NOISE_ESTIMATE_H_
13 
14 #include "vp9/encoder/vp9_block.h"
15 #include "vp9/encoder/vp9_skin_detection.h"
16 #include "vpx_scale/yv12config.h"
17 
18 #if CONFIG_VP9_TEMPORAL_DENOISING
19 #include "vp9/encoder/vp9_denoiser.h"
20 #endif
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #define MAX_VAR_HIST_BINS 20
27 
28 typedef enum noise_level { kLowLow, kLow, kMedium, kHigh } NOISE_LEVEL;
29 
30 typedef struct noise_estimate {
31   int enabled;
32   NOISE_LEVEL level;
33   int value;
34   int thresh;
35   int adapt_thresh;
36   int count;
37   int last_w;
38   int last_h;
39   int num_frames_estimate;
40 } NOISE_ESTIMATE;
41 
42 struct VP9_COMP;
43 
44 void vp9_noise_estimate_init(NOISE_ESTIMATE *const ne, int width, int height);
45 
46 NOISE_LEVEL vp9_noise_estimate_extract_level(NOISE_ESTIMATE *const ne);
47 
48 void vp9_update_noise_estimate(struct VP9_COMP *const cpi);
49 
50 #ifdef __cplusplus
51 }  // extern "C"
52 #endif
53 
54 #endif  // VPX_VP9_ENCODER_VP9_NOISE_ESTIMATE_H_
55