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
1329db8c
Commit
1329db8c
authored
May 30, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter/af_aiir: simplify polynomial evaluation
parent
aac16abd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
31 deletions
+18
-31
af_aiir.c
libavfilter/af_aiir.c
+18
-31
No files found.
libavfilter/af_aiir.c
View file @
1329db8c
...
@@ -385,45 +385,32 @@ static int read_channels(AVFilterContext *ctx, int channels, uint8_t *item_str,
...
@@ -385,45 +385,32 @@ static int read_channels(AVFilterContext *ctx, int channels, uint8_t *item_str,
return
0
;
return
0
;
}
}
static
void
multiply
(
double
wre
,
double
wim
,
int
npz
,
double
*
coeffs
)
static
void
cmul
(
double
re
,
double
im
,
double
re2
,
double
im2
,
double
*
RE
,
double
*
IM
)
{
{
double
nwre
=
-
wre
,
nwim
=
-
wim
;
*
RE
=
re
*
re2
-
im
*
im2
;
double
cre
,
cim
;
*
IM
=
re
*
im2
+
re2
*
im
;
int
i
;
for
(
i
=
npz
;
i
>=
1
;
i
--
)
{
cre
=
coeffs
[
2
*
i
+
0
];
cim
=
coeffs
[
2
*
i
+
1
];
coeffs
[
2
*
i
+
0
]
=
(
nwre
*
cre
-
nwim
*
cim
)
+
coeffs
[
2
*
(
i
-
1
)
+
0
];
coeffs
[
2
*
i
+
1
]
=
(
nwre
*
cim
+
nwim
*
cre
)
+
coeffs
[
2
*
(
i
-
1
)
+
1
];
}
cre
=
coeffs
[
0
];
cim
=
coeffs
[
1
];
coeffs
[
0
]
=
nwre
*
cre
-
nwim
*
cim
;
coeffs
[
1
]
=
nwre
*
cim
+
nwim
*
cre
;
}
}
static
int
expand
(
AVFilterContext
*
ctx
,
double
*
pz
,
int
n
b
,
double
*
coef
fs
)
static
int
expand
(
AVFilterContext
*
ctx
,
double
*
pz
,
int
n
,
double
*
coe
fs
)
{
{
int
i
;
coefs
[
2
*
n
]
=
1
.
0
;
coeffs
[
0
]
=
1
.
0
;
for
(
int
i
=
1
;
i
<=
n
;
i
++
)
{
coeffs
[
1
]
=
0
.
0
;
for
(
int
j
=
n
-
i
;
j
<
n
;
j
++
)
{
double
re
,
im
;
for
(
i
=
0
;
i
<
nb
;
i
++
)
{
cmul
(
coefs
[
2
*
(
j
+
1
)],
coefs
[
2
*
(
j
+
1
)
+
1
],
coeffs
[
2
*
(
i
+
1
)
]
=
0
.
0
;
pz
[
2
*
(
i
-
1
)],
pz
[
2
*
(
i
-
1
)
+
1
],
&
re
,
&
im
);
coeffs
[
2
*
(
i
+
1
)
+
1
]
=
0
.
0
;
}
for
(
i
=
0
;
i
<
nb
;
i
++
)
coefs
[
2
*
j
]
-=
re
;
multiply
(
pz
[
2
*
i
],
pz
[
2
*
i
+
1
],
nb
,
coeffs
);
coefs
[
2
*
j
+
1
]
-=
im
;
}
}
for
(
i
=
0
;
i
<
nb
+
1
;
i
++
)
{
for
(
i
nt
i
=
0
;
i
<
n
+
1
;
i
++
)
{
if
(
fabs
(
coef
f
s
[
2
*
i
+
1
])
>
FLT_EPSILON
)
{
if
(
fabs
(
coefs
[
2
*
i
+
1
])
>
FLT_EPSILON
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"coef
f
: %f of z^%d is not real; poles/zeros are not complex conjugates.
\n
"
,
av_log
(
ctx
,
AV_LOG_ERROR
,
"coef
s
: %f of z^%d is not real; poles/zeros are not complex conjugates.
\n
"
,
coef
f
s
[
2
*
i
+
1
],
i
);
coefs
[
2
*
i
+
1
],
i
);
return
AVERROR
(
EINVAL
);
return
AVERROR
(
EINVAL
);
}
}
}
}
...
...
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