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
e6547cce
Commit
e6547cce
authored
Mar 13, 2015
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/eq: factorize code in process_command()
parent
6b940b8c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
43 deletions
+23
-43
vf_eq.c
libavfilter/vf_eq.c
+23
-43
No files found.
libavfilter/vf_eq.c
View file @
e6547cce
...
...
@@ -276,54 +276,34 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
return
ff_filter_frame
(
outlink
,
out
);
}
static
inline
int
set_param
(
AVExpr
**
pexpr
,
const
char
*
args
,
const
char
*
cmd
,
void
(
*
set_fn
)(
EQContext
*
eq
),
AVFilterContext
*
ctx
)
{
EQContext
*
eq
=
ctx
->
priv
;
int
ret
;
if
((
ret
=
set_expr
(
pexpr
,
args
,
cmd
,
ctx
))
<
0
)
return
ret
;
set_fn
(
eq
);
return
0
;
}
static
int
process_command
(
AVFilterContext
*
ctx
,
const
char
*
cmd
,
const
char
*
args
,
char
*
res
,
int
res_len
,
int
flags
)
{
EQContext
*
eq
=
ctx
->
priv
;
int
ret
;
if
(
!
strcmp
(
cmd
,
"contrast"
))
{
ret
=
set_expr
(
&
eq
->
contrast_pexpr
,
args
,
cmd
,
ctx
);
set_contrast
(
eq
);
return
ret
;
}
else
if
(
!
strcmp
(
cmd
,
"brightness"
))
{
ret
=
set_expr
(
&
eq
->
brightness_pexpr
,
args
,
cmd
,
ctx
);
set_brightness
(
eq
);
return
ret
;
}
else
if
(
!
strcmp
(
cmd
,
"saturation"
))
{
ret
=
set_expr
(
&
eq
->
saturation_pexpr
,
args
,
cmd
,
ctx
);
set_saturation
(
eq
);
return
ret
;
}
else
if
(
!
strcmp
(
cmd
,
"gamma"
))
{
ret
=
set_expr
(
&
eq
->
gamma_pexpr
,
args
,
cmd
,
ctx
);
set_gamma
(
eq
);
return
ret
;
}
else
if
(
!
strcmp
(
cmd
,
"gamma_r"
))
{
ret
=
set_expr
(
&
eq
->
gamma_r_pexpr
,
args
,
cmd
,
ctx
);
set_gamma
(
eq
);
return
ret
;
}
else
if
(
!
strcmp
(
cmd
,
"gamma_g"
))
{
ret
=
set_expr
(
&
eq
->
gamma_g_pexpr
,
args
,
cmd
,
ctx
);
set_gamma
(
eq
);
return
ret
;
}
else
if
(
!
strcmp
(
cmd
,
"gamma_b"
))
{
ret
=
set_expr
(
&
eq
->
gamma_b_pexpr
,
args
,
cmd
,
ctx
);
set_gamma
(
eq
);
return
ret
;
}
else
if
(
!
strcmp
(
cmd
,
"gamma_weight"
))
{
ret
=
set_expr
(
&
eq
->
gamma_weight_pexpr
,
args
,
cmd
,
ctx
);
set_gamma
(
eq
);
return
ret
;
}
else
return
AVERROR
(
ENOSYS
);
#define SET_PARAM(param_name, set_fn_name) \
if (!strcmp(cmd, #param_name)) return set_param(&eq->param_name##_pexpr, args, cmd, set_##set_fn_name, ctx);
SET_PARAM
(
contrast
,
contrast
)
else
SET_PARAM
(
brightness
,
brightness
)
else
SET_PARAM
(
saturation
,
saturation
)
else
SET_PARAM
(
gamma
,
gamma
)
else
SET_PARAM
(
gamma_r
,
gamma
)
else
SET_PARAM
(
gamma_g
,
gamma
)
else
SET_PARAM
(
gamma_b
,
gamma
)
else
SET_PARAM
(
gamma_weight
,
gamma
)
else
return
AVERROR
(
ENOSYS
);
}
static
const
AVFilterPad
eq_inputs
[]
=
{
...
...
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