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
d709a18a
Commit
d709a18a
authored
Feb 19, 2013
by
Stefano Sabatini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavfi/hue: simplify parsing by making use of option shorthands
parent
088f20a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
34 deletions
+3
-34
vf_hue.c
libavfilter/vf_hue.c
+3
-34
No files found.
libavfilter/vf_hue.c
View file @
d709a18a
...
...
@@ -130,14 +130,10 @@ static inline void compute_sin_and_cos(HueContext *hue)
static
inline
int
set_options
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
HueContext
*
hue
=
ctx
->
priv
;
int
n
,
ret
;
char
c1
=
0
,
c2
=
0
;
int
ret
;
char
*
old_hue_expr
,
*
old_hue_deg_expr
,
*
old_saturation_expr
;
AVExpr
*
old_hue_pexpr
,
*
old_hue_deg_pexpr
,
*
old_saturation_pexpr
;
if
(
args
)
{
/* named options syntax */
if
(
strchr
(
args
,
'='
))
{
static
const
char
*
shorthand
[]
=
{
"h"
,
"s"
,
NULL
};
old_hue_expr
=
hue
->
hue_expr
;
old_hue_deg_expr
=
hue
->
hue_deg_expr
;
old_saturation_expr
=
hue
->
saturation_expr
;
...
...
@@ -150,7 +146,7 @@ static inline int set_options(AVFilterContext *ctx, const char *args)
hue
->
hue_deg_expr
=
NULL
;
hue
->
saturation_expr
=
NULL
;
if
((
ret
=
av_
set_options_string
(
hue
,
args
,
"="
,
":"
))
<
0
)
if
((
ret
=
av_
opt_set_from_string
(
hue
,
args
,
shorthand
,
"="
,
":"
))
<
0
)
return
ret
;
if
(
hue
->
hue_expr
&&
hue
->
hue_deg_expr
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
...
...
@@ -172,33 +168,6 @@ static inline int set_options(AVFilterContext *ctx, const char *args)
"H_expr:%s h_deg_expr:%s s_expr:%s
\n
"
,
hue
->
hue_expr
,
hue
->
hue_deg_expr
,
hue
->
saturation_expr
);
/* compatibility h:s syntax */
}
else
{
n
=
sscanf
(
args
,
"%f%c%f%c"
,
&
hue
->
hue_deg
,
&
c1
,
&
hue
->
saturation
,
&
c2
);
if
(
n
!=
1
&&
(
n
!=
3
||
c1
!=
':'
))
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid syntax for argument '%s': "
"must be in the form 'hue[:saturation]'
\n
"
,
args
);
return
AVERROR
(
EINVAL
);
}
if
(
hue
->
saturation
<
SAT_MIN_VAL
||
hue
->
saturation
>
SAT_MAX_VAL
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid value for saturation %0.1f: "
"must be included between range %d and +%d
\n
"
,
hue
->
saturation
,
SAT_MIN_VAL
,
SAT_MAX_VAL
);
return
AVERROR
(
EINVAL
);
}
hue
->
hue
=
hue
->
hue_deg
*
M_PI
/
180
;
hue
->
flat_syntax
=
1
;
av_log
(
ctx
,
AV_LOG_VERBOSE
,
"H:%0.1f h:%0.1f s:%0.1f
\n
"
,
hue
->
hue
,
hue
->
hue_deg
,
hue
->
saturation
);
}
}
compute_sin_and_cos
(
hue
);
return
0
;
...
...
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