Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
f476e23c
提交
f476e23c
authored
4月 29, 2016
作者:
Piotr Gregor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-9117 [avmd] #fix build on Windows
上级
65460fae
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
22 行增加
和
8 行删除
+22
-8
avmd_fast_acosf.c
src/mod/applications/mod_avmd/avmd_fast_acosf.c
+5
-1
avmd_fast_acosf.h
src/mod/applications/mod_avmd/avmd_fast_acosf.h
+2
-0
mod_avmd.c
src/mod/applications/mod_avmd/mod_avmd.c
+15
-7
没有找到文件。
src/mod/applications/mod_avmd/avmd_fast_acosf.c
浏览文件 @
f476e23c
#ifndef WIN32
/* currently we support fast acosf computation only on UNIX/Linux */
#include <switch.h>
#include <stdio.h>
#include <stdlib.h>
...
...
@@ -312,4 +315,5 @@ dump_table_summary(void)
printf
(
"i [%d] from float [%f]
\n
"
,
index_from_float
(
f
),
f
);
}
#endif
/* FAST_ACOSF_TESTING */
#endif
/* FAST_ACOSF_TESTING */
#endif
/* WIN32 */
src/mod/applications/mod_avmd/avmd_fast_acosf.h
浏览文件 @
f476e23c
#ifndef WIN32
/* currently we support fast acosf computation only on UNIX/Linux */
/*
* @brief Fast arithmetic using precomputed arc cosine table.
* Contributor(s):
...
...
@@ -46,3 +47,4 @@ extern float fast_acosf(float x);
extern
int
compute_table
(
void
);
#endif
/* __AVMD_FAST_ACOSF_H__ */
#endif
src/mod/applications/mod_avmd/mod_avmd.c
浏览文件 @
f476e23c
...
...
@@ -483,7 +483,7 @@ avmd_parse_u8_user_input(const char *input, uint8_t *output,
if
(
helper
<
min
||
helper
>
UINT8_MAX
||
helper
>
max
||
(
pCh
==
input
)
||
(
*
pCh
!=
'\0'
))
{
return
-
1
;
}
*
output
=
helper
;
*
output
=
(
uint8_t
)
helper
;
return
0
;
}
...
...
@@ -500,7 +500,7 @@ avmd_parse_u16_user_input(const char *input, uint16_t *output,
if
(
helper
<
min
||
helper
>
UINT16_MAX
||
helper
>
max
||
(
pCh
==
input
)
||
(
*
pCh
!=
'\0'
))
{
return
-
1
;
}
*
output
=
helper
;
*
output
=
(
uint16_t
)
helper
;
return
0
;
}
...
...
@@ -689,8 +689,10 @@ avmd_show(switch_stream_handle_t *stream, switch_mutex_t *mutex)
SWITCH_MODULE_LOAD_FUNCTION
(
mod_avmd_load
)
{
#ifndef WIN32
char
err
[
150
];
int
ret
;
#endif
switch_application_interface_t
*
app_interface
;
switch_api_interface_t
*
api_interface
;
...
...
@@ -727,6 +729,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load)
/* Not so severe to prevent further loading, well - it depends, anyway */
}
#ifndef WIN32
if
(
avmd_globals
.
settings
.
fast_math
==
1
)
{
ret
=
init_fast_acosf
();
if
(
ret
!=
0
)
{
...
...
@@ -768,6 +771,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load)
"is [%s]
\n
"
,
ACOS_TABLE_FILENAME
);
}
#endif
SWITCH_ADD_APP
(
app_interface
,
"avmd_start"
,
"Start avmd detection"
,
"Start avmd detection"
,
avmd_start_app
,
""
,
SAF_NONE
);
...
...
@@ -1022,12 +1026,15 @@ SWITCH_STANDARD_APP(avmd_start_function)
SWITCH_MODULE_SHUTDOWN_FUNCTION
(
mod_avmd_shutdown
)
{
#ifndef WIN32
int
res
;
#endif
switch_mutex_lock
(
avmd_globals
.
mutex
);
avmd_unregister_all_events
();
#ifndef WIN32
if
(
avmd_globals
.
settings
.
fast_math
==
1
)
{
res
=
destroy_fast_acosf
();
if
(
res
!=
0
)
{
...
...
@@ -1045,6 +1052,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_avmd_shutdown)
}
}
}
#endif
switch_event_unbind_callback
(
avmd_reloadxml_event_handler
);
...
...
@@ -1494,13 +1502,13 @@ static void avmd_process(avmd_session_t *s, switch_frame_t *frame)
/* calculate variance (biased estimator) */
v
=
s
->
sqa_b
.
sma
-
(
s
->
sma_b
.
sma
*
s
->
sma_b
.
sma
);
#ifdef AVMD_DEBUG
#if
def AVMD_FAST_MATH
#if
!defined(WIN32) && defined(AVMD_FAST_MATH)
f
=
0
.
5
*
(
double
)
fast_acosf
((
float
)
omega
);
sma_digital_freq
=
0
.
5
*
(
double
)
fast_acosf
((
float
)
s
->
sma_b
.
sma
);
#else
f
=
0
.
5
*
acos
(
omega
);
sma_digital_freq
=
0
.
5
*
acos
(
s
->
sma_b
.
sma
);
#endif
/* AVMD_FAST_MATH */
#endif
/*
!WIN32 &&
AVMD_FAST_MATH */
#ifdef AVMD_REQUIRE_CONTINUOUS_STREAK
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
s
->
session
),
SWITCH_LOG_DEBUG
,
"<<< AVMD v[%.10f]
\t
omega[%f]
\t
f[%f] [%f]Hz
\t\t
sma[%f][%f]Hz
\t\t
sqa[%f]
\t
"
...
...
@@ -1527,11 +1535,11 @@ static void avmd_process(avmd_session_t *s, switch_frame_t *frame)
#else
if
(
v
<
VARIANCE_THRESHOLD
&&
(
s
->
sma_b
.
lpos
>
1
))
{
#endif
#if
def AVMD_FAST_MATH
#if
!defined(WIN32) && defined(AVMD_FAST_MATH)
sma_digital_freq
=
0
.
5
*
(
double
)
fast_acosf
((
float
)
s
->
sma_b
.
sma
);
#else
sma_digital_freq
=
0
.
5
*
acos
(
s
->
sma_b
.
sma
);
#endif
/* AVMD_FAST_MATH */
#endif
/*
!WIN32 &&
AVMD_FAST_MATH */
switch_channel_set_variable_printf
(
channel
,
"avmd_total_time"
,
"[%d]"
,
(
int
)(
switch_micro_time_now
()
-
s
->
start_time
)
/
1000
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论