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
# @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
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.]))
;;
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
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 <tiffio.h>
-])
- 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], [
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)
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)
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}
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 \
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)
#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/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"
#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"
#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"
@SPANDSP_USE_EXPORT_CAPABILITY@
-@SPANDSP_SUPPORT_T42@
@SPANDSP_SUPPORT_T43@
@SPANDSP_SUPPORT_V32BIS@
@SPANDSP_SUPPORT_V34@
#include <spandsp/modem_connect_tones.h>
#include <spandsp/silence_gen.h>
#include <spandsp/v8.h>
-#include <spandsp/v42.h>
-#include <spandsp/v42bis.h>
#include <spandsp/v29rx.h>
#include <spandsp/v29tx.h>
#include <spandsp/v17rx.h>
#include <spandsp/v17tx.h>
-#if defined(SPANDSP_SUPPORT_V32BIS)
-#include <spandsp/v32bis.h>
-#endif
#include <spandsp/v22bis.h>
#include <spandsp/v27ter_rx.h>
#include <spandsp/v27ter_tx.h>
+#if defined(SPANDSP_SUPPORT_V32BIS)
+#include <spandsp/v32bis.h>
+#endif
#if defined(SPANDSP_SUPPORT_V34)
#include <spandsp/v34.h>
#endif
+#include <spandsp/v42.h>
+#include <spandsp/v42bis.h>
#include <spandsp/v18.h>
#include <spandsp/timezone.h>
#include <spandsp/t4_rx.h>
#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/t30.h>
#include <spandsp/t30_api.h>
#include <spandsp/t30_fcf.h>
#include <spandsp/private/v27ter_tx.h>
#include <spandsp/private/v29rx.h>
#include <spandsp/private/v29tx.h>
+#if defined(SPANDSP_SUPPORT_V32BIS)
+#include <spandsp/private/v32bis.h>
+#endif
+#if defined(SPANDSP_SUPPORT_V34)
+#include <spandsp/private/v34.h>
+#endif
#include <spandsp/private/v42.h>
#include <spandsp/private/v42bis.h>
#include <spandsp/private/at_interpreter.h>
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
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
*/
/* 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
#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"
#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"
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)
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;
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 */
#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"
#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"
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;
}
#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"
#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"
#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"
#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"
#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"
#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"
#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"
#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"
output_compression = COMPRESSION_T88;
break;
#endif
-#if defined(SPANDSP_SUPPORT_T42)
case T4_COMPRESSION_JPEG:
output_compression = COMPRESSION_JPEG;
bits_per_sample = 8;
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;
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);
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);
}
/*- End of function --------------------------------------------------------*/
-#if defined(SPANDSP_SUPPORT_T43)
static int write_tiff_t43_image(t4_rx_state_t *s)
{
uint8_t *buf;
return 0;
}
/*- End of function --------------------------------------------------------*/
-#endif
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. */
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");
#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);
pre_encoded_init(&s->decoder.no_decoder);
}
return 0;
-#if defined(SPANDSP_SUPPORT_T43)
case T4_COMPRESSION_T43:
switch (s->metadata.compression)
{
pre_encoded_init(&s->decoder.no_decoder);
}
return 0;
-#endif
#if defined(SPANDSP_SUPPORT_T45)
case T4_COMPRESSION_T45:
switch (s->metadata.compression)
#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);
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);
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;
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);
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);
#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/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"
#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/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"
#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/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"
float bmax;
uint8_t parm8;
#endif
-#if defined(TIFFTAG_INDEXED)
+#if defined(SPANDSP_SUPPORT_TIFF_FX)
uint16_t parm16;
#endif
uint32_t parm32;
else
return -1;
-#if defined(TIFFTAG_INDEXED)
+#if defined(SPANDSP_SUPPORT_TIFF_FX)
parm16 = 0;
if (TIFFGetField(t->tiff_file, TIFFTAG_INDEXED, &parm16))
{
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)
}
/*- End of function --------------------------------------------------------*/
-#if defined(SPANDSP_SUPPORT_T43)
static int read_tiff_t43_image(t4_tx_state_t *s)
{
int biggest;
return s->tiff.image_size;
}
/*- End of function --------------------------------------------------------*/
-#endif
static int read_tiff_t42_t81_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
{
#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
{
#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
{
{
/* 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);
}
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);
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++)
}
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);
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);
}
/* 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));
}
}
s->metadata.compression = compression;
res = T4_IMAGE_FORMAT_OK;
break;
-#if defined(SPANDSP_SUPPORT_T43)
case T4_COMPRESSION_T43:
switch (s->metadata.compression)
{
s->metadata.compression = compression;
res = T4_IMAGE_FORMAT_OK;
break;
-#endif
#if defined(SPANDSP_SUPPORT_T45)
case T4_COMPRESSION_T45:
switch (s->metadata.compression)
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);
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);
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);
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);
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);
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);
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);
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 \
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 \
playout_tests \
plc_tests \
power_meter_tests \
+ pseudo_terminal_tests \
queue_tests \
r2_mf_rx_tests \
r2_mf_tx_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 \
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
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
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
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
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
void *b;
void *c;
- if (span_mem_allocators(memalign,
- malloc,
+ if (span_mem_allocators(malloc,
realloc,
+ free,
+ memalign,
free))
{
printf("Failed\n");
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);
}
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;
double tx_when;
double rx_when;
int supported_modems;
- int remove_fill_bits;
int opt;
int start_page;
int end_page;
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;
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);
| 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 */
{
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
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
{
# 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 ]
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
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
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-colour.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="${TIFFFX_DIR}/c03x_02x.tif"
-# OUT_FILE="${TIFFFX_DIR}/c03x_02x.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}/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-bilevel.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
# 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"
--- /dev/null
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * pseudo_terminal_tests.c - pseudo terminal handling tests.
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * 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 <inttypes.h>
+#include <stdlib.h>
+
+#if defined(WIN32)
+#include <windows.h>
+#else
+#if defined(__APPLE__)
+#include <util.h>
+#include <sys/ioctl.h>
+#elif defined(__FreeBSD__)
+#include <libutil.h>
+#include <termios.h>
+#include <sys/socket.h>
+#else
+#include <pty.h>
+#endif
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <poll.h>
+#include <errno.h>
+#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 ------------------------------------------------------------*/
#include "pseudo_terminals.h"
int next_id = 0;
+const char *device_root_name = "/dev/spandsp";
int psuedo_terminal_close(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);
+++ /dev/null
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * pseudo_terminals_tests.c - pseudo terminal handling tests.
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * 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 <inttypes.h>
-#include <stdlib.h>
-
-#if defined(WIN32)
-#include <windows.h>
-#else
-#if defined(__APPLE__)
-#include <util.h>
-#include <sys/ioctl.h>
-#elif defined(__FreeBSD__)
-#include <libutil.h>
-#include <termios.h>
-#include <sys/socket.h>
-#else
-#include <pty.h>
-#endif
-#include <unistd.h>
-#include <fcntl.h>
-#include <poll.h>
-#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 ------------------------------------------------------------*/
#include "spandsp.h"
-#include "spandsp/t30_fcf.h"
-
#include "spandsp-sim.h"
#undef SPANDSP_EXPOSE_INTERNAL_STRUCTURES
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);
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);
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)
{
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);
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;
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 */
}
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 */
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)
{
--- /dev/null
+:
+
+#
+# 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