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
f46b04c4
Commit
f46b04c4
authored
Nov 22, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_biquads: add new normalize/n option
parent
e759fbfb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
0 deletions
+70
-0
filters.texi
doc/filters.texi
+39
-0
af_biquads.c
libavfilter/af_biquads.c
+31
-0
No files found.
doc/filters.texi
View file @
f46b04c4
...
...
@@ -1547,6 +1547,10 @@ Range is between 0 and 1.
@item channels, c
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.
@end table
@subsection Commands
...
...
@@ -2568,6 +2572,10 @@ Range is between 0 and 1.
@
item
channels
,
c
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
0
dB
.
@
end
table
@
subsection
Commands
...
...
@@ -2627,6 +2635,10 @@ Range is between 0 and 1.
@item channels, c
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.
@end table
@subsection Commands
...
...
@@ -2693,6 +2705,10 @@ Range is between 0 and 1.
@
item
channels
,
c
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
0
dB
.
@
end
table
@
subsection
Commands
...
...
@@ -2744,6 +2760,13 @@ Syntax for the command is : "@var{value}"
@
item
mix
,
m
How
much
to
use
filtered
signal
in
output
.
Default
is
1.
Range
is
between
0
and
1.
@
item
channels
,
c
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
0
dB
.
@
end
table
@
section
bs2b
...
...
@@ -3439,6 +3462,10 @@ Range is between 0 and 1.
@
item
channels
,
c
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
0
dB
.
@
end
table
@
subsection
Examples
...
...
@@ -3908,6 +3935,10 @@ Range is between 0 and 1.
@item channels, c
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.
@end table
@subsection Commands
...
...
@@ -4224,6 +4255,10 @@ Range is between 0 and 1.
@
item
channels
,
c
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
0
dB
.
@
end
table
@
subsection
Examples
...
...
@@ -5332,6 +5367,10 @@ Range is between 0 and 1.
@
item
channels
,
c
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
0
dB
.
@
end
table
@
subsection
Commands
...
...
libavfilter/af_biquads.c
View file @
f46b04c4
...
...
@@ -112,6 +112,7 @@ typedef struct BiquadsContext {
double
width
;
double
mix
;
uint64_t
channels
;
int
normalize
;
double
a0
,
a1
,
a2
;
double
b0
,
b1
,
b2
;
...
...
@@ -408,6 +409,14 @@ static int config_filter(AVFilterLink *outlink, int reset)
s
->
b2
/=
s
->
a0
;
s
->
a0
/=
s
->
a0
;
if
(
s
->
normalize
&&
fabs
(
s
->
b0
+
s
->
b1
+
s
->
b2
)
>
1e-6
)
{
double
factor
=
(
s
->
a0
+
s
->
a1
+
s
->
a2
)
/
(
s
->
b0
+
s
->
b1
+
s
->
b2
);
s
->
b0
*=
factor
;
s
->
b1
*=
factor
;
s
->
b2
*=
factor
;
}
s
->
cache
=
av_realloc_f
(
s
->
cache
,
sizeof
(
ChanCache
),
inlink
->
channels
);
if
(
!
s
->
cache
)
return
AVERROR
(
ENOMEM
);
...
...
@@ -585,6 +594,8 @@ static const AVOption equalizer_options[] = {
{
"m"
,
"set mix"
,
OFFSET
(
mix
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
1
,
FLAGS
},
{
"channels"
,
"set channels to filter"
,
OFFSET
(
channels
),
AV_OPT_TYPE_CHANNEL_LAYOUT
,
{.
i64
=-
1
},
INT64_MIN
,
INT64_MAX
,
FLAGS
},
{
"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
},
{
NULL
}
};
...
...
@@ -609,6 +620,8 @@ static const AVOption bass_options[] = {
{
"m"
,
"set mix"
,
OFFSET
(
mix
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
1
,
FLAGS
},
{
"channels"
,
"set channels to filter"
,
OFFSET
(
channels
),
AV_OPT_TYPE_CHANNEL_LAYOUT
,
{.
i64
=-
1
},
INT64_MIN
,
INT64_MAX
,
FLAGS
},
{
"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
},
{
NULL
}
};
...
...
@@ -633,6 +646,8 @@ static const AVOption treble_options[] = {
{
"m"
,
"set mix"
,
OFFSET
(
mix
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
1
,
FLAGS
},
{
"channels"
,
"set channels to filter"
,
OFFSET
(
channels
),
AV_OPT_TYPE_CHANNEL_LAYOUT
,
{.
i64
=-
1
},
INT64_MIN
,
INT64_MAX
,
FLAGS
},
{
"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
},
{
NULL
}
};
...
...
@@ -656,6 +671,8 @@ static const AVOption bandpass_options[] = {
{
"m"
,
"set mix"
,
OFFSET
(
mix
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
1
,
FLAGS
},
{
"channels"
,
"set channels to filter"
,
OFFSET
(
channels
),
AV_OPT_TYPE_CHANNEL_LAYOUT
,
{.
i64
=-
1
},
INT64_MIN
,
INT64_MAX
,
FLAGS
},
{
"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
},
{
NULL
}
};
...
...
@@ -678,6 +695,8 @@ static const AVOption bandreject_options[] = {
{
"m"
,
"set mix"
,
OFFSET
(
mix
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
1
,
FLAGS
},
{
"channels"
,
"set channels to filter"
,
OFFSET
(
channels
),
AV_OPT_TYPE_CHANNEL_LAYOUT
,
{.
i64
=-
1
},
INT64_MIN
,
INT64_MAX
,
FLAGS
},
{
"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
},
{
NULL
}
};
...
...
@@ -702,6 +721,8 @@ static const AVOption lowpass_options[] = {
{
"m"
,
"set mix"
,
OFFSET
(
mix
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
1
,
FLAGS
},
{
"channels"
,
"set channels to filter"
,
OFFSET
(
channels
),
AV_OPT_TYPE_CHANNEL_LAYOUT
,
{.
i64
=-
1
},
INT64_MIN
,
INT64_MAX
,
FLAGS
},
{
"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
},
{
NULL
}
};
...
...
@@ -726,6 +747,8 @@ static const AVOption highpass_options[] = {
{
"m"
,
"set mix"
,
OFFSET
(
mix
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
1
,
FLAGS
},
{
"channels"
,
"set channels to filter"
,
OFFSET
(
channels
),
AV_OPT_TYPE_CHANNEL_LAYOUT
,
{.
i64
=-
1
},
INT64_MIN
,
INT64_MAX
,
FLAGS
},
{
"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
},
{
NULL
}
};
...
...
@@ -748,6 +771,8 @@ static const AVOption allpass_options[] = {
{
"m"
,
"set mix"
,
OFFSET
(
mix
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
1
,
FLAGS
},
{
"channels"
,
"set channels to filter"
,
OFFSET
(
channels
),
AV_OPT_TYPE_CHANNEL_LAYOUT
,
{.
i64
=-
1
},
INT64_MIN
,
INT64_MAX
,
FLAGS
},
{
"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
},
{
NULL
}
};
...
...
@@ -772,6 +797,8 @@ static const AVOption lowshelf_options[] = {
{
"m"
,
"set mix"
,
OFFSET
(
mix
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
1
,
FLAGS
},
{
"channels"
,
"set channels to filter"
,
OFFSET
(
channels
),
AV_OPT_TYPE_CHANNEL_LAYOUT
,
{.
i64
=-
1
},
INT64_MIN
,
INT64_MAX
,
FLAGS
},
{
"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
},
{
NULL
}
};
...
...
@@ -796,6 +823,8 @@ static const AVOption highshelf_options[] = {
{
"m"
,
"set mix"
,
OFFSET
(
mix
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
1
,
FLAGS
},
{
"channels"
,
"set channels to filter"
,
OFFSET
(
channels
),
AV_OPT_TYPE_CHANNEL_LAYOUT
,
{.
i64
=-
1
},
INT64_MIN
,
INT64_MAX
,
FLAGS
},
{
"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
},
{
NULL
}
};
...
...
@@ -813,6 +842,8 @@ static const AVOption biquad_options[] = {
{
"m"
,
"set mix"
,
OFFSET
(
mix
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
1
,
FLAGS
},
{
"channels"
,
"set channels to filter"
,
OFFSET
(
channels
),
AV_OPT_TYPE_CHANNEL_LAYOUT
,
{.
i64
=-
1
},
INT64_MIN
,
INT64_MAX
,
FLAGS
},
{
"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
},
{
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