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
f3552c3b
Commit
f3552c3b
authored
Dec 31, 2017
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_afir: rework FIR gain measurement
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
0e1f771d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
5 deletions
+19
-5
af_afir.c
libavfilter/af_afir.c
+19
-5
No files found.
libavfilter/af_afir.c
View file @
f3552c3b
...
...
@@ -105,7 +105,7 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
if
(
out
)
{
float
*
ptr
=
(
float
*
)
out
->
extended_data
[
ch
];
s
->
fdsp
->
vector_fmul_scalar
(
ptr
,
dst
,
s
->
gain
*
s
->
wet_gain
,
FFALIGN
(
out
->
nb_samples
,
4
));
s
->
fdsp
->
vector_fmul_scalar
(
ptr
,
dst
,
s
->
wet_gain
,
FFALIGN
(
out
->
nb_samples
,
4
));
emms_c
();
}
...
...
@@ -166,7 +166,6 @@ static int convert_coeffs(AVFilterContext *ctx)
{
AudioFIRContext
*
s
=
ctx
->
priv
;
int
i
,
ch
,
n
,
N
;
float
power
=
0
;
s
->
nb_taps
=
av_audio_fifo_size
(
s
->
fifo
[
1
]);
if
(
s
->
nb_taps
<=
0
)
...
...
@@ -217,13 +216,29 @@ static int convert_coeffs(AVFilterContext *ctx)
av_audio_fifo_read
(
s
->
fifo
[
1
],
(
void
**
)
s
->
in
[
1
]
->
extended_data
,
s
->
nb_taps
);
if
(
s
->
again
)
{
float
power
=
0
;
for
(
ch
=
0
;
ch
<
ctx
->
inputs
[
1
]
->
channels
;
ch
++
)
{
float
*
time
=
(
float
*
)
s
->
in
[
1
]
->
extended_data
[
!
s
->
one2many
*
ch
];
for
(
i
=
0
;
i
<
s
->
nb_taps
;
i
++
)
power
+=
FFABS
(
time
[
i
]);
}
s
->
gain
=
sqrtf
(
1
.
f
/
(
ctx
->
inputs
[
1
]
->
channels
*
power
))
/
(
sqrtf
(
ctx
->
inputs
[
1
]
->
channels
));
for
(
ch
=
0
;
ch
<
ctx
->
inputs
[
1
]
->
channels
;
ch
++
)
{
float
*
time
=
(
float
*
)
s
->
in
[
1
]
->
extended_data
[
!
s
->
one2many
*
ch
];
s
->
fdsp
->
vector_fmul_scalar
(
time
,
time
,
s
->
gain
,
FFALIGN
(
s
->
nb_taps
,
4
));
}
}
for
(
ch
=
0
;
ch
<
ctx
->
inputs
[
1
]
->
channels
;
ch
++
)
{
float
*
time
=
(
float
*
)
s
->
in
[
1
]
->
extended_data
[
!
s
->
one2many
*
ch
];
float
*
block
=
s
->
block
[
ch
];
FFTComplex
*
coeff
=
s
->
coeff
[
ch
];
power
+=
s
->
fdsp
->
scalarproduct_float
(
time
,
time
,
s
->
nb_taps
);
for
(
i
=
FFMAX
(
1
,
s
->
length
*
s
->
nb_taps
);
i
<
s
->
nb_taps
;
i
++
)
time
[
i
]
=
0
;
...
...
@@ -252,7 +267,6 @@ static int convert_coeffs(AVFilterContext *ctx)
}
av_frame_free
(
&
s
->
in
[
1
]);
s
->
gain
=
s
->
again
?
1
.
f
/
sqrtf
(
power
/
ctx
->
inputs
[
1
]
->
channels
)
:
1
.
f
;
av_log
(
ctx
,
AV_LOG_DEBUG
,
"nb_taps: %d
\n
"
,
s
->
nb_taps
);
av_log
(
ctx
,
AV_LOG_DEBUG
,
"nb_partitions: %d
\n
"
,
s
->
nb_partitions
);
av_log
(
ctx
,
AV_LOG_DEBUG
,
"partition size: %d
\n
"
,
s
->
part_size
);
...
...
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