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
1206a10d
Commit
1206a10d
authored
May 23, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_biquads: implement 1st order allpass
parent
f3068be1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
6 deletions
+25
-6
filters.texi
doc/filters.texi
+3
-0
af_biquads.c
libavfilter/af_biquads.c
+22
-6
No files found.
doc/filters.texi
View file @
1206a10d
...
...
@@ -1568,6 +1568,9 @@ Specify which channels to filter, by default all available are filtered.
@item normalize, n
Normalize biquad coefficients, by default is disabled.
Enabling it will normalize magnitude response at DC to 0dB.
@item order, o
Set the filter order, can be 1 or 2. Default is 2.
@end table
@subsection Commands
...
...
libavfilter/af_biquads.c
View file @
1206a10d
...
...
@@ -113,6 +113,7 @@ typedef struct BiquadsContext {
double
mix
;
uint64_t
channels
;
int
normalize
;
int
order
;
double
a0
,
a1
,
a2
;
double
b0
,
b1
,
b2
;
...
...
@@ -264,6 +265,7 @@ static int config_filter(AVFilterLink *outlink, int reset)
AVFilterLink
*
inlink
=
ctx
->
inputs
[
0
];
double
A
=
ff_exp10
(
s
->
gain
/
40
);
double
w0
=
2
*
M_PI
*
s
->
frequency
/
inlink
->
sample_rate
;
double
K
=
tan
(
w0
/
2
.);
double
alpha
,
beta
;
if
(
w0
>
M_PI
)
{
...
...
@@ -389,6 +391,16 @@ static int config_filter(AVFilterLink *outlink, int reset)
}
break
;
case
allpass
:
switch
(
s
->
order
)
{
case
1
:
s
->
a0
=
1
.;
s
->
a1
=
-
(
1
.
-
K
)
/
(
1
.
+
K
);
s
->
a2
=
0
.;
s
->
b0
=
s
->
a1
;
s
->
b1
=
s
->
a0
;
s
->
b2
=
0
.;
break
;
case
2
:
s
->
a0
=
1
+
alpha
;
s
->
a1
=
-
2
*
cos
(
w0
);
s
->
a2
=
1
-
alpha
;
...
...
@@ -396,6 +408,8 @@ static int config_filter(AVFilterLink *outlink, int reset)
s
->
b1
=
-
2
*
cos
(
w0
);
s
->
b2
=
1
+
alpha
;
break
;
}
break
;
default
:
av_assert0
(
0
);
}
...
...
@@ -773,6 +787,8 @@ static const AVOption allpass_options[] = {
{
"c"
,
"set channels to filter"
,
OFFSET
(
channels
),
AV_OPT_TYPE_CHANNEL_LAYOUT
,
{.
i64
=-
1
},
INT64_MIN
,
INT64_MAX
,
FLAGS
},
{
"normalize"
,
"normalize coefficients"
,
OFFSET
(
normalize
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
FLAGS
},
{
"n"
,
"normalize coefficients"
,
OFFSET
(
normalize
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
FLAGS
},
{
"order"
,
"set filter order"
,
OFFSET
(
order
),
AV_OPT_TYPE_INT
,
{.
i64
=
2
},
1
,
2
,
FLAGS
},
{
"o"
,
"set filter order"
,
OFFSET
(
order
),
AV_OPT_TYPE_INT
,
{.
i64
=
2
},
1
,
2
,
FLAGS
},
{
NULL
}
};
...
...
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