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
cbaa6032
Commit
cbaa6032
authored
Jun 02, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_xmedian: remove limitation of only odd number of inputs
parent
41588658
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
filters.texi
doc/filters.texi
+3
-2
vf_xmedian.c
libavfilter/vf_xmedian.c
+10
-8
No files found.
doc/filters.texi
View file @
cbaa6032
...
...
@@ -18465,9 +18465,10 @@ Pick median pixels from several input videos.
The filter accept the following options:
@table @option
@item
nb_
inputs
Set number of inputs.
This must be odd number.
@item inputs
Set number of inputs.
Default is 3. Allowed range is from 3 to 255.
If number of inputs is even number, than result will be mean value between two median values.
@item planes
Set which planes to filter. Default value is @code{15}, by which all planes are processed.
...
...
libavfilter/vf_xmedian.c
View file @
cbaa6032
...
...
@@ -88,10 +88,6 @@ static av_cold int init(AVFilterContext *ctx)
XMedianContext
*
s
=
ctx
->
priv
;
int
ret
;
if
(
!
(
s
->
nb_inputs
&
1
))
av_log
(
s
,
AV_LOG_WARNING
,
"nb_intputs: %d is not odd number.
\n
"
,
s
->
nb_inputs
);
s
->
nb_inputs
=
s
->
nb_inputs
|
1
;
s
->
radius
=
s
->
nb_inputs
/
2
;
s
->
frames
=
av_calloc
(
s
->
nb_inputs
,
sizeof
(
*
s
->
frames
));
if
(
!
s
->
frames
)
...
...
@@ -156,7 +152,10 @@ static int median_frames16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
}
AV_QSORT
(
values
,
nb_inputs
,
int
,
comparei
);
dst
[
x
]
=
values
[
radius
];
if
(
radius
&
1
)
dst
[
x
]
=
values
[
radius
];
else
dst
[
x
]
=
(
values
[
radius
]
+
values
[
radius
-
1
])
>>
1
;
}
dst
+=
out
->
linesize
[
p
]
/
2
;
...
...
@@ -195,7 +194,10 @@ static int median_frames8(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
values
[
i
]
=
in
[
i
]
->
data
[
p
][
y
*
in
[
i
]
->
linesize
[
p
]
+
x
];
AV_QSORT
(
values
,
nb_inputs
,
int
,
comparei
);
dst
[
x
]
=
values
[
radius
];
if
(
radius
&
1
)
dst
[
x
]
=
values
[
radius
];
else
dst
[
x
]
=
(
values
[
radius
]
+
values
[
radius
-
1
])
>>
1
;
}
dst
+=
out
->
linesize
[
p
];
...
...
@@ -319,8 +321,8 @@ static int activate(AVFilterContext *ctx)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
static
const
AVOption
xmedian_options
[]
=
{
{
"
nb_
inputs"
,
"set number of inputs"
,
OFFSET
(
nb_inputs
),
AV_OPT_TYPE_INT
,
{.
i64
=
3
},
3
,
255
,
.
flags
=
FLAGS
},
{
"planes"
,
"set planes to filter"
,
OFFSET
(
planes
),
AV_OPT_TYPE_INT
,
{.
i64
=
15
},
0
,
15
,
.
flags
=
FLAGS
},
{
"inputs"
,
"set number of inputs"
,
OFFSET
(
nb_inputs
),
AV_OPT_TYPE_INT
,
{.
i64
=
3
},
3
,
255
,
.
flags
=
FLAGS
},
{
"planes"
,
"set planes to filter"
,
OFFSET
(
planes
),
AV_OPT_TYPE_INT
,
{.
i64
=
15
},
0
,
15
,
.
flags
=
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