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
1b3fdd97
Commit
1b3fdd97
authored
Oct 30, 2012
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/drawbox: implement color=invert mode
Based on a libmpcodecs/vf_rectangle.c feature.
parent
652fab59
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
filters.texi
doc/filters.texi
+3
-1
version.h
libavfilter/version.h
+1
-1
vf_drawbox.c
libavfilter/vf_drawbox.c
+11
-1
No files found.
doc/filters.texi
View file @
1b3fdd97
...
...
@@ -1741,7 +1741,9 @@ the input width and height. Default to 0.
@item color, c
Specify the color of the box to write, it can be the name of a color
(case insensitive match) or a 0xRRGGBB[AA] sequence.
(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.
@end table
If the key of the first options is omitted, the arguments are
...
...
libavfilter/version.h
View file @
1b3fdd97
...
...
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 21
#define LIBAVFILTER_VERSION_MICRO 10
1
#define LIBAVFILTER_VERSION_MICRO 10
2
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
...
...
libavfilter/vf_drawbox.c
View file @
1b3fdd97
...
...
@@ -41,6 +41,7 @@ typedef struct {
int
x
,
y
,
w
,
h
;
char
*
color_str
;
unsigned
char
yuv_color
[
4
];
int
invert_color
;
///< invert luma color
int
vsub
,
hsub
;
///< chroma subsampling
}
DrawBoxContext
;
...
...
@@ -72,7 +73,9 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
if
((
ret
=
av_opt_set_from_string
(
drawbox
,
args
,
shorthand
,
"="
,
":"
))
<
0
)
return
ret
;
if
(
av_parse_color
(
rgba_color
,
drawbox
->
color_str
,
-
1
,
ctx
)
<
0
)
if
(
!
strcmp
(
drawbox
->
color_str
,
"invert"
))
drawbox
->
invert_color
=
1
;
else
if
(
av_parse_color
(
rgba_color
,
drawbox
->
color_str
,
-
1
,
ctx
)
<
0
)
return
AVERROR
(
EINVAL
);
drawbox
->
yuv_color
[
Y
]
=
RGB_TO_Y_CCIR
(
rgba_color
[
0
],
rgba_color
[
1
],
rgba_color
[
2
]);
...
...
@@ -135,6 +138,12 @@ static int draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir)
row
[
plane
]
=
picref
->
data
[
plane
]
+
picref
->
linesize
[
plane
]
*
(
y
>>
drawbox
->
vsub
);
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
))
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
;
...
...
@@ -145,6 +154,7 @@ static int draw_slice(AVFilterLink *inlink, int y0, int h, int slice_dir)
row
[
2
][
x
>>
drawbox
->
hsub
]
=
(
1
-
alpha
)
*
row
[
2
][
x
>>
drawbox
->
hsub
]
+
alpha
*
drawbox
->
yuv_color
[
V
];
}
}
}
}
return
ff_draw_slice
(
inlink
->
dst
->
outputs
[
0
],
y0
,
h
,
1
);
...
...
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