Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
b9e307c0
提交
b9e307c0
authored
9月 08, 2013
作者:
Steve Underwood
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improved handling of page lengths in the T.85 decoder
上级
58e7db0c
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
49 行增加
和
22 行删除
+49
-22
t85_decode.c
libs/spandsp/src/t85_decode.c
+43
-20
v17rx.c
libs/spandsp/src/v17rx.c
+1
-2
v27ter_rx.c
libs/spandsp/src/v27ter_rx.c
+5
-0
没有找到文件。
libs/spandsp/src/t85_decode.c
浏览文件 @
b9e307c0
...
...
@@ -271,11 +271,16 @@ SPAN_DECLARE(bool) t85_analyse_header(uint32_t *width, uint32_t *length, const u
return
false
;
*
width
=
pack_32
(
&
data
[
6
]);
*
length
=
pack_32
(
&
data
[
10
]);
if
((
data
[
19
]
&
T85_VLENGTH
))
{
/* TODO: scan for a true length, if the initial one just says 0xFFFFFFFF */
/* There should be an image length sequence terminating the image later on. */
}
return
true
;
}
/*- End of function --------------------------------------------------------*/
static
int
check
_bih
(
t85_decode_state_t
*
s
)
static
int
extract
_bih
(
t85_decode_state_t
*
s
)
{
/* Check that the fixed parameters have the values they are expected to be
fixed at - see T.85/Table 1 */
...
...
@@ -303,50 +308,68 @@ static int check_bih(t85_decode_state_t *s)
return
T4_DECODE_INVALID_DATA
;
}
/* P - Number of bit planes */
if
(
s
->
buffer
[
2
]
<
s
->
min_bit_planes
||
s
->
buffer
[
2
]
>
s
->
max_bit_planes
)
{
span_log
(
&
s
->
logging
,
SPAN_LOG_FLOW
,
"BIH invalid. %d bit planes. Should be %d to %d.
\n
"
,
s
->
buffer
[
2
],
s
->
min_bit_planes
,
s
->
max_bit_planes
);
s
->
end_of_data
=
2
;
return
T4_DECODE_INVALID_DATA
;
}
s
->
bit_planes
=
s
->
buffer
[
2
];
s
->
current_bit_plane
=
0
;
/* Now look at the stuff which actually counts in a T.85 header. */
/* XD - Horizontal image size at layer D */
s
->
xd
=
pack_32
(
&
s
->
buffer
[
4
]);
/* YD - Vertical image size at layer D */
s
->
yd
=
pack_32
(
&
s
->
buffer
[
8
]);
/* L0 - Rows per stripe, at the lowest resolution */
s
->
l0
=
pack_32
(
&
s
->
buffer
[
12
]);
/* MX - Maximum horizontal offset allowed for AT pixel */
s
->
mx
=
s
->
buffer
[
16
];
/* Options byte */
s
->
options
=
s
->
buffer
[
19
];
if
(
s
->
bit_planes
<
s
->
min_bit_planes
||
s
->
bit_planes
>
s
->
max_bit_planes
)
{
span_log
(
&
s
->
logging
,
SPAN_LOG_FLOW
,
"BIH invalid. %d bit planes. Should be %d to %d.
\n
"
,
s
->
bit_planes
,
s
->
min_bit_planes
,
s
->
max_bit_planes
);
s
->
end_of_data
=
2
;
return
T4_DECODE_INVALID_DATA
;
}
if
(
s
->
xd
==
0
||
(
s
->
max_xd
&&
s
->
xd
>
s
->
max_xd
))
{
span_log
(
&
s
->
logging
,
SPAN_LOG_FLOW
,
"BIH invalid. Width is %"
PRIu32
"
\n
"
,
s
->
xd
);
s
->
end_of_data
=
2
;
return
T4_DECODE_INVALID_DATA
;
}
/* YD - Vertical image size at layer D */
s
->
yd
=
pack_32
(
&
s
->
buffer
[
8
]);
if
(
s
->
yd
==
0
||
(
s
->
max_yd
&&
s
->
yd
>
s
->
max_yd
))
if
(
s
->
yd
==
0
)
{
span_log
(
&
s
->
logging
,
SPAN_LOG_FLOW
,
"BIH invalid. Length is %"
PRIu32
"
\n
"
,
s
->
yd
);
s
->
end_of_data
=
2
;
return
T4_DECODE_INVALID_DATA
;
}
/* L0 - Rows per stripe, at the lowest resolution */
s
->
l0
=
pack_32
(
&
s
->
buffer
[
12
]);
if
(
s
->
max_yd
)
{
if
((
s
->
options
&
T85_VLENGTH
))
{
if
(
s
->
yd
>
s
->
max_yd
)
s
->
yd
=
s
->
max_yd
;
}
else
{
if
(
s
->
yd
>
s
->
max_yd
)
{
span_log
(
&
s
->
logging
,
SPAN_LOG_FLOW
,
"BIH invalid. Length is %"
PRIu32
"
\n
"
,
s
->
yd
);
s
->
end_of_data
=
2
;
return
T4_DECODE_INVALID_DATA
;
}
}
}
if
(
s
->
l0
==
0
)
{
span_log
(
&
s
->
logging
,
SPAN_LOG_FLOW
,
"BIH invalid. L0 is %"
PRIu32
"
\n
"
,
s
->
l0
);
s
->
end_of_data
=
2
;
return
T4_DECODE_INVALID_DATA
;
}
/* MX - Maximum horizontal offset allowed for AT pixel */
s
->
mx
=
s
->
buffer
[
16
];
if
(
s
->
mx
>
127
)
{
span_log
(
&
s
->
logging
,
SPAN_LOG_FLOW
,
"BIH invalid. MX is %d
\n
"
,
s
->
mx
);
s
->
end_of_data
=
2
;
return
T4_DECODE_INVALID_DATA
;
}
/* Options byte */
s
->
options
=
s
->
buffer
[
19
];
if
((
s
->
options
&
0x97
))
if
((
s
->
options
&
~
(
T85_LRLTWO
|
T85_VLENGTH
|
T85_TPBON
)))
{
span_log
(
&
s
->
logging
,
SPAN_LOG_FLOW
,
"BIH invalid. Options are 0x%X
\n
"
,
s
->
options
);
s
->
end_of_data
=
2
;
...
...
@@ -413,7 +436,7 @@ SPAN_DECLARE(int) t85_decode_put(t85_decode_state_t *s, const uint8_t data[], si
cnt
=
i
;
if
(
s
->
bie_len
<
20
)
return
T4_DECODE_MORE_DATA
;
if
((
ret
=
check
_bih
(
s
))
!=
T4_DECODE_OK
)
if
((
ret
=
extract
_bih
(
s
))
!=
T4_DECODE_OK
)
return
ret
;
/* Set up the two/three row buffer */
bytes_per_row
=
(
s
->
xd
+
7
)
>>
3
;
...
...
@@ -690,8 +713,8 @@ SPAN_DECLARE(int) t85_decode_put(t85_decode_state_t *s, const uint8_t data[], si
cnt
+=
decode_pscd
(
s
,
data
+
cnt
,
len
-
cnt
);
if
(
s
->
interrupt
)
return
T4_DECODE_INTERRUPT
;
/* We should only have stopped processing PSCD if
we ran out of data,
or hit a T82_ESC */
/* We should only have stopped processing PSCD if
we ran out of data,
or hit a T82_ESC */
if
(
cnt
<
len
&&
data
[
cnt
]
!=
T82_ESC
)
{
s
->
end_of_data
=
2
;
...
...
libs/spandsp/src/v17rx.c
浏览文件 @
b9e307c0
...
...
@@ -905,12 +905,11 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample)
tune_equalizer
(
s
,
&
z
,
target
);
if
(
++
s
->
training_count
>=
V17_TRAINING_SEG_2_LEN
-
48
)
{
s
->
training_error
=
FP_SCALE
(
0
.
0
f
);
#if defined(SPANDSP_USE_FIXED_POINTx)
s
->
training_error
=
0
;
s
->
carrier_track_i
=
100
;
s
->
carrier_track_p
=
500000
;
#else
s
->
training_error
=
0
.
0
f
;
s
->
carrier_track_i
=
100
.
0
f
;
s
->
carrier_track_p
=
500000
.
0
f
;
#endif
...
...
libs/spandsp/src/v27ter_rx.c
浏览文件 @
b9e307c0
...
...
@@ -178,8 +178,13 @@ SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexi16_t *
SPAN_DECLARE
(
int
)
v27ter_rx_equalizer_state
(
v27ter_rx_state_t
*
s
,
complexf_t
**
coeffs
)
#endif
{
#if defined(SPANDSP_USE_FIXED_POINT)
*
coeffs
=
NULL
;
return
0
;
#else
*
coeffs
=
s
->
eq_coeff
;
return
V27TER_EQUALIZER_LEN
;
#endif
}
/*- End of function --------------------------------------------------------*/
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论