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
36cf3eb7
Commit
36cf3eb7
authored
Mar 21, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_waveform: add orange graticule
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
caef9573
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
21 deletions
+29
-21
filters.texi
doc/filters.texi
+3
-0
vf_waveform.c
libavfilter/vf_waveform.c
+26
-21
No files found.
doc/filters.texi
View file @
36cf3eb7
...
@@ -16513,6 +16513,9 @@ Do not display graticule.
...
@@ -16513,6 +16513,9 @@ Do not display graticule.
@item green
@item green
Display green graticule showing legal broadcast ranges.
Display green graticule showing legal broadcast ranges.
@item orange
Display orange graticule showing legal broadcast ranges.
@end table
@end table
@item opacity, o
@item opacity, o
...
...
libavfilter/vf_waveform.c
View file @
36cf3eb7
...
@@ -90,6 +90,7 @@ typedef struct WaveformContext {
...
@@ -90,6 +90,7 @@ typedef struct WaveformContext {
int
max
;
int
max
;
int
size
;
int
size
;
int
scale
;
int
scale
;
uint8_t
grat_yuva_color
[
4
];
int
shift_w
[
4
],
shift_h
[
4
];
int
shift_w
[
4
],
shift_h
[
4
];
GraticuleLines
*
glines
;
GraticuleLines
*
glines
;
int
nb_glines
;
int
nb_glines
;
...
@@ -137,10 +138,11 @@ static const AVOption waveform_options[] = {
...
@@ -137,10 +138,11 @@ static const AVOption waveform_options[] = {
{
"color"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
COLOR
},
0
,
0
,
FLAGS
,
"filter"
},
{
"color"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
COLOR
},
0
,
0
,
FLAGS
,
"filter"
},
{
"acolor"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
ACOLOR
},
0
,
0
,
FLAGS
,
"filter"
},
{
"acolor"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
ACOLOR
},
0
,
0
,
FLAGS
,
"filter"
},
{
"xflat"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
XFLAT
},
0
,
0
,
FLAGS
,
"filter"
},
{
"xflat"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
XFLAT
},
0
,
0
,
FLAGS
,
"filter"
},
{
"graticule"
,
"set graticule"
,
OFFSET
(
graticule
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
FLAGS
,
"graticule"
},
{
"graticule"
,
"set graticule"
,
OFFSET
(
graticule
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
2
,
FLAGS
,
"graticule"
},
{
"g"
,
"set graticule"
,
OFFSET
(
graticule
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
1
,
FLAGS
,
"graticule"
},
{
"g"
,
"set graticule"
,
OFFSET
(
graticule
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
2
,
FLAGS
,
"graticule"
},
{
"none"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
FLAGS
,
"graticule"
},
{
"none"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
0
},
0
,
0
,
FLAGS
,
"graticule"
},
{
"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"
},
{
"orange"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
2
},
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
,
3
,
FLAGS
,
"flags"
},
{
"flags"
,
"set graticule flags"
,
OFFSET
(
flags
),
AV_OPT_TYPE_FLAGS
,
{.
i64
=
1
},
0
,
3
,
FLAGS
,
"flags"
},
...
@@ -1878,7 +1880,6 @@ static av_always_inline void acolor(WaveformContext *s,
...
@@ -1878,7 +1880,6 @@ static av_always_inline void acolor(WaveformContext *s,
}
}
static
const
uint8_t
black_yuva_color
[
4
]
=
{
0
,
127
,
127
,
255
};
static
const
uint8_t
black_yuva_color
[
4
]
=
{
0
,
127
,
127
,
255
};
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
GraticuleLines
aflat_digital8
[]
=
{
static
const
GraticuleLines
aflat_digital8
[]
=
{
...
@@ -2339,7 +2340,7 @@ static void graticule_none(WaveformContext *s, AVFrame *out)
...
@@ -2339,7 +2340,7 @@ static void graticule_none(WaveformContext *s, AVFrame *out)
{
{
}
}
static
void
graticule_
green_
row
(
WaveformContext
*
s
,
AVFrame
*
out
)
static
void
graticule_row
(
WaveformContext
*
s
,
AVFrame
*
out
)
{
{
const
int
step
=
(
s
->
flags
&
2
)
+
1
;
const
int
step
=
(
s
->
flags
&
2
)
+
1
;
const
float
o1
=
s
->
opacity
;
const
float
o1
=
s
->
opacity
;
...
@@ -2353,7 +2354,7 @@ static void graticule_green_row(WaveformContext *s, AVFrame *out)
...
@@ -2353,7 +2354,7 @@ static void graticule_green_row(WaveformContext *s, AVFrame *out)
k
++
;
k
++
;
for
(
p
=
0
;
p
<
s
->
ncomp
;
p
++
)
{
for
(
p
=
0
;
p
<
s
->
ncomp
;
p
++
)
{
const
int
v
=
green
_yuva_color
[
p
];
const
int
v
=
s
->
grat
_yuva_color
[
p
];
for
(
l
=
0
;
l
<
s
->
nb_glines
;
l
++
)
{
for
(
l
=
0
;
l
<
s
->
nb_glines
;
l
++
)
{
const
uint16_t
pos
=
s
->
glines
[
l
].
line
[
c
].
pos
;
const
uint16_t
pos
=
s
->
glines
[
l
].
line
[
c
].
pos
;
int
x
=
offset_x
+
(
s
->
mirror
?
s
->
size
-
1
-
pos
:
pos
);
int
x
=
offset_x
+
(
s
->
mirror
?
s
->
size
-
1
-
pos
:
pos
);
...
@@ -2371,7 +2372,7 @@ static void graticule_green_row(WaveformContext *s, AVFrame *out)
...
@@ -2371,7 +2372,7 @@ static void graticule_green_row(WaveformContext *s, AVFrame *out)
if
(
x
<
0
)
if
(
x
<
0
)
x
=
4
;
x
=
4
;
draw_vtext
(
out
,
x
,
offset_y
+
2
,
o1
,
o2
,
name
,
green
_yuva_color
);
draw_vtext
(
out
,
x
,
offset_y
+
2
,
o1
,
o2
,
name
,
s
->
grat
_yuva_color
);
}
}
offset_x
+=
s
->
size
*
(
s
->
display
==
STACK
);
offset_x
+=
s
->
size
*
(
s
->
display
==
STACK
);
...
@@ -2379,12 +2380,12 @@ static void graticule_green_row(WaveformContext *s, AVFrame *out)
...
@@ -2379,12 +2380,12 @@ static void graticule_green_row(WaveformContext *s, AVFrame *out)
}
}
}
}
static
void
graticule16_
green_
row
(
WaveformContext
*
s
,
AVFrame
*
out
)
static
void
graticule16_row
(
WaveformContext
*
s
,
AVFrame
*
out
)
{
{
const
int
step
=
(
s
->
flags
&
2
)
+
1
;
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
->
max
/
256
;
const
int
height
=
s
->
display
==
PARADE
?
out
->
height
/
s
->
acomp
:
out
->
height
;
const
int
height
=
s
->
display
==
PARADE
?
out
->
height
/
s
->
acomp
:
out
->
height
;
int
k
=
0
,
c
,
p
,
l
,
offset_x
=
0
,
offset_y
=
0
;
int
k
=
0
,
c
,
p
,
l
,
offset_x
=
0
,
offset_y
=
0
;
...
@@ -2394,7 +2395,7 @@ static void graticule16_green_row(WaveformContext *s, AVFrame *out)
...
@@ -2394,7 +2395,7 @@ static void graticule16_green_row(WaveformContext *s, AVFrame *out)
k
++
;
k
++
;
for
(
p
=
0
;
p
<
s
->
ncomp
;
p
++
)
{
for
(
p
=
0
;
p
<
s
->
ncomp
;
p
++
)
{
const
int
v
=
green
_yuva_color
[
p
]
*
mult
;
const
int
v
=
s
->
grat
_yuva_color
[
p
]
*
mult
;
for
(
l
=
0
;
l
<
s
->
nb_glines
;
l
++
)
{
for
(
l
=
0
;
l
<
s
->
nb_glines
;
l
++
)
{
const
uint16_t
pos
=
s
->
glines
[
l
].
line
[
c
].
pos
;
const
uint16_t
pos
=
s
->
glines
[
l
].
line
[
c
].
pos
;
int
x
=
offset_x
+
(
s
->
mirror
?
s
->
size
-
1
-
pos
:
pos
);
int
x
=
offset_x
+
(
s
->
mirror
?
s
->
size
-
1
-
pos
:
pos
);
...
@@ -2412,7 +2413,7 @@ static void graticule16_green_row(WaveformContext *s, AVFrame *out)
...
@@ -2412,7 +2413,7 @@ static void graticule16_green_row(WaveformContext *s, AVFrame *out)
if
(
x
<
0
)
if
(
x
<
0
)
x
=
4
;
x
=
4
;
draw_vtext16
(
out
,
x
,
offset_y
+
2
,
mult
,
o1
,
o2
,
name
,
green
_yuva_color
);
draw_vtext16
(
out
,
x
,
offset_y
+
2
,
mult
,
o1
,
o2
,
name
,
s
->
grat
_yuva_color
);
}
}
offset_x
+=
s
->
size
*
(
s
->
display
==
STACK
);
offset_x
+=
s
->
size
*
(
s
->
display
==
STACK
);
...
@@ -2420,7 +2421,7 @@ static void graticule16_green_row(WaveformContext *s, AVFrame *out)
...
@@ -2420,7 +2421,7 @@ static void graticule16_green_row(WaveformContext *s, AVFrame *out)
}
}
}
}
static
void
graticule_
green_
column
(
WaveformContext
*
s
,
AVFrame
*
out
)
static
void
graticule_column
(
WaveformContext
*
s
,
AVFrame
*
out
)
{
{
const
int
step
=
(
s
->
flags
&
2
)
+
1
;
const
int
step
=
(
s
->
flags
&
2
)
+
1
;
const
float
o1
=
s
->
opacity
;
const
float
o1
=
s
->
opacity
;
...
@@ -2434,7 +2435,7 @@ static void graticule_green_column(WaveformContext *s, AVFrame *out)
...
@@ -2434,7 +2435,7 @@ static void graticule_green_column(WaveformContext *s, AVFrame *out)
k
++
;
k
++
;
for
(
p
=
0
;
p
<
s
->
ncomp
;
p
++
)
{
for
(
p
=
0
;
p
<
s
->
ncomp
;
p
++
)
{
const
int
v
=
green
_yuva_color
[
p
];
const
int
v
=
s
->
grat
_yuva_color
[
p
];
for
(
l
=
0
;
l
<
s
->
nb_glines
;
l
++
)
{
for
(
l
=
0
;
l
<
s
->
nb_glines
;
l
++
)
{
const
uint16_t
pos
=
s
->
glines
[
l
].
line
[
c
].
pos
;
const
uint16_t
pos
=
s
->
glines
[
l
].
line
[
c
].
pos
;
int
y
=
offset_y
+
(
s
->
mirror
?
s
->
size
-
1
-
pos
:
pos
);
int
y
=
offset_y
+
(
s
->
mirror
?
s
->
size
-
1
-
pos
:
pos
);
...
@@ -2452,7 +2453,7 @@ static void graticule_green_column(WaveformContext *s, AVFrame *out)
...
@@ -2452,7 +2453,7 @@ static void graticule_green_column(WaveformContext *s, AVFrame *out)
if
(
y
<
0
)
if
(
y
<
0
)
y
=
4
;
y
=
4
;
draw_htext
(
out
,
2
+
offset_x
,
y
,
o1
,
o2
,
name
,
green
_yuva_color
);
draw_htext
(
out
,
2
+
offset_x
,
y
,
o1
,
o2
,
name
,
s
->
grat
_yuva_color
);
}
}
offset_y
+=
s
->
size
*
(
s
->
display
==
STACK
);
offset_y
+=
s
->
size
*
(
s
->
display
==
STACK
);
...
@@ -2460,12 +2461,12 @@ static void graticule_green_column(WaveformContext *s, AVFrame *out)
...
@@ -2460,12 +2461,12 @@ static void graticule_green_column(WaveformContext *s, AVFrame *out)
}
}
}
}
static
void
graticule16_
green_
column
(
WaveformContext
*
s
,
AVFrame
*
out
)
static
void
graticule16_column
(
WaveformContext
*
s
,
AVFrame
*
out
)
{
{
const
int
step
=
(
s
->
flags
&
2
)
+
1
;
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
->
max
/
256
;
const
int
width
=
s
->
display
==
PARADE
?
out
->
width
/
s
->
acomp
:
out
->
width
;
const
int
width
=
s
->
display
==
PARADE
?
out
->
width
/
s
->
acomp
:
out
->
width
;
int
k
=
0
,
c
,
p
,
l
,
offset_x
=
0
,
offset_y
=
0
;
int
k
=
0
,
c
,
p
,
l
,
offset_x
=
0
,
offset_y
=
0
;
...
@@ -2475,7 +2476,7 @@ static void graticule16_green_column(WaveformContext *s, AVFrame *out)
...
@@ -2475,7 +2476,7 @@ static void graticule16_green_column(WaveformContext *s, AVFrame *out)
k
++
;
k
++
;
for
(
p
=
0
;
p
<
s
->
ncomp
;
p
++
)
{
for
(
p
=
0
;
p
<
s
->
ncomp
;
p
++
)
{
const
int
v
=
green
_yuva_color
[
p
]
*
mult
;
const
int
v
=
s
->
grat
_yuva_color
[
p
]
*
mult
;
for
(
l
=
0
;
l
<
s
->
nb_glines
;
l
++
)
{
for
(
l
=
0
;
l
<
s
->
nb_glines
;
l
++
)
{
const
uint16_t
pos
=
s
->
glines
[
l
].
line
[
c
].
pos
;
const
uint16_t
pos
=
s
->
glines
[
l
].
line
[
c
].
pos
;
int
y
=
offset_y
+
(
s
->
mirror
?
s
->
size
-
1
-
pos
:
pos
);
int
y
=
offset_y
+
(
s
->
mirror
?
s
->
size
-
1
-
pos
:
pos
);
...
@@ -2493,7 +2494,7 @@ static void graticule16_green_column(WaveformContext *s, AVFrame *out)
...
@@ -2493,7 +2494,7 @@ static void graticule16_green_column(WaveformContext *s, AVFrame *out)
if
(
y
<
0
)
if
(
y
<
0
)
y
=
4
;
y
=
4
;
draw_htext16
(
out
,
2
+
offset_x
,
y
,
mult
,
o1
,
o2
,
name
,
green
_yuva_color
);
draw_htext16
(
out
,
2
+
offset_x
,
y
,
mult
,
o1
,
o2
,
name
,
s
->
grat
_yuva_color
);
}
}
offset_y
+=
s
->
size
*
(
s
->
display
==
STACK
);
offset_y
+=
s
->
size
*
(
s
->
display
==
STACK
);
...
@@ -2586,6 +2587,10 @@ static int config_input(AVFilterLink *inlink)
...
@@ -2586,6 +2587,10 @@ static int config_input(AVFilterLink *inlink)
case
0x0016
:
s
->
waveform
=
xflat16_row
;
break
;
case
0x0016
:
s
->
waveform
=
xflat16_row
;
break
;
}
}
s
->
grat_yuva_color
[
0
]
=
255
;
s
->
grat_yuva_color
[
2
]
=
s
->
graticule
==
2
?
255
:
0
;
s
->
grat_yuva_color
[
3
]
=
255
;
switch
(
s
->
filter
)
{
switch
(
s
->
filter
)
{
case
LOWPASS
:
case
LOWPASS
:
case
COLOR
:
case
COLOR
:
...
@@ -2595,9 +2600,9 @@ static int config_input(AVFilterLink *inlink)
...
@@ -2595,9 +2600,9 @@ static int config_input(AVFilterLink *inlink)
case
XFLAT
:
case
XFLAT
:
case
FLAT
:
case
FLAT
:
if
(
s
->
graticule
&&
s
->
mode
==
1
)
if
(
s
->
graticule
&&
s
->
mode
==
1
)
s
->
graticulef
=
s
->
bits
>
8
?
graticule16_
green_column
:
graticule_green
_column
;
s
->
graticulef
=
s
->
bits
>
8
?
graticule16_
column
:
graticule
_column
;
else
if
(
s
->
graticule
&&
s
->
mode
==
0
)
else
if
(
s
->
graticule
&&
s
->
mode
==
0
)
s
->
graticulef
=
s
->
bits
>
8
?
graticule16_
green_row
:
graticule_green
_row
;
s
->
graticulef
=
s
->
bits
>
8
?
graticule16_
row
:
graticule
_row
;
break
;
break
;
}
}
...
...
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