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
49d97d9b
Commit
49d97d9b
authored
Dec 13, 2015
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_sofalizer: move modulo operation out of loop
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
1acc90ea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
af_sofalizer.c
libavfilter/af_sofalizer.c
+10
-6
No files found.
libavfilter/af_sofalizer.c
View file @
49d97d9b
...
...
@@ -654,15 +654,15 @@ static int sofalizer_convolute(AVFilterContext *ctx, void *arg, int jobnr, int n
const
int
n_samples
=
s
->
sofa
.
n_samples
;
/* length of one IR */
const
float
*
src
=
(
const
float
*
)
in
->
data
[
0
];
/* get pointer to audio input buffer */
float
*
dst
=
(
float
*
)
out
->
data
[
0
];
/* get pointer to audio output buffer */
int
in_channels
=
in
->
channels
;
/* number of input channels */
const
int
in_channels
=
in
->
channels
;
/* number of input channels */
/* ring buffer length is: longest IR plus max. delay -> next power of 2 */
int
buffer_length
=
s
->
buffer_length
;
const
int
buffer_length
=
s
->
buffer_length
;
/* -1 for AND instead of MODULO (applied to powers of 2): */
uint32_t
modulo
=
(
uint32_t
)
buffer_length
-
1
;
const
uint32_t
modulo
=
(
uint32_t
)
buffer_length
-
1
;
float
*
buffer
[
10
];
/* holds ringbuffer for each input channel */
int
wr
=
*
write
;
int
read
;
int
i
,
j
,
l
;
int
i
,
l
;
dst
+=
offset
;
for
(
l
=
0
;
l
<
in_channels
;
l
++
)
{
...
...
@@ -688,8 +688,12 @@ static int sofalizer_convolute(AVFilterContext *ctx, void *arg, int jobnr, int n
* (mod buffer length) */
read
=
(
wr
-
*
(
delay
+
l
)
-
(
n_samples
-
1
)
+
buffer_length
)
&
modulo
;
for
(
j
=
0
;
j
<
n_samples
;
j
++
)
temp_src
[
j
]
=
bptr
[(
read
+
j
)
&
modulo
];
if
(
read
+
n_samples
<
buffer_length
)
{
memcpy
(
temp_src
,
bptr
+
read
,
n_samples
*
sizeof
(
*
temp_src
));
}
else
{
memcpy
(
temp_src
,
bptr
+
read
,
(
buffer_length
-
read
)
*
sizeof
(
*
temp_src
));
memcpy
(
temp_src
+
(
buffer_length
-
read
),
bptr
,
(
read
-
n_samples
)
*
sizeof
(
*
temp_src
));
}
/* multiply signal and IR, and add up the results */
dst
[
0
]
+=
s
->
fdsp
->
scalarproduct_float
(
temp_ir
,
temp_src
,
n_samples
);
...
...
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