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
e9770b40
Commit
e9770b40
authored
Sep 08, 2016
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_datascope: let user change background opacity
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
03742217
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
filters.texi
doc/filters.texi
+3
-0
vf_datascope.c
libavfilter/vf_datascope.c
+4
-3
No files found.
doc/filters.texi
View file @
e9770b40
...
@@ -6035,6 +6035,9 @@ the text color is picked in such way so its always visible.
...
@@ -6035,6 +6035,9 @@ the text color is picked in such way so its always visible.
@item axis
@item axis
Draw rows and columns numbers on left and top of video.
Draw rows and columns numbers on left and top of video.
@item opacity
Set background opacity.
@end table
@end table
@section dctdnoiz
@section dctdnoiz
...
...
libavfilter/vf_datascope.c
View file @
e9770b40
...
@@ -36,6 +36,7 @@ typedef struct DatascopeContext {
...
@@ -36,6 +36,7 @@ typedef struct DatascopeContext {
int
x
,
y
;
int
x
,
y
;
int
mode
;
int
mode
;
int
axis
;
int
axis
;
float
opacity
;
int
nb_planes
;
int
nb_planes
;
int
nb_comps
;
int
nb_comps
;
...
@@ -62,6 +63,7 @@ static const AVOption datascope_options[] = {
...
@@ -62,6 +63,7 @@ static const AVOption datascope_options[] = {
{
"color"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
FLAGS
,
"mode"
},
{
"color"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
1
},
0
,
0
,
FLAGS
,
"mode"
},
{
"color2"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
2
},
0
,
0
,
FLAGS
,
"mode"
},
{
"color2"
,
NULL
,
0
,
AV_OPT_TYPE_CONST
,
{.
i64
=
2
},
0
,
0
,
FLAGS
,
"mode"
},
{
"axis"
,
"draw column/row numbers"
,
OFFSET
(
axis
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
FLAGS
},
{
"axis"
,
"draw column/row numbers"
,
OFFSET
(
axis
),
AV_OPT_TYPE_BOOL
,
{.
i64
=
0
},
0
,
1
,
FLAGS
},
{
"opacity"
,
"set background opacity"
,
OFFSET
(
opacity
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
.
75
},
0
,
1
,
FLAGS
},
{
NULL
}
{
NULL
}
};
};
...
@@ -135,7 +137,6 @@ static void reverse_color(FFDrawContext *draw, FFDrawColor *color, FFDrawColor *
...
@@ -135,7 +137,6 @@ static void reverse_color(FFDrawContext *draw, FFDrawColor *color, FFDrawColor *
reverse
->
comp
[
p
].
u8
[
0
]
=
color
->
comp
[
p
].
u8
[
0
]
>
127
?
0
:
255
;
reverse
->
comp
[
p
].
u8
[
0
]
=
color
->
comp
[
p
].
u8
[
0
]
>
127
?
0
:
255
;
reverse
->
comp
[
p
].
u8
[
1
]
=
color
->
comp
[
p
].
u8
[
1
]
>
127
?
0
:
255
;
reverse
->
comp
[
p
].
u8
[
1
]
=
color
->
comp
[
p
].
u8
[
1
]
>
127
?
0
:
255
;
reverse
->
comp
[
p
].
u8
[
2
]
=
color
->
comp
[
p
].
u8
[
2
]
>
127
?
0
:
255
;
reverse
->
comp
[
p
].
u8
[
2
]
=
color
->
comp
[
p
].
u8
[
2
]
>
127
?
0
:
255
;
reverse
->
comp
[
p
].
u8
[
3
]
=
color
->
comp
[
p
].
u8
[
3
]
>
127
?
0
:
255
;
}
else
{
}
else
{
const
unsigned
max
=
(
1
<<
draw
->
desc
->
comp
[
p
].
depth
)
-
1
;
const
unsigned
max
=
(
1
<<
draw
->
desc
->
comp
[
p
].
depth
)
-
1
;
const
unsigned
mid
=
(
max
+
1
)
/
2
;
const
unsigned
mid
=
(
max
+
1
)
/
2
;
...
@@ -143,7 +144,6 @@ static void reverse_color(FFDrawContext *draw, FFDrawColor *color, FFDrawColor *
...
@@ -143,7 +144,6 @@ static void reverse_color(FFDrawContext *draw, FFDrawColor *color, FFDrawColor *
reverse
->
comp
[
p
].
u16
[
0
]
=
color
->
comp
[
p
].
u16
[
0
]
>
mid
?
0
:
max
;
reverse
->
comp
[
p
].
u16
[
0
]
=
color
->
comp
[
p
].
u16
[
0
]
>
mid
?
0
:
max
;
reverse
->
comp
[
p
].
u16
[
1
]
=
color
->
comp
[
p
].
u16
[
1
]
>
mid
?
0
:
max
;
reverse
->
comp
[
p
].
u16
[
1
]
=
color
->
comp
[
p
].
u16
[
1
]
>
mid
?
0
:
max
;
reverse
->
comp
[
p
].
u16
[
2
]
=
color
->
comp
[
p
].
u16
[
2
]
>
mid
?
0
:
max
;
reverse
->
comp
[
p
].
u16
[
2
]
=
color
->
comp
[
p
].
u16
[
2
]
>
mid
?
0
:
max
;
reverse
->
comp
[
p
].
u16
[
3
]
=
color
->
comp
[
p
].
u16
[
3
]
>
mid
?
0
:
max
;
}
}
}
}
}
}
...
@@ -337,11 +337,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
...
@@ -337,11 +337,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static
int
config_input
(
AVFilterLink
*
inlink
)
static
int
config_input
(
AVFilterLink
*
inlink
)
{
{
DatascopeContext
*
s
=
inlink
->
dst
->
priv
;
DatascopeContext
*
s
=
inlink
->
dst
->
priv
;
uint8_t
alpha
=
s
->
opacity
*
255
;
s
->
nb_planes
=
av_pix_fmt_count_planes
(
inlink
->
format
);
s
->
nb_planes
=
av_pix_fmt_count_planes
(
inlink
->
format
);
ff_draw_init
(
&
s
->
draw
,
inlink
->
format
,
0
);
ff_draw_init
(
&
s
->
draw
,
inlink
->
format
,
0
);
ff_draw_color
(
&
s
->
draw
,
&
s
->
white
,
(
uint8_t
[]){
255
,
255
,
255
,
255
}
);
ff_draw_color
(
&
s
->
draw
,
&
s
->
white
,
(
uint8_t
[]){
255
,
255
,
255
,
255
}
);
ff_draw_color
(
&
s
->
draw
,
&
s
->
black
,
(
uint8_t
[]){
0
,
0
,
0
,
0
}
);
ff_draw_color
(
&
s
->
draw
,
&
s
->
black
,
(
uint8_t
[]){
0
,
0
,
0
,
alpha
}
);
ff_draw_color
(
&
s
->
draw
,
&
s
->
yellow
,
(
uint8_t
[]){
255
,
255
,
0
,
255
}
);
ff_draw_color
(
&
s
->
draw
,
&
s
->
yellow
,
(
uint8_t
[]){
255
,
255
,
0
,
255
}
);
ff_draw_color
(
&
s
->
draw
,
&
s
->
gray
,
(
uint8_t
[]){
77
,
77
,
77
,
255
}
);
ff_draw_color
(
&
s
->
draw
,
&
s
->
gray
,
(
uint8_t
[]){
77
,
77
,
77
,
255
}
);
s
->
chars
=
(
s
->
draw
.
desc
->
comp
[
0
].
depth
+
7
)
/
8
*
2
;
s
->
chars
=
(
s
->
draw
.
desc
->
comp
[
0
].
depth
+
7
)
/
8
*
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