Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
32f70174
提交
32f70174
authored
12月 05, 2011
作者:
Steve Underwood
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tweaks to spandsp tests
上级
62f21d8d
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
218 行增加
和
96 行删除
+218
-96
fax_tests.c
libs/spandsp/tests/fax_tests.c
+18
-4
fax_tests.sh
libs/spandsp/tests/fax_tests.sh
+2
-2
make_g168_css.c
libs/spandsp/tests/make_g168_css.c
+123
-36
regression_tests.sh
libs/spandsp/tests/regression_tests.sh
+9
-0
t4_tests.c
libs/spandsp/tests/t4_tests.c
+5
-1
tone_generate_tests.c
libs/spandsp/tests/tone_generate_tests.c
+8
-8
udptl.c
libs/spandsp/tests/udptl.c
+49
-38
v17_tests.c
libs/spandsp/tests/v17_tests.c
+4
-7
没有找到文件。
libs/spandsp/tests/fax_tests.c
浏览文件 @
32f70174
/*
/*
* SpanDSP - a series of DSP components for telephony
* SpanDSP - a series of DSP components for telephony
*
*
* fax_tests.c
* fax_tests.c
- Tests for the audio and T.38 FAX modules.
*
*
* Written by Steve Underwood <steveu@coppice.org>
* Written by Steve Underwood <steveu@coppice.org>
*
*
* Copyright (C) 200
3
Steve Underwood
* Copyright (C) 200
5, 2006, 2009, 2010
Steve Underwood
*
*
* All rights reserved.
* All rights reserved.
*
*
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
*/
/*! \file */
/*! \page fax_tests_page FAX tests
/*! \page fax_tests_page FAX tests
\section fax_tests_page_sec_1 What does it do?
\section fax_tests_page_sec_1 What does it do?
\section fax_tests_page_sec_2 How does it work?
\section fax_tests_page_sec_2 How does it work?
...
@@ -33,11 +35,16 @@
...
@@ -33,11 +35,16 @@
#endif
#endif
#include <stdlib.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdio.h>
#include <
unistd
.h>
#include <
fcntl
.h>
#include <string.h>
#include <string.h>
#include <assert.h>
#include <assert.h>
#include <errno.h>
#include <sndfile.h>
#include <sndfile.h>
#if !defined(_WIN32)
#include <unistd.h>
#endif
//#if defined(WITH_SPANDSP_INTERNALS)
//#if defined(WITH_SPANDSP_INTERNALS)
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
...
@@ -206,6 +213,7 @@ int main(int argc, char *argv[])
...
@@ -206,6 +213,7 @@ int main(int argc, char *argv[])
time_t
end_time
;
time_t
end_time
;
int
scan_line_time
;
int
scan_line_time
;
char
*
page_header_info
;
char
*
page_header_info
;
char
*
page_header_tz
;
int
opt
;
int
opt
;
t30_state_t
*
t30
;
t30_state_t
*
t30
;
logging_state_t
*
logging
;
logging_state_t
*
logging
;
...
@@ -218,6 +226,7 @@ int main(int argc, char *argv[])
...
@@ -218,6 +226,7 @@ int main(int argc, char *argv[])
use_tep
=
FALSE
;
use_tep
=
FALSE
;
polled_mode
=
FALSE
;
polled_mode
=
FALSE
;
page_header_info
=
NULL
;
page_header_info
=
NULL
;
page_header_tz
=
NULL
;
reverse_flow
=
FALSE
;
reverse_flow
=
FALSE
;
use_transmit_on_idle
=
TRUE
;
use_transmit_on_idle
=
TRUE
;
use_receiver_not_ready
=
FALSE
;
use_receiver_not_ready
=
FALSE
;
...
@@ -226,7 +235,7 @@ int main(int argc, char *argv[])
...
@@ -226,7 +235,7 @@ int main(int argc, char *argv[])
noise_level
=
-
99
;
noise_level
=
-
99
;
scan_line_time
=
0
;
scan_line_time
=
0
;
supported_modems
=
T30_SUPPORT_V27TER
|
T30_SUPPORT_V29
|
T30_SUPPORT_V17
;
supported_modems
=
T30_SUPPORT_V27TER
|
T30_SUPPORT_V29
|
T30_SUPPORT_V17
;
while
((
opt
=
getopt
(
argc
,
argv
,
"ehH:i:I:lm:n:prRs:S:tTw:"
))
!=
-
1
)
while
((
opt
=
getopt
(
argc
,
argv
,
"ehH:i:I:lm:n:prRs:S:tTw:
z:
"
))
!=
-
1
)
{
{
switch
(
opt
)
switch
(
opt
)
{
{
...
@@ -278,6 +287,9 @@ int main(int argc, char *argv[])
...
@@ -278,6 +287,9 @@ int main(int argc, char *argv[])
case
'w'
:
case
'w'
:
t30_state_to_wreck
=
atoi
(
optarg
);
t30_state_to_wreck
=
atoi
(
optarg
);
break
;
break
;
case
'z'
:
page_header_tz
=
optarg
;
break
;
default:
default:
//usage();
//usage();
exit
(
2
);
exit
(
2
);
...
@@ -335,6 +347,8 @@ int main(int argc, char *argv[])
...
@@ -335,6 +347,8 @@ int main(int argc, char *argv[])
t30_set_tx_polled_sub_address
(
t30
,
"Polled sub-address"
);
t30_set_tx_polled_sub_address
(
t30
,
"Polled sub-address"
);
t30_set_tx_selective_polling_address
(
t30
,
"Selective polling address"
);
t30_set_tx_selective_polling_address
(
t30
,
"Selective polling address"
);
t30_set_tx_page_header_info
(
t30
,
page_header_info
);
t30_set_tx_page_header_info
(
t30
,
page_header_info
);
if
(
page_header_tz
)
t30_set_tx_page_header_tz
(
t30
,
page_header_tz
);
t30_set_tx_nsf
(
t30
,
(
const
uint8_t
*
)
"
\x50\x00\x00\x00
Spandsp
\x00
"
,
12
);
t30_set_tx_nsf
(
t30
,
(
const
uint8_t
*
)
"
\x50\x00\x00\x00
Spandsp
\x00
"
,
12
);
t30_set_ecm_capability
(
t30
,
use_ecm
);
t30_set_ecm_capability
(
t30
,
use_ecm
);
t30_set_supported_t30_features
(
t30
,
t30_set_supported_t30_features
(
t30
,
...
...
libs/spandsp/tests/fax_tests.sh
浏览文件 @
32f70174
...
@@ -18,8 +18,8 @@
...
@@ -18,8 +18,8 @@
run_fax_test
()
run_fax_test
()
{
{
rm
-f
fax_tests_1.tif
rm
-f
fax_tests_1.tif
echo
-i
${
FILE
}
${
OPTS
}
echo
./fax_tests
${
OPTS
}
-i
${
FILE
}
./fax_tests
-i
${
FILE
}
${
OPTS
}
>
xyzzy 2>xyzzy2
./fax_tests
${
OPTS
}
-i
${
FILE
}
>
xyzzy 2>xyzzy2
RETVAL
=
$?
RETVAL
=
$?
if
[
$RETVAL
!=
0
]
if
[
$RETVAL
!=
0
]
then
then
...
...
libs/spandsp/tests/make_g168_css.c
浏览文件 @
32f70174
...
@@ -131,8 +131,8 @@ int main(int argc, char *argv[])
...
@@ -131,8 +131,8 @@ int main(int argc, char *argv[])
int16_t
noise_sound
[
8830
];
int16_t
noise_sound
[
8830
];
int16_t
silence_sound
[
8192
];
int16_t
silence_sound
[
8192
];
int
i
;
int
i
;
int
outframes
;
int
voiced_length
;
int
voiced_length
;
int
randy
;
double
f
;
double
f
;
double
pk
;
double
pk
;
double
ms
;
double
ms
;
...
@@ -155,6 +155,18 @@ int main(int argc, char *argv[])
...
@@ -155,6 +155,18 @@ int main(int argc, char *argv[])
}
}
printf
(
"Generate C1
\n
"
);
printf
(
"Generate C1
\n
"
);
/* The sequence is
48.62ms of voiced sound from table C.1 of G.168
200.0ms of pseudo-noise
101.38ms of silence
The above is then repeated phase inverted.
The voice comes straight from C.1, repeated enough times to
fill out the 48.62ms period - i.e. 16 copies of the sequence.
The pseudo noise section is random numbers filtered by the spectral
pattern in Figure C.2 */
/* The set of C1 voice samples is ready for use in the output file. */
/* The set of C1 voice samples is ready for use in the output file. */
voiced_length
=
sizeof
(
css_c1
)
/
sizeof
(
css_c1
[
0
]);
voiced_length
=
sizeof
(
css_c1
)
/
sizeof
(
css_c1
[
0
]);
for
(
i
=
0
;
i
<
voiced_length
;
i
++
)
for
(
i
=
0
;
i
<
voiced_length
;
i
++
)
...
@@ -208,13 +220,12 @@ int main(int argc, char *argv[])
...
@@ -208,13 +220,12 @@ int main(int argc, char *argv[])
#else
#else
scale
=
0
.
0
;
scale
=
0
.
0
;
#endif
#endif
randy
=
((
rand
()
>>
10
)
&
0x1
)
?
1
.
0
:
-
1
.
0
;
#if defined(HAVE_FFTW3_H)
#if defined(HAVE_FFTW3_H)
in
[
i
][
0
]
=
((
rand
()
>>
10
)
&
0x1
)
?
1
.
0
:
-
1
.
0
;
in
[
i
][
0
]
=
randy
*
pow
(
10
.
0
,
scale
/
20
.
0
)
*
35
.
0
;
in
[
i
][
0
]
*=
pow
(
10
.
0
,
scale
/
20
.
0
)
*
35
.
0
;
//305360
in
[
8192
-
i
][
0
]
=
-
in
[
i
][
0
];
in
[
8192
-
i
][
0
]
=
-
in
[
i
][
0
];
#else
#else
in
[
i
].
re
=
((
rand
()
>>
10
)
&
0x1
)
?
1
.
0
:
-
1
.
0
;
in
[
i
].
re
=
randy
*
pow
(
10
.
0
,
scale
/
20
.
0
)
*
35
.
0
;
in
[
i
].
re
*=
pow
(
10
.
0
,
scale
/
20
.
0
)
*
35
.
0
;
//305360
in
[
8192
-
i
].
re
=
-
in
[
i
].
re
;
in
[
8192
-
i
].
re
=
-
in
[
i
].
re
;
#endif
#endif
}
}
...
@@ -233,38 +244,34 @@ int main(int argc, char *argv[])
...
@@ -233,38 +244,34 @@ int main(int argc, char *argv[])
}
}
pk
=
peak
(
noise_sound
,
8192
);
pk
=
peak
(
noise_sound
,
8192
);
ms
=
rms
(
noise_sound
,
8192
);
ms
=
rms
(
noise_sound
,
8192
);
printf
(
"
N
oise level = %.2fdB, crest factor = %.2fdB
\n
"
,
rms_to_dbm0
(
ms
),
rms_to_db
(
pk
/
ms
));
printf
(
"
Filtered n
oise level = %.2fdB, crest factor = %.2fdB
\n
"
,
rms_to_dbm0
(
ms
),
rms_to_db
(
pk
/
ms
));
for
(
i
=
0
;
i
<
8192
;
i
++
)
for
(
i
=
0
;
i
<
8192
;
i
++
)
silence_sound
[
i
]
=
0
.
0
;
silence_sound
[
i
]
=
0
.
0
;
for
(
i
=
0
;
i
<
16
;
i
++
)
for
(
i
=
0
;
i
<
16
;
i
++
)
outframes
=
sf_writef_short
(
filehandle
,
voiced_sound
,
voiced_length
);
sf_writef_short
(
filehandle
,
voiced_sound
,
voiced_length
);
printf
(
"%d samples of voice
\n
"
,
16
*
voiced_length
);
printf
(
"%d samples of voice
\n
"
,
16
*
voiced_length
);
outframes
=
sf_writef_short
(
filehandle
,
noise_sound
,
8192
);
sf_writef_short
(
filehandle
,
noise_sound
,
8192
);
outframes
=
sf_writef_short
(
filehandle
,
noise_sound
,
C1_NOISE_SAMPLES
-
8192
);
sf_writef_short
(
filehandle
,
noise_sound
,
C1_NOISE_SAMPLES
-
8192
);
printf
(
"%d samples of noise
\n
"
,
C1_NOISE_SAMPLES
);
printf
(
"%d samples of noise
\n
"
,
C1_NOISE_SAMPLES
);
outframes
=
sf_writef_short
(
filehandle
,
silence_sound
,
C1_SILENCE_SAMPLES
);
sf_writef_short
(
filehandle
,
silence_sound
,
C1_SILENCE_SAMPLES
);
printf
(
"%d samples of silence
\n
"
,
C1_SILENCE_SAMPLES
);
printf
(
"%d samples of silence
\n
"
,
C1_SILENCE_SAMPLES
);
/* Now phase invert the C1 set of
voice
samples. */
/* Now phase invert the C1 set of samples. */
voiced_length
=
sizeof
(
css_c1
)
/
sizeof
(
css_c1
[
0
]);
voiced_length
=
sizeof
(
css_c1
)
/
sizeof
(
css_c1
[
0
]);
for
(
i
=
0
;
i
<
voiced_length
;
i
++
)
for
(
i
=
0
;
i
<
voiced_length
;
i
++
)
voiced_sound
[
i
]
=
-
css_c1
[
i
];
voiced_sound
[
i
]
=
-
css_c1
[
i
];
pk
=
peak
(
voiced_sound
,
voiced_length
);
ms
=
rms
(
voiced_sound
,
voiced_length
);
printf
(
"Voiced level = %.2fdB, crest factor = %.2fdB
\n
"
,
rms_to_dbm0
(
ms
),
rms_to_db
(
pk
/
ms
));
for
(
i
=
0
;
i
<
8192
;
i
++
)
for
(
i
=
0
;
i
<
8192
;
i
++
)
noise_sound
[
i
]
=
-
noise_sound
[
i
];
noise_sound
[
i
]
=
-
noise_sound
[
i
];
for
(
i
=
0
;
i
<
16
;
i
++
)
for
(
i
=
0
;
i
<
16
;
i
++
)
outframes
=
sf_writef_short
(
filehandle
,
voiced_sound
,
voiced_length
);
sf_writef_short
(
filehandle
,
voiced_sound
,
voiced_length
);
printf
(
"%d samples of voice
\n
"
,
16
*
voiced_length
);
printf
(
"%d samples of voice
\n
"
,
16
*
voiced_length
);
outframes
=
sf_writef_short
(
filehandle
,
noise_sound
,
8192
);
sf_writef_short
(
filehandle
,
noise_sound
,
8192
);
outframes
=
sf_writef_short
(
filehandle
,
noise_sound
,
C1_NOISE_SAMPLES
-
8192
);
sf_writef_short
(
filehandle
,
noise_sound
,
C1_NOISE_SAMPLES
-
8192
);
printf
(
"%d samples of noise
\n
"
,
C1_NOISE_SAMPLES
);
printf
(
"%d samples of noise
\n
"
,
C1_NOISE_SAMPLES
);
outframes
=
sf_writef_short
(
filehandle
,
silence_sound
,
C1_SILENCE_SAMPLES
);
sf_writef_short
(
filehandle
,
silence_sound
,
C1_SILENCE_SAMPLES
);
printf
(
"%d samples of silence
\n
"
,
C1_SILENCE_SAMPLES
);
printf
(
"%d samples of silence
\n
"
,
C1_SILENCE_SAMPLES
);
if
(
sf_close
(
filehandle
))
if
(
sf_close
(
filehandle
))
...
@@ -287,6 +294,21 @@ int main(int argc, char *argv[])
...
@@ -287,6 +294,21 @@ int main(int argc, char *argv[])
}
}
printf
(
"Generate C3
\n
"
);
printf
(
"Generate C3
\n
"
);
/* The sequence is
72.69ms of voiced sound from table C.3 of G.168
200.0ms of pseudo-noise
127.31ms of silence
The above is then repeated phase inverted.
The voice comes straight from C.3, repeated enough times to
fill out the 72.69ms period - i.e. 14 copies of the sequence.
The pseudo noise section is AWGN filtered by the spectral
pattern in Figure C.2. Since AWGN has the quality of being its
own Fourier transform, we can use an approach like the one above
for the C1 signal, using AWGN samples instead of randomly alternating
ones and zeros. */
/* Take the supplied set of C3 voice samples. */
/* Take the supplied set of C3 voice samples. */
voiced_length
=
(
sizeof
(
css_c3
)
/
sizeof
(
css_c3
[
0
]));
voiced_length
=
(
sizeof
(
css_c3
)
/
sizeof
(
css_c3
[
0
]));
for
(
i
=
0
;
i
<
voiced_length
;
i
++
)
for
(
i
=
0
;
i
<
voiced_length
;
i
++
)
...
@@ -300,37 +322,102 @@ int main(int argc, char *argv[])
...
@@ -300,37 +322,102 @@ int main(int argc, char *argv[])
noise_sound
[
i
]
=
awgn
(
&
noise_source
);
noise_sound
[
i
]
=
awgn
(
&
noise_source
);
pk
=
peak
(
noise_sound
,
8192
);
pk
=
peak
(
noise_sound
,
8192
);
ms
=
rms
(
noise_sound
,
8192
);
ms
=
rms
(
noise_sound
,
8192
);
printf
(
"Noise level = %.2fdB, crest factor = %.2fdB
\n
"
,
rms_to_dbm0
(
ms
),
rms_to_db
(
pk
/
ms
));
printf
(
"Unfiltered noise level = %.2fdB, crest factor = %.2fdB
\n
"
,
rms_to_dbm0
(
ms
),
rms_to_db
(
pk
/
ms
));
/* Now filter them */
#if defined(HAVE_FFTW3_H)
p
=
fftw_plan_dft_1d
(
8192
,
in
,
out
,
FFTW_BACKWARD
,
FFTW_ESTIMATE
);
#else
p
=
fftw_create_plan
(
8192
,
FFTW_BACKWARD
,
FFTW_ESTIMATE
);
#endif
for
(
i
=
0
;
i
<
8192
;
i
++
)
{
#if defined(HAVE_FFTW3_H)
in
[
i
][
0
]
=
0
.
0
;
in
[
i
][
1
]
=
0
.
0
;
#else
in
[
i
].
re
=
0
.
0
;
in
[
i
].
im
=
0
.
0
;
#endif
}
for
(
i
=
1
;
i
<=
3715
;
i
++
)
{
f
=
FAST_SAMPLE_RATE
*
i
/
8192
.
0
;
#if 1
if
(
f
<
50
.
0
)
scale
=
-
60
.
0
;
else
if
(
f
<
100
.
0
)
scale
=
scaling
(
f
,
50
.
0
,
100
.
0
,
-
25
.
8
,
-
12
.
8
);
else
if
(
f
<
200
.
0
)
scale
=
scaling
(
f
,
100
.
0
,
200
.
0
,
-
12
.
8
,
17
.
4
);
else
if
(
f
<
215
.
0
)
scale
=
scaling
(
f
,
200
.
0
,
215
.
0
,
17
.
4
,
17
.
8
);
else
if
(
f
<
500
.
0
)
scale
=
scaling
(
f
,
215
.
0
,
500
.
0
,
17
.
8
,
12
.
2
);
else
if
(
f
<
1000
.
0
)
scale
=
scaling
(
f
,
500
.
0
,
1000
.
0
,
12
.
2
,
7
.
2
);
else
if
(
f
<
2850
.
0
)
scale
=
scaling
(
f
,
1000
.
0
,
2850
.
0
,
7
.
2
,
0
.
0
);
else
if
(
f
<
3600
.
0
)
scale
=
scaling
(
f
,
2850
.
0
,
3600
.
0
,
0
.
0
,
-
2
.
0
);
else
if
(
f
<
3660
.
0
)
scale
=
scaling
(
f
,
3600
.
0
,
3660
.
0
,
-
2
.
0
,
-
20
.
0
);
else
if
(
f
<
3680
.
0
)
scale
=
scaling
(
f
,
3600
.
0
,
3680
.
0
,
-
20
.
0
,
-
30
.
0
);
else
scale
=
-
60
.
0
;
#else
scale
=
0
.
0
;
#endif
#if defined(HAVE_FFTW3_H)
in
[
i
][
0
]
=
noise_sound
[
i
]
*
pow
(
10
.
0
,
scale
/
20
.
0
)
*
0
.
0106
;
in
[
8192
-
i
][
0
]
=
-
in
[
i
][
0
];
#else
in
[
i
].
re
=
noise_sound
[
i
]
*
pow
(
10
.
0
,
scale
/
20
.
0
)
*
0
.
0106
;
in
[
8192
-
i
].
re
=
-
in
[
i
].
re
;
#endif
}
#if defined(HAVE_FFTW3_H)
fftw_execute
(
p
);
#else
fftw_one
(
p
,
in
,
out
);
#endif
for
(
i
=
0
;
i
<
8192
;
i
++
)
{
#if defined(HAVE_FFTW3_H)
noise_sound
[
i
]
=
out
[
i
][
1
];
#else
noise_sound
[
i
]
=
out
[
i
].
im
;
#endif
}
pk
=
peak
(
noise_sound
,
8192
);
ms
=
rms
(
noise_sound
,
8192
);
printf
(
"Filtered noise level = %.2fdB, crest factor = %.2fdB
\n
"
,
rms_to_dbm0
(
ms
),
rms_to_db
(
pk
/
ms
));
for
(
i
=
0
;
i
<
14
;
i
++
)
for
(
i
=
0
;
i
<
14
;
i
++
)
outframes
=
sf_writef_short
(
filehandle
,
voiced_sound
,
voiced_length
);
sf_writef_short
(
filehandle
,
voiced_sound
,
voiced_length
);
printf
(
"%d samples of voice
\n
"
,
14
*
voiced_length
);
printf
(
"%d samples of voice
\n
"
,
14
*
voiced_length
);
sf_writef_short
(
filehandle
,
noise_sound
,
8192
);
outframes
=
sf_writef_short
(
filehandle
,
noise_sound
,
8192
);
sf_writef_short
(
filehandle
,
noise_sound
,
C3_NOISE_SAMPLES
-
8192
);
outframes
=
sf_writef_short
(
filehandle
,
noise_sound
,
C3_NOISE_SAMPLES
-
8192
);
printf
(
"%d samples of noise
\n
"
,
C3_NOISE_SAMPLES
);
printf
(
"%d samples of noise
\n
"
,
C3_NOISE_SAMPLES
);
outframes
=
sf_writef_short
(
filehandle
,
silence_sound
,
C3_SILENCE_SAMPLES
);
sf_writef_short
(
filehandle
,
silence_sound
,
C3_SILENCE_SAMPLES
);
printf
(
"%d samples of silence
\n
"
,
C3_SILENCE_SAMPLES
);
printf
(
"%d samples of silence
\n
"
,
C3_SILENCE_SAMPLES
);
/* Now phase invert the
set of voice
samples. */
/* Now phase invert the
C3 set of
samples. */
voiced_length
=
(
sizeof
(
css_c3
)
/
sizeof
(
css_c3
[
0
]));
voiced_length
=
(
sizeof
(
css_c3
)
/
sizeof
(
css_c3
[
0
]));
for
(
i
=
0
;
i
<
voiced_length
;
i
++
)
for
(
i
=
0
;
i
<
voiced_length
;
i
++
)
voiced_sound
[
i
]
=
-
css_c3
[
i
];
voiced_sound
[
i
]
=
-
css_c3
[
i
];
pk
=
peak
(
voiced_sound
,
voiced_length
);
ms
=
rms
(
voiced_sound
,
voiced_length
);
printf
(
"Voiced level = %.2fdB, crest factor = %.2fdB
\n
"
,
rms_to_dbm0
(
ms
),
rms_to_db
(
pk
/
ms
));
/* Now phase invert the set of noise samples. */
for
(
i
=
0
;
i
<
8192
;
i
++
)
for
(
i
=
0
;
i
<
8192
;
i
++
)
noise_sound
[
i
]
=
-
noise_sound
[
i
];
noise_sound
[
i
]
=
-
noise_sound
[
i
];
for
(
i
=
0
;
i
<
14
;
i
++
)
for
(
i
=
0
;
i
<
14
;
i
++
)
outframes
=
sf_writef_short
(
filehandle
,
voiced_sound
,
voiced_length
);
sf_writef_short
(
filehandle
,
voiced_sound
,
voiced_length
);
printf
(
"%d samples of voice
\n
"
,
14
*
i
);
printf
(
"%d samples of voice
\n
"
,
14
*
voiced_length
);
outframes
=
sf_writef_short
(
filehandle
,
noise_sound
,
8192
);
sf_writef_short
(
filehandle
,
noise_sound
,
8192
);
outframes
=
sf_writef_short
(
filehandle
,
noise_sound
,
C3_NOISE_SAMPLES
-
8192
);
sf_writef_short
(
filehandle
,
noise_sound
,
C3_NOISE_SAMPLES
-
8192
);
printf
(
"%d samples of noise
\n
"
,
C3_NOISE_SAMPLES
);
printf
(
"%d samples of noise
\n
"
,
C3_NOISE_SAMPLES
);
outframes
=
sf_writef_short
(
filehandle
,
silence_sound
,
C3_SILENCE_SAMPLES
);
sf_writef_short
(
filehandle
,
silence_sound
,
C3_SILENCE_SAMPLES
);
printf
(
"%d samples of silence
\n
"
,
C3_SILENCE_SAMPLES
);
printf
(
"%d samples of silence
\n
"
,
C3_SILENCE_SAMPLES
);
if
(
sf_close
(
filehandle
))
if
(
sf_close
(
filehandle
))
...
...
libs/spandsp/tests/regression_tests.sh
浏览文件 @
32f70174
...
@@ -334,6 +334,15 @@ then
...
@@ -334,6 +334,15 @@ then
fi
fi
echo
lpc10_tests completed OK
echo
lpc10_tests completed OK
./math_fixed_tests
>
$STDOUT_DEST
2>
$STDERR_DEST
RETVAL
=
$?
if
[
$RETVAL
!=
0
]
then
echo
math_fixed_tests failed!
exit
$RETVAL
fi
echo
math_fixed_tests completed OK
./modem_echo_tests
>
$STDOUT_DEST
2>
$STDERR_DEST
./modem_echo_tests
>
$STDOUT_DEST
2>
$STDERR_DEST
RETVAL
=
$?
RETVAL
=
$?
if
[
$RETVAL
!=
0
]
if
[
$RETVAL
!=
0
]
...
...
libs/spandsp/tests/t4_tests.c
浏览文件 @
32f70174
...
@@ -311,6 +311,7 @@ int main(int argc, char *argv[])
...
@@ -311,6 +311,7 @@ int main(int argc, char *argv[])
const
char
*
in_file_name
;
const
char
*
in_file_name
;
const
char
*
decode_file_name
;
const
char
*
decode_file_name
;
const
char
*
page_header_tz
;
const
char
*
page_header_tz
;
tz_t
tz
;
int
opt
;
int
opt
;
int
i
;
int
i
;
int
bit_error_rate
;
int
bit_error_rate
;
...
@@ -678,7 +679,10 @@ int main(int argc, char *argv[])
...
@@ -678,7 +679,10 @@ int main(int argc, char *argv[])
else
else
t4_tx_set_header_info
(
&
send_state
,
NULL
);
t4_tx_set_header_info
(
&
send_state
,
NULL
);
if
(
page_header_tz
&&
page_header_tz
[
0
])
if
(
page_header_tz
&&
page_header_tz
[
0
])
t4_tx_set_header_tz
(
&
send_state
,
page_header_tz
);
{
if
(
tz_init
(
&
tz
,
page_header_tz
))
t4_tx_set_header_tz
(
&
send_state
,
&
tz
);
}
//t4_tx_set_header_overlays_image(&send_state, overlay_page_headers);
//t4_tx_set_header_overlays_image(&send_state, overlay_page_headers);
if
(
restart_pages
&&
(
sends
&
1
))
if
(
restart_pages
&&
(
sends
&
1
))
{
{
...
...
libs/spandsp/tests/tone_generate_tests.c
浏览文件 @
32f70174
...
@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
...
@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
printf
(
"Generated %d samples
\n
"
,
len
);
printf
(
"Generated %d samples
\n
"
,
len
);
if
(
len
<=
0
)
if
(
len
<=
0
)
break
;
break
;
outframes
=
sf_writef_short
(
outhandle
,
amp
,
len
);
sf_writef_short
(
outhandle
,
amp
,
len
);
}
}
/* Try a different tone pair */
/* Try a different tone pair */
...
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
...
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
printf
(
"Generated %d samples
\n
"
,
len
);
printf
(
"Generated %d samples
\n
"
,
len
);
if
(
len
<=
0
)
if
(
len
<=
0
)
break
;
break
;
outframes
=
sf_writef_short
(
outhandle
,
amp
,
len
);
sf_writef_short
(
outhandle
,
amp
,
len
);
}
}
/* Try a different tone pair */
/* Try a different tone pair */
...
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
...
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
printf
(
"Generated %d samples
\n
"
,
len
);
printf
(
"Generated %d samples
\n
"
,
len
);
if
(
len
<=
0
)
if
(
len
<=
0
)
break
;
break
;
outframes
=
sf_writef_short
(
outhandle
,
amp
,
len
);
sf_writef_short
(
outhandle
,
amp
,
len
);
}
}
/* Try a single tone */
/* Try a single tone */
...
@@ -148,7 +148,7 @@ int main(int argc, char *argv[])
...
@@ -148,7 +148,7 @@ int main(int argc, char *argv[])
printf
(
"Generated %d samples
\n
"
,
len
);
printf
(
"Generated %d samples
\n
"
,
len
);
if
(
len
<=
0
)
if
(
len
<=
0
)
break
;
break
;
outframes
=
sf_writef_short
(
outhandle
,
amp
,
len
);
sf_writef_short
(
outhandle
,
amp
,
len
);
}
}
/* Try a single non-repeating tone */
/* Try a single non-repeating tone */
...
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
...
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
printf
(
"Generated %d samples
\n
"
,
len
);
printf
(
"Generated %d samples
\n
"
,
len
);
if
(
len
<=
0
)
if
(
len
<=
0
)
break
;
break
;
outframes
=
sf_writef_short
(
outhandle
,
amp
,
len
);
sf_writef_short
(
outhandle
,
amp
,
len
);
}
}
/* Try a single non-repeating tone at 0dBm0 */
/* Try a single non-repeating tone at 0dBm0 */
...
@@ -192,7 +192,7 @@ int main(int argc, char *argv[])
...
@@ -192,7 +192,7 @@ int main(int argc, char *argv[])
printf
(
"Generated %d samples
\n
"
,
len
);
printf
(
"Generated %d samples
\n
"
,
len
);
if
(
len
<=
0
)
if
(
len
<=
0
)
break
;
break
;
outframes
=
sf_writef_short
(
outhandle
,
amp
,
len
);
sf_writef_short
(
outhandle
,
amp
,
len
);
}
}
/* Try an AM modulated tone at a modest modulation level (25%) */
/* Try an AM modulated tone at a modest modulation level (25%) */
...
@@ -214,7 +214,7 @@ int main(int argc, char *argv[])
...
@@ -214,7 +214,7 @@ int main(int argc, char *argv[])
printf
(
"Generated %d samples
\n
"
,
len
);
printf
(
"Generated %d samples
\n
"
,
len
);
if
(
len
<=
0
)
if
(
len
<=
0
)
break
;
break
;
outframes
=
sf_writef_short
(
outhandle
,
amp
,
len
);
sf_writef_short
(
outhandle
,
amp
,
len
);
}
}
/* Try an AM modulated tone at maximum modulation level (100%) */
/* Try an AM modulated tone at maximum modulation level (100%) */
...
@@ -236,7 +236,7 @@ int main(int argc, char *argv[])
...
@@ -236,7 +236,7 @@ int main(int argc, char *argv[])
printf
(
"Generated %d samples
\n
"
,
len
);
printf
(
"Generated %d samples
\n
"
,
len
);
if
(
len
<=
0
)
if
(
len
<=
0
)
break
;
break
;
outframes
=
sf_writef_short
(
outhandle
,
amp
,
len
);
sf_writef_short
(
outhandle
,
amp
,
len
);
}
}
if
(
sf_close_telephony
(
outhandle
))
if
(
sf_close_telephony
(
outhandle
))
...
...
libs/spandsp/tests/udptl.c
浏览文件 @
32f70174
...
@@ -2,11 +2,12 @@
...
@@ -2,11 +2,12 @@
/*
/*
* SpanDSP - a series of DSP components for telephony
* SpanDSP - a series of DSP components for telephony
*
*
* udptl.c
* udptl.c - An implementation of the UDPTL protocol defined in T.38,
* less the packet exchange part
*
*
* Written by Steve Underwood <steveu@coppice.org>
* Written by Steve Underwood <steveu@coppice.org>
*
*
* Copyright (C) 200
9
Steve Underwood
* Copyright (C) 200
5
Steve Underwood
*
*
* All rights reserved.
* All rights reserved.
*
*
...
@@ -62,15 +63,14 @@ static int decode_length(const uint8_t *buf, int limit, int *len, int *pvalue)
...
@@ -62,15 +63,14 @@ static int decode_length(const uint8_t *buf, int limit, int *len, int *pvalue)
}
}
/*- End of function --------------------------------------------------------*/
/*- End of function --------------------------------------------------------*/
static
int
decode_open_type
(
const
uint8_t
*
buf
,
int
limit
,
int
*
len
,
const
uint8_t
**
p_object
,
int
*
p_num_octets
)
static
int
decode_open_type
(
const
uint8_t
*
buf
,
int
limit
,
int
*
len
,
const
uint8_t
**
p_object
,
int
*
p_num_octets
)
{
{
int
octet_cnt
;
int
octet_cnt
;
int
octet_idx
;
int
octet_idx
;
int
stat
;
int
stat
;
int
i
;
const
uint8_t
**
pbuf
;
const
uint8_t
**
pbuf
;
for
(
octet_idx
=
0
,
*
p_num_octets
=
0
;
;
octet_idx
+=
octet_cnt
)
for
(
octet_idx
=
0
,
*
p_num_octets
=
0
;
;
octet_idx
+=
octet_cnt
)
{
{
if
((
stat
=
decode_length
(
buf
,
limit
,
len
,
&
octet_cnt
))
<
0
)
if
((
stat
=
decode_length
(
buf
,
limit
,
len
,
&
octet_cnt
))
<
0
)
return
-
1
;
return
-
1
;
...
@@ -79,7 +79,6 @@ static int decode_open_type(const uint8_t *buf, int limit, int *len, const uint8
...
@@ -79,7 +79,6 @@ static int decode_open_type(const uint8_t *buf, int limit, int *len, const uint8
*
p_num_octets
+=
octet_cnt
;
*
p_num_octets
+=
octet_cnt
;
pbuf
=
&
p_object
[
octet_idx
];
pbuf
=
&
p_object
[
octet_idx
];
i
=
0
;
/* Make sure the buffer contains at least the number of bits requested */
/* Make sure the buffer contains at least the number of bits requested */
if
((
*
len
+
octet_cnt
)
>
limit
)
if
((
*
len
+
octet_cnt
)
>
limit
)
return
-
1
;
return
-
1
;
...
@@ -134,7 +133,7 @@ static int encode_open_type(uint8_t *buf, int *len, const uint8_t *data, int num
...
@@ -134,7 +133,7 @@ static int encode_open_type(uint8_t *buf, int *len, const uint8_t *data, int num
num_octets
=
1
;
num_octets
=
1
;
}
}
/* Encode the open type */
/* Encode the open type */
for
(
octet_idx
=
0
;
;
num_octets
-=
enclen
,
octet_idx
+=
enclen
)
for
(
octet_idx
=
0
;
;
num_octets
-=
enclen
,
octet_idx
+=
enclen
)
{
{
if
((
enclen
=
encode_length
(
buf
,
len
,
num_octets
))
<
0
)
if
((
enclen
=
encode_length
(
buf
,
len
,
num_octets
))
<
0
)
return
-
1
;
return
-
1
;
...
@@ -240,7 +239,7 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
...
@@ -240,7 +239,7 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
if
(
seq_no
-
i
>=
s
->
rx_seq_no
)
if
(
seq_no
-
i
>=
s
->
rx_seq_no
)
{
{
/* This one wasn't seen before */
/* This one wasn't seen before */
/*
Decode
the secondary packet */
/*
Process
the secondary packet */
#if defined(UDPTL_DEBUG)
#if defined(UDPTL_DEBUG)
fprintf
(
stderr
,
"Secondary %d, len %d
\n
"
,
seq_no
-
i
,
lengths
[
i
-
1
]);
fprintf
(
stderr
,
"Secondary %d, len %d
\n
"
,
seq_no
-
i
,
lengths
[
i
-
1
]);
#endif
#endif
...
@@ -307,14 +306,15 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
...
@@ -307,14 +306,15 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
return
-
1
;
return
-
1
;
/* See if we can reconstruct anything which is missing */
/* See if we can reconstruct anything which is missing */
/* TODO: this does not comprehensively hunt back and repair everything that is possible */
/* TODO: this does not comprehensively hunt back and repair everything that is possible */
for
(
l
=
x
;
l
!=
((
x
-
(
16
-
span
*
entries
))
&
UDPTL_BUF_MASK
);
l
=
(
l
-
1
)
&
UDPTL_BUF_MASK
)
for
(
l
=
x
;
l
!=
((
x
-
(
16
-
span
*
entries
))
&
UDPTL_BUF_MASK
);
l
=
(
l
-
1
)
&
UDPTL_BUF_MASK
)
{
{
if
(
s
->
rx
[
l
].
fec_len
[
0
]
<=
0
)
if
(
s
->
rx
[
l
].
fec_len
[
0
]
<=
0
)
continue
;
continue
;
for
(
m
=
0
;
m
<
s
->
rx
[
l
].
fec_entries
;
m
++
)
for
(
m
=
0
;
m
<
s
->
rx
[
l
].
fec_entries
;
m
++
)
{
{
limit
=
(
l
+
m
)
&
UDPTL_BUF_MASK
;
limit
=
(
l
+
m
)
&
UDPTL_BUF_MASK
;
for
(
which
=
-
1
,
k
=
(
limit
-
s
->
rx
[
l
].
fec_span
*
s
->
rx
[
l
].
fec_entries
)
&
UDPTL_BUF_MASK
;
k
!=
limit
;
for
(
which
=
-
1
,
k
=
(
limit
-
s
->
rx
[
l
].
fec_span
*
s
->
rx
[
l
].
fec_entries
)
&
UDPTL_BUF_MASK
;
k
!=
limit
;
k
=
(
k
+
s
->
rx
[
l
].
fec_entries
)
&
UDPTL_BUF_MASK
)
k
=
(
k
+
s
->
rx
[
l
].
fec_entries
)
&
UDPTL_BUF_MASK
)
{
{
if
(
s
->
rx
[
k
].
buf_len
<=
0
)
if
(
s
->
rx
[
k
].
buf_len
<=
0
)
...
@@ -326,10 +326,13 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
...
@@ -326,10 +326,13 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
for
(
j
=
0
;
j
<
s
->
rx
[
l
].
fec_len
[
m
];
j
++
)
for
(
j
=
0
;
j
<
s
->
rx
[
l
].
fec_len
[
m
];
j
++
)
{
{
s
->
rx
[
which
].
buf
[
j
]
=
s
->
rx
[
l
].
fec
[
m
][
j
];
s
->
rx
[
which
].
buf
[
j
]
=
s
->
rx
[
l
].
fec
[
m
][
j
];
for
(
k
=
(
limit
-
s
->
rx
[
l
].
fec_span
*
s
->
rx
[
l
].
fec_entries
)
&
UDPTL_BUF_MASK
;
k
!=
limit
;
for
(
k
=
(
limit
-
s
->
rx
[
l
].
fec_span
*
s
->
rx
[
l
].
fec_entries
)
&
UDPTL_BUF_MASK
;
k
!=
limit
;
k
=
(
k
+
s
->
rx
[
l
].
fec_entries
)
&
UDPTL_BUF_MASK
)
k
=
(
k
+
s
->
rx
[
l
].
fec_entries
)
&
UDPTL_BUF_MASK
)
{
s
->
rx
[
which
].
buf
[
j
]
^=
(
s
->
rx
[
k
].
buf_len
>
j
)
?
s
->
rx
[
k
].
buf
[
j
]
:
0
;
s
->
rx
[
which
].
buf
[
j
]
^=
(
s
->
rx
[
k
].
buf_len
>
j
)
?
s
->
rx
[
k
].
buf
[
j
]
:
0
;
}
}
}
s
->
rx
[
which
].
buf_len
=
s
->
rx
[
l
].
fec_len
[
m
];
s
->
rx
[
which
].
buf_len
=
s
->
rx
[
l
].
fec_len
[
m
];
repaired
[
which
]
=
TRUE
;
repaired
[
which
]
=
TRUE
;
}
}
...
@@ -348,8 +351,8 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
...
@@ -348,8 +351,8 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
}
}
}
}
}
}
/* If packets are received out of sequence, we may have already processed this packet
from the error
/* If packets are received out of sequence, we may have already processed this packet
recovery information in a packet already received. */
from the error
recovery information in a packet already received. */
if
(
seq_no
>=
s
->
rx_seq_no
)
if
(
seq_no
>=
s
->
rx_seq_no
)
{
{
/* Decode the primary packet */
/* Decode the primary packet */
...
@@ -437,10 +440,10 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
...
@@ -437,10 +440,10 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
case
UDPTL_ERROR_CORRECTION_FEC
:
case
UDPTL_ERROR_CORRECTION_FEC
:
span
=
s
->
error_correction_span
;
span
=
s
->
error_correction_span
;
entries
=
s
->
error_correction_entries
;
entries
=
s
->
error_correction_entries
;
if
(
seq
<
s
->
error_correction_span
*
s
->
error_correction_entries
)
if
(
seq
<
s
->
error_correction_span
*
s
->
error_correction_entries
)
{
{
/* In the initial stages, wind up the FEC smoothly */
/* In the initial stages, wind up the FEC smoothly */
entries
=
seq
/
s
->
error_correction_span
;
entries
=
seq
/
s
->
error_correction_span
;
if
(
seq
<
s
->
error_correction_span
)
if
(
seq
<
s
->
error_correction_span
)
span
=
0
;
span
=
0
;
}
}
...
@@ -458,13 +461,13 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
...
@@ -458,13 +461,13 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
/* Make an XOR'ed entry the maximum length */
/* Make an XOR'ed entry the maximum length */
limit
=
(
entry
+
m
)
&
UDPTL_BUF_MASK
;
limit
=
(
entry
+
m
)
&
UDPTL_BUF_MASK
;
high_tide
=
0
;
high_tide
=
0
;
for
(
i
=
(
limit
-
span
*
entries
)
&
UDPTL_BUF_MASK
;
i
!=
limit
;
i
=
(
i
+
entries
)
&
UDPTL_BUF_MASK
)
for
(
i
=
(
limit
-
span
*
entries
)
&
UDPTL_BUF_MASK
;
i
!=
limit
;
i
=
(
i
+
entries
)
&
UDPTL_BUF_MASK
)
{
{
if
(
high_tide
<
s
->
tx
[
i
].
buf_len
)
if
(
high_tide
<
s
->
tx
[
i
].
buf_len
)
{
{
for
(
j
=
0
;
j
<
high_tide
;
j
++
)
for
(
j
=
0
;
j
<
high_tide
;
j
++
)
fec
[
j
]
^=
s
->
tx
[
i
].
buf
[
j
];
fec
[
j
]
^=
s
->
tx
[
i
].
buf
[
j
];
for
(
;
j
<
s
->
tx
[
i
].
buf_len
;
j
++
)
for
(
;
j
<
s
->
tx
[
i
].
buf_len
;
j
++
)
fec
[
j
]
=
s
->
tx
[
i
].
buf
[
j
];
fec
[
j
]
=
s
->
tx
[
i
].
buf
[
j
];
high_tide
=
s
->
tx
[
i
].
buf_len
;
high_tide
=
s
->
tx
[
i
].
buf_len
;
}
}
...
@@ -487,7 +490,10 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
...
@@ -487,7 +490,10 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int
}
}
/*- End of function --------------------------------------------------------*/
/*- End of function --------------------------------------------------------*/
int
udptl_set_error_correction
(
udptl_state_t
*
s
,
int
ec_scheme
,
int
span
,
int
entries
)
int
udptl_set_error_correction
(
udptl_state_t
*
s
,
int
ec_scheme
,
int
span
,
int
entries
)
{
{
switch
(
ec_scheme
)
switch
(
ec_scheme
)
{
{
...
@@ -548,7 +554,12 @@ int udptl_get_far_max_datagram(udptl_state_t *s)
...
@@ -548,7 +554,12 @@ int udptl_get_far_max_datagram(udptl_state_t *s)
}
}
/*- End of function --------------------------------------------------------*/
/*- End of function --------------------------------------------------------*/
udptl_state_t
*
udptl_init
(
udptl_state_t
*
s
,
int
ec_scheme
,
int
span
,
int
entries
,
udptl_rx_packet_handler_t
rx_packet_handler
,
void
*
user_data
)
udptl_state_t
*
udptl_init
(
udptl_state_t
*
s
,
int
ec_scheme
,
int
span
,
int
entries
,
udptl_rx_packet_handler_t
rx_packet_handler
,
void
*
user_data
)
{
{
int
i
;
int
i
;
...
...
libs/spandsp/tests/v17_tests.c
浏览文件 @
32f70174
...
@@ -119,17 +119,17 @@ static void reporter(void *user_data, int reason, bert_results_t *results)
...
@@ -119,17 +119,17 @@ static void reporter(void *user_data, int reason, bert_results_t *results)
static
void
v17_rx_status
(
void
*
user_data
,
int
status
)
static
void
v17_rx_status
(
void
*
user_data
,
int
status
)
{
{
v17_rx_state_t
*
rx
;
v17_rx_state_t
*
s
;
int
i
;
int
i
;
int
len
;
int
len
;
complexf_t
*
coeffs
;
complexf_t
*
coeffs
;
printf
(
"V.17 rx status is %s (%d)
\n
"
,
signal_status_to_str
(
status
),
status
);
printf
(
"V.17 rx status is %s (%d)
\n
"
,
signal_status_to_str
(
status
),
status
);
rx
=
(
v17_rx_state_t
*
)
user_data
;
s
=
(
v17_rx_state_t
*
)
user_data
;
switch
(
status
)
switch
(
status
)
{
{
case
SIG_STATUS_TRAINING_SUCCEEDED
:
case
SIG_STATUS_TRAINING_SUCCEEDED
:
len
=
v17_rx_equalizer_state
(
rx
,
&
coeffs
);
len
=
v17_rx_equalizer_state
(
s
,
&
coeffs
);
printf
(
"Equalizer:
\n
"
);
printf
(
"Equalizer:
\n
"
);
for
(
i
=
0
;
i
<
len
;
i
++
)
for
(
i
=
0
;
i
<
len
;
i
++
)
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
]));
...
@@ -140,15 +140,12 @@ static void v17_rx_status(void *user_data, int status)
...
@@ -140,15 +140,12 @@ static void v17_rx_status(void *user_data, int status)
static
void
v17putbit
(
void
*
user_data
,
int
bit
)
static
void
v17putbit
(
void
*
user_data
,
int
bit
)
{
{
v17_rx_state_t
*
rx
;
if
(
bit
<
0
)
if
(
bit
<
0
)
{
{
v17_rx_status
(
user_data
,
bit
);
v17_rx_status
(
user_data
,
bit
);
return
;
return
;
}
}
rx
=
(
v17_rx_state_t
*
)
user_data
;
if
(
decode_test_file
)
if
(
decode_test_file
)
printf
(
"Rx bit %d - %d
\n
"
,
rx_bits
++
,
bit
);
printf
(
"Rx bit %d - %d
\n
"
,
rx_bits
++
,
bit
);
else
else
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论