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
86555a2f
Commit
86555a2f
authored
Dec 31, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_afir: fix overhead for small partitions
parent
c4276a7f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
af_afir.c
libavfilter/af_afir.c
+23
-10
No files found.
libavfilter/af_afir.c
View file @
86555a2f
...
...
@@ -56,12 +56,12 @@ static void fcmul_add_c(float *sum, const float *t, const float *c, ptrdiff_t le
sum
[
2
*
n
]
+=
t
[
2
*
n
]
*
c
[
2
*
n
];
}
static
int
fir_
channel
(
AVFilterContext
*
ctx
,
void
*
arg
,
int
ch
)
static
int
fir_
quantum
(
AVFilterContext
*
ctx
,
AVFrame
*
out
,
int
ch
,
int
offset
)
{
AudioFIRContext
*
s
=
ctx
->
priv
;
const
float
*
in
=
(
const
float
*
)
s
->
in
[
0
]
->
extended_data
[
ch
];
AVFrame
*
out
=
arg
;
float
*
block
,
*
buf
,
*
ptr
=
(
float
*
)
out
->
extended_data
[
ch
]
;
const
float
*
in
=
(
const
float
*
)
s
->
in
[
0
]
->
extended_data
[
ch
]
+
offset
;
float
*
block
,
*
buf
,
*
ptr
=
(
float
*
)
out
->
extended_data
[
ch
]
+
offset
;
const
int
nb_samples
=
FFMIN
(
s
->
min_part_size
,
out
->
nb_samples
-
offset
)
;
int
n
,
i
,
j
;
for
(
int
segment
=
0
;
segment
<
s
->
nb_segments
;
segment
++
)
{
...
...
@@ -70,7 +70,7 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int ch)
float
*
dst
=
(
float
*
)
seg
->
output
->
extended_data
[
ch
];
float
*
sum
=
(
float
*
)
seg
->
sum
->
extended_data
[
ch
];
s
->
fdsp
->
vector_fmul_scalar
(
src
+
seg
->
input_offset
,
in
,
s
->
dry_gain
,
FFALIGN
(
out
->
nb_samples
,
4
));
s
->
fdsp
->
vector_fmul_scalar
(
src
+
seg
->
input_offset
,
in
,
s
->
dry_gain
,
FFALIGN
(
nb_samples
,
4
));
emms_c
();
seg
->
output_offset
[
ch
]
+=
s
->
min_part_size
;
...
...
@@ -80,7 +80,7 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int ch)
memmove
(
src
,
src
+
s
->
min_part_size
,
(
seg
->
input_size
-
s
->
min_part_size
)
*
sizeof
(
*
src
));
dst
+=
seg
->
output_offset
[
ch
];
for
(
n
=
0
;
n
<
out
->
nb_samples
;
n
++
)
{
for
(
n
=
0
;
n
<
nb_samples
;
n
++
)
{
ptr
[
n
]
+=
dst
[
n
];
}
continue
;
...
...
@@ -127,17 +127,28 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int ch)
memmove
(
src
,
src
+
s
->
min_part_size
,
(
seg
->
input_size
-
s
->
min_part_size
)
*
sizeof
(
*
src
));
for
(
n
=
0
;
n
<
out
->
nb_samples
;
n
++
)
{
for
(
n
=
0
;
n
<
nb_samples
;
n
++
)
{
ptr
[
n
]
+=
dst
[
n
];
}
}
s
->
fdsp
->
vector_fmul_scalar
(
ptr
,
ptr
,
s
->
wet_gain
,
FFALIGN
(
out
->
nb_samples
,
4
));
s
->
fdsp
->
vector_fmul_scalar
(
ptr
,
ptr
,
s
->
wet_gain
,
FFALIGN
(
nb_samples
,
4
));
emms_c
();
return
0
;
}
static
int
fir_channel
(
AVFilterContext
*
ctx
,
AVFrame
*
out
,
int
ch
)
{
AudioFIRContext
*
s
=
ctx
->
priv
;
for
(
int
offset
=
0
;
offset
<
out
->
nb_samples
;
offset
+=
s
->
min_part_size
)
{
fir_quantum
(
ctx
,
out
,
ch
,
offset
);
}
return
0
;
}
static
int
fir_channels
(
AVFilterContext
*
ctx
,
void
*
arg
,
int
jobnr
,
int
nb_jobs
)
{
AVFrame
*
out
=
arg
;
...
...
@@ -525,8 +536,8 @@ static int activate(AVFilterContext *ctx)
{
AudioFIRContext
*
s
=
ctx
->
priv
;
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
int
ret
,
status
,
available
,
wanted
;
AVFrame
*
in
=
NULL
;
int
ret
,
status
;
int64_t
pts
;
FF_FILTER_FORWARD_STATUS_BACK_ALL
(
ctx
->
outputs
[
0
],
ctx
);
...
...
@@ -557,7 +568,9 @@ static int activate(AVFilterContext *ctx)
return
ret
;
}
ret
=
ff_inlink_consume_samples
(
ctx
->
inputs
[
0
],
s
->
min_part_size
,
s
->
min_part_size
,
&
in
);
available
=
ff_inlink_queued_samples
(
ctx
->
inputs
[
0
]);
wanted
=
FFMAX
(
s
->
min_part_size
,
(
available
/
s
->
min_part_size
)
*
s
->
min_part_size
);
ret
=
ff_inlink_consume_samples
(
ctx
->
inputs
[
0
],
wanted
,
wanted
,
&
in
);
if
(
ret
>
0
)
ret
=
fir_frame
(
s
,
in
,
outlink
);
...
...
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