OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebM 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 VP8_ENCODER_DENOISING_H_ | 11 #ifndef VP8_ENCODER_DENOISING_H_ |
12 #define VP8_ENCODER_DENOISING_H_ | 12 #define VP8_ENCODER_DENOISING_H_ |
13 | 13 |
14 #include "block.h" | 14 #include "block.h" |
15 #include "vp8/common/loopfilter.h" | 15 #include "vp8/common/loopfilter.h" |
16 | 16 |
17 #ifdef __cplusplus | 17 #ifdef __cplusplus |
18 extern "C" { | 18 extern "C" { |
19 #endif | 19 #endif |
20 | 20 |
21 #define SUM_DIFF_THRESHOLD (16 * 16 * 2) | 21 #define SUM_DIFF_THRESHOLD (16 * 16 * 2) |
22 #define SUM_DIFF_THRESHOLD_HIGH (16 * 16 * 3) | 22 #define SUM_DIFF_THRESHOLD_HIGH (600) |
23 #define MOTION_MAGNITUDE_THRESHOLD (8*3) | 23 #define MOTION_MAGNITUDE_THRESHOLD (8*3) |
24 | 24 |
25 #define SUM_DIFF_THRESHOLD_UV (96) // (8 * 8 * 1.5) | 25 #define SUM_DIFF_THRESHOLD_UV (96) // (8 * 8 * 1.5) |
26 #define SUM_DIFF_THRESHOLD_HIGH_UV (8 * 8 * 2) | 26 #define SUM_DIFF_THRESHOLD_HIGH_UV (8 * 8 * 2) |
27 #define SUM_DIFF_FROM_AVG_THRESH_UV (8 * 8 * 8) | 27 #define SUM_DIFF_FROM_AVG_THRESH_UV (8 * 8 * 8) |
28 #define MOTION_MAGNITUDE_THRESHOLD_UV (8*3) | 28 #define MOTION_MAGNITUDE_THRESHOLD_UV (8*3) |
29 | 29 |
30 enum vp8_denoiser_decision | 30 enum vp8_denoiser_decision |
31 { | 31 { |
32 COPY_BLOCK, | 32 COPY_BLOCK, |
(...skipping 27 matching lines...) Expand all Loading... |
60 unsigned int denoise_mv_bias; | 60 unsigned int denoise_mv_bias; |
61 // Scale factor to bias to ZEROMV for coding mode selection. | 61 // Scale factor to bias to ZEROMV for coding mode selection. |
62 unsigned int pickmode_mv_bias; | 62 unsigned int pickmode_mv_bias; |
63 // Quantizer threshold below which we use the segmentation map to switch off | 63 // Quantizer threshold below which we use the segmentation map to switch off |
64 // loop filter for blocks that have been coded as ZEROMV-LAST a certain number | 64 // loop filter for blocks that have been coded as ZEROMV-LAST a certain number |
65 // (consec_zerolast) of consecutive frames. Note that the delta-QP is set to | 65 // (consec_zerolast) of consecutive frames. Note that the delta-QP is set to |
66 // 0 when segmentation map is used for shutting off loop filter. | 66 // 0 when segmentation map is used for shutting off loop filter. |
67 unsigned int qp_thresh; | 67 unsigned int qp_thresh; |
68 // Threshold for number of consecutive frames for blocks coded as ZEROMV-LAST. | 68 // Threshold for number of consecutive frames for blocks coded as ZEROMV-LAST. |
69 unsigned int consec_zerolast; | 69 unsigned int consec_zerolast; |
| 70 // Threshold for amount of spatial blur on Y channel. 0 means no spatial blur. |
| 71 unsigned int spatial_blur; |
70 } denoise_params; | 72 } denoise_params; |
71 | 73 |
72 typedef struct vp8_denoiser | 74 typedef struct vp8_denoiser |
73 { | 75 { |
74 YV12_BUFFER_CONFIG yv12_running_avg[MAX_REF_FRAMES]; | 76 YV12_BUFFER_CONFIG yv12_running_avg[MAX_REF_FRAMES]; |
75 YV12_BUFFER_CONFIG yv12_mc_running_avg; | 77 YV12_BUFFER_CONFIG yv12_mc_running_avg; |
76 // TODO(marpan): Should remove yv12_last_source and use vp8_lookahead_peak. | 78 // TODO(marpan): Should remove yv12_last_source and use vp8_lookahead_peak. |
77 YV12_BUFFER_CONFIG yv12_last_source; | 79 YV12_BUFFER_CONFIG yv12_last_source; |
78 unsigned char* denoise_state; | 80 unsigned char* denoise_state; |
79 int num_mb_cols; | 81 int num_mb_cols; |
80 int denoiser_mode; | 82 int denoiser_mode; |
81 int threshold_aggressive_mode; | 83 int threshold_aggressive_mode; |
82 int nmse_source_diff; | 84 int nmse_source_diff; |
83 int nmse_source_diff_count; | 85 int nmse_source_diff_count; |
| 86 int qp_avg; |
| 87 int qp_threshold_up; |
| 88 int qp_threshold_down; |
| 89 int bitrate_threshold; |
84 denoise_params denoise_pars; | 90 denoise_params denoise_pars; |
85 } VP8_DENOISER; | 91 } VP8_DENOISER; |
86 | 92 |
87 int vp8_denoiser_allocate(VP8_DENOISER *denoiser, int width, int height, | 93 int vp8_denoiser_allocate(VP8_DENOISER *denoiser, int width, int height, |
88 int num_mb_rows, int num_mb_cols, int mode); | 94 int num_mb_rows, int num_mb_cols, int mode); |
89 | 95 |
90 void vp8_denoiser_free(VP8_DENOISER *denoiser); | 96 void vp8_denoiser_free(VP8_DENOISER *denoiser); |
91 | 97 |
92 void vp8_denoiser_set_parameters(VP8_DENOISER *denoiser, int mode); | 98 void vp8_denoiser_set_parameters(VP8_DENOISER *denoiser, int mode); |
93 | 99 |
94 void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, | 100 void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, |
95 MACROBLOCK *x, | 101 MACROBLOCK *x, |
96 unsigned int best_sse, | 102 unsigned int best_sse, |
97 unsigned int zero_mv_sse, | 103 unsigned int zero_mv_sse, |
98 int recon_yoffset, | 104 int recon_yoffset, |
99 int recon_uvoffset, | 105 int recon_uvoffset, |
100 loop_filter_info_n *lfi_n, | 106 loop_filter_info_n *lfi_n, |
101 int mb_row, | 107 int mb_row, |
102 int mb_col, | 108 int mb_col, |
103 int block_index); | 109 int block_index); |
104 | 110 |
105 #ifdef __cplusplus | 111 #ifdef __cplusplus |
106 } // extern "C" | 112 } // extern "C" |
107 #endif | 113 #endif |
108 | 114 |
109 #endif // VP8_ENCODER_DENOISING_H_ | 115 #endif // VP8_ENCODER_DENOISING_H_ |
OLD | NEW |