Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
354a2e61
Commit
354a2e61
authored
Jul 29, 2014
by
Marco Paniconi
Browse files
vp8: Code cleanup for control of denoiser mode.
Change-Id: Icb9918dd38d15061d62852e6a2d905e8ceb2c1ac
parent
9a4cd417
Changes
6
Hide whitespace changes
Inline
Side-by-side
vp8/common/onyx.h
View file @
354a2e61
...
...
@@ -108,7 +108,7 @@ extern "C"
* For temporal denoiser: noise_sensitivity = 0 means off,
* noise_sensitivity = 1 means temporal denoiser on for Y channel only,
* noise_sensitivity = 2 means temporal denoiser on for all channels.
* noise_sensitivity = 3 means aggressive denoising mode.
* noise_sensitivity
>
= 3 means aggressive denoising mode.
* Temporal denoiser is enabled via the configuration option:
* CONFIG_TEMPORAL_DENOISING.
* For spatial denoiser: noise_sensitivity controls the amount of
...
...
vp8/encoder/denoising.c
View file @
354a2e61
...
...
@@ -335,8 +335,16 @@ int vp8_denoiser_filter_uv_c(unsigned char *mc_running_avg_uv,
return
FILTER_BLOCK
;
}
void
vp8_denoiser_set_parameters
(
VP8_DENOISER
*
denoiser
)
{
if
(
!
denoiser
->
aggressive_mode
)
{
void
vp8_denoiser_set_parameters
(
VP8_DENOISER
*
denoiser
,
int
mode
)
{
assert
(
mode
>
0
);
// Denoiser is allocated only if mode > 0.
if
(
mode
==
1
)
{
denoiser
->
denoiser_mode
=
kDenoiserOnYOnly
;
}
else
if
(
mode
==
2
)
{
denoiser
->
denoiser_mode
=
kDenoiserOnYUV
;
}
else
{
denoiser
->
denoiser_mode
=
kDenoiserOnYUVAggressive
;
}
if
(
denoiser
->
denoiser_mode
!=
kDenoiserOnYUVAggressive
)
{
denoiser
->
denoise_pars
.
scale_sse_thresh
=
1
;
denoiser
->
denoise_pars
.
scale_motion_thresh
=
8
;
denoiser
->
denoise_pars
.
scale_increase_filter
=
0
;
...
...
@@ -361,7 +369,6 @@ int vp8_denoiser_allocate(VP8_DENOISER *denoiser, int width, int height,
int
i
;
assert
(
denoiser
);
denoiser
->
num_mb_cols
=
num_mb_cols
;
denoiser
->
aggressive_mode
=
mode
;
for
(
i
=
0
;
i
<
MAX_REF_FRAMES
;
i
++
)
{
...
...
@@ -392,7 +399,7 @@ int vp8_denoiser_allocate(VP8_DENOISER *denoiser, int width, int height,
denoiser
->
denoise_state
=
vpx_calloc
((
num_mb_rows
*
num_mb_cols
),
1
);
vpx_memset
(
denoiser
->
denoise_state
,
0
,
(
num_mb_rows
*
num_mb_cols
));
vp8_denoiser_set_parameters
(
denoiser
);
vp8_denoiser_set_parameters
(
denoiser
,
mode
);
return
0
;
}
...
...
@@ -420,8 +427,8 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser,
loop_filter_info_n
*
lfi_n
,
int
mb_row
,
int
mb_col
,
int
block_index
,
int
uv_denoise
)
int
block_index
)
{
int
mv_row
;
int
mv_col
;
...
...
@@ -558,7 +565,7 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser,
denoiser
->
denoise_state
[
block_index
]
=
motion_magnitude2
>
0
?
kFilterNonZeroMV
:
kFilterZeroMV
;
// Only denoise UV for zero motion, and if y channel was denoised.
if
(
uv_
denoise
&&
if
(
denoise
r
->
denoiser_mode
!=
kDenoiserOnYOnly
&&
motion_magnitude2
==
0
&&
decision
==
FILTER_BLOCK
)
{
unsigned
char
*
mc_running_avg_u
=
...
...
@@ -595,7 +602,7 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser,
denoiser
->
yv12_running_avg
[
INTRA_FRAME
].
y_stride
);
denoiser
->
denoise_state
[
block_index
]
=
kNoFilter
;
}
if
(
uv_
denoise
)
{
if
(
denoise
r
->
denoiser_mode
!=
kDenoiserOnYOnly
)
{
if
(
decision_u
==
COPY_BLOCK
)
{
vp8_copy_mem8x8
(
x
->
block
[
16
].
src
+
*
x
->
block
[
16
].
base_src
,
x
->
block
[
16
].
src_stride
,
...
...
vp8/encoder/denoising.h
View file @
354a2e61
...
...
@@ -39,6 +39,13 @@ enum vp8_denoiser_filter_state {
kFilterNonZeroMV
};
enum
vp8_denoiser_mode
{
kDenoiserOff
,
kDenoiserOnYOnly
,
kDenoiserOnYUV
,
kDenoiserOnYUVAggressive
};
typedef
struct
{
// Scale factor on sse threshold above which no denoising is done.
unsigned
int
scale_sse_thresh
;
...
...
@@ -67,7 +74,7 @@ typedef struct vp8_denoiser
YV12_BUFFER_CONFIG
yv12_mc_running_avg
;
unsigned
char
*
denoise_state
;
int
num_mb_cols
;
int
aggressive
_mode
;
int
denoiser
_mode
;
denoise_params
denoise_pars
;
}
VP8_DENOISER
;
...
...
@@ -85,8 +92,7 @@ void vp8_denoiser_denoise_mb(VP8_DENOISER *denoiser,
loop_filter_info_n
*
lfi_n
,
int
mb_row
,
int
mb_col
,
int
block_index
,
int
uv_denoise
);
int
block_index
);
#ifdef __cplusplus
}
// extern "C"
...
...
vp8/encoder/onyx_if.c
View file @
354a2e61
...
...
@@ -615,7 +615,7 @@ static void cyclic_background_refresh(VP8_COMP *cpi, int Q, int lf_adjustment)
cpi
->
cyclic_refresh_mode_index
=
i
;
#if CONFIG_TEMPORAL_DENOISING
if
(
cpi
->
denoiser
.
aggressive
_mode
!
=
0
&&
if
(
cpi
->
denoiser
.
denoiser
_mode
=
=
kDenoiserOnYUVAggressive
&&
Q
<
(
int
)
cpi
->
denoiser
.
denoise_pars
.
qp_thresh
)
{
// Under aggressive denoising mode, use segmentation to turn off loop
// filter below some qp thresh. The loop filter is turned off for all
...
...
@@ -1283,8 +1283,7 @@ void vp8_alloc_compressor_data(VP8_COMP *cpi)
vp8_denoiser_free
(
&
cpi
->
denoiser
);
vp8_denoiser_allocate
(
&
cpi
->
denoiser
,
width
,
height
,
cm
->
mb_rows
,
cm
->
mb_cols
,
((
cpi
->
oxcf
.
noise_sensitivity
==
3
)
?
1
:
0
));
cpi
->
oxcf
.
noise_sensitivity
);
}
#endif
}
...
...
@@ -1781,7 +1780,7 @@ void vp8_change_config(VP8_COMP *cpi, VP8_CONFIG *oxcf)
int
height
=
(
cpi
->
oxcf
.
Height
+
15
)
&
~
15
;
vp8_denoiser_allocate
(
&
cpi
->
denoiser
,
width
,
height
,
cm
->
mb_rows
,
cm
->
mb_cols
,
((
cpi
->
oxcf
.
noise_sensitivity
==
3
)
?
1
:
0
)
);
cpi
->
oxcf
.
noise_sensitivity
);
}
}
#endif
...
...
vp8/encoder/pickinter.c
View file @
354a2e61
...
...
@@ -1174,7 +1174,6 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
#if CONFIG_TEMPORAL_DENOISING
if
(
cpi
->
oxcf
.
noise_sensitivity
)
{
int
uv_denoise
=
(
cpi
->
oxcf
.
noise_sensitivity
>=
2
)
?
1
:
0
;
int
block_index
=
mb_row
*
cpi
->
common
.
mb_cols
+
mb_col
;
if
(
x
->
best_sse_inter_mode
==
DC_PRED
)
{
...
...
@@ -1189,8 +1188,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
vp8_denoiser_denoise_mb
(
&
cpi
->
denoiser
,
x
,
best_sse
,
zero_mv_sse
,
recon_yoffset
,
recon_uvoffset
,
&
cpi
->
common
.
lf_info
,
mb_row
,
mb_col
,
block_index
,
uv_denoise
);
block_index
);
/* Reevaluate ZEROMV after denoising. */
if
(
best_mbmode
.
ref_frame
==
INTRA_FRAME
&&
...
...
vp8/encoder/rdopt.c
View file @
354a2e61
...
...
@@ -2511,7 +2511,6 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
#if CONFIG_TEMPORAL_DENOISING
if
(
cpi
->
oxcf
.
noise_sensitivity
)
{
int
uv_denoise
=
(
cpi
->
oxcf
.
noise_sensitivity
==
2
)
?
1
:
0
;
int
block_index
=
mb_row
*
cpi
->
common
.
mb_cols
+
mb_col
;
if
(
x
->
best_sse_inter_mode
==
DC_PRED
)
{
...
...
@@ -2525,8 +2524,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
vp8_denoiser_denoise_mb
(
&
cpi
->
denoiser
,
x
,
best_sse
,
zero_mv_sse
,
recon_yoffset
,
recon_uvoffset
,
&
cpi
->
common
.
lf_info
,
mb_row
,
mb_col
,
block_index
,
uv_denoise
);
block_index
);
/* Reevaluate ZEROMV after denoising. */
if
(
best_mode
.
mbmode
.
ref_frame
==
INTRA_FRAME
&&
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment