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
e712d301
Commit
e712d301
authored
Dec 25, 2017
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/vf_convolve: add threading for complex multiplication
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
c59e49f9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
14 deletions
+32
-14
vf_convolve.c
libavfilter/vf_convolve.c
+32
-14
No files found.
libavfilter/vf_convolve.c
View file @
e712d301
...
@@ -377,6 +377,35 @@ static void get_output(ConvolveContext *s, AVFrame *out,
...
@@ -377,6 +377,35 @@ static void get_output(ConvolveContext *s, AVFrame *out,
}
}
}
}
static
int
complex_multiply
(
AVFilterContext
*
ctx
,
void
*
arg
,
int
jobnr
,
int
nb_jobs
)
{
ThreadData
*
td
=
arg
;
FFTComplex
*
input
=
td
->
hdata
;
FFTComplex
*
filter
=
td
->
vdata
;
const
int
n
=
td
->
n
;
int
start
=
(
n
*
jobnr
)
/
nb_jobs
;
int
end
=
(
n
*
(
jobnr
+
1
))
/
nb_jobs
;
int
y
,
x
;
for
(
y
=
start
;
y
<
end
;
y
++
)
{
int
yn
=
y
*
n
;
for
(
x
=
0
;
x
<
n
;
x
++
)
{
FFTSample
re
,
im
,
ire
,
iim
;
re
=
input
[
yn
+
x
].
re
;
im
=
input
[
yn
+
x
].
im
;
ire
=
filter
[
yn
+
x
].
re
;
iim
=
filter
[
yn
+
x
].
im
;
input
[
yn
+
x
].
re
=
ire
*
re
-
iim
*
im
;
input
[
yn
+
x
].
im
=
iim
*
re
+
ire
*
im
;
}
}
return
0
;
}
static
int
do_convolve
(
FFFrameSync
*
fs
)
static
int
do_convolve
(
FFFrameSync
*
fs
)
{
{
AVFilterContext
*
ctx
=
fs
->
parent
;
AVFilterContext
*
ctx
=
fs
->
parent
;
...
@@ -442,21 +471,10 @@ static int do_convolve(FFFrameSync *fs)
...
@@ -442,21 +471,10 @@ static int do_convolve(FFFrameSync *fs)
s
->
got_impulse
[
plane
]
=
1
;
s
->
got_impulse
[
plane
]
=
1
;
}
}
for
(
y
=
0
;
y
<
n
;
y
++
)
{
td
.
hdata
=
input
;
int
yn
=
y
*
n
;
td
.
vdata
=
filter
;
for
(
x
=
0
;
x
<
n
;
x
++
)
{
FFTSample
re
,
im
,
ire
,
iim
;
re
=
input
[
yn
+
x
].
re
;
ctx
->
internal
->
execute
(
ctx
,
complex_multiply
,
&
td
,
NULL
,
FFMIN3
(
MAX_THREADS
,
n
,
ff_filter_get_nb_threads
(
ctx
)));
im
=
input
[
yn
+
x
].
im
;
ire
=
filter
[
yn
+
x
].
re
;
iim
=
filter
[
yn
+
x
].
im
;
input
[
yn
+
x
].
re
=
ire
*
re
-
iim
*
im
;
input
[
yn
+
x
].
im
=
iim
*
re
+
ire
*
im
;
}
}
td
.
hdata
=
s
->
fft_hdata
[
plane
];
td
.
hdata
=
s
->
fft_hdata
[
plane
];
td
.
vdata
=
s
->
fft_vdata
[
plane
];
td
.
vdata
=
s
->
fft_vdata
[
plane
];
...
...
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