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
d94c6df9
Commit
d94c6df9
authored
May 03, 2023
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_afreqshift: cache nb_coeffs value
parent
0e580806
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
af_afreqshift.c
libavfilter/af_afreqshift.c
+8
-6
No files found.
libavfilter/af_afreqshift.c
View file @
d94c6df9
...
@@ -66,6 +66,7 @@ static void pfilter_channel_## name(AVFilterContext *ctx, \
...
@@ -66,6 +66,7 @@ static void pfilter_channel_## name(AVFilterContext *ctx, \
type *o1 = (type *)s->o1->extended_data[ch]; \
type *o1 = (type *)s->o1->extended_data[ch]; \
type *i2 = (type *)s->i2->extended_data[ch]; \
type *i2 = (type *)s->i2->extended_data[ch]; \
type *o2 = (type *)s->o2->extended_data[ch]; \
type *o2 = (type *)s->o2->extended_data[ch]; \
const int nb_coeffs = s->nb_coeffs; \
const type *c = s->cc; \
const type *c = s->cc; \
const type level = s->level; \
const type level = s->level; \
type shift = s->shift * M_PI; \
type shift = s->shift * M_PI; \
...
@@ -76,7 +77,7 @@ static void pfilter_channel_## name(AVFilterContext *ctx, \
...
@@ -76,7 +77,7 @@ static void pfilter_channel_## name(AVFilterContext *ctx, \
type xn1 = src[n], xn2 = src[n]; \
type xn1 = src[n], xn2 = src[n]; \
type I, Q; \
type I, Q; \
\
\
for (int j = 0; j <
s->nb_coeffs; j++) {
\
for (int j = 0; j <
nb_coeffs; j++) {
\
I = c[j] * (xn1 + o2[j]) - i2[j]; \
I = c[j] * (xn1 + o2[j]) - i2[j]; \
i2[j] = i1[j]; \
i2[j] = i1[j]; \
i1[j] = xn1; \
i1[j] = xn1; \
...
@@ -85,7 +86,7 @@ static void pfilter_channel_## name(AVFilterContext *ctx, \
...
@@ -85,7 +86,7 @@ static void pfilter_channel_## name(AVFilterContext *ctx, \
xn1 = I; \
xn1 = I; \
} \
} \
\
\
for (int j =
s->nb_coeffs; j < s->nb_coeffs*2; j++) {
\
for (int j =
nb_coeffs; j < nb_coeffs*2; j++) {
\
Q = c[j] * (xn2 + o2[j]) - i2[j]; \
Q = c[j] * (xn2 + o2[j]) - i2[j]; \
i2[j] = i1[j]; \
i2[j] = i1[j]; \
i1[j] = xn2; \
i1[j] = xn2; \
...
@@ -93,7 +94,7 @@ static void pfilter_channel_## name(AVFilterContext *ctx, \
...
@@ -93,7 +94,7 @@ static void pfilter_channel_## name(AVFilterContext *ctx, \
o1[j] = Q; \
o1[j] = Q; \
xn2 = Q; \
xn2 = Q; \
} \
} \
Q = o2[
s->nb_coeffs * 2 - 1];
\
Q = o2[
nb_coeffs * 2 - 1];
\
\
\
dst[n] = (I * cos_theta - Q * sin_theta) * level; \
dst[n] = (I * cos_theta - Q * sin_theta) * level; \
} \
} \
...
@@ -115,6 +116,7 @@ static void ffilter_channel_## name(AVFilterContext *ctx, \
...
@@ -115,6 +116,7 @@ static void ffilter_channel_## name(AVFilterContext *ctx, \
type *o1 = (type *)s->o1->extended_data[ch]; \
type *o1 = (type *)s->o1->extended_data[ch]; \
type *i2 = (type *)s->i2->extended_data[ch]; \
type *i2 = (type *)s->i2->extended_data[ch]; \
type *o2 = (type *)s->o2->extended_data[ch]; \
type *o2 = (type *)s->o2->extended_data[ch]; \
const int nb_coeffs = s->nb_coeffs; \
const type *c = s->cc; \
const type *c = s->cc; \
const type level = s->level; \
const type level = s->level; \
type ts = 1. / in->sample_rate; \
type ts = 1. / in->sample_rate; \
...
@@ -125,7 +127,7 @@ static void ffilter_channel_## name(AVFilterContext *ctx, \
...
@@ -125,7 +127,7 @@ static void ffilter_channel_## name(AVFilterContext *ctx, \
type xn1 = src[n], xn2 = src[n]; \
type xn1 = src[n], xn2 = src[n]; \
type I, Q, theta; \
type I, Q, theta; \
\
\
for (int j = 0; j <
s->nb_coeffs; j++) {
\
for (int j = 0; j <
nb_coeffs; j++) {
\
I = c[j] * (xn1 + o2[j]) - i2[j]; \
I = c[j] * (xn1 + o2[j]) - i2[j]; \
i2[j] = i1[j]; \
i2[j] = i1[j]; \
i1[j] = xn1; \
i1[j] = xn1; \
...
@@ -134,7 +136,7 @@ static void ffilter_channel_## name(AVFilterContext *ctx, \
...
@@ -134,7 +136,7 @@ static void ffilter_channel_## name(AVFilterContext *ctx, \
xn1 = I; \
xn1 = I; \
} \
} \
\
\
for (int j =
s->nb_coeffs; j < s->nb_coeffs*2; j++) {
\
for (int j =
nb_coeffs; j < nb_coeffs*2; j++) {
\
Q = c[j] * (xn2 + o2[j]) - i2[j]; \
Q = c[j] * (xn2 + o2[j]) - i2[j]; \
i2[j] = i1[j]; \
i2[j] = i1[j]; \
i1[j] = xn2; \
i1[j] = xn2; \
...
@@ -142,7 +144,7 @@ static void ffilter_channel_## name(AVFilterContext *ctx, \
...
@@ -142,7 +144,7 @@ static void ffilter_channel_## name(AVFilterContext *ctx, \
o1[j] = Q; \
o1[j] = Q; \
xn2 = Q; \
xn2 = Q; \
} \
} \
Q = o2[
s->nb_coeffs * 2 - 1];
\
Q = o2[
nb_coeffs * 2 - 1];
\
\
\
theta = 2. * M_PI * fmod(shift * (N + n) * ts, 1.); \
theta = 2. * M_PI * fmod(shift * (N + n) * ts, 1.); \
dst[n] = (I * cos(theta) - Q * sin(theta)) * level; \
dst[n] = (I * cos(theta) - Q * sin(theta)) * level; \
...
...
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