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
f2b1df73
Commit
f2b1df73
authored
Sep 15, 2015
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/avf_showfreqs: add lanczos and gauss windowing functions
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
1c853d57
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
avf_showfreqs.c
libavfilter/avf_showfreqs.c
+14
-1
No files found.
libavfilter/avf_showfreqs.c
View file @
f2b1df73
...
...
@@ -39,7 +39,7 @@ enum AmplitudeScale { AS_LINEAR, AS_SQRT, AS_CBRT, AS_LOG, NB_ASCALES };
enum
WindowFunc
{
WFUNC_RECT
,
WFUNC_HANNING
,
WFUNC_HAMMING
,
WFUNC_BLACKMAN
,
WFUNC_BARTLETT
,
WFUNC_WELCH
,
WFUNC_FLATTOP
,
WFUNC_BHARRIS
,
WFUNC_BNUTTALL
,
WFUNC_SINE
,
WFUNC_NUTTALL
,
WFUNC_BHANN
,
NB_WFUNC
};
WFUNC_BHANN
,
WFUNC_LANCZOS
,
WFUNC_GAUSS
,
NB_WFUNC
};
typedef
struct
ShowFreqsContext
{
const
AVClass
*
class
;
...
...
@@ -110,6 +110,8 @@ static const AVOption showfreqs_options[] = {
{
"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"
},
{
"overlap"
,
"set window overlap"
,
OFFSET
(
overlap
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
.},
0
.,
1
.,
FLAGS
},
{
"averaging"
,
"set time averaging"
,
OFFSET
(
avg
),
AV_OPT_TYPE_INT
,
{.
i64
=
1
},
0
,
INT32_MAX
,
FLAGS
},
{
"colors"
,
"set channels colors"
,
OFFSET
(
colors
),
AV_OPT_TYPE_STRING
,
{.
str
=
"red|green|blue|yellow|orange|lime|pink|magenta|brown"
},
0
,
0
,
FLAGS
},
...
...
@@ -221,6 +223,17 @@ static void generate_window_func(float *lut, int N, int win_func, float *overlap
lut
[
n
]
=
0
.
355768
-
0
.
487396
*
cos
(
2
*
M_PI
*
n
/
(
N
-
1
))
+
0
.
144232
*
cos
(
4
*
M_PI
*
n
/
(
N
-
1
))
-
0
.
012604
*
cos
(
6
*
M_PI
*
n
/
(
N
-
1
));
*
overlap
=
0
.
663
;
break
;
case
WFUNC_LANCZOS
:
#define SINC(x) (!(x)) ? 1 : sin(M_PI * (x))/(M_PI * (x));
for
(
n
=
0
;
n
<
N
;
n
++
)
lut
[
n
]
=
SINC
((
2
.
*
n
)
/
(
N
-
1
)
-
1
);
*
overlap
=
0
.
75
;
break
;
case
WFUNC_GAUSS
:
for
(
n
=
0
;
n
<
N
;
n
++
)
lut
[
n
]
=
pow
(
M_E
,
-
0
.
5
*
pow
((
n
-
(
N
-
1
)
/
2
)
/
(
0
.
4
*
(
N
-
1
)
/
2
.
f
),
2
));
*
overlap
=
0
.
75
;
break
;
default:
av_assert0
(
0
);
}
...
...
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