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
e364fe4c
Commit
e364fe4c
authored
Jan 08, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_afir: split input frames from impulse response frames
parent
929e5159
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
14 deletions
+15
-14
af_afir.c
libavfilter/af_afir.c
+13
-13
af_afir.h
libavfilter/af_afir.h
+2
-1
No files found.
libavfilter/af_afir.c
View file @
e364fe4c
...
...
@@ -59,7 +59,7 @@ static void fcmul_add_c(float *sum, const float *t, const float *c, ptrdiff_t le
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
]
+
offset
;
const
float
*
in
=
(
const
float
*
)
s
->
in
->
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
;
...
...
@@ -175,7 +175,7 @@ static int fir_frame(AudioFIRContext *s, AVFrame *in, AVFilterLink *outlink)
if
(
s
->
pts
==
AV_NOPTS_VALUE
)
s
->
pts
=
in
->
pts
;
s
->
in
[
0
]
=
in
;
s
->
in
=
in
;
ctx
->
internal
->
execute
(
ctx
,
fir_channels
,
out
,
NULL
,
FFMIN
(
outlink
->
channels
,
ff_filter_get_nb_threads
(
ctx
)));
...
...
@@ -184,7 +184,7 @@ static int fir_frame(AudioFIRContext *s, AVFrame *in, AVFilterLink *outlink)
s
->
pts
+=
av_rescale_q
(
out
->
nb_samples
,
(
AVRational
){
1
,
outlink
->
sample_rate
},
outlink
->
time_base
);
av_frame_free
(
&
in
);
s
->
in
[
0
]
=
NULL
;
s
->
in
=
NULL
;
return
ff_filter_frame
(
outlink
,
out
);
}
...
...
@@ -255,9 +255,9 @@ static void draw_response(AVFilterContext *ctx, AVFrame *out)
if
(
!
mag
||
!
phase
||
!
delay
)
goto
end
;
channel
=
av_clip
(
s
->
ir_channel
,
0
,
s
->
i
n
[
1
]
->
channels
-
1
);
channel
=
av_clip
(
s
->
ir_channel
,
0
,
s
->
i
r
[
0
]
->
channels
-
1
);
for
(
i
=
0
;
i
<
s
->
w
;
i
++
)
{
const
float
*
src
=
(
const
float
*
)
s
->
i
n
[
1
]
->
extended_data
[
channel
];
const
float
*
src
=
(
const
float
*
)
s
->
i
r
[
0
]
->
extended_data
[
channel
];
double
w
=
i
*
M_PI
/
(
s
->
w
-
1
);
double
div
,
real_num
=
0
.,
imag_num
=
0
.,
real
=
0
.,
imag
=
0
.;
...
...
@@ -404,7 +404,7 @@ static int convert_coeffs(AVFilterContext *ctx)
part_size
=
FFMIN
(
part_size
,
max_part_size
);
}
ret
=
ff_inlink_consume_samples
(
ctx
->
inputs
[
1
],
s
->
nb_taps
,
s
->
nb_taps
,
&
s
->
i
n
[
1
]);
ret
=
ff_inlink_consume_samples
(
ctx
->
inputs
[
1
],
s
->
nb_taps
,
s
->
nb_taps
,
&
s
->
i
r
[
0
]);
if
(
ret
<
0
)
return
ret
;
if
(
ret
==
0
)
...
...
@@ -421,7 +421,7 @@ static int convert_coeffs(AVFilterContext *ctx)
break
;
case
0
:
for
(
ch
=
0
;
ch
<
ctx
->
inputs
[
1
]
->
channels
;
ch
++
)
{
float
*
time
=
(
float
*
)
s
->
i
n
[
1
]
->
extended_data
[
!
s
->
one2many
*
ch
];
float
*
time
=
(
float
*
)
s
->
i
r
[
0
]
->
extended_data
[
!
s
->
one2many
*
ch
];
for
(
i
=
0
;
i
<
s
->
nb_taps
;
i
++
)
power
+=
FFABS
(
time
[
i
]);
...
...
@@ -430,7 +430,7 @@ static int convert_coeffs(AVFilterContext *ctx)
break
;
case
1
:
for
(
ch
=
0
;
ch
<
ctx
->
inputs
[
1
]
->
channels
;
ch
++
)
{
float
*
time
=
(
float
*
)
s
->
i
n
[
1
]
->
extended_data
[
!
s
->
one2many
*
ch
];
float
*
time
=
(
float
*
)
s
->
i
r
[
0
]
->
extended_data
[
!
s
->
one2many
*
ch
];
for
(
i
=
0
;
i
<
s
->
nb_taps
;
i
++
)
power
+=
time
[
i
];
...
...
@@ -439,7 +439,7 @@ static int convert_coeffs(AVFilterContext *ctx)
break
;
case
2
:
for
(
ch
=
0
;
ch
<
ctx
->
inputs
[
1
]
->
channels
;
ch
++
)
{
float
*
time
=
(
float
*
)
s
->
i
n
[
1
]
->
extended_data
[
!
s
->
one2many
*
ch
];
float
*
time
=
(
float
*
)
s
->
i
r
[
0
]
->
extended_data
[
!
s
->
one2many
*
ch
];
for
(
i
=
0
;
i
<
s
->
nb_taps
;
i
++
)
power
+=
time
[
i
]
*
time
[
i
];
...
...
@@ -453,7 +453,7 @@ static int convert_coeffs(AVFilterContext *ctx)
s
->
gain
=
FFMIN
(
s
->
gain
*
s
->
ir_gain
,
1
.
f
);
av_log
(
ctx
,
AV_LOG_DEBUG
,
"power %f, gain %f
\n
"
,
power
,
s
->
gain
);
for
(
ch
=
0
;
ch
<
ctx
->
inputs
[
1
]
->
channels
;
ch
++
)
{
float
*
time
=
(
float
*
)
s
->
i
n
[
1
]
->
extended_data
[
!
s
->
one2many
*
ch
];
float
*
time
=
(
float
*
)
s
->
i
r
[
0
]
->
extended_data
[
!
s
->
one2many
*
ch
];
s
->
fdsp
->
vector_fmul_scalar
(
time
,
time
,
s
->
gain
,
FFALIGN
(
s
->
nb_taps
,
4
));
}
...
...
@@ -462,7 +462,7 @@ static int convert_coeffs(AVFilterContext *ctx)
av_log
(
ctx
,
AV_LOG_DEBUG
,
"nb_segments: %d
\n
"
,
s
->
nb_segments
);
for
(
ch
=
0
;
ch
<
ctx
->
inputs
[
1
]
->
channels
;
ch
++
)
{
float
*
time
=
(
float
*
)
s
->
i
n
[
1
]
->
extended_data
[
!
s
->
one2many
*
ch
];
float
*
time
=
(
float
*
)
s
->
i
r
[
0
]
->
extended_data
[
!
s
->
one2many
*
ch
];
int
toffset
=
0
;
for
(
i
=
FFMAX
(
1
,
s
->
length
*
s
->
nb_taps
);
i
<
s
->
nb_taps
;
i
++
)
...
...
@@ -510,7 +510,7 @@ static int convert_coeffs(AVFilterContext *ctx)
}
}
av_frame_free
(
&
s
->
i
n
[
1
]);
av_frame_free
(
&
s
->
i
r
[
0
]);
s
->
have_coeffs
=
1
;
return
0
;
...
...
@@ -727,7 +727,7 @@ static av_cold void uninit(AVFilterContext *ctx)
}
av_freep
(
&
s
->
fdsp
);
av_frame_free
(
&
s
->
i
n
[
1
]);
av_frame_free
(
&
s
->
i
r
[
0
]);
for
(
int
i
=
0
;
i
<
ctx
->
nb_outputs
;
i
++
)
av_freep
(
&
ctx
->
output_pads
[
i
].
name
);
...
...
libavfilter/af_afir.h
View file @
e364fe4c
...
...
@@ -87,7 +87,8 @@ typedef struct AudioFIRContext {
AudioFIRSegment
seg
[
1024
];
int
nb_segments
;
AVFrame
*
in
[
2
];
AVFrame
*
in
;
AVFrame
*
ir
[
32
];
AVFrame
*
video
;
int
min_part_size
;
int64_t
pts
;
...
...
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