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
6b9862f6
Commit
6b9862f6
authored
Nov 21, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_lumakey: change options to doubles, so that values are automatically scaled
parent
08f7968f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
vf_lumakey.c
libavfilter/vf_lumakey.c
+15
-12
No files found.
libavfilter/vf_lumakey.c
View file @
6b9862f6
...
...
@@ -28,12 +28,13 @@
typedef
struct
LumakeyContext
{
const
AVClass
*
class
;
int
threshold
;
int
tolerance
;
int
softness
;
double
threshold
;
double
tolerance
;
double
softness
;
int
white
;
int
black
;
int
so
;
int
max
;
int
(
*
do_lumakey_slice
)(
AVFilterContext
*
ctx
,
void
*
arg
,
int
jobnr
,
int
nb_jobs
);
...
...
@@ -47,7 +48,7 @@ static int do_lumakey_slice8(AVFilterContext *ctx, void *arg, int jobnr, int nb_
const
int
slice_end
=
(
frame
->
height
*
(
jobnr
+
1
))
/
nb_jobs
;
uint8_t
*
alpha
=
frame
->
data
[
3
]
+
slice_start
*
frame
->
linesize
[
3
];
const
uint8_t
*
luma
=
frame
->
data
[
0
]
+
slice_start
*
frame
->
linesize
[
0
];
const
int
so
=
s
->
so
ftness
;
const
int
so
=
s
->
so
;
const
int
w
=
s
->
white
;
const
int
b
=
s
->
black
;
int
x
,
y
;
...
...
@@ -79,7 +80,7 @@ static int do_lumakey_slice16(AVFilterContext *ctx, void *arg, int jobnr, int nb
const
int
slice_end
=
(
frame
->
height
*
(
jobnr
+
1
))
/
nb_jobs
;
uint16_t
*
alpha
=
(
uint16_t
*
)(
frame
->
data
[
3
]
+
slice_start
*
frame
->
linesize
[
3
]);
const
uint16_t
*
luma
=
(
const
uint16_t
*
)(
frame
->
data
[
0
]
+
slice_start
*
frame
->
linesize
[
0
]);
const
int
so
=
s
->
so
ftness
;
const
int
so
=
s
->
so
;
const
int
w
=
s
->
white
;
const
int
b
=
s
->
black
;
const
int
m
=
s
->
max
;
...
...
@@ -113,14 +114,16 @@ static int config_input(AVFilterLink *inlink)
depth
=
desc
->
comp
[
0
].
depth
;
if
(
depth
==
8
)
{
s
->
white
=
av_clip_uint8
(
s
->
threshold
+
s
->
tolerance
);
s
->
black
=
av_clip_uint8
(
s
->
threshold
-
s
->
tolerance
);
s
->
white
=
av_clip_uint8
(
(
s
->
threshold
+
s
->
tolerance
)
*
255
);
s
->
black
=
av_clip_uint8
(
(
s
->
threshold
-
s
->
tolerance
)
*
255
);
s
->
do_lumakey_slice
=
do_lumakey_slice8
;
s
->
so
=
s
->
softness
*
255
;
}
else
{
s
->
max
=
(
1
<<
depth
)
-
1
;
s
->
white
=
av_clip
(
s
->
threshold
+
s
->
tolerance
,
0
,
s
->
max
);
s
->
black
=
av_clip
(
s
->
threshold
-
s
->
tolerance
,
0
,
s
->
max
);
s
->
white
=
av_clip
(
(
s
->
threshold
+
s
->
tolerance
)
*
s
->
max
,
0
,
s
->
max
);
s
->
black
=
av_clip
(
(
s
->
threshold
-
s
->
tolerance
)
*
s
->
max
,
0
,
s
->
max
);
s
->
do_lumakey_slice
=
do_lumakey_slice16
;
s
->
so
=
s
->
softness
*
s
->
max
;
}
return
0
;
...
...
@@ -182,9 +185,9 @@ static const AVFilterPad lumakey_outputs[] = {
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
lumakey_options
[]
=
{
{
"threshold"
,
"set the threshold value"
,
OFFSET
(
threshold
),
AV_OPT_TYPE_
INT
,
{.
i64
=
0
},
0
,
UINT16_MAX
,
FLAGS
},
{
"tolerance"
,
"set the tolerance value"
,
OFFSET
(
tolerance
),
AV_OPT_TYPE_
INT
,
{.
i64
=
1
},
0
,
UINT16_MAX
,
FLAGS
},
{
"softness"
,
"set the softness value"
,
OFFSET
(
softness
),
AV_OPT_TYPE_
INT
,
{.
i64
=
0
},
0
,
UINT16_MAX
,
FLAGS
},
{
"threshold"
,
"set the threshold value"
,
OFFSET
(
threshold
),
AV_OPT_TYPE_
DOUBLE
,
{.
dbl
=
0
},
0
,
1
,
FLAGS
},
{
"tolerance"
,
"set the tolerance value"
,
OFFSET
(
tolerance
),
AV_OPT_TYPE_
DOUBLE
,
{.
dbl
=
0
.
01
},
0
,
1
,
FLAGS
},
{
"softness"
,
"set the softness value"
,
OFFSET
(
softness
),
AV_OPT_TYPE_
DOUBLE
,
{.
dbl
=
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