Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Side by Side Diff: source/libvpx/vp8/encoder/denoising.h

Issue 478033002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp8/encoder/boolhuff.h ('k') | source/libvpx/vp8/encoder/denoising.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 (16 * 16 * 3)
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 * 4) 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,
33 FILTER_BLOCK 33 FILTER_BLOCK
34 }; 34 };
35 35
36 enum vp8_denoiser_filter_state { 36 enum vp8_denoiser_filter_state {
37 kNoFilter, 37 kNoFilter,
38 kFilterZeroMV, 38 kFilterZeroMV,
39 kFilterNonZeroMV 39 kFilterNonZeroMV
40 }; 40 };
41 41
42 enum vp8_denoiser_mode {
43 kDenoiserOff,
44 kDenoiserOnYOnly,
45 kDenoiserOnYUV,
46 kDenoiserOnYUVAggressive,
47 kDenoiserOnAdaptive
48 };
49
50 typedef struct {
51 // Scale factor on sse threshold above which no denoising is done.
52 unsigned int scale_sse_thresh;
53 // Scale factor on motion magnitude threshold above which no
54 // denoising is done.
55 unsigned int scale_motion_thresh;
56 // Scale factor on motion magnitude below which we increase the strength of
57 // the temporal filter (in function vp8_denoiser_filter).
58 unsigned int scale_increase_filter;
59 // Scale factor to bias to ZEROMV for denoising.
60 unsigned int denoise_mv_bias;
61 // Scale factor to bias to ZEROMV for coding mode selection.
62 unsigned int pickmode_mv_bias;
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
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.
67 unsigned int qp_thresh;
68 // Threshold for number of consecutive frames for blocks coded as ZEROMV-LAST.
69 unsigned int consec_zerolast;
70 } denoise_params;
71
42 typedef struct vp8_denoiser 72 typedef struct vp8_denoiser
43 { 73 {
44 YV12_BUFFER_CONFIG yv12_running_avg[MAX_REF_FRAMES]; 74 YV12_BUFFER_CONFIG yv12_running_avg[MAX_REF_FRAMES];
45 YV12_BUFFER_CONFIG yv12_mc_running_avg; 75 YV12_BUFFER_CONFIG yv12_mc_running_avg;
76 // TODO(marpan): Should remove yv12_last_source and use vp8_lookahead_peak.
77 YV12_BUFFER_CONFIG yv12_last_source;
46 unsigned char* denoise_state; 78 unsigned char* denoise_state;
47 int num_mb_cols; 79 int num_mb_cols;
80 int denoiser_mode;
81 int threshold_aggressive_mode;
82 int nmse_source_diff;
83 int nmse_source_diff_count;
84 denoise_params denoise_pars;
48 } VP8_DENOISER; 85 } VP8_DENOISER;
49 86
50 int vp8_denoiser_allocate(VP8_DENOISER *denoiser, int width, int height, 87 int vp8_denoiser_allocate(VP8_DENOISER *denoiser, int width, int height,
51 int num_mb_rows, int num_mb_cols); 88 int num_mb_rows, int num_mb_cols, int mode);
52 89
53 void vp8_denoiser_free(VP8_DENOISER *denoiser); 90 void vp8_denoiser_free(VP8_DENOISER *denoiser);
54 91
92 void vp8_denoiser_set_parameters(VP8_DENOISER *denoiser, int mode);
93
55 void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser, 94 void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser,
56 MACROBLOCK *x, 95 MACROBLOCK *x,
57 unsigned int best_sse, 96 unsigned int best_sse,
58 unsigned int zero_mv_sse, 97 unsigned int zero_mv_sse,
59 int recon_yoffset, 98 int recon_yoffset,
60 int recon_uvoffset, 99 int recon_uvoffset,
61 loop_filter_info_n *lfi_n, 100 loop_filter_info_n *lfi_n,
62 int mb_row, 101 int mb_row,
63 int mb_col, 102 int mb_col,
64 int block_index, 103 int block_index);
65 int uv_denoise);
66 104
67 #ifdef __cplusplus 105 #ifdef __cplusplus
68 } // extern "C" 106 } // extern "C"
69 #endif 107 #endif
70 108
71 #endif // VP8_ENCODER_DENOISING_H_ 109 #endif // VP8_ENCODER_DENOISING_H_
OLDNEW
« no previous file with comments | « source/libvpx/vp8/encoder/boolhuff.h ('k') | source/libvpx/vp8/encoder/denoising.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698