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
f1c9d6fe
Commit
f1c9d6fe
authored
May 13, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_chromahold: implement blend option
parent
dcc99981
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
filters.texi
doc/filters.texi
+5
-0
vf_chromakey.c
libavfilter/vf_chromakey.c
+7
-1
No files found.
doc/filters.texi
View file @
f1c9d6fe
...
...
@@ -6449,6 +6449,11 @@ The color which will not be replaced with neutral chroma.
Similarity
percentage
with
the
above
color
.
0.01
matches
only
the
exact
key
color
,
while
1.0
matches
everything
.
@
item
blend
Blend
percentage
.
0.0
makes
pixels
either
fully
gray
,
or
not
gray
at
all
.
Higher
values
result
in
more
preserved
color
.
@
item
yuv
Signals
that
the
color
passed
is
already
in
YUV
instead
of
RGB
.
...
...
libavfilter/vf_chromakey.c
View file @
f1c9d6fe
...
...
@@ -128,7 +128,12 @@ static int do_chromahold_slice(AVFilterContext *avctx, void *arg, int jobnr, int
diff
=
sqrt
((
du
*
du
+
dv
*
dv
)
/
(
255
.
0
*
255
.
0
));
alpha
=
diff
>
ctx
->
similarity
;
if
(
alpha
)
{
if
(
ctx
->
blend
>
0
.
0001
)
{
double
f
=
1
.
-
av_clipd
((
diff
-
ctx
->
similarity
)
/
ctx
->
blend
,
0
.
0
,
1
.
0
);
frame
->
data
[
1
][
frame
->
linesize
[
1
]
*
y
+
x
]
=
128
+
(
u
-
128
)
*
f
;
frame
->
data
[
2
][
frame
->
linesize
[
2
]
*
y
+
x
]
=
128
+
(
v
-
128
)
*
f
;
}
else
if
(
alpha
)
{
frame
->
data
[
1
][
frame
->
linesize
[
1
]
*
y
+
x
]
=
128
;
frame
->
data
[
2
][
frame
->
linesize
[
2
]
*
y
+
x
]
=
128
;
}
...
...
@@ -262,6 +267,7 @@ AVFilter ff_vf_chromakey = {
static
const
AVOption
chromahold_options
[]
=
{
{
"color"
,
"set the chromahold key color"
,
OFFSET
(
chromakey_rgba
),
AV_OPT_TYPE_COLOR
,
{
.
str
=
"black"
},
CHAR_MIN
,
CHAR_MAX
,
FLAGS
},
{
"similarity"
,
"set the chromahold similarity value"
,
OFFSET
(
similarity
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
.
01
},
0
.
01
,
1
.
0
,
FLAGS
},
{
"blend"
,
"set the chromahold blend value"
,
OFFSET
(
blend
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
0
.
0
},
0
.
0
,
1
.
0
,
FLAGS
},
{
"yuv"
,
"color parameter is in yuv instead of rgb"
,
OFFSET
(
is_yuv
),
AV_OPT_TYPE_BOOL
,
{
.
i64
=
0
},
0
,
1
,
FLAGS
},
{
NULL
}
};
...
...
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