Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
e6f0cec8
Commit
e6f0cec8
authored
May 14, 2022
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_acrossover: add precision option
parent
8b64d8d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
1 deletion
+59
-1
filters.texi
doc/filters.texi
+16
-0
af_acrossover.c
libavfilter/af_acrossover.c
+43
-1
No files found.
doc/filters.texi
View file @
e6f0cec8
...
@@ -557,6 +557,22 @@ Set input gain level. Allowed range is from 0 to 1. Default value is 1.
...
@@ -557,6 +557,22 @@ Set input gain level. Allowed range is from 0 to 1. Default value is 1.
@item gains
@item gains
Set output gain for each band. Default value is 1 for all bands.
Set output gain for each band. Default value is 1 for all bands.
@item precision
Set which precision to use when processing samples.
@table @option
@item auto
Auto pick internal sample format depending on other filters.
@item float
Always use single-floating point precision sample format.
@item double
Always use double-floating point precision sample format.
@end table
Default value is @code{auto}.
@end table
@end table
@subsection Examples
@subsection Examples
...
...
libavfilter/af_acrossover.c
View file @
e6f0cec8
...
@@ -58,6 +58,7 @@ typedef struct AudioCrossoverContext {
...
@@ -58,6 +58,7 @@ typedef struct AudioCrossoverContext {
char
*
gains_str
;
char
*
gains_str
;
int
order_opt
;
int
order_opt
;
float
level_in
;
float
level_in
;
int
precision
;
int
order
;
int
order
;
int
filter_count
;
int
filter_count
;
...
@@ -99,11 +100,52 @@ static const AVOption acrossover_options[] = {
...
@@ -99,11 +100,52 @@ static const AVOption acrossover_options[] = {
{
"20th"
,
"20th order (120 dB/8ve)"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
9
},
0
,
0
,
AF
,
"m"
},
{
"20th"
,
"20th order (120 dB/8ve)"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
9
},
0
,
0
,
AF
,
"m"
},
{
"level"
,
"set input gain"
,
OFFSET
(
level_in
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
},
0
,
1
,
AF
},
{
"level"
,
"set input gain"
,
OFFSET
(
level_in
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
},
0
,
1
,
AF
},
{
"gain"
,
"set output bands gain"
,
OFFSET
(
gains_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"1.f"
},
0
,
0
,
AF
},
{
"gain"
,
"set output bands gain"
,
OFFSET
(
gains_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"1.f"
},
0
,
0
,
AF
},
{
"precision"
,
"set processing precision"
,
OFFSET
(
precision
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
2
,
AF
,
"precision"
},
{
"auto"
,
"set auto processing precision"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
AF
,
"precision"
},
{
"float"
,
"set single-floating point processing precision"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
AF
,
"precision"
},
{
"double"
,
"set double-floating point processing precision"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
2
},
0
,
0
,
AF
,
"precision"
},
{
NULL
}
{
NULL
}
};
};
AVFILTER_DEFINE_CLASS
(
acrossover
);
AVFILTER_DEFINE_CLASS
(
acrossover
);
static
int
query_formats
(
AVFilterContext
*
ctx
)
{
AudioCrossoverContext
*
s
=
ctx
->
priv
;
static
const
enum
AVSampleFormat
auto_sample_fmts
[]
=
{
AV_SAMPLE_FMT_FLTP
,
AV_SAMPLE_FMT_DBLP
,
AV_SAMPLE_FMT_NONE
};
enum
AVSampleFormat
sample_fmts
[]
=
{
AV_SAMPLE_FMT_FLTP
,
AV_SAMPLE_FMT_NONE
};
const
enum
AVSampleFormat
*
sample_fmts_list
=
sample_fmts
;
int
ret
=
ff_set_common_all_channel_counts
(
ctx
);
if
(
ret
<
0
)
return
ret
;
switch
(
s
->
precision
)
{
case
0
:
sample_fmts_list
=
auto_sample_fmts
;
break
;
case
1
:
sample_fmts
[
0
]
=
AV_SAMPLE_FMT_FLTP
;
break
;
case
2
:
sample_fmts
[
0
]
=
AV_SAMPLE_FMT_DBLP
;
break
;
default:
break
;
}
ret
=
ff_set_common_formats_from_list
(
ctx
,
sample_fmts_list
);
if
(
ret
<
0
)
return
ret
;
return
ff_set_common_all_samplerates
(
ctx
);
}
static
int
parse_gains
(
AVFilterContext
*
ctx
)
static
int
parse_gains
(
AVFilterContext
*
ctx
)
{
{
AudioCrossoverContext
*
s
=
ctx
->
priv
;
AudioCrossoverContext
*
s
=
ctx
->
priv
;
...
@@ -586,7 +628,7 @@ const AVFilter ff_af_acrossover = {
...
@@ -586,7 +628,7 @@ const AVFilter ff_af_acrossover = {
.
uninit
=
uninit
,
.
uninit
=
uninit
,
FILTER_INPUTS
(
inputs
),
FILTER_INPUTS
(
inputs
),
.
outputs
=
NULL
,
.
outputs
=
NULL
,
FILTER_
SAMPLEFMTS
(
AV_SAMPLE_FMT_FLTP
,
AV_SAMPLE_FMT_DBLP
),
FILTER_
QUERY_FUNC
(
query_formats
),
.
flags
=
AVFILTER_FLAG_DYNAMIC_OUTPUTS
|
.
flags
=
AVFILTER_FLAG_DYNAMIC_OUTPUTS
|
AVFILTER_FLAG_SLICE_THREADS
,
AVFILTER_FLAG_SLICE_THREADS
,
};
};
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