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
c7bfc826
Commit
c7bfc826
authored
Aug 08, 2023
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_vibrato: refactor code
Move some code out of inner loop.
parent
b98ee1a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
21 deletions
+28
-21
af_vibrato.c
libavfilter/af_vibrato.c
+28
-21
No files found.
libavfilter/af_vibrato.c
View file @
c7bfc826
...
...
@@ -54,9 +54,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
AVFilterContext
*
ctx
=
inlink
->
dst
;
VibratoContext
*
s
=
ctx
->
priv
;
const
int
wave_table_size
=
s
->
wave_table_size
;
const
double
*
wave_table
=
s
->
wave_table
;
AVFilterLink
*
outlink
=
ctx
->
outputs
[
0
];
const
int
channels
=
s
->
channels
;
const
int
buf_size
=
s
->
buf_size
;
const
double
depth
=
s
->
depth
;
int
wave_table_index
=
s
->
wave_table_index
;
int
buf_index
=
s
->
buf_index
;
AVFrame
*
out
;
int
n
,
c
;
const
double
*
src
;
double
*
dst
;
...
...
@@ -71,39 +77,40 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
av_frame_copy_props
(
out
,
in
);
}
for
(
n
=
0
;
n
<
in
->
nb_samples
;
n
++
)
{
for
(
int
n
=
0
;
n
<
in
->
nb_samples
;
n
++
)
{
int
samp1_index
,
samp2_index
;
double
integer
,
decimal
;
decimal
=
modf
(
s
->
depth
*
s
->
wave_table
[
s
->
wave_table_index
],
&
integer
);
decimal
=
modf
(
depth
*
wave_table
[
wave_table_index
],
&
integer
);
s
->
wave_table_index
++
;
if
(
s
->
wave_table_index
>=
s
->
wave_table_size
)
s
->
wave_table_index
-=
s
->
wave_table_size
;
wave_table_index
++
;
if
(
wave_table_index
>=
wave_table_size
)
wave_table_index
-=
wave_table_size
;
for
(
c
=
0
;
c
<
inlink
->
ch_layout
.
nb_channels
;
c
++
)
{
int
samp1_index
,
samp2_index
;
double
*
buf
;
double
this_samp
;
samp1_index
=
buf_index
+
integer
;
if
(
samp1_index
>=
buf_size
)
samp1_index
-=
buf_size
;
samp2_index
=
samp1_index
+
1
;
if
(
samp2_index
>=
buf_size
)
samp2_index
-=
buf_size
;
for
(
int
c
=
0
;
c
<
channels
;
c
++
)
{
double
*
buf
,
this_samp
;
src
=
(
const
double
*
)
in
->
extended_data
[
c
];
dst
=
(
double
*
)
out
->
extended_data
[
c
];
buf
=
s
->
buf
[
c
];
samp1_index
=
s
->
buf_index
+
integer
;
if
(
samp1_index
>=
s
->
buf_size
)
samp1_index
-=
s
->
buf_size
;
samp2_index
=
samp1_index
+
1
;
if
(
samp2_index
>=
s
->
buf_size
)
samp2_index
-=
s
->
buf_size
;
this_samp
=
src
[
n
];
dst
[
n
]
=
buf
[
samp1_index
]
+
(
decimal
*
(
buf
[
samp2_index
]
-
buf
[
samp1_index
]));
buf
[
s
->
buf_index
]
=
this_samp
;
buf
[
buf_index
]
=
this_samp
;
}
s
->
buf_index
++
;
if
(
s
->
buf_index
>=
s
->
buf_size
)
s
->
buf_index
-=
s
->
buf_size
;
buf_index
++
;
if
(
buf_index
>=
buf_size
)
buf_index
-=
buf_size
;
}
s
->
wave_table_index
=
wave_table_index
;
s
->
buf_index
=
buf_index
;
if
(
in
!=
out
)
av_frame_free
(
&
in
);
...
...
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