Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
13d26716
Commit
13d26716
authored
Oct 21, 2012
by
Clément Bœsch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/showspectrum: add sliding mode.
parent
b19bfd6c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
+17
-5
filters.texi
doc/filters.texi
+3
-0
avf_showspectrum.c
libavfilter/avf_showspectrum.c
+13
-4
version.h
libavfilter/version.h
+1
-1
No files found.
doc/filters.texi
View file @
13d26716
...
...
@@ -4704,6 +4704,9 @@ The filter accepts the following named parameters:
@table @option
@item size, s
Specify the video size for the output. Default value is @code{640x480}.
@item slide
Specify if the spectrum should slide along the window. Default value is
@code{0}.
@end table
The usage is very similar to the showwaves filter; see the examples in that
...
...
libavfilter/avf_showspectrum.c
View file @
13d26716
...
...
@@ -37,6 +37,7 @@ typedef struct {
int
w
,
h
;
AVFilterBufferRef
*
outpicref
;
int
req_fullfilled
;
int
sliding
;
///< 1 if sliding mode, 0 otherwise
int
xpos
;
///< x position (current column)
RDFTContext
*
rdft
;
///< Real Discrete Fourier Transform context
int
rdft_bits
;
///< number of bits (RDFT window size = 1<<rdft_bits)
...
...
@@ -52,6 +53,7 @@ typedef struct {
static
const
AVOption
showspectrum_options
[]
=
{
{
"size"
,
"set video size"
,
OFFSET
(
w
),
AV_OPT_TYPE_IMAGE_SIZE
,
{.
str
=
"640x480"
},
0
,
0
,
FLAGS
},
{
"s"
,
"set video size"
,
OFFSET
(
w
),
AV_OPT_TYPE_IMAGE_SIZE
,
{.
str
=
"640x480"
},
0
,
0
,
FLAGS
},
{
"slide"
,
"set sliding mode"
,
OFFSET
(
sliding
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
FLAGS
},
{
NULL
},
};
...
...
@@ -247,16 +249,23 @@ static int plot_spectrum_column(AVFilterLink *inlink, AVFilterBufferRef *insampl
for
(
y
=
0
;
y
<
outlink
->
h
;
y
++
)
{
// FIXME: bin[0] contains first and last bins
const
int
pos
=
showspectrum
->
xpos
*
3
+
(
outlink
->
h
-
y
-
1
)
*
outpicref
->
linesize
[
0
];
uint8_t
*
p
=
outpicref
->
data
[
0
]
+
(
outlink
->
h
-
y
-
1
)
*
outpicref
->
linesize
[
0
];
const
double
w
=
1
.
/
sqrt
(
nb_freq
);
int
a
=
sqrt
(
w
*
MAGNITUDE
(
RE
(
0
),
IM
(
0
)));
int
b
=
nb_display_channels
>
1
?
sqrt
(
w
*
MAGNITUDE
(
RE
(
1
),
IM
(
1
)))
:
a
;
if
(
showspectrum
->
sliding
)
{
memmove
(
p
,
p
+
3
,
(
outlink
->
w
-
1
)
*
3
);
p
+=
(
outlink
->
w
-
1
)
*
3
;
}
else
{
p
+=
showspectrum
->
xpos
*
3
;
}
a
=
FFMIN
(
a
,
255
);
b
=
FFMIN
(
b
,
255
);
outpicref
->
data
[
0
][
pos
]
=
a
;
outpicref
->
data
[
0
][
pos
+
1
]
=
b
;
outpicref
->
data
[
0
][
pos
+
2
]
=
(
a
+
b
)
/
2
;
p
[
0
]
=
a
;
p
[
1
]
=
b
;
p
[
2
]
=
(
a
+
b
)
/
2
;
}
outpicref
->
pts
=
insamples
->
pts
+
av_rescale_q
(
showspectrum
->
consumed
,
...
...
libavfilter/version.h
View file @
13d26716
...
...
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 20
#define LIBAVFILTER_VERSION_MICRO 10
5
#define LIBAVFILTER_VERSION_MICRO 10
6
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
...
...
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