Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
dc669d5f
Commit
dc669d5f
authored
Sep 11, 2016
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_vaguedenoiser: change thresholding to function pointers
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
5bbffe34
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
8 deletions
+27
-8
vf_vaguedenoiser.c
libavfilter/vf_vaguedenoiser.c
+27
-8
No files found.
libavfilter/vf_vaguedenoiser.c
View file @
dc669d5f
...
...
@@ -56,6 +56,10 @@ typedef struct VagueDenoiserContext {
int
hhighsize
[
32
];
int
vlowsize
[
32
];
int
vhighsize
[
32
];
void
(
*
thresholding
)(
float
*
block
,
const
int
width
,
const
int
height
,
const
int
stride
,
const
float
threshold
,
const
float
percent
,
const
int
nsteps
);
}
VagueDenoiserContext
;
#define OFFSET(x) offsetof(VagueDenoiserContext, x)
...
...
@@ -308,7 +312,7 @@ static void invert_step(const float *input, float *output, float *temp, const in
static
void
hard_thresholding
(
float
*
block
,
const
int
width
,
const
int
height
,
const
int
stride
,
const
float
threshold
,
const
float
percent
)
const
float
percent
,
const
int
unused
)
{
const
float
frac
=
1
.
f
-
percent
*
0
.
01
f
;
int
y
,
x
;
...
...
@@ -351,7 +355,7 @@ static void soft_thresholding(float *block, const int width, const int height, c
static
void
qian_thresholding
(
float
*
block
,
const
int
width
,
const
int
height
,
const
int
stride
,
const
float
threshold
,
const
float
percent
)
const
float
percent
,
const
int
unused
)
{
const
float
percent01
=
percent
*
0
.
01
f
;
const
float
tr2
=
threshold
*
threshold
*
percent01
;
...
...
@@ -435,12 +439,7 @@ static void filter(VagueDenoiserContext *s, AVFrame *in, AVFrame *out)
v_low_size0
=
(
v_low_size0
+
1
)
>>
1
;
}
if
(
s
->
method
==
0
)
hard_thresholding
(
s
->
block
,
width
,
height
,
width
,
s
->
threshold
,
s
->
percent
);
else
if
(
s
->
method
==
1
)
soft_thresholding
(
s
->
block
,
width
,
height
,
width
,
s
->
threshold
,
s
->
percent
,
s
->
nsteps
);
else
qian_thresholding
(
s
->
block
,
width
,
height
,
width
,
s
->
threshold
,
s
->
percent
);
s
->
thresholding
(
s
->
block
,
width
,
height
,
width
,
s
->
threshold
,
s
->
percent
,
s
->
nsteps
);
s
->
hlowsize
[
0
]
=
(
width
+
1
)
>>
1
;
s
->
hhighsize
[
0
]
=
width
>>
1
;
...
...
@@ -520,6 +519,25 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
return
ff_filter_frame
(
outlink
,
out
);
}
static
av_cold
int
init
(
AVFilterContext
*
ctx
)
{
VagueDenoiserContext
*
s
=
ctx
->
priv
;
switch
(
s
->
method
)
{
case
0
:
s
->
thresholding
=
hard_thresholding
;
break
;
case
1
:
s
->
thresholding
=
soft_thresholding
;
break
;
case
2
:
s
->
thresholding
=
qian_thresholding
;
break
;
}
return
0
;
}
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
{
VagueDenoiserContext
*
s
=
ctx
->
priv
;
...
...
@@ -554,6 +572,7 @@ AVFilter ff_vf_vaguedenoiser = {
.
description
=
NULL_IF_CONFIG_SMALL
(
"Apply a Wavelet based Denoiser."
),
.
priv_size
=
sizeof
(
VagueDenoiserContext
),
.
priv_class
=
&
vaguedenoiser_class
,
.
init
=
init
,
.
uninit
=
uninit
,
.
query_formats
=
query_formats
,
.
inputs
=
vaguedenoiser_inputs
,
...
...
Write
Preview
Markdown
is supported
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