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
4568e54c
Commit
4568e54c
authored
Oct 08, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_colorchannelmixer: add support for commands
parent
953b1c7b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
8 deletions
+23
-8
vf_colorchannelmixer.c
libavfilter/vf_colorchannelmixer.c
+23
-8
No files found.
libavfilter/vf_colorchannelmixer.c
View file @
4568e54c
...
...
@@ -52,7 +52,8 @@ typedef struct ColorChannelMixerContext {
}
ColorChannelMixerContext
;
#define OFFSET(x) offsetof(ColorChannelMixerContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
static
const
AVOption
colorchannelmixer_options
[]
=
{
{
"rr"
,
"set the red gain for the red channel"
,
OFFSET
(
rr
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
1
},
-
2
,
2
,
FLAGS
},
{
"rg"
,
"set the green gain for the red channel"
,
OFFSET
(
rg
),
AV_OPT_TYPE_DOUBLE
,
{.
dbl
=
0
},
-
2
,
2
,
FLAGS
},
...
...
@@ -408,18 +409,20 @@ static int config_output(AVFilterLink *outlink)
ColorChannelMixerContext
*
s
=
ctx
->
priv
;
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
outlink
->
format
);
const
int
depth
=
desc
->
comp
[
0
].
depth
;
int
i
,
j
,
size
,
*
buffer
;
int
i
,
j
,
size
,
*
buffer
=
s
->
buffer
;
ff_fill_rgba_map
(
s
->
rgba_map
,
outlink
->
format
);
size
=
1
<<
depth
;
s
->
buffer
=
buffer
=
av_malloc
(
16
*
size
*
sizeof
(
*
s
->
buffer
));
if
(
!
s
->
buffer
)
return
AVERROR
(
ENOMEM
);
if
(
!
s
->
buffer
)
{
s
->
buffer
=
buffer
=
av_malloc
(
16
*
size
*
sizeof
(
*
s
->
buffer
));
if
(
!
s
->
buffer
)
return
AVERROR
(
ENOMEM
);
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
j
=
0
;
j
<
4
;
j
++
,
buffer
+=
size
)
s
->
lut
[
i
][
j
]
=
buffer
;
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
j
=
0
;
j
<
4
;
j
++
,
buffer
+=
size
)
s
->
lut
[
i
][
j
]
=
buffer
;
}
for
(
i
=
0
;
i
<
size
;
i
++
)
{
s
->
lut
[
R
][
R
][
i
]
=
lrint
(
i
*
s
->
rr
);
...
...
@@ -531,6 +534,17 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
return
ff_filter_frame
(
outlink
,
out
);
}
static
int
process_command
(
AVFilterContext
*
ctx
,
const
char
*
cmd
,
const
char
*
args
,
char
*
res
,
int
res_len
,
int
flags
)
{
int
ret
=
ff_filter_process_command
(
ctx
,
cmd
,
args
,
res
,
res_len
,
flags
);
if
(
ret
<
0
)
return
ret
;
return
config_output
(
ctx
->
outputs
[
0
]);
}
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
{
ColorChannelMixerContext
*
s
=
ctx
->
priv
;
...
...
@@ -566,4 +580,5 @@ AVFilter ff_vf_colorchannelmixer = {
.
inputs
=
colorchannelmixer_inputs
,
.
outputs
=
colorchannelmixer_outputs
,
.
flags
=
AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
|
AVFILTER_FLAG_SLICE_THREADS
,
.
process_command
=
process_command
,
};
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