mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-06 06:33:29 +00:00
Tweaks to spandsp configuration
This commit is contained in:
parent
dd6b8a828a
commit
8b8b91beeb
@ -47,7 +47,8 @@ EXTRA_DIST = autogen.sh \
|
|||||||
unpack_g726_data.sh \
|
unpack_g726_data.sh \
|
||||||
unpack_gsm0610_data.sh \
|
unpack_gsm0610_data.sh \
|
||||||
unpack_v56ter_data.sh \
|
unpack_v56ter_data.sh \
|
||||||
wrapper.xsl
|
wrapper.xsl \
|
||||||
|
yum-prepare.sh
|
||||||
|
|
||||||
if COND_DOC
|
if COND_DOC
|
||||||
MAYBE_DOC=doc
|
MAYBE_DOC=doc
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
# @start 1
|
# @start 1
|
||||||
|
|
||||||
AC_PREREQ([2.59])
|
AC_PREREQ([2.59])
|
||||||
AC_INIT([spandsp], [0.0.7])
|
AC_INIT([spandsp], [1.99.0])
|
||||||
|
|
||||||
SPANDSP_LT_CURRENT=3
|
SPANDSP_LT_CURRENT=3
|
||||||
SPANDSP_LT_REVISION=0
|
SPANDSP_LT_REVISION=0
|
||||||
@ -265,15 +265,6 @@ then
|
|||||||
esac
|
esac
|
||||||
fi
|
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])
|
AC_CHECK_LIB([m], [cos])
|
||||||
# Some platforms still seem to lack the basic single precision trig and power related functions.
|
# 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.]))
|
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
|
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
|
if test "$enable_builtin_tiff" = "yes" ; then
|
||||||
abs_tiffdir="`cd $srcdir/../tiff-4.0.2/ && pwd`"
|
abs_tiffdir="`cd $srcdir/../tiff-4.0.2/ && pwd`"
|
||||||
save_CFLAGS=$CFLAGS
|
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).])
|
AC_DEFINE([HAVE_LIBTIFF], [1], [Define to 1 if you have the `tiff' library (-ltiff).])
|
||||||
else
|
else
|
||||||
AC_CHECK_HEADERS([tiffio.h])
|
AC_CHECK_HEADERS([tiffio.h])
|
||||||
AC_CHECK_HEADERS([tif_dir.h], [], [], [#include <tiffio.h>
|
AC_CHECK_LIB([tiff], [TIFFOpen], , AC_MSG_ERROR("Cannot build without libtiff (does your system require a libtiff-devel package?)"), -lm)
|
||||||
])
|
|
||||||
AC_CHECK_LIB([tiff], [TIFFOpen], [TIFF_LIBS="-ltiff"], AC_MSG_ERROR("Cannot build without libtiff (does your system require a libtiff-devel package?)"), -lm)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_LIB([tiff], [TIFFCreateCustomDirectory], [
|
AC_CHECK_LIB([tiff], [TIFFCreateCustomDirectory], [
|
||||||
@ -574,6 +548,31 @@ LIBS="$LIBS $TIFF_LIBS $JPEG_LIBS"
|
|||||||
|
|
||||||
TESTLIBS="$SIMLIBS $TESTLIBS"
|
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_CURRENT)
|
||||||
AC_SUBST(SPANDSP_LT_REVISION)
|
AC_SUBST(SPANDSP_LT_REVISION)
|
||||||
AC_SUBST(SPANDSP_LT_AGE)
|
AC_SUBST(SPANDSP_LT_AGE)
|
||||||
@ -586,7 +585,6 @@ AC_SUBST(TESTLIBS)
|
|||||||
AC_SUBST(SPANDSP_USE_FIXED_POINT)
|
AC_SUBST(SPANDSP_USE_FIXED_POINT)
|
||||||
AC_SUBST(SPANDSP_MISALIGNED_ACCESS_FAILS)
|
AC_SUBST(SPANDSP_MISALIGNED_ACCESS_FAILS)
|
||||||
AC_SUBST(SPANDSP_USE_EXPORT_CAPABILITY)
|
AC_SUBST(SPANDSP_USE_EXPORT_CAPABILITY)
|
||||||
AC_SUBST(SPANDSP_SUPPORT_T42)
|
|
||||||
AC_SUBST(SPANDSP_SUPPORT_T43)
|
AC_SUBST(SPANDSP_SUPPORT_T43)
|
||||||
AC_SUBST(SPANDSP_SUPPORT_V32BIS)
|
AC_SUBST(SPANDSP_SUPPORT_V32BIS)
|
||||||
AC_SUBST(SPANDSP_SUPPORT_V34)
|
AC_SUBST(SPANDSP_SUPPORT_V34)
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
Summary: A DSP library for telephony.
|
Summary: A DSP library for telephony.
|
||||||
Name: spandsp
|
Name: spandsp
|
||||||
Version: 0.0.7
|
Version: 1.99.0
|
||||||
Release: 1
|
Release: 1
|
||||||
License: LGPLv2 and GPLv2
|
License: LGPLv2 and GPLv2
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
URL: http://www.soft-switch.org/spandsp
|
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)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
|
|
||||||
BuildRequires: libtiff-devel%{?_isa}
|
BuildRequires: libtiff-devel%{?_isa}
|
||||||
|
@ -82,6 +82,16 @@ AM_CPPFLAGS = -I$(top_builddir)
|
|||||||
|
|
||||||
lib_LTLIBRARIES = libspandsp.la
|
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 \
|
libspandsp_la_SOURCES = ademco_contactid.c \
|
||||||
adsi.c \
|
adsi.c \
|
||||||
alloc.c \
|
alloc.c \
|
||||||
@ -173,7 +183,9 @@ libspandsp_la_SOURCES = ademco_contactid.c \
|
|||||||
v42bis.c \
|
v42bis.c \
|
||||||
v8.c \
|
v8.c \
|
||||||
vector_float.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)
|
libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS)
|
||||||
|
|
||||||
|
@ -84,9 +84,7 @@
|
|||||||
#include "spandsp/t81_t82_arith_coding.h"
|
#include "spandsp/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/t85.h"
|
#include "spandsp/t85.h"
|
||||||
#include "spandsp/t42.h"
|
#include "spandsp/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/t43.h"
|
#include "spandsp/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/t4_t6_decode.h"
|
#include "spandsp/t4_t6_decode.h"
|
||||||
#include "spandsp/t4_t6_encode.h"
|
#include "spandsp/t4_t6_encode.h"
|
||||||
|
|
||||||
@ -117,9 +115,7 @@
|
|||||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/private/t85.h"
|
#include "spandsp/private/t85.h"
|
||||||
#include "spandsp/private/t42.h"
|
#include "spandsp/private/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/private/t43.h"
|
#include "spandsp/private/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/private/t4_t6_decode.h"
|
#include "spandsp/private/t4_t6_decode.h"
|
||||||
#include "spandsp/private/t4_t6_encode.h"
|
#include "spandsp/private/t4_t6_encode.h"
|
||||||
#include "spandsp/private/image_translate.h"
|
#include "spandsp/private/image_translate.h"
|
||||||
|
@ -67,9 +67,7 @@
|
|||||||
#include "spandsp/t81_t82_arith_coding.h"
|
#include "spandsp/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/t85.h"
|
#include "spandsp/t85.h"
|
||||||
#include "spandsp/t42.h"
|
#include "spandsp/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/t43.h"
|
#include "spandsp/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/t4_t6_decode.h"
|
#include "spandsp/t4_t6_decode.h"
|
||||||
#include "spandsp/t4_t6_encode.h"
|
#include "spandsp/t4_t6_encode.h"
|
||||||
#include "spandsp/image_translate.h"
|
#include "spandsp/image_translate.h"
|
||||||
@ -78,9 +76,7 @@
|
|||||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/private/t85.h"
|
#include "spandsp/private/t85.h"
|
||||||
#include "spandsp/private/t42.h"
|
#include "spandsp/private/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/private/t43.h"
|
#include "spandsp/private/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/private/t4_t6_decode.h"
|
#include "spandsp/private/t4_t6_decode.h"
|
||||||
#include "spandsp/private/t4_t6_encode.h"
|
#include "spandsp/private/t4_t6_encode.h"
|
||||||
#include "spandsp/private/image_translate.h"
|
#include "spandsp/private/image_translate.h"
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
@SPANDSP_USE_EXPORT_CAPABILITY@
|
@SPANDSP_USE_EXPORT_CAPABILITY@
|
||||||
|
|
||||||
@SPANDSP_SUPPORT_T42@
|
|
||||||
@SPANDSP_SUPPORT_T43@
|
@SPANDSP_SUPPORT_T43@
|
||||||
@SPANDSP_SUPPORT_V32BIS@
|
@SPANDSP_SUPPORT_V32BIS@
|
||||||
@SPANDSP_SUPPORT_V34@
|
@SPANDSP_SUPPORT_V34@
|
||||||
@ -93,21 +92,21 @@
|
|||||||
#include <spandsp/modem_connect_tones.h>
|
#include <spandsp/modem_connect_tones.h>
|
||||||
#include <spandsp/silence_gen.h>
|
#include <spandsp/silence_gen.h>
|
||||||
#include <spandsp/v8.h>
|
#include <spandsp/v8.h>
|
||||||
#include <spandsp/v42.h>
|
|
||||||
#include <spandsp/v42bis.h>
|
|
||||||
#include <spandsp/v29rx.h>
|
#include <spandsp/v29rx.h>
|
||||||
#include <spandsp/v29tx.h>
|
#include <spandsp/v29tx.h>
|
||||||
#include <spandsp/v17rx.h>
|
#include <spandsp/v17rx.h>
|
||||||
#include <spandsp/v17tx.h>
|
#include <spandsp/v17tx.h>
|
||||||
#if defined(SPANDSP_SUPPORT_V32BIS)
|
|
||||||
#include <spandsp/v32bis.h>
|
|
||||||
#endif
|
|
||||||
#include <spandsp/v22bis.h>
|
#include <spandsp/v22bis.h>
|
||||||
#include <spandsp/v27ter_rx.h>
|
#include <spandsp/v27ter_rx.h>
|
||||||
#include <spandsp/v27ter_tx.h>
|
#include <spandsp/v27ter_tx.h>
|
||||||
|
#if defined(SPANDSP_SUPPORT_V32BIS)
|
||||||
|
#include <spandsp/v32bis.h>
|
||||||
|
#endif
|
||||||
#if defined(SPANDSP_SUPPORT_V34)
|
#if defined(SPANDSP_SUPPORT_V34)
|
||||||
#include <spandsp/v34.h>
|
#include <spandsp/v34.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <spandsp/v42.h>
|
||||||
|
#include <spandsp/v42bis.h>
|
||||||
#include <spandsp/v18.h>
|
#include <spandsp/v18.h>
|
||||||
#include <spandsp/timezone.h>
|
#include <spandsp/timezone.h>
|
||||||
#include <spandsp/t4_rx.h>
|
#include <spandsp/t4_rx.h>
|
||||||
@ -118,9 +117,7 @@
|
|||||||
#include <spandsp/t81_t82_arith_coding.h>
|
#include <spandsp/t81_t82_arith_coding.h>
|
||||||
#include <spandsp/t85.h>
|
#include <spandsp/t85.h>
|
||||||
#include <spandsp/t42.h>
|
#include <spandsp/t42.h>
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include <spandsp/t43.h>
|
#include <spandsp/t43.h>
|
||||||
#endif
|
|
||||||
#include <spandsp/t30.h>
|
#include <spandsp/t30.h>
|
||||||
#include <spandsp/t30_api.h>
|
#include <spandsp/t30_api.h>
|
||||||
#include <spandsp/t30_fcf.h>
|
#include <spandsp/t30_fcf.h>
|
||||||
|
@ -73,6 +73,12 @@
|
|||||||
#include <spandsp/private/v27ter_tx.h>
|
#include <spandsp/private/v27ter_tx.h>
|
||||||
#include <spandsp/private/v29rx.h>
|
#include <spandsp/private/v29rx.h>
|
||||||
#include <spandsp/private/v29tx.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/v42.h>
|
||||||
#include <spandsp/private/v42bis.h>
|
#include <spandsp/private/v42bis.h>
|
||||||
#include <spandsp/private/at_interpreter.h>
|
#include <spandsp/private/at_interpreter.h>
|
||||||
|
@ -128,9 +128,7 @@ struct t4_rx_state_s
|
|||||||
t88_decode_state_t t88;
|
t88_decode_state_t t88;
|
||||||
#endif
|
#endif
|
||||||
t42_decode_state_t t42;
|
t42_decode_state_t t42;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
t43_decode_state_t t43;
|
t43_decode_state_t t43;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
t45_decode_state_t t45;
|
t45_decode_state_t t45;
|
||||||
#endif
|
#endif
|
||||||
|
@ -164,9 +164,7 @@ struct t4_tx_state_s
|
|||||||
t88_encode_state_t t88;
|
t88_encode_state_t t88;
|
||||||
#endif
|
#endif
|
||||||
t42_encode_state_t t42;
|
t42_encode_state_t t42;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
t43_encode_state_t t43;
|
t43_encode_state_t t43;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
t45_encode_state_t t45;
|
t45_encode_state_t t45;
|
||||||
#endif
|
#endif
|
||||||
|
@ -175,7 +175,8 @@ ImageLayer(34732) LONG
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Define the TIFF/FX tags to extend libtiff, when using a version of libtiff where this
|
/* 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)
|
#if defined(SPANDSP_SUPPORT_TIFF_FX) && !defined(TIFFTAG_FAXPROFILE)
|
||||||
#define TIFFTAG_INDEXED 346
|
#define TIFFTAG_INDEXED 346
|
||||||
#define TIFFTAG_GLOBALPARAMETERSIFD 400
|
#define TIFFTAG_GLOBALPARAMETERSIFD 400
|
||||||
|
@ -71,9 +71,7 @@
|
|||||||
#include "spandsp/t81_t82_arith_coding.h"
|
#include "spandsp/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/t85.h"
|
#include "spandsp/t85.h"
|
||||||
#include "spandsp/t42.h"
|
#include "spandsp/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/t43.h"
|
#include "spandsp/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/t4_t6_decode.h"
|
#include "spandsp/t4_t6_decode.h"
|
||||||
#include "spandsp/t4_t6_encode.h"
|
#include "spandsp/t4_t6_encode.h"
|
||||||
#include "spandsp/t30_fcf.h"
|
#include "spandsp/t30_fcf.h"
|
||||||
@ -87,9 +85,7 @@
|
|||||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/private/t85.h"
|
#include "spandsp/private/t85.h"
|
||||||
#include "spandsp/private/t42.h"
|
#include "spandsp/private/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/private/t43.h"
|
#include "spandsp/private/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/private/t4_t6_decode.h"
|
#include "spandsp/private/t4_t6_decode.h"
|
||||||
#include "spandsp/private/t4_t6_encode.h"
|
#include "spandsp/private/t4_t6_encode.h"
|
||||||
#include "spandsp/private/image_translate.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);
|
set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, T30_DCS_BIT_MIN_SCAN_LINE_TIME_1);
|
||||||
use_bilevel = false;
|
use_bilevel = false;
|
||||||
break;
|
break;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T43_MODE);
|
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)
|
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);
|
set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, T30_DCS_BIT_MIN_SCAN_LINE_TIME_1);
|
||||||
use_bilevel = false;
|
use_bilevel = false;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
use_bilevel = false;
|
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;
|
s->mutual_colour_resolutions &= ~T4_RESOLUTION_300_300;
|
||||||
}
|
}
|
||||||
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE))
|
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE))
|
||||||
{
|
s->mutual_bilevel_resolutions &= ~(T4_RESOLUTION_200_400 | T4_RESOLUTION_R8_SUPERFINE);
|
||||||
s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_400;
|
|
||||||
s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_R8_SUPERFINE;
|
|
||||||
}
|
|
||||||
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE))
|
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_200_200 | T4_RESOLUTION_R8_FINE);
|
||||||
s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_R8_FINE;
|
|
||||||
s->mutual_colour_resolutions &= ~T4_RESOLUTION_200_200;
|
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))
|
if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INCH_RESOLUTION_PREFERRED))
|
||||||
s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_100;
|
s->mutual_bilevel_resolutions &= ~T4_RESOLUTION_200_100;
|
||||||
/* Never suppress T4_RESOLUTION_R8_STANDARD */
|
/* Never suppress T4_RESOLUTION_R8_STANDARD */
|
||||||
|
@ -71,9 +71,7 @@
|
|||||||
#include "spandsp/t81_t82_arith_coding.h"
|
#include "spandsp/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/t85.h"
|
#include "spandsp/t85.h"
|
||||||
#include "spandsp/t42.h"
|
#include "spandsp/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/t43.h"
|
#include "spandsp/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/t4_t6_decode.h"
|
#include "spandsp/t4_t6_decode.h"
|
||||||
#include "spandsp/t4_t6_encode.h"
|
#include "spandsp/t4_t6_encode.h"
|
||||||
#include "spandsp/t30_fcf.h"
|
#include "spandsp/t30_fcf.h"
|
||||||
@ -87,9 +85,7 @@
|
|||||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/private/t85.h"
|
#include "spandsp/private/t85.h"
|
||||||
#include "spandsp/private/t42.h"
|
#include "spandsp/private/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/private/t43.h"
|
#include "spandsp/private/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/private/t4_t6_decode.h"
|
#include "spandsp/private/t4_t6_decode.h"
|
||||||
#include "spandsp/private/t4_t6_encode.h"
|
#include "spandsp/private/t4_t6_encode.h"
|
||||||
#include "spandsp/private/image_translate.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)
|
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;
|
s->supported_output_compressions = supported_compressions;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -70,9 +70,7 @@
|
|||||||
#include "spandsp/t81_t82_arith_coding.h"
|
#include "spandsp/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/t85.h"
|
#include "spandsp/t85.h"
|
||||||
#include "spandsp/t42.h"
|
#include "spandsp/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/t43.h"
|
#include "spandsp/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/t4_t6_decode.h"
|
#include "spandsp/t4_t6_decode.h"
|
||||||
#include "spandsp/t4_t6_encode.h"
|
#include "spandsp/t4_t6_encode.h"
|
||||||
#include "spandsp/t30_fcf.h"
|
#include "spandsp/t30_fcf.h"
|
||||||
@ -85,9 +83,7 @@
|
|||||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/private/t85.h"
|
#include "spandsp/private/t85.h"
|
||||||
#include "spandsp/private/t42.h"
|
#include "spandsp/private/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/private/t43.h"
|
#include "spandsp/private/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/private/t4_t6_decode.h"
|
#include "spandsp/private/t4_t6_decode.h"
|
||||||
#include "spandsp/private/t4_t6_encode.h"
|
#include "spandsp/private/t4_t6_encode.h"
|
||||||
#include "spandsp/private/image_translate.h"
|
#include "spandsp/private/image_translate.h"
|
||||||
|
@ -84,9 +84,7 @@
|
|||||||
#include "spandsp/t81_t82_arith_coding.h"
|
#include "spandsp/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/t85.h"
|
#include "spandsp/t85.h"
|
||||||
#include "spandsp/t42.h"
|
#include "spandsp/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/t43.h"
|
#include "spandsp/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/t4_t6_decode.h"
|
#include "spandsp/t4_t6_decode.h"
|
||||||
#include "spandsp/t4_t6_encode.h"
|
#include "spandsp/t4_t6_encode.h"
|
||||||
#include "spandsp/t30_fcf.h"
|
#include "spandsp/t30_fcf.h"
|
||||||
@ -115,9 +113,7 @@
|
|||||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/private/t85.h"
|
#include "spandsp/private/t85.h"
|
||||||
#include "spandsp/private/t42.h"
|
#include "spandsp/private/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/private/t43.h"
|
#include "spandsp/private/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/private/t4_t6_decode.h"
|
#include "spandsp/private/t4_t6_decode.h"
|
||||||
#include "spandsp/private/t4_t6_encode.h"
|
#include "spandsp/private/t4_t6_encode.h"
|
||||||
#include "spandsp/private/image_translate.h"
|
#include "spandsp/private/image_translate.h"
|
||||||
|
@ -74,9 +74,7 @@
|
|||||||
#include "spandsp/t81_t82_arith_coding.h"
|
#include "spandsp/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/t85.h"
|
#include "spandsp/t85.h"
|
||||||
#include "spandsp/t42.h"
|
#include "spandsp/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/t43.h"
|
#include "spandsp/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/t4_t6_decode.h"
|
#include "spandsp/t4_t6_decode.h"
|
||||||
#include "spandsp/t4_t6_encode.h"
|
#include "spandsp/t4_t6_encode.h"
|
||||||
#include "spandsp/t30_fcf.h"
|
#include "spandsp/t30_fcf.h"
|
||||||
@ -92,9 +90,7 @@
|
|||||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/private/t85.h"
|
#include "spandsp/private/t85.h"
|
||||||
#include "spandsp/private/t42.h"
|
#include "spandsp/private/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/private/t43.h"
|
#include "spandsp/private/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/private/t4_t6_decode.h"
|
#include "spandsp/private/t4_t6_decode.h"
|
||||||
#include "spandsp/private/t4_t6_encode.h"
|
#include "spandsp/private/t4_t6_encode.h"
|
||||||
#include "spandsp/private/image_translate.h"
|
#include "spandsp/private/image_translate.h"
|
||||||
|
@ -64,9 +64,7 @@
|
|||||||
#include "spandsp/t81_t82_arith_coding.h"
|
#include "spandsp/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/t85.h"
|
#include "spandsp/t85.h"
|
||||||
#include "spandsp/t42.h"
|
#include "spandsp/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/t43.h"
|
#include "spandsp/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/t4_t6_decode.h"
|
#include "spandsp/t4_t6_decode.h"
|
||||||
#include "spandsp/t4_t6_encode.h"
|
#include "spandsp/t4_t6_encode.h"
|
||||||
#include "spandsp/version.h"
|
#include "spandsp/version.h"
|
||||||
@ -75,9 +73,7 @@
|
|||||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/private/t85.h"
|
#include "spandsp/private/t85.h"
|
||||||
#include "spandsp/private/t42.h"
|
#include "spandsp/private/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/private/t43.h"
|
#include "spandsp/private/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/private/t4_t6_decode.h"
|
#include "spandsp/private/t4_t6_decode.h"
|
||||||
#include "spandsp/private/t4_t6_encode.h"
|
#include "spandsp/private/t4_t6_encode.h"
|
||||||
#include "spandsp/private/image_translate.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;
|
output_compression = COMPRESSION_T88;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(SPANDSP_SUPPORT_T42)
|
|
||||||
case T4_COMPRESSION_JPEG:
|
case T4_COMPRESSION_JPEG:
|
||||||
output_compression = COMPRESSION_JPEG;
|
output_compression = COMPRESSION_JPEG;
|
||||||
bits_per_sample = 8;
|
bits_per_sample = 8;
|
||||||
@ -287,15 +282,12 @@ static int set_tiff_directory_info(t4_rx_state_t *s)
|
|||||||
photometric = PHOTOMETRIC_MINISBLACK;
|
photometric = PHOTOMETRIC_MINISBLACK;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
output_compression = COMPRESSION_T43;
|
output_compression = COMPRESSION_T43;
|
||||||
bits_per_sample = 8;
|
bits_per_sample = 8;
|
||||||
samples_per_pixel = 3;
|
samples_per_pixel = 3;
|
||||||
photometric = PHOTOMETRIC_ITULAB;
|
photometric = PHOTOMETRIC_ITULAB;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
output_compression = COMPRESSION_T45;
|
output_compression = COMPRESSION_T45;
|
||||||
@ -323,11 +315,9 @@ static int set_tiff_directory_info(t4_rx_state_t *s)
|
|||||||
case COMPRESSION_JPEG:
|
case COMPRESSION_JPEG:
|
||||||
TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
|
TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
|
||||||
break;
|
break;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case COMPRESSION_T43:
|
case COMPRESSION_T43:
|
||||||
TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
|
TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
TIFFSetField(t->tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
|
TIFFSetField(t->tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
|
||||||
TIFFSetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, bits_per_sample);
|
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:
|
case T4_COMPRESSION_T42_T81:
|
||||||
s->metadata.image_length = t42_decode_get_image_length(&s->decoder.t42);
|
s->metadata.image_length = t42_decode_get_image_length(&s->decoder.t42);
|
||||||
break;
|
break;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
s->metadata.image_length = t43_decode_get_image_length(&s->decoder.t43);
|
s->metadata.image_length = t43_decode_get_image_length(&s->decoder.t43);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
s->metadata.image_length = t45_decode_get_image_length(&s->decoder.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 --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
static int write_tiff_t43_image(t4_rx_state_t *s)
|
static int write_tiff_t43_image(t4_rx_state_t *s)
|
||||||
{
|
{
|
||||||
uint8_t *buf;
|
uint8_t *buf;
|
||||||
@ -621,7 +608,6 @@ static int write_tiff_t43_image(t4_rx_state_t *s)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
#endif
|
|
||||||
|
|
||||||
static int write_tiff_image(t4_rx_state_t *s)
|
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;
|
return -1;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
/* We need to perform this compression here, as libtiff does not understand it. */
|
/* We need to perform this compression here, as libtiff does not understand it. */
|
||||||
if (write_tiff_t43_image(s) < 0)
|
if (write_tiff_t43_image(s) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
/* We need to perform this compression here, as libtiff does not understand it. */
|
/* 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)
|
static bool select_tiff_compression(t4_rx_state_t *s, int output_image_type)
|
||||||
{
|
{
|
||||||
s->tiff.image_type = 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))))
|
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");
|
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
|
#endif
|
||||||
case T4_COMPRESSION_T42_T81:
|
case T4_COMPRESSION_T42_T81:
|
||||||
return t42_decode_release(&s->decoder.t42);
|
return t42_decode_release(&s->decoder.t42);
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
return t43_decode_release(&s->decoder.t43);
|
return t43_decode_release(&s->decoder.t43);
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
return t45_decode_release(&s->decoder.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);
|
pre_encoded_init(&s->decoder.no_decoder);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
switch (s->metadata.compression)
|
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);
|
pre_encoded_init(&s->decoder.no_decoder);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
switch (s->metadata.compression)
|
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
|
#endif
|
||||||
case T4_COMPRESSION_T42_T81:
|
case T4_COMPRESSION_T42_T81:
|
||||||
return t42_decode_set_row_write_handler(&s->decoder.t42, handler, user_data);
|
return t42_decode_set_row_write_handler(&s->decoder.t42, handler, user_data);
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
return t43_decode_set_row_write_handler(&s->decoder.t43, handler, user_data);
|
return t43_decode_set_row_write_handler(&s->decoder.t43, handler, user_data);
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
return t45_decode_set_row_write_handler(&s->decoder.t45, handler, user_data);
|
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->image_length = t->length;
|
||||||
t->line_image_size = t42_decode_get_compressed_image_size(&s->decoder.t42)/8;
|
t->line_image_size = t42_decode_get_compressed_image_size(&s->decoder.t42)/8;
|
||||||
break;
|
break;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
t->type = T4_IMAGE_TYPE_COLOUR_8BIT;
|
t->type = T4_IMAGE_TYPE_COLOUR_8BIT;
|
||||||
t->width = t43_decode_get_image_width(&s->decoder.t43);
|
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->image_length = t->length;
|
||||||
t->line_image_size = t43_decode_get_compressed_image_size(&s->decoder.t43)/8;
|
t->line_image_size = t43_decode_get_compressed_image_size(&s->decoder.t43)/8;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
break;
|
break;
|
||||||
@ -1235,12 +1214,10 @@ SPAN_DECLARE(int) t4_rx_start_page(t4_rx_state_t *s)
|
|||||||
t42_decode_restart(&s->decoder.t42);
|
t42_decode_restart(&s->decoder.t42);
|
||||||
s->image_put_handler = (t4_image_put_handler_t) t42_decode_put;
|
s->image_put_handler = (t4_image_put_handler_t) t42_decode_put;
|
||||||
break;
|
break;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
t43_decode_restart(&s->decoder.t43);
|
t43_decode_restart(&s->decoder.t43);
|
||||||
s->image_put_handler = (t4_image_put_handler_t) t43_decode_put;
|
s->image_put_handler = (t4_image_put_handler_t) t43_decode_put;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
t45_decode_restart(&s->decoder.t45);
|
t45_decode_restart(&s->decoder.t45);
|
||||||
@ -1311,11 +1288,9 @@ SPAN_DECLARE(int) t4_rx_end_page(t4_rx_state_t *s)
|
|||||||
else
|
else
|
||||||
s->tiff.image_type = T4_IMAGE_TYPE_GRAY_8BIT;
|
s->tiff.image_type = T4_IMAGE_TYPE_GRAY_8BIT;
|
||||||
break;
|
break;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
length = t43_decode_get_image_length(&s->decoder.t43);
|
length = t43_decode_get_image_length(&s->decoder.t43);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
length = t45_decode_get_image_length(&s->decoder.t45);
|
length = t45_decode_get_image_length(&s->decoder.t45);
|
||||||
|
@ -95,9 +95,7 @@
|
|||||||
#include "spandsp/t81_t82_arith_coding.h"
|
#include "spandsp/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/t85.h"
|
#include "spandsp/t85.h"
|
||||||
#include "spandsp/t42.h"
|
#include "spandsp/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/t43.h"
|
#include "spandsp/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/t4_t6_decode.h"
|
#include "spandsp/t4_t6_decode.h"
|
||||||
#include "spandsp/t4_t6_encode.h"
|
#include "spandsp/t4_t6_encode.h"
|
||||||
|
|
||||||
@ -105,9 +103,7 @@
|
|||||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/private/t85.h"
|
#include "spandsp/private/t85.h"
|
||||||
#include "spandsp/private/t42.h"
|
#include "spandsp/private/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/private/t43.h"
|
#include "spandsp/private/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/private/t4_t6_decode.h"
|
#include "spandsp/private/t4_t6_decode.h"
|
||||||
#include "spandsp/private/t4_t6_encode.h"
|
#include "spandsp/private/t4_t6_encode.h"
|
||||||
#include "spandsp/private/image_translate.h"
|
#include "spandsp/private/image_translate.h"
|
||||||
|
@ -92,9 +92,7 @@
|
|||||||
#include "spandsp/t81_t82_arith_coding.h"
|
#include "spandsp/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/t85.h"
|
#include "spandsp/t85.h"
|
||||||
#include "spandsp/t42.h"
|
#include "spandsp/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/t43.h"
|
#include "spandsp/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/t4_t6_decode.h"
|
#include "spandsp/t4_t6_decode.h"
|
||||||
#include "spandsp/t4_t6_encode.h"
|
#include "spandsp/t4_t6_encode.h"
|
||||||
|
|
||||||
@ -102,9 +100,7 @@
|
|||||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/private/t85.h"
|
#include "spandsp/private/t85.h"
|
||||||
#include "spandsp/private/t42.h"
|
#include "spandsp/private/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/private/t43.h"
|
#include "spandsp/private/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/private/t4_t6_decode.h"
|
#include "spandsp/private/t4_t6_decode.h"
|
||||||
#include "spandsp/private/t4_t6_encode.h"
|
#include "spandsp/private/t4_t6_encode.h"
|
||||||
#include "spandsp/private/image_translate.h"
|
#include "spandsp/private/image_translate.h"
|
||||||
|
@ -64,9 +64,7 @@
|
|||||||
#include "spandsp/t81_t82_arith_coding.h"
|
#include "spandsp/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/t85.h"
|
#include "spandsp/t85.h"
|
||||||
#include "spandsp/t42.h"
|
#include "spandsp/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/t43.h"
|
#include "spandsp/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/t4_t6_decode.h"
|
#include "spandsp/t4_t6_decode.h"
|
||||||
#include "spandsp/t4_t6_encode.h"
|
#include "spandsp/t4_t6_encode.h"
|
||||||
|
|
||||||
@ -74,9 +72,7 @@
|
|||||||
#include "spandsp/private/t81_t82_arith_coding.h"
|
#include "spandsp/private/t81_t82_arith_coding.h"
|
||||||
#include "spandsp/private/t85.h"
|
#include "spandsp/private/t85.h"
|
||||||
#include "spandsp/private/t42.h"
|
#include "spandsp/private/t42.h"
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
#include "spandsp/private/t43.h"
|
#include "spandsp/private/t43.h"
|
||||||
#endif
|
|
||||||
#include "spandsp/private/t4_t6_decode.h"
|
#include "spandsp/private/t4_t6_decode.h"
|
||||||
#include "spandsp/private/t4_t6_encode.h"
|
#include "spandsp/private/t4_t6_encode.h"
|
||||||
#include "spandsp/private/image_translate.h"
|
#include "spandsp/private/image_translate.h"
|
||||||
@ -420,7 +416,7 @@ static int get_tiff_directory_info(t4_tx_state_t *s)
|
|||||||
float bmax;
|
float bmax;
|
||||||
uint8_t parm8;
|
uint8_t parm8;
|
||||||
#endif
|
#endif
|
||||||
#if defined(TIFFTAG_INDEXED)
|
#if defined(SPANDSP_SUPPORT_TIFF_FX)
|
||||||
uint16_t parm16;
|
uint16_t parm16;
|
||||||
#endif
|
#endif
|
||||||
uint32_t parm32;
|
uint32_t parm32;
|
||||||
@ -457,7 +453,7 @@ static int get_tiff_directory_info(t4_tx_state_t *s)
|
|||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
#if defined(TIFFTAG_INDEXED)
|
#if defined(SPANDSP_SUPPORT_TIFF_FX)
|
||||||
parm16 = 0;
|
parm16 = 0;
|
||||||
if (TIFFGetField(t->tiff_file, TIFFTAG_INDEXED, &parm16))
|
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:
|
case COMPRESSION_T85:
|
||||||
span_log(&s->logging, SPAN_LOG_FLOW, "T.85\n");
|
span_log(&s->logging, SPAN_LOG_FLOW, "T.85\n");
|
||||||
break;
|
break;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case COMPRESSION_T43:
|
case COMPRESSION_T43:
|
||||||
span_log(&s->logging, SPAN_LOG_FLOW, "T.43\n");
|
span_log(&s->logging, SPAN_LOG_FLOW, "T.43\n");
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case COMPRESSION_JPEG:
|
case COMPRESSION_JPEG:
|
||||||
span_log(&s->logging, SPAN_LOG_FLOW, "JPEG\n");
|
span_log(&s->logging, SPAN_LOG_FLOW, "JPEG\n");
|
||||||
if (t->photo_metric == PHOTOMETRIC_ITULAB)
|
if (t->photo_metric == PHOTOMETRIC_ITULAB)
|
||||||
@ -959,7 +953,6 @@ static int read_tiff_t85_image(t4_tx_state_t *s)
|
|||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
static int read_tiff_t43_image(t4_tx_state_t *s)
|
static int read_tiff_t43_image(t4_tx_state_t *s)
|
||||||
{
|
{
|
||||||
int biggest;
|
int biggest;
|
||||||
@ -1037,7 +1030,6 @@ static int read_tiff_t43_image(t4_tx_state_t *s)
|
|||||||
return s->tiff.image_size;
|
return s->tiff.image_size;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
#endif
|
|
||||||
|
|
||||||
static int read_tiff_t42_t81_image(t4_tx_state_t *s)
|
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 total_len;
|
||||||
int i;
|
int i;
|
||||||
int len;
|
int len;
|
||||||
|
int alter_image;
|
||||||
uint8_t *t;
|
uint8_t *t;
|
||||||
|
|
||||||
if (s->metadata.image_type != s->tiff.image_type || s->metadata.image_width != s->tiff.image_width)
|
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);
|
image_translate_restart(&s->translator, s->tiff.image_length);
|
||||||
s->metadata.image_length = image_translate_get_output_length(&s->translator);
|
s->metadata.image_length = image_translate_get_output_length(&s->translator);
|
||||||
|
image_translate_set_row_read_handler(&s->translator, translate_row_read2, s);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
alter_image = false;
|
||||||
s->metadata.image_length = s->tiff.image_length;
|
s->metadata.image_length = s->tiff.image_length;
|
||||||
}
|
}
|
||||||
s->pack_buf = NULL;
|
s->pack_buf = NULL;
|
||||||
s->pack_ptr = 0;
|
s->pack_ptr = 0;
|
||||||
s->pack_row = 0;
|
s->pack_row = 0;
|
||||||
|
|
||||||
|
s->apply_lab = false;
|
||||||
if (s->tiff.image_type != T4_IMAGE_TYPE_BILEVEL)
|
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
|
/* 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. */
|
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->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)
|
if (read_tiff_t42_t81_image(s) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
s->pack_buf = s->tiff.image_buffer;
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -1209,15 +1203,11 @@ static int read_tiff_image(t4_tx_state_t *s)
|
|||||||
#if defined(SPANDSP_SUPPORT_T43)
|
#if defined(SPANDSP_SUPPORT_T43)
|
||||||
else if (s->tiff.compression == COMPRESSION_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)
|
if ((len = read_tiff_t43_image(s)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
s->pack_buf = s->tiff.image_buffer;
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -1230,15 +1220,11 @@ static int read_tiff_image(t4_tx_state_t *s)
|
|||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
else if (s->tiff.compression == COMPRESSION_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)
|
if (read_tiff_t45_image(s) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
s->pack_buf = s->tiff.image_buffer;
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -1252,7 +1238,7 @@ static int read_tiff_image(t4_tx_state_t *s)
|
|||||||
{
|
{
|
||||||
/* Let libtiff handle the decompression */
|
/* Let libtiff handle the decompression */
|
||||||
TIFFSetField(s->tiff.tiff_file, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
|
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);
|
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;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set_image_width(s, s->metadata.image_width);
|
set_image_width(s, s->metadata.image_width);
|
||||||
set_image_length(s, s->metadata.image_length);
|
set_image_length(s, s->metadata.image_length);
|
||||||
t4_tx_set_image_type(s, s->metadata.image_type);
|
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);
|
set_lab_gamut(&s->lab_params, 0, 100, -85, 85, -75, 125, false);
|
||||||
s->apply_lab = true;
|
s->apply_lab = true;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
s->apply_lab = false;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
total_len = 0;
|
total_len = 0;
|
||||||
for (i = 0; i < s->metadata.image_length; i++)
|
for (i = 0; i < s->metadata.image_length; i++)
|
||||||
@ -1305,7 +1289,7 @@ static int read_tiff_image(t4_tx_state_t *s)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (s->metadata.image_type != s->tiff.image_type || s->metadata.image_width != s->tiff.image_width)
|
if (alter_image)
|
||||||
{
|
{
|
||||||
total_len = 0;
|
total_len = 0;
|
||||||
s->tiff.image_buffer = span_realloc(s->tiff.image_buffer, s->metadata.image_width*s->metadata.image_length*3);
|
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_T42_T81:
|
||||||
case T4_COMPRESSION_SYCC_T81:
|
case T4_COMPRESSION_SYCC_T81:
|
||||||
return t42_encode_set_row_read_handler(&s->encoder.t42, handler, user_data);
|
return t42_encode_set_row_read_handler(&s->encoder.t42, handler, user_data);
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
return t43_encode_set_row_read_handler(&s->encoder.t43, handler, user_data);
|
return t43_encode_set_row_read_handler(&s->encoder.t43, handler, user_data);
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
return t45_encode_set_row_read_handler(&s->encoder.t45, handler, user_data);
|
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 */
|
/* Squashing to a bi-level image is possible */
|
||||||
s->metadata.image_type = T4_IMAGE_TYPE_BILEVEL;
|
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;
|
s->metadata.compression = compression;
|
||||||
res = T4_IMAGE_FORMAT_OK;
|
res = T4_IMAGE_FORMAT_OK;
|
||||||
break;
|
break;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
switch (s->metadata.compression)
|
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;
|
s->metadata.compression = compression;
|
||||||
res = T4_IMAGE_FORMAT_OK;
|
res = T4_IMAGE_FORMAT_OK;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
switch (s->metadata.compression)
|
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:
|
case T4_COMPRESSION_SYCC_T81:
|
||||||
t42_encode_set_image_width(&s->encoder.t42, image_width);
|
t42_encode_set_image_width(&s->encoder.t42, image_width);
|
||||||
break;
|
break;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
t43_encode_set_image_width(&s->encoder.t43, image_width);
|
t43_encode_set_image_width(&s->encoder.t43, image_width);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
t45_encode_set_image_width(&s->encoder.t45, image_width);
|
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:
|
case T4_COMPRESSION_SYCC_T81:
|
||||||
t42_encode_set_image_length(&s->encoder.t42, image_length);
|
t42_encode_set_image_length(&s->encoder.t42, image_length);
|
||||||
break;
|
break;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
t43_encode_set_image_length(&s->encoder.t43, image_length);
|
t43_encode_set_image_length(&s->encoder.t43, image_length);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
t45_encode_set_image_length(&s->encoder.t45, image_length);
|
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:
|
case T4_COMPRESSION_SYCC_T81:
|
||||||
t42_encode_set_image_type(&s->encoder.t42, image_type);
|
t42_encode_set_image_type(&s->encoder.t42, image_type);
|
||||||
break;
|
break;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
t43_encode_set_image_type(&s->encoder.t43, image_type);
|
t43_encode_set_image_type(&s->encoder.t43, image_type);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
t45_encode_set_image_type(&s->encoder.t45, image_type);
|
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->length = t42_encode_get_image_length(&s->encoder.t42);
|
||||||
t->line_image_size = t42_encode_get_compressed_image_size(&s->encoder.t42)/8;
|
t->line_image_size = t42_encode_get_compressed_image_size(&s->encoder.t42)/8;
|
||||||
break;
|
break;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
t->width = t43_encode_get_image_width(&s->encoder.t43);
|
t->width = t43_encode_get_image_width(&s->encoder.t43);
|
||||||
t->length = t43_encode_get_image_length(&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;
|
t->line_image_size = t43_encode_get_compressed_image_size(&s->encoder.t43)/8;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
t->width = t45_encode_get_image_width(&s->encoder.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_T42_T81:
|
||||||
case T4_COMPRESSION_SYCC_T81:
|
case T4_COMPRESSION_SYCC_T81:
|
||||||
return t42_encode_image_complete(&s->encoder.t42);
|
return t42_encode_image_complete(&s->encoder.t42);
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
return t43_encode_image_complete(&s->encoder.t43);
|
return t43_encode_image_complete(&s->encoder.t43);
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
return t45_encode_image_complete(&s->encoder.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);
|
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;
|
s->image_get_handler = (t4_image_get_handler_t) t42_encode_get;
|
||||||
break;
|
break;
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
t43_encode_restart(&s->encoder.t43, s->metadata.image_width, s->metadata.image_length);
|
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;
|
s->image_get_handler = (t4_image_get_handler_t) t43_encode_get;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
t45_encode_restart(&s->encoder.t45, s->metadata.image_width, s->metadata.image_length);
|
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_T42_T81:
|
||||||
case T4_COMPRESSION_SYCC_T81:
|
case T4_COMPRESSION_SYCC_T81:
|
||||||
return t42_encode_release(&s->encoder.t42);
|
return t42_encode_release(&s->encoder.t42);
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
case T4_COMPRESSION_T43:
|
case T4_COMPRESSION_T43:
|
||||||
return t43_encode_release(&s->encoder.t43);
|
return t43_encode_release(&s->encoder.t43);
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
case T4_COMPRESSION_T45:
|
case T4_COMPRESSION_T45:
|
||||||
return t45_encode_release(&s->encoder.t45);
|
return t45_encode_release(&s->encoder.t45);
|
||||||
|
@ -50,6 +50,14 @@ AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/spandsp-sim -DDATADIR="\"$
|
|||||||
|
|
||||||
LIBDIR = -L$(top_builddir)/src
|
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 \
|
noinst_PROGRAMS = ademco_contactid_tests \
|
||||||
adsi_tests \
|
adsi_tests \
|
||||||
alloc_tests \
|
alloc_tests \
|
||||||
@ -65,10 +73,12 @@ noinst_PROGRAMS = ademco_contactid_tests \
|
|||||||
complex_vector_float_tests \
|
complex_vector_float_tests \
|
||||||
complex_vector_int_tests \
|
complex_vector_int_tests \
|
||||||
crc_tests \
|
crc_tests \
|
||||||
|
data_modems_tests \
|
||||||
dc_restore_tests \
|
dc_restore_tests \
|
||||||
dds_tests \
|
dds_tests \
|
||||||
dtmf_rx_tests \
|
dtmf_rx_tests \
|
||||||
dtmf_tx_tests \
|
dtmf_tx_tests \
|
||||||
|
dummy_modems_tests \
|
||||||
echo_tests \
|
echo_tests \
|
||||||
fax_decode \
|
fax_decode \
|
||||||
fax_tests \
|
fax_tests \
|
||||||
@ -94,6 +104,7 @@ noinst_PROGRAMS = ademco_contactid_tests \
|
|||||||
playout_tests \
|
playout_tests \
|
||||||
plc_tests \
|
plc_tests \
|
||||||
power_meter_tests \
|
power_meter_tests \
|
||||||
|
pseudo_terminal_tests \
|
||||||
queue_tests \
|
queue_tests \
|
||||||
r2_mf_rx_tests \
|
r2_mf_rx_tests \
|
||||||
r2_mf_tx_tests \
|
r2_mf_tx_tests \
|
||||||
@ -130,7 +141,9 @@ noinst_PROGRAMS = ademco_contactid_tests \
|
|||||||
v42bis_tests \
|
v42bis_tests \
|
||||||
v8_tests \
|
v8_tests \
|
||||||
vector_float_tests \
|
vector_float_tests \
|
||||||
vector_int_tests
|
vector_int_tests \
|
||||||
|
$(V32BIS_PROGS) \
|
||||||
|
$(V34_PROGS)
|
||||||
|
|
||||||
noinst_HEADERS = echo_monitor.h \
|
noinst_HEADERS = echo_monitor.h \
|
||||||
fax_tester.h \
|
fax_tester.h \
|
||||||
@ -139,6 +152,8 @@ noinst_HEADERS = echo_monitor.h \
|
|||||||
media_monitor.h \
|
media_monitor.h \
|
||||||
modem_monitor.h \
|
modem_monitor.h \
|
||||||
pcap_parse.h \
|
pcap_parse.h \
|
||||||
|
pseudo_terminals.h \
|
||||||
|
socket_harness.h \
|
||||||
udptl.h
|
udptl.h
|
||||||
|
|
||||||
ademco_contactid_tests_SOURCES = ademco_contactid_tests.c
|
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_SOURCES = crc_tests.c
|
||||||
crc_tests_LDADD = $(LIBDIR) -lspandsp
|
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_SOURCES = dc_restore_tests.c
|
||||||
dc_restore_tests_LDADD = $(LIBDIR) -lspandsp
|
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_SOURCES = dtmf_tx_tests.c
|
||||||
dtmf_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
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_SOURCES = echo_tests.c echo_monitor.cpp
|
||||||
echo_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
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_SOURCES = power_meter_tests.c
|
||||||
power_meter_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
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_SOURCES = queue_tests.c
|
||||||
queue_tests_LDADD = $(LIBDIR) -lspandsp
|
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_SOURCES = v29_tests.c line_model_monitor.cpp modem_monitor.cpp
|
||||||
v29_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp
|
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_SOURCES = v42_tests.c
|
||||||
v42_tests_LDADD = $(LIBDIR) -lspandsp
|
v42_tests_LDADD = $(LIBDIR) -lspandsp
|
||||||
|
|
||||||
|
@ -58,9 +58,10 @@ int main(int argc, char *argv[])
|
|||||||
void *b;
|
void *b;
|
||||||
void *c;
|
void *c;
|
||||||
|
|
||||||
if (span_mem_allocators(memalign,
|
if (span_mem_allocators(malloc,
|
||||||
malloc,
|
|
||||||
realloc,
|
realloc,
|
||||||
|
free,
|
||||||
|
memalign,
|
||||||
free))
|
free))
|
||||||
{
|
{
|
||||||
printf("Failed\n");
|
printf("Failed\n");
|
||||||
@ -70,7 +71,7 @@ int main(int argc, char *argv[])
|
|||||||
b = span_alloc(42);
|
b = span_alloc(42);
|
||||||
c = span_realloc(NULL, 42);
|
c = span_realloc(NULL, 42);
|
||||||
printf("%p %p %p\n", a, b, c);
|
printf("%p %p %p\n", a, b, c);
|
||||||
span_free(a);
|
span_aligned_free(a);
|
||||||
span_free(b);
|
span_free(b);
|
||||||
span_free(c);
|
span_free(c);
|
||||||
}
|
}
|
||||||
|
@ -463,8 +463,8 @@ int main(int argc, char *argv[])
|
|||||||
int outframes;
|
int outframes;
|
||||||
SNDFILE *wave_handle;
|
SNDFILE *wave_handle;
|
||||||
SNDFILE *input_wave_handle;
|
SNDFILE *input_wave_handle;
|
||||||
int use_ecm;
|
bool use_ecm;
|
||||||
int use_tep;
|
bool use_tep;
|
||||||
int feedback_audio;
|
int feedback_audio;
|
||||||
int use_transmit_on_idle;
|
int use_transmit_on_idle;
|
||||||
int t38_version;
|
int t38_version;
|
||||||
@ -479,7 +479,6 @@ int main(int argc, char *argv[])
|
|||||||
double tx_when;
|
double tx_when;
|
||||||
double rx_when;
|
double rx_when;
|
||||||
int supported_modems;
|
int supported_modems;
|
||||||
int remove_fill_bits;
|
|
||||||
int opt;
|
int opt;
|
||||||
int start_page;
|
int start_page;
|
||||||
int end_page;
|
int end_page;
|
||||||
@ -490,8 +489,11 @@ int main(int argc, char *argv[])
|
|||||||
int noise_level;
|
int noise_level;
|
||||||
int code_to_look_up;
|
int code_to_look_up;
|
||||||
int scan_line_time;
|
int scan_line_time;
|
||||||
int allowed_bilevel_resolutions;
|
int allowed_bilevel_resolutions[2];
|
||||||
int colour_enabled;
|
int allowed;
|
||||||
|
bool remove_fill_bits;
|
||||||
|
bool colour_enabled;
|
||||||
|
bool t37_like_output;
|
||||||
t38_stats_t t38_stats;
|
t38_stats_t t38_stats;
|
||||||
t30_stats_t t30_stats;
|
t30_stats_t t30_stats;
|
||||||
logging_state_t *logging;
|
logging_state_t *logging;
|
||||||
@ -530,15 +532,22 @@ int main(int argc, char *argv[])
|
|||||||
scan_line_time = 0;
|
scan_line_time = 0;
|
||||||
decode_file_name = NULL;
|
decode_file_name = NULL;
|
||||||
code_to_look_up = -1;
|
code_to_look_up = -1;
|
||||||
allowed_bilevel_resolutions = 0;
|
allowed_bilevel_resolutions[0] = 0;
|
||||||
|
allowed_bilevel_resolutions[1] = 0;
|
||||||
|
allowed = 0;
|
||||||
colour_enabled = false;
|
colour_enabled = false;
|
||||||
|
t37_like_output = false;
|
||||||
t38_transport = T38_TRANSPORT_UDPTL;
|
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)
|
switch (opt)
|
||||||
{
|
{
|
||||||
|
case '7':
|
||||||
|
t37_like_output = true;
|
||||||
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
allowed_bilevel_resolutions = atoi(optarg);
|
allowed_bilevel_resolutions[allowed] = atoi(optarg);
|
||||||
|
allowed ^= 1;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
code_to_look_up = atoi(optarg);
|
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_LETTER
|
||||||
| T4_SUPPORT_LENGTH_US_LEGAL
|
| T4_SUPPORT_LENGTH_US_LEGAL
|
||||||
| T4_SUPPORT_LENGTH_UNLIMITED);
|
| T4_SUPPORT_LENGTH_UNLIMITED);
|
||||||
switch (allowed_bilevel_resolutions)
|
switch (allowed_bilevel_resolutions[i])
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
/* Allow anything */
|
/* Allow anything */
|
||||||
@ -926,7 +935,21 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
t30_set_supported_colour_resolutions(t30_state[i], 0);
|
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_ecm_capability(t30_state[i], use_ecm);
|
||||||
t30_set_supported_compressions(t30_state[i],
|
t30_set_supported_compressions(t30_state[i],
|
||||||
T4_COMPRESSION_T4_1D
|
T4_COMPRESSION_T4_1D
|
||||||
|
@ -28,7 +28,7 @@ run_fax_test()
|
|||||||
fi
|
fi
|
||||||
# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
|
# 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.
|
# 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=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL != 0 ]
|
if [ $RETVAL != 0 ]
|
||||||
then
|
then
|
||||||
@ -43,7 +43,7 @@ run_fax_squash_test()
|
|||||||
{
|
{
|
||||||
# Test with lengthwise squashing of a bilevel image
|
# Test with lengthwise squashing of a bilevel image
|
||||||
rm -f fax_tests.tif
|
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
|
./fax_tests -b ${SQ} ${OPTS} -i ${IN_FILE} >xyzzy 2>xyzzy2
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL != 0 ]
|
if [ $RETVAL != 0 ]
|
||||||
@ -53,7 +53,7 @@ run_fax_squash_test()
|
|||||||
fi
|
fi
|
||||||
# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
|
# 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.
|
# 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=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL != 0 ]
|
if [ $RETVAL != 0 ]
|
||||||
then
|
then
|
||||||
@ -77,7 +77,7 @@ run_colour_fax_test()
|
|||||||
fi
|
fi
|
||||||
# Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t
|
# 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.
|
# 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=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL != 0 ]
|
if [ $RETVAL != 0 ]
|
||||||
then
|
then
|
||||||
@ -91,40 +91,35 @@ run_colour_fax_test()
|
|||||||
ITUTESTS_DIR=../test-data/itu/fax
|
ITUTESTS_DIR=../test-data/itu/fax
|
||||||
TIFFFX_DIR=../test-data/itu/tiff-fx
|
TIFFFX_DIR=../test-data/itu/tiff-fx
|
||||||
LOCALTESTS_DIR=../test-data/local
|
LOCALTESTS_DIR=../test-data/local
|
||||||
|
TIFFCMP=tiffcmp
|
||||||
|
|
||||||
# Colour/gray -> bilevel by not allowing ECM
|
# Colour/gray -> bilevel by not allowing ECM
|
||||||
for OPTS in "-p AA" "-p TT" "-p GG" "-p TG" "-p GT"
|
for OPTS in "-p AA" "-p TT" "-p GG" "-p TG" "-p GT"
|
||||||
do
|
do
|
||||||
echo Colour to bi-level tests disabled
|
IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif"
|
||||||
# IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif"
|
OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-bilevel.tif"
|
||||||
# OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-bilevel.tif"
|
run_colour_fax_test
|
||||||
# run_colour_fax_test
|
|
||||||
|
|
||||||
# IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif"
|
IN_FILE="${LOCALTESTS_DIR}/lenna-bw.tif"
|
||||||
# OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-bilevel.tif"
|
OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-bilevel.tif"
|
||||||
# run_colour_fax_test
|
run_colour_fax_test
|
||||||
|
|
||||||
# IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif"
|
IN_FILE="${TIFFFX_DIR}/c03x_02x.tif"
|
||||||
# OUT_FILE="${LOCALTESTS_DIR}/lenna-bw-bilevel.tif"
|
OUT_FILE="${TIFFFX_DIR}/c03x_02x-bilevel.tif"
|
||||||
# run_colour_fax_test
|
run_colour_fax_test
|
||||||
|
|
||||||
# IN_FILE="${TIFFFX_DIR}/c03x_02x.tif"
|
IN_FILE="${TIFFFX_DIR}/l02x_02x.tif"
|
||||||
# OUT_FILE="${TIFFFX_DIR}/c03x_02x.tif"
|
OUT_FILE="${TIFFFX_DIR}/l02x_02x-bilevel.tif"
|
||||||
# run_colour_fax_test
|
run_colour_fax_test
|
||||||
|
|
||||||
# IN_FILE="${TIFFFX_DIR}/l02x_02x.tif"
|
IN_FILE="${TIFFFX_DIR}/l04x_02x.tif"
|
||||||
# OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif"
|
OUT_FILE="${TIFFFX_DIR}/l04x_02x-bilevel.tif"
|
||||||
# run_colour_fax_test
|
run_colour_fax_test
|
||||||
|
|
||||||
# IN_FILE="${TIFFFX_DIR}/l04x_02x.tif"
|
|
||||||
# OUT_FILE="${TIFFFX_DIR}/l04x_02x.tif"
|
|
||||||
# run_colour_fax_test
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Colour/gray -> colour/gray
|
# 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"
|
for OPTS in "-p AA -C -e" "-p TT -C -e" "-p GG -C -e" "-p TG -C -e" "-p GT -C -e"
|
||||||
do
|
do
|
||||||
echo Colour to colour tests disabled
|
|
||||||
# IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif"
|
# IN_FILE="${LOCALTESTS_DIR}/lenna-colour.tif"
|
||||||
# OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-out.tif"
|
# OUT_FILE="${LOCALTESTS_DIR}/lenna-colour-out.tif"
|
||||||
# run_colour_fax_test
|
# run_colour_fax_test
|
||||||
@ -137,9 +132,9 @@ do
|
|||||||
# OUT_FILE="${TIFFFX_DIR}/c03x_02x-out.tif"
|
# OUT_FILE="${TIFFFX_DIR}/c03x_02x-out.tif"
|
||||||
# run_colour_fax_test
|
# run_colour_fax_test
|
||||||
|
|
||||||
# IN_FILE="${TIFFFX_DIR}/l02x_02x.tif"
|
IN_FILE="${TIFFFX_DIR}/l02x_02x.tif"
|
||||||
# OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif"
|
OUT_FILE="${TIFFFX_DIR}/l02x_02x.tif"
|
||||||
# run_colour_fax_test
|
run_colour_fax_test
|
||||||
|
|
||||||
# IN_FILE="${TIFFFX_DIR}/l04x_02x.tif"
|
# IN_FILE="${TIFFFX_DIR}/l04x_02x.tif"
|
||||||
# OUT_FILE="${TIFFFX_DIR}/l04x_02x.tif"
|
# OUT_FILE="${TIFFFX_DIR}/l04x_02x.tif"
|
||||||
|
185
libs/spandsp/tests/pseudo_terminal_tests.c
Normal file
185
libs/spandsp/tests/pseudo_terminal_tests.c
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
/*
|
||||||
|
* 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 ------------------------------------------------------------*/
|
@ -51,6 +51,7 @@
|
|||||||
#include "pseudo_terminals.h"
|
#include "pseudo_terminals.h"
|
||||||
|
|
||||||
int next_id = 0;
|
int next_id = 0;
|
||||||
|
const char *device_root_name = "/dev/spandsp";
|
||||||
|
|
||||||
int psuedo_terminal_close(modem_t *modem)
|
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);
|
modem->threadAbort = CreateEvent(NULL, true, false, NULL);
|
||||||
#else
|
#else
|
||||||
modem->slot = next_id++;
|
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 */
|
/* Remove any stale link which might be present */
|
||||||
unlink(modem->devlink);
|
unlink(modem->devlink);
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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 ------------------------------------------------------------*/
|
|
@ -47,8 +47,6 @@
|
|||||||
|
|
||||||
#include "spandsp.h"
|
#include "spandsp.h"
|
||||||
|
|
||||||
#include "spandsp/t30_fcf.h"
|
|
||||||
|
|
||||||
#include "spandsp-sim.h"
|
#include "spandsp-sim.h"
|
||||||
|
|
||||||
#undef SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
#undef SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||||
|
@ -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_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_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A');
|
||||||
t30_set_ecm_capability(t30, use_ecm);
|
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))
|
if (pcap_scan_pkts(input_file_name, src_addr, src_port, dest_addr, dest_port, t38_terminal_timing_update, process_packet, NULL))
|
||||||
exit(2);
|
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_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_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'B');
|
||||||
t30_set_ecm_capability(t30, use_ecm);
|
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);
|
logging = fax_get_logging_state(fax_state);
|
||||||
span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
|
span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
|
||||||
|
@ -300,7 +300,7 @@ int main(int argc, char *argv[])
|
|||||||
memcpy(data, jpeg_table, jpeg_table_len - 2);
|
memcpy(data, jpeg_table, jpeg_table_len - 2);
|
||||||
|
|
||||||
if (total_len != total_image_len)
|
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;
|
off = total_len;
|
||||||
switch (compression)
|
switch (compression)
|
||||||
{
|
{
|
||||||
@ -309,7 +309,7 @@ int main(int argc, char *argv[])
|
|||||||
case COMPRESSION_CCITT_T6:
|
case COMPRESSION_CCITT_T6:
|
||||||
break;
|
break;
|
||||||
case COMPRESSION_T85:
|
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++)
|
for (i = 0; i < 16; i++)
|
||||||
printf("0x%02x\n", data[i]);
|
printf("0x%02x\n", data[i]);
|
||||||
t85_decode_init(&t85_dec, t85_row_write_handler, NULL);
|
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);
|
t85_decode_release(&t85_dec);
|
||||||
return 0;
|
return 0;
|
||||||
case COMPRESSION_T43:
|
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)
|
if (pack_16(data) == 0xFFA8)
|
||||||
{
|
{
|
||||||
data += 2;
|
data += 2;
|
||||||
@ -447,7 +447,7 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
off += bytes_per_row;
|
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 */
|
/* We now have the image in memory in RGB form */
|
||||||
|
|
||||||
@ -497,7 +497,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
TIFFClose(tif);
|
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 */
|
/* We now have the image in memory in ITULAB form */
|
||||||
|
|
||||||
|
@ -288,20 +288,16 @@ int main(int argc, char *argv[])
|
|||||||
compression_step = -1;
|
compression_step = -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(SPANDSP_SUPPORT_T42)
|
|
||||||
else if (strcmp(optarg, "T81") == 0)
|
else if (strcmp(optarg, "T81") == 0)
|
||||||
{
|
{
|
||||||
compression = T4_COMPRESSION_T42_T81;
|
compression = T4_COMPRESSION_T42_T81;
|
||||||
compression_step = -1;
|
compression_step = -1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T43)
|
|
||||||
else if (strcmp(optarg, "T43") == 0)
|
else if (strcmp(optarg, "T43") == 0)
|
||||||
{
|
{
|
||||||
compression = T4_COMPRESSION_T43;
|
compression = T4_COMPRESSION_T43;
|
||||||
compression_step = -1;
|
compression_step = -1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if defined(SPANDSP_SUPPORT_T45)
|
#if defined(SPANDSP_SUPPORT_T45)
|
||||||
else if (strcmp(optarg, "T45") == 0)
|
else if (strcmp(optarg, "T45") == 0)
|
||||||
{
|
{
|
||||||
|
26
libs/spandsp/yum-prepare.sh
Normal file
26
libs/spandsp/yum-prepare.sh
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user