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
c679119a
Commit
c679119a
authored
Feb 22, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_amplify: add tolerance option
parent
6f93868e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
filters.texi
doc/filters.texi
+5
-0
vf_amplify.c
libavfilter/vf_amplify.c
+5
-2
No files found.
doc/filters.texi
View file @
c679119a
...
...
@@ -5652,6 +5652,11 @@ Set threshold for difference amplification. Any difference greater or equal to
this value will not alter source pixel. Default is 10.
Allowed range is from 0 to 65535.
@item tolerance
Set tolerance for difference amplification. Any difference lower to
this value will not alter source pixel. Default is 0.
Allowed range is from 0 to 65535.
@item low
Set lower limit for changing source pixel. Default is 65535. Allowed range is from 0 to 65535.
This option controls maximum possible value that will decrease source pixel value.
...
...
libavfilter/vf_amplify.c
View file @
c679119a
...
...
@@ -34,6 +34,7 @@ typedef struct AmplifyContext {
int
radius
;
float
factor
;
float
threshold
;
float
tolerance
;
int
planes
;
int
llimit
;
...
...
@@ -104,6 +105,7 @@ static int amplify_frame(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs
const
int
radius
=
s
->
radius
;
const
int
nb_inputs
=
s
->
nb_inputs
;
const
float
threshold
=
s
->
threshold
;
const
float
tolerance
=
s
->
tolerance
;
const
float
factor
=
s
->
factor
;
const
int
llimit
=
s
->
llimit
;
const
int
hlimit
=
s
->
hlimit
;
...
...
@@ -136,7 +138,7 @@ static int amplify_frame(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs
avg
=
sum
/
(
float
)
nb_inputs
;
diff
=
src
-
avg
;
if
(
fabsf
(
diff
)
<
threshold
)
{
if
(
fabsf
(
diff
)
<
threshold
&&
fabsf
(
diff
)
>
tolerance
)
{
int
amp
;
if
(
diff
<
0
)
{
amp
=
-
FFMIN
(
FFABS
(
diff
*
factor
),
llimit
);
...
...
@@ -179,7 +181,7 @@ static int amplify_frame(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs
avg
=
sum
/
(
float
)
nb_inputs
;
diff
=
src
-
avg
;
if
(
fabsf
(
diff
)
<
threshold
)
{
if
(
fabsf
(
diff
)
<
threshold
&&
fabsf
(
diff
)
>
tolerance
)
{
int
amp
;
if
(
diff
<
0
)
{
amp
=
-
FFMIN
(
FFABS
(
diff
*
factor
),
llimit
);
...
...
@@ -271,6 +273,7 @@ static const AVOption amplify_options[] = {
{
"radius"
,
"set radius"
,
OFFSET
(
radius
),
AV_OPT_TYPE_INT
,
{.
i64
=
2
},
1
,
63
,
.
flags
=
FLAGS
},
{
"factor"
,
"set factor"
,
OFFSET
(
factor
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
2
},
0
,
UINT16_MAX
,
.
flags
=
FLAGS
},
{
"threshold"
,
"set threshold"
,
OFFSET
(
threshold
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
10
},
0
,
UINT16_MAX
,
.
flags
=
FLAGS
},
{
"tolerance"
,
"set tolerance"
,
OFFSET
(
tolerance
),
AV_OPT_TYPE_FLOAT
,
{.
dbl
=
0
},
0
,
UINT16_MAX
,
.
flags
=
FLAGS
},
{
"low"
,
"set low limit for amplification"
,
OFFSET
(
llimit
),
AV_OPT_TYPE_INT
,
{.
i64
=
UINT16_MAX
},
0
,
UINT16_MAX
,
.
flags
=
FLAGS
},
{
"high"
,
"set high limit for amplification"
,
OFFSET
(
hlimit
),
AV_OPT_TYPE_INT
,
{.
i64
=
UINT16_MAX
},
0
,
UINT16_MAX
,
.
flags
=
FLAGS
},
{
"planes"
,
"set what planes to filter"
,
OFFSET
(
planes
),
AV_OPT_TYPE_FLAGS
,
{.
i64
=
7
},
0
,
15
,
FLAGS
},
...
...
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