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
84e9a55d
Commit
84e9a55d
authored
Nov 21, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_afftdn: simplify changing commands
parent
8e2a832a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
41 deletions
+23
-41
af_afftdn.c
libavfilter/af_afftdn.c
+23
-41
No files found.
libavfilter/af_afftdn.c
View file @
84e9a55d
...
...
@@ -141,24 +141,25 @@ typedef struct AudioFFTDeNoiseContext {
}
AudioFFTDeNoiseContext
;
#define OFFSET(x) offsetof(AudioFFTDeNoiseContext, x)
#define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
#define AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
#define AFR AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
static
const
AVOption
afftdn_options
[]
=
{
{
"nr"
,
"set the noise reduction"
,
OFFSET
(
noise_reduction
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
12
},
.
01
,
97
,
A
},
{
"nf"
,
"set the noise floor"
,
OFFSET
(
noise_floor
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=-
50
},
-
80
,
-
20
,
A
},
{
"nt"
,
"set the noise type"
,
OFFSET
(
noise_type
),
AV_OPT_TYPE_INT
,
{.
i64
=
WHITE_NOISE
},
WHITE_NOISE
,
NB_NOISE
-
1
,
A
,
"type"
},
{
"w"
,
"white noise"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WHITE_NOISE
},
0
,
0
,
A
,
"type"
},
{
"v"
,
"vinyl noise"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
VINYL_NOISE
},
0
,
0
,
A
,
"type"
},
{
"s"
,
"shellac noise"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
SHELLAC_NOISE
},
0
,
0
,
A
,
"type"
},
{
"c"
,
"custom noise"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
CUSTOM_NOISE
},
0
,
0
,
A
,
"type"
},
{
"bn"
,
"set the custom bands noise"
,
OFFSET
(
band_noise_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
0
},
0
,
0
,
A
},
{
"rf"
,
"set the residual floor"
,
OFFSET
(
residual_floor
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=-
38
},
-
80
,
-
20
,
A
},
{
"tn"
,
"track noise"
,
OFFSET
(
track_noise
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
A
},
{
"tr"
,
"track residual"
,
OFFSET
(
track_residual
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
A
},
{
"om"
,
"set output mode"
,
OFFSET
(
output_mode
),
AV_OPT_TYPE_INT
,
{.
i64
=
OUT_MODE
},
0
,
NB_MODES
-
1
,
A
,
"mode"
},
{
"i"
,
"input"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
IN_MODE
},
0
,
0
,
A
,
"mode"
},
{
"o"
,
"output"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
OUT_MODE
},
0
,
0
,
A
,
"mode"
},
{
"n"
,
"noise"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
NOISE_MODE
},
0
,
0
,
A
,
"mode"
},
{
"nr"
,
"set the noise reduction"
,
OFFSET
(
noise_reduction
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
12
},
.
01
,
97
,
A
FR
},
{
"nf"
,
"set the noise floor"
,
OFFSET
(
noise_floor
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=-
50
},
-
80
,
-
20
,
A
FR
},
{
"nt"
,
"set the noise type"
,
OFFSET
(
noise_type
),
AV_OPT_TYPE_INT
,
{.
i64
=
WHITE_NOISE
},
WHITE_NOISE
,
NB_NOISE
-
1
,
A
F
,
"type"
},
{
"w"
,
"white noise"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WHITE_NOISE
},
0
,
0
,
A
F
,
"type"
},
{
"v"
,
"vinyl noise"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
VINYL_NOISE
},
0
,
0
,
A
F
,
"type"
},
{
"s"
,
"shellac noise"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
SHELLAC_NOISE
},
0
,
0
,
A
F
,
"type"
},
{
"c"
,
"custom noise"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
CUSTOM_NOISE
},
0
,
0
,
A
F
,
"type"
},
{
"bn"
,
"set the custom bands noise"
,
OFFSET
(
band_noise_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
0
},
0
,
0
,
A
F
},
{
"rf"
,
"set the residual floor"
,
OFFSET
(
residual_floor
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=-
38
},
-
80
,
-
20
,
A
FR
},
{
"tn"
,
"track noise"
,
OFFSET
(
track_noise
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
A
FR
},
{
"tr"
,
"track residual"
,
OFFSET
(
track_residual
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
A
FR
},
{
"om"
,
"set output mode"
,
OFFSET
(
output_mode
),
AV_OPT_TYPE_INT
,
{.
i64
=
OUT_MODE
},
0
,
NB_MODES
-
1
,
A
FR
,
"mode"
},
{
"i"
,
"input"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
IN_MODE
},
0
,
0
,
A
FR
,
"mode"
},
{
"o"
,
"output"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
OUT_MODE
},
0
,
0
,
A
FR
,
"mode"
},
{
"n"
,
"noise"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
NOISE_MODE
},
0
,
0
,
A
FR
,
"mode"
},
{
NULL
}
};
...
...
@@ -1375,6 +1376,7 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar
{
AudioFFTDeNoiseContext
*
s
=
ctx
->
priv
;
int
need_reset
=
0
;
int
ret
=
0
;
if
(
!
strcmp
(
cmd
,
"sample_noise"
)
||
!
strcmp
(
cmd
,
"sn"
))
{
...
...
@@ -1386,31 +1388,11 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar
s
->
sample_noise_start
=
0
;
s
->
sample_noise_end
=
1
;
}
}
else
if
(
!
strcmp
(
cmd
,
"nr"
)
||
!
strcmp
(
cmd
,
"noise_reduction"
))
{
float
nr
;
if
(
av_sscanf
(
args
,
"%f"
,
&
nr
)
==
1
)
{
s
->
noise_reduction
=
av_clipf
(
nr
,
0
.
01
,
97
);
need_reset
=
1
;
}
}
else
if
(
!
strcmp
(
cmd
,
"nf"
)
||
!
strcmp
(
cmd
,
"noise_floor"
))
{
float
nf
;
if
(
av_sscanf
(
args
,
"%f"
,
&
nf
)
==
1
)
{
s
->
noise_floor
=
av_clipf
(
nf
,
-
80
,
-
20
);
need_reset
=
1
;
}
}
else
if
(
!
strcmp
(
cmd
,
"output_mode"
)
||
!
strcmp
(
cmd
,
"om"
))
{
if
(
!
strcmp
(
args
,
"i"
))
{
s
->
output_mode
=
IN_MODE
;
}
else
if
(
!
strcmp
(
args
,
"o"
))
{
s
->
output_mode
=
OUT_MODE
;
}
else
if
(
!
strcmp
(
args
,
"n"
))
{
s
->
output_mode
=
NOISE_MODE
;
}
}
else
{
ret
=
ff_filter_process_command
(
ctx
,
cmd
,
args
,
res
,
res_len
,
flags
);
if
(
ret
<
0
)
return
ret
;
need_reset
=
1
;
}
if
(
need_reset
)
...
...
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