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
2c10f054
Commit
2c10f054
authored
Sep 05, 2017
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/avf_avectorscope: add possibility to auto zoom
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
6faa1275
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
3 deletions
+33
-3
filters.texi
doc/filters.texi
+2
-1
avf_avectorscope.c
libavfilter/avf_avectorscope.c
+31
-2
No files found.
doc/filters.texi
View file @
2c10f054
...
...
@@ -17044,7 +17044,8 @@ Specify the red, green, blue and alpha fade. Default values are @code{15},
Allowed range is @code{[0, 255]}.
@item zoom
Set the zoom factor. Default value is @code{1}. Allowed range is @code{[1, 10]}.
Set the zoom factor. Default value is @code{1}. Allowed range is @code{[0, 10]}.
Values lower than @var{1} will auto adjust zoom factor to maximal possible value.
@item draw
Set the vectorscope drawing mode.
...
...
libavfilter/avf_avectorscope.c
View file @
2c10f054
...
...
@@ -90,7 +90,7 @@ static const AVOption avectorscope_options[] = {
{
"gf"
,
"set green fade"
,
OFFSET
(
fade
[
1
]),
AV_OPT_TYPE_INT
,
{.
i64
=
10
},
0
,
255
,
FLAGS
},
{
"bf"
,
"set blue fade"
,
OFFSET
(
fade
[
2
]),
AV_OPT_TYPE_INT
,
{.
i64
=
5
},
0
,
255
,
FLAGS
},
{
"af"
,
"set alpha fade"
,
OFFSET
(
fade
[
3
]),
AV_OPT_TYPE_INT
,
{.
i64
=
5
},
0
,
255
,
FLAGS
},
{
"zoom"
,
"set zoom factor"
,
OFFSET
(
zoom
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
1
,
10
,
FLAGS
},
{
"zoom"
,
"set zoom factor"
,
OFFSET
(
zoom
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
0
,
10
,
FLAGS
},
{
"draw"
,
"set draw mode"
,
OFFSET
(
draw
),
AV_OPT_TYPE_INT
,
{.
i64
=
DOT
},
0
,
DRAW_NB
-
1
,
FLAGS
,
"draw"
},
{
"dot"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
DOT
}
,
0
,
0
,
FLAGS
,
"draw"
},
{
"line"
,
""
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
LINE
},
0
,
0
,
FLAGS
,
"draw"
},
...
...
@@ -234,7 +234,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
const
int
hh
=
s
->
hh
;
unsigned
x
,
y
;
unsigned
prev_x
=
s
->
prev_x
,
prev_y
=
s
->
prev_y
;
const
double
zoom
=
s
->
zoom
;
double
zoom
=
s
->
zoom
;
int
i
;
if
(
!
s
->
outpicref
||
s
->
outpicref
->
width
!=
outlink
->
w
||
...
...
@@ -254,6 +254,35 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
fade
(
s
);
if
(
zoom
<
1
)
{
float
max
=
0
;
switch
(
insamples
->
format
)
{
case
AV_SAMPLE_FMT_S16
:
{
int16_t
*
samples
=
(
int16_t
*
)
insamples
->
data
[
0
];
for
(
i
=
0
;
i
<
insamples
->
nb_samples
*
2
;
i
++
)
{
float
sample
=
samples
[
i
]
/
(
float
)
INT16_MAX
;
max
=
FFMAX
(
FFABS
(
sample
),
max
);
}
}
break
;
case
AV_SAMPLE_FMT_FLT
:
{
float
*
samples
=
(
float
*
)
insamples
->
data
[
0
]
+
i
*
2
;
for
(
i
=
0
;
i
<
insamples
->
nb_samples
;
i
++
)
{
max
=
FFMAX
(
FFABS
(
samples
[
i
]),
max
);
}
}
break
;
default:
av_assert2
(
0
);
}
zoom
=
1
.
/
max
;
}
for
(
i
=
0
;
i
<
insamples
->
nb_samples
;
i
++
)
{
int16_t
*
samples
=
(
int16_t
*
)
insamples
->
data
[
0
]
+
i
*
2
;
float
*
samplesf
=
(
float
*
)
insamples
->
data
[
0
]
+
i
*
2
;
...
...
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