Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
04e93f4c
提交
04e93f4c
authored
8月 05, 2012
作者:
Steve Underwood
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix fixed point builds of spandsp, and improve logging of modem performance during tests
上级
72566f6a
隐藏空白字符变更
内嵌
并排
正在显示
11 个修改的文件
包含
187 行增加
和
197 行删除
+187
-197
v17rx.h
libs/spandsp/src/spandsp/v17rx.h
+6
-0
v22bis.h
libs/spandsp/src/spandsp/v22bis.h
+6
-0
v27ter_rx.h
libs/spandsp/src/spandsp/v27ter_rx.h
+6
-0
v29rx.h
libs/spandsp/src/spandsp/v29rx.h
+6
-0
v17rx.c
libs/spandsp/src/v17rx.c
+2
-1
modem_monitor.cpp
libs/spandsp/tests/modem_monitor.cpp
+17
-15
modem_monitor.h
libs/spandsp/tests/modem_monitor.h
+1
-1
v17_tests.c
libs/spandsp/tests/v17_tests.c
+33
-40
v22bis_tests.c
libs/spandsp/tests/v22bis_tests.c
+31
-35
v27ter_tests.c
libs/spandsp/tests/v27ter_tests.c
+47
-66
v29_tests.c
libs/spandsp/tests/v29_tests.c
+32
-39
没有找到文件。
libs/spandsp/src/spandsp/v17rx.h
浏览文件 @
04e93f4c
...
...
@@ -209,6 +209,12 @@ working only on the most optimal lines, and being widely usable across most phon
TCM absolutely transformed the phone line modem business.
*/
#if defined(SPANDSP_USE_FIXED_POINT)
#define V17_CONSTELLATION_SCALING_FACTOR 1024.0
#else
#define V17_CONSTELLATION_SCALING_FACTOR 1.0
#endif
/*!
V.17 modem receive side descriptor. This defines the working state for a
single instance of a V.17 modem receiver.
...
...
libs/spandsp/src/spandsp/v22bis.h
浏览文件 @
04e93f4c
...
...
@@ -48,6 +48,12 @@ or 1200bps if one or both ends to not acknowledge that 2400bps is OK.
#if !defined(_SPANDSP_V22BIS_H_)
#define _SPANDSP_V22BIS_H_
#if defined(SPANDSP_USE_FIXED_POINT)
#define V22BIS_CONSTELLATION_SCALING_FACTOR 1024.0
#else
#define V22BIS_CONSTELLATION_SCALING_FACTOR 1.0
#endif
enum
{
V22BIS_GUARD_TONE_NONE
,
...
...
libs/spandsp/src/spandsp/v27ter_rx.h
浏览文件 @
04e93f4c
...
...
@@ -44,6 +44,12 @@ at the start of transmission, which makes the design of a V.27ter receiver relat
straightforward.
*/
#if defined(SPANDSP_USE_FIXED_POINT)
#define V27TER_CONSTELLATION_SCALING_FACTOR 1024.0
#else
#define V27TER_CONSTELLATION_SCALING_FACTOR 1.0
#endif
/*!
V.27ter modem receive side descriptor. This defines the working state for a
single instance of a V.27ter modem receiver.
...
...
libs/spandsp/src/spandsp/v29rx.h
浏览文件 @
04e93f4c
...
...
@@ -118,6 +118,12 @@ scrambler register) cannot be trusted for the test. The receive modem,
therefore, only tests that bits starting at bit 24 are really ones.
*/
#if defined(SPANDSP_USE_FIXED_POINT)
#define V29_CONSTELLATION_SCALING_FACTOR 4096.0
#else
#define V29_CONSTELLATION_SCALING_FACTOR 1.0
#endif
#if defined(SPANDSP_USE_FIXED_POINT)
typedef
void
(
*
qam_report_handler_t
)(
void
*
user_data
,
const
complexi16_t
*
constel
,
const
complexi16_t
*
target
,
int
symbol
);
#else
...
...
libs/spandsp/src/v17rx.c
浏览文件 @
04e93f4c
...
...
@@ -202,10 +202,11 @@ SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexf_t **coeffs)
{
#if defined(SPANDSP_USE_FIXED_POINT)
*
coeffs
=
NULL
;
return
0
;
#else
*
coeffs
=
s
->
eq_coeff
;
#endif
return
V17_EQUALIZER_LEN
;
#endif
}
/*- End of function --------------------------------------------------------*/
...
...
libs/spandsp/tests/modem_monitor.cpp
浏览文件 @
04e93f4c
...
...
@@ -52,10 +52,10 @@
#define SYMBOL_TRACKER_POINTS 12000
#define CARRIER_TRACKER_POINTS 12000
#define FP_FACTOR 4096
struct
qam_monitor_s
{
float
constel_scaling
;
Fl_Double_Window
*
w
;
Fl_Group
*
c_const
;
Fl_Group
*
c_right
;
...
...
@@ -189,14 +189,14 @@ int qam_monitor_update_equalizer(qam_monitor_t *s, const complexf_t *coeffs, int
for
(
i
=
0
;
i
<
len
;
i
++
)
{
s
->
eq_re_plot
[
2
*
i
]
=
(
i
-
len
/
2
)
/
2.0
;
s
->
eq_re_plot
[
2
*
i
+
1
]
=
coeffs
[
i
].
re
;
s
->
eq_re_plot
[
2
*
i
+
1
]
=
coeffs
[
i
].
re
*
s
->
constel_scaling
;
if
(
min
>
coeffs
[
i
].
re
)
min
=
coeffs
[
i
].
re
;
if
(
max
<
coeffs
[
i
].
re
)
max
=
coeffs
[
i
].
re
;
s
->
eq_im_plot
[
2
*
i
]
=
(
i
-
len
/
2
)
/
2.0
;
s
->
eq_im_plot
[
2
*
i
+
1
]
=
coeffs
[
i
].
im
;
s
->
eq_im_plot
[
2
*
i
+
1
]
=
coeffs
[
i
].
im
*
s
->
constel_scaling
;
if
(
min
>
coeffs
[
i
].
im
)
min
=
coeffs
[
i
].
im
;
if
(
max
<
coeffs
[
i
].
im
)
...
...
@@ -235,22 +235,22 @@ int qam_monitor_update_int_equalizer(qam_monitor_t *s, const complexi16_t *coeff
max
=
coeffs
[
i
].
im
;
for
(
i
=
0
;
i
<
len
;
i
++
)
{
s
->
eq_re_plot
[
2
*
i
]
=
(
i
-
len
/
2
)
/
2.0
f
;
s
->
eq_re_plot
[
2
*
i
+
1
]
=
coeffs
[
i
].
re
/
(
float
)
FP_FACTOR
;
if
(
min
>
coeffs
[
i
].
re
)
min
=
coeffs
[
i
].
re
;
if
(
max
<
coeffs
[
i
].
re
)
max
=
coeffs
[
i
].
re
;
s
->
eq_re_plot
[
2
*
i
]
=
(
i
-
len
/
2
)
/
2.0
f
;
s
->
eq_re_plot
[
2
*
i
+
1
]
=
coeffs
[
i
].
re
*
s
->
constel_scaling
;
s
->
eq_im_plot
[
2
*
i
]
=
(
i
-
len
/
2
)
/
2.0
f
;
s
->
eq_im_plot
[
2
*
i
+
1
]
=
coeffs
[
i
].
im
/
(
float
)
FP_FACTOR
;
if
(
min
>
coeffs
[
i
].
im
)
min
=
coeffs
[
i
].
im
;
if
(
max
<
coeffs
[
i
].
im
)
max
=
coeffs
[
i
].
im
;
s
->
eq_im_plot
[
2
*
i
]
=
(
i
-
len
/
2
)
/
2.0
f
;
s
->
eq_im_plot
[
2
*
i
+
1
]
=
coeffs
[
i
].
im
*
s
->
constel_scaling
;
}
min
/=
(
float
)
FP_FACTOR
;
max
/=
(
float
)
FP_FACTOR
;
min
*=
s
->
constel_scaling
;
max
*=
s
->
constel_scaling
;
s
->
eq_x
->
minimum
(
-
len
/
4.0
);
s
->
eq_x
->
maximum
(
len
/
4.0
);
...
...
@@ -286,21 +286,21 @@ int qam_monitor_update_symbol_tracking(qam_monitor_t *s, float total_correction)
max
=
s
->
symbol_tracker
[
0
];
for
(
i
=
s
->
symbol_track_ptr
,
j
=
0
;
i
<
s
->
symbol_track_points
;
i
++
,
j
++
)
{
s
->
symbol_track_plot
[
2
*
j
]
=
j
;
s
->
symbol_track_plot
[
2
*
j
+
1
]
=
s
->
symbol_tracker
[
i
];
if
(
min
>
s
->
symbol_tracker
[
i
])
min
=
s
->
symbol_tracker
[
i
];
if
(
max
<
s
->
symbol_tracker
[
i
])
max
=
s
->
symbol_tracker
[
i
];
s
->
symbol_track_plot
[
2
*
j
]
=
j
;
s
->
symbol_track_plot
[
2
*
j
+
1
]
=
s
->
symbol_tracker
[
i
];
}
for
(
i
=
0
;
i
<
s
->
symbol_track_ptr
;
i
++
,
j
++
)
{
s
->
symbol_track_plot
[
2
*
j
]
=
j
;
s
->
symbol_track_plot
[
2
*
j
+
1
]
=
s
->
symbol_tracker
[
i
];
if
(
min
>
s
->
symbol_tracker
[
i
])
min
=
s
->
symbol_tracker
[
i
];
if
(
max
<
s
->
symbol_tracker
[
i
])
max
=
s
->
symbol_tracker
[
i
];
s
->
symbol_track_plot
[
2
*
j
]
=
j
;
s
->
symbol_track_plot
[
2
*
j
+
1
]
=
s
->
symbol_tracker
[
i
];
}
s
->
symbol_track_y
->
maximum
((
fabs
(
max
-
min
)
<
0.05
)
?
max
+
0.05
:
max
);
s
->
symbol_track_y
->
minimum
(
min
);
...
...
@@ -379,7 +379,7 @@ int qam_monitor_update_carrier_tracking(qam_monitor_t *s, float carrier_freq)
}
/*- End of function --------------------------------------------------------*/
qam_monitor_t
*
qam_monitor_init
(
float
constel_width
,
const
char
*
tag
)
qam_monitor_t
*
qam_monitor_init
(
float
constel_width
,
float
constel_scaling
,
const
char
*
tag
)
{
char
buf
[
132
+
1
];
float
x
;
...
...
@@ -391,6 +391,8 @@ qam_monitor_t *qam_monitor_init(float constel_width, const char *tag)
s
->
w
=
new
Fl_Double_Window
(
905
,
400
,
(
tag
)
?
tag
:
"QAM monitor"
);
s
->
constel_scaling
=
1.0
/
constel_scaling
;
s
->
c_const
=
new
Fl_Group
(
0
,
0
,
380
,
400
);
s
->
c_const
->
box
(
FL_DOWN_BOX
);
s
->
c_const
->
align
(
FL_ALIGN_TOP
|
FL_ALIGN_INSIDE
);
...
...
libs/spandsp/tests/modem_monitor.h
浏览文件 @
04e93f4c
...
...
@@ -50,7 +50,7 @@ extern "C"
{
#endif
qam_monitor_t
*
qam_monitor_init
(
float
constel_width
,
const
char
*
tag
);
qam_monitor_t
*
qam_monitor_init
(
float
constel_width
,
float
constel_scaling
,
const
char
*
tag
);
int
qam_monitor_clear_constel
(
qam_monitor_t
*
s
);
int
qam_monitor_update_constel
(
qam_monitor_t
*
s
,
const
complexf_t
*
pt
);
int
qam_monitor_update_equalizer
(
qam_monitor_t
*
s
,
const
complexf_t
*
coeffs
,
int
len
);
...
...
libs/spandsp/tests/v17_tests.c
浏览文件 @
04e93f4c
...
...
@@ -133,14 +133,17 @@ static void v17_rx_status(void *user_data, int status)
switch
(
status
)
{
case
SIG_STATUS_TRAINING_SUCCEEDED
:
len
=
v17_rx_equalizer_state
(
s
,
&
coeffs
);
printf
(
"Equalizer:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
printf
(
"Training succeeded
\n
"
);
if
((
len
=
v17_rx_equalizer_state
(
s
,
&
coeffs
)))
{
printf
(
"Equalizer:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
#if defined(SPANDSP_USE_FIXED_POINT)
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
4096
.
0
f
,
coeffs
[
i
].
im
/
4096
.
0
f
);
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
V17_CONSTELLATION_SCALING_FACTOR
,
coeffs
[
i
].
im
/
V17_CONSTELLATION_SCALING_FACTOR
);
#else
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
#endif
}
break
;
}
}
...
...
@@ -183,10 +186,11 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
int
len
;
#if defined(SPANDSP_USE_FIXED_POINT)
complexi16_t
*
coeffs
;
complexf_t
constel_point
;
#else
complexf_t
*
coeffs
;
#endif
complexf_t
constel_point
;
complexf_t
target_point
;
float
fpower
;
v17_rx_state_t
*
rx
;
static
float
smooth_power
=
0
.
0
f
;
...
...
@@ -195,67 +199,56 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
rx
=
(
v17_rx_state_t
*
)
user_data
;
if
(
constel
)
{
fpower
=
(
constel
->
re
-
target
->
re
)
*
(
constel
->
re
-
target
->
re
)
+
(
constel
->
im
-
target
->
im
)
*
(
constel
->
im
-
target
->
im
);
#if defined(SPANDSP_USE_FIXED_POINT)
fpower
/=
4096
.
0
*
4096
.
0
;
#endif
constel_point
.
re
=
constel
->
re
/
V17_CONSTELLATION_SCALING_FACTOR
;
constel_point
.
im
=
constel
->
im
/
V17_CONSTELLATION_SCALING_FACTOR
;
target_point
.
re
=
target
->
re
/
V17_CONSTELLATION_SCALING_FACTOR
,
target_point
.
im
=
target
->
im
/
V17_CONSTELLATION_SCALING_FACTOR
,
fpower
=
(
constel_point
.
re
-
target_point
.
re
)
*
(
constel_point
.
re
-
target_point
.
re
)
+
(
constel_point
.
im
-
target_point
.
im
)
*
(
constel_point
.
im
-
target_point
.
im
);
smooth_power
=
0
.
95
f
*
smooth_power
+
0
.
05
f
*
fpower
;
#if defined(ENABLE_GUI)
if
(
use_gui
)
{
#if defined(SPANDSP_USE_FIXED_POINT)
constel_point
.
re
=
constel
->
re
/
4096
.
0
;
constel_point
.
im
=
constel
->
im
/
4096
.
0
;
qam_monitor_update_constel
(
qam_monitor
,
&
constel_point
);
#else
qam_monitor_update_constel
(
qam_monitor
,
constel
);
#endif
qam_monitor_update_carrier_tracking
(
qam_monitor
,
v17_rx_carrier_frequency
(
rx
));
qam_monitor_update_symbol_tracking
(
qam_monitor
,
v17_rx_symbol_timing_correction
(
rx
));
}
#endif
printf
(
"%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f
\n
"
,
symbol_no
,
#if defined(SPANDSP_USE_FIXED_POINT)
constel
->
re
/
4096
.
0
,
constel
->
im
/
4096
.
0
,
target
->
re
/
4096
.
0
,
target
->
im
/
4096
.
0
,
#else
constel
->
re
,
constel
->
im
,
target
->
re
,
target
->
im
,
#endif
constel_point
.
re
,
constel_point
.
im
,
target_point
.
re
,
target_point
.
im
,
symbol
,
fpower
,
smooth_power
,
v17_rx_carrier_frequency
(
rx
),
v17_rx_signal_power
(
rx
),
v17_rx_symbol_timing_correction
(
rx
));
//printf("Carrier %d %f %f\n", symbol_no, v17_rx_carrier_frequency(rx), v17_rx_symbol_timing_correction(rx));
symbol_no
++
;
if
(
--
update_interval
<=
0
)
{
len
=
v17_rx_equalizer_state
(
rx
,
&
coeffs
);
printf
(
"Equalizer A:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
if
((
len
=
v17_rx_equalizer_state
(
rx
,
&
coeffs
)))
{
printf
(
"Equalizer A:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
#if defined(SPANDSP_USE_FIXED_POINT)
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
4096
.
0
f
,
coeffs
[
i
].
im
/
4096
.
0
f
);
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
V17_CONSTELLATION_SCALING_FACTOR
,
coeffs
[
i
].
im
/
V17_CONSTELLATION_SCALING_FACTOR
);
#else
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
#endif
#if defined(ENABLE_GUI)
if
(
use_gui
)
{
if
(
use_gui
)
{
#if defined(SPANDSP_USE_FIXED_POINT)
qam_monitor_update_int_equalizer
(
qam_monitor
,
coeffs
,
len
);
qam_monitor_update_int_equalizer
(
qam_monitor
,
coeffs
,
len
);
#else
qam_monitor_update_equalizer
(
qam_monitor
,
coeffs
,
len
);
qam_monitor_update_equalizer
(
qam_monitor
,
coeffs
,
len
);
#endif
}
}
#endif
}
update_interval
=
100
;
}
}
...
...
@@ -481,7 +474,7 @@ int main(int argc, char *argv[])
#if defined(ENABLE_GUI)
if
(
use_gui
)
{
qam_monitor
=
qam_monitor_init
(
10
.
0
f
,
NULL
);
qam_monitor
=
qam_monitor_init
(
10
.
0
f
,
V17_CONSTELLATION_SCALING_FACTOR
,
NULL
);
if
(
!
decode_test_file
)
{
start_line_model_monitor
(
129
);
...
...
libs/spandsp/tests/v22bis_tests.c
浏览文件 @
04e93f4c
...
...
@@ -129,14 +129,16 @@ static void v22bis_rx_status(void *user_data, int status)
case
SIG_STATUS_TRAINING_SUCCEEDED
:
bit_rate
=
v22bis_get_current_bit_rate
(
s
->
v22bis
);
printf
(
"Negotiated bit rate: %d
\n
"
,
bit_rate
);
len
=
v22bis_rx_equalizer_state
(
s
->
v22bis
,
&
coeffs
);
printf
(
"Equalizer:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
if
((
len
=
v22bis_rx_equalizer_state
(
s
->
v22bis
,
&
coeffs
)))
{
printf
(
"Equalizer:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
#if defined(SPANDSP_USE_FIXED_POINT)
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
1024
.
0
f
,
coeffs
[
i
].
im
/
1024
.
0
f
);
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
V22BIS_CONSTELLATION_SCALING_FACTOR
,
coeffs
[
i
].
im
/
V22BIS_CONSTELLATION_SCALING_FACTOR
);
#else
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
#endif
}
break
;
}
}
...
...
@@ -181,26 +183,25 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
int
len
;
#if defined(SPANDSP_USE_FIXED_POINT)
complexi16_t
*
coeffs
;
complexf_t
constel_point
;
#else
complexf_t
*
coeffs
;
#endif
complexf_t
constel_point
;
complexf_t
target_point
;
float
fpower
;
endpoint_t
*
s
;
s
=
(
endpoint_t
*
)
user_data
;
if
(
constel
)
{
constel_point
.
re
=
constel
->
re
/
V22BIS_CONSTELLATION_SCALING_FACTOR
;
constel_point
.
im
=
constel
->
im
/
V22BIS_CONSTELLATION_SCALING_FACTOR
;
target_point
.
re
=
target
->
re
/
V22BIS_CONSTELLATION_SCALING_FACTOR
;
target_point
.
im
=
target
->
im
/
V22BIS_CONSTELLATION_SCALING_FACTOR
;
#if defined(ENABLE_GUI)
if
(
use_gui
)
{
#if defined(SPANDSP_USE_FIXED_POINT)
constel_point
.
re
=
constel
->
re
/
1024
.
0
;
constel_point
.
im
=
constel
->
im
/
1024
.
0
;
qam_monitor_update_constel
(
s
->
qam_monitor
,
&
constel_point
);
#else
qam_monitor_update_constel
(
s
->
qam_monitor
,
constel
);
#endif
qam_monitor_update_carrier_tracking
(
s
->
qam_monitor
,
v22bis_rx_carrier_frequency
(
s
->
v22bis
));
qam_monitor_update_symbol_tracking
(
s
->
qam_monitor
,
v22bis_rx_symbol_timing_correction
(
s
->
v22bis
));
}
...
...
@@ -211,17 +212,10 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
printf
(
"%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %8.4f
\n
"
,
s
->
symbol_no
,
#if defined(SPANDSP_USE_FIXED_POINT)
constel
->
re
/
1024
.
0
,
constel
->
im
/
1024
.
0
,
target
->
re
/
1024
.
0
,
target
->
im
/
1024
.
0
,
#else
constel
->
re
,
constel
->
im
,
target
->
re
,
target
->
im
,
#endif
constel_point
.
re
,
constel_point
.
im
,
target_point
.
re
,
target_point
.
im
,
symbol
,
fpower
,
s
->
smooth_power
,
...
...
@@ -231,24 +225,26 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
else
{
printf
(
"Gardner step %d
\n
"
,
symbol
);
len
=
v22bis_rx_equalizer_state
(
s
->
v22bis
,
&
coeffs
);
printf
(
"Equalizer A:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
if
((
len
=
v22bis_rx_equalizer_state
(
s
->
v22bis
,
&
coeffs
)))
{
printf
(
"Equalizer A:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
#if defined(SPANDSP_USE_FIXED_POINT)
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
1024
.
0
f
,
coeffs
[
i
].
im
/
1024
.
0
f
);
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
V22BIS_CONSTELLATION_SCALING_FACTOR
,
coeffs
[
i
].
im
/
V22BIS_CONSTELLATION_SCALING_FACTOR
);
#else
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
#endif
#if defined(ENABLE_GUI)
if
(
use_gui
)
{
if
(
use_gui
)
{
#if defined(SPANDSP_USE_FIXED_POINT)
qam_monitor_update_int_equalizer
(
s
->
qam_monitor
,
coeffs
,
len
);
qam_monitor_update_int_equalizer
(
s
->
qam_monitor
,
coeffs
,
len
);
#else
qam_monitor_update_equalizer
(
s
->
qam_monitor
,
coeffs
,
len
);
qam_monitor_update_equalizer
(
s
->
qam_monitor
,
coeffs
,
len
);
#endif
}
}
#endif
}
}
}
/*- End of function --------------------------------------------------------*/
...
...
@@ -381,8 +377,8 @@ int main(int argc, char *argv[])
#if defined(ENABLE_GUI)
if
(
use_gui
)
{
endpoint
[
0
].
qam_monitor
=
qam_monitor_init
(
6
.
0
f
,
"Calling modem"
);
endpoint
[
1
].
qam_monitor
=
qam_monitor_init
(
6
.
0
f
,
"Answering modem"
);
endpoint
[
0
].
qam_monitor
=
qam_monitor_init
(
6
.
0
f
,
V22BIS_CONSTELLATION_SCALING_FACTOR
,
"Calling modem"
);
endpoint
[
1
].
qam_monitor
=
qam_monitor_init
(
6
.
0
f
,
V22BIS_CONSTELLATION_SCALING_FACTOR
,
"Answering modem"
);
}
#endif
if
((
model
=
both_ways_line_model_init
(
line_model_no
,
...
...
libs/spandsp/tests/v27ter_tests.c
浏览文件 @
04e93f4c
...
...
@@ -129,14 +129,16 @@ static void v27ter_rx_status(void *user_data, int status)
switch
(
status
)
{
case
SIG_STATUS_TRAINING_SUCCEEDED
:
len
=
v27ter_rx_equalizer_state
(
s
,
&
coeffs
);
printf
(
"Equalizer:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
if
((
len
=
v27ter_rx_equalizer_state
(
s
,
&
coeffs
)))
{
printf
(
"Equalizer:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
#if defined(SPANDSP_USE_FIXED_POINT)
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
4096
.
0
f
,
coeffs
[
i
].
im
/
4096
.
0
f
);
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
V27TER_CONSTELLATION_SCALING_FACTOR
,
coeffs
[
i
].
im
/
V27TER_CONSTELLATION_SCALING_FACTOR
);
#else
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
#endif
}
break
;
}
}
...
...
@@ -179,115 +181,94 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
int
len
;
#if defined(SPANDSP_USE_FIXED_POINT)
complexi16_t
*
coeffs
;
complexf_t
constel_point
;
#else
complexf_t
*
coeffs
;
#endif
complexf_t
constel_point
;
complexf_t
target_point
;
float
fpower
;
float
error
;
v27ter_rx_state_t
*
rx
;
static
float
smooth_power
=
0
.
0
f
;
#if defined(ENABLE_GUI)
static
int
reports
=
0
;
#endif
static
int
update_interval
=
100
;
rx
=
(
v27ter_rx_state_t
*
)
user_data
;
if
(
constel
)
{
fpower
=
(
constel
->
re
-
target
->
re
)
*
(
constel
->
re
-
target
->
re
)
+
(
constel
->
im
-
target
->
im
)
*
(
constel
->
im
-
target
->
im
);
#if defined(SPANDSP_USE_FIXED_POINT)
fpower
/=
1024
.
0
*
1024
.
0
;
#endif
constel_point
.
re
=
constel
->
re
/
V27TER_CONSTELLATION_SCALING_FACTOR
;
constel_point
.
im
=
constel
->
im
/
V27TER_CONSTELLATION_SCALING_FACTOR
;
target_point
.
re
=
target
->
re
/
V27TER_CONSTELLATION_SCALING_FACTOR
;
target_point
.
im
=
target
->
im
/
V27TER_CONSTELLATION_SCALING_FACTOR
;
fpower
=
(
constel_point
.
re
-
target_point
.
re
)
*
(
constel_point
.
re
-
target_point
.
re
)
+
(
constel_point
.
im
-
target_point
.
im
)
*
(
constel_point
.
im
-
target_point
.
im
);
smooth_power
=
0
.
95
f
*
smooth_power
+
0
.
05
f
*
fpower
;
#if defined(ENABLE_GUI)
if
(
use_gui
)
{
#if defined(SPANDSP_USE_FIXED_POINT)
constel_point
.
re
=
constel
->
re
/
1024
.
0
;
constel_point
.
im
=
constel
->
im
/
1024
.
0
;
qam_monitor_update_constel
(
qam_monitor
,
&
constel_point
);
#else
qam_monitor_update_constel
(
qam_monitor
,
constel
);
#endif
qam_monitor_update_carrier_tracking
(
qam_monitor
,
v27ter_rx_carrier_frequency
(
rx
));
qam_monitor_update_symbol_tracking
(
qam_monitor
,
v27ter_rx_symbol_timing_correction
(
rx
));
}
#endif
error
=
constel
->
im
*
target
->
re
-
constel
->
re
*
target
->
im
;
#if defined(SPANDSP_USE_FIXED_POINT)
printf
(
"Tracking error %f %f %f %f %f %f
\n
"
,
error
,
v27ter_rx_carrier_frequency
(
rx
),
constel
->
re
/
1024
.
0
,
constel
->
im
/
1024
.
0
,
target
->
re
/
1024
.
0
,
target
->
im
/
1024
.
0
);
#else
printf
(
"Tracking error %f %f %f %f %f %f
\n
"
,
error
,
v27ter_rx_carrier_frequency
(
rx
),
constel
->
re
,
constel
->
im
,
target
->
re
,
target
->
im
);
#endif
printf
(
"Tracking error %f %f %f %f %f %f
\n
"
,
error
,
v27ter_rx_carrier_frequency
(
rx
),
constel_point
.
re
,
constel_point
.
im
,
target_point
.
re
,
target_point
.
im
);
printf
(
"%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f
\n
"
,
symbol_no
,
#if defined(SPANDSP_USE_FIXED_POINT)
constel
->
re
/
1024
.
0
,
constel
->
im
/
1024
.
0
,
target
->
re
/
1024
.
0
,
target
->
im
/
1024
.
0
,
#else
constel
->
re
,
constel
->
im
,
target
->
re
,
target
->
im
,
#endif
constel_point
.
re
,
constel_point
.
im
,
target_point
.
re
,
target_point
.
im
,
symbol
,
fpower
,
smooth_power
,
v27ter_rx_carrier_frequency
(
rx
),
v27ter_rx_signal_power
(
rx
),
v27ter_rx_symbol_timing_correction
(
rx
));
len
=
v27ter_rx_equalizer_state
(
rx
,
&
coeffs
);
printf
(
"Equalizer B:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
#if defined(SPANDSP_USE_FIXED_POINT)
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
1024
.
0
f
,
coeffs
[
i
].
im
/
1024
.
0
f
);
#else
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
#endif
#if defined(WITH_SPANDSP_INTERNALS)
printf
(
"Gardtest %d %f %d
\n
"
,
symbol_no
,
v27ter_rx_symbol_timing_correction
(
rx
),
rx
->
gardner_integrate
);
#endif
printf
(
"Carcar %d %f
\n
"
,
symbol_no
,
v27ter_rx_carrier_frequency
(
rx
));
#if defined(ENABLE_GUI)
if
(
use_gui
)
symbol_no
++
;
if
(
--
update_interval
<=
0
)
{
if
(
++
reports
>=
1000
)
if
(
(
len
=
v27ter_rx_equalizer_state
(
rx
,
&
coeffs
))
)
{
printf
(
"Equalizer B:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
V27TER_CONSTELLATION_SCALING_FACTOR
,
coeffs
[
i
].
im
/
V27TER_CONSTELLATION_SCALING_FACTOR
);
#if defined(ENABLE_GUI)
if
(
use_gui
)
{
#if defined(SPANDSP_USE_FIXED_POINT)
qam_monitor_update_int_equalizer
(
qam_monitor
,
coeffs
,
len
);
qam_monitor_update_int_equalizer
(
qam_monitor
,
coeffs
,
len
);
#else
qam_monitor_update_equalizer
(
qam_monitor
,
coeffs
,
len
);
qam_monitor_update_equalizer
(
qam_monitor
,
coeffs
,
len
);
#endif
reports
=
0
;
}
}
update_interval
=
100
;
}
#endif
symbol_no
++
;
}
else
{
printf
(
"Gardner step %d
\n
"
,
symbol
);
len
=
v27ter_rx_equalizer_state
(
rx
,
&
coeffs
);
printf
(
"Equalizer A:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
if
((
len
=
v27ter_rx_equalizer_state
(
rx
,
&
coeffs
)))
{
printf
(
"Equalizer A:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
#if defined(SPANDSP_USE_FIXED_POINT)
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
1024
.
0
f
,
coeffs
[
i
].
im
/
1024
.
0
f
);
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
V27TER_CONSTELLATION_SCALING_FACTOR
,
coeffs
[
i
].
im
/
V27TER_CONSTELLATION_SCALING_FACTOR
);
#else
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
#endif
#if defined(ENABLE_GUI)
if
(
use_gui
)
{
if
(
use_gui
)
{
#if defined(SPANDSP_USE_FIXED_POINT)
qam_monitor_update_int_equalizer
(
qam_monitor
,
coeffs
,
len
);
qam_monitor_update_int_equalizer
(
qam_monitor
,
coeffs
,
len
);
#else
qam_monitor_update_equalizer
(
qam_monitor
,
coeffs
,
len
);
qam_monitor_update_equalizer
(
qam_monitor
,
coeffs
,
len
);
#endif
}
}
#endif
}
}
}
/*- End of function --------------------------------------------------------*/
...
...
@@ -497,7 +478,7 @@ int main(int argc, char *argv[])
#if defined(ENABLE_GUI)
if
(
use_gui
)
{
qam_monitor
=
qam_monitor_init
(
2
.
0
f
,
NULL
);
qam_monitor
=
qam_monitor_init
(
2
.
0
f
,
V27TER_CONSTELLATION_SCALING_FACTOR
,
NULL
);
if
(
!
decode_test_file
)
{
start_line_model_monitor
(
129
);
...
...
libs/spandsp/tests/v29_tests.c
浏览文件 @
04e93f4c
...
...
@@ -129,14 +129,16 @@ static void v29_rx_status(void *user_data, int status)
{
case
SIG_STATUS_TRAINING_SUCCEEDED
:
printf
(
"Training succeeded
\n
"
);
len
=
v29_rx_equalizer_state
(
s
,
&
coeffs
);
printf
(
"Equalizer:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
if
((
len
=
v29_rx_equalizer_state
(
s
,
&
coeffs
)))
{
printf
(
"Equalizer:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
#if defined(SPANDSP_USE_FIXED_POINT)
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
4096
.
0
f
,
coeffs
[
i
].
im
/
4096
.
0
f
);
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
V29_CONSTELLATION_SCALING_FACTOR
,
coeffs
[
i
].
im
/
V29_CONSTELLATION_SCALING_FACTOR
);
#else
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
#endif
}
break
;
}
}
...
...
@@ -179,10 +181,11 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
int
len
;
#if defined(SPANDSP_USE_FIXED_POINT)
complexi16_t
*
coeffs
;
complexf_t
constel_point
;
#else
complexf_t
*
coeffs
;
#endif
complexf_t
constel_point
;
complexf_t
target_point
;
float
fpower
;
v29_rx_state_t
*
rx
;
static
float
smooth_power
=
0
.
0
f
;
...
...
@@ -191,22 +194,17 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
rx
=
(
v29_rx_state_t
*
)
user_data
;
if
(
constel
)
{
fpower
=
(
constel
->
re
-
target
->
re
)
*
(
constel
->
re
-
target
->
re
)
+
(
constel
->
im
-
target
->
im
)
*
(
constel
->
im
-
target
->
im
);
#if defined(SPANDSP_USE_FIXED_POINT)
fpower
/=
4096
.
0
*
4096
.
0
;
#endif
constel_point
.
re
=
constel
->
re
/
V29_CONSTELLATION_SCALING_FACTOR
;
constel_point
.
im
=
constel
->
im
/
V29_CONSTELLATION_SCALING_FACTOR
;
target_point
.
re
=
target
->
re
/
V29_CONSTELLATION_SCALING_FACTOR
,
target_point
.
im
=
target
->
im
/
V29_CONSTELLATION_SCALING_FACTOR
,
fpower
=
(
constel_point
.
re
-
target_point
.
re
)
*
(
constel_point
.
re
-
target_point
.
re
)
+
(
constel_point
.
im
-
target_point
.
im
)
*
(
constel_point
.
im
-
target_point
.
im
);
smooth_power
=
0
.
95
f
*
smooth_power
+
0
.
05
f
*
fpower
;
#if defined(ENABLE_GUI)
if
(
use_gui
)
{
#if defined(SPANDSP_USE_FIXED_POINT)
constel_point
.
re
=
constel
->
re
/
4096
.
0
;
constel_point
.
im
=
constel
->
im
/
4096
.
0
;
qam_monitor_update_constel
(
qam_monitor
,
&
constel_point
);
#else
qam_monitor_update_constel
(
qam_monitor
,
constel
);
#endif
qam_monitor_update_carrier_tracking
(
qam_monitor
,
v29_rx_carrier_frequency
(
rx
));
//qam_monitor_update_carrier_tracking(qam_monitor, (fpower) ? fpower : 0.001f);
qam_monitor_update_symbol_tracking
(
qam_monitor
,
v29_rx_symbol_timing_correction
(
rx
));
...
...
@@ -214,17 +212,10 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
#endif
printf
(
"%8d [%8.4f, %8.4f] [%8.4f, %8.4f] %2x %8.4f %8.4f %9.4f %7.3f %7.4f
\n
"
,
symbol_no
,
#if defined(SPANDSP_USE_FIXED_POINT)
constel
->
re
/
4096
.
0
,
constel
->
im
/
4096
.
0
,
target
->
re
/
4096
.
0
,
target
->
im
/
4096
.
0
,
#else
constel
->
re
,
constel
->
im
,
target
->
re
,
target
->
im
,
#endif
constel_point
.
re
,
constel_point
.
im
,
target_point
.
re
,
target_point
.
im
,
symbol
,
fpower
,
smooth_power
,
...
...
@@ -234,24 +225,26 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex
symbol_no
++
;
if
(
--
update_interval
<=
0
)
{
len
=
v29_rx_equalizer_state
(
rx
,
&
coeffs
);
printf
(
"Equalizer A:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
if
((
len
=
v29_rx_equalizer_state
(
rx
,
&
coeffs
)))
{
printf
(
"Equalizer A:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
#if defined(SPANDSP_USE_FIXED_POINT)
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
4096
.
0
f
,
coeffs
[
i
].
im
/
4096
.
0
f
);
printf
(
"%3d (%15.5f, %15.5f)
\n
"
,
i
,
coeffs
[
i
].
re
/
V29_CONSTELLATION_SCALING_FACTOR
,
coeffs
[
i
].
im
/
V29_CONSTELLATION_SCALING_FACTOR
);
#else
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
printf
(
"%3d (%15.5f, %15.5f) -> %15.5f
\n
"
,
i
,
coeffs
[
i
].
re
,
coeffs
[
i
].
im
,
powerf
(
&
coeffs
[
i
]));
#endif
#if defined(ENABLE_GUI)
if
(
use_gui
)
{
if
(
use_gui
)
{
#if defined(SPANDSP_USE_FIXED_POINT)
qam_monitor_update_int_equalizer
(
qam_monitor
,
coeffs
,
len
);
qam_monitor_update_int_equalizer
(
qam_monitor
,
coeffs
,
len
);
#else
qam_monitor_update_equalizer
(
qam_monitor
,
coeffs
,
len
);
qam_monitor_update_equalizer
(
qam_monitor
,
coeffs
,
len
);
#endif
}
}
#endif
}
update_interval
=
100
;
}
}
...
...
@@ -470,7 +463,7 @@ int main(int argc, char *argv[])
#if defined(ENABLE_GUI)
if
(
use_gui
)
{
qam_monitor
=
qam_monitor_init
(
6
.
0
f
,
NULL
);
qam_monitor
=
qam_monitor_init
(
6
.
0
f
,
V29_CONSTELLATION_SCALING_FACTOR
,
NULL
);
if
(
!
decode_test_file
)
{
start_line_model_monitor
(
129
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论