From 8b8b91beebfad6b994e47a11ccf680690a1bc0ee Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sun, 1 Sep 2013 00:36:48 +0800 Subject: [PATCH] Tweaks to spandsp configuration --- libs/spandsp/Makefile.am | 3 +- libs/spandsp/configure.ac | 56 +++--- libs/spandsp/spandsp.spec | 4 +- libs/spandsp/src/Makefile.am | 14 +- libs/spandsp/src/fax.c | 4 - libs/spandsp/src/image_translate.c | 4 - libs/spandsp/src/spandsp.h.in | 13 +- libs/spandsp/src/spandsp/expose.h | 6 + libs/spandsp/src/spandsp/private/t4_rx.h | 2 - libs/spandsp/src/spandsp/private/t4_tx.h | 2 - libs/spandsp/src/spandsp/t4_tx.h | 3 +- libs/spandsp/src/t30.c | 19 +- libs/spandsp/src/t30_api.c | 26 ++- libs/spandsp/src/t30_logging.c | 4 - libs/spandsp/src/t38_gateway.c | 4 - libs/spandsp/src/t38_terminal.c | 4 - libs/spandsp/src/t4_rx.c | 31 +-- libs/spandsp/src/t4_t6_decode.c | 4 - libs/spandsp/src/t4_t6_encode.c | 4 - libs/spandsp/src/t4_tx.c | 64 ++---- libs/spandsp/tests/Makefile.am | 36 +++- libs/spandsp/tests/alloc_tests.c | 7 +- libs/spandsp/tests/fax_tests.c | 43 +++- libs/spandsp/tests/fax_tests.sh | 51 +++-- libs/spandsp/tests/pseudo_terminal_tests.c | 185 ++++++++++++++++++ libs/spandsp/tests/pseudo_terminals.c | 3 +- libs/spandsp/tests/pseudo_terminals_tests.c | 71 ------- .../spandsp/tests/t31_pseudo_terminal_tests.c | 2 - libs/spandsp/tests/t38_decode.c | 62 +++++- libs/spandsp/tests/t42_tests.c | 10 +- libs/spandsp/tests/t4_tests.c | 4 - libs/spandsp/yum-prepare.sh | 26 +++ 32 files changed, 472 insertions(+), 299 deletions(-) create mode 100644 libs/spandsp/tests/pseudo_terminal_tests.c delete mode 100644 libs/spandsp/tests/pseudo_terminals_tests.c create mode 100644 libs/spandsp/yum-prepare.sh diff --git a/libs/spandsp/Makefile.am b/libs/spandsp/Makefile.am index 3eaddfc7a1..6902c867c5 100644 --- a/libs/spandsp/Makefile.am +++ b/libs/spandsp/Makefile.am @@ -47,7 +47,8 @@ EXTRA_DIST = autogen.sh \ unpack_g726_data.sh \ unpack_gsm0610_data.sh \ unpack_v56ter_data.sh \ - wrapper.xsl + wrapper.xsl \ + yum-prepare.sh if COND_DOC MAYBE_DOC=doc diff --git a/libs/spandsp/configure.ac b/libs/spandsp/configure.ac index 13e31152a4..b28cf25f3c 100644 --- a/libs/spandsp/configure.ac +++ b/libs/spandsp/configure.ac @@ -19,7 +19,7 @@ # @start 1 AC_PREREQ([2.59]) -AC_INIT([spandsp], [0.0.7]) +AC_INIT([spandsp], [1.99.0]) SPANDSP_LT_CURRENT=3 SPANDSP_LT_REVISION=0 @@ -265,15 +265,6 @@ then esac fi -AC_DEFINE([SPANDSP_SUPPORT_T42], [1], [Support T.42 JPEG compression]) -SPANDSP_SUPPORT_T42="#define SPANDSP_SUPPORT_T42 1" -AC_DEFINE([SPANDSP_SUPPORT_T43], [1], [Support T.43 JBIG gray and colour compression]) -SPANDSP_SUPPORT_T43="#define SPANDSP_SUPPORT_T43 1" -#AC_DEFINE([SPANDSP_SUPPORT_V32BIS], [1], [Support the V.32bis modem]) -SPANDSP_SUPPORT_V32BIS="#undef SPANDSP_SUPPORT_V32BIS" -#AC_DEFINE([SPANDSP_SUPPORT_V34], [1], [Support the V.34 FAX modem]) -SPANDSP_SUPPORT_V34="#undef SPANDSP_SUPPORT_V34" - AC_CHECK_LIB([m], [cos]) # Some platforms still seem to lack the basic single precision trig and power related functions. AC_SEARCH_LIBS([sinf], [m], AC_DEFINE([HAVE_SINF], [1], [Define to 1 if you have the sinf() function.])) @@ -524,21 +515,6 @@ x86_64-* | i386-* | i686-*) ;; esac -AM_CONDITIONAL([COND_DOC], [test "$enable_doc" = yes]) -AM_CONDITIONAL([COND_TESTS], [test "$enable_tests" = yes]) -AM_CONDITIONAL([COND_MMX], [test "$enable_mmx" = yes]) -AM_CONDITIONAL([COND_SSE], [test "$enable_sse" = yes]) -AM_CONDITIONAL([COND_SSE2], [test "$enable_sse2" = yes]) -AM_CONDITIONAL([COND_SSE3], [test "$enable_sse3" = yes]) -AM_CONDITIONAL([COND_SSSE3], [test "$enable_ssse3" = yes]) -AM_CONDITIONAL([COND_SSE4_1], [test "$enable_sse4_1" = yes]) -AM_CONDITIONAL([COND_SSE4_2], [test "$enable_sse4_2" = yes]) -AM_CONDITIONAL([COND_SSE4A], [test "$enable_sse4a" = yes]) -AM_CONDITIONAL([COND_SSE5], [test "$enable_sse5" = yes]) -AM_CONDITIONAL([COND_AVX], [test "$enable_avx" = yes]) -AM_CONDITIONAL([COND_AVX2], [test "$enable_avx2" = yes]) -AM_CONDITIONAL([COND_NEON], [test "$enable_neon" = yes]) - if test "$enable_builtin_tiff" = "yes" ; then abs_tiffdir="`cd $srcdir/../tiff-4.0.2/ && pwd`" save_CFLAGS=$CFLAGS @@ -553,9 +529,7 @@ if test "$enable_builtin_tiff" = "yes" ; then AC_DEFINE([HAVE_LIBTIFF], [1], [Define to 1 if you have the `tiff' library (-ltiff).]) else AC_CHECK_HEADERS([tiffio.h]) - AC_CHECK_HEADERS([tif_dir.h], [], [], [#include -]) - AC_CHECK_LIB([tiff], [TIFFOpen], [TIFF_LIBS="-ltiff"], AC_MSG_ERROR("Cannot build without libtiff (does your system require a libtiff-devel package?)"), -lm) + AC_CHECK_LIB([tiff], [TIFFOpen], , AC_MSG_ERROR("Cannot build without libtiff (does your system require a libtiff-devel package?)"), -lm) fi AC_CHECK_LIB([tiff], [TIFFCreateCustomDirectory], [ @@ -574,6 +548,31 @@ LIBS="$LIBS $TIFF_LIBS $JPEG_LIBS" TESTLIBS="$SIMLIBS $TESTLIBS" +AC_DEFINE([SPANDSP_SUPPORT_T43], [0], [Support T.43 JBIG gray and colour compression]) +SPANDSP_SUPPORT_T43="#undef SPANDSP_SUPPORT_T43" +AC_DEFINE([SPANDSP_SUPPORT_V32BIS], [0], [Support the V.32bis modem]) +SPANDSP_SUPPORT_V32BIS="#undef SPANDSP_SUPPORT_V32BIS" +AC_DEFINE([SPANDSP_SUPPORT_V34], [0], [Support the V.34 FAX modem]) +SPANDSP_SUPPORT_V34="#undef SPANDSP_SUPPORT_V34" + +AM_CONDITIONAL([COND_DOC], [test "$enable_doc" = yes]) +AM_CONDITIONAL([COND_TESTS], [test "$enable_tests" = yes]) +AM_CONDITIONAL([COND_MMX], [test "$enable_mmx" = yes]) +AM_CONDITIONAL([COND_SSE], [test "$enable_sse" = yes]) +AM_CONDITIONAL([COND_SSE2], [test "$enable_sse2" = yes]) +AM_CONDITIONAL([COND_SSE3], [test "$enable_sse3" = yes]) +AM_CONDITIONAL([COND_SSSE3], [test "$enable_ssse3" = yes]) +AM_CONDITIONAL([COND_SSE4_1], [test "$enable_sse4_1" = yes]) +AM_CONDITIONAL([COND_SSE4_2], [test "$enable_sse4_2" = yes]) +AM_CONDITIONAL([COND_SSE4A], [test "$enable_sse4a" = yes]) +AM_CONDITIONAL([COND_SSE5], [test "$enable_sse5" = yes]) +AM_CONDITIONAL([COND_AVX], [test "$enable_avx" = yes]) +AM_CONDITIONAL([COND_AVX2], [test "$enable_avx2" = yes]) +AM_CONDITIONAL([COND_NEON], [test "$enable_neon" = yes]) + +AM_CONDITIONAL([COND_V32BIS], [test yes = xyes]) +AM_CONDITIONAL([COND_V34], [test yes = xyes]) + AC_SUBST(SPANDSP_LT_CURRENT) AC_SUBST(SPANDSP_LT_REVISION) AC_SUBST(SPANDSP_LT_AGE) @@ -586,7 +585,6 @@ AC_SUBST(TESTLIBS) AC_SUBST(SPANDSP_USE_FIXED_POINT) AC_SUBST(SPANDSP_MISALIGNED_ACCESS_FAILS) AC_SUBST(SPANDSP_USE_EXPORT_CAPABILITY) -AC_SUBST(SPANDSP_SUPPORT_T42) AC_SUBST(SPANDSP_SUPPORT_T43) AC_SUBST(SPANDSP_SUPPORT_V32BIS) AC_SUBST(SPANDSP_SUPPORT_V34) diff --git a/libs/spandsp/spandsp.spec b/libs/spandsp/spandsp.spec index 40ca9ddce3..d248ac71fb 100644 --- a/libs/spandsp/spandsp.spec +++ b/libs/spandsp/spandsp.spec @@ -2,12 +2,12 @@ Summary: A DSP library for telephony. Name: spandsp -Version: 0.0.7 +Version: 1.99.0 Release: 1 License: LGPLv2 and GPLv2 Group: System Environment/Libraries URL: http://www.soft-switch.org/spandsp -Source: http://www.soft-switch.org/downloads/spandsp/spandsp-0.0.7.tar.gz +Source: http://www.soft-switch.org/downloads/spandsp/spandsp-1.99.0.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libtiff-devel%{?_isa} diff --git a/libs/spandsp/src/Makefile.am b/libs/spandsp/src/Makefile.am index a3b7a48ecd..9f60205f07 100644 --- a/libs/spandsp/src/Makefile.am +++ b/libs/spandsp/src/Makefile.am @@ -82,6 +82,16 @@ AM_CPPFLAGS = -I$(top_builddir) lib_LTLIBRARIES = libspandsp.la +if COND_V32BIS +V32BIS_SOURCES = v32bis.c +endif + +if COND_V34 +V34_SOURCES = v34rx.c \ + v34tx.c \ + v34_logging.c +endif + libspandsp_la_SOURCES = ademco_contactid.c \ adsi.c \ alloc.c \ @@ -173,7 +183,9 @@ libspandsp_la_SOURCES = ademco_contactid.c \ v42bis.c \ v8.c \ vector_float.c \ - vector_int.c + vector_int.c \ + $(V32BIS_SOURCES) \ + $(V34_SOURCES) libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS) diff --git a/libs/spandsp/src/fax.c b/libs/spandsp/src/fax.c index a220c4f818..3a08d49218 100644 --- a/libs/spandsp/src/fax.c +++ b/libs/spandsp/src/fax.c @@ -84,9 +84,7 @@ #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #include "spandsp/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" -#endif #include "spandsp/t4_t6_decode.h" #include "spandsp/t4_t6_encode.h" @@ -117,9 +115,7 @@ #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" #include "spandsp/private/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" -#endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/image_translate.h" diff --git a/libs/spandsp/src/image_translate.c b/libs/spandsp/src/image_translate.c index 4c6a5affb8..1768b92138 100644 --- a/libs/spandsp/src/image_translate.c +++ b/libs/spandsp/src/image_translate.c @@ -67,9 +67,7 @@ #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #include "spandsp/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" -#endif #include "spandsp/t4_t6_decode.h" #include "spandsp/t4_t6_encode.h" #include "spandsp/image_translate.h" @@ -78,9 +76,7 @@ #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" #include "spandsp/private/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" -#endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/image_translate.h" diff --git a/libs/spandsp/src/spandsp.h.in b/libs/spandsp/src/spandsp.h.in index 6ed699f3b4..747f4a432f 100644 --- a/libs/spandsp/src/spandsp.h.in +++ b/libs/spandsp/src/spandsp.h.in @@ -33,7 +33,6 @@ @SPANDSP_USE_EXPORT_CAPABILITY@ -@SPANDSP_SUPPORT_T42@ @SPANDSP_SUPPORT_T43@ @SPANDSP_SUPPORT_V32BIS@ @SPANDSP_SUPPORT_V34@ @@ -93,21 +92,21 @@ #include #include #include -#include -#include #include #include #include #include -#if defined(SPANDSP_SUPPORT_V32BIS) -#include -#endif #include #include #include +#if defined(SPANDSP_SUPPORT_V32BIS) +#include +#endif #if defined(SPANDSP_SUPPORT_V34) #include #endif +#include +#include #include #include #include @@ -118,9 +117,7 @@ #include #include #include -#if defined(SPANDSP_SUPPORT_T43) #include -#endif #include #include #include diff --git a/libs/spandsp/src/spandsp/expose.h b/libs/spandsp/src/spandsp/expose.h index a6ca48e5a5..b65a21f1b9 100644 --- a/libs/spandsp/src/spandsp/expose.h +++ b/libs/spandsp/src/spandsp/expose.h @@ -73,6 +73,12 @@ #include #include #include +#if defined(SPANDSP_SUPPORT_V32BIS) +#include +#endif +#if defined(SPANDSP_SUPPORT_V34) +#include +#endif #include #include #include diff --git a/libs/spandsp/src/spandsp/private/t4_rx.h b/libs/spandsp/src/spandsp/private/t4_rx.h index ff2fc11567..3f89e1d38b 100644 --- a/libs/spandsp/src/spandsp/private/t4_rx.h +++ b/libs/spandsp/src/spandsp/private/t4_rx.h @@ -128,9 +128,7 @@ struct t4_rx_state_s t88_decode_state_t t88; #endif t42_decode_state_t t42; -#if defined(SPANDSP_SUPPORT_T43) t43_decode_state_t t43; -#endif #if defined(SPANDSP_SUPPORT_T45) t45_decode_state_t t45; #endif diff --git a/libs/spandsp/src/spandsp/private/t4_tx.h b/libs/spandsp/src/spandsp/private/t4_tx.h index d3c3e5a8a8..009152d9e2 100644 --- a/libs/spandsp/src/spandsp/private/t4_tx.h +++ b/libs/spandsp/src/spandsp/private/t4_tx.h @@ -164,9 +164,7 @@ struct t4_tx_state_s t88_encode_state_t t88; #endif t42_encode_state_t t42; -#if defined(SPANDSP_SUPPORT_T43) t43_encode_state_t t43; -#endif #if defined(SPANDSP_SUPPORT_T45) t45_encode_state_t t45; #endif diff --git a/libs/spandsp/src/spandsp/t4_tx.h b/libs/spandsp/src/spandsp/t4_tx.h index 019e2e6cd5..2e019e9dc5 100644 --- a/libs/spandsp/src/spandsp/t4_tx.h +++ b/libs/spandsp/src/spandsp/t4_tx.h @@ -175,7 +175,8 @@ ImageLayer(34732) LONG */ /* Define the TIFF/FX tags to extend libtiff, when using a version of libtiff where this - stuff has not been merged. */ + stuff has not been merged. We only need to define these things for older versions of + libtiff. */ #if defined(SPANDSP_SUPPORT_TIFF_FX) && !defined(TIFFTAG_FAXPROFILE) #define TIFFTAG_INDEXED 346 #define TIFFTAG_GLOBALPARAMETERSIFD 400 diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index 3a0d9bbc8b..897ac4a449 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -71,9 +71,7 @@ #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #include "spandsp/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" -#endif #include "spandsp/t4_t6_decode.h" #include "spandsp/t4_t6_encode.h" #include "spandsp/t30_fcf.h" @@ -87,9 +85,7 @@ #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" #include "spandsp/private/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" -#endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/image_translate.h" @@ -1498,7 +1494,6 @@ static int build_dcs(t30_state_t *s) set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, T30_DCS_BIT_MIN_SCAN_LINE_TIME_1); use_bilevel = false; break; -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T43_MODE); if (image_type == T4_IMAGE_TYPE_COLOUR_8BIT || image_type == T4_IMAGE_TYPE_COLOUR_12BIT) @@ -1508,7 +1503,6 @@ static int build_dcs(t30_state_t *s) set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, T30_DCS_BIT_MIN_SCAN_LINE_TIME_1); use_bilevel = false; break; -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: use_bilevel = false; @@ -1786,21 +1780,12 @@ static int analyze_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) s->mutual_colour_resolutions &= ~T4_RESOLUTION_300_300; } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE)) - { - s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_400; - s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_R8_SUPERFINE; - } + s->mutual_bilevel_resolutions &= ~(T4_RESOLUTION_200_400 | T4_RESOLUTION_R8_SUPERFINE); if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE)) { - s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_200; - s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_R8_FINE; + s->mutual_bilevel_resolutions &= ~(T4_RESOLUTION_200_200 | T4_RESOLUTION_R8_FINE); s->mutual_colour_resolutions &= ~T4_RESOLUTION_200_200; } - else - { - //if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED)) - // s->mutual_colour_resolutions &= ~T4_RESOLUTION_200_200; - } if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED)) s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_100; /* Never suppress T4_RESOLUTION_R8_STANDARD */ diff --git a/libs/spandsp/src/t30_api.c b/libs/spandsp/src/t30_api.c index a0a78b3164..b6e50838ce 100644 --- a/libs/spandsp/src/t30_api.c +++ b/libs/spandsp/src/t30_api.c @@ -71,9 +71,7 @@ #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #include "spandsp/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" -#endif #include "spandsp/t4_t6_decode.h" #include "spandsp/t4_t6_encode.h" #include "spandsp/t30_fcf.h" @@ -87,9 +85,7 @@ #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" #include "spandsp/private/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" -#endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/image_translate.h" @@ -654,6 +650,28 @@ SPAN_DECLARE(int) t30_set_ecm_capability(t30_state_t *s, bool enabled) SPAN_DECLARE(int) t30_set_supported_output_compressions(t30_state_t *s, int supported_compressions) { + /* Mask out the ones we actually support today. */ + supported_compressions &= T4_COMPRESSION_T4_1D + | T4_COMPRESSION_T4_2D + | T4_COMPRESSION_T6 + | T4_COMPRESSION_T85 + | T4_COMPRESSION_T85_L0 +#if defined(SPANDSP_SUPPORT_T88) + | T4_COMPRESSION_T88 +#endif + | T4_COMPRESSION_T42_T81 +#if defined(SPANDSP_SUPPORT_SYCC_T81) + | T4_COMPRESSION_SYCC_T81 +#endif +#if defined(SPANDSP_SUPPORT_T43) + | T4_COMPRESSION_T43 +#endif +#if defined(SPANDSP_SUPPORT_T45) + | T4_COMPRESSION_T45 +#endif + | T4_COMPRESSION_UNCOMPRESSED + | T4_COMPRESSION_JPEG + | 0; s->supported_output_compressions = supported_compressions; return 0; } diff --git a/libs/spandsp/src/t30_logging.c b/libs/spandsp/src/t30_logging.c index ce1dc74664..a3dea97b2e 100644 --- a/libs/spandsp/src/t30_logging.c +++ b/libs/spandsp/src/t30_logging.c @@ -70,9 +70,7 @@ #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #include "spandsp/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" -#endif #include "spandsp/t4_t6_decode.h" #include "spandsp/t4_t6_encode.h" #include "spandsp/t30_fcf.h" @@ -85,9 +83,7 @@ #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" #include "spandsp/private/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" -#endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/image_translate.h" diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index 78346e3ecf..77225cc63f 100644 --- a/libs/spandsp/src/t38_gateway.c +++ b/libs/spandsp/src/t38_gateway.c @@ -84,9 +84,7 @@ #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #include "spandsp/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" -#endif #include "spandsp/t4_t6_decode.h" #include "spandsp/t4_t6_encode.h" #include "spandsp/t30_fcf.h" @@ -115,9 +113,7 @@ #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" #include "spandsp/private/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" -#endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/image_translate.h" diff --git a/libs/spandsp/src/t38_terminal.c b/libs/spandsp/src/t38_terminal.c index bf6a2a9de7..75d8842d9a 100644 --- a/libs/spandsp/src/t38_terminal.c +++ b/libs/spandsp/src/t38_terminal.c @@ -74,9 +74,7 @@ #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #include "spandsp/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" -#endif #include "spandsp/t4_t6_decode.h" #include "spandsp/t4_t6_encode.h" #include "spandsp/t30_fcf.h" @@ -92,9 +90,7 @@ #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" #include "spandsp/private/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" -#endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/image_translate.h" diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index 4723b0111c..ea305098d3 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -64,9 +64,7 @@ #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #include "spandsp/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" -#endif #include "spandsp/t4_t6_decode.h" #include "spandsp/t4_t6_encode.h" #include "spandsp/version.h" @@ -75,9 +73,7 @@ #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" #include "spandsp/private/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" -#endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/image_translate.h" @@ -244,7 +240,6 @@ static int set_tiff_directory_info(t4_rx_state_t *s) output_compression = COMPRESSION_T88; break; #endif -#if defined(SPANDSP_SUPPORT_T42) case T4_COMPRESSION_JPEG: output_compression = COMPRESSION_JPEG; bits_per_sample = 8; @@ -287,15 +282,12 @@ static int set_tiff_directory_info(t4_rx_state_t *s) photometric = PHOTOMETRIC_MINISBLACK; } break; -#endif -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: output_compression = COMPRESSION_T43; bits_per_sample = 8; samples_per_pixel = 3; photometric = PHOTOMETRIC_ITULAB; break; -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: output_compression = COMPRESSION_T45; @@ -323,11 +315,9 @@ static int set_tiff_directory_info(t4_rx_state_t *s) case COMPRESSION_JPEG: TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF); break; -#if defined(SPANDSP_SUPPORT_T43) case COMPRESSION_T43: TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF); break; -#endif } TIFFSetField(t->tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); TIFFSetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, bits_per_sample); @@ -456,11 +446,9 @@ static int set_tiff_directory_info(t4_rx_state_t *s) case T4_COMPRESSION_T42_T81: s->metadata.image_length = t42_decode_get_image_length(&s->decoder.t42); break; -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: s->metadata.image_length = t43_decode_get_image_length(&s->decoder.t43); break; -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: s->metadata.image_length = t45_decode_get_image_length(&s->decoder.t45); @@ -579,7 +567,6 @@ static int write_tiff_t85_image(t4_rx_state_t *s) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_SUPPORT_T43) static int write_tiff_t43_image(t4_rx_state_t *s) { uint8_t *buf; @@ -621,7 +608,6 @@ static int write_tiff_t43_image(t4_rx_state_t *s) return 0; } /*- End of function --------------------------------------------------------*/ -#endif static int write_tiff_image(t4_rx_state_t *s) { @@ -662,13 +648,11 @@ static int write_tiff_image(t4_rx_state_t *s) return -1; break; #endif -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: /* We need to perform this compression here, as libtiff does not understand it. */ if (write_tiff_t43_image(s) < 0) return -1; break; -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: /* We need to perform this compression here, as libtiff does not understand it. */ @@ -879,6 +863,9 @@ SPAN_DECLARE(void) t4_rx_set_model(t4_rx_state_t *s, const char *model) static bool select_tiff_compression(t4_rx_state_t *s, int output_image_type) { s->tiff.image_type = output_image_type; + /* The only compression schemes where we can really avoid decoding and + recoding the images are those where the width an length of the image + can be readily extracted from the image data (e.g. from its header) */ if ((s->metadata.compression & (s->supported_tiff_compressions & (T4_COMPRESSION_T85 | T4_COMPRESSION_T85_L0 | T4_COMPRESSION_T42_T81 | T4_COMPRESSION_SYCC_T81)))) { span_log(&s->logging, SPAN_LOG_FLOW, "Image can be written without recoding\n"); @@ -934,10 +921,8 @@ static int release_current_decoder(t4_rx_state_t *s) #endif case T4_COMPRESSION_T42_T81: return t42_decode_release(&s->decoder.t42); -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: return t43_decode_release(&s->decoder.t43); -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: return t45_decode_release(&s->decoder.t45); @@ -1045,7 +1030,6 @@ SPAN_DECLARE(int) t4_rx_set_rx_encoding(t4_rx_state_t *s, int compression) pre_encoded_init(&s->decoder.no_decoder); } return 0; -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: switch (s->metadata.compression) { @@ -1069,7 +1053,6 @@ SPAN_DECLARE(int) t4_rx_set_rx_encoding(t4_rx_state_t *s, int compression) pre_encoded_init(&s->decoder.no_decoder); } return 0; -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: switch (s->metadata.compression) @@ -1119,10 +1102,8 @@ SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_rx_state_t *s, t4_row_write_han #endif case T4_COMPRESSION_T42_T81: return t42_decode_set_row_write_handler(&s->decoder.t42, handler, user_data); -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: return t43_decode_set_row_write_handler(&s->decoder.t43, handler, user_data); -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: return t45_decode_set_row_write_handler(&s->decoder.t45, handler, user_data); @@ -1188,7 +1169,6 @@ SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t t->image_length = t->length; t->line_image_size = t42_decode_get_compressed_image_size(&s->decoder.t42)/8; break; -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: t->type = T4_IMAGE_TYPE_COLOUR_8BIT; t->width = t43_decode_get_image_width(&s->decoder.t43); @@ -1198,7 +1178,6 @@ SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_rx_state_t *s, t4_stats_t *t t->image_length = t->length; t->line_image_size = t43_decode_get_compressed_image_size(&s->decoder.t43)/8; break; -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: break; @@ -1235,12 +1214,10 @@ SPAN_DECLARE(int) t4_rx_start_page(t4_rx_state_t *s) t42_decode_restart(&s->decoder.t42); s->image_put_handler = (t4_image_put_handler_t) t42_decode_put; break; -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: t43_decode_restart(&s->decoder.t43); s->image_put_handler = (t4_image_put_handler_t) t43_decode_put; break; -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: t45_decode_restart(&s->decoder.t45); @@ -1311,11 +1288,9 @@ SPAN_DECLARE(int) t4_rx_end_page(t4_rx_state_t *s) else s->tiff.image_type = T4_IMAGE_TYPE_GRAY_8BIT; break; -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: length = t43_decode_get_image_length(&s->decoder.t43); break; -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: length = t45_decode_get_image_length(&s->decoder.t45); diff --git a/libs/spandsp/src/t4_t6_decode.c b/libs/spandsp/src/t4_t6_decode.c index 4daf7e65c7..b163277e22 100644 --- a/libs/spandsp/src/t4_t6_decode.c +++ b/libs/spandsp/src/t4_t6_decode.c @@ -95,9 +95,7 @@ #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #include "spandsp/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" -#endif #include "spandsp/t4_t6_decode.h" #include "spandsp/t4_t6_encode.h" @@ -105,9 +103,7 @@ #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" #include "spandsp/private/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" -#endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/image_translate.h" diff --git a/libs/spandsp/src/t4_t6_encode.c b/libs/spandsp/src/t4_t6_encode.c index 85838a0ea9..b092ecd3f0 100644 --- a/libs/spandsp/src/t4_t6_encode.c +++ b/libs/spandsp/src/t4_t6_encode.c @@ -92,9 +92,7 @@ #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #include "spandsp/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" -#endif #include "spandsp/t4_t6_decode.h" #include "spandsp/t4_t6_encode.h" @@ -102,9 +100,7 @@ #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" #include "spandsp/private/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" -#endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/image_translate.h" diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index f38239f492..f3739c89db 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -64,9 +64,7 @@ #include "spandsp/t81_t82_arith_coding.h" #include "spandsp/t85.h" #include "spandsp/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/t43.h" -#endif #include "spandsp/t4_t6_decode.h" #include "spandsp/t4_t6_encode.h" @@ -74,9 +72,7 @@ #include "spandsp/private/t81_t82_arith_coding.h" #include "spandsp/private/t85.h" #include "spandsp/private/t42.h" -#if defined(SPANDSP_SUPPORT_T43) #include "spandsp/private/t43.h" -#endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/image_translate.h" @@ -420,7 +416,7 @@ static int get_tiff_directory_info(t4_tx_state_t *s) float bmax; uint8_t parm8; #endif -#if defined(TIFFTAG_INDEXED) +#if defined(SPANDSP_SUPPORT_TIFF_FX) uint16_t parm16; #endif uint32_t parm32; @@ -457,7 +453,7 @@ static int get_tiff_directory_info(t4_tx_state_t *s) else return -1; -#if defined(TIFFTAG_INDEXED) +#if defined(SPANDSP_SUPPORT_TIFF_FX) parm16 = 0; if (TIFFGetField(t->tiff_file, TIFFTAG_INDEXED, &parm16)) { @@ -526,11 +522,9 @@ static int get_tiff_directory_info(t4_tx_state_t *s) case COMPRESSION_T85: span_log(&s->logging, SPAN_LOG_FLOW, "T.85\n"); break; -#if defined(SPANDSP_SUPPORT_T43) case COMPRESSION_T43: span_log(&s->logging, SPAN_LOG_FLOW, "T.43\n"); break; -#endif case COMPRESSION_JPEG: span_log(&s->logging, SPAN_LOG_FLOW, "JPEG\n"); if (t->photo_metric == PHOTOMETRIC_ITULAB) @@ -959,7 +953,6 @@ static int read_tiff_t85_image(t4_tx_state_t *s) } /*- End of function --------------------------------------------------------*/ -#if defined(SPANDSP_SUPPORT_T43) static int read_tiff_t43_image(t4_tx_state_t *s) { int biggest; @@ -1037,7 +1030,6 @@ static int read_tiff_t43_image(t4_tx_state_t *s) return s->tiff.image_size; } /*- End of function --------------------------------------------------------*/ -#endif static int read_tiff_t42_t81_image(t4_tx_state_t *s) { @@ -1168,36 +1160,38 @@ static int read_tiff_image(t4_tx_state_t *s) int total_len; int i; int len; + int alter_image; uint8_t *t; if (s->metadata.image_type != s->tiff.image_type || s->metadata.image_width != s->tiff.image_width) { + /* We need to rework the image, so it can't pass directly through */ + alter_image = true; image_translate_restart(&s->translator, s->tiff.image_length); s->metadata.image_length = image_translate_get_output_length(&s->translator); + image_translate_set_row_read_handler(&s->translator, translate_row_read2, s); } else { + alter_image = false; s->metadata.image_length = s->tiff.image_length; } s->pack_buf = NULL; s->pack_ptr = 0; s->pack_row = 0; + s->apply_lab = false; if (s->tiff.image_type != T4_IMAGE_TYPE_BILEVEL) { /* If colour/gray scale is supported we may be able to send the image as it is, perhaps after a resizing. Otherwise we need to resize it, and squash it to a bilevel image. */ if (s->tiff.compression == COMPRESSION_JPEG && s->tiff.photo_metric == PHOTOMETRIC_ITULAB) { - if (s->metadata.image_type != s->tiff.image_type || s->metadata.image_width != s->tiff.image_width) + if (alter_image) { if (read_tiff_t42_t81_image(s) < 0) return -1; - s->pack_buf = s->tiff.image_buffer; - s->pack_ptr = 0; - s->pack_row = 0; - image_translate_set_row_read_handler(&s->translator, translate_row_read2, s); } else { @@ -1209,15 +1203,11 @@ static int read_tiff_image(t4_tx_state_t *s) #if defined(SPANDSP_SUPPORT_T43) else if (s->tiff.compression == COMPRESSION_T43) { - if (s->metadata.image_type != s->tiff.image_type || s->metadata.image_width != s->tiff.image_width) + if (alter_image) { if ((len = read_tiff_t43_image(s)) < 0) return -1; - s->pack_buf = s->tiff.image_buffer; - s->pack_ptr = 0; - s->pack_row = 0; - image_translate_set_row_read_handler(&s->translator, translate_row_read2, s); } else { @@ -1230,15 +1220,11 @@ static int read_tiff_image(t4_tx_state_t *s) #if defined(SPANDSP_SUPPORT_T45) else if (s->tiff.compression == COMPRESSION_T45) { - if (s->metadata.image_type != s->tiff.image_type || s->metadata.image_width != s->tiff.image_width) + if (alter_image) { if (read_tiff_t45_image(s) < 0) return -1; - s->pack_buf = s->tiff.image_buffer; - s->pack_ptr = 0; - s->pack_row = 0; - image_translate_set_row_read_handler(&s->translator, translate_row_read2, s); } else { @@ -1252,7 +1238,7 @@ static int read_tiff_image(t4_tx_state_t *s) { /* Let libtiff handle the decompression */ TIFFSetField(s->tiff.tiff_file, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB); - if (s->metadata.image_type != s->tiff.image_type || s->metadata.image_width != s->tiff.image_width) + if (alter_image) { image_translate_set_row_read_handler(&s->translator, translate_row_read, s); } @@ -1262,6 +1248,7 @@ static int read_tiff_image(t4_tx_state_t *s) return -1; } } + set_image_width(s, s->metadata.image_width); set_image_length(s, s->metadata.image_length); t4_tx_set_image_type(s, s->metadata.image_type); @@ -1292,9 +1279,6 @@ static int read_tiff_image(t4_tx_state_t *s) set_lab_gamut(&s->lab_params, 0, 100, -85, 85, -75, 125, false); s->apply_lab = true; break; - default: - s->apply_lab = false; - break; } total_len = 0; for (i = 0; i < s->metadata.image_length; i++) @@ -1305,7 +1289,7 @@ static int read_tiff_image(t4_tx_state_t *s) } else { - if (s->metadata.image_type != s->tiff.image_type || s->metadata.image_width != s->tiff.image_width) + if (alter_image) { total_len = 0; s->tiff.image_buffer = span_realloc(s->tiff.image_buffer, s->metadata.image_width*s->metadata.image_length*3); @@ -1435,10 +1419,8 @@ static int set_row_read_handler(t4_tx_state_t *s, t4_row_read_handler_t handler, case T4_COMPRESSION_T42_T81: case T4_COMPRESSION_SYCC_T81: return t42_encode_set_row_read_handler(&s->encoder.t42, handler, user_data); -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: return t43_encode_set_row_read_handler(&s->encoder.t43, handler, user_data); -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: return t45_encode_set_row_read_handler(&s->encoder.t45, handler, user_data); @@ -1840,7 +1822,7 @@ SPAN_DECLARE(int) t4_tx_set_tx_image_format(t4_tx_state_t *s, } /* Squashing to a bi-level image is possible */ s->metadata.image_type = T4_IMAGE_TYPE_BILEVEL; - span_log(&s->logging, SPAN_LOG_FLOW, "The image will be flattened to %d\n", s->metadata.image_type); + span_log(&s->logging, SPAN_LOG_FLOW, "The image will be flattened to %s\n", t4_image_type_to_str(s->metadata.image_type)); } } @@ -2070,7 +2052,6 @@ SPAN_DECLARE(int) t4_tx_set_tx_image_format(t4_tx_state_t *s, s->metadata.compression = compression; res = T4_IMAGE_FORMAT_OK; break; -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: switch (s->metadata.compression) { @@ -2083,7 +2064,6 @@ SPAN_DECLARE(int) t4_tx_set_tx_image_format(t4_tx_state_t *s, s->metadata.compression = compression; res = T4_IMAGE_FORMAT_OK; break; -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: switch (s->metadata.compression) @@ -2182,11 +2162,9 @@ static void set_image_width(t4_tx_state_t *s, uint32_t image_width) case T4_COMPRESSION_SYCC_T81: t42_encode_set_image_width(&s->encoder.t42, image_width); break; -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: t43_encode_set_image_width(&s->encoder.t43, image_width); break; -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: t45_encode_set_image_width(&s->encoder.t45, image_width); @@ -2219,11 +2197,9 @@ static void set_image_length(t4_tx_state_t *s, uint32_t image_length) case T4_COMPRESSION_SYCC_T81: t42_encode_set_image_length(&s->encoder.t42, image_length); break; -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: t43_encode_set_image_length(&s->encoder.t43, image_length); break; -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: t45_encode_set_image_length(&s->encoder.t45, image_length); @@ -2247,11 +2223,9 @@ static void t4_tx_set_image_type(t4_tx_state_t *s, int image_type) case T4_COMPRESSION_SYCC_T81: t42_encode_set_image_type(&s->encoder.t42, image_type); break; -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: t43_encode_set_image_type(&s->encoder.t43, image_type); break; -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: t45_encode_set_image_type(&s->encoder.t45, image_type); @@ -2377,13 +2351,11 @@ SPAN_DECLARE(void) t4_tx_get_transfer_statistics(t4_tx_state_t *s, t4_stats_t *t t->length = t42_encode_get_image_length(&s->encoder.t42); t->line_image_size = t42_encode_get_compressed_image_size(&s->encoder.t42)/8; break; -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: t->width = t43_encode_get_image_width(&s->encoder.t43); t->length = t43_encode_get_image_length(&s->encoder.t43); t->line_image_size = t43_encode_get_compressed_image_size(&s->encoder.t43)/8; break; -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: t->width = t45_encode_get_image_width(&s->encoder.t45); @@ -2420,10 +2392,8 @@ SPAN_DECLARE(int) t4_tx_image_complete(t4_tx_state_t *s) case T4_COMPRESSION_T42_T81: case T4_COMPRESSION_SYCC_T81: return t42_encode_image_complete(&s->encoder.t42); -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: return t43_encode_image_complete(&s->encoder.t43); -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: return t45_encode_image_complete(&s->encoder.t45); @@ -2514,12 +2484,10 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_tx_state_t *s) t42_encode_restart(&s->encoder.t42, s->metadata.image_width, s->metadata.image_length); s->image_get_handler = (t4_image_get_handler_t) t42_encode_get; break; -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: t43_encode_restart(&s->encoder.t43, s->metadata.image_width, s->metadata.image_length); s->image_get_handler = (t4_image_get_handler_t) t43_encode_get; break; -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: t45_encode_restart(&s->encoder.t45, s->metadata.image_width, s->metadata.image_length); @@ -2651,10 +2619,8 @@ SPAN_DECLARE(int) t4_tx_release(t4_tx_state_t *s) case T4_COMPRESSION_T42_T81: case T4_COMPRESSION_SYCC_T81: return t42_encode_release(&s->encoder.t42); -#if defined(SPANDSP_SUPPORT_T43) case T4_COMPRESSION_T43: return t43_encode_release(&s->encoder.t43); -#endif #if defined(SPANDSP_SUPPORT_T45) case T4_COMPRESSION_T45: return t45_encode_release(&s->encoder.t45); diff --git a/libs/spandsp/tests/Makefile.am b/libs/spandsp/tests/Makefile.am index 881a4839b5..f1ce1930b1 100644 --- a/libs/spandsp/tests/Makefile.am +++ b/libs/spandsp/tests/Makefile.am @@ -50,6 +50,14 @@ AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/spandsp-sim -DDATADIR="\"$ LIBDIR = -L$(top_builddir)/src +if COND_V32BIS +V32BIS_PROGS = v32bis_tests +endif + +if COND_V34 +V34_PROGS = v34_tests +endif + noinst_PROGRAMS = ademco_contactid_tests \ adsi_tests \ alloc_tests \ @@ -65,10 +73,12 @@ noinst_PROGRAMS = ademco_contactid_tests \ complex_vector_float_tests \ complex_vector_int_tests \ crc_tests \ + data_modems_tests \ dc_restore_tests \ dds_tests \ dtmf_rx_tests \ dtmf_tx_tests \ + dummy_modems_tests \ echo_tests \ fax_decode \ fax_tests \ @@ -94,6 +104,7 @@ noinst_PROGRAMS = ademco_contactid_tests \ playout_tests \ plc_tests \ power_meter_tests \ + pseudo_terminal_tests \ queue_tests \ r2_mf_rx_tests \ r2_mf_tx_tests \ @@ -130,7 +141,9 @@ noinst_PROGRAMS = ademco_contactid_tests \ v42bis_tests \ v8_tests \ vector_float_tests \ - vector_int_tests + vector_int_tests \ + $(V32BIS_PROGS) \ + $(V34_PROGS) noinst_HEADERS = echo_monitor.h \ fax_tester.h \ @@ -139,6 +152,8 @@ noinst_HEADERS = echo_monitor.h \ media_monitor.h \ modem_monitor.h \ pcap_parse.h \ + pseudo_terminals.h \ + socket_harness.h \ udptl.h ademco_contactid_tests_SOURCES = ademco_contactid_tests.c @@ -186,6 +201,9 @@ complex_vector_int_tests_LDADD = $(LIBDIR) -lspandsp crc_tests_SOURCES = crc_tests.c crc_tests_LDADD = $(LIBDIR) -lspandsp +data_modems_tests_SOURCES = data_modems_tests.c media_monitor.cpp +data_modems_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + dc_restore_tests_SOURCES = dc_restore_tests.c dc_restore_tests_LDADD = $(LIBDIR) -lspandsp @@ -198,6 +216,9 @@ dtmf_rx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lsp dtmf_tx_tests_SOURCES = dtmf_tx_tests.c dtmf_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +dummy_modems_tests_SOURCES = dummy_modems_tests.c media_monitor.cpp socket_harness.c +dummy_modems_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + echo_tests_SOURCES = echo_tests.c echo_monitor.cpp echo_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp @@ -273,6 +294,9 @@ plc_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspands power_meter_tests_SOURCES = power_meter_tests.c power_meter_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +pseudo_terminal_tests_SOURCES = pseudo_terminal_tests.c fax_utils.c pseudo_terminals.c +pseudo_terminal_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim -lspandsp -lutil + queue_tests_SOURCES = queue_tests.c queue_tests_LDADD = $(LIBDIR) -lspandsp @@ -369,6 +393,16 @@ v27ter_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspa v29_tests_SOURCES = v29_tests.c line_model_monitor.cpp modem_monitor.cpp v29_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +if COND_V32BIS +v32bis_tests_SOURCES = v32bis_tests.c line_model_monitor.cpp modem_monitor.cpp +v32bis_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +endif + +if COND_V34 +v34_tests_SOURCES = v34_tests.c line_model_monitor.cpp modem_monitor.cpp +v34_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +endif + v42_tests_SOURCES = v42_tests.c v42_tests_LDADD = $(LIBDIR) -lspandsp diff --git a/libs/spandsp/tests/alloc_tests.c b/libs/spandsp/tests/alloc_tests.c index 0e8177ae29..2f64e6ae27 100644 --- a/libs/spandsp/tests/alloc_tests.c +++ b/libs/spandsp/tests/alloc_tests.c @@ -58,9 +58,10 @@ int main(int argc, char *argv[]) void *b; void *c; - if (span_mem_allocators(memalign, - malloc, + if (span_mem_allocators(malloc, realloc, + free, + memalign, free)) { printf("Failed\n"); @@ -70,7 +71,7 @@ int main(int argc, char *argv[]) b = span_alloc(42); c = span_realloc(NULL, 42); printf("%p %p %p\n", a, b, c); - span_free(a); + span_aligned_free(a); span_free(b); span_free(c); } diff --git a/libs/spandsp/tests/fax_tests.c b/libs/spandsp/tests/fax_tests.c index 7cbe61fcfa..5f8ce070e2 100644 --- a/libs/spandsp/tests/fax_tests.c +++ b/libs/spandsp/tests/fax_tests.c @@ -463,8 +463,8 @@ int main(int argc, char *argv[]) int outframes; SNDFILE *wave_handle; SNDFILE *input_wave_handle; - int use_ecm; - int use_tep; + bool use_ecm; + bool use_tep; int feedback_audio; int use_transmit_on_idle; int t38_version; @@ -479,7 +479,6 @@ int main(int argc, char *argv[]) double tx_when; double rx_when; int supported_modems; - int remove_fill_bits; int opt; int start_page; int end_page; @@ -490,8 +489,11 @@ int main(int argc, char *argv[]) int noise_level; int code_to_look_up; int scan_line_time; - int allowed_bilevel_resolutions; - int colour_enabled; + int allowed_bilevel_resolutions[2]; + int allowed; + bool remove_fill_bits; + bool colour_enabled; + bool t37_like_output; t38_stats_t t38_stats; t30_stats_t t30_stats; logging_state_t *logging; @@ -530,15 +532,22 @@ int main(int argc, char *argv[]) scan_line_time = 0; decode_file_name = NULL; code_to_look_up = -1; - allowed_bilevel_resolutions = 0; + allowed_bilevel_resolutions[0] = 0; + allowed_bilevel_resolutions[1] = 0; + allowed = 0; colour_enabled = false; + t37_like_output = false; t38_transport = T38_TRANSPORT_UDPTL; - while ((opt = getopt(argc, argv, "b:c:Cd:D:efFgH:i:Ilm:M:n:p:s:S:tT:u:v:z:")) != -1) + while ((opt = getopt(argc, argv, "7b:c:Cd:D:efFgH:i:Ilm:M:n:p:s:S:tT:u:v:z:")) != -1) { switch (opt) { + case '7': + t37_like_output = true; + break; case 'b': - allowed_bilevel_resolutions = atoi(optarg); + allowed_bilevel_resolutions[allowed] = atoi(optarg); + allowed ^= 1; break; case 'c': code_to_look_up = atoi(optarg); @@ -855,7 +864,7 @@ int main(int argc, char *argv[]) | T4_SUPPORT_LENGTH_US_LETTER | T4_SUPPORT_LENGTH_US_LEGAL | T4_SUPPORT_LENGTH_UNLIMITED); - switch (allowed_bilevel_resolutions) + switch (allowed_bilevel_resolutions[i]) { case 0: /* Allow anything */ @@ -926,7 +935,21 @@ int main(int argc, char *argv[]) { t30_set_supported_colour_resolutions(t30_state[i], 0); } - t30_set_supported_output_compressions(t30_state[i], T4_COMPRESSION_T6 | T4_COMPRESSION_JPEG); + if (t37_like_output) + { + t30_set_supported_output_compressions(t30_state[i], + T4_COMPRESSION_T85 + | T4_COMPRESSION_T85_L0 + | T4_COMPRESSION_T6 + | T4_COMPRESSION_T42_T81); + } + else + { + t30_set_supported_output_compressions(t30_state[i], + T4_COMPRESSION_T6 + | T4_COMPRESSION_JPEG); + } + t30_set_ecm_capability(t30_state[i], use_ecm); t30_set_supported_compressions(t30_state[i], T4_COMPRESSION_T4_1D diff --git a/libs/spandsp/tests/fax_tests.sh b/libs/spandsp/tests/fax_tests.sh index b09609e3f3..a4d36ce501 100755 --- a/libs/spandsp/tests/fax_tests.sh +++ b/libs/spandsp/tests/fax_tests.sh @@ -28,7 +28,7 @@ run_fax_test() 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 + ${TIFFCMP} -t ${FILE} fax_tests.tif >/dev/null RETVAL=$? if [ $RETVAL != 0 ] then @@ -43,7 +43,7 @@ run_fax_squash_test() { # Test with lengthwise squashing of a bilevel image rm -f fax_tests.tif - echo ./fax_tests -b ${SQ} ${OPTS} -i ${IN_FILE} + echo ./fax_tests -b ${SQ} -b ${SQ} ${OPTS} -i ${IN_FILE} ./fax_tests -b ${SQ} ${OPTS} -i ${IN_FILE} >xyzzy 2>xyzzy2 RETVAL=$? if [ $RETVAL != 0 ] @@ -53,7 +53,7 @@ run_fax_squash_test() 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 ${OUT_FILE} fax_tests.tif >/dev/null + ${TIFFCMP} -t ${OUT_FILE} fax_tests.tif >/dev/null RETVAL=$? if [ $RETVAL != 0 ] then @@ -77,7 +77,7 @@ run_colour_fax_test() 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 ${OUT_FILE} fax_tests.tif >/dev/null + ${TIFFCMP} -t ${OUT_FILE} fax_tests.tif >/dev/null RETVAL=$? if [ $RETVAL != 0 ] then @@ -91,40 +91,35 @@ run_colour_fax_test() ITUTESTS_DIR=../test-data/itu/fax TIFFFX_DIR=../test-data/itu/tiff-fx LOCALTESTS_DIR=../test-data/local +TIFFCMP=tiffcmp # Colour/gray -> bilevel by not allowing ECM for OPTS in "-p AA" "-p TT" "-p GG" "-p TG" "-p GT" do - echo Colour to bi-level tests disabled -# IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" -# OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-bilevel.tif" -# run_colour_fax_test + IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" + OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-bilevel.tif" + run_colour_fax_test -# IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif" -# OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-bilevel.tif" -# run_colour_fax_test + IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif" + OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-bilevel.tif" + run_colour_fax_test -# IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" -# OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-bilevel.tif" -# run_colour_fax_test + IN_FILE="${TIFFFX_DIR}/c03x_02x.tif" + OUT_FILE="${TIFFFX_DIR}/c03x_02x-bilevel.tif" + run_colour_fax_test -# IN_FILE="${TIFFFX_DIR}/c03x_02x.tif" -# OUT_FILE="${TIFFFX_DIR}/c03x_02x.tif" -# run_colour_fax_test + IN_FILE="${TIFFFX_DIR}/l02x_02x.tif" + OUT_FILE="${TIFFFX_DIR}/l02x_02x-bilevel.tif" + run_colour_fax_test -# IN_FILE="${TIFFFX_DIR}/l02x_02x.tif" -# OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif" -# run_colour_fax_test - -# IN_FILE="${TIFFFX_DIR}/l04x_02x.tif" -# OUT_FILE="${TIFFFX_DIR}/l04x_02x.tif" -# run_colour_fax_test + IN_FILE="${TIFFFX_DIR}/l04x_02x.tif" + OUT_FILE="${TIFFFX_DIR}/l04x_02x-bilevel.tif" + run_colour_fax_test done # Colour/gray -> colour/gray for OPTS in "-p AA -C -e" "-p TT -C -e" "-p GG -C -e" "-p TG -C -e" "-p GT -C -e" do - echo Colour to colour tests disabled # IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif" # OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-out.tif" # run_colour_fax_test @@ -137,9 +132,9 @@ do # OUT_FILE="${TIFFFX_DIR}/c03x_02x-out.tif" # run_colour_fax_test -# IN_FILE="${TIFFFX_DIR}/l02x_02x.tif" -# OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif" -# run_colour_fax_test + IN_FILE="${TIFFFX_DIR}/l02x_02x.tif" + OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif" + run_colour_fax_test # IN_FILE="${TIFFFX_DIR}/l04x_02x.tif" # OUT_FILE="${TIFFFX_DIR}/l04x_02x.tif" diff --git a/libs/spandsp/tests/pseudo_terminal_tests.c b/libs/spandsp/tests/pseudo_terminal_tests.c new file mode 100644 index 0000000000..1e271bc6ad --- /dev/null +++ b/libs/spandsp/tests/pseudo_terminal_tests.c @@ -0,0 +1,185 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * pseudo_terminal_tests.c - pseudo terminal handling tests. + * + * Written by Steve Underwood + * + * Copyright (C) 2012 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +#if defined(WIN32) +#include +#else +#if defined(__APPLE__) +#include +#include +#elif defined(__FreeBSD__) +#include +#include +#include +#else +#include +#endif +#include +#include +#include +#include +#include +#endif + +#include "spandsp.h" + +#include "spandsp/t30_fcf.h" + +#include "spandsp-sim.h" + +#undef SPANDSP_EXPOSE_INTERNAL_STRUCTURES + +#include "pseudo_terminals.h" + +static int master(void) +{ + modem_t modem[10]; + char buf[1024]; + int len; + int i; +#if !defined(WIN32) + int tioflags; +#endif + + for (i = 0; i < 10; i++) + { + if (psuedo_terminal_create(&modem[i])) + { + printf("Failure\n"); + exit(2); + } + printf("%s %s\n", modem[i].devlink, modem[i].stty); + } + + for (i = 0; i < 10; i++) + { +#if !defined(WIN32) + ioctl(modem[i].slave, TIOCMGET, &tioflags); + tioflags |= TIOCM_RI; + ioctl(modem[i].slave, TIOCMSET, &tioflags); +#endif + } + + for (;;) + { + for (i = 0; i < 10; i++) + { + len = read(modem[i].master, buf, 4); + if (len >= 0) + { + buf[len] = '\0'; + printf("%d %d '%s' %s\n", i, len, buf, strerror(errno)); +#if !defined(WIN32) + ioctl(modem[i].slave, TIOCMGET, &tioflags); + tioflags |= TIOCM_RI; + ioctl(modem[i].slave, TIOCMSET, &tioflags); +#endif + } + } + } + + for (i = 0; i < 10; i++) + { + if (psuedo_terminal_close(&modem[i])) + { + printf("Failure\n"); + exit(2); + } + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int slave(void) +{ + int fd[10]; + char name[64]; + int i; + int j; +#if !defined(WIN32) + int tioflags; +#endif + + for (i = 0; i < 10; i++) + { + sprintf(name, "/dev/spandsp/%d", i); + if ((fd[i] = open(name, O_RDWR)) < 0) + { + printf("Failed to open %s\n", name); + exit(2); + } + printf("%s\n", name); + } + + for (i = 0; i < 10; i++) + { +#if !defined(WIN32) + ioctl(fd[i], TIOCMGET, &tioflags); + if ((tioflags & TIOCM_RI)) + printf("Ring %d\n", i); + else + printf("No ring %d\n", i); +#endif + } + + for (j = 0; j < 10; j++) + { + for (i = 0; i < 10; i++) + { + write(fd[i], "FRED", 4); +#if !defined(WIN32) + ioctl(fd[i], TIOCMGET, &tioflags); + if ((tioflags & TIOCM_RI)) + printf("Ring %d\n", i); +#endif + } + } + + for (i = 0; i < 10; i++) + { + if (close(fd[i])) + { + printf("Failed to close %d\n", i); + exit(2); + } + } + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + if (argc < 2) + master(); + else + slave(); + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/tests/pseudo_terminals.c b/libs/spandsp/tests/pseudo_terminals.c index c7bc2e67eb..1f042be8b9 100644 --- a/libs/spandsp/tests/pseudo_terminals.c +++ b/libs/spandsp/tests/pseudo_terminals.c @@ -51,6 +51,7 @@ #include "pseudo_terminals.h" int next_id = 0; +const char *device_root_name = "/dev/spandsp"; int psuedo_terminal_close(modem_t *modem) { @@ -175,7 +176,7 @@ int psuedo_terminal_create(modem_t *modem) modem->threadAbort = CreateEvent(NULL, true, false, NULL); #else modem->slot = next_id++; - snprintf(modem->devlink, sizeof(modem->devlink), "/dev/spandsp/%d", modem->slot); + snprintf(modem->devlink, sizeof(modem->devlink), "%s/%d", device_root_name, modem->slot); /* Remove any stale link which might be present */ unlink(modem->devlink); diff --git a/libs/spandsp/tests/pseudo_terminals_tests.c b/libs/spandsp/tests/pseudo_terminals_tests.c deleted file mode 100644 index a4675c6c5b..0000000000 --- a/libs/spandsp/tests/pseudo_terminals_tests.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SpanDSP - a series of DSP components for telephony - * - * pseudo_terminals_tests.c - pseudo terminal handling tests. - * - * Written by Steve Underwood - * - * Copyright (C) 2012 Steve Underwood - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2, as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include -#include - -#if defined(WIN32) -#include -#else -#if defined(__APPLE__) -#include -#include -#elif defined(__FreeBSD__) -#include -#include -#include -#else -#include -#endif -#include -#include -#include -#endif - -#include "spandsp.h" - -#include "pseudo_terminals.h" - -int main(int argc, char *argv[]) -{ - modem_t modem[10]; - int i; - - for (i = 0; i < 10; i++) - { - if (psuedo_terminal_create(&modem[i])) - printf("Failure\n"); - printf("%s %s\n", modem[i].devlink, modem[i].stty); - } - getchar(); - for (i = 0; i < 10; i++) - { - if (psuedo_terminal_close(&modem[i])) - printf("Failure\n"); - } - return 0; -} -/*- End of function --------------------------------------------------------*/ -/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/tests/t31_pseudo_terminal_tests.c b/libs/spandsp/tests/t31_pseudo_terminal_tests.c index 7c0825e4b5..d4fc01efc3 100644 --- a/libs/spandsp/tests/t31_pseudo_terminal_tests.c +++ b/libs/spandsp/tests/t31_pseudo_terminal_tests.c @@ -47,8 +47,6 @@ #include "spandsp.h" -#include "spandsp/t30_fcf.h" - #include "spandsp-sim.h" #undef SPANDSP_EXPOSE_INTERNAL_STRUCTURES diff --git a/libs/spandsp/tests/t38_decode.c b/libs/spandsp/tests/t38_decode.c index 34f072b781..e29b64cbf6 100644 --- a/libs/spandsp/tests/t38_decode.c +++ b/libs/spandsp/tests/t38_decode.c @@ -440,7 +440,36 @@ int main(int argc, char *argv[]) t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'A'); t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A'); t30_set_ecm_capability(t30, use_ecm); - t30_set_supported_compressions(t30, T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D | T4_COMPRESSION_T6 | T4_COMPRESSION_T85); + t30_set_supported_compressions(t30, + T4_COMPRESSION_T4_1D + | T4_COMPRESSION_T4_2D + | T4_COMPRESSION_T6 + | T4_COMPRESSION_T85 + | T4_COMPRESSION_T85_L0 + | T4_COMPRESSION_T42_T81 + | T4_COMPRESSION_COLOUR); + t30_set_supported_bilevel_resolutions(t30, + T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_R8_SUPERFINE + | T4_RESOLUTION_R16_SUPERFINE + | T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_200_400 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_300_600 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_400_800 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_600_1200 + | T4_RESOLUTION_1200_1200); + t30_set_supported_colour_resolutions(t30, + T4_RESOLUTION_100_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_1200_1200); if (pcap_scan_pkts(input_file_name, src_addr, src_port, dest_addr, dest_port, t38_terminal_timing_update, process_packet, NULL)) exit(2); @@ -497,7 +526,36 @@ int main(int argc, char *argv[]) t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'B'); t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'B'); t30_set_ecm_capability(t30, use_ecm); - t30_set_supported_compressions(t30, T4_COMPRESSION_T4_1D | T4_COMPRESSION_T4_2D | T4_COMPRESSION_T6); + t30_set_supported_compressions(t30, + T4_COMPRESSION_T4_1D + | T4_COMPRESSION_T4_2D + | T4_COMPRESSION_T6 + | T4_COMPRESSION_T85 + | T4_COMPRESSION_T85_L0 + | T4_COMPRESSION_T42_T81 + | T4_COMPRESSION_COLOUR); + t30_set_supported_bilevel_resolutions(t30, + T4_RESOLUTION_R8_STANDARD + | T4_RESOLUTION_R8_FINE + | T4_RESOLUTION_R8_SUPERFINE + | T4_RESOLUTION_R16_SUPERFINE + | T4_RESOLUTION_200_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_200_400 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_300_600 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_400_800 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_600_1200 + | T4_RESOLUTION_1200_1200); + t30_set_supported_colour_resolutions(t30, + T4_RESOLUTION_100_100 + | T4_RESOLUTION_200_200 + | T4_RESOLUTION_300_300 + | T4_RESOLUTION_400_400 + | T4_RESOLUTION_600_600 + | T4_RESOLUTION_1200_1200); logging = fax_get_logging_state(fax_state); span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); diff --git a/libs/spandsp/tests/t42_tests.c b/libs/spandsp/tests/t42_tests.c index fe6b773e23..ea87b4eab3 100644 --- a/libs/spandsp/tests/t42_tests.c +++ b/libs/spandsp/tests/t42_tests.c @@ -300,7 +300,7 @@ int main(int argc, char *argv[]) memcpy(data, jpeg_table, jpeg_table_len - 2); if (total_len != total_image_len) - printf("Size mismatch %ld %ld\n", total_len, total_image_len); + printf("Size mismatch %ld %ld\n", (long int) total_len, (long int) total_image_len); off = total_len; switch (compression) { @@ -309,7 +309,7 @@ int main(int argc, char *argv[]) case COMPRESSION_CCITT_T6: break; case COMPRESSION_T85: - printf("T.85 image %ld bytes\n", total_len); + printf("T.85 image %ld bytes\n", (long int) total_len); for (i = 0; i < 16; i++) printf("0x%02x\n", data[i]); t85_decode_init(&t85_dec, t85_row_write_handler, NULL); @@ -322,7 +322,7 @@ int main(int argc, char *argv[]) t85_decode_release(&t85_dec); return 0; case COMPRESSION_T43: - printf("T.43 image %ld bytes\n", total_len); + printf("T.43 image %ld bytes\n", (long int) total_len); if (pack_16(data) == 0xFFA8) { data += 2; @@ -447,7 +447,7 @@ int main(int argc, char *argv[]) return 1; off += bytes_per_row; } - printf("total %u, off %ld\n", totdata, off); + printf("total %u, off %ld\n", totdata, (long int) off); /* We now have the image in memory in RGB form */ @@ -497,7 +497,7 @@ int main(int argc, char *argv[]) } TIFFClose(tif); - printf("XXX - image is %d by %d, %ld bytes\n", w, h, off); + printf("XXX - image is %d by %d, %ld bytes\n", w, h, (long int) off); /* We now have the image in memory in ITULAB form */ diff --git a/libs/spandsp/tests/t4_tests.c b/libs/spandsp/tests/t4_tests.c index 0af75b1ab5..98a57cfe54 100644 --- a/libs/spandsp/tests/t4_tests.c +++ b/libs/spandsp/tests/t4_tests.c @@ -288,20 +288,16 @@ int main(int argc, char *argv[]) compression_step = -1; } #endif -#if defined(SPANDSP_SUPPORT_T42) else if (strcmp(optarg, "T81") == 0) { compression = T4_COMPRESSION_T42_T81; compression_step = -1; } -#endif -#if defined(SPANDSP_SUPPORT_T43) else if (strcmp(optarg, "T43") == 0) { compression = T4_COMPRESSION_T43; compression_step = -1; } -#endif #if defined(SPANDSP_SUPPORT_T45) else if (strcmp(optarg, "T45") == 0) { diff --git a/libs/spandsp/yum-prepare.sh b/libs/spandsp/yum-prepare.sh new file mode 100644 index 0000000000..e41200482b --- /dev/null +++ b/libs/spandsp/yum-prepare.sh @@ -0,0 +1,26 @@ +: + +# +# Install the things which need adding to a fresh Fedora or Centos install to make it ready to build +# spandsp and its test suite +# +yum groupinstall "Development tools" +yum install fftw-devel \ + libtiff-tools \ + libtiff-devel \ + libjpeg-turbo-devel \ + libpcap-devel \ + libxml2-devel \ + libsndfile-devel \ + fltk-devel \ + fltk-fluid \ + libstdc++-devel \ + libstdc++-static \ + sox \ + gcc-c++ \ + libtool \ + autconf \ + automake \ + m4 \ + netpbm \ + netpbm-progs