提交 4998e22b authored 作者: Steve Underwood's avatar Steve Underwood

Tweaks to spandsp tests

上级 713c0124
...@@ -19,12 +19,16 @@ ...@@ -19,12 +19,16 @@
name CDATA #IMPLIED name CDATA #IMPLIED
> >
<!ELEMENT test (step|possible-step)* > <!ELEMENT test (repeat|step)* >
<!ATTLIST test <!ATTLIST test
name CDATA #IMPLIED name CDATA #IMPLIED
> >
<!ELEMENT possible-step (step)* > <!ELEMENT repeat (step)* >
<!ATTLIST repeat
min CDATA #IMPLIED
max CDATA #IMPLIED
>
<!ELEMENT step (check|EMPTY)* > <!ELEMENT step (check|EMPTY)* >
<!ATTLIST step <!ATTLIST step
...@@ -49,5 +53,6 @@ ...@@ -49,5 +53,6 @@
<!ATTLIST check <!ATTLIST check
name CDATA #IMPLIED name CDATA #IMPLIED
desc CDATA #IMPLIED desc CDATA #IMPLIED
cond CDATA #IMPLIED
> >
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
<step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 00 80 08"/> <step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 00 80 08"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
<possible-step> <repeat min="0">
<step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/> <step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
<step dir="R" type="SILENCE"/> <step dir="R" type="SILENCE"/>
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
<step dir="T" type="PREAMBLE" modem="V.21"/> <step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="RR" value="FF C8 76"/> <step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
</possible-step> </repeat>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/> <step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/> <step dir="R" type="SILENCE"/>
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
<step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 80 00 10"/> <step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 80 00 10"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
<possible-step> <repeat min="0">
<step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/> <step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
<step dir="R" type="SILENCE"/> <step dir="R" type="SILENCE"/>
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
<step dir="T" type="PREAMBLE" modem="V.21"/> <step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="RR" value="FF C8 76"/> <step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
</possible-step> </repeat>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/> <step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/> <step dir="R" type="SILENCE"/>
...@@ -200,6 +200,7 @@ ...@@ -200,6 +200,7 @@
<step dir="T" type="CED"/> <step dir="T" type="CED"/>
<step type="WAIT" value="75"/> <step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/> <step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DIS" value="FF C8 01 00 50 00"/> <step dir="T" type="HDLC" tag="DIS" value="FF C8 01 00 50 00"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
...@@ -261,7 +262,7 @@ ...@@ -261,7 +262,7 @@
<step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/> <step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
<possible-step> <repeat min="0">
<step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/> <step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
<step dir="R" type="SILENCE"/> <step dir="R" type="SILENCE"/>
...@@ -269,7 +270,7 @@ ...@@ -269,7 +270,7 @@
<step dir="T" type="PREAMBLE" modem="V.21"/> <step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="RR" value="FF C8 76"/> <step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
</possible-step> </repeat>
<step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/> <step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/>
<step dir="R" type="SILENCE"/> <step dir="R" type="SILENCE"/>
...@@ -283,7 +284,7 @@ ...@@ -283,7 +284,7 @@
<step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/> <step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
<possible-step> <repeat min="0">
<step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/> <step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
<step dir="R" type="SILENCE"/> <step dir="R" type="SILENCE"/>
...@@ -291,7 +292,7 @@ ...@@ -291,7 +292,7 @@
<step dir="T" type="PREAMBLE" modem="V.21"/> <step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="RR" value="FF C8 76"/> <step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
</possible-step> </repeat>
<step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/> <step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/>
<step dir="R" type="SILENCE"/> <step dir="R" type="SILENCE"/>
...@@ -305,7 +306,7 @@ ...@@ -305,7 +306,7 @@
<step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/> <step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
<possible-step> <repeat min="0">
<step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/> <step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
<step dir="R" type="SILENCE"/> <step dir="R" type="SILENCE"/>
...@@ -313,7 +314,7 @@ ...@@ -313,7 +314,7 @@
<step dir="T" type="PREAMBLE" modem="V.21"/> <step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="RR" value="FF C8 76"/> <step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
</possible-step> </repeat>
<step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/> <step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/>
<step dir="R" type="SILENCE"/> <step dir="R" type="SILENCE"/>
...@@ -327,7 +328,7 @@ ...@@ -327,7 +328,7 @@
<step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/> <step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
<possible-step> <repeat min="0">
<step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/> <step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
<step dir="R" type="SILENCE"/> <step dir="R" type="SILENCE"/>
...@@ -335,7 +336,7 @@ ...@@ -335,7 +336,7 @@
<step dir="T" type="PREAMBLE" modem="V.21"/> <step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="RR" value="FF C8 76"/> <step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
</possible-step> </repeat>
<step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/> <step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/>
<step dir="R" type="SILENCE"/> <step dir="R" type="SILENCE"/>
...@@ -357,7 +358,7 @@ ...@@ -357,7 +358,7 @@
<step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 6B"/> <step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 6B"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
<possible-step> <repeat min="0">
<step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/> <step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
<step dir="R" type="SILENCE"/> <step dir="R" type="SILENCE"/>
...@@ -365,7 +366,7 @@ ...@@ -365,7 +366,7 @@
<step dir="T" type="PREAMBLE" modem="V.21"/> <step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="RR" value="FF C8 76"/> <step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
</possible-step> </repeat>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/> <step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/> <step dir="R" type="SILENCE"/>
...@@ -375,6 +376,105 @@ ...@@ -375,6 +376,105 @@
<step dir="T" type="HDLC" tag="DCN" value="FF C8 5F"/> <step dir="T" type="HDLC" tag="DCN" value="FF C8 5F"/>
<step dir="T" type="POSTAMBLE"/> <step dir="T" type="POSTAMBLE"/>
<step dir="T" type="CLEAR"/>
<step dir="R" type="CLEAR" timein="0" timeout="100"/>
<step type="STATUS" value="OK"/>
</test>
<test name="ECM-DCN-clipped">
<!-- Tester calls DUT and sends one 31k byte STAIRSTEP page and one 15k byte STAIRSTEP page. -->
<step type="CALL"/>
<!--<step dir="T" type="CNG"/>-->
<step dir="R" type="CED"/>
<step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 50 1F 30"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="TCF" modem="V.27ter/4800" value="900"/>
<step dir="R" type="HDLC" modem="V.21" tag="CFR" value="FF C8 21"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
<step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" min_bits="141"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-NULL" value="FF C8 7D 00 00 00 08"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
<step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 80 08"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<repeat min="2" max="2">
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
</repeat>
<step dir="T" type="CLEAR"/>
<step dir="R" type="CLEAR" timein="0" timeout="100"/>
<step type="STATUS" value="OK"/>
</test>
<test name="Non-ECM-DCN-clipped">
<!-- Tester calls DUT and sends 2 WHITE pages. DUT should send CSI for this test procedure. -->
<step type="CALL"/>
<step dir="T" type="SET" tag="IDENT" value="+0123456789"/>
<!--<step dir="T" type="CNG"/>-->
<step dir="R" type="CED"/>
<step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 50 00"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="TCF" modem="V.27ter/4800" value="900"/>
<step dir="R" type="HDLC" modem="V.21" tag="CFR" value="FF C8 21"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="MSG" modem="V.27ter/4800" value="etsi_300_242_a4_white.tif"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="EOP" value="FF C8 72"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<repeat min="2" max="2">
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
</repeat>
<step dir="T" type="CLEAR"/> <step dir="T" type="CLEAR"/>
<step dir="R" type="CLEAR" timein="0" timeout="100"/> <step dir="R" type="CLEAR" timein="0" timeout="100"/>
<step type="STATUS" value="OK"/> <step type="STATUS" value="OK"/>
......
...@@ -149,7 +149,7 @@ static void rx_callback(void *user_data, const ademco_contactid_report_t *report ...@@ -149,7 +149,7 @@ static void rx_callback(void *user_data, const ademco_contactid_report_t *report
printf(" Event %X\n", report->xyz); printf(" Event %X\n", report->xyz);
printf(" Group/partition %X\n", report->gg); printf(" Group/partition %X\n", report->gg);
printf(" User/Zone information %X\n", report->ccc); printf(" User/Zone information %X\n", report->ccc);
if (memcmp(&reports[reports_entry], report, sizeof (*report))) if (memcmp(&reports[reports_entry], report, sizeof(*report)))
{ {
printf("Report mismatch\n"); printf("Report mismatch\n");
exit(2); exit(2);
......
...@@ -77,7 +77,7 @@ int main(int argc, char *argv[]) ...@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
total = 0.0; total = 0.0;
if ((noise_source = awgn_init_dbm0(NULL, idum, (float) j)) == NULL) if ((noise_source = awgn_init_dbm0(NULL, idum, (float) j)) == NULL)
{ {
printf("Failed to allocation AWGN source\n"); printf("Failed to allocate AWGN source\n");
exit(2); exit(2);
} }
total_samples = 1000000; total_samples = 1000000;
...@@ -114,7 +114,7 @@ int main(int argc, char *argv[]) ...@@ -114,7 +114,7 @@ int main(int argc, char *argv[])
clip_low = 0; clip_low = 0;
if ((noise_source = awgn_init_dbm0(NULL, idum, -15.0)) == NULL) if ((noise_source = awgn_init_dbm0(NULL, idum, -15.0)) == NULL)
{ {
printf("Failed to allocation AWGN source\n"); printf("Failed to allocate AWGN source\n");
exit(2); exit(2);
} }
total_samples = 10000000; total_samples = 10000000;
......
...@@ -232,7 +232,11 @@ static int check_rx_dcs(const uint8_t *msg, int len) ...@@ -232,7 +232,11 @@ static int check_rx_dcs(const uint8_t *msg, int len)
image_width = widths[(dcs_frame[8] & DISBIT3) ? 2 : 1][dcs_frame[5] & (DISBIT2 | DISBIT1)]; image_width = widths[(dcs_frame[8] & DISBIT3) ? 2 : 1][dcs_frame[5] & (DISBIT2 | DISBIT1)];
/* Check which compression we will use. */ /* Check which compression we will use. */
if ((dcs_frame[6] & DISBIT7)) if ((dcs_frame[12] & DISBIT7))
line_encoding = T4_COMPRESSION_T85_L0;
else if ((dcs_frame[12] & DISBIT6))
line_encoding = T4_COMPRESSION_T85;
else if ((dcs_frame[6] & DISBIT7))
line_encoding = T4_COMPRESSION_T6; line_encoding = T4_COMPRESSION_T6;
else if ((dcs_frame[4] & DISBIT8)) else if ((dcs_frame[4] & DISBIT8))
line_encoding = T4_COMPRESSION_T4_2D; line_encoding = T4_COMPRESSION_T4_2D;
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <ctype.h>
#if defined(HAVE_TGMATH_H) #if defined(HAVE_TGMATH_H)
#include <tgmath.h> #include <tgmath.h>
#endif #endif
...@@ -59,10 +60,102 @@ ...@@ -59,10 +60,102 @@
#include "spandsp.h" #include "spandsp.h"
#include "fax_utils.h"
#include "fax_tester.h" #include "fax_tester.h"
#define HDLC_FRAMING_OK_THRESHOLD 5 #define HDLC_FRAMING_OK_THRESHOLD 5
extern const char *output_tiff_file_name;
struct xml_node_parms_s
{
xmlChar *dir;
xmlChar *type;
xmlChar *modem;
xmlChar *value;
xmlChar *tag;
xmlChar *bad_rows;
xmlChar *crc_error;
xmlChar *pattern;
xmlChar *timein;
xmlChar *timeout;
xmlChar *min_bits;
xmlChar *frame_size;
xmlChar *block;
xmlChar *compression;
};
static struct
{
const char *tag;
int code;
} t30_status[] =
{
{"OK", T30_ERR_OK},
{"CEDTONE", T30_ERR_CEDTONE},
{"T0_EXPIRED", T30_ERR_T0_EXPIRED},
{"T1_EXPIRED", T30_ERR_T1_EXPIRED},
{"T3_EXPIRED", T30_ERR_T3_EXPIRED},
{"HDLC_CARRIER", T30_ERR_HDLC_CARRIER},
{"CANNOT_TRAIN", T30_ERR_CANNOT_TRAIN},
{"OPER_INT_FAIL", T30_ERR_OPER_INT_FAIL},
{"INCOMPATIBLE", T30_ERR_INCOMPATIBLE},
{"RX_INCAPABLE", T30_ERR_RX_INCAPABLE},
{"TX_INCAPABLE", T30_ERR_TX_INCAPABLE},
{"NORESSUPPORT", T30_ERR_NORESSUPPORT},
{"NOSIZESUPPORT", T30_ERR_NOSIZESUPPORT},
{"UNEXPECTED", T30_ERR_UNEXPECTED},
{"TX_BADDCS", T30_ERR_TX_BADDCS},
{"TX_BADPG", T30_ERR_TX_BADPG},
{"TX_ECMPHD", T30_ERR_TX_ECMPHD},
{"TX_GOTDCN", T30_ERR_TX_GOTDCN},
{"TX_INVALRSP", T30_ERR_TX_INVALRSP},
{"TX_NODIS", T30_ERR_TX_NODIS},
{"TX_PHBDEAD", T30_ERR_TX_PHBDEAD},
{"TX_PHDDEAD", T30_ERR_TX_PHDDEAD},
{"TX_T5EXP", T30_ERR_TX_T5EXP},
{"RX_ECMPHD", T30_ERR_RX_ECMPHD},
{"RX_GOTDCS", T30_ERR_RX_GOTDCS},
{"RX_INVALCMD", T30_ERR_RX_INVALCMD},
{"RX_NOCARRIER", T30_ERR_RX_NOCARRIER},
{"RX_NOEOL", T30_ERR_RX_NOEOL},
{"RX_NOFAX", T30_ERR_RX_NOFAX},
{"RX_T2EXPDCN", T30_ERR_RX_T2EXPDCN},
{"RX_T2EXPD", T30_ERR_RX_T2EXPD},
{"RX_T2EXPFAX", T30_ERR_RX_T2EXPFAX},
{"RX_T2EXPMPS", T30_ERR_RX_T2EXPMPS},
{"RX_T2EXPRR", T30_ERR_RX_T2EXPRR},
{"RX_T2EXP", T30_ERR_RX_T2EXP},
{"RX_DCNWHY", T30_ERR_RX_DCNWHY},
{"RX_DCNDATA", T30_ERR_RX_DCNDATA},
{"RX_DCNFAX", T30_ERR_RX_DCNFAX},
{"RX_DCNPHD", T30_ERR_RX_DCNPHD},
{"RX_DCNRRD", T30_ERR_RX_DCNRRD},
{"RX_DCNNORTN", T30_ERR_RX_DCNNORTN},
{"FILEERROR", T30_ERR_FILEERROR},
{"NOPAGE", T30_ERR_NOPAGE},
{"BADTIFF", T30_ERR_BADTIFF},
{"BADPAGE", T30_ERR_BADPAGE},
{"BADTAG", T30_ERR_BADTAG},
{"BADTIFFHDR", T30_ERR_BADTIFFHDR},
{"NOMEM", T30_ERR_NOMEM},
{"RETRYDCN", T30_ERR_RETRYDCN},
{"CALLDROPPED", T30_ERR_CALLDROPPED},
{"NOPOLL", T30_ERR_NOPOLL},
{"IDENT_UNACCEPTABLE", T30_ERR_IDENT_UNACCEPTABLE},
{"SUB_UNACCEPTABLE", T30_ERR_SUB_UNACCEPTABLE},
{"SEP_UNACCEPTABLE", T30_ERR_SEP_UNACCEPTABLE},
{"PSA_UNACCEPTABLE", T30_ERR_PSA_UNACCEPTABLE},
{"SID_UNACCEPTABLE", T30_ERR_SID_UNACCEPTABLE},
{"PWD_UNACCEPTABLE", T30_ERR_PWD_UNACCEPTABLE},
{"TSA_UNACCEPTABLE", T30_ERR_TSA_UNACCEPTABLE},
{"IRA_UNACCEPTABLE", T30_ERR_IRA_UNACCEPTABLE},
{"CIA_UNACCEPTABLE", T30_ERR_CIA_UNACCEPTABLE},
{"ISP_UNACCEPTABLE", T30_ERR_ISP_UNACCEPTABLE},
{"CSA_UNACCEPTABLE", T30_ERR_CSA_UNACCEPTABLE},
{NULL, -1}
};
static void timer_update(faxtester_state_t *s, int len) static void timer_update(faxtester_state_t *s, int len)
{ {
s->timer += len; s->timer += len;
......
...@@ -90,7 +90,7 @@ uint8_t unpacked[MAX_TEST_VECTOR_LEN]; ...@@ -90,7 +90,7 @@ uint8_t unpacked[MAX_TEST_VECTOR_LEN];
uint8_t xlaw[MAX_TEST_VECTOR_LEN]; uint8_t xlaw[MAX_TEST_VECTOR_LEN];
/* /*
Table 4 - V Reset and homing sequences for u-law Table 4 - Reset and homing sequences for u-law
Normal I-input Overload Normal I-input Overload
Algorithm Input Intermediate Output Input Output Input Intermediate Output Algorithm Input Intermediate Output Input Output Input Intermediate Output
(PCM) (ADPCM) (PCM) (ADPCM) (PCM) (PCM) (ADPCM) (PCM) (PCM) (ADPCM) (PCM) (ADPCM) (PCM) (PCM) (ADPCM) (PCM)
...@@ -108,7 +108,7 @@ Algorithm Input Intermediate Output Input Output Input ...@@ -108,7 +108,7 @@ Algorithm Input Intermediate Output Input Output Input
HN40FM.I HN40FM.O HI40FM.O HV40FM.I HV40FM.O HN40FM.I HN40FM.O HI40FM.O HV40FM.I HV40FM.O
Table 5 - V Reset and homing sequences for A-law Table 5 - Reset and homing sequences for A-law
Normal I-input Overload Normal I-input Overload
Algorithm Input Intermediate Output Input Output Input Intermediate Output Algorithm Input Intermediate Output Input Output Input Intermediate Output
(PCM) (ADPCM) (PCM) (ADPCM) (PCM) (PCM) (ADPCM) (PCM) (PCM) (ADPCM) (PCM) (ADPCM) (PCM) (PCM) (ADPCM) (PCM)
......
...@@ -275,7 +275,6 @@ int main(int argc, char *argv[]) ...@@ -275,7 +275,6 @@ int main(int argc, char *argv[])
} }
} }
oki_adpcm_free(oki_enc_state); oki_adpcm_free(oki_enc_state);
if (sf_close_telephony(inhandle)) if (sf_close_telephony(inhandle))
{ {
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include "spandsp.h" #include "spandsp.h"
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
#include <tif_dir.h> #include <tif_dir.h>
#endif #endif
...@@ -157,7 +157,7 @@ int main(int argc, char *argv[]) ...@@ -157,7 +157,7 @@ int main(int argc, char *argv[])
logging = span_log_init(NULL, SPAN_LOG_FLOW, "T.42"); logging = span_log_init(NULL, SPAN_LOG_FLOW, "T.42");
#endif #endif
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
TIFF_FX_init(); TIFF_FX_init();
#endif #endif
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include "spandsp.h" #include "spandsp.h"
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
#include <tif_dir.h> #include <tif_dir.h>
#endif #endif
...@@ -63,7 +63,7 @@ typedef struct ...@@ -63,7 +63,7 @@ typedef struct
int ptr; int ptr;
} packer_t; } packer_t;
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
/* TIFF-FX related extensions to the tag set supported by libtiff */ /* TIFF-FX related extensions to the tag set supported by libtiff */
static const TIFFFieldInfo tiff_fx_tiff_field_info[] = static const TIFFFieldInfo tiff_fx_tiff_field_info[] =
{ {
...@@ -184,7 +184,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[]) ...@@ -184,7 +184,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[])
uint8_t *out_buf; uint8_t *out_buf;
uint8_t *out_buf2; uint8_t *out_buf2;
packer_t packer; packer_t packer;
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
toff_t diroff; toff_t diroff;
#endif #endif
...@@ -222,7 +222,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[]) ...@@ -222,7 +222,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[])
TIFFSetField(tif, TIFFTAG_MAKE, "soft-switch.org"); TIFFSetField(tif, TIFFTAG_MAKE, "soft-switch.org");
TIFFSetField(tif, TIFFTAG_MODEL, "spandsp"); TIFFSetField(tif, TIFFTAG_MODEL, "spandsp");
TIFFSetField(tif, TIFFTAG_HOSTCOMPUTER, "i7.coppice.org"); TIFFSetField(tif, TIFFTAG_HOSTCOMPUTER, "i7.coppice.org");
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
/* Make space for this to be filled in later */ /* Make space for this to be filled in later */
TIFFSetField(tif, TIFFTAG_GLOBALPARAMETERSIFD, 0); TIFFSetField(tif, TIFFTAG_GLOBALPARAMETERSIFD, 0);
#endif #endif
...@@ -310,7 +310,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[]) ...@@ -310,7 +310,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[])
if (!TIFFWriteDirectory(tif)) if (!TIFFWriteDirectory(tif))
printf("Failed to write directory.\n"); printf("Failed to write directory.\n");
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
if (!TIFFCreateCustomDirectory(tif, &tiff_fx_field_array)) if (!TIFFCreateCustomDirectory(tif, &tiff_fx_field_array))
{ {
TIFFSetField(tif, TIFFTAG_PROFILETYPE, PROFILETYPE_G3_FAX); TIFFSetField(tif, TIFFTAG_PROFILETYPE, PROFILETYPE_G3_FAX);
...@@ -337,7 +337,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[]) ...@@ -337,7 +337,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[])
int read_file(meta_t *meta, int page) int read_file(meta_t *meta, int page)
{ {
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
static const char *tiff_fx_fax_profiles[] = static const char *tiff_fx_fax_profiles[] =
{ {
"???", "???",
...@@ -419,7 +419,7 @@ int read_file(meta_t *meta, int page) ...@@ -419,7 +419,7 @@ int read_file(meta_t *meta, int page)
meta->bmax = 0.0f; meta->bmax = 0.0f;
break; break;
} }
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
if (TIFFGetField(tif, TIFFTAG_DECODE, &parm16, &fl_parms)) if (TIFFGetField(tif, TIFFTAG_DECODE, &parm16, &fl_parms))
{ {
meta->lmin = fl_parms[0]; meta->lmin = fl_parms[0];
...@@ -432,7 +432,7 @@ int read_file(meta_t *meta, int page) ...@@ -432,7 +432,7 @@ int read_file(meta_t *meta, int page)
} }
#endif #endif
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
printf("Trying to get global parameters\n"); printf("Trying to get global parameters\n");
if (TIFFGetField(tif, TIFFTAG_GLOBALPARAMETERSIFD, &diroff)) if (TIFFGetField(tif, TIFFTAG_GLOBALPARAMETERSIFD, &diroff))
{ {
...@@ -891,7 +891,7 @@ int main(int argc, char *argv[]) ...@@ -891,7 +891,7 @@ int main(int argc, char *argv[])
meta_t meta; meta_t meta;
int output_compression; int output_compression;
int page_no; int page_no;
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
toff_t diroff; toff_t diroff;
#endif #endif
...@@ -900,7 +900,7 @@ int main(int argc, char *argv[]) ...@@ -900,7 +900,7 @@ int main(int argc, char *argv[])
destination_file = OUT_FILE_NAME; destination_file = OUT_FILE_NAME;
output_compression = (argc > 2) ? atoi(argv[2]) : COMPRESSION_CCITT_T6; output_compression = (argc > 2) ? atoi(argv[2]) : COMPRESSION_CCITT_T6;
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
TIFF_FX_init(); TIFF_FX_init();
#endif #endif
...@@ -1305,7 +1305,7 @@ int main(int argc, char *argv[]) ...@@ -1305,7 +1305,7 @@ int main(int argc, char *argv[])
TIFFSetField(tif, TIFFTAG_MAKE, "soft-switch.org"); TIFFSetField(tif, TIFFTAG_MAKE, "soft-switch.org");
TIFFSetField(tif, TIFFTAG_MODEL, "spandsp"); TIFFSetField(tif, TIFFTAG_MODEL, "spandsp");
TIFFSetField(tif, TIFFTAG_HOSTCOMPUTER, "i7.coppice.org"); TIFFSetField(tif, TIFFTAG_HOSTCOMPUTER, "i7.coppice.org");
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
/* Make space for this to be filled in later */ /* Make space for this to be filled in later */
TIFFSetField(tif, TIFFTAG_GLOBALPARAMETERSIFD, 0); TIFFSetField(tif, TIFFTAG_GLOBALPARAMETERSIFD, 0);
#endif #endif
...@@ -1379,7 +1379,7 @@ int main(int argc, char *argv[]) ...@@ -1379,7 +1379,7 @@ int main(int argc, char *argv[])
if (!TIFFWriteDirectory(tif)) if (!TIFFWriteDirectory(tif))
printf("Failed to write directory.\n"); printf("Failed to write directory.\n");
#if defined(SPANDSP_SUPPORT_TIFF_FX) #if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
if (!TIFFCreateCustomDirectory(tif, &tiff_fx_field_array)) if (!TIFFCreateCustomDirectory(tif, &tiff_fx_field_array))
{ {
TIFFSetField(tif, TIFFTAG_PROFILETYPE, PROFILETYPE_G3_FAX); TIFFSetField(tif, TIFFTAG_PROFILETYPE, PROFILETYPE_G3_FAX);
......
...@@ -65,6 +65,8 @@ int main(int argc, char *argv[]) ...@@ -65,6 +65,8 @@ int main(int argc, char *argv[])
int out_frames; int out_frames;
int count; int count;
int max; int max;
int samples_in;
int samples_out;
time_scale_state_t state; time_scale_state_t state;
float rate; float rate;
float sample_rate; float sample_rate;
...@@ -129,9 +131,19 @@ int main(int argc, char *argv[]) ...@@ -129,9 +131,19 @@ int main(int argc, char *argv[])
max = time_scale_max_output_len(&state, BLOCK_LEN); max = time_scale_max_output_len(&state, BLOCK_LEN);
printf("Rate is %f, longest output block is %d\n", rate, max); printf("Rate is %f, longest output block is %d\n", rate, max);
count = 0; count = 0;
samples_in = 0;
samples_out = 0;
while ((frames = sf_readf_short(inhandle, in, BLOCK_LEN))) while ((frames = sf_readf_short(inhandle, in, BLOCK_LEN)))
{ {
samples_in += frames;
new_frames = time_scale(&state, out, in, frames); new_frames = time_scale(&state, out, in, frames);
if (new_frames > max)
{
printf("Generated signal has more than the expected maximum samples - %d vs %d\n", new_frames, max);
printf("Tests failed\n");
exit(2);
}
samples_out += new_frames;
out_frames = sf_writef_short(outhandle, out, new_frames); out_frames = sf_writef_short(outhandle, out, new_frames);
if (out_frames != new_frames) if (out_frames != new_frames)
{ {
...@@ -152,7 +164,27 @@ int main(int argc, char *argv[]) ...@@ -152,7 +164,27 @@ int main(int argc, char *argv[])
count = 0; count = 0;
} }
} }
new_frames = time_scale_flush(&state, out);
if (new_frames > max)
{
printf("Generated signal has more than the expected maximum samples - %d vs %d\n", new_frames, max);
printf("Tests failed\n");
exit(2);
}
samples_out += new_frames;
out_frames = sf_writef_short(outhandle, out, new_frames);
if (out_frames != new_frames)
{
fprintf(stderr, " Error writing audio file\n");
exit(2);
}
time_scale_release(&state); time_scale_release(&state);
if ((int) (rate*samples_in) < samples_out - 1 || (int) (rate*samples_in) > samples_out + 1)
{
printf("%d samples became %d samples\n", (int) (rate*samples_in), samples_out);
printf("Tests failed\n");
exit(2);
}
if (sf_close(inhandle)) if (sf_close(inhandle))
{ {
printf(" Cannot close audio file '%s'\n", in_file_name); printf(" Cannot close audio file '%s'\n", in_file_name);
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
run_tsb85_test() run_tsb85_test()
{ {
rm -f fax_tests_1.tif rm -f tsb85_tests.tif
echo ./tsb85_tests ${TEST} echo ./tsb85_tests ${TEST}
./tsb85_tests -x ../spandsp/fax-tests.xml ${TEST} 2>xyzzy2 ./tsb85_tests -x ../spandsp/fax-tests.xml ${TEST} 2>xyzzy2
RETVAL=$? RETVAL=$?
...@@ -28,7 +28,7 @@ run_tsb85_test() ...@@ -28,7 +28,7 @@ run_tsb85_test()
fi fi
} }
for TEST in PPS-MPS-lost-PPS V17-12000-V29-9600 Phase-D-collision Modem-change-at-CTC for TEST in PPS-MPS-lost-PPS V17-12000-V29-9600 Phase-D-collision Modem-change-at-CTC ECM-DCN-clipped Non-ECM-DCN-clipped
do do
run_tsb85_test run_tsb85_test
done done
...@@ -60,8 +60,8 @@ ...@@ -60,8 +60,8 @@
#include "spandsp.h" #include "spandsp.h"
#include "spandsp-sim.h" #include "spandsp-sim.h"
#include "fax_tester.h"
#include "fax_utils.h" #include "fax_utils.h"
#include "fax_tester.h"
#define OUTPUT_TIFF_FILE_NAME "tsb85.tif" #define OUTPUT_TIFF_FILE_NAME "tsb85.tif"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
run_tsb85_test() run_tsb85_test()
{ {
rm -f fax_tests_1.tif rm -f tsb85_tests.tif
echo ./tsb85_tests ${TEST} echo ./tsb85_tests ${TEST}
./tsb85_tests ${TEST} 2>xyzzy2 ./tsb85_tests ${TEST} 2>xyzzy2
RETVAL=$? RETVAL=$?
...@@ -33,11 +33,6 @@ do ...@@ -33,11 +33,6 @@ do
run_tsb85_test run_tsb85_test
done done
#MRGN14 fails because we don't adequately distinguish between receiving a
#bad image signal and receiving none at all.
#MRGN16 fails because we don't adequately distinguish between receiving a
#bad image signal and receiving none at all.
for TEST in MRGN09 MRGN10 MRGN11 MRGN12 MRGN13 MRGN14 MRGN15 MRGN16 MRGN17 for TEST in MRGN09 MRGN10 MRGN11 MRGN12 MRGN13 MRGN14 MRGN15 MRGN16 MRGN17
do do
run_tsb85_test run_tsb85_test
...@@ -53,10 +48,6 @@ do ...@@ -53,10 +48,6 @@ do
run_tsb85_test run_tsb85_test
done done
# MRGX03 is failing because the V.27ter modem says it trained on HDLC
# MRGX05 is failing because we don't distinguish MPS immediately after MCF from MPS after
# a corrupt image signal.
for TEST in MRGX01 MRGX02 MRGX03 MRGX04 MRGX05 MRGX06 MRGX07 MRGX08 for TEST in MRGX01 MRGX02 MRGX03 MRGX04 MRGX05 MRGX06 MRGX07 MRGX08
do do
run_tsb85_test run_tsb85_test
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论