Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
83965199
提交
83965199
authored
3月 21, 2013
作者:
Steve Underwood
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
A few spandsp tweaks
上级
1ce96ce9
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
115 行增加
和
29 行删除
+115
-29
ax_check_arm_neon.m4
libs/spandsp/m4/ax_check_arm_neon.m4
+1
-1
saturated.h
libs/spandsp/src/spandsp/saturated.h
+64
-8
v22bis_rx.c
libs/spandsp/src/v22bis_rx.c
+5
-6
v22bis_tx.c
libs/spandsp/src/v22bis_tx.c
+1
-1
v29tx.c
libs/spandsp/src/v29tx.c
+1
-2
saturated_tests.c
libs/spandsp/tests/saturated_tests.c
+43
-11
没有找到文件。
libs/spandsp/m4/ax_check_arm_neon.m4
浏览文件 @
83965199
# @synopsis AX_CHECK_ARM_NEON
#
# Does the machine support the ARM NEON instruction set?
# @version 1.0
Dec 31 2012
# @version 1.0
1 Feb 11 2013
# @author Steve Underwood
#
# Permission to use, copy, modify, distribute, and sell this file for any
...
...
libs/spandsp/src/spandsp/saturated.h
浏览文件 @
83965199
...
...
@@ -363,24 +363,80 @@ static __inline__ int32_t saturated_sub32(int32_t a, int32_t b)
static
__inline__
int16_t
saturated_mul16
(
int16_t
a
,
int16_t
b
)
{
int32_t
product
;
int32_t
z
;
product
=
(
int32_t
)
a
*
b
;
if
(
product
==
0x40000000
)
#if defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
__asm__
__volatile__
(
" smulbb %[z],%[a],%[b];
\n
"
" qadd %[z],%[z],%[z];
\n
"
:
[
z
]
"=r"
(
z
)
:
[
a
]
"r"
(
a
),
[
b
]
"r"
(
b
)
);
return
(
int16_t
)
(
z
>>
16
);
#else
z
=
(
int32_t
)
a
*
b
;
if
(
z
==
0x40000000
)
return
INT16_MAX
;
/*endif*/
return
(
int16_t
)
(
product
>>
15
);
return
(
int16_t
)
(
z
>>
15
);
#endif
}
/*- End of function --------------------------------------------------------*/
static
__inline__
int32_t
saturated_mul16_32
(
int16_t
a
,
int16_t
b
)
{
int32_t
product
;
int32_t
z
;
product
=
(
int32_t
)
a
*
b
;
if
(
product
==
0x40000000
)
#if defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
__asm__
__volatile__
(
" smulbb %[z],%[a],%[b];
\n
"
" qadd %[z],%[z],%[z];
\n
"
:
[
z
]
"=r"
(
z
)
:
[
a
]
"r"
(
a
),
[
b
]
"r"
(
b
)
);
return
z
;
#else
z
=
(
int32_t
)
a
*
b
;
if
(
z
==
0x40000000
)
return
INT32_MAX
;
return
product
<<
1
;
return
z
<<
1
;
#endif
}
/*- End of function --------------------------------------------------------*/
static
__inline__
int32_t
saturated_mac16_32
(
int32_t
z
,
int16_t
a
,
int16_t
b
)
{
#if defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
int32_t
product
;
__asm__
__volatile__
(
" smulbb %[p],%[a],%[b];
\n
"
" qdadd %[z],%[z],%[p];
\n
"
:
[
z
]
"=r"
(
z
)
:
"[z]"
(
z
),
[
a
]
"r"
(
a
),
[
b
]
"r"
(
b
),
[
p
]
"r"
(
product
)
);
return
z
;
#else
return
saturated_add32
(
z
,
saturated_mul16_32
(
a
,
b
));
#endif
}
/*- End of function --------------------------------------------------------*/
static
__inline__
int32_t
saturated_msu16_32
(
int32_t
z
,
int16_t
a
,
int16_t
b
)
{
#if defined(__GNUC__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__))
int32_t
product
;
__asm__
__volatile__
(
" smulbb %[p],%[a],%[b];
\n
"
" qdsub %[z],%[z],%[p];
\n
"
:
[
z
]
"=r"
(
z
)
:
"[z]"
(
z
),
[
a
]
"r"
(
a
),
[
b
]
"r"
(
b
),
[
p
]
"r"
(
product
)
);
return
z
;
#else
return
saturated_sub32
(
z
,
saturated_mul16_32
(
a
,
b
));
#endif
}
/*- End of function --------------------------------------------------------*/
...
...
libs/spandsp/src/v22bis_rx.c
浏览文件 @
83965199
...
...
@@ -73,8 +73,8 @@
#include "spandsp/private/v22bis.h"
#if defined(SPANDSP_USE_FIXED_POINT)
#define FP_SCALE(x) FP_Q_6_10(x)
#define FP_SHIFT_FACTOR 10
#define FP_SCALE FP_Q_6_10
#else
#define FP_SCALE(x) (x)
#endif
...
...
@@ -306,9 +306,8 @@ static __inline__ int descramble(v22bis_state_t *s, int bit)
{
int
out_bit
;
bit
&=
1
;
/* Descramble the bit */
bit
&=
1
;
out_bit
=
(
bit
^
(
s
->
rx
.
scramble_reg
>>
13
)
^
(
s
->
rx
.
scramble_reg
>>
16
))
&
1
;
s
->
rx
.
scramble_reg
=
(
s
->
rx
.
scramble_reg
<<
1
)
|
bit
;
...
...
@@ -856,9 +855,9 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l
{
/* Only AGC during the initial symbol acquisition, and then lock the gain. */
#if defined(SPANDSP_USE_FIXED_POINT)
s
->
rx
.
agc_scaling
=
saturate16
(((
int32_t
)
(
1024
.
0
f
*
1024
.
0
f
*
0
.
18
f
*
3
.
60
f
))
/
fixed_sqrt32
(
power
));
s
->
rx
.
agc_scaling
=
saturate16
(((
int32_t
)
(
FP_SCALE
(
0
.
18
f
)
*
FP_SCALE
(
3
.
60
f
)
))
/
fixed_sqrt32
(
power
));
#else
s
->
rx
.
agc_scaling
=
0
.
18
f
*
3
.
60
f
/
sqrtf
(
power
);
s
->
rx
.
agc_scaling
=
FP_SCALE
(
0
.
18
f
)
*
FP_SCALE
(
3
.
60
f
)
/
fixed_sqrt32
(
power
);
#endif
}
/* Pulse shape while still at the carrier frequency, using a quadrature
...
...
@@ -868,7 +867,6 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l
step
=
-
s
->
rx
.
eq_put_step
;
if
(
step
>
PULSESHAPER_COEFF_SETS
-
1
)
step
=
PULSESHAPER_COEFF_SETS
-
1
;
s
->
rx
.
eq_put_step
+=
PULSESHAPER_COEFF_SETS
*
40
/
(
3
*
2
);
if
(
s
->
calling_party
)
{
#if defined(SPANDSP_USE_FIXED_POINT)
...
...
@@ -905,6 +903,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l
zz
.
re
=
sample
.
re
*
z
.
re
-
sample
.
im
*
z
.
im
;
zz
.
im
=
-
sample
.
re
*
z
.
im
-
sample
.
im
*
z
.
re
;
#endif
s
->
rx
.
eq_put_step
+=
PULSESHAPER_COEFF_SETS
*
40
/
(
3
*
2
);
process_half_baud
(
s
,
&
zz
);
}
#if defined(SPANDSP_USE_FIXED_POINT)
...
...
libs/spandsp/src/v22bis_tx.c
浏览文件 @
83965199
...
...
@@ -63,7 +63,7 @@
#include "spandsp/private/v22bis.h"
#if defined(SPANDSP_USE_FIXED_POINT)
#define FP_SCALE
FP_Q_6_10
#define FP_SCALE
(x) FP_Q_6_10(x)
#else
#define FP_SCALE(x) (x)
#endif
...
...
libs/spandsp/src/v29tx.c
浏览文件 @
83965199
...
...
@@ -66,9 +66,8 @@
#define FP_CONSTELLATION_SCALE(x) FP_SCALE(x)
#include "v29tx_constellation_maps.h"
#include "v29tx_rrc.h"
#include "v29tx_constellation_maps.h"
/*! The nominal frequency of the carrier, in Hertz */
#define CARRIER_NOMINAL_FREQ 1700.0f
...
...
libs/spandsp/tests/saturated_tests.c
浏览文件 @
83965199
...
...
@@ -197,17 +197,17 @@ int main(int argc, char *argv[])
exit
(
2
);
}
printf
(
"Testing 16 bit add
\n
"
);
if
(
saturated_add16
(
10000
,
10000
)
!=
20000
||
saturated_add16
(
10000
,
-
10000
)
!=
0
||
saturated_add16
(
-
10000
,
10000
)
!=
0
||
saturated_add16
(
-
10000
,
-
10000
)
!=
-
20000
||
saturated_add16
(
-
30000
,
-
30000
)
!=
INT16_MIN
||
saturated_add16
(
30000
,
30000
)
!=
INT16_MAX
)
if
(
saturated_add16
(
10000
,
10000
)
!=
20000
)
printf
(
"aaa1 %d
\n
"
,
saturated_add16
(
10000
,
10000
));
if
(
saturated_add16
(
10000
,
-
10000
)
!=
0
)
printf
(
"aaa2 %d
\n
"
,
saturated_add16
(
10000
,
-
10000
));
if
(
saturated_add16
(
-
10000
,
10000
)
!=
0
)
printf
(
"aaa3 %d
\n
"
,
saturated_add16
(
-
10000
,
10000
));
if
(
saturated_add16
(
-
10000
,
-
10000
)
!=
-
20000
)
printf
(
"aaa4 %d
\n
"
,
saturated_add16
(
-
10000
,
-
10000
));
if
(
saturated_add16
(
-
30000
,
-
30000
)
!=
INT16_MIN
)
printf
(
"aaa5 %d
\n
"
,
saturated_add16
(
-
30000
,
-
30000
));
if
(
saturated_add16
(
30000
,
30000
)
!=
INT16_MAX
)
{
printf
(
"Test failed.
\n
"
);
exit
(
2
);
...
...
@@ -292,6 +292,38 @@ int main(int argc, char *argv[])
printf
(
"Test failed.
\n
"
);
exit
(
2
);
}
printf
(
"Testing 32 + 16 x 16 => 32 bit MAC
\n
"
);
if
(
saturated_mac16_32
(
123
,
100
,
100
)
!=
123
+
20000
||
saturated_mac16_32
(
123
,
-
100
,
100
)
!=
123
-
20000
||
saturated_mac16_32
(
123
,
32767
,
-
32768
)
!=
123
-
2147418112
||
saturated_mac16_32
(
123
,
-
32768
,
32767
)
!=
123
-
2147418112
||
saturated_mac16_32
(
123
,
32767
,
32767
)
!=
123
+
2147352578
||
saturated_mac16_32
(
123
,
-
32768
,
-
32768
)
!=
INT32_MAX
)
{
printf
(
"Test failed.
\n
"
);
exit
(
2
);
}
printf
(
"Testing 32 - 16 x 16 => 32 bit MSU
\n
"
);
if
(
saturated_msu16_32
(
123
,
100
,
100
)
!=
123
-
20000
||
saturated_msu16_32
(
123
,
-
100
,
100
)
!=
123
+
20000
||
saturated_msu16_32
(
123
,
32767
,
-
32768
)
!=
123
+
2147418112
||
saturated_msu16_32
(
123
,
-
32768
,
32767
)
!=
123
+
2147418112
||
saturated_msu16_32
(
123
,
32767
,
32767
)
!=
123
-
2147352578
||
saturated_msu16_32
(
123
,
-
32768
,
-
32768
)
!=
123
-
INT32_MAX
)
{
printf
(
"Test failed.
\n
"
);
exit
(
2
);
}
printf
(
"Testing 16 bit absolute
\n
"
);
if
(
saturated_abs16
(
10000
)
!=
10000
||
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论