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
f88546b4
Commit
f88546b4
authored
Dec 28, 2015
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/avf_showspectrum: use ff_generate_window_func
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
45b3e6e0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
32 deletions
+32
-32
filters.texi
doc/filters.texi
+12
-5
Makefile
libavfilter/Makefile
+1
-1
avf_showspectrum.c
libavfilter/avf_showspectrum.c
+19
-26
No files found.
doc/filters.texi
View file @
f88546b4
...
...
@@ -14647,14 +14647,21 @@ Set window function.
It accepts the following values:
@table @samp
@item
none
No samples pre-processing (do not expect this to be faster)
@item
rect
@item bartlett
@item hann
Hann window
@item hanning
@item hamming
Hamming window
@item blackman
Blackman window
@item welch
@item flattop
@item bharris
@item bnuttall
@item bhann
@item sine
@item nuttall
@item lanczos
@item gauss
@end table
Default value is @code{hann}.
...
...
libavfilter/Makefile
View file @
f88546b4
...
...
@@ -285,7 +285,7 @@ OBJS-$(CONFIG_AVECTORSCOPE_FILTER) += avf_avectorscope.o
OBJS-$(CONFIG_CONCAT_FILTER)
+=
avf_concat.o
OBJS-$(CONFIG_SHOWCQT_FILTER)
+=
avf_showcqt.o
lswsutils.o
lavfutils.o
OBJS-$(CONFIG_SHOWFREQS_FILTER)
+=
avf_showfreqs.o
window_func.o
OBJS-$(CONFIG_SHOWSPECTRUM_FILTER)
+=
avf_showspectrum.o
OBJS-$(CONFIG_SHOWSPECTRUM_FILTER)
+=
avf_showspectrum.o
window_func.o
OBJS-$(CONFIG_SHOWVOLUME_FILTER)
+=
avf_showvolume.o
OBJS-$(CONFIG_SHOWWAVES_FILTER)
+=
avf_showwaves.o
OBJS-$(CONFIG_SHOWWAVESPIC_FILTER)
+=
avf_showwaves.o
...
...
libavfilter/avf_showspectrum.c
View file @
f88546b4
...
...
@@ -33,11 +33,11 @@
#include "libavutil/opt.h"
#include "avfilter.h"
#include "internal.h"
#include "window_func.h"
enum
DisplayMode
{
COMBINED
,
SEPARATE
,
NB_MODES
};
enum
DisplayScale
{
LINEAR
,
SQRT
,
CBRT
,
LOG
,
NB_SCALES
};
enum
ColorMode
{
CHANNEL
,
INTENSITY
,
NB_CLMODES
};
enum
WindowFunc
{
WFUNC_NONE
,
WFUNC_HANN
,
WFUNC_HAMMING
,
WFUNC_BLACKMAN
,
NB_WFUNC
};
enum
SlideMode
{
REPLACE
,
SCROLL
,
FULLFRAME
,
RSCROLL
,
NB_SLIDES
};
typedef
struct
{
...
...
@@ -57,6 +57,7 @@ typedef struct {
FFTSample
**
rdft_data
;
///< bins holder for each (displayed) channels
float
*
window_func_lut
;
///< Window function LUT
int
win_func
;
float
overlap
;
float
*
combine_buffer
;
///< color combining buffer (3 * h items)
}
ShowSpectrumContext
;
...
...
@@ -83,10 +84,22 @@ static const AVOption showspectrum_options[] = {
{
"log"
,
"logarithmic"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
LOG
},
0
,
0
,
FLAGS
,
"scale"
},
{
"lin"
,
"linear"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
LINEAR
},
0
,
0
,
FLAGS
,
"scale"
},
{
"saturation"
,
"color saturation multiplier"
,
OFFSET
(
saturation
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
},
-
10
,
10
,
FLAGS
},
{
"win_func"
,
"set window function"
,
OFFSET
(
win_func
),
AV_OPT_TYPE_INT
,
{.
i64
=
WFUNC_HANN
},
0
,
NB_WFUNC
-
1
,
FLAGS
,
"win_func"
},
{
"hann"
,
"Hann window"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_HANN
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"hamming"
,
"Hamming window"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_HAMMING
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"blackman"
,
"Blackman window"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
WFUNC_BLACKMAN
},
0
,
0
,
FLAGS
,
"win_func"
},
{
"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"
},
{
NULL
}
};
...
...
@@ -203,27 +216,7 @@ static int config_output(AVFilterLink *outlink)
sizeof
(
*
s
->
window_func_lut
));
if
(
!
s
->
window_func_lut
)
return
AVERROR
(
ENOMEM
);
switch
(
s
->
win_func
)
{
case
WFUNC_NONE
:
for
(
i
=
0
;
i
<
win_size
;
i
++
)
s
->
window_func_lut
[
i
]
=
1
.;
break
;
case
WFUNC_HANN
:
for
(
i
=
0
;
i
<
win_size
;
i
++
)
s
->
window_func_lut
[
i
]
=
.
5
f
*
(
1
-
cos
(
2
*
M_PI
*
i
/
(
win_size
-
1
)));
break
;
case
WFUNC_HAMMING
:
for
(
i
=
0
;
i
<
win_size
;
i
++
)
s
->
window_func_lut
[
i
]
=
.
54
f
-
.
46
f
*
cos
(
2
*
M_PI
*
i
/
(
win_size
-
1
));
break
;
case
WFUNC_BLACKMAN
:
{
for
(
i
=
0
;
i
<
win_size
;
i
++
)
s
->
window_func_lut
[
i
]
=
.
42
f
-
.
5
f
*
cos
(
2
*
M_PI
*
i
/
(
win_size
-
1
))
+
.
08
f
*
cos
(
4
*
M_PI
*
i
/
(
win_size
-
1
));
break
;
}
default:
av_assert0
(
0
);
}
ff_generate_window_func
(
s
->
window_func_lut
,
win_size
,
s
->
win_func
,
&
s
->
overlap
);
/* prepare the initial picref buffer (black frame) */
av_frame_free
(
&
s
->
outpicref
);
...
...
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