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
3c3eb493
Commit
3c3eb493
authored
Dec 29, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_afir: make part_index values per channel
parent
31c9d693
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
af_afir.c
libavfilter/af_afir.c
+10
-8
af_afir.h
libavfilter/af_afir.h
+2
-1
No files found.
libavfilter/af_afir.c
View file @
3c3eb493
...
...
@@ -67,7 +67,7 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
int
n
,
i
,
j
;
memset
(
sum
,
0
,
sizeof
(
*
sum
)
*
seg
->
fft_length
);
block
=
(
float
*
)
seg
->
block
->
extended_data
[
ch
]
+
seg
->
part_index
*
seg
->
block_size
;
block
=
(
float
*
)
seg
->
block
->
extended_data
[
ch
]
+
seg
->
part_index
[
ch
]
*
seg
->
block_size
;
memset
(
block
,
0
,
sizeof
(
*
block
)
*
seg
->
fft_length
);
s
->
fdsp
->
vector_fmul_scalar
(
block
,
src
,
s
->
dry_gain
,
FFALIGN
(
out
->
nb_samples
,
4
));
...
...
@@ -77,7 +77,7 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
block
[
2
*
seg
->
part_size
]
=
block
[
1
];
block
[
1
]
=
0
;
j
=
seg
->
part_index
;
j
=
seg
->
part_index
[
ch
]
;
for
(
i
=
0
;
i
<
seg
->
nb_partitions
;
i
++
)
{
const
int
coffset
=
i
*
seg
->
coeff_size
;
...
...
@@ -106,6 +106,8 @@ static int fir_channel(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
dst
=
(
float
*
)
seg
->
buffer
->
extended_data
[
ch
];
memcpy
(
dst
,
sum
+
seg
->
part_size
,
seg
->
part_size
*
sizeof
(
*
dst
));
seg
->
part_index
[
ch
]
=
(
seg
->
part_index
[
ch
]
+
1
)
%
seg
->
nb_partitions
;
return
0
;
}
...
...
@@ -125,12 +127,6 @@ static int fir_frame(AudioFIRContext *s, AVFrame *in, AVFilterLink *outlink)
s
->
in
[
0
]
=
in
;
ctx
->
internal
->
execute
(
ctx
,
fir_channel
,
out
,
NULL
,
outlink
->
channels
);
for
(
int
segment
=
0
;
segment
<
s
->
nb_segments
;
segment
++
)
{
AudioFIRSegment
*
seg
=
&
s
->
seg
[
segment
];
seg
->
part_index
=
(
seg
->
part_index
+
1
)
%
seg
->
nb_partitions
;
}
out
->
pts
=
s
->
pts
;
if
(
s
->
pts
!=
AV_NOPTS_VALUE
)
s
->
pts
+=
av_rescale_q
(
out
->
nb_samples
,
(
AVRational
){
1
,
outlink
->
sample_rate
},
outlink
->
time_base
);
...
...
@@ -300,6 +296,10 @@ static int init_segment(AVFilterContext *ctx, AudioFIRSegment *seg, int nb_parti
return
AVERROR
(
ENOMEM
);
}
seg
->
part_index
=
av_calloc
(
ctx
->
inputs
[
0
]
->
channels
,
sizeof
(
*
seg
->
part_index
));
if
(
!
seg
->
part_index
)
return
AVERROR
(
ENOMEM
);
seg
->
sum
=
ff_get_audio_buffer
(
ctx
->
inputs
[
0
],
seg
->
fft_length
);
seg
->
block
=
ff_get_audio_buffer
(
ctx
->
inputs
[
0
],
seg
->
nb_partitions
*
seg
->
block_size
);
seg
->
buffer
=
ff_get_audio_buffer
(
ctx
->
inputs
[
0
],
seg
->
part_size
);
...
...
@@ -622,6 +622,8 @@ static void uninit_segment(AVFilterContext *ctx, AudioFIRSegment *seg)
}
av_freep
(
&
seg
->
irdft
);
av_freep
(
&
seg
->
part_index
);
av_frame_free
(
&
seg
->
block
);
av_frame_free
(
&
seg
->
sum
);
av_frame_free
(
&
seg
->
buffer
);
...
...
libavfilter/af_afir.h
View file @
3c3eb493
...
...
@@ -33,13 +33,14 @@
typedef
struct
AudioFIRSegment
{
int
nb_partitions
;
int
part_index
;
int
part_size
;
int
block_size
;
int
fft_length
;
int
coeff_size
;
int
segment_size
;
int
*
part_index
;
AVFrame
*
sum
;
AVFrame
*
block
;
AVFrame
*
buffer
;
...
...
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