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
007c13e5
Commit
007c13e5
authored
Mar 01, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_anlmdn: add output mode option
parent
85051feb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
filters.texi
doc/filters.texi
+17
-0
af_anlmdn.c
libavfilter/af_anlmdn.c
+18
-1
No files found.
doc/filters.texi
View file @
007c13e5
...
...
@@ -1773,6 +1773,23 @@ Default value is 2 milliseconds.
@item r
Set research radius duration. Allowed range is from 2 to 300 milliseconds.
Default value is 6 milliseconds.
@item o
Set the output mode.
It accepts the following values:
@table @option
@item i
Pass input unchanged.
@item o
Pass noise filtered out.
@item n
Pass only noise.
Default value is @var{o}.
@end table
@end table
@section anull
...
...
libavfilter/af_anlmdn.c
View file @
007c13e5
...
...
@@ -41,6 +41,7 @@ typedef struct AudioNLMeansContext {
float
a
;
int64_t
pd
;
int64_t
rd
;
int
om
;
float
pdiff_lut_scale
;
float
weight_lut
[
WEIGHT_LUT_SIZE
];
...
...
@@ -62,6 +63,13 @@ typedef struct AudioNLMeansContext {
AudioNLMDNDSPContext
dsp
;
}
AudioNLMeansContext
;
enum
OutModes
{
IN_MODE
,
OUT_MODE
,
NOISE_MODE
,
NB_MODES
};
#define OFFSET(x) offsetof(AudioNLMeansContext, x)
#define AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
...
...
@@ -69,6 +77,10 @@ static const AVOption anlmdn_options[] = {
{
"s"
,
"set denoising strength"
,
OFFSET
(
a
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
.
00001
},
0
.
00001
,
10
,
AF
},
{
"p"
,
"set patch duration"
,
OFFSET
(
pd
),
AV_OPT_TYPE_DURATION
,
{.
i64
=
2000
},
1000
,
100000
,
AF
},
{
"r"
,
"set research duration"
,
OFFSET
(
rd
),
AV_OPT_TYPE_DURATION
,
{.
i64
=
6000
},
2000
,
300000
,
AF
},
{
"o"
,
"set output mode"
,
OFFSET
(
om
),
AV_OPT_TYPE_INT
,
{.
i64
=
OUT_MODE
},
0
,
NB_MODES
-
1
,
AF
,
"mode"
},
{
"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"
},
{
NULL
}
};
...
...
@@ -184,6 +196,7 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
AVFrame
*
out
=
arg
;
const
int
S
=
s
->
S
;
const
int
K
=
s
->
K
;
const
int
om
=
s
->
om
;
const
float
*
f
=
(
const
float
*
)(
s
->
in
->
extended_data
[
ch
])
+
K
;
float
*
cache
=
(
float
*
)
s
->
cache
->
extended_data
[
ch
];
const
float
sw
=
(
65536
.
f
/
(
4
*
K
+
2
))
/
sqrtf
(
s
->
a
);
...
...
@@ -223,7 +236,11 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
P
+=
f
[
i
];
Q
+=
1
;
dst
[
i
-
S
]
=
P
/
Q
;
switch
(
om
)
{
case
IN_MODE
:
dst
[
i
-
S
]
=
f
[
i
];
break
;
case
OUT_MODE
:
dst
[
i
-
S
]
=
P
/
Q
;
break
;
case
NOISE_MODE
:
dst
[
i
-
S
]
=
f
[
i
]
-
(
P
/
Q
);
break
;
}
}
return
0
;
...
...
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