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
04a8bbca
Commit
04a8bbca
authored
Aug 05, 2016
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/avf_showspectrum: add color rotation feature
Mostly useful with channel color scheme.
parent
6803a298
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
filters.texi
doc/filters.texi
+8
-0
avf_showspectrum.c
libavfilter/avf_showspectrum.c
+11
-4
No files found.
doc/filters.texi
View file @
04a8bbca
...
@@ -16500,6 +16500,10 @@ Default value is @code{1}.
...
@@ -16500,6 +16500,10 @@ Default value is @code{1}.
@item data
@item data
Set which data to display. Can be @code{magnitude}, default or @code{phase}.
Set which data to display. Can be @code{magnitude}, default or @code{phase}.
@item rotation
Set color rotation, must be in [-1.0, 1.0] range.
Default value is @code{0}.
@end table
@end table
The usage is very similar to the showwaves filter; see the examples in that
The usage is very similar to the showwaves filter; see the examples in that
...
@@ -16633,6 +16637,10 @@ Default value is @code{1}.
...
@@ -16633,6 +16637,10 @@ Default value is @code{1}.
@item legend
@item legend
Draw time and frequency axes and legends. Default is enabled.
Draw time and frequency axes and legends. Default is enabled.
@item rotation
Set color rotation, must be in [-1.0, 1.0] range.
Default value is @code{0}.
@end table
@end table
@subsection Examples
@subsection Examples
...
...
libavfilter/avf_showspectrum.c
View file @
04a8bbca
...
@@ -61,6 +61,7 @@ typedef struct {
...
@@ -61,6 +61,7 @@ typedef struct {
int
color_mode
;
///< display color scheme
int
color_mode
;
///< display color scheme
int
scale
;
int
scale
;
float
saturation
;
///< color saturation multiplier
float
saturation
;
///< color saturation multiplier
float
rotation
;
///< color rotation
int
data
;
int
data
;
int
xpos
;
///< x position (current column)
int
xpos
;
///< x position (current column)
FFTContext
*
fft
;
///< Fast Fourier Transform context
FFTContext
*
fft
;
///< Fast Fourier Transform context
...
@@ -140,6 +141,7 @@ static const AVOption showspectrum_options[] = {
...
@@ -140,6 +141,7 @@ static const AVOption showspectrum_options[] = {
{
"data"
,
"set data mode"
,
OFFSET
(
data
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
NB_DMODES
-
1
,
FLAGS
,
"data"
},
{
"data"
,
"set data mode"
,
OFFSET
(
data
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
NB_DMODES
-
1
,
FLAGS
,
"data"
},
{
"magnitude"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
D_MAGNITUDE
},
0
,
0
,
FLAGS
,
"data"
},
{
"magnitude"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
D_MAGNITUDE
},
0
,
0
,
FLAGS
,
"data"
},
{
"phase"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
D_PHASE
},
0
,
0
,
FLAGS
,
"data"
},
{
"phase"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
D_PHASE
},
0
,
0
,
FLAGS
,
"data"
},
{
"rotation"
,
"color rotation"
,
OFFSET
(
rotation
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
},
-
1
,
1
,
FLAGS
},
{
NULL
}
{
NULL
}
};
};
...
@@ -542,13 +544,17 @@ static void color_range(ShowSpectrumContext *s, int ch,
...
@@ -542,13 +544,17 @@ static void color_range(ShowSpectrumContext *s, int ch,
if
(
s
->
color_mode
==
CHANNEL
)
{
if
(
s
->
color_mode
==
CHANNEL
)
{
if
(
s
->
nb_display_channels
>
1
)
{
if
(
s
->
nb_display_channels
>
1
)
{
*
uf
*=
0
.
5
*
sin
((
2
*
M_PI
*
ch
)
/
s
->
nb_display_channels
);
*
uf
*=
0
.
5
*
sin
((
2
*
M_PI
*
ch
)
/
s
->
nb_display_channels
+
M_PI
*
s
->
rotation
);
*
vf
*=
0
.
5
*
cos
((
2
*
M_PI
*
ch
)
/
s
->
nb_display_channels
);
*
vf
*=
0
.
5
*
cos
((
2
*
M_PI
*
ch
)
/
s
->
nb_display_channels
+
M_PI
*
s
->
rotation
);
}
else
{
}
else
{
*
uf
=
0
.
0
f
;
*
uf
*=
0
.
5
*
sin
(
M_PI
*
s
->
rotation
)
;
*
vf
=
0
.
0
f
;
*
vf
*=
0
.
5
*
cos
(
M_PI
*
s
->
rotation
+
M_PI_2
)
;
}
}
}
else
{
*
uf
+=
*
uf
*
sin
(
M_PI
*
s
->
rotation
);
*
vf
+=
*
vf
*
cos
(
M_PI
*
s
->
rotation
+
M_PI_2
);
}
}
*
uf
*=
s
->
saturation
;
*
uf
*=
s
->
saturation
;
*
vf
*=
s
->
saturation
;
*
vf
*=
s
->
saturation
;
}
}
...
@@ -913,6 +919,7 @@ static const AVOption showspectrumpic_options[] = {
...
@@ -913,6 +919,7 @@ static const AVOption showspectrumpic_options[] = {
{
"horizontal"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
HORIZONTAL
},
0
,
0
,
FLAGS
,
"orientation"
},
{
"horizontal"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
HORIZONTAL
},
0
,
0
,
FLAGS
,
"orientation"
},
{
"gain"
,
"set scale gain"
,
OFFSET
(
gain
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
},
0
,
128
,
FLAGS
},
{
"gain"
,
"set scale gain"
,
OFFSET
(
gain
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
1
},
0
,
128
,
FLAGS
},
{
"legend"
,
"draw legend"
,
OFFSET
(
legend
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
1
},
0
,
1
,
FLAGS
},
{
"legend"
,
"draw legend"
,
OFFSET
(
legend
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
1
},
0
,
1
,
FLAGS
},
{
"rotation"
,
"color rotation"
,
OFFSET
(
rotation
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
},
-
1
,
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