Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
270068b5
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
270068b5
编写于
4月 14, 2019
作者:
P
Paul B Mahol
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avfilter/af_acrossover: improve filter output
Makes sum always flat. Also faster.
上级
616e9b5c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
39 deletion
+19
-39
libavfilter/af_acrossover.c
libavfilter/af_acrossover.c
+19
-39
未找到文件。
libavfilter/af_acrossover.c
浏览文件 @
270068b5
...
...
@@ -47,7 +47,6 @@ typedef struct BiquadContext {
typedef
struct
CrossoverChannel
{
BiquadContext
lp
[
MAX_BANDS
][
4
];
BiquadContext
hp
[
MAX_BANDS
][
4
];
}
CrossoverChannel
;
typedef
struct
AudioCrossoverContext
{
...
...
@@ -131,30 +130,16 @@ static av_cold int init(AVFilterContext *ctx)
return
ret
;
}
static
void
set_lp
(
BiquadContext
*
b
,
float
fc
,
float
q
,
float
sr
)
static
void
set_lp
(
BiquadContext
*
b
,
double
fc
,
double
q
,
double
sr
)
{
double
omega
=
(
2
.
0
*
M_PI
*
fc
/
sr
)
;
double
omega
=
2
.
0
*
M_PI
*
fc
/
sr
;
double
sn
=
sin
(
omega
);
double
cs
=
cos
(
omega
);
double
alpha
=
(
sn
/
(
2
*
q
));
double
inv
=
(
1
.
0
/
(
1
.
0
+
alpha
));
b
->
a2
=
b
->
a0
=
(
inv
*
(
1
.
0
-
cs
)
*
0
.
5
);
b
->
a1
=
b
->
a0
+
b
->
a0
;
b
->
b1
=
-
2
.
*
cs
*
inv
;
b
->
b2
=
(
1
.
-
alpha
)
*
inv
;
}
static
void
set_hp
(
BiquadContext
*
b
,
float
fc
,
float
q
,
float
sr
)
{
double
omega
=
2
*
M_PI
*
fc
/
sr
;
double
sn
=
sin
(
omega
);
double
cs
=
cos
(
omega
);
double
alpha
=
sn
/
(
2
*
q
);
double
alpha
=
sn
/
(
2
.
*
q
);
double
inv
=
1
.
0
/
(
1
.
0
+
alpha
);
b
->
a0
=
inv
*
(
1
.
+
cs
)
/
2
.
;
b
->
a1
=
-
2
.
*
b
->
a0
;
b
->
a0
=
(
1
.
-
cs
)
*
0
.
5
*
inv
;
b
->
a1
=
(
1
.
-
cs
)
*
inv
;
b
->
a2
=
b
->
a0
;
b
->
b1
=
-
2
.
*
cs
*
inv
;
b
->
b2
=
(
1
.
-
alpha
)
*
inv
;
...
...
@@ -189,18 +174,13 @@ static int config_input(AVFilterLink *inlink)
for
(
ch
=
0
;
ch
<
inlink
->
channels
;
ch
++
)
{
for
(
band
=
0
;
band
<=
s
->
nb_splits
;
band
++
)
{
set_lp
(
&
s
->
xover
[
ch
].
lp
[
band
][
0
],
s
->
splits
[
band
],
q
,
sample_rate
);
set_hp
(
&
s
->
xover
[
ch
].
hp
[
band
][
0
],
s
->
splits
[
band
],
q
,
sample_rate
);
if
(
s
->
order
>
1
)
{
set_lp
(
&
s
->
xover
[
ch
].
lp
[
band
][
1
],
s
->
splits
[
band
],
1
.
34
,
sample_rate
);
set_hp
(
&
s
->
xover
[
ch
].
hp
[
band
][
1
],
s
->
splits
[
band
],
1
.
34
,
sample_rate
);
set_lp
(
&
s
->
xover
[
ch
].
lp
[
band
][
2
],
s
->
splits
[
band
],
q
,
sample_rate
);
set_hp
(
&
s
->
xover
[
ch
].
hp
[
band
][
2
],
s
->
splits
[
band
],
q
,
sample_rate
);
set_lp
(
&
s
->
xover
[
ch
].
lp
[
band
][
3
],
s
->
splits
[
band
],
1
.
34
,
sample_rate
);
set_hp
(
&
s
->
xover
[
ch
].
hp
[
band
][
3
],
s
->
splits
[
band
],
1
.
34
,
sample_rate
);
}
else
{
set_lp
(
&
s
->
xover
[
ch
].
lp
[
band
][
1
],
s
->
splits
[
band
],
q
,
sample_rate
);
set_hp
(
&
s
->
xover
[
ch
].
hp
[
band
][
1
],
s
->
splits
[
band
],
q
,
sample_rate
);
}
}
}
...
...
@@ -275,23 +255,23 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
const
double
*
src
=
(
const
double
*
)
in
->
extended_data
[
ch
];
CrossoverChannel
*
xover
=
&
s
->
xover
[
ch
];
for
(
band
=
0
;
band
<
ctx
->
nb_outputs
;
band
++
)
{
double
*
dst
=
(
double
*
)
frames
[
band
]
->
extended_data
[
ch
];
for
(
i
=
0
;
i
<
in
->
nb_samples
;
i
++
)
{
dst
[
i
]
=
src
[
i
];
for
(
i
=
0
;
i
<
in
->
nb_samples
;
i
++
)
{
double
sample
=
src
[
i
],
lo
,
hi
;
for
(
f
=
0
;
f
<
s
->
filter_count
;
f
++
)
{
if
(
band
+
1
<
ctx
->
nb_outputs
)
{
BiquadContext
*
lp
=
&
xover
->
lp
[
band
][
f
];
dst
[
i
]
=
biquad_process
(
lp
,
dst
[
i
]);
}
for
(
band
=
0
;
band
<
ctx
->
nb_outputs
;
band
++
)
{
double
*
dst
=
(
double
*
)
frames
[
band
]
->
extended_data
[
ch
];
if
(
band
-
1
>=
0
)
{
BiquadContext
*
hp
=
&
xover
->
hp
[
band
-
1
][
f
];
dst
[
i
]
=
biquad_process
(
hp
,
dst
[
i
])
;
}
lo
=
sample
;
for
(
f
=
0
;
band
+
1
<
ctx
->
nb_outputs
&&
f
<
s
->
filter_count
;
f
++
)
{
BiquadContext
*
lp
=
&
xover
->
lp
[
band
][
f
]
;
lo
=
biquad_process
(
lp
,
lo
);
}
hi
=
sample
-
lo
;
dst
[
i
]
=
lo
;
sample
=
hi
;
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录