More integration with the current spandsp

This commit is contained in:
Steve Underwood 2012-07-15 01:47:55 +08:00
parent 5d7e26141f
commit 232fe67722
6 changed files with 84 additions and 99 deletions

View File

@ -154,8 +154,8 @@ int callback_ok;
int callback_roll;
int step;
int max_forward_twist;
int max_reverse_twist;
float max_forward_twist;
float max_reverse_twist;
int use_dialtone_filter = FALSE;
@ -325,8 +325,8 @@ static void mitel_cm7291_side_1_tests(void)
logging_state_t *logging;
dtmf_state = dtmf_rx_init(NULL, NULL, NULL);
if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0)
dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99);
if (use_dialtone_filter || max_forward_twist >= 0.0f || max_reverse_twist >= 0.0f)
dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99.0f);
logging = dtmf_rx_get_logging_state(dtmf_state);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
span_log_set_tag(logging, "DTMF-rx");
@ -635,8 +635,8 @@ static void mitel_cm7291_side_2_and_bellcore_tests(void)
logging_state_t *logging;
dtmf_state = dtmf_rx_init(NULL, NULL, NULL);
if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0)
dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99);
if (use_dialtone_filter || max_forward_twist >= 0.0f || max_reverse_twist >= 0.0f)
dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99.0f);
logging = dtmf_rx_get_logging_state(dtmf_state);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
span_log_set_tag(logging, "DTMF-rx");
@ -706,8 +706,8 @@ static void dial_tone_tolerance_tests(void)
logging_state_t *logging;
dtmf_state = dtmf_rx_init(NULL, NULL, NULL);
if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0)
dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99);
if (use_dialtone_filter || max_forward_twist >= 0.0f || max_reverse_twist >= 0.0f)
dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99.0f);
logging = dtmf_rx_get_logging_state(dtmf_state);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
span_log_set_tag(logging, "DTMF-rx");
@ -763,8 +763,8 @@ static void callback_function_tests(void)
callback_ok = TRUE;
callback_roll = 0;
dtmf_state = dtmf_rx_init(NULL, digit_delivery, (void *) 0x12345678);
if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0)
dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99);
if (use_dialtone_filter || max_forward_twist >= 0.0f || max_reverse_twist >= 0.0f)
dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99.0f);
logging = dtmf_rx_get_logging_state(dtmf_state);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
span_log_set_tag(logging, "DTMF-rx");
@ -793,8 +793,8 @@ static void callback_function_tests(void)
callback_roll = 0;
dtmf_rx_init(dtmf_state, NULL, NULL);
dtmf_rx_set_realtime_callback(dtmf_state, digit_status, (void *) 0x12345678);
if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0)
dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99);
if (use_dialtone_filter || max_forward_twist >= 0.0f || max_reverse_twist >= 0.0f)
dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99.0f);
logging = dtmf_rx_get_logging_state(dtmf_state);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
span_log_set_tag(logging, "DTMF-rx");
@ -836,8 +836,8 @@ static void decode_test(const char *test_file)
logging_state_t *logging;
dtmf_state = dtmf_rx_init(NULL, NULL, NULL);
if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0)
dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99);
if (use_dialtone_filter || max_forward_twist >= 0.0f || max_reverse_twist >= 0.0f)
dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99.0f);
logging = dtmf_rx_get_logging_state(dtmf_state);
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
span_log_set_tag(logging, "DTMF-rx");
@ -874,8 +874,8 @@ int main(int argc, char *argv[])
use_dialtone_filter = FALSE;
channel_codec = MUNGE_CODEC_NONE;
decode_test_file = NULL;
max_forward_twist = -1;
max_reverse_twist = -1;
max_forward_twist = -1.0f;
max_reverse_twist = -1.0f;
while ((opt = getopt(argc, argv, "c:d:F:fR:")) != -1)
{
switch (opt)
@ -887,13 +887,13 @@ int main(int argc, char *argv[])
decode_test_file = optarg;
break;
case 'F':
max_forward_twist = atoi(optarg);
max_forward_twist = atof(optarg);
break;
case 'f':
use_dialtone_filter = TRUE;
break;
case 'R':
max_reverse_twist = atoi(optarg);
max_reverse_twist = atof(optarg);
break;
default:
//usage();

View File

@ -465,7 +465,8 @@ int main(int argc, char *argv[])
fsk_rx_state_t *fsk;
v17_rx_state_t *v17;
v29_rx_state_t *v29;
v27ter_rx_state_t *v27ter;
v27ter_rx_state_t *v27ter_4800;
v27ter_rx_state_t *v27ter_2400;
int16_t amp[SAMPLES_PER_CHUNK];
SNDFILE *inhandle;
SF_INFO info;
@ -504,11 +505,14 @@ int main(int argc, char *argv[])
v17 = v17_rx_init(NULL, 14400, v17_put_bit, NULL);
v29 = v29_rx_init(NULL, 9600, v29_put_bit, NULL);
//v29 = v29_rx_init(NULL, 7200, v29_put_bit, NULL);
v27ter = v27ter_rx_init(NULL, 4800, v27ter_put_bit, NULL);
v27ter_4800 = v27ter_rx_init(NULL, 4800, v27ter_put_bit, NULL);
v27ter_2400 = v27ter_rx_init(NULL, 2400, v27ter_put_bit, NULL);
fsk_rx_signal_cutoff(fsk, -45.5);
v17_rx_signal_cutoff(v17, -45.5);
v29_rx_signal_cutoff(v29, -45.5);
v27ter_rx_signal_cutoff(v27ter, -40.0);
v27ter_rx_signal_cutoff(v27ter_4800, -40.0);
v27ter_rx_signal_cutoff(v27ter_2400, -40.0);
#if 1
logging = v17_rx_get_logging_state(v17);
@ -521,9 +525,14 @@ int main(int argc, char *argv[])
span_log_set_protocol(logging, "V.29");
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
logging = v27ter_rx_get_logging_state(v27ter);
logging = v27ter_rx_get_logging_state(v27ter_4800);
span_log_init(logging, SPAN_LOG_FLOW, NULL);
span_log_set_protocol(logging, "V.27ter");
span_log_set_protocol(logging, "V.27ter-4800");
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
logging = v27ter_rx_get_logging_state(v27ter_2400);
span_log_init(logging, SPAN_LOG_FLOW, NULL);
span_log_set_protocol(logging, "V.27ter-2400");
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW);
#endif
@ -541,7 +550,8 @@ int main(int argc, char *argv[])
fsk_rx(fsk, amp, len);
v17_rx(v17, amp, len);
v29_rx(v29, amp, len);
//v27ter_rx(v27ter, amp, len);
v27ter_rx(v27ter_4800, amp, len);
v27ter_rx(v27ter_2400, amp, len);
}
t4_rx_release(&t4_rx_state);

View File

@ -86,15 +86,15 @@ static void front_end_step_complete(faxtester_state_t *s)
void faxtester_send_hdlc_flags(faxtester_state_t *s, int flags)
{
hdlc_tx_flags(&(s->modems.hdlc_tx), flags);
hdlc_tx_flags(&s->modems.hdlc_tx, flags);
}
/*- End of function --------------------------------------------------------*/
void faxtester_send_hdlc_msg(faxtester_state_t *s, const uint8_t *msg, int len, int crc_ok)
{
hdlc_tx_frame(&(s->modems.hdlc_tx), msg, len);
hdlc_tx_frame(&s->modems.hdlc_tx, msg, len);
if (!crc_ok)
hdlc_tx_corrupt_frame(&(s->modems.hdlc_tx));
hdlc_tx_corrupt_frame(&s->modems.hdlc_tx);
}
/*- End of function --------------------------------------------------------*/
@ -115,30 +115,24 @@ static void hdlc_underflow_handler(void *user_data)
buf[2] = 0x06;
buf[3] = s->image_ptr/s->ecm_frame_size;
memcpy(buf + 4, &s->image_buffer[s->image_ptr], s->ecm_frame_size);
hdlc_tx_frame(&(s->modems.hdlc_tx), buf, 4 + s->ecm_frame_size);
hdlc_tx_frame(&s->modems.hdlc_tx, buf, 4 + s->ecm_frame_size);
if (s->corrupt_crc >= 0 && s->corrupt_crc == s->image_ptr/s->ecm_frame_size)
hdlc_tx_corrupt_frame(&(s->modems.hdlc_tx));
hdlc_tx_corrupt_frame(&s->modems.hdlc_tx);
s->image_ptr += s->ecm_frame_size;
return;
}
else
/* The actual image is over. We are sending the final RCP frames. */
if (s->image_bit_ptr > 2)
{
/* The actual image is over. We are sending the final RCP frames. */
if (s->image_bit_ptr > 2)
{
s->image_bit_ptr--;
buf[0] = 0xFF;
buf[1] = 0x03;
buf[2] = 0x86;
hdlc_tx_frame(&(s->modems.hdlc_tx), buf, 3);
return;
}
else
{
/* All done. */
s->image_buffer = NULL;
}
s->image_bit_ptr--;
buf[0] = 0xFF;
buf[1] = 0x03;
buf[2] = 0x86;
hdlc_tx_frame(&s->modems.hdlc_tx, buf, 3);
return;
}
/* All done. */
s->image_buffer = NULL;
}
front_end_step_complete(s);
}
@ -388,7 +382,7 @@ int faxtester_rx(faxtester_state_t *s, int16_t *amp, int len)
int i;
for (i = 0; i < len; i++)
amp[i] = dc_restore(&(s->modems.dc_restore), amp[i]);
amp[i] = dc_restore(&s->modems.dc_restore, amp[i]);
s->modems.rx_handler(s->modems.rx_user_data, amp, len);
timer_update(s, len);
if (s->wait_for_silence)
@ -474,10 +468,7 @@ void faxtester_set_rx_type(void *user_data, int type, int bit_rate, int short_tr
{
case T30_MODEM_CED:
case T30_MODEM_CNG:
if (type == T30_MODEM_CED)
tone = MODEM_CONNECT_TONES_FAX_CED;
else
tone = MODEM_CONNECT_TONES_FAX_CNG;
tone = (type == T30_MODEM_CED) ? MODEM_CONNECT_TONES_FAX_CED : MODEM_CONNECT_TONES_FAX_CNG;
modem_connect_tones_rx_init(&t->connect_rx,
tone,
tone_detected,

View File

@ -18,7 +18,7 @@
run_fax_test()
{
rm -f fax_tests_1.tif
echo ./fax_tests -i ${FILE} ${OPTS} -i ${FILE}
echo ./fax_tests ${OPTS} -i ${FILE}
./fax_tests ${OPTS} -i ${FILE} >xyzzy 2>xyzzy2
RETVAL=$?
if [ $RETVAL != 0 ]
@ -142,3 +142,6 @@ do
FILE="${ITUTESTS_DIR}/R1200_1200_A3.tif"
run_fax_test
done
echo
echo All fax tests successfully completed

View File

@ -91,7 +91,7 @@ void fax_log_final_transfer_statistics(t30_state_t *s, const char *tag)
t30_get_transfer_statistics(s, &t);
printf("%s: Bit rate %d\n", tag, t.bit_rate);
printf("%s: ECM %s\n", tag, (t.error_correcting_mode) ? "on" : "off");
//printf("%s: RTP events %d. RTN events %d\n", tag, t.rtp_events, t.rtn_events);
printf("%s: RTP events %d. RTN events %d\n", tag, t.rtp_events, t.rtn_events);
printf("%s: Tx pages %d, rx pages %d\n", tag, t.pages_tx, t.pages_rx);
}
/*- End of function --------------------------------------------------------*/

View File

@ -179,31 +179,14 @@ echo dtmf_tx_tests completed OK
#echo echo_tests completed OK
echo echo_tests not enabled
for OPTS in "-p AA" "-p AA -e" "-p TT" "-p TT -e" "-p GG" "-p GG -e" "-p TG" "-p TG -e" "-p GT" "-p GT -e"
do
for FILE in ${ITUTESTS_TIF} ${MIXEDSIZES_TIF}
do
rm -f fax_tests.tif
./fax_tests ${OPTS} -i ${FILE} >$STDOUT_DEST 2>$STDERR_DEST
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo fax_tests ${OPTS} -i ${FILE} failed!
exit $RETVAL
fi
# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
# option means the normal differences in tags will be ignored.
tiffcmp -t ${FILE} fax_tests.tif >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo fax_tests ${OPTS} -i ${FILE} failed!
exit $RETVAL
fi
echo fax_tests ${OPTS} -i ${FILE} completed OK
done
done
echo fax_tests completed OK
./fax_tests.sh
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo fax_tests.sh failed!
exit $RETVAL
fi
echo fax_tests.sh completed OK
./fsk_tests >$STDOUT_DEST 2>$STDERR_DEST
RETVAL=$?
@ -536,27 +519,25 @@ echo t4_tests completed OK
#echo t4_t6_tests completed OK
echo t4_t6_tests not enabled
#rm -f t81_t82_arith_coding_tests_receive.tif
#./t4_tests >$STDOUT_DEST 2>$STDERR_DEST
#RETVAL=$?
#if [ $RETVAL != 0 ]
#then
# echo t81_t82_arith_coding_tests failed!
# exit $RETVAL
#fi
#echo t81_t82_arith_coding_tests completed OK
echo t81_t82_arith_coding_tests not enabled
rm -f t81_t82_arith_coding_tests_receive.tif
./t4_tests >$STDOUT_DEST 2>$STDERR_DEST
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo t81_t82_arith_coding_tests failed!
exit $RETVAL
fi
echo t81_t82_arith_coding_tests completed OK
#rm -f t85_tests_receive.tif
#./t85_tests >$STDOUT_DEST 2>$STDERR_DEST
#RETVAL=$?
#if [ $RETVAL != 0 ]
#then
# echo t85_tests failed!
# exit $RETVAL
#fi
#echo t85_tests completed OK
echo t85_tests not enabled
rm -f t85_tests_receive.tif
./t85_tests >$STDOUT_DEST 2>$STDERR_DEST
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo t85_tests failed!
exit $RETVAL
fi
echo t85_tests completed OK
#./time_scale_tests >$STDOUT_DEST 2>$STDERR_DEST
#RETVAL=$?
@ -672,10 +653,10 @@ echo v42_tests completed OK
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo v42bis_tests failed!
echo v42bis_tests.sh failed!
exit $RETVAL
fi
echo v42bis_tests completed OK
echo v42bis_tests.sh completed OK
./v8_tests >$STDOUT_DEST 2>$STDERR_DEST
RETVAL=$?