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
37cb3eb5
Commit
37cb3eb5
authored
Jan 27, 2011
by
Justin Ruggles
Committed by
Mans Rullgard
Jan 28, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add special case for 2nd-order IIR filter.
40% faster in ff_iir_filter_flt() when c->order == 2.
parent
d1b6f33b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
iirfilter.c
libavcodec/iirfilter.c
+22
-2
No files found.
libavcodec/iirfilter.c
View file @
37cb3eb5
...
...
@@ -256,11 +256,29 @@ av_cold struct FFIIRFilterState* ff_iir_filter_init_state(int order)
} \
}
#define FILTER_O2(type, fmt) { \
int i; \
const type *src0 = src; \
type *dst0 = dst; \
for (i = 0; i < size; i++) { \
float in = *src0 * c->gain + \
s->x[0] * c->cy[0] + \
s->x[1] * c->cy[1]; \
CONV_##fmt(*dst0, s->x[0] + in + s->x[1] * c->cx[1]) \
s->x[0] = s->x[1]; \
s->x[1] = in; \
src0 += sstep; \
dst0 += dstep; \
} \
}
void
ff_iir_filter
(
const
struct
FFIIRFilterCoeffs
*
c
,
struct
FFIIRFilterState
*
s
,
int
size
,
const
int16_t
*
src
,
int
sstep
,
int16_t
*
dst
,
int
dstep
)
{
if
(
c
->
order
==
4
)
{
if
(
c
->
order
==
2
)
{
FILTER_O2
(
int16_t
,
S16
)
}
else
if
(
c
->
order
==
4
)
{
FILTER_BW_O4
(
int16_t
,
S16
)
}
else
{
FILTER_DIRECT_FORM_II
(
int16_t
,
S16
)
...
...
@@ -271,7 +289,9 @@ void ff_iir_filter_flt(const struct FFIIRFilterCoeffs *c,
struct
FFIIRFilterState
*
s
,
int
size
,
const
float
*
src
,
int
sstep
,
float
*
dst
,
int
dstep
)
{
if
(
c
->
order
==
4
)
{
if
(
c
->
order
==
2
)
{
FILTER_O2
(
float
,
FLT
)
}
else
if
(
c
->
order
==
4
)
{
FILTER_BW_O4
(
float
,
FLT
)
}
else
{
FILTER_DIRECT_FORM_II
(
float
,
FLT
)
...
...
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