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
631f7acc
Commit
631f7acc
authored
Sep 25, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_stack: add slice threading
parent
44095564
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
15 deletions
+28
-15
vf_stack.c
libavfilter/vf_stack.c
+28
-15
No files found.
libavfilter/vf_stack.c
View file @
631f7acc
...
...
@@ -116,6 +116,29 @@ static av_cold int init(AVFilterContext *ctx)
return
0
;
}
static
int
process_slice
(
AVFilterContext
*
ctx
,
void
*
arg
,
int
job
,
int
nb_jobs
)
{
StackContext
*
s
=
ctx
->
priv
;
AVFrame
*
out
=
arg
;
AVFrame
**
in
=
s
->
frames
;
const
int
start
=
(
s
->
nb_inputs
*
job
)
/
nb_jobs
;
const
int
end
=
(
s
->
nb_inputs
*
(
job
+
1
))
/
nb_jobs
;
for
(
int
i
=
start
;
i
<
end
;
i
++
)
{
StackItem
*
item
=
&
s
->
items
[
i
];
for
(
int
p
=
0
;
p
<
s
->
nb_planes
;
p
++
)
{
av_image_copy_plane
(
out
->
data
[
p
]
+
out
->
linesize
[
p
]
*
item
->
y
[
p
]
+
item
->
x
[
p
],
out
->
linesize
[
p
],
in
[
i
]
->
data
[
p
],
in
[
i
]
->
linesize
[
p
],
item
->
linesize
[
p
],
item
->
height
[
p
]);
}
}
return
0
;
}
static
int
process_frame
(
FFFrameSync
*
fs
)
{
AVFilterContext
*
ctx
=
fs
->
parent
;
...
...
@@ -123,7 +146,7 @@ static int process_frame(FFFrameSync *fs)
StackContext
*
s
=
fs
->
opaque
;
AVFrame
**
in
=
s
->
frames
;
AVFrame
*
out
;
int
i
,
p
,
ret
;
int
i
,
ret
;
for
(
i
=
0
;
i
<
s
->
nb_inputs
;
i
++
)
{
if
((
ret
=
ff_framesync_get_frame
(
&
s
->
fs
,
i
,
&
in
[
i
],
0
))
<
0
)
...
...
@@ -136,17 +159,7 @@ static int process_frame(FFFrameSync *fs)
out
->
pts
=
av_rescale_q
(
s
->
fs
.
pts
,
s
->
fs
.
time_base
,
outlink
->
time_base
);
out
->
sample_aspect_ratio
=
outlink
->
sample_aspect_ratio
;
for
(
i
=
0
;
i
<
s
->
nb_inputs
;
i
++
)
{
StackItem
*
item
=
&
s
->
items
[
i
];
for
(
p
=
0
;
p
<
s
->
nb_planes
;
p
++
)
{
av_image_copy_plane
(
out
->
data
[
p
]
+
out
->
linesize
[
p
]
*
item
->
y
[
p
]
+
item
->
x
[
p
],
out
->
linesize
[
p
],
in
[
i
]
->
data
[
p
],
in
[
i
]
->
linesize
[
p
],
item
->
linesize
[
p
],
item
->
height
[
p
]);
}
}
ctx
->
internal
->
execute
(
ctx
,
process_slice
,
out
,
NULL
,
FFMIN
(
s
->
nb_inputs
,
ff_filter_get_nb_threads
(
ctx
)));
return
ff_filter_frame
(
outlink
,
out
);
}
...
...
@@ -370,7 +383,7 @@ AVFilter ff_vf_hstack = {
.
init
=
init
,
.
uninit
=
uninit
,
.
activate
=
activate
,
.
flags
=
AVFILTER_FLAG_DYNAMIC_INPUTS
,
.
flags
=
AVFILTER_FLAG_DYNAMIC_INPUTS
|
AVFILTER_FLAG_SLICE_THREADS
,
};
#endif
/* CONFIG_HSTACK_FILTER */
...
...
@@ -390,7 +403,7 @@ AVFilter ff_vf_vstack = {
.
init
=
init
,
.
uninit
=
uninit
,
.
activate
=
activate
,
.
flags
=
AVFILTER_FLAG_DYNAMIC_INPUTS
,
.
flags
=
AVFILTER_FLAG_DYNAMIC_INPUTS
|
AVFILTER_FLAG_SLICE_THREADS
,
};
#endif
/* CONFIG_VSTACK_FILTER */
...
...
@@ -416,7 +429,7 @@ AVFilter ff_vf_xstack = {
.
init
=
init
,
.
uninit
=
uninit
,
.
activate
=
activate
,
.
flags
=
AVFILTER_FLAG_DYNAMIC_INPUTS
,
.
flags
=
AVFILTER_FLAG_DYNAMIC_INPUTS
|
AVFILTER_FLAG_SLICE_THREADS
,
};
#endif
/* CONFIG_XSTACK_FILTER */
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