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
b5355774
Commit
b5355774
authored
Jun 02, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_anlmdn: add smooth factor option
parent
cbaa6032
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
filters.texi
doc/filters.texi
+3
-0
af_anlmdn.c
libavfilter/af_anlmdn.c
+5
-3
No files found.
doc/filters.texi
View file @
b5355774
...
...
@@ -1801,6 +1801,9 @@ Pass only noise.
Default value is @var{o}.
@end table
@item m
Set smooth factor. Default value is @var{11}. Allowed range is from @var{1} to @var{15}.
@end table
@section anull
...
...
libavfilter/af_anlmdn.c
View file @
b5355774
...
...
@@ -29,7 +29,6 @@
#include "af_anlmdndsp.h"
#define MAX_DIFF 11.f
#define WEIGHT_LUT_NBITS 20
#define WEIGHT_LUT_SIZE (1<<WEIGHT_LUT_NBITS)
...
...
@@ -41,6 +40,7 @@ typedef struct AudioNLMeansContext {
float
a
;
int64_t
pd
;
int64_t
rd
;
float
m
;
int
om
;
float
pdiff_lut_scale
;
...
...
@@ -81,6 +81,7 @@ static const AVOption anlmdn_options[] = {
{
"i"
,
"input"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
IN_MODE
},
0
,
0
,
AF
,
"mode"
},
{
"o"
,
"output"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
OUT_MODE
},
0
,
0
,
AF
,
"mode"
},
{
"n"
,
"noise"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
NOISE_MODE
},
0
,
0
,
AF
,
"mode"
},
{
"m"
,
"set smooth factor"
,
OFFSET
(
m
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
11
.},
1
,
15
,
AF
},
{
NULL
}
};
...
...
@@ -178,7 +179,7 @@ static int config_output(AVFilterLink *outlink)
if
(
ret
<
0
)
return
ret
;
s
->
pdiff_lut_scale
=
1
.
f
/
MAX_DIFF
*
WEIGHT_LUT_SIZE
;
s
->
pdiff_lut_scale
=
1
.
f
/
s
->
m
*
WEIGHT_LUT_SIZE
;
for
(
int
i
=
0
;
i
<
WEIGHT_LUT_SIZE
;
i
++
)
{
float
w
=
-
i
/
s
->
pdiff_lut_scale
;
...
...
@@ -201,6 +202,7 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
float
*
cache
=
(
float
*
)
s
->
cache
->
extended_data
[
ch
];
const
float
sw
=
(
65536
.
f
/
(
4
*
K
+
2
))
/
sqrtf
(
s
->
a
);
float
*
dst
=
(
float
*
)
out
->
extended_data
[
ch
]
+
s
->
offset
;
const
float
smooth
=
s
->
m
;
for
(
int
i
=
S
;
i
<
s
->
H
+
S
;
i
++
)
{
float
P
=
0
.
f
,
Q
=
0
.
f
;
...
...
@@ -224,7 +226,7 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
av_assert2
(
distance
>=
0
.
f
);
w
=
distance
*
sw
;
if
(
w
>=
MAX_DIFF
)
if
(
w
>=
smooth
)
continue
;
weight_lut_idx
=
w
*
s
->
pdiff_lut_scale
;
av_assert2
(
weight_lut_idx
<
WEIGHT_LUT_SIZE
);
...
...
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