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
93399e93
Commit
93399e93
authored
Oct 30, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/drawbox: add thickness option
parent
84833b02
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
8 deletions
+19
-8
filters.texi
doc/filters.texi
+10
-1
version.h
libavfilter/version.h
+1
-1
vf_drawbox.c
libavfilter/vf_drawbox.c
+8
-6
No files found.
doc/filters.texi
View file @
93399e93
...
...
@@ -1744,12 +1744,15 @@ Specify the color of the box to write, it can be the name of a color
(case insensitive match) or a 0xRRGGBB[AA] sequence. If the special
value @code{invert} is used, the box edge color is the same as the
video with inverted luma.
@item thickness, t
Set the thickness of the box edge. Default value is @code{4}.
@end table
If the key of the first options is omitted, the arguments are
interpreted according to the following syntax:
@example
drawbox=@var{x}:@var{y}:@var{width}:@var{height}:@var{color}
drawbox=@var{x}:@var{y}:@var{width}:@var{height}:@var{color}
:@var{thickness}
@end example
Some examples follow:
...
...
@@ -1770,6 +1773,12 @@ The previous example can be specified as:
@example
drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
@end example
@item
Fill the box with pink color:
@example
drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
@end example
@end itemize
@section drawtext
...
...
libavfilter/version.h
View file @
93399e93
...
...
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 21
#define LIBAVFILTER_VERSION_MICRO 10
2
#define LIBAVFILTER_VERSION_MICRO 10
3
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
...
...
libavfilter/vf_drawbox.c
View file @
93399e93
...
...
@@ -38,7 +38,7 @@ enum { Y, U, V, A };
typedef
struct
{
const
AVClass
*
class
;
int
x
,
y
,
w
,
h
;
int
x
,
y
,
w
,
h
,
thickness
;
char
*
color_str
;
unsigned
char
yuv_color
[
4
];
int
invert_color
;
///< invert luma color
...
...
@@ -55,6 +55,8 @@ static const AVOption drawbox_options[] = {
{
"h"
,
"set the box heigth"
,
OFFSET
(
h
),
AV_OPT_TYPE_INT
,
{.
i64
=
0
},
0
,
INT_MAX
,
FLAGS
},
{
"color"
,
"set the box edge color"
,
OFFSET
(
color_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"black"
},
CHAR_MIN
,
CHAR_MAX
,
FLAGS
},
{
"c"
,
"set the box edge color"
,
OFFSET
(
color_str
),
AV_OPT_TYPE_STRING
,
{.
str
=
"black"
},
CHAR_MIN
,
CHAR_MAX
,
FLAGS
},
{
"thickness"
,
"set the box maximum thickness"
,
OFFSET
(
thickness
),
AV_OPT_TYPE_INT
,
{.
i64
=
4
},
0
,
INT_MAX
,
FLAGS
},
{
"t"
,
"set the box maximum thickness"
,
OFFSET
(
thickness
),
AV_OPT_TYPE_INT
,
{.
i64
=
4
},
0
,
INT_MAX
,
FLAGS
},
{
NULL
},
};
...
...
@@ -64,7 +66,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
{
DrawBoxContext
*
drawbox
=
ctx
->
priv
;
uint8_t
rgba_color
[
4
];
static
const
char
*
shorthand
[]
=
{
"x"
,
"y"
,
"w"
,
"h"
,
"color"
,
NULL
};
static
const
char
*
shorthand
[]
=
{
"x"
,
"y"
,
"w"
,
"h"
,
"color"
,
"thickness"
,
NULL
};
int
ret
;
drawbox
->
class
=
&
drawbox_class
;
...
...
@@ -140,15 +142,15 @@ static int draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir)
if
(
drawbox
->
invert_color
)
{
for
(
x
=
FFMAX
(
xb
,
0
);
x
<
xb
+
drawbox
->
w
&&
x
<
picref
->
video
->
w
;
x
++
)
if
((
y
-
yb
<
3
)
||
(
yb
+
drawbox
->
h
-
y
<
4
)
||
(
x
-
xb
<
3
)
||
(
xb
+
drawbox
->
w
-
x
<
4
))
if
((
y
-
yb
<
drawbox
->
thickness
-
1
)
||
(
yb
+
drawbox
->
h
-
y
<
drawbox
->
thickness
)
||
(
x
-
xb
<
drawbox
->
thickness
-
1
)
||
(
xb
+
drawbox
->
w
-
x
<
drawbox
->
thickness
))
row
[
0
][
x
]
=
0xff
-
row
[
0
][
x
];
}
else
{
for
(
x
=
FFMAX
(
xb
,
0
);
x
<
xb
+
drawbox
->
w
&&
x
<
picref
->
video
->
w
;
x
++
)
{
double
alpha
=
(
double
)
drawbox
->
yuv_color
[
A
]
/
255
;
if
((
y
-
yb
<
3
)
||
(
yb
+
drawbox
->
h
-
y
<
4
)
||
(
x
-
xb
<
3
)
||
(
xb
+
drawbox
->
w
-
x
<
4
))
{
if
((
y
-
yb
<
drawbox
->
thickness
-
1
)
||
(
yb
+
drawbox
->
h
-
y
<
drawbox
->
thickness
)
||
(
x
-
xb
<
drawbox
->
thickness
-
1
)
||
(
xb
+
drawbox
->
w
-
x
<
drawbox
->
thickness
))
{
row
[
0
][
x
]
=
(
1
-
alpha
)
*
row
[
0
][
x
]
+
alpha
*
drawbox
->
yuv_color
[
Y
];
row
[
1
][
x
>>
drawbox
->
hsub
]
=
(
1
-
alpha
)
*
row
[
1
][
x
>>
drawbox
->
hsub
]
+
alpha
*
drawbox
->
yuv_color
[
U
];
row
[
2
][
x
>>
drawbox
->
hsub
]
=
(
1
-
alpha
)
*
row
[
2
][
x
>>
drawbox
->
hsub
]
+
alpha
*
drawbox
->
yuv_color
[
V
];
...
...
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