Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
abd03cee
提交
abd03cee
authored
4月 21, 2013
作者:
Steve Underwood
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tweaks to the V.17 modem
上级
df4d264a
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
22 行增加
和
27 行删除
+22
-27
v17rx.c
libs/spandsp/src/v17rx.c
+22
-27
没有找到文件。
libs/spandsp/src/v17rx.c
浏览文件 @
abd03cee
...
@@ -330,7 +330,7 @@ static __inline__ void track_carrier(v17_rx_state_t *s, const complexf_t *z, con
...
@@ -330,7 +330,7 @@ static __inline__ void track_carrier(v17_rx_state_t *s, const complexf_t *z, con
positions is proportional to the phase error, for any particular target. However, the
positions is proportional to the phase error, for any particular target. However, the
different amplitudes of the various target positions scale things. */
different amplitudes of the various target positions scale things. */
#if defined(SPANDSP_USE_FIXED_POINTx)
#if defined(SPANDSP_USE_FIXED_POINTx)
error
=
z
->
im
*
(
target
->
re
>>
FP_SHIFT_FACTOR
)
-
z
->
re
*
(
target
->
im
>>
FP_SHIFT_FACTOR
);
error
=
z
->
im
*
(
((
int32_t
)
target
->
re
)
>>
FP_SHIFT_FACTOR
)
-
z
->
re
*
(((
int32_t
)
target
->
im
)
>>
FP_SHIFT_FACTOR
);
s
->
carrier_phase_rate
+=
((
s
->
carrier_track_i
*
error
)
>>
FP_SHIFT_FACTOR
);
s
->
carrier_phase_rate
+=
((
s
->
carrier_track_i
*
error
)
>>
FP_SHIFT_FACTOR
);
s
->
carrier_phase
+=
((
s
->
carrier_track_p
*
error
)
>>
FP_SHIFT_FACTOR
);
s
->
carrier_phase
+=
((
s
->
carrier_track_p
*
error
)
>>
FP_SHIFT_FACTOR
);
#else
#else
...
@@ -363,9 +363,9 @@ static __inline__ void put_bit(v17_rx_state_t *s, int bit)
...
@@ -363,9 +363,9 @@ static __inline__ void put_bit(v17_rx_state_t *s, int bit)
/* We need to strip the last part of the training - the test period of all 1s -
/* We need to strip the last part of the training - the test period of all 1s -
before we let data go to the application. */
before we let data go to the application. */
out_bit
=
descramble
(
s
,
bit
);
if
(
s
->
training_stage
==
TRAINING_STAGE_NORMAL_OPERATION
)
if
(
s
->
training_stage
==
TRAINING_STAGE_NORMAL_OPERATION
)
{
{
out_bit
=
descramble
(
s
,
bit
);
s
->
put_bit
(
s
->
put_bit_user_data
,
out_bit
);
s
->
put_bit
(
s
->
put_bit_user_data
,
out_bit
);
}
}
else
if
(
s
->
training_stage
==
TRAINING_STAGE_TEST_ONES
)
else
if
(
s
->
training_stage
==
TRAINING_STAGE_TEST_ONES
)
...
@@ -373,16 +373,15 @@ static __inline__ void put_bit(v17_rx_state_t *s, int bit)
...
@@ -373,16 +373,15 @@ static __inline__ void put_bit(v17_rx_state_t *s, int bit)
/* The bits during the final stage of training should be all ones. However,
/* The bits during the final stage of training should be all ones. However,
buggy modems mean you cannot rely on this. Therefore we don't bother
buggy modems mean you cannot rely on this. Therefore we don't bother
testing for ones, but just rely on a constellation mismatch measurement. */
testing for ones, but just rely on a constellation mismatch measurement. */
out_bit
=
descramble
(
s
,
bit
);
//span_log(&s->logging, SPAN_LOG_FLOW, "A 1 is really %d\n", out_bit);
//span_log(&s->logging, SPAN_LOG_FLOW, "A 1 is really %d\n", out_bit);
}
}
}
}
/*- End of function --------------------------------------------------------*/
/*- End of function --------------------------------------------------------*/
#if defined(SPANDSP_USE_FIXED_POINTx)
#if defined(SPANDSP_USE_FIXED_POINTx)
static
__inline__
uint32_t
dist_sq
(
const
complexi
32_t
*
x
,
const
complexi32
_t
*
y
)
static
__inline__
uint32_t
dist_sq
(
const
complexi
16_t
*
x
,
const
complexi16
_t
*
y
)
{
{
return
(
x
->
re
-
y
->
re
)
*
(
x
->
re
-
y
->
re
)
+
(
x
->
im
-
y
->
im
)
*
(
x
->
im
-
y
->
im
);
return
(
int32_t
)
(
x
->
re
-
y
->
re
)
*
(
x
->
re
-
y
->
re
)
+
(
int32_t
)
(
x
->
im
-
y
->
im
)
*
(
x
->
im
-
y
->
im
);
}
}
/*- End of function --------------------------------------------------------*/
/*- End of function --------------------------------------------------------*/
#else
#else
...
@@ -446,11 +445,11 @@ static int decode_baud(v17_rx_state_t *s, complexf_t *z)
...
@@ -446,11 +445,11 @@ static int decode_baud(v17_rx_state_t *s, complexf_t *z)
#endif
#endif
#if defined(SPANDSP_USE_FIXED_POINTx)
#if defined(SPANDSP_USE_FIXED_POINTx)
re
=
(
z
->
re
+
9
*
FP_FACTOR
)
>>
(
FP
_SHIFT_FACTOR
-
1
);
re
=
(
z
->
re
+
FP_CONSTELLATION_SCALE
(
9
.
0
f
))
>>
(
FP_CONSTELLATION
_SHIFT_FACTOR
-
1
);
im
=
(
z
->
im
+
9
*
FP_FACTOR
)
>>
(
FP
_SHIFT_FACTOR
-
1
);
im
=
(
z
->
im
+
FP_CONSTELLATION_SCALE
(
9
.
0
f
))
>>
(
FP_CONSTELLATION
_SHIFT_FACTOR
-
1
);
#else
#else
re
=
(
int
)
((
z
->
re
+
9
.
0
f
)
*
2
.
0
f
);
re
=
(
int
)
((
z
->
re
+
FP_CONSTELLATION_SCALE
(
9
.
0
f
)
)
*
2
.
0
f
);
im
=
(
int
)
((
z
->
im
+
9
.
0
f
)
*
2
.
0
f
);
im
=
(
int
)
((
z
->
im
+
FP_CONSTELLATION_SCALE
(
9
.
0
f
)
)
*
2
.
0
f
);
#endif
#endif
if
(
re
>
35
)
if
(
re
>
35
)
re
=
35
;
re
=
35
;
...
@@ -611,9 +610,9 @@ static __inline__ void symbol_sync(v17_rx_state_t *s)
...
@@ -611,9 +610,9 @@ static __inline__ void symbol_sync(v17_rx_state_t *s)
#if defined(SPANDSP_USE_FIXED_POINTx)
#if defined(SPANDSP_USE_FIXED_POINTx)
/* TODO: The scalings used here need more thorough evaluation, to see if overflows are possible. */
/* TODO: The scalings used here need more thorough evaluation, to see if overflows are possible. */
/* Cross correlate */
/* Cross correlate */
v
=
(((
s
->
symbol_sync_low
[
1
]
>>
5
)
*
(
s
->
symbol_sync_high
[
0
]
>>
4
))
>>
15
)
*
SYNC_LOW_BAND_EDGE_COEFF_2
v
=
(((
s
->
symbol_sync_low
[
1
]
>>
(
FP_SYNC_SHIFT_FACTOR
/
2
))
*
(
s
->
symbol_sync_high
[
0
]
>>
(
FP_SYNC_SHIFT_FACTOR
/
2
)))
>>
14
)
*
SYNC_LOW_BAND_EDGE_COEFF_2
-
(((
s
->
symbol_sync_low
[
0
]
>>
5
)
*
(
s
->
symbol_sync_high
[
1
]
>>
4
))
>>
15
)
*
SYNC_HIGH_BAND_EDGE_COEFF_2
-
(((
s
->
symbol_sync_low
[
0
]
>>
(
FP_SYNC_SHIFT_FACTOR
/
2
))
*
(
s
->
symbol_sync_high
[
1
]
>>
(
FP_SYNC_SHIFT_FACTOR
/
2
)))
>>
14
)
*
SYNC_HIGH_BAND_EDGE_COEFF_2
+
(((
s
->
symbol_sync_low
[
1
]
>>
5
)
*
(
s
->
symbol_sync_high
[
1
]
>>
4
))
>>
15
)
*
SYNC_MIXED_EDGES_COEFF_3
;
+
(((
s
->
symbol_sync_low
[
1
]
>>
(
FP_SYNC_SHIFT_FACTOR
/
2
))
*
(
s
->
symbol_sync_high
[
1
]
>>
(
FP_SYNC_SHIFT_FACTOR
/
2
)))
>>
14
)
*
SYNC_MIXED_EDGES_COEFF_3
;
/* Filter away any DC component */
/* Filter away any DC component */
p
=
v
-
s
->
symbol_sync_dc_filter
[
1
];
p
=
v
-
s
->
symbol_sync_dc_filter
[
1
];
s
->
symbol_sync_dc_filter
[
1
]
=
s
->
symbol_sync_dc_filter
[
0
];
s
->
symbol_sync_dc_filter
[
1
]
=
s
->
symbol_sync_dc_filter
[
0
];
...
@@ -621,10 +620,10 @@ static __inline__ void symbol_sync(v17_rx_state_t *s)
...
@@ -621,10 +620,10 @@ static __inline__ void symbol_sync(v17_rx_state_t *s)
/* A little integration will now filter away much of the HF noise */
/* A little integration will now filter away much of the HF noise */
s
->
baud_phase
-=
p
;
s
->
baud_phase
-=
p
;
v
=
labs
(
s
->
baud_phase
);
v
=
labs
(
s
->
baud_phase
);
if
(
v
>
100
*
FP_FACTOR
)
if
(
v
>
FP_SYNC_SCALE_32
(
100
.
0
f
)
)
{
{
i
=
(
v
>
1000
*
FP_FACTOR
)
?
15
:
1
;
i
=
(
v
>
FP_SYNC_SCALE_32
(
1000
.
0
f
)
)
?
15
:
1
;
if
(
s
->
baud_phase
<
0
)
if
(
s
->
baud_phase
<
FP_SYNC_SCALE_32
(
0
.
0
f
)
)
i
=
-
i
;
i
=
-
i
;
//printf("v = %10.5f %5d - %f %f %d %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction);
//printf("v = %10.5f %5d - %f %f %d %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction);
s
->
eq_put_step
+=
i
;
s
->
eq_put_step
+=
i
;
...
@@ -642,10 +641,10 @@ static __inline__ void symbol_sync(v17_rx_state_t *s)
...
@@ -642,10 +641,10 @@ static __inline__ void symbol_sync(v17_rx_state_t *s)
/* A little integration will now filter away much of the HF noise */
/* A little integration will now filter away much of the HF noise */
s
->
baud_phase
-=
p
;
s
->
baud_phase
-=
p
;
v
=
fabsf
(
s
->
baud_phase
);
v
=
fabsf
(
s
->
baud_phase
);
if
(
v
>
100
.
0
f
)
if
(
v
>
FP_SYNC_SCALE_32
(
100
.
0
f
)
)
{
{
i
=
(
v
>
1000
.
0
f
)
?
15
:
1
;
i
=
(
v
>
FP_SYNC_SCALE_32
(
1000
.
0
f
)
)
?
15
:
1
;
if
(
s
->
baud_phase
<
0
.
0
f
)
if
(
s
->
baud_phase
<
FP_SYNC_SCALE_32
(
0
.
0
f
)
)
i
=
-
i
;
i
=
-
i
;
//printf("v = %10.5f %5d - %f %f %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction);
//printf("v = %10.5f %5d - %f %f %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction);
s
->
eq_put_step
+=
i
;
s
->
eq_put_step
+=
i
;
...
@@ -1274,14 +1273,14 @@ SPAN_DECLARE_NONSTD(int) v17_rx(v17_rx_state_t *s, const int16_t amp[], int len)
...
@@ -1274,14 +1273,14 @@ SPAN_DECLARE_NONSTD(int) v17_rx(v17_rx_state_t *s, const int16_t amp[], int len)
sample
.
re
=
(
v
*
s
->
agc_scaling
)
>>
10
;
sample
.
re
=
(
v
*
s
->
agc_scaling
)
>>
10
;
/* Symbol timing synchronisation band edge filters */
/* Symbol timing synchronisation band edge filters */
/* Low Nyquist band edge filter */
/* Low Nyquist band edge filter */
v
=
((
s
->
symbol_sync_low
[
0
]
*
SYNC_LOW_BAND_EDGE_COEFF_0
)
>>
10
)
v
=
((
s
->
symbol_sync_low
[
0
]
*
SYNC_LOW_BAND_EDGE_COEFF_0
)
>>
FP_SYNC_SHIFT_FACTOR
)
+
((
s
->
symbol_sync_low
[
1
]
*
SYNC_LOW_BAND_EDGE_COEFF_1
)
>>
10
)
+
((
s
->
symbol_sync_low
[
1
]
*
SYNC_LOW_BAND_EDGE_COEFF_1
)
>>
FP_SYNC_SHIFT_FACTOR
)
+
sample
.
re
;
+
sample
.
re
;
s
->
symbol_sync_low
[
1
]
=
s
->
symbol_sync_low
[
0
];
s
->
symbol_sync_low
[
1
]
=
s
->
symbol_sync_low
[
0
];
s
->
symbol_sync_low
[
0
]
=
v
;
s
->
symbol_sync_low
[
0
]
=
v
;
/* High Nyquist band edge filter */
/* High Nyquist band edge filter */
v
=
((
s
->
symbol_sync_high
[
0
]
*
SYNC_HIGH_BAND_EDGE_COEFF_0
)
>>
10
)
v
=
((
s
->
symbol_sync_high
[
0
]
*
SYNC_HIGH_BAND_EDGE_COEFF_0
)
>>
FP_SYNC_SHIFT_FACTOR
)
+
((
s
->
symbol_sync_high
[
1
]
*
SYNC_HIGH_BAND_EDGE_COEFF_1
)
>>
10
)
+
((
s
->
symbol_sync_high
[
1
]
*
SYNC_HIGH_BAND_EDGE_COEFF_1
)
>>
FP_SYNC_SHIFT_FACTOR
)
+
sample
.
re
;
+
sample
.
re
;
s
->
symbol_sync_high
[
1
]
=
s
->
symbol_sync_high
[
0
];
s
->
symbol_sync_high
[
1
]
=
s
->
symbol_sync_high
[
0
];
s
->
symbol_sync_high
[
0
]
=
v
;
s
->
symbol_sync_high
[
0
]
=
v
;
...
@@ -1453,11 +1452,7 @@ SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_trai
...
@@ -1453,11 +1452,7 @@ SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_trai
at a value of zero, and all others start larger. This forces the
at a value of zero, and all others start larger. This forces the
initial paths to merge at the zero states. */
initial paths to merge at the zero states. */
for
(
i
=
0
;
i
<
8
;
i
++
)
for
(
i
=
0
;
i
<
8
;
i
++
)
#if defined(SPANDSP_USE_FIXED_POINTx)
s
->
distances
[
i
]
=
FP_CONSTELLATION_SCALE
(
99
.
0
f
)
*
FP_CONSTELLATION_SCALE
(
1
.
0
f
);
s
->
distances
[
i
]
=
99
*
DIST_FACTOR
*
DIST_FACTOR
;
#else
s
->
distances
[
i
]
=
99
.
0
f
;
#endif
memset
(
s
->
full_path_to_past_state_locations
,
0
,
sizeof
(
s
->
full_path_to_past_state_locations
));
memset
(
s
->
full_path_to_past_state_locations
,
0
,
sizeof
(
s
->
full_path_to_past_state_locations
));
memset
(
s
->
past_state_locations
,
0
,
sizeof
(
s
->
past_state_locations
));
memset
(
s
->
past_state_locations
,
0
,
sizeof
(
s
->
past_state_locations
));
s
->
distances
[
0
]
=
0
;
s
->
distances
[
0
]
=
0
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论