diff --git a/libs/spandsp/spandsp/fax-tests.dtd b/libs/spandsp/spandsp/fax-tests.dtd
index 39f97febaa..8299ecbb34 100644
--- a/libs/spandsp/spandsp/fax-tests.dtd
+++ b/libs/spandsp/spandsp/fax-tests.dtd
@@ -19,12 +19,16 @@
name CDATA #IMPLIED
>
-
+
-
+
+
diff --git a/libs/spandsp/spandsp/fax-tests.xml b/libs/spandsp/spandsp/fax-tests.xml
index fcb3b6be5f..9a51464088 100644
--- a/libs/spandsp/spandsp/fax-tests.xml
+++ b/libs/spandsp/spandsp/fax-tests.xml
@@ -147,7 +147,7 @@
-
+
@@ -155,7 +155,7 @@
-
+
@@ -169,7 +169,7 @@
-
+
@@ -177,7 +177,7 @@
-
+
@@ -200,6 +200,7 @@
+
@@ -261,7 +262,7 @@
-
+
@@ -269,7 +270,7 @@
-
+
@@ -283,7 +284,7 @@
-
+
@@ -291,7 +292,7 @@
-
+
@@ -305,7 +306,7 @@
-
+
@@ -313,7 +314,7 @@
-
+
@@ -327,7 +328,7 @@
-
+
@@ -335,7 +336,7 @@
-
+
@@ -357,7 +358,7 @@
-
+
@@ -365,7 +366,7 @@
-
+
@@ -375,6 +376,105 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/libs/spandsp/spandsp/tsb85.xml b/libs/spandsp/spandsp/tsb85.xml
index a711100916..c72a863151 100644
--- a/libs/spandsp/spandsp/tsb85.xml
+++ b/libs/spandsp/spandsp/tsb85.xml
@@ -26,7 +26,7 @@
-
+
@@ -171,7 +171,7 @@
-
+
@@ -183,7 +183,7 @@
-
+
@@ -239,7 +239,7 @@
-
+
@@ -255,7 +255,7 @@
-
+
@@ -493,9 +493,9 @@
-
-
-
+
+
+
@@ -507,7 +507,7 @@
-
+
@@ -1356,7 +1356,7 @@
-
+
@@ -1364,7 +1364,7 @@
-
+
@@ -1378,7 +1378,7 @@
-
+
@@ -1386,7 +1386,7 @@
-
+
@@ -1491,7 +1491,7 @@
-
+
@@ -1499,7 +1499,7 @@
-
+
@@ -1539,7 +1539,7 @@
-
+
@@ -1547,7 +1547,7 @@
-
+
@@ -1561,7 +1561,7 @@
-
+
@@ -1569,7 +1569,7 @@
-
+
@@ -1583,7 +1583,7 @@
-
+
@@ -1591,7 +1591,7 @@
-
+
@@ -1605,7 +1605,7 @@
-
+
@@ -1613,7 +1613,7 @@
-
+
@@ -1635,7 +1635,7 @@
-
+
@@ -1643,7 +1643,7 @@
-
+
@@ -1686,7 +1686,7 @@
-
+
@@ -1694,7 +1694,7 @@
-
+
@@ -1708,7 +1708,7 @@
-
+
@@ -1716,7 +1716,7 @@
-
+
@@ -1730,7 +1730,7 @@
-
+
@@ -1738,7 +1738,7 @@
-
+
@@ -1752,7 +1752,7 @@
-
+
@@ -1760,7 +1760,7 @@
-
+
@@ -1782,7 +1782,7 @@
-
+
@@ -1790,7 +1790,7 @@
-
+
@@ -1833,7 +1833,7 @@
-
+
@@ -1841,7 +1841,7 @@
-
+
@@ -1855,7 +1855,7 @@
-
+
@@ -1863,7 +1863,7 @@
-
+
@@ -1877,7 +1877,7 @@
-
+
@@ -1885,7 +1885,7 @@
-
+
@@ -1899,7 +1899,7 @@
-
+
@@ -1907,7 +1907,7 @@
-
+
@@ -1921,7 +1921,7 @@
-
+
@@ -1929,7 +1929,7 @@
-
+
@@ -1980,7 +1980,7 @@
-
+
@@ -1988,7 +1988,7 @@
-
+
@@ -2002,7 +2002,7 @@
-
+
@@ -2010,7 +2010,7 @@
-
+
@@ -2024,7 +2024,7 @@
-
+
@@ -2032,7 +2032,7 @@
-
+
@@ -2046,7 +2046,7 @@
-
+
@@ -2054,7 +2054,7 @@
-
+
@@ -2076,7 +2076,7 @@
-
+
@@ -2084,7 +2084,7 @@
-
+
@@ -2126,7 +2126,7 @@
-
+
@@ -2134,7 +2134,7 @@
-
+
@@ -2148,7 +2148,7 @@
-
+
@@ -2156,7 +2156,7 @@
-
+
@@ -2170,7 +2170,7 @@
-
+
@@ -2178,7 +2178,7 @@
-
+
@@ -2192,7 +2192,7 @@
-
+
@@ -2200,7 +2200,7 @@
-
+
@@ -2251,7 +2251,7 @@
-
+
@@ -2259,7 +2259,7 @@
-
+
@@ -2273,7 +2273,7 @@
-
+
@@ -2281,7 +2281,7 @@
-
+
@@ -5456,166 +5456,14 @@
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -6755,12 +6603,12 @@
-
+
-
-
-
+
+
+
@@ -6770,12 +6618,12 @@
-
+
-
-
-
+
+
+
@@ -6785,10 +6633,10 @@
-
-
-
-
+
+
+
+
@@ -6805,7 +6653,7 @@
-
+
@@ -6817,7 +6665,7 @@
-
+
@@ -6870,7 +6718,7 @@
-
+
@@ -6894,7 +6742,7 @@
-
+
@@ -6909,7 +6757,7 @@
-
+
@@ -6919,7 +6767,7 @@
-
+
@@ -6942,7 +6790,7 @@
-
+
@@ -6993,7 +6841,7 @@
-
+
@@ -7016,7 +6864,7 @@
-
+
@@ -7061,7 +6909,7 @@
-
+
@@ -7123,7 +6971,7 @@
-
+
diff --git a/libs/spandsp/tests/ademco_contactid_tests.c b/libs/spandsp/tests/ademco_contactid_tests.c
index b1c9c4f42d..4071999d03 100644
--- a/libs/spandsp/tests/ademco_contactid_tests.c
+++ b/libs/spandsp/tests/ademco_contactid_tests.c
@@ -149,7 +149,7 @@ static void rx_callback(void *user_data, const ademco_contactid_report_t *report
printf(" Event %X\n", report->xyz);
printf(" Group/partition %X\n", report->gg);
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");
exit(2);
diff --git a/libs/spandsp/tests/awgn_tests.c b/libs/spandsp/tests/awgn_tests.c
index c105a9b243..09e7884e33 100644
--- a/libs/spandsp/tests/awgn_tests.c
+++ b/libs/spandsp/tests/awgn_tests.c
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
total = 0.0;
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);
}
total_samples = 1000000;
@@ -114,7 +114,7 @@ int main(int argc, char *argv[])
clip_low = 0;
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);
}
total_samples = 10000000;
diff --git a/libs/spandsp/tests/fax_decode.c b/libs/spandsp/tests/fax_decode.c
index 7b624bd6f8..e67d32a120 100644
--- a/libs/spandsp/tests/fax_decode.c
+++ b/libs/spandsp/tests/fax_decode.c
@@ -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)];
/* 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;
else if ((dcs_frame[4] & DISBIT8))
line_encoding = T4_COMPRESSION_T4_2D;
diff --git a/libs/spandsp/tests/fax_tester.c b/libs/spandsp/tests/fax_tester.c
index 4cd85d68a7..fb5dcc1ac1 100644
--- a/libs/spandsp/tests/fax_tester.c
+++ b/libs/spandsp/tests/fax_tester.c
@@ -33,6 +33,7 @@
#include
#include
#include
+#include
#if defined(HAVE_TGMATH_H)
#include
#endif
@@ -59,10 +60,102 @@
#include "spandsp.h"
+#include "fax_utils.h"
#include "fax_tester.h"
#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)
{
s->timer += len;
diff --git a/libs/spandsp/tests/g726_tests.c b/libs/spandsp/tests/g726_tests.c
index 75d1a542cd..45f64c228a 100644
--- a/libs/spandsp/tests/g726_tests.c
+++ b/libs/spandsp/tests/g726_tests.c
@@ -90,7 +90,7 @@ uint8_t unpacked[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
Algorithm Input Intermediate Output Input Output Input Intermediate Output
(PCM) (ADPCM) (PCM) (ADPCM) (PCM) (PCM) (ADPCM) (PCM)
@@ -108,7 +108,7 @@ Algorithm Input Intermediate Output Input Output Input
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
Algorithm Input Intermediate Output Input Output Input Intermediate Output
(PCM) (ADPCM) (PCM) (ADPCM) (PCM) (PCM) (ADPCM) (PCM)
diff --git a/libs/spandsp/tests/oki_adpcm_tests.c b/libs/spandsp/tests/oki_adpcm_tests.c
index 84604b69be..a9eef7e1ae 100644
--- a/libs/spandsp/tests/oki_adpcm_tests.c
+++ b/libs/spandsp/tests/oki_adpcm_tests.c
@@ -275,7 +275,6 @@ int main(int argc, char *argv[])
}
}
-
oki_adpcm_free(oki_enc_state);
if (sf_close_telephony(inhandle))
{
diff --git a/libs/spandsp/tests/t42_tests.c b/libs/spandsp/tests/t42_tests.c
index d9f80da5b5..fd42133dfd 100644
--- a/libs/spandsp/tests/t42_tests.c
+++ b/libs/spandsp/tests/t42_tests.c
@@ -43,7 +43,7 @@
#include "spandsp.h"
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
#include
#endif
@@ -157,7 +157,7 @@ int main(int argc, char *argv[])
logging = span_log_init(NULL, SPAN_LOG_FLOW, "T.42");
#endif
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
TIFF_FX_init();
#endif
diff --git a/libs/spandsp/tests/t43_tests.c b/libs/spandsp/tests/t43_tests.c
index 3df17ea7f2..dff6bc1978 100644
--- a/libs/spandsp/tests/t43_tests.c
+++ b/libs/spandsp/tests/t43_tests.c
@@ -43,7 +43,7 @@
#include "spandsp.h"
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
#include
#endif
@@ -63,7 +63,7 @@ typedef struct
int ptr;
} 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 */
static const TIFFFieldInfo tiff_fx_tiff_field_info[] =
{
@@ -184,7 +184,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[])
uint8_t *out_buf;
uint8_t *out_buf2;
packer_t packer;
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
toff_t diroff;
#endif
@@ -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_MODEL, "spandsp");
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 */
TIFFSetField(tif, TIFFTAG_GLOBALPARAMETERSIFD, 0);
#endif
@@ -310,7 +310,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[])
if (!TIFFWriteDirectory(tif))
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))
{
TIFFSetField(tif, TIFFTAG_PROFILETYPE, PROFILETYPE_G3_FAX);
@@ -337,7 +337,7 @@ int write_file(meta_t *meta, int page, const uint8_t buf[])
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[] =
{
"???",
@@ -419,7 +419,7 @@ int read_file(meta_t *meta, int page)
meta->bmax = 0.0f;
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))
{
meta->lmin = fl_parms[0];
@@ -432,7 +432,7 @@ int read_file(meta_t *meta, int page)
}
#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");
if (TIFFGetField(tif, TIFFTAG_GLOBALPARAMETERSIFD, &diroff))
{
@@ -891,7 +891,7 @@ int main(int argc, char *argv[])
meta_t meta;
int output_compression;
int page_no;
-#if defined(SPANDSP_SUPPORT_TIFF_FX)
+#if defined(SPANDSP_SUPPORT_TIFF_FX) && defined(HAVE_TIF_DIR_H)
toff_t diroff;
#endif
@@ -900,7 +900,7 @@ int main(int argc, char *argv[])
destination_file = OUT_FILE_NAME;
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();
#endif
@@ -1305,7 +1305,7 @@ int main(int argc, char *argv[])
TIFFSetField(tif, TIFFTAG_MAKE, "soft-switch.org");
TIFFSetField(tif, TIFFTAG_MODEL, "spandsp");
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 */
TIFFSetField(tif, TIFFTAG_GLOBALPARAMETERSIFD, 0);
#endif
@@ -1379,7 +1379,7 @@ int main(int argc, char *argv[])
if (!TIFFWriteDirectory(tif))
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))
{
TIFFSetField(tif, TIFFTAG_PROFILETYPE, PROFILETYPE_G3_FAX);
diff --git a/libs/spandsp/tests/time_scale_tests.c b/libs/spandsp/tests/time_scale_tests.c
index abd5300fdf..4e902c2eae 100644
--- a/libs/spandsp/tests/time_scale_tests.c
+++ b/libs/spandsp/tests/time_scale_tests.c
@@ -65,6 +65,8 @@ int main(int argc, char *argv[])
int out_frames;
int count;
int max;
+ int samples_in;
+ int samples_out;
time_scale_state_t state;
float rate;
float sample_rate;
@@ -129,9 +131,19 @@ int main(int argc, char *argv[])
max = time_scale_max_output_len(&state, BLOCK_LEN);
printf("Rate is %f, longest output block is %d\n", rate, max);
count = 0;
+ samples_in = 0;
+ samples_out = 0;
while ((frames = sf_readf_short(inhandle, in, BLOCK_LEN)))
{
+ samples_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);
if (out_frames != new_frames)
{
@@ -152,7 +164,27 @@ int main(int argc, char *argv[])
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);
+ 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))
{
printf(" Cannot close audio file '%s'\n", in_file_name);
diff --git a/libs/spandsp/tests/tsb85_extra_tests.sh b/libs/spandsp/tests/tsb85_extra_tests.sh
index 7b6a52d46f..8e401d41ad 100755
--- a/libs/spandsp/tests/tsb85_extra_tests.sh
+++ b/libs/spandsp/tests/tsb85_extra_tests.sh
@@ -17,7 +17,7 @@
run_tsb85_test()
{
- rm -f fax_tests_1.tif
+ rm -f tsb85_tests.tif
echo ./tsb85_tests ${TEST}
./tsb85_tests -x ../spandsp/fax-tests.xml ${TEST} 2>xyzzy2
RETVAL=$?
@@ -28,7 +28,7 @@ run_tsb85_test()
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
run_tsb85_test
done
diff --git a/libs/spandsp/tests/tsb85_tests.c b/libs/spandsp/tests/tsb85_tests.c
index 4c1559c5dc..624dcb1f6c 100644
--- a/libs/spandsp/tests/tsb85_tests.c
+++ b/libs/spandsp/tests/tsb85_tests.c
@@ -60,8 +60,8 @@
#include "spandsp.h"
#include "spandsp-sim.h"
-#include "fax_tester.h"
#include "fax_utils.h"
+#include "fax_tester.h"
#define OUTPUT_TIFF_FILE_NAME "tsb85.tif"
diff --git a/libs/spandsp/tests/tsb85_tests.sh b/libs/spandsp/tests/tsb85_tests.sh
index ed39b1c524..f20bbfaa97 100755
--- a/libs/spandsp/tests/tsb85_tests.sh
+++ b/libs/spandsp/tests/tsb85_tests.sh
@@ -17,7 +17,7 @@
run_tsb85_test()
{
- rm -f fax_tests_1.tif
+ rm -f tsb85_tests.tif
echo ./tsb85_tests ${TEST}
./tsb85_tests ${TEST} 2>xyzzy2
RETVAL=$?
@@ -33,11 +33,6 @@ do
run_tsb85_test
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
do
run_tsb85_test
@@ -53,10 +48,6 @@ do
run_tsb85_test
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
do
run_tsb85_test