Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
aa4acc11
Commit
aa4acc11
authored
May 28, 2023
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_silenceremove: use separate variable for size of cache
parent
364c03d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
af_silenceremove.c
libavfilter/af_silenceremove.c
+15
-2
silenceremove_template.c
libavfilter/silenceremove_template.c
+5
-3
No files found.
libavfilter/af_silenceremove.c
View file @
aa4acc11
...
...
@@ -94,6 +94,7 @@ typedef struct SilenceRemoveContext {
int
*
stop_back
;
int64_t
window_duration
;
int
cache_size
;
int
start_window_pos
;
int
start_window_size
;
...
...
@@ -224,10 +225,22 @@ static int config_output(AVFilterLink *outlink)
AVFilterContext
*
ctx
=
outlink
->
src
;
SilenceRemoveContext
*
s
=
ctx
->
priv
;
switch
(
s
->
detection
)
{
case
D_AVG
:
case
D_RMS
:
s
->
cache_size
=
1
;
break
;
case
D_MEDIAN
:
case
D_PEAK
:
case
D_PTP
:
s
->
cache_size
=
s
->
window_duration
;
break
;
}
s
->
start_window
=
ff_get_audio_buffer
(
outlink
,
s
->
window_duration
);
s
->
stop_window
=
ff_get_audio_buffer
(
outlink
,
s
->
window_duration
);
s
->
start_cache
=
av_calloc
(
outlink
->
ch_layout
.
nb_channels
,
s
->
window_duration
*
sizeof
(
*
s
->
start_cache
));
s
->
stop_cache
=
av_calloc
(
outlink
->
ch_layout
.
nb_channels
,
s
->
window_duration
*
sizeof
(
*
s
->
stop_cache
));
s
->
start_cache
=
av_calloc
(
outlink
->
ch_layout
.
nb_channels
,
s
->
cache_size
*
sizeof
(
*
s
->
start_cache
));
s
->
stop_cache
=
av_calloc
(
outlink
->
ch_layout
.
nb_channels
,
s
->
cache_size
*
sizeof
(
*
s
->
stop_cache
));
if
(
!
s
->
start_window
||
!
s
->
stop_window
||
!
s
->
start_cache
||
!
s
->
stop_cache
)
return
AVERROR
(
ENOMEM
);
...
...
libavfilter/silenceremove_template.c
View file @
aa4acc11
...
...
@@ -328,6 +328,7 @@ static void fn(filter_start)(AVFilterContext *ctx,
ftype
*
start_cache
=
(
ftype
*
)
s
->
start_cache
;
const
int
start_silence
=
s
->
start_silence
;
int
window_size
=
start_window_nb_samples
;
const
int
cache_size
=
s
->
cache_size
;
int
*
front
=
s
->
start_front
;
int
*
back
=
s
->
start_back
;
...
...
@@ -352,7 +353,7 @@ static void fn(filter_start)(AVFilterContext *ctx,
ftype
start_ow
=
startw
[
start_wpos
+
ch
];
ftype
tstart
;
tstart
=
fn
(
s
->
compute
)(
start_cache
+
ch
*
start_window_nb_samples
,
tstart
=
fn
(
s
->
compute
)(
start_cache
+
ch
*
cache_size
,
start_sample
,
start_ow
,
window_size
,
...
...
@@ -423,8 +424,9 @@ static void fn(filter_stop)(AVFilterContext *ctx,
const
int
stop_duration
=
s
->
stop_duration
;
ftype
*
stop_cache
=
(
ftype
*
)
s
->
stop_cache
;
const
int
stop_silence
=
s
->
stop_silence
;
const
int
restart
=
s
->
restart
;
int
window_size
=
stop_window_nb_samples
;
const
int
cache_size
=
s
->
cache_size
;
const
int
restart
=
s
->
restart
;
int
*
front
=
s
->
stop_front
;
int
*
back
=
s
->
stop_back
;
...
...
@@ -446,7 +448,7 @@ static void fn(filter_stop)(AVFilterContext *ctx,
ftype
stop_ow
=
stopw
[
stop_wpos
+
ch
];
ftype
tstop
;
tstop
=
fn
(
s
->
compute
)(
stop_cache
+
ch
*
stop_window_nb_samples
,
tstop
=
fn
(
s
->
compute
)(
stop_cache
+
ch
*
cache_size
,
stop_sample
,
stop_ow
,
window_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