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
fee7c15d
Commit
fee7c15d
authored
Apr 20, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_surround: allow user to change overlap and win_func
parent
3a07aec8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
3 deletions
+41
-3
filters.texi
doc/filters.texi
+7
-0
af_surround.c
libavfilter/af_surround.c
+34
-3
No files found.
doc/filters.texi
View file @
fee7c15d
...
@@ -4882,6 +4882,13 @@ Set LFE input volume. By default, this is @var{1}.
...
@@ -4882,6 +4882,13 @@ Set LFE input volume. By default, this is @var{1}.
@item lfe_out
@item lfe_out
Set LFE output volume. By default, this is @var{1}.
Set LFE output volume. By default, this is @var{1}.
@item win_func
Set window function, default is @code{hann}.
@item overlap
Set window overlap. If set to 1, the recommended overlap for selected
window function will be picked. Default is @code{0.5}.
@end table
@end table
@section treble, highshelf
@section treble, highshelf
...
...
libavfilter/af_surround.c
View file @
fee7c15d
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "avfilter.h"
#include "avfilter.h"
#include "audio.h"
#include "audio.h"
#include "formats.h"
#include "formats.h"
#include "window_func.h"
typedef
struct
AudioSurroundContext
{
typedef
struct
AudioSurroundContext
{
const
AVClass
*
class
;
const
AVClass
*
class
;
...
@@ -38,6 +39,8 @@ typedef struct AudioSurroundContext {
...
@@ -38,6 +39,8 @@ typedef struct AudioSurroundContext {
float
fc_out
;
float
fc_out
;
float
lfe_in
;
float
lfe_in
;
float
lfe_out
;
float
lfe_out
;
int
win_func
;
float
overlap
;
float
*
input_levels
;
float
*
input_levels
;
float
*
output_levels
;
float
*
output_levels
;
...
@@ -1288,10 +1291,15 @@ fail:
...
@@ -1288,10 +1291,15 @@ fail:
if
(
!
s
->
window_func_lut
)
if
(
!
s
->
window_func_lut
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
generate_window_func
(
s
->
window_func_lut
,
s
->
buf_size
,
s
->
win_func
,
&
overlap
);
if
(
s
->
overlap
==
1
)
s
->
overlap
=
overlap
;
for
(
i
=
0
;
i
<
s
->
buf_size
;
i
++
)
for
(
i
=
0
;
i
<
s
->
buf_size
;
i
++
)
s
->
window_func_lut
[
i
]
=
sqrtf
(
0
.
5
*
(
1
-
cosf
(
2
*
M_PI
*
i
/
s
->
buf_size
))
/
s
->
buf_size
);
s
->
window_func_lut
[
i
]
=
sqrtf
(
s
->
window_func_lut
[
i
]
/
s
->
buf_size
);
overlap
=
.
5
;
s
->
hop_size
=
s
->
buf_size
*
(
1
.
-
s
->
overlap
);
s
->
hop_size
=
s
->
buf_size
*
(
1
.
-
overlap
);
if
(
s
->
hop_size
<=
0
)
return
AVERROR
(
EINVAL
);
return
0
;
return
0
;
}
}
...
@@ -1449,6 +1457,29 @@ static const AVOption surround_options[] = {
...
@@ -1449,6 +1457,29 @@ static const AVOption surround_options[] = {
{
"fc_out"
,
"set front center channel output level"
,
OFFSET
(
fc_out
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
},
0
,
10
,
FLAGS
},
{
"fc_out"
,
"set front center channel output level"
,
OFFSET
(
fc_out
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
},
0
,
10
,
FLAGS
},
{
"lfe_in"
,
"set lfe channel input level"
,
OFFSET
(
lfe_in
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
},
0
,
10
,
FLAGS
},
{
"lfe_in"
,
"set lfe channel input level"
,
OFFSET
(
lfe_in
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
},
0
,
10
,
FLAGS
},
{
"lfe_out"
,
"set lfe channel output level"
,
OFFSET
(
lfe_out
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
},
0
,
10
,
FLAGS
},
{
"lfe_out"
,
"set lfe channel output level"
,
OFFSET
(
lfe_out
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
},
0
,
10
,
FLAGS
},
{
"win_func"
,
"set window function"
,
OFFSET
(
win_func
),
AV_OPT_TYPE_INT
,
{.
i64
=
WFUNC_HANNING
},
0
,
NB_WFUNC
-
1
,
FLAGS
,
"win_func"
},
{
"rect"
,
"Rectangular"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_RECT
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"bartlett"
,
"Bartlett"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_BARTLETT
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"hann"
,
"Hann"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_HANNING
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"hanning"
,
"Hanning"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_HANNING
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"hamming"
,
"Hamming"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_HAMMING
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"blackman"
,
"Blackman"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_BLACKMAN
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"welch"
,
"Welch"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_WELCH
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"flattop"
,
"Flat-top"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_FLATTOP
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"bharris"
,
"Blackman-Harris"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_BHARRIS
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"bnuttall"
,
"Blackman-Nuttall"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_BNUTTALL
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"bhann"
,
"Bartlett-Hann"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_BHANN
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"sine"
,
"Sine"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_SINE
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"nuttall"
,
"Nuttall"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_NUTTALL
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"lanczos"
,
"Lanczos"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_LANCZOS
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"gauss"
,
"Gauss"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_GAUSS
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"tukey"
,
"Tukey"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_TUKEY
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"dolph"
,
"Dolph-Chebyshev"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_DOLPH
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"cauchy"
,
"Cauchy"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_CAUCHY
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"parzen"
,
"Parzen"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_PARZEN
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"poisson"
,
"Poisson"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_POISSON
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"bohman"
,
"Bohman"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_BOHMAN
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"overlap"
,
"set window overlap"
,
OFFSET
(
overlap
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
.
5
},
0
,
1
,
FLAGS
},
{
NULL
}
{
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