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
b3e03718
Commit
b3e03718
authored
Mar 08, 2016
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_waveform: make it possible to draw dots instead of lines
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
209cff2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
16 deletions
+24
-16
filters.texi
doc/filters.texi
+3
-0
vf_waveform.c
libavfilter/vf_waveform.c
+21
-16
No files found.
doc/filters.texi
View file @
b3e03718
...
@@ -13185,6 +13185,9 @@ Set graticule flags.
...
@@ -13185,6 +13185,9 @@ Set graticule flags.
@table @samp
@table @samp
@item numbers
@item numbers
Draw numbers above lines. By default enabled.
Draw numbers above lines. By default enabled.
@item dots
Draw dots instead of lines.
@end table
@end table
@end table
@end table
...
...
libavfilter/vf_waveform.c
View file @
b3e03718
...
@@ -106,9 +106,10 @@ static const AVOption waveform_options[] = {
...
@@ -106,9 +106,10 @@ static const AVOption waveform_options[] = {
{
"green"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
FLAGS
,
"graticule"
},
{
"green"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
FLAGS
,
"graticule"
},
{
"opacity"
,
"set graticule opacity"
,
OFFSET
(
opacity
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
.
75
},
0
,
1
,
FLAGS
},
{
"opacity"
,
"set graticule opacity"
,
OFFSET
(
opacity
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
.
75
},
0
,
1
,
FLAGS
},
{
"o"
,
"set graticule opacity"
,
OFFSET
(
opacity
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
.
75
},
0
,
1
,
FLAGS
},
{
"o"
,
"set graticule opacity"
,
OFFSET
(
opacity
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
.
75
},
0
,
1
,
FLAGS
},
{
"flags"
,
"set graticule flags"
,
OFFSET
(
flags
),
AV_OPT_TYPE_FLAGS
,
{.
i64
=
1
},
0
,
1
,
FLAGS
,
"flags"
},
{
"flags"
,
"set graticule flags"
,
OFFSET
(
flags
),
AV_OPT_TYPE_FLAGS
,
{.
i64
=
1
},
0
,
3
,
FLAGS
,
"flags"
},
{
"fl"
,
"set graticule flags"
,
OFFSET
(
flags
),
AV_OPT_TYPE_FLAGS
,
{.
i64
=
1
},
0
,
1
,
FLAGS
,
"flags"
},
{
"fl"
,
"set graticule flags"
,
OFFSET
(
flags
),
AV_OPT_TYPE_FLAGS
,
{.
i64
=
1
},
0
,
3
,
FLAGS
,
"flags"
},
{
"numbers"
,
"draw numbers"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
FLAGS
,
"flags"
},
{
"numbers"
,
"draw numbers"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
FLAGS
,
"flags"
},
{
"dots"
,
"draw dots instead of lines"
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
2
},
0
,
0
,
FLAGS
,
"flags"
},
{
NULL
}
{
NULL
}
};
};
...
@@ -1201,42 +1202,42 @@ static const uint8_t green_yuva_color[4] = { 255, 0, 0, 255 };
...
@@ -1201,42 +1202,42 @@ static const uint8_t green_yuva_color[4] = { 255, 0, 0, 255 };
static
const
uint8_t
black_gbrp_color
[
4
]
=
{
0
,
0
,
0
,
255
};
static
const
uint8_t
black_gbrp_color
[
4
]
=
{
0
,
0
,
0
,
255
};
static
const
uint8_t
lines
[
4
][
2
]
=
{
{
16
,
235
},
{
16
,
240
},
{
16
,
240
},
{
0
,
255
}
};
static
const
uint8_t
lines
[
4
][
2
]
=
{
{
16
,
235
},
{
16
,
240
},
{
16
,
240
},
{
0
,
255
}
};
static
void
blend_vline
(
uint8_t
*
dst
,
int
height
,
int
linesize
,
float
o1
,
float
o2
,
int
v
)
static
void
blend_vline
(
uint8_t
*
dst
,
int
height
,
int
linesize
,
float
o1
,
float
o2
,
int
v
,
int
step
)
{
{
int
y
;
int
y
;
for
(
y
=
0
;
y
<
height
;
y
++
)
{
for
(
y
=
0
;
y
<
height
;
y
+=
step
)
{
dst
[
0
]
=
v
*
o1
+
dst
[
0
]
*
o2
;
dst
[
0
]
=
v
*
o1
+
dst
[
0
]
*
o2
;
dst
+=
linesize
;
dst
+=
linesize
*
step
;
}
}
}
}
static
void
blend_vline16
(
uint16_t
*
dst
,
int
height
,
int
linesize
,
float
o1
,
float
o2
,
int
v
)
static
void
blend_vline16
(
uint16_t
*
dst
,
int
height
,
int
linesize
,
float
o1
,
float
o2
,
int
v
,
int
step
)
{
{
int
y
;
int
y
;
for
(
y
=
0
;
y
<
height
;
y
++
)
{
for
(
y
=
0
;
y
<
height
;
y
+=
step
)
{
dst
[
0
]
=
v
*
o1
+
dst
[
0
]
*
o2
;
dst
[
0
]
=
v
*
o1
+
dst
[
0
]
*
o2
;
dst
+=
linesize
/
2
;
dst
+=
(
linesize
/
2
)
*
step
;
}
}
}
}
static
void
blend_hline
(
uint8_t
*
dst
,
int
width
,
float
o1
,
float
o2
,
int
v
)
static
void
blend_hline
(
uint8_t
*
dst
,
int
width
,
float
o1
,
float
o2
,
int
v
,
int
step
)
{
{
int
x
;
int
x
;
for
(
x
=
0
;
x
<
width
;
x
++
)
{
for
(
x
=
0
;
x
<
width
;
x
+=
step
)
{
dst
[
x
]
=
v
*
o1
+
dst
[
x
]
*
o2
;
dst
[
x
]
=
v
*
o1
+
dst
[
x
]
*
o2
;
}
}
}
}
static
void
blend_hline16
(
uint16_t
*
dst
,
int
width
,
float
o1
,
float
o2
,
int
v
)
static
void
blend_hline16
(
uint16_t
*
dst
,
int
width
,
float
o1
,
float
o2
,
int
v
,
int
step
)
{
{
int
x
;
int
x
;
for
(
x
=
0
;
x
<
width
;
x
++
)
{
for
(
x
=
0
;
x
<
width
;
x
+=
step
)
{
dst
[
x
]
=
v
*
o1
+
dst
[
x
]
*
o2
;
dst
[
x
]
=
v
*
o1
+
dst
[
x
]
*
o2
;
}
}
}
}
...
@@ -1349,6 +1350,7 @@ static void graticule_none(WaveformContext *s, AVFrame *out)
...
@@ -1349,6 +1350,7 @@ static void graticule_none(WaveformContext *s, AVFrame *out)
static
void
graticule_green_row
(
WaveformContext
*
s
,
AVFrame
*
out
)
static
void
graticule_green_row
(
WaveformContext
*
s
,
AVFrame
*
out
)
{
{
const
int
step
=
s
->
flags
&
2
+
1
;
const
float
o1
=
s
->
opacity
;
const
float
o1
=
s
->
opacity
;
const
float
o2
=
1
.
-
o1
;
const
float
o2
=
1
.
-
o1
;
int
k
=
0
,
c
,
p
,
l
,
offset
=
0
;
int
k
=
0
,
c
,
p
,
l
,
offset
=
0
;
...
@@ -1364,7 +1366,7 @@ static void graticule_green_row(WaveformContext *s, AVFrame *out)
...
@@ -1364,7 +1366,7 @@ static void graticule_green_row(WaveformContext *s, AVFrame *out)
int
x
=
offset
+
(
s
->
mirror
?
255
-
lines
[
c
][
l
]
:
lines
[
c
][
l
]);
int
x
=
offset
+
(
s
->
mirror
?
255
-
lines
[
c
][
l
]
:
lines
[
c
][
l
]);
uint8_t
*
dst
=
out
->
data
[
p
]
+
x
;
uint8_t
*
dst
=
out
->
data
[
p
]
+
x
;
blend_vline
(
dst
,
out
->
height
,
out
->
linesize
[
p
],
o1
,
o2
,
v
);
blend_vline
(
dst
,
out
->
height
,
out
->
linesize
[
p
],
o1
,
o2
,
v
,
step
);
}
}
}
}
...
@@ -1385,6 +1387,7 @@ static void graticule_green_row(WaveformContext *s, AVFrame *out)
...
@@ -1385,6 +1387,7 @@ static void graticule_green_row(WaveformContext *s, AVFrame *out)
static
void
graticule16_green_row
(
WaveformContext
*
s
,
AVFrame
*
out
)
static
void
graticule16_green_row
(
WaveformContext
*
s
,
AVFrame
*
out
)
{
{
const
int
step
=
s
->
flags
&
2
+
1
;
const
float
o1
=
s
->
opacity
;
const
float
o1
=
s
->
opacity
;
const
float
o2
=
1
.
-
o1
;
const
float
o2
=
1
.
-
o1
;
const
int
mult
=
s
->
size
/
256
;
const
int
mult
=
s
->
size
/
256
;
...
@@ -1401,7 +1404,7 @@ static void graticule16_green_row(WaveformContext *s, AVFrame *out)
...
@@ -1401,7 +1404,7 @@ static void graticule16_green_row(WaveformContext *s, AVFrame *out)
int
x
=
offset
+
(
s
->
mirror
?
s
->
size
-
1
-
lines
[
c
][
l
]
*
mult
:
lines
[
c
][
l
]
*
mult
);
int
x
=
offset
+
(
s
->
mirror
?
s
->
size
-
1
-
lines
[
c
][
l
]
*
mult
:
lines
[
c
][
l
]
*
mult
);
uint16_t
*
dst
=
(
uint16_t
*
)(
out
->
data
[
p
])
+
x
;
uint16_t
*
dst
=
(
uint16_t
*
)(
out
->
data
[
p
])
+
x
;
blend_vline16
(
dst
,
out
->
height
,
out
->
linesize
[
p
],
o1
,
o2
,
v
);
blend_vline16
(
dst
,
out
->
height
,
out
->
linesize
[
p
],
o1
,
o2
,
v
,
step
);
}
}
}
}
...
@@ -1422,6 +1425,7 @@ static void graticule16_green_row(WaveformContext *s, AVFrame *out)
...
@@ -1422,6 +1425,7 @@ static void graticule16_green_row(WaveformContext *s, AVFrame *out)
static
void
graticule_green_column
(
WaveformContext
*
s
,
AVFrame
*
out
)
static
void
graticule_green_column
(
WaveformContext
*
s
,
AVFrame
*
out
)
{
{
const
int
step
=
s
->
flags
&
2
+
1
;
const
float
o1
=
s
->
opacity
;
const
float
o1
=
s
->
opacity
;
const
float
o2
=
1
.
-
o1
;
const
float
o2
=
1
.
-
o1
;
int
k
=
0
,
c
,
p
,
l
,
offset
=
0
;
int
k
=
0
,
c
,
p
,
l
,
offset
=
0
;
...
@@ -1437,7 +1441,7 @@ static void graticule_green_column(WaveformContext *s, AVFrame *out)
...
@@ -1437,7 +1441,7 @@ static void graticule_green_column(WaveformContext *s, AVFrame *out)
int
y
=
offset
+
(
s
->
mirror
?
255
-
lines
[
c
][
l
]
:
lines
[
c
][
l
]);
int
y
=
offset
+
(
s
->
mirror
?
255
-
lines
[
c
][
l
]
:
lines
[
c
][
l
]);
uint8_t
*
dst
=
out
->
data
[
p
]
+
y
*
out
->
linesize
[
p
];
uint8_t
*
dst
=
out
->
data
[
p
]
+
y
*
out
->
linesize
[
p
];
blend_hline
(
dst
,
out
->
width
,
o1
,
o2
,
v
);
blend_hline
(
dst
,
out
->
width
,
o1
,
o2
,
v
,
step
);
}
}
}
}
...
@@ -1458,6 +1462,7 @@ static void graticule_green_column(WaveformContext *s, AVFrame *out)
...
@@ -1458,6 +1462,7 @@ static void graticule_green_column(WaveformContext *s, AVFrame *out)
static
void
graticule16_green_column
(
WaveformContext
*
s
,
AVFrame
*
out
)
static
void
graticule16_green_column
(
WaveformContext
*
s
,
AVFrame
*
out
)
{
{
const
int
step
=
s
->
flags
&
2
+
1
;
const
float
o1
=
s
->
opacity
;
const
float
o1
=
s
->
opacity
;
const
float
o2
=
1
.
-
o1
;
const
float
o2
=
1
.
-
o1
;
const
int
mult
=
s
->
size
/
256
;
const
int
mult
=
s
->
size
/
256
;
...
@@ -1474,7 +1479,7 @@ static void graticule16_green_column(WaveformContext *s, AVFrame *out)
...
@@ -1474,7 +1479,7 @@ static void graticule16_green_column(WaveformContext *s, AVFrame *out)
int
y
=
offset
+
(
s
->
mirror
?
s
->
size
-
1
-
lines
[
c
][
l
]
*
mult
:
lines
[
c
][
l
]
*
mult
);
int
y
=
offset
+
(
s
->
mirror
?
s
->
size
-
1
-
lines
[
c
][
l
]
*
mult
:
lines
[
c
][
l
]
*
mult
);
uint16_t
*
dst
=
(
uint16_t
*
)(
out
->
data
[
p
]
+
y
*
out
->
linesize
[
p
]);
uint16_t
*
dst
=
(
uint16_t
*
)(
out
->
data
[
p
]
+
y
*
out
->
linesize
[
p
]);
blend_hline16
(
dst
,
out
->
width
,
o1
,
o2
,
v
);
blend_hline16
(
dst
,
out
->
width
,
o1
,
o2
,
v
,
step
);
}
}
}
}
...
...
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