diff --git a/libs/spandsp/Makefile.am b/libs/spandsp/Makefile.am index 69f1b06823..193c108c6b 100644 --- a/libs/spandsp/Makefile.am +++ b/libs/spandsp/Makefile.am @@ -15,8 +15,6 @@ ## You should have received a copy of the GNU Lesser General Public ## License along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.49 2009/05/30 05:55:22 steveu Exp $ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) @@ -37,9 +35,9 @@ EXTRA_DIST = autogen.sh \ debian/rules \ debian/watch \ README.testdata \ - spandsp.pc \ spandsp.spec \ spandsp/fax-tests.dtd \ + spandsp/fax-tests.xml \ spandsp/global-tones.xml \ spandsp/tones.dtd \ spandsp/tsb85.xml \ diff --git a/libs/spandsp/autogen.sh b/libs/spandsp/autogen.sh index a32d63e370..2d9a0670da 100755 --- a/libs/spandsp/autogen.sh +++ b/libs/spandsp/autogen.sh @@ -16,9 +16,6 @@ # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: autogen.sh,v 1.6 2008/03/30 18:33:24 steveu Exp $ -# UNAME=`uname` diff --git a/libs/spandsp/configure.ac b/libs/spandsp/configure.ac index bfc348584c..3aeb44ff52 100644 --- a/libs/spandsp/configure.ac +++ b/libs/spandsp/configure.ac @@ -15,17 +15,11 @@ # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: configure.ac,v 1.73 2009/10/03 04:37:25 steveu Exp $ # @start 1 AC_INIT -CFLAGS="$CFLAGS $CONFIGURE_CFLAGS" -CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS" -LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS" - m4_include(config/ax_compiler_vendor.m4) m4_include(config/ax_check_real_file.m4) m4_include(config/ax_fixed_point_machine.m4) @@ -209,7 +203,9 @@ AC_CHECK_HEADERS([sys/select.h]) AC_CHECK_HEADERS([sys/ioctl.h]) AC_CHECK_HEADERS([sys/fcntl.h]) AC_CHECK_HEADERS([sndfile.h]) +AC_CHECK_HEADERS([fenv.h]) AC_CHECK_HEADERS([fftw3.h], , [AC_CHECK_HEADERS([fftw.h])]) +AC_CHECK_HEADERS([pcap.h]) AC_CHECK_HEADERS([pthread.h]) if test "${build}" == "${host}" then @@ -270,6 +266,11 @@ then esac fi +#AC_DEFINE([SPANDSP_SUPPORT_T85], [1], [Support T.85 JBIG compression]) +SPANDSP_SUPPORT_T85="#undef SPANDSP_SUPPORT_T85" +#AC_DEFINE([SPANDSP_SUPPORT_V34], [1], [Support the V.34 FAX modem]) +SPANDSP_SUPPORT_V34="#undef SPANDSP_SUPPORT_V34" + AC_CHECK_LIB([m], [cos]) # Some platforms still seem to lack the basic single precision trig and power related function. AC_SEARCH_LIBS([sinf], [m], AC_DEFINE([HAVE_SINF], [1], [Define to 1 if you have the sinf() function.])) @@ -293,6 +294,7 @@ if test -n "$enable_tests" ; then AC_LANG([C]) AC_CHECK_LIB([sndfile], [sf_open], SIMLIBS="$SIMLIBS -lsndfile", AC_MSG_ERROR("Can't make tests without libsndfile (does your system require a libsndfile-devel package?)")) AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], SIMLIBS="$SIMLIBS -lfftw3", [AC_CHECK_LIB([fftw], [fftw_create_plan], SIMLIBS="$SIMLIBS -lfftw", AC_MSG_ERROR("Can't make tests without FFTW 2 or 3 (does your system require an fftw?-devel package?)"))]) + AC_CHECK_LIB([pcap], [pcap_open_offline], TESTLIBS="$TESTLIBS -lpcap", AC_MSG_ERROR("Can't make tests without libpcap (does your system require a libpcap-devel package?)")) AC_CHECK_LIB([pthread], [pthread_attr_init], TESTLIBS="$TESTLIBS -lpthread") AC_CHECK_LIB([dl], [dlopen], TESTLIBS="$TESTLIBS -ldl") AC_CHECK_LIB([Xft], [XftFontOpen], TESTLIBS="$TESTLIBS -lXft",, $TESTLIBS) @@ -366,6 +368,37 @@ sun) COMP_VENDOR_LDFLAGS= REMOVE_FROM_VAR(CFLAGS, -Xc) ;; +intel) + COMP_VENDOR_CFLAGS="-std=c99 -D_POSIX_C_SOURCE=2 -D_GNU_SOURCE=1 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" + if test "$enable_sse5" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse5 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse4a" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse4a $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse4_2" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse42 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse4_1" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse41 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_ssse3" = "yes" ; then + COMP_VENDOR_CFLAGS="-mssse3 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse3" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse3 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse2" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse2 $COMP_VENDOR_CFLAGS" + fi + if test "$enable_sse" = "yes" ; then + COMP_VENDOR_CFLAGS="-msse $COMP_VENDOR_CFLAGS" + fi + if test "$enable_mmx" = "yes" ; then + COMP_VENDOR_CFLAGS="-mmmx $COMP_VENDOR_CFLAGS" + fi + COMP_VENDOR_LDFLAGS= + ;; *) COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS" COMP_VENDOR_LDFLAGS= @@ -438,15 +471,13 @@ fi if test "$enable_builtin_tiff" = "yes" ; then abs_tiffdir="`cd $srcdir/../tiff-3.8.2/ && pwd`" - spandsp_builddir="`pwd`" - abs_tiffbuilddir="`cd $spandsp_builddir/../tiff-3.8.2/ && pwd`" save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -I$abs_tiffdir/libtiff" AC_CHECK_HEADERS([tiffio.h]) CFLAGS="$save_CFLAGS" COMP_VENDOR_CFLAGS="-I$abs_tiffdir/libtiff $COMP_VENDOR_CFLAGS" COMP_VENDOR_LDFLAGS="-L$abs_tiffdir/libtiff $COMP_VENDOR_LDFLAGS" - LIBS="$LIBS $abs_tiffbuilddir/libtiff/libtiff.la" + LIBS="$LIBS $abs_tiffdir/libtiff/libtiff.la" AC_DEFINE([HAVE_LIBTIFF], [1], [Define to 1 if you have the `tiff' library (-ltiff).]) else AC_CHECK_HEADERS([tiffio.h]) @@ -464,6 +495,8 @@ AC_SUBST(TESTLIBS) AC_SUBST(SPANDSP_USE_FIXED_POINT) AC_SUBST(SPANDSP_MISALIGNED_ACCESS_FAILS) AC_SUBST(SPANDSP_USE_EXPORT_CAPABILITY) +AC_SUBST(SPANDSP_SUPPORT_T85) +AC_SUBST(SPANDSP_SUPPORT_V34) AC_SUBST(INSERT_INTTYPES_HEADER) AC_SUBST(INSERT_STDINT_HEADER) AC_SUBST(INSERT_TGMATH_HEADER) diff --git a/libs/spandsp/doc/Makefile.am b/libs/spandsp/doc/Makefile.am index ba4386a156..b85883f4f7 100644 --- a/libs/spandsp/doc/Makefile.am +++ b/libs/spandsp/doc/Makefile.am @@ -15,8 +15,6 @@ ## You should have received a copy of the GNU Lesser General Public ## License along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.12 2008/09/20 15:44:40 steveu Exp $ MAINTAINERCLEANFILES = Makefile.in diff --git a/libs/spandsp/doc/t38_manual.xml b/libs/spandsp/doc/t38_manual.xml index 095d7d7d03..7edcd9583c 100644 --- a/libs/spandsp/doc/t38_manual.xml +++ b/libs/spandsp/doc/t38_manual.xml @@ -1,7 +1,6 @@ - 2007-11-14 diff --git a/libs/spandsp/spandsp-sim/Makefile.am b/libs/spandsp/spandsp-sim/Makefile.am index 63fb09473b..d33575a55c 100644 --- a/libs/spandsp/spandsp-sim/Makefile.am +++ b/libs/spandsp/spandsp-sim/Makefile.am @@ -15,8 +15,6 @@ ## 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. -## -## $Id: Makefile.am,v 1.10 2009/06/02 16:03:55 steveu Exp $ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) diff --git a/libs/spandsp/spandsp-sim/g1050.c b/libs/spandsp/spandsp-sim/g1050.c index 10b7753226..afdcf82d63 100644 --- a/libs/spandsp/spandsp-sim/g1050.c +++ b/libs/spandsp/spandsp-sim/g1050.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: g1050.c,v 1.17 2009/06/02 14:55:36 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/spandsp-sim/line_model.c b/libs/spandsp/spandsp-sim/line_model.c index 88af203ab0..001af2c581 100644 --- a/libs/spandsp/spandsp-sim/line_model.c +++ b/libs/spandsp/spandsp-sim/line_model.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: line_model.c,v 1.14 2009/09/23 16:02:59 steveu Exp $ */ #if defined(HAVE_CONFIG_H) @@ -505,12 +503,15 @@ SPAN_DECLARE(int) one_way_line_model_release(one_way_line_model_state_t *s) SPAN_DECLARE(both_ways_line_model_state_t *) both_ways_line_model_init(int model1, float noise1, + float echo_level_cpe1, + float echo_level_co1, int model2, float noise2, + float echo_level_cpe2, + float echo_level_co2, int codec, int rbs_pattern) { - float echo_level; both_ways_line_model_state_t *s; if ((s = (both_ways_line_model_state_t *) malloc(sizeof(*s))) == NULL) @@ -549,11 +550,10 @@ SPAN_DECLARE(both_ways_line_model_state_t *) both_ways_line_model_init(int model s->line2.mains_interference = 0; /* Echos */ - echo_level = -15; /* in dB */ - s->line1.near_co_hybrid_echo = pow(10, echo_level/20.0f); - s->line2.near_co_hybrid_echo = pow(10, echo_level/20.0f); - s->line1.near_cpe_hybrid_echo = pow(10, echo_level/20.0f); - s->line2.near_cpe_hybrid_echo = pow(10, echo_level/20.0f); + s->line1.near_co_hybrid_echo = pow(10, echo_level_co1/20.0f); + s->line2.near_co_hybrid_echo = pow(10, echo_level_co2/20.0f); + s->line1.near_cpe_hybrid_echo = pow(10, echo_level_cpe1/20.0f); + s->line2.near_cpe_hybrid_echo = pow(10, echo_level_cpe2/20.0f); return s; } diff --git a/libs/spandsp/spandsp-sim/make_line_models.c b/libs/spandsp/spandsp-sim/make_line_models.c index 42fac11fa8..fd7b81f72f 100644 --- a/libs/spandsp/spandsp-sim/make_line_models.c +++ b/libs/spandsp/spandsp-sim/make_line_models.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: make_line_models.c,v 1.10 2009/09/23 16:02:59 steveu Exp $ */ /*! \page make_line_models_page Telephony line model construction diff --git a/libs/spandsp/spandsp-sim/rfc2198_sim.c b/libs/spandsp/spandsp-sim/rfc2198_sim.c index 16929bf158..b187ae6e15 100644 --- a/libs/spandsp/spandsp-sim/rfc2198_sim.c +++ b/libs/spandsp/spandsp-sim/rfc2198_sim.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: rfc2198_sim.c,v 1.10 2009/06/01 16:27:12 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/spandsp-sim/spandsp-sim.h b/libs/spandsp/spandsp-sim/spandsp-sim.h index 8dfa9b3374..ea15435665 100644 --- a/libs/spandsp/spandsp-sim/spandsp-sim.h +++ b/libs/spandsp/spandsp-sim/spandsp-sim.h @@ -21,8 +21,6 @@ * 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. - * - * $Id: spandsp-sim.h,v 1.5 2008/04/26 13:39:16 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/spandsp-sim/spandsp/g1050.h b/libs/spandsp/spandsp-sim/spandsp/g1050.h index b7ffb80574..731947b39c 100644 --- a/libs/spandsp/spandsp-sim/spandsp/g1050.h +++ b/libs/spandsp/spandsp-sim/spandsp/g1050.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: g1050.h,v 1.12 2009/06/01 16:27:12 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/spandsp-sim/spandsp/line_model.h b/libs/spandsp/spandsp-sim/spandsp/line_model.h index ce8f7ddd09..550e8a80fe 100644 --- a/libs/spandsp/spandsp-sim/spandsp/line_model.h +++ b/libs/spandsp/spandsp-sim/spandsp/line_model.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: line_model.h,v 1.7.4.1 2009/12/19 10:16:44 steveu Exp $ */ /*! \file */ @@ -147,8 +145,12 @@ SPAN_DECLARE(void) both_ways_line_model_set_mains_pickup(both_ways_line_model_st SPAN_DECLARE(both_ways_line_model_state_t *) both_ways_line_model_init(int model1, float noise1, + float echo_level_cpe1, + float echo_level_co1, int model2, float noise2, + float echo_level_cpe2, + float echo_level_co2, int codec, int rbs_pattern); diff --git a/libs/spandsp/spandsp-sim/spandsp/line_models.h b/libs/spandsp/spandsp-sim/spandsp/line_models.h index bf68f936de..3acdd4492c 100644 --- a/libs/spandsp/spandsp-sim/spandsp/line_models.h +++ b/libs/spandsp/spandsp-sim/spandsp/line_models.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: line_models.h,v 1.3 2008/04/17 18:03:23 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/spandsp-sim/spandsp/rfc2198_sim.h b/libs/spandsp/spandsp-sim/spandsp/rfc2198_sim.h index 51618028dc..a0c3d64b62 100644 --- a/libs/spandsp/spandsp-sim/spandsp/rfc2198_sim.h +++ b/libs/spandsp/spandsp-sim/spandsp/rfc2198_sim.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: rfc2198_sim.h,v 1.6 2009/05/31 14:47:10 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/spandsp-sim/spandsp/test_utils.h b/libs/spandsp/spandsp-sim/spandsp/test_utils.h index f64c838374..22815a35c6 100644 --- a/libs/spandsp/spandsp-sim/spandsp/test_utils.h +++ b/libs/spandsp/spandsp-sim/spandsp/test_utils.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: test_utils.h,v 1.9 2009/05/31 14:47:10 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/spandsp-sim/test_utils.c b/libs/spandsp/spandsp-sim/test_utils.c index 992da5cba8..d2fc2fc7e5 100644 --- a/libs/spandsp/spandsp-sim/test_utils.c +++ b/libs/spandsp/spandsp-sim/test_utils.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: test_utils.c,v 1.14 2009/06/01 16:27:12 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/spandsp/global-tones.xml b/libs/spandsp/spandsp/global-tones.xml index a1012bab93..466dae5d2f 100644 --- a/libs/spandsp/spandsp/global-tones.xml +++ b/libs/spandsp/spandsp/global-tones.xml @@ -365,6 +365,7 @@ + @@ -444,6 +445,7 @@ + @@ -596,6 +598,7 @@ + @@ -1080,6 +1083,7 @@ + @@ -1201,6 +1205,7 @@ + @@ -1647,6 +1652,7 @@ + @@ -1700,6 +1706,7 @@ + @@ -1967,6 +1974,7 @@ + @@ -2181,6 +2189,7 @@ + @@ -2210,6 +2219,7 @@ + @@ -2419,6 +2429,7 @@ + @@ -2571,6 +2582,7 @@ + @@ -3136,6 +3148,7 @@ + @@ -3227,6 +3240,7 @@ + @@ -3247,6 +3261,7 @@ + @@ -3268,6 +3283,7 @@ + @@ -4181,6 +4197,7 @@ + @@ -4622,6 +4639,7 @@ + @@ -4858,6 +4876,7 @@ + @@ -5248,6 +5267,7 @@ + @@ -5412,6 +5432,7 @@ + @@ -5902,6 +5923,7 @@ + @@ -6144,6 +6166,7 @@ + @@ -6357,6 +6380,7 @@ + @@ -6417,6 +6441,7 @@ + @@ -6634,6 +6659,7 @@ + @@ -6701,6 +6727,7 @@ + @@ -6907,6 +6934,7 @@ + @@ -7246,6 +7274,7 @@ + diff --git a/libs/spandsp/spandsp/tsb85.xml b/libs/spandsp/spandsp/tsb85.xml index 01ebf29efa..cd0d5db807 100644 --- a/libs/spandsp/spandsp/tsb85.xml +++ b/libs/spandsp/spandsp/tsb85.xml @@ -1,7 +1,6 @@ - @@ -1270,7 +1269,7 @@ - + @@ -1292,7 +1291,7 @@ - + diff --git a/libs/spandsp/src/Makefile.am b/libs/spandsp/src/Makefile.am index 3ed16a618b..7e8af50f5f 100644 --- a/libs/spandsp/src/Makefile.am +++ b/libs/spandsp/src/Makefile.am @@ -15,8 +15,6 @@ ## You should have received a copy of the GNU Lesser General Public ## License along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.138.4.3 2009/12/19 10:30:10 steveu Exp $ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) @@ -56,8 +54,8 @@ EXTRA_DIST = floating_fudge.h \ libtiff.2005.vcproj \ libtiff.2008.vcproj \ filter_tools.c \ - make_at_dictionary.c \ - make_modem_filter.c \ + make_at_dictionary.c \ + make_modem_filter.c \ msvc/config.h \ msvc/Download_TIFF.2005.vcproj \ msvc/Download_TIFF.2008.vcproj \ @@ -118,6 +116,7 @@ libspandsp_la_SOURCES = adsi.c \ gsm0610_short_term.c \ hdlc.c \ ima_adpcm.c \ + image_translate.c \ logging.c \ lpc10_analyse.c \ lpc10_decode.c \ @@ -151,6 +150,7 @@ libspandsp_la_SOURCES = adsi.c \ t38_terminal.c \ testcpuid.c \ time_scale.c \ + timezone.c \ tone_detect.c \ tone_generate.c \ v17rx.c \ @@ -201,6 +201,7 @@ nobase_include_HEADERS = spandsp/adsi.h \ spandsp/gsm0610.h \ spandsp/hdlc.h \ spandsp/ima_adpcm.h \ + spandsp/image_translate.h \ spandsp/logging.h \ spandsp/lpc10.h \ spandsp/modem_echo.h \ @@ -218,8 +219,6 @@ nobase_include_HEADERS = spandsp/adsi.h \ spandsp/super_tone_rx.h \ spandsp/super_tone_tx.h \ spandsp/swept_tone.h \ - spandsp/t4_rx.h \ - spandsp/t4_tx.h \ spandsp/t30.h \ spandsp/t30_api.h \ spandsp/t30_fcf.h \ @@ -230,8 +229,13 @@ nobase_include_HEADERS = spandsp/adsi.h \ spandsp/t38_gateway.h \ spandsp/t38_non_ecm_buffer.h \ spandsp/t38_terminal.h \ + spandsp/t4_rx.h \ + spandsp/t4_tx.h \ + spandsp/t4_t6_decode.h \ + spandsp/t4_t6_encode.h \ spandsp/telephony.h \ spandsp/time_scale.h \ + spandsp/timezone.h \ spandsp/timing.h \ spandsp/tone_detect.h \ spandsp/tone_generate.h \ @@ -267,6 +271,7 @@ nobase_include_HEADERS = spandsp/adsi.h \ spandsp/private/gsm0610.h \ spandsp/private/hdlc.h \ spandsp/private/ima_adpcm.h \ + spandsp/private/image_translate.h \ spandsp/private/logging.h \ spandsp/private/lpc10.h \ spandsp/private/modem_connect_tones.h \ @@ -289,7 +294,10 @@ nobase_include_HEADERS = spandsp/adsi.h \ spandsp/private/t38_terminal.h \ spandsp/private/t4_rx.h \ spandsp/private/t4_tx.h \ + spandsp/private/t4_t6_decode.h \ + spandsp/private/t4_t6_encode.h \ spandsp/private/time_scale.h \ + spandsp/private/timezone.h \ spandsp/private/tone_detect.h \ spandsp/private/tone_generate.h \ spandsp/private/v17rx.h \ @@ -307,16 +315,16 @@ nobase_include_HEADERS = spandsp/adsi.h \ nodist_include_HEADERS = spandsp.h -noinst_HEADERS = faxfont.h \ - filter_tools.h \ - gsm0610_local.h \ - lpc10_encdecs.h \ - mmx_sse_decs.h \ - t30_local.h \ - t4_t6_decode_states.h \ - v17_v32bis_rx_constellation_maps.h \ - v17_v32bis_tx_constellation_maps.h \ - v29tx_constellation_maps.h +noinst_HEADERS = faxfont.h \ + filter_tools.h \ + gsm0610_local.h \ + lpc10_encdecs.h \ + mmx_sse_decs.h \ + t30_local.h \ + t4_t6_decode_states.h \ + v17_v32bis_rx_constellation_maps.h \ + v17_v32bis_tx_constellation_maps.h \ + v29tx_constellation_maps.h make_at_dictionary$(EXEEXT): $(top_srcdir)/src/make_at_dictionary.c $(CC_FOR_BUILD) -o make_at_dictionary$(EXEEXT) $(top_srcdir)/src/make_at_dictionary.c -DHAVE_CONFIG_H -I$(top_builddir)/src @@ -334,13 +342,16 @@ at_interpreter.lo: at_interpreter_dictionary.h at_interpreter_dictionary.h: make_at_dictionary$(EXEEXT) ./make_at_dictionary$(EXEEXT) >at_interpreter_dictionary.h -t4.$(OBJEXT): spandsp/version.h +t4_rx.$(OBJEXT): spandsp/version.h -t4.lo: spandsp/version.h +t4_rx.lo: spandsp/version.h -v17rx.$(OBJEXT): v17_v32bis_rx_fixed_rrc.h v17_v32bis_rx_floating_rrc.h +V17_V32BIS_RX_INCL = v17_v32bis_rx_fixed_rrc.h \ + v17_v32bis_rx_floating_rrc.h -v17rx.lo: v17_v32bis_rx_fixed_rrc.h v17_v32bis_rx_floating_rrc.h +v17rx.$(OBJEXT): ${V17_V32BIS_RX_INCL} + +v17rx.lo: ${V17_V32BIS_RX_INCL} v17_v32bis_rx_fixed_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.17 -i -r >v17_v32bis_rx_fixed_rrc.h @@ -348,9 +359,12 @@ v17_v32bis_rx_fixed_rrc.h: make_modem_filter$(EXEEXT) v17_v32bis_rx_floating_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.17 -r >v17_v32bis_rx_floating_rrc.h -v17tx.$(OBJEXT): v17_v32bis_tx_fixed_rrc.h v17_v32bis_tx_floating_rrc.h +V17_V32BIS_TX_INCL = v17_v32bis_tx_fixed_rrc.h \ + v17_v32bis_tx_floating_rrc.h -v17tx.lo: v17_v32bis_tx_fixed_rrc.h v17_v32bis_tx_floating_rrc.h +v17tx.$(OBJEXT): ${V17_V32BIS_TX_INCL} + +v17tx.lo: ${V17_V32BIS_TX_INCL} v17_v32bis_tx_fixed_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.17 -i -t >v17_v32bis_tx_fixed_rrc.h @@ -358,15 +372,14 @@ v17_v32bis_tx_fixed_rrc.h: make_modem_filter$(EXEEXT) v17_v32bis_tx_floating_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.17 -t >v17_v32bis_tx_floating_rrc.h -v22bis_rx.$(OBJEXT): v22bis_rx_1200_fixed_rrc.h \ - v22bis_rx_2400_fixed_rrc.h \ - v22bis_rx_1200_floating_rrc.h \ - v22bis_rx_2400_floating_rrc.h +V22BIS_RX_INCL = v22bis_rx_1200_fixed_rrc.h \ + v22bis_rx_2400_fixed_rrc.h \ + v22bis_rx_1200_floating_rrc.h \ + v22bis_rx_2400_floating_rrc.h -v22bis_rx.lo: v22bis_rx_1200_fixed_rrc.h \ - v22bis_rx_2400_fixed_rrc.h \ - v22bis_rx_1200_floating_rrc.h \ - v22bis_rx_2400_floating_rrc.h +v22bis_rx.$(OBJEXT): ${V22BIS_RX_INCL} + +v22bis_rx.lo: ${V22BIS_RX_INCL} v22bis_rx_1200_fixed_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.22bis1200 -i -r >v22bis_rx_1200_fixed_rrc.h @@ -380,9 +393,12 @@ v22bis_rx_1200_floating_rrc.h: make_modem_filter$(EXEEXT) v22bis_rx_2400_floating_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.22bis2400 -r >v22bis_rx_2400_floating_rrc.h -v22bis_tx.$(OBJEXT): v22bis_tx_fixed_rrc.h v22bis_tx_floating_rrc.h +V22BIS_TX_INCL = v22bis_tx_fixed_rrc.h \ + v22bis_tx_floating_rrc.h -v22bis_tx.lo: v22bis_tx_fixed_rrc.h v22bis_tx_floating_rrc.h +v22bis_tx.$(OBJEXT): ${V22BIS_TX_INCL} + +v22bis_tx.lo: ${V22BIS_TX_INCL} v22bis_tx_fixed_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.22bis -i -t >v22bis_tx_fixed_rrc.h @@ -390,16 +406,15 @@ v22bis_tx_fixed_rrc.h: make_modem_filter$(EXEEXT) v22bis_tx_floating_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.22bis -t >v22bis_tx_floating_rrc.h -v27ter_rx_.$(OBJEXT): v27ter_rx_2400_fixed_rrc.h \ - v27ter_rx_4800_fixed_rrc.h \ - v27ter_rx_2400_floating_rrc.h \ - v27ter_rx_4800_floating_rrc.h - -v27ter_rx.lo: v27ter_rx_2400_fixed_rrc.h \ +V27_RX_INCL = v27ter_rx_2400_fixed_rrc.h \ v27ter_rx_4800_fixed_rrc.h \ v27ter_rx_2400_floating_rrc.h \ v27ter_rx_4800_floating_rrc.h +v27ter_rx.$(OBJEXT): ${V27_RX_INCL} + +v27ter_rx.lo: ${V27_RX_INCL} + v27ter_rx_2400_fixed_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.27ter2400 -i -r >v27ter_rx_2400_fixed_rrc.h @@ -412,15 +427,14 @@ v27ter_rx_2400_floating_rrc.h: make_modem_filter$(EXEEXT) v27ter_rx_4800_floating_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.27ter4800 -r >v27ter_rx_4800_floating_rrc.h -v27ter_tx_.$(OBJEXT): v27ter_tx_2400_fixed_rrc.h \ - v27ter_tx_4800_fixed_rrc.h \ - v27ter_tx_2400_floating_rrc.h \ - v27ter_tx_4800_floating_rrc.h +V27TER_TX_INCL = v27ter_tx_2400_fixed_rrc.h \ + v27ter_tx_4800_fixed_rrc.h \ + v27ter_tx_2400_floating_rrc.h \ + v27ter_tx_4800_floating_rrc.h -v27ter_tx.lo: v27ter_tx_2400_fixed_rrc.h \ - v27ter_tx_4800_fixed_rrc.h \ - v27ter_tx_2400_floating_rrc.h \ - v27ter_tx_4800_floating_rrc.h +v27ter_tx_.$(OBJEXT): ${V27TER_TX_INCL} + +v27ter_tx.lo: ${V27TER_TX_INCL} v27ter_tx_2400_fixed_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.27ter2400 -i -t >v27ter_tx_2400_fixed_rrc.h @@ -434,9 +448,12 @@ v27ter_tx_2400_floating_rrc.h: make_modem_filter$(EXEEXT) v27ter_tx_4800_floating_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.27ter4800 -t >v27ter_tx_4800_floating_rrc.h -v29rx.$(OBJEXT): v29rx_fixed_rrc.h v29rx_floating_rrc.h +V29_RX_INCL = v29rx_fixed_rrc.h \ + v29rx_floating_rrc.h -v29rx.lo: v29rx_fixed_rrc.h v29rx_floating_rrc.h +v29rx.$(OBJEXT): ${V29_RX_INCL} + +v29rx.lo: ${V29_RX_INCL} v29rx_fixed_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.29 -i -r >v29rx_fixed_rrc.h @@ -444,9 +461,12 @@ v29rx_fixed_rrc.h: make_modem_filter$(EXEEXT) v29rx_floating_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.29 -r >v29rx_floating_rrc.h -v29tx.$(OBJEXT): v29tx_fixed_rrc.h v29tx_floating_rrc.h +V29_TX_INCL = v29tx_fixed_rrc.h \ + v29tx_floating_rrc.h -v29tx.lo: v29tx_fixed_rrc.h v29tx_floating_rrc.h +v29tx.$(OBJEXT): ${V29_TX_INCL} + +v29tx.lo: ${V29_TX_INCL} v29tx_fixed_rrc.h: make_modem_filter$(EXEEXT) ./make_modem_filter$(EXEEXT) -m V.29 -i -t >v29tx_fixed_rrc.h @@ -519,11 +539,11 @@ $(srcdir)/msvc/spandsp.h: spandsp.h.in -e "s/\@INSERT_INTTYPES_HEADER\@/#include /" \ -e "s/\@INSERT_MATH_HEADER\@/#include /" $(srcdir)/spandsp.h.in > $(srcdir)/msvc/spandsp.h +dist-hook: spandsp/version.h + spandsp/version.h: mkdir -p $(@D) NOWDATE=`date --utc +"%Y%m%d"` ; \ NOWTIME=`date --utc +"%H%M%S"` ; \ sed 's/$$SPANDSP_RELEASE_DATE/'$$NOWDATE'/;s/$$SPANDSP_RELEASE_TIME/'$$NOWTIME'/' \ <$(srcdir)/spandsp/version.h.in >$@ - -dist-hook: spandsp/version.h diff --git a/libs/spandsp/src/adsi.c b/libs/spandsp/src/adsi.c index 2e4de25ad1..207c893e09 100644 --- a/libs/spandsp/src/adsi.c +++ b/libs/spandsp/src/adsi.c @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: adsi.c,v 1.77 2009/11/02 13:25:20 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/async.c b/libs/spandsp/src/async.c index 29974df2de..e24d84343b 100644 --- a/libs/spandsp/src/async.c +++ b/libs/spandsp/src/async.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: async.c,v 1.19 2009/04/23 14:12:34 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/at_interpreter.c b/libs/spandsp/src/at_interpreter.c index f34d875981..9bf0d4aa1a 100644 --- a/libs/spandsp/src/at_interpreter.c +++ b/libs/spandsp/src/at_interpreter.c @@ -24,8 +24,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: at_interpreter.c,v 1.42.4.1 2009/12/23 14:18:32 steveu Exp $ */ /*! \file */ @@ -245,13 +243,21 @@ SPAN_DECLARE(void) at_call_event(at_state_t *s, int event) } else { - /* FAX modem connection */ - at_set_at_rx_mode(s, AT_MODE_DELIVERY); - if (s->silent_dial) - at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_NOCNG_TONE); + if (s->command_dial) + { + at_put_response_code(s, AT_RESPONSE_CODE_OK); + at_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); + } else - at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_CNG_TONE); - s->dte_is_waiting = TRUE; + { + /* FAX modem connection */ + at_set_at_rx_mode(s, AT_MODE_DELIVERY); + if (s->silent_dial) + at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_NOCNG_TONE); + else + at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_CNG_TONE); + s->dte_is_waiting = TRUE; + } } break; case AT_CALL_EVENT_BUSY: @@ -369,7 +375,7 @@ static int parse_num(const char **s, int max_value) /* The spec. says no digits is valid, and should be treated as zero. */ i = 0; - while (isdigit(**s)) + while (isdigit((int) **s)) { i = i*10 + ((**s) - '0'); (*s)++; @@ -387,7 +393,7 @@ static int parse_hex_num(const char **s, int max_value) /* The spec. says a hex value is always 2 digits, and the alpha digits are upper case. */ i = 0; - if (isdigit(**s)) + if (isdigit((int) **s)) i = **s - '0'; else if (**s >= 'A' && **s <= 'F') i = **s - 'A'; @@ -395,7 +401,7 @@ static int parse_hex_num(const char **s, int max_value) return -1; (*s)++; - if (isdigit(**s)) + if (isdigit((int) **s)) i = (i << 4) | (**s - '0'); else if (**s >= 'A' && **s <= 'F') i = (i << 4) | (**s - 'A'); @@ -847,6 +853,7 @@ static const char *at_cmd_D(at_state_t *s, const char *t) at_reset_call_info(s); s->do_hangup = FALSE; s->silent_dial = FALSE; + s->command_dial = FALSE; t += 1; ok = FALSE; /* There are a numbers of options in a dial command string. @@ -855,7 +862,7 @@ static const char *at_cmd_D(at_state_t *s, const char *t) u = num; for ( ; (ch = *t); t++) { - if (isdigit(ch)) + if (isdigit((int) ch)) { /* V.250 6.3.1.1 Basic digit set */ *u++ = ch; @@ -926,7 +933,7 @@ static const char *at_cmd_D(at_state_t *s, const char *t) break; case ';': /* V.250 6.3.1 - Dial string terminator - make voice call and remain in command mode */ - /* TODO: */ + s->command_dial = TRUE; break; case '>': /* GSM07.07 6.2 - Direct dialling from phone book supplementary service subscription @@ -5319,7 +5326,7 @@ static int command_search(const char *u, int len, int *matched) { /* The character in u we are processing... */ /* V.250 5.4.1 says upper and lower case are equivalent in commands */ - index = (unsigned char) toupper(u[i]); + index = toupper((int) u[i]); /* Is there a child node for this character? */ /* Note: First and last could have been packed into one uint16_t, but space is not that critical, so the other packing is good diff --git a/libs/spandsp/src/awgn.c b/libs/spandsp/src/awgn.c index f0e246a1fb..e97dd6be0b 100644 --- a/libs/spandsp/src/awgn.c +++ b/libs/spandsp/src/awgn.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: awgn.c,v 1.22 2009/02/10 13:06:46 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/bell_r2_mf.c b/libs/spandsp/src/bell_r2_mf.c index ae12475921..e61b782dc5 100644 --- a/libs/spandsp/src/bell_r2_mf.c +++ b/libs/spandsp/src/bell_r2_mf.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bell_r2_mf.c,v 1.39.4.1 2009/12/23 14:23:48 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/bert.c b/libs/spandsp/src/bert.c index 69defc1dc2..c697b39a7a 100644 --- a/libs/spandsp/src/bert.c +++ b/libs/spandsp/src/bert.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bert.c,v 1.33 2009/04/14 16:04:53 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/src/bit_operations.c b/libs/spandsp/src/bit_operations.c index 547536b68c..a301c03ec2 100644 --- a/libs/spandsp/src/bit_operations.c +++ b/libs/spandsp/src/bit_operations.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bit_operations.c,v 1.16 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/bitstream.c b/libs/spandsp/src/bitstream.c index 25468d7391..9a8c0bc9dd 100644 --- a/libs/spandsp/src/bitstream.c +++ b/libs/spandsp/src/bitstream.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bitstream.c,v 1.18.4.1 2009/12/28 12:20:46 steveu Exp $ */ /*! \file */ @@ -74,15 +72,27 @@ SPAN_DECLARE(void) bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t val } /*- End of function --------------------------------------------------------*/ +SPAN_DECLARE(void) bitstream_emit(bitstream_state_t *s, uint8_t **c) +{ + uint32_t bitstream; + + if (s->residue > 0) + { + bitstream = s->bitstream & ((1 << s->residue) - 1); + if (s->lsb_first) + *(*c) = (uint8_t) bitstream; + else + *(*c) = (uint8_t) (bitstream << (8 - s->residue)); + } +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c) { if (s->residue > 0) { - s->bitstream &= ((1 << s->residue) - 1); - if (s->lsb_first) - *(*c)++ = (uint8_t) s->bitstream; - else - *(*c)++ = (uint8_t) (s->bitstream << (8 - s->residue)); + bitstream_emit(s, c); + (*c)++; s->residue = 0; } s->bitstream = 0; diff --git a/libs/spandsp/src/complex_filters.c b/libs/spandsp/src/complex_filters.c index 7ae4a1323e..36af84b36a 100644 --- a/libs/spandsp/src/complex_filters.c +++ b/libs/spandsp/src/complex_filters.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: complex_filters.c,v 1.16 2009/02/03 16:28:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/src/complex_vector_float.c b/libs/spandsp/src/complex_vector_float.c index 3dffbb08ca..ebb6accba4 100644 --- a/libs/spandsp/src/complex_vector_float.c +++ b/libs/spandsp/src/complex_vector_float.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: complex_vector_float.c,v 1.16 2009/07/12 09:23:09 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/complex_vector_int.c b/libs/spandsp/src/complex_vector_int.c index d55009d491..0bf7eb8a98 100644 --- a/libs/spandsp/src/complex_vector_int.c +++ b/libs/spandsp/src/complex_vector_int.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: complex_vector_int.c,v 1.9 2009/07/12 09:23:09 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/crc.c b/libs/spandsp/src/crc.c index c82c58e3ab..f970fe8a2c 100644 --- a/libs/spandsp/src/crc.c +++ b/libs/spandsp/src/crc.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: crc.c,v 1.6 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -41,70 +39,38 @@ static const uint32_t crc_itu32_table[] = { - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, - 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, - 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, - 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, - 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, - 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, - 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, - 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, - 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, - 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, - 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, - 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, - 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, - 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, - 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, - 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, - 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, - 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, - 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, - 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, - 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, - 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, - 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, - 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, - 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, - 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, - 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, - 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, - 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, - 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, - 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, - 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, - 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, - 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, - 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, - 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, - 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, - 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, - 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, - 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, - 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, - 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, - 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, - 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, - 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, - 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, - 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, - 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, - 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, - 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, - 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, - 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, - 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, - 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D + 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, + 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, + 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, + 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, + 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, + 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, + 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, + 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, + 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, + 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, + 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, + 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, + 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, + 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, + 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, + 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, + 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, + 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, + 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, + 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, + 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, + 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, + 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, + 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, + 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, + 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, + 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, + 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, + 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, + 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, + 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, + 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D }; SPAN_DECLARE(uint32_t) crc_itu32_calc(const uint8_t *buf, int len, uint32_t crc) @@ -194,6 +160,22 @@ SPAN_DECLARE(uint16_t) crc_itu16_calc(const uint8_t *buf, int len, uint16_t crc) } /*- End of function --------------------------------------------------------*/ +SPAN_DECLARE(uint16_t) crc_itu16_bits(uint8_t buf, int len, uint16_t crc) +{ + int i; + + for (i = 0; i < len; i++) + { + if (((buf ^ crc) & 1)) + crc = (crc >> 1) ^ 0x8408; + else + crc = crc >> 1; + buf >>= 1; + } + return crc; +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE(int) crc_itu16_append(uint8_t *buf, int len) { uint16_t crc; diff --git a/libs/spandsp/src/dds_float.c b/libs/spandsp/src/dds_float.c index 8acf7c0c3b..4acaa1eaf9 100644 --- a/libs/spandsp/src/dds_float.c +++ b/libs/spandsp/src/dds_float.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: dds_float.c,v 1.11 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/dds_int.c b/libs/spandsp/src/dds_int.c index 9f30d83c80..cf75ecc9c3 100644 --- a/libs/spandsp/src/dds_int.c +++ b/libs/spandsp/src/dds_int.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: dds_int.c,v 1.16 2009/02/21 04:27:46 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/dtmf.c b/libs/spandsp/src/dtmf.c index fca60dd4d1..b07f8ec120 100644 --- a/libs/spandsp/src/dtmf.c +++ b/libs/spandsp/src/dtmf.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: dtmf.c,v 1.53 2009/04/12 09:12:10 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/echo.c b/libs/spandsp/src/echo.c index 23bb868bbd..13a685d316 100644 --- a/libs/spandsp/src/echo.c +++ b/libs/spandsp/src/echo.c @@ -26,8 +26,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: echo.c,v 1.33 2009/09/22 13:11:04 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/fax.c b/libs/spandsp/src/fax.c index 99808d86ef..ae10069e82 100644 --- a/libs/spandsp/src/fax.c +++ b/libs/spandsp/src/fax.c @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: fax.c,v 1.96.4.1 2009/12/19 10:44:10 steveu Exp $ */ /*! \file */ @@ -55,6 +53,7 @@ #include "spandsp/logging.h" #include "spandsp/queue.h" #include "spandsp/dc_restore.h" +#include "spandsp/vector_int.h" #include "spandsp/power_meter.h" #include "spandsp/complex.h" #include "spandsp/tone_detect.h" @@ -62,17 +61,24 @@ #include "spandsp/async.h" #include "spandsp/hdlc.h" #include "spandsp/silence_gen.h" +#include "spandsp/super_tone_rx.h" #include "spandsp/fsk.h" +#include "spandsp/modem_connect_tones.h" +#include "spandsp/v8.h" #include "spandsp/v29tx.h" #include "spandsp/v29rx.h" #include "spandsp/v27ter_tx.h" #include "spandsp/v27ter_rx.h" #include "spandsp/v17tx.h" #include "spandsp/v17rx.h" -#include "spandsp/super_tone_rx.h" -#include "spandsp/modem_connect_tones.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/t81_t82_arith_coding.h" +#include "spandsp/t85.h" +#endif +#include "spandsp/t4_t6_decode.h" +#include "spandsp/t4_t6_encode.h" #include "spandsp/t30_fcf.h" #include "spandsp/t35.h" @@ -86,15 +92,22 @@ #include "spandsp/private/logging.h" #include "spandsp/private/silence_gen.h" #include "spandsp/private/fsk.h" +#include "spandsp/private/modem_connect_tones.h" +#include "spandsp/private/v8.h" #include "spandsp/private/v17tx.h" #include "spandsp/private/v17rx.h" #include "spandsp/private/v27ter_tx.h" #include "spandsp/private/v27ter_rx.h" #include "spandsp/private/v29tx.h" #include "spandsp/private/v29rx.h" -#include "spandsp/private/modem_connect_tones.h" #include "spandsp/private/hdlc.h" #include "spandsp/private/fax_modems.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/private/t81_t82_arith_coding.h" +#include "spandsp/private/t85.h" +#endif +#include "spandsp/private/t4_t6_decode.h" +#include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" #include "spandsp/private/t30.h" @@ -121,6 +134,17 @@ static void tone_detected(void *user_data, int tone, int level, int delay) } /*- End of function --------------------------------------------------------*/ +#if 0 +static void v8_handler(void *user_data, v8_parms_t *result) +{ + fax_state_t *s; + + s = (fax_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "V.8 report received\n"); +} +/*- End of function --------------------------------------------------------*/ +#endif + static void hdlc_underflow_handler(void *user_data) { t30_state_t *s; @@ -284,7 +308,7 @@ static int v29_v21_rx_fillin(void *user_data, int len) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) fax_rx(fax_state_t *s, int16_t *amp, int len) +SPAN_DECLARE_NONSTD(int) fax_rx(fax_state_t *s, int16_t *amp, int len) { int i; @@ -300,7 +324,7 @@ SPAN_DECLARE(int) fax_rx(fax_state_t *s, int16_t *amp, int len) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) fax_rx_fillin(fax_state_t *s, int len) +SPAN_DECLARE_NONSTD(int) fax_rx_fillin(fax_state_t *s, int len) { /* To mitigate the effect of lost packets on a packet network we should try to sustain the status quo. If there is no receive modem running, keep @@ -348,7 +372,7 @@ static int set_next_tx_type(fax_state_t *s) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len) +SPAN_DECLARE_NONSTD(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len) { int len; #if defined(LOG_FAX_AUDIO) @@ -577,33 +601,32 @@ SPAN_DECLARE(logging_state_t *) fax_get_logging_state(fax_state_t *s) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(fax_state_t *) fax_init(fax_state_t *s, int calling_party) +SPAN_DECLARE(int) fax_restart(fax_state_t *s, int calling_party) { - if (s == NULL) - { - if ((s = (fax_state_t *) malloc(sizeof(*s))) == NULL) - return NULL; - } - memset(s, 0, sizeof(*s)); - span_log_init(&s->logging, SPAN_LOG_NONE, NULL); - span_log_set_protocol(&s->logging, "FAX"); - fax_modems_init(&s->modems, - FALSE, - t30_hdlc_accept, - hdlc_underflow_handler, - t30_non_ecm_put_bit, - t30_non_ecm_get_bit, - tone_detected, - &s->t30); - t30_init(&s->t30, - calling_party, - fax_set_rx_type, - (void *) s, - fax_set_tx_type, - (void *) s, - fax_send_hdlc, - (void *) s); - t30_set_supported_modems(&s->t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17); +#if 0 + v8_parms_t v8_parms; +#endif + + fax_modems_restart(&s->modems); +#if 0 + v8_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR; + v8_parms.call_function = V8_CALL_T30_RX; + v8_parms.modulations = V8_MOD_V21; + if (s->t30.supported_modems & T30_SUPPORT_V27TER) + v8_parms.modulations |= V8_MOD_V27TER; + if (s->t30.supported_modems & T30_SUPPORT_V29) + v8_parms.modulations |= V8_MOD_V29; + if (s->t30.supported_modems & T30_SUPPORT_V17) + v8_parms.modulations |= V8_MOD_V17; + if (s->t30.supported_modems & T30_SUPPORT_V34HDX) + v8_parms.modulations |= V8_MOD_V34HDX; + v8_parms.protocol = V8_PROTOCOL_NONE; + v8_parms.pcm_modem_availability = 0; + v8_parms.pstn_access = 0; + v8_parms.nsf = -1; + v8_parms.t66 = -1; + v8_restart(&s->v8, calling_party, &v8_parms); +#endif t30_restart(&s->t30); #if defined(LOG_FAX_AUDIO) { @@ -635,6 +658,61 @@ SPAN_DECLARE(fax_state_t *) fax_init(fax_state_t *s, int calling_party) s->modems.audio_tx_log = open(buf, O_CREAT | O_TRUNC | O_WRONLY, 0666); } #endif + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(fax_state_t *) fax_init(fax_state_t *s, int calling_party) +{ +#if 0 + v8_parms_t v8_parms; +#endif + + if (s == NULL) + { + if ((s = (fax_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + span_log_init(&s->logging, SPAN_LOG_NONE, NULL); + span_log_set_protocol(&s->logging, "FAX"); + fax_modems_init(&s->modems, + FALSE, + t30_hdlc_accept, + hdlc_underflow_handler, + t30_non_ecm_put_bit, + t30_non_ecm_get_bit, + tone_detected, + &s->t30); + t30_init(&s->t30, + calling_party, + fax_set_rx_type, + (void *) s, + fax_set_tx_type, + (void *) s, + fax_send_hdlc, + (void *) s); + t30_set_supported_modems(&s->t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17); +#if 0 + v8_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR; + v8_parms.call_function = V8_CALL_T30_RX; + v8_parms.modulations = V8_MOD_V21; + if (s->t30.supported_modems & T30_SUPPORT_V27TER) + v8_parms.modulations |= V8_MOD_V27TER; + if (s->t30.supported_modems & T30_SUPPORT_V29) + v8_parms.modulations |= V8_MOD_V29; + if (s->t30.supported_modems & T30_SUPPORT_V17) + v8_parms.modulations |= V8_MOD_V17; + if (s->t30.supported_modems & T30_SUPPORT_V34HDX) + v8_parms.modulations |= V8_MOD_V34HDX; + v8_parms.protocol = V8_PROTOCOL_NONE; + v8_parms.pcm_modem_availability = 0; + v8_parms.pstn_access = 0; + v8_parms.nsf = -1; + v8_parms.t66 = -1; + v8_init(&s->v8, calling_party, &v8_parms, v8_handler, s); +#endif + fax_restart(s, calling_party); return s; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/fax_modems.c b/libs/spandsp/src/fax_modems.c index bc8404036c..29392be1a4 100644 --- a/libs/spandsp/src/fax_modems.c +++ b/libs/spandsp/src/fax_modems.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: fax_modems.c,v 1.8 2009/11/02 13:25:20 steveu Exp $ */ /*! \file */ @@ -88,7 +86,7 @@ #define HDLC_FRAMING_OK_THRESHOLD 5 -SPAN_DECLARE(int) fax_modems_v17_v21_rx(void *user_data, const int16_t amp[], int len) +SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx(void *user_data, const int16_t amp[], int len) { fax_modems_state_t *s; @@ -108,7 +106,7 @@ SPAN_DECLARE(int) fax_modems_v17_v21_rx(void *user_data, const int16_t amp[], in } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) fax_modems_v17_v21_rx_fillin(void *user_data, int len) +SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx_fillin(void *user_data, int len) { fax_modems_state_t *s; @@ -119,7 +117,7 @@ SPAN_DECLARE(int) fax_modems_v17_v21_rx_fillin(void *user_data, int len) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t amp[], int len) +SPAN_DECLARE_NONSTD(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t amp[], int len) { fax_modems_state_t *s; @@ -139,7 +137,7 @@ SPAN_DECLARE(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t amp[], } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) fax_modems_v27ter_v21_rx_fillin(void *user_data, int len) +SPAN_DECLARE_NONSTD(int) fax_modems_v27ter_v21_rx_fillin(void *user_data, int len) { fax_modems_state_t *s; @@ -150,7 +148,7 @@ SPAN_DECLARE(int) fax_modems_v27ter_v21_rx_fillin(void *user_data, int len) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) fax_modems_v29_v21_rx(void *user_data, const int16_t amp[], int len) +SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx(void *user_data, const int16_t amp[], int len) { fax_modems_state_t *s; @@ -170,7 +168,7 @@ SPAN_DECLARE(int) fax_modems_v29_v21_rx(void *user_data, const int16_t amp[], in } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) fax_modems_v29_v21_rx_fillin(void *user_data, int len) +SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx_fillin(void *user_data, int len) { fax_modems_state_t *s; @@ -264,6 +262,12 @@ SPAN_DECLARE(void) fax_modems_set_tep_mode(fax_modems_state_t *s, int use_tep) } /*- End of function --------------------------------------------------------*/ +SPAN_DECLARE(int) fax_modems_restart(fax_modems_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s, int use_tep, hdlc_frame_handler_t hdlc_accept, diff --git a/libs/spandsp/src/faxfont.h b/libs/spandsp/src/faxfont.h index 38ce2f6fff..08ed46ad9d 100644 --- a/libs/spandsp/src/faxfont.h +++ b/libs/spandsp/src/faxfont.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: faxfont.h,v 1.6 2008/04/17 14:26:56 steveu Exp $ */ #if !defined(_FAXFONT_H_) diff --git a/libs/spandsp/src/filter_tools.c b/libs/spandsp/src/filter_tools.c index bef04e89e9..1743747166 100644 --- a/libs/spandsp/src/filter_tools.c +++ b/libs/spandsp/src/filter_tools.c @@ -24,8 +24,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: filter_tools.c,v 1.11 2009/10/05 16:33:25 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/src/filter_tools.h b/libs/spandsp/src/filter_tools.h index da0c99dfff..4df89adab4 100644 --- a/libs/spandsp/src/filter_tools.h +++ b/libs/spandsp/src/filter_tools.h @@ -25,8 +25,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: filter_tools.h,v 1.3 2008/04/17 14:26:56 steveu Exp $ */ #if !defined(_FILTER_TOOLS_H_) diff --git a/libs/spandsp/src/floating_fudge.h b/libs/spandsp/src/floating_fudge.h index a959e20f85..2ef0423399 100644 --- a/libs/spandsp/src/floating_fudge.h +++ b/libs/spandsp/src/floating_fudge.h @@ -24,8 +24,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: floating_fudge.h,v 1.7 2009/02/03 16:28:39 steveu Exp $ */ #if !defined(_FLOATING_FUDGE_H_) diff --git a/libs/spandsp/src/fsk.c b/libs/spandsp/src/fsk.c index 8e07ada884..088c54bb88 100644 --- a/libs/spandsp/src/fsk.c +++ b/libs/spandsp/src/fsk.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: fsk.c,v 1.60 2009/11/02 13:25:20 steveu Exp $ */ /*! \file */ @@ -566,7 +564,7 @@ SPAN_DECLARE_NONSTD(int) fsk_rx(fsk_rx_state_t *s, const int16_t *amp, int len) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) fsk_rx_fillin(fsk_rx_state_t *s, int len) +SPAN_DECLARE_NONSTD(int) fsk_rx_fillin(fsk_rx_state_t *s, int len) { /* The valid choice here is probably to do nothing. We don't change state (i.e carrier on<->carrier off), and we'll just output less bits than we diff --git a/libs/spandsp/src/g711.c b/libs/spandsp/src/g711.c index fad1882011..17403d8f92 100644 --- a/libs/spandsp/src/g711.c +++ b/libs/spandsp/src/g711.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: g711.c,v 1.16 2009/02/10 13:06:46 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/g722.c b/libs/spandsp/src/g722.c index 1bc84be738..f2cca6b179 100644 --- a/libs/spandsp/src/g722.c +++ b/libs/spandsp/src/g722.c @@ -27,8 +27,6 @@ * Copyright (c) CMU 1993 * Computer Science, Speech Group * Chengxiang Lu and Alex Hauptmann - * - * $Id: g722.c,v 1.10 2009/04/22 12:57:40 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/g726.c b/libs/spandsp/src/g726.c index 3d666f0be2..2bf1236d80 100644 --- a/libs/spandsp/src/g726.c +++ b/libs/spandsp/src/g726.c @@ -47,8 +47,6 @@ * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 - * - * $Id: g726.c,v 1.28.4.1 2009/12/28 12:20:46 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/gsm0610_decode.c b/libs/spandsp/src/gsm0610_decode.c index 1ab1e8e6bb..783acda4b3 100644 --- a/libs/spandsp/src/gsm0610_decode.c +++ b/libs/spandsp/src/gsm0610_decode.c @@ -24,8 +24,6 @@ * * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html - * - * $Id: gsm0610_decode.c,v 1.25 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/gsm0610_encode.c b/libs/spandsp/src/gsm0610_encode.c index 091e4fb458..10a27540df 100644 --- a/libs/spandsp/src/gsm0610_encode.c +++ b/libs/spandsp/src/gsm0610_encode.c @@ -24,8 +24,6 @@ * * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html - * - * $Id: gsm0610_encode.c,v 1.30 2009/02/10 13:06:46 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/gsm0610_local.h b/libs/spandsp/src/gsm0610_local.h index 42a38c54d4..e3150f62de 100644 --- a/libs/spandsp/src/gsm0610_local.h +++ b/libs/spandsp/src/gsm0610_local.h @@ -24,8 +24,6 @@ * * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html - * - * $Id: gsm0610_local.h,v 1.15 2009/03/13 15:57:29 steveu Exp $ */ #if !defined(_GSM0610_LOCAL_H_) diff --git a/libs/spandsp/src/gsm0610_long_term.c b/libs/spandsp/src/gsm0610_long_term.c index a9255fc3a2..d257832526 100644 --- a/libs/spandsp/src/gsm0610_long_term.c +++ b/libs/spandsp/src/gsm0610_long_term.c @@ -24,8 +24,6 @@ * * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html - * - * $Id: gsm0610_long_term.c,v 1.24 2009/04/20 16:36:36 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/gsm0610_lpc.c b/libs/spandsp/src/gsm0610_lpc.c index b8ec8d4aa2..4b2c553d87 100644 --- a/libs/spandsp/src/gsm0610_lpc.c +++ b/libs/spandsp/src/gsm0610_lpc.c @@ -24,8 +24,6 @@ * * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html - * - * $Id: gsm0610_lpc.c,v 1.29 2009/02/05 15:57:27 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/gsm0610_preprocess.c b/libs/spandsp/src/gsm0610_preprocess.c index 3e94fa043d..ea0edfd64e 100644 --- a/libs/spandsp/src/gsm0610_preprocess.c +++ b/libs/spandsp/src/gsm0610_preprocess.c @@ -24,8 +24,6 @@ * * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html - * - * $Id: gsm0610_preprocess.c,v 1.17 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/gsm0610_rpe.c b/libs/spandsp/src/gsm0610_rpe.c index 8d61ef272a..28b1a72e79 100644 --- a/libs/spandsp/src/gsm0610_rpe.c +++ b/libs/spandsp/src/gsm0610_rpe.c @@ -24,8 +24,6 @@ * * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html - * - * $Id: gsm0610_rpe.c,v 1.25.4.2 2009/12/28 11:54:58 steveu Exp $ */ /*! \file */ @@ -172,7 +170,7 @@ static void weighting_filter(int16_t x[40], : "eax", "edx", "esi", "memory" ); #else - int32_t L_result; + int32_t result; int k; /* The coefficients of the weighting filter are stored in a table @@ -194,12 +192,12 @@ static void weighting_filter(int16_t x[40], /* Compute the signal x[0..39] */ for (k = 0; k < 40; k++) { - L_result = 8192 >> 1; + result = 8192 >> 1; /* for (i = 0; i <= 10; i++) * { - * L_temp = saturated_mul_16_32(wt[k + i], gsm_H[i]); - * L_result = saturated_add32(L_result, L_temp); + * temp = saturated_mul16_32(wt[k + i], gsm_H[i]); + * result = saturated_add32(result, temp); * } */ @@ -210,22 +208,22 @@ static void weighting_filter(int16_t x[40], but I don't see an elegant way to optimize this. Do you? */ - L_result += STEP( 0, -134); - L_result += STEP( 1, -374); - /* += STEP( 2, 0 ); */ - L_result += STEP( 3, 2054); - L_result += STEP( 4, 5741); - L_result += STEP( 5, 8192); - L_result += STEP( 6, 5741); - L_result += STEP( 7, 2054); - /* += STEP( 8, 0 ); */ - L_result += STEP( 9, -374); - L_result += STEP(10, -134); + result += STEP( 0, -134); + result += STEP( 1, -374); + /* += STEP( 2, 0 ); */ + result += STEP( 3, 2054); + result += STEP( 4, 5741); + result += STEP( 5, 8192); + result += STEP( 6, 5741); + result += STEP( 7, 2054); + /* += STEP( 8, 0 ); */ + result += STEP( 9, -374); + result += STEP(10, -134); /* 2 adds vs. >> 16 => 14, minus one shift to compensate for those we lost when replacing L_MULT by '*'. */ - L_result >>= 13; - x[k] = saturate(L_result); + result >>= 13; + x[k] = saturate(result); } /*endfor*/ #endif diff --git a/libs/spandsp/src/gsm0610_short_term.c b/libs/spandsp/src/gsm0610_short_term.c index 7b1dfe082a..226ac1f6eb 100644 --- a/libs/spandsp/src/gsm0610_short_term.c +++ b/libs/spandsp/src/gsm0610_short_term.c @@ -24,8 +24,6 @@ * * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html - * - * $Id: gsm0610_short_term.c,v 1.19 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/hdlc.c b/libs/spandsp/src/hdlc.c index 4d84af3df5..a07eb3e9fc 100644 --- a/libs/spandsp/src/hdlc.c +++ b/libs/spandsp/src/hdlc.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: hdlc.c,v 1.72 2009/06/02 16:03:56 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/ima_adpcm.c b/libs/spandsp/src/ima_adpcm.c index dc6fe29b44..299d0d1137 100644 --- a/libs/spandsp/src/ima_adpcm.c +++ b/libs/spandsp/src/ima_adpcm.c @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: ima_adpcm.c,v 1.36 2009/04/11 18:11:19 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/logging.c b/libs/spandsp/src/logging.c index 2ca54a1d26..726e7bd322 100644 --- a/libs/spandsp/src/logging.c +++ b/libs/spandsp/src/logging.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: logging.c,v 1.32 2009/02/10 17:44:18 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/lpc10_analyse.c b/libs/spandsp/src/lpc10_analyse.c index de294de284..7c852c4e12 100644 --- a/libs/spandsp/src/lpc10_analyse.c +++ b/libs/spandsp/src/lpc10_analyse.c @@ -25,8 +25,6 @@ * This code is based on the U.S. Department of Defense reference * implementation of the LPC-10 2400 bps Voice Coder. They do not * exert copyright claims on their code, and it may be freely used. - * - * $Id: lpc10_analyse.c,v 1.22 2009/01/28 03:41:27 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/src/lpc10_decode.c b/libs/spandsp/src/lpc10_decode.c index d71272c763..bfb169edaa 100644 --- a/libs/spandsp/src/lpc10_decode.c +++ b/libs/spandsp/src/lpc10_decode.c @@ -25,8 +25,6 @@ * This code is based on the U.S. Department of Defense reference * implementation of the LPC-10 2400 bps Voice Coder. They do not * exert copyright claims on their code, and it may be freely used. - * - * $Id: lpc10_decode.c,v 1.27.4.1 2009/12/24 17:00:19 steveu Exp $ */ #if defined(HAVE_CONFIG_H) @@ -251,6 +249,7 @@ static int pitsyn(lpc10_decode_state_t *s, float slope; float uvpit; float xxy; + float msix; rci_dim1 = LPC10_ORDER; rci_offset = rci_dim1 + 1; @@ -446,7 +445,10 @@ static int pitsyn(lpc10_decode_state_t *s, xxy = expf(xxy); rci[j + *nout*rci_dim1 + 1] = (xxy - 1.0f)/(xxy + 1.0f); } - rmsi[*nout - 1] = expf(logf(s->rmso) + prop*(logf(*rms) - logf(s->rmso))); + msix = logf(*rms) - logf(s->rmso); + msix = prop*msix; + msix = logf(s->rmso) + msix; + rmsi[*nout - 1] = expf(msix); } } if (vflag != 1) diff --git a/libs/spandsp/src/lpc10_encdecs.h b/libs/spandsp/src/lpc10_encdecs.h index e0c78a65c0..1e276e374b 100644 --- a/libs/spandsp/src/lpc10_encdecs.h +++ b/libs/spandsp/src/lpc10_encdecs.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: lpc10_encdecs.h,v 1.11 2008/04/17 14:26:56 steveu Exp $ */ #define LPC10_ORDER 10 diff --git a/libs/spandsp/src/lpc10_encode.c b/libs/spandsp/src/lpc10_encode.c index 2f36080197..1a080b65c0 100644 --- a/libs/spandsp/src/lpc10_encode.c +++ b/libs/spandsp/src/lpc10_encode.c @@ -25,8 +25,6 @@ * This code is based on the U.S. Department of Defense reference * implementation of the LPC-10 2400 bps Voice Coder. They do not * exert copyright claims on their code, and it may be freely used. - * - * $Id: lpc10_encode.c,v 1.28 2009/02/10 13:06:46 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/src/lpc10_placev.c b/libs/spandsp/src/lpc10_placev.c index 6c77cb1414..78723dd6cf 100644 --- a/libs/spandsp/src/lpc10_placev.c +++ b/libs/spandsp/src/lpc10_placev.c @@ -25,8 +25,6 @@ * This code is based on the U.S. Department of Defense reference * implementation of the LPC-10 2400 bps Voice Coder. They do not * exert copyright claims on their code, and it may be freely used. - * - * $Id: lpc10_placev.c,v 1.19 2009/01/28 03:41:27 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/src/lpc10_voicing.c b/libs/spandsp/src/lpc10_voicing.c index d11572d21b..c4754b46b1 100644 --- a/libs/spandsp/src/lpc10_voicing.c +++ b/libs/spandsp/src/lpc10_voicing.c @@ -25,8 +25,6 @@ * This code is based on the U.S. Department of Defense reference * implementation of the LPC-10 2400 bps Voice Coder. They do not * exert copyright claims on their code, and it may be freely used. - * - * $Id: lpc10_voicing.c,v 1.18 2009/02/03 16:28:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/src/make_at_dictionary.c b/libs/spandsp/src/make_at_dictionary.c index 874bd5469c..b5fee707a5 100644 --- a/libs/spandsp/src/make_at_dictionary.c +++ b/libs/spandsp/src/make_at_dictionary.c @@ -11,19 +11,17 @@ * All rights reserved. * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 2.1, - * as published by the Free Software Foundation. + * 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 Lesser General Public License for more details. + * GNU General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software + * 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. - * - * $Id: make_at_dictionary.c,v 1.6 2009/10/09 14:53:57 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/src/make_modem_filter.c b/libs/spandsp/src/make_modem_filter.c index 94feb885e2..aa58ac301b 100644 --- a/libs/spandsp/src/make_modem_filter.c +++ b/libs/spandsp/src/make_modem_filter.c @@ -22,8 +22,6 @@ * 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. - * - * $Id: make_modem_filter.c,v 1.17.4.1 2009/12/28 12:20:46 steveu Exp $ */ #if defined(HAVE_CONFIG_H) @@ -328,7 +326,8 @@ int main(int argc, char **argv) double baud_rate; double rx_excess_bandwidth; double tx_excess_bandwidth; - const char *tag; + const char *rx_tag; + const char *tx_tag; const char *modem; fixed_point = FALSE; @@ -367,58 +366,50 @@ int main(int argc, char **argv) tx_excess_bandwidth = 0.25; carrier = 1800.0; baud_rate = 2400.0; - tag = ""; + rx_tag = ""; + tx_tag = ""; } else if (strcmp(modem, "V.22bis") == 0) { /* This is only intended to apply to transmit. */ rx_coeff_sets = 12; - rx_coeffs_per_filter = 37; + rx_coeffs_per_filter = 27; rx_excess_bandwidth = 0.75; tx_coeff_sets = 40; tx_coeffs_per_filter = 9; tx_excess_bandwidth = 0.75; carrier = 1200.0; baud_rate = 600.0; - tag = ""; + rx_tag = ""; + tx_tag = ""; } else if (strcmp(modem, "V.22bis1200") == 0) { /* This is only intended to apply to receive. */ rx_coeff_sets = 12; - rx_coeffs_per_filter = 37; + rx_coeffs_per_filter = 27; rx_excess_bandwidth = 0.75; tx_coeff_sets = 40; tx_coeffs_per_filter = 9; tx_excess_bandwidth = 0.75; carrier = 1200.0; baud_rate = 600.0; - tag = "_1200"; + rx_tag = "_1200"; + tx_tag = "_1200"; } else if (strcmp(modem, "V.22bis2400") == 0) { /* This is only intended to apply to receive. */ rx_coeff_sets = 12; - rx_coeffs_per_filter = 37; + rx_coeffs_per_filter = 27; rx_excess_bandwidth = 0.75; tx_coeff_sets = 40; tx_coeffs_per_filter = 9; tx_excess_bandwidth = 0.75; carrier = 2400.0; baud_rate = 600.0; - tag = "_2400"; - } - else if (strcmp(modem, "V.27ter4800") == 0) - { - rx_coeff_sets = 8; - rx_coeffs_per_filter = 27; - rx_excess_bandwidth = 0.5; - tx_coeff_sets = 5; - tx_coeffs_per_filter = 9; - tx_excess_bandwidth = 0.5; - carrier = 1800.0; - baud_rate = 1600.0; - tag = "_4800"; + rx_tag = "_2400"; + tx_tag = "_2400"; } else if (strcmp(modem, "V.27ter2400") == 0) { @@ -430,7 +421,21 @@ int main(int argc, char **argv) tx_excess_bandwidth = 0.5; carrier = 1800.0; baud_rate = 1200.0; - tag = "_2400"; + rx_tag = "_2400"; + tx_tag = "_2400"; + } + else if (strcmp(modem, "V.27ter4800") == 0) + { + rx_coeff_sets = 8; + rx_coeffs_per_filter = 27; + rx_excess_bandwidth = 0.5; + tx_coeff_sets = 5; + tx_coeffs_per_filter = 9; + tx_excess_bandwidth = 0.5; + carrier = 1800.0; + baud_rate = 1600.0; + rx_tag = "_4800"; + tx_tag = "_4800"; } else if (strcmp(modem, "V.29") == 0) { @@ -442,7 +447,8 @@ int main(int argc, char **argv) tx_excess_bandwidth = 0.25; carrier = 1700.0; baud_rate = 2400.0; - tag = ""; + rx_tag = ""; + tx_tag = ""; } else { @@ -457,7 +463,7 @@ int main(int argc, char **argv) baud_rate, tx_excess_bandwidth, fixed_point, - tag); + tx_tag); } else { @@ -467,7 +473,7 @@ int main(int argc, char **argv) baud_rate, rx_excess_bandwidth, fixed_point, - tag); + rx_tag); } return 0; } diff --git a/libs/spandsp/src/mmx_sse_decs.h b/libs/spandsp/src/mmx_sse_decs.h index 40dca542b5..4dff6fe26a 100644 --- a/libs/spandsp/src/mmx_sse_decs.h +++ b/libs/spandsp/src/mmx_sse_decs.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: mmx_sse_decs.h,v 1.1 2009/07/12 09:23:09 steveu Exp $ */ #if !defined(_MMX_SSE_DECS_H_) diff --git a/libs/spandsp/src/modem_connect_tones.c b/libs/spandsp/src/modem_connect_tones.c index 93e0b31485..25e96b04d2 100644 --- a/libs/spandsp/src/modem_connect_tones.c +++ b/libs/spandsp/src/modem_connect_tones.c @@ -2,7 +2,7 @@ * SpanDSP - a series of DSP components for telephony * * modem_connect_tones.c - Generation and detection of tones - * associated with modems calling and answering calls. + * associated with modems calling and answering calls. * * Written by Steve Underwood * @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: modem_connect_tones.c,v 1.41 2009/11/06 19:21:33 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/modem_echo.c b/libs/spandsp/src/modem_echo.c index c31d4cba31..e4203e15e5 100644 --- a/libs/spandsp/src/modem_echo.c +++ b/libs/spandsp/src/modem_echo.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: modem_echo.c,v 1.26 2009/09/22 13:11:04 steveu Exp $ */ /*! \file */ @@ -55,7 +53,16 @@ #include "spandsp/private/modem_echo.h" -SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_create(int len) +SPAN_DECLARE(void) modem_echo_can_free(modem_echo_can_state_t *ec) +{ + fir16_free(&ec->fir_state); + free(ec->fir_taps32); + free(ec->fir_taps16); + free(ec); +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_init(int len) { modem_echo_can_state_t *ec; @@ -88,15 +95,6 @@ SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_create(int len) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(void) modem_echo_can_free(modem_echo_can_state_t *ec) -{ - fir16_free(&ec->fir_state); - free(ec->fir_taps32); - free(ec->fir_taps16); - free(ec); -} -/*- End of function --------------------------------------------------------*/ - SPAN_DECLARE(void) modem_echo_can_flush(modem_echo_can_state_t *ec) { ec->tx_power = 0; diff --git a/libs/spandsp/src/msvc/config.h b/libs/spandsp/src/msvc/config.h index f1bdab324f..a1eaae16a6 100644 --- a/libs/spandsp/src/msvc/config.h +++ b/libs/spandsp/src/msvc/config.h @@ -9,8 +9,6 @@ * * * This file is released in the public domain. - * - * $Id: config.h,v 1.4 2009/02/25 15:30:21 steveu Exp $ */ #if !defined(_MSVC_CONFIG_H_) diff --git a/libs/spandsp/src/noise.c b/libs/spandsp/src/noise.c index 4eaccae911..5d7fe23aad 100644 --- a/libs/spandsp/src/noise.c +++ b/libs/spandsp/src/noise.c @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: noise.c,v 1.31 2009/02/10 13:06:46 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/playout.c b/libs/spandsp/src/playout.c index 0f3eabc715..073c4bf96b 100644 --- a/libs/spandsp/src/playout.c +++ b/libs/spandsp/src/playout.c @@ -28,8 +28,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: playout.c,v 1.17 2009/02/10 13:06:46 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/src/plc.c b/libs/spandsp/src/plc.c index 56f3a72fa0..fb1cea78be 100644 --- a/libs/spandsp/src/plc.c +++ b/libs/spandsp/src/plc.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: plc.c,v 1.27.4.1 2009/12/23 14:23:49 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/power_meter.c b/libs/spandsp/src/power_meter.c index ed13bd2f03..fc752c3846 100644 --- a/libs/spandsp/src/power_meter.c +++ b/libs/spandsp/src/power_meter.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: power_meter.c,v 1.31 2009/05/30 17:29:23 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/queue.c b/libs/spandsp/src/queue.c index c671b1e148..51774a1810 100644 --- a/libs/spandsp/src/queue.c +++ b/libs/spandsp/src/queue.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: queue.c,v 1.31 2009/04/11 18:11:19 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/schedule.c b/libs/spandsp/src/schedule.c index 010806a129..60ba12bc1f 100644 --- a/libs/spandsp/src/schedule.c +++ b/libs/spandsp/src/schedule.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: schedule.c,v 1.22 2009/02/10 13:06:46 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/src/sig_tone.c b/libs/spandsp/src/sig_tone.c index f25119c97d..99b0444023 100644 --- a/libs/spandsp/src/sig_tone.c +++ b/libs/spandsp/src/sig_tone.c @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: sig_tone.c,v 1.40 2010/05/12 15:32:41 steveu Exp $ */ /*! \file */ @@ -634,8 +632,8 @@ SPAN_DECLARE(void) sig_tone_rx_set_mode(sig_tone_rx_state_t *s, int mode, int du SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int tone_type, tone_report_func_t sig_update, void *user_data) { -#if !defined(SPANDSP_USE_FIXED_POINT) int i; +#if !defined(SPANDSP_USE_FIXED_POINT) int j; #endif diff --git a/libs/spandsp/src/silence_gen.c b/libs/spandsp/src/silence_gen.c index 4998f8bc0e..96559d5d14 100644 --- a/libs/spandsp/src/silence_gen.c +++ b/libs/spandsp/src/silence_gen.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: silence_gen.c,v 1.23 2009/09/04 14:38:46 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp.h.in b/libs/spandsp/src/spandsp.h.in index 3293bb5027..9167c1c2cc 100644 --- a/libs/spandsp/src/spandsp.h.in +++ b/libs/spandsp/src/spandsp.h.in @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: spandsp.h.in,v 1.19.4.1 2009/12/19 09:47:56 steveu Exp $ */ /*! \file */ @@ -85,19 +83,26 @@ #include #include #include +#include +#include +#include #include #include #include #include +/*#include */ #include #include #include -#include +/*#include */ #include -#include -#include #include #include +#include +#include +#include +/*#include */ +/*#include */ #include #include #include @@ -120,6 +125,7 @@ #include #include #include +#include #endif diff --git a/libs/spandsp/src/spandsp/adsi.h b/libs/spandsp/src/spandsp/adsi.h index d8c8294355..72275de9af 100644 --- a/libs/spandsp/src/spandsp/adsi.h +++ b/libs/spandsp/src/spandsp/adsi.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: adsi.h,v 1.40 2009/05/22 16:39:01 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/arctan2.h b/libs/spandsp/src/spandsp/arctan2.h index e732601eed..628a559987 100644 --- a/libs/spandsp/src/spandsp/arctan2.h +++ b/libs/spandsp/src/spandsp/arctan2.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: arctan2.h,v 1.13 2008/05/29 13:04:19 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/async.h b/libs/spandsp/src/spandsp/async.h index 50eb6e4455..9c6c66cf8a 100644 --- a/libs/spandsp/src/spandsp/async.h +++ b/libs/spandsp/src/spandsp/async.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: async.h,v 1.25 2009/04/23 14:12:34 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/at_interpreter.h b/libs/spandsp/src/spandsp/at_interpreter.h index 90cf061699..6f844599f0 100644 --- a/libs/spandsp/src/spandsp/at_interpreter.h +++ b/libs/spandsp/src/spandsp/at_interpreter.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: at_interpreter.h,v 1.23 2009/02/10 13:06:47 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/awgn.h b/libs/spandsp/src/spandsp/awgn.h index ef4ff09d14..7f8b780273 100644 --- a/libs/spandsp/src/spandsp/awgn.h +++ b/libs/spandsp/src/spandsp/awgn.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: awgn.h,v 1.18 2009/02/10 13:06:47 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/bell_r2_mf.h b/libs/spandsp/src/spandsp/bell_r2_mf.h index 398a9c583b..6421a36a41 100644 --- a/libs/spandsp/src/spandsp/bell_r2_mf.h +++ b/libs/spandsp/src/spandsp/bell_r2_mf.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bell_r2_mf.h,v 1.24 2009/02/10 13:06:47 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/bert.h b/libs/spandsp/src/spandsp/bert.h index 3871255bad..93d8d08c13 100644 --- a/libs/spandsp/src/spandsp/bert.h +++ b/libs/spandsp/src/spandsp/bert.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bert.h,v 1.23 2009/02/10 13:06:47 steveu Exp $ */ #if !defined(_SPANDSP_BERT_H_) diff --git a/libs/spandsp/src/spandsp/biquad.h b/libs/spandsp/src/spandsp/biquad.h index 1373dfef79..f17ca95fab 100644 --- a/libs/spandsp/src/spandsp/biquad.h +++ b/libs/spandsp/src/spandsp/biquad.h @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: biquad.h,v 1.14 2008/04/17 14:26:59 steveu Exp $ */ /*! \page biquad_page Bi-quadratic filter sections diff --git a/libs/spandsp/src/spandsp/bit_operations.h b/libs/spandsp/src/spandsp/bit_operations.h index 56850ffd35..df308d9ec2 100644 --- a/libs/spandsp/src/spandsp/bit_operations.h +++ b/libs/spandsp/src/spandsp/bit_operations.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bit_operations.h,v 1.27 2009/07/10 13:15:56 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/bitstream.h b/libs/spandsp/src/spandsp/bitstream.h index a934a77edb..b55e4afd16 100644 --- a/libs/spandsp/src/spandsp/bitstream.h +++ b/libs/spandsp/src/spandsp/bitstream.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bitstream.h,v 1.14.4.1 2009/12/28 12:20:47 steveu Exp $ */ /*! \file */ @@ -58,7 +56,15 @@ SPAN_DECLARE(void) bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t val \return The value retrieved from the input buffer. */ SPAN_DECLARE(uint32_t) bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits); -/*! \brief Flush any residual bit to the output buffer. +/*! \brief Emit any residual bits to the output buffer, without actually flushing them. + This is useful for getting the buffer fully up to date, ready for things + like CRC calculations, while allowing bitstream_put() to be used to continue + the message later. + \param s A pointer to the bitstream context. + \param c A pointer to the bitstream output buffer. */ +SPAN_DECLARE(void) bitstream_emit(bitstream_state_t *s, uint8_t **c); + +/*! \brief Flush any residual bits to the output buffer. \param s A pointer to the bitstream context. \param c A pointer to the bitstream output buffer. */ SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c); diff --git a/libs/spandsp/src/spandsp/complex.h b/libs/spandsp/src/spandsp/complex.h index 4575f68b6f..3bc8c5407d 100644 --- a/libs/spandsp/src/spandsp/complex.h +++ b/libs/spandsp/src/spandsp/complex.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: complex.h,v 1.20 2009/02/21 05:39:08 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/complex_filters.h b/libs/spandsp/src/spandsp/complex_filters.h index efc99ab85c..51d3c61c00 100644 --- a/libs/spandsp/src/spandsp/complex_filters.h +++ b/libs/spandsp/src/spandsp/complex_filters.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: complex_filters.h,v 1.14 2009/02/03 16:28:41 steveu Exp $ */ #if !defined(_SPANDSP_COMPLEX_FILTERS_H_) diff --git a/libs/spandsp/src/spandsp/complex_vector_float.h b/libs/spandsp/src/spandsp/complex_vector_float.h index abfb8bd0ef..4dc3569f7a 100644 --- a/libs/spandsp/src/spandsp/complex_vector_float.h +++ b/libs/spandsp/src/spandsp/complex_vector_float.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: complex_vector_float.h,v 1.13 2009/02/04 13:18:53 steveu Exp $ */ #if !defined(_SPANDSP_COMPLEX_VECTOR_FLOAT_H_) diff --git a/libs/spandsp/src/spandsp/complex_vector_int.h b/libs/spandsp/src/spandsp/complex_vector_int.h index 114d00e438..320457d57f 100644 --- a/libs/spandsp/src/spandsp/complex_vector_int.h +++ b/libs/spandsp/src/spandsp/complex_vector_int.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: complex_vector_int.h,v 1.4 2009/01/31 08:48:11 steveu Exp $ */ #if !defined(_SPANDSP_COMPLEX_VECTOR_INT_H_) diff --git a/libs/spandsp/src/spandsp/crc.h b/libs/spandsp/src/spandsp/crc.h index d2dab65398..a4d9b8040a 100644 --- a/libs/spandsp/src/spandsp/crc.h +++ b/libs/spandsp/src/spandsp/crc.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: crc.h,v 1.5 2009/01/31 08:48:11 steveu Exp $ */ /*! \file */ @@ -66,7 +64,7 @@ SPAN_DECLARE(int) crc_itu32_append(uint8_t *buf, int len); */ SPAN_DECLARE(int) crc_itu32_check(const uint8_t *buf, int len); -/*! \brief Calculate the ITU/CCITT CRC-16 value in buffer. +/*! \brief Calculate the ITU/CCITT CRC-16 value in buffer by whole bytes. \param buf The buffer containing the data. \param len The length of the frame. \param crc The initial CRC value. This is usually 0xFFFF, or 0 for a new block (it depends on @@ -75,6 +73,15 @@ SPAN_DECLARE(int) crc_itu32_check(const uint8_t *buf, int len); */ SPAN_DECLARE(uint16_t) crc_itu16_calc(const uint8_t *buf, int len, uint16_t crc); +/*! \brief Calculate the ITU/CCITT CRC-16 value of some bits from a byte. + \param buf The buffer containing the byte of data. + \param len The number of bits, starting from the LSB. + \param crc The initial CRC value. This is usually 0xFFFF, or 0 for a new block (it depends on + the application). It is previous returned CRC value for the continuation of a block. + \return The CRC value. +*/ +SPAN_DECLARE(uint16_t) crc_itu16_bits(uint8_t buf, int len, uint16_t crc); + /*! \brief Append an ITU/CCITT CRC-16 value to a frame. \param buf The buffer containing the frame. This must be at least 2 bytes longer than the frame it contains, to allow room for the CRC value. diff --git a/libs/spandsp/src/spandsp/dc_restore.h b/libs/spandsp/src/spandsp/dc_restore.h index 4061f41137..94ff6c7e70 100644 --- a/libs/spandsp/src/spandsp/dc_restore.h +++ b/libs/spandsp/src/spandsp/dc_restore.h @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: dc_restore.h,v 1.24 2008/09/19 14:02:05 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/dds.h b/libs/spandsp/src/spandsp/dds.h index a2228a47a5..10bf99fdf7 100644 --- a/libs/spandsp/src/spandsp/dds.h +++ b/libs/spandsp/src/spandsp/dds.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: dds.h,v 1.23 2009/01/31 08:48:11 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/dtmf.h b/libs/spandsp/src/spandsp/dtmf.h index d3f81eaa19..60b2f65183 100644 --- a/libs/spandsp/src/spandsp/dtmf.h +++ b/libs/spandsp/src/spandsp/dtmf.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: dtmf.h,v 1.32 2009/02/10 13:06:47 steveu Exp $ */ #if !defined(_SPANDSP_DTMF_H_) diff --git a/libs/spandsp/src/spandsp/echo.h b/libs/spandsp/src/spandsp/echo.h index b476909181..ec8c53b023 100644 --- a/libs/spandsp/src/spandsp/echo.h +++ b/libs/spandsp/src/spandsp/echo.h @@ -23,8 +23,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: echo.h,v 1.20 2009/09/22 13:11:04 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/expose.h b/libs/spandsp/src/spandsp/expose.h index da14722aae..6cef9bf7c9 100644 --- a/libs/spandsp/src/spandsp/expose.h +++ b/libs/spandsp/src/spandsp/expose.h @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: expose.h,v 1.14.4.1 2009/12/19 09:47:56 steveu Exp $ */ /*! \file */ @@ -61,16 +59,24 @@ #include #include #include -#include -#include +#include +#include #include #include #include #include #include -#include +#include +#include +/*#include */ +/*#include */ #include #include +#include +#include +#include +/*#include */ +/*#include */ #include #include #include @@ -80,7 +86,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libs/spandsp/src/spandsp/fast_convert.h b/libs/spandsp/src/spandsp/fast_convert.h index ccf275aaf3..10679eab4d 100644 --- a/libs/spandsp/src/spandsp/fast_convert.h +++ b/libs/spandsp/src/spandsp/fast_convert.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: fast_convert.h,v 1.9 2009/10/03 04:37:25 steveu Exp $ */ #if !defined(_SPANDSP_FAST_CONVERT_H_) @@ -82,12 +80,12 @@ extern "C" */ #if defined(__CYGWIN__) -#if !defined(__cplusplus) +#if !defined(__cplusplus) && (__GNUC__ < 4) /* - * CYGWIN has lrint and lrintf functions, but they are slow and buggy: + * CYGWIN versions prior to 1.7.1 have lrint and lrintf functions, but + * they are slow and buggy: * http://sourceware.org/ml/cygwin/2005-06/msg00153.html * http://sourceware.org/ml/cygwin/2005-09/msg00047.html - * The latest version of cygwin seems to have made no effort to fix this. * These replacement functions (pulled from the Public Domain MinGW * math.h header) replace the native versions. */ diff --git a/libs/spandsp/src/spandsp/fax.h b/libs/spandsp/src/spandsp/fax.h index fe0598b1a7..9d268770bc 100644 --- a/libs/spandsp/src/spandsp/fax.h +++ b/libs/spandsp/src/spandsp/fax.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: fax.h,v 1.39 2009/03/13 12:59:26 steveu Exp $ */ /*! \file */ @@ -52,7 +50,7 @@ extern "C" \return The number of samples unprocessed. This should only be non-zero if the software has reached the end of the FAX call. */ -SPAN_DECLARE(int) fax_rx(fax_state_t *s, int16_t *amp, int len); +SPAN_DECLARE_NONSTD(int) fax_rx(fax_state_t *s, int16_t *amp, int len); /*! Apply fake T.30 receive processing when a block of audio samples is missing (e.g due to packet loss). @@ -62,7 +60,7 @@ SPAN_DECLARE(int) fax_rx(fax_state_t *s, int16_t *amp, int len); \return The number of samples unprocessed. This should only be non-zero if the software has reached the end of the FAX call. */ -SPAN_DECLARE(int) fax_rx_fillin(fax_state_t *s, int len); +SPAN_DECLARE_NONSTD(int) fax_rx_fillin(fax_state_t *s, int len); /*! Apply T.30 transmit processing to generate a block of audio samples. \brief Apply T.30 transmit processing to generate a block of audio samples. @@ -72,7 +70,7 @@ SPAN_DECLARE(int) fax_rx_fillin(fax_state_t *s, int len); \return The number of samples actually generated. This will be zero when there is nothing to send. */ -SPAN_DECLARE(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len); +SPAN_DECLARE_NONSTD(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len); /*! Select whether silent audio will be sent when FAX transmit is idle. \brief Select whether silent audio will be sent when FAX transmit is idle. @@ -104,6 +102,14 @@ SPAN_DECLARE(t30_state_t *) fax_get_t30_state(fax_state_t *s); */ SPAN_DECLARE(logging_state_t *) fax_get_logging_state(fax_state_t *s); +/*! Restart a FAX context. + \brief Restart a FAX context. + \param s The FAX context. + \param calling_party TRUE if the context is for a calling party. FALSE if the + context is for an answering party. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) fax_restart(fax_state_t *s, int calling_party); + /*! Initialise a FAX context. \brief Initialise a FAX context. \param s The FAX context. diff --git a/libs/spandsp/src/spandsp/fax_modems.h b/libs/spandsp/src/spandsp/fax_modems.h index ad48b8f240..a3b5ef6f68 100644 --- a/libs/spandsp/src/spandsp/fax_modems.h +++ b/libs/spandsp/src/spandsp/fax_modems.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: fax_modems.h,v 1.11 2009/04/26 12:55:23 steveu Exp $ */ /*! \file */ @@ -60,16 +58,18 @@ extern "C" #endif /* N.B. the following are currently a work in progress */ -SPAN_DECLARE(int) fax_modems_v17_v21_rx(void *user_data, const int16_t amp[], int len); -SPAN_DECLARE(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t amp[], int len); -SPAN_DECLARE(int) fax_modems_v29_v21_rx(void *user_data, const int16_t amp[], int len); -SPAN_DECLARE(int) fax_modems_v17_v21_rx_fillin(void *user_data, int len); -SPAN_DECLARE(int) fax_modems_v27ter_v21_rx_fillin(void *user_data, int len); -SPAN_DECLARE(int) fax_modems_v29_v21_rx_fillin(void *user_data, int len); +SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx(void *user_data, const int16_t amp[], int len); +SPAN_DECLARE_NONSTD(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t amp[], int len); +SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx(void *user_data, const int16_t amp[], int len); +SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx_fillin(void *user_data, int len); +SPAN_DECLARE_NONSTD(int) fax_modems_v27ter_v21_rx_fillin(void *user_data, int len); +SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx_fillin(void *user_data, int len); SPAN_DECLARE(void) fax_modems_start_rx_modem(fax_modems_state_t *s, int which); SPAN_DECLARE(void) fax_modems_set_tep_mode(fax_modems_state_t *s, int use_tep); +SPAN_DECLARE(int) fax_modems_restart(fax_modems_state_t *s); + SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s, int use_tep, hdlc_frame_handler_t hdlc_accept, diff --git a/libs/spandsp/src/spandsp/fir.h b/libs/spandsp/src/spandsp/fir.h index c3944c1761..52aab24db0 100644 --- a/libs/spandsp/src/spandsp/fir.h +++ b/libs/spandsp/src/spandsp/fir.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: fir.h,v 1.13 2008/04/17 14:27:00 steveu Exp $ */ /*! \page fir_page FIR filtering diff --git a/libs/spandsp/src/spandsp/fsk.h b/libs/spandsp/src/spandsp/fsk.h index 854d9e6a22..df6829514e 100644 --- a/libs/spandsp/src/spandsp/fsk.h +++ b/libs/spandsp/src/spandsp/fsk.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: fsk.h,v 1.41 2009/11/02 13:25:20 steveu Exp $ */ /*! \file */ @@ -236,7 +234,7 @@ SPAN_DECLARE_NONSTD(int) fsk_rx(fsk_rx_state_t *s, const int16_t *amp, int len); \param len The number of samples to fake. \return The number of samples unprocessed. */ -SPAN_DECLARE(int) fsk_rx_fillin(fsk_rx_state_t *s, int len); +SPAN_DECLARE_NONSTD(int) fsk_rx_fillin(fsk_rx_state_t *s, int len); SPAN_DECLARE(void) fsk_rx_set_put_bit(fsk_rx_state_t *s, put_bit_func_t put_bit, void *user_data); diff --git a/libs/spandsp/src/spandsp/g168models.h b/libs/spandsp/src/spandsp/g168models.h index 887dffdc65..ff57491f0b 100644 --- a/libs/spandsp/src/spandsp/g168models.h +++ b/libs/spandsp/src/spandsp/g168models.h @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: g168models.h,v 1.9 2008/08/29 09:28:13 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/g711.h b/libs/spandsp/src/spandsp/g711.h index 274c61d62e..a2e094843e 100644 --- a/libs/spandsp/src/spandsp/g711.h +++ b/libs/spandsp/src/spandsp/g711.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: g711.h,v 1.19 2009/04/12 09:12:10 steveu Exp $ */ /*! \file */ @@ -112,9 +110,9 @@ extern "C" */ /* Enable the trap as per the MIL-STD */ -//#define ULAW_ZEROTRAP +//#define G711_ULAW_ZEROTRAP /*! Bias for u-law encoding from linear. */ -#define ULAW_BIAS 0x84 +#define G711_ULAW_BIAS 0x84 /*! \brief Encode a linear sample to u-law \param linear The sample to encode. @@ -129,12 +127,12 @@ static __inline__ uint8_t linear_to_ulaw(int linear) /* Get the sign and the magnitude of the value. */ if (linear >= 0) { - linear = ULAW_BIAS + linear; + linear = G711_ULAW_BIAS + linear; mask = 0xFF; } else { - linear = ULAW_BIAS - linear; + linear = G711_ULAW_BIAS - linear; mask = 0x7F; } @@ -148,7 +146,7 @@ static __inline__ uint8_t linear_to_ulaw(int linear) u_val = (uint8_t) (0x7F ^ mask); else u_val = (uint8_t) (((seg << 4) | ((linear >> (seg + 3)) & 0xF)) ^ mask); -#ifdef ULAW_ZEROTRAP +#if defined(G711_ULAW_ZEROTRAP) /* Optional ITU trap */ if (u_val == 0) u_val = 0x02; @@ -171,8 +169,8 @@ static __inline__ int16_t ulaw_to_linear(uint8_t ulaw) * Extract and bias the quantization bits. Then * shift up by the segment number and subtract out the bias. */ - t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4); - return (int16_t) ((ulaw & 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS)); + t = (((ulaw & 0x0F) << 3) + G711_ULAW_BIAS) << (((int) ulaw & 0x70) >> 4); + return (int16_t) ((ulaw & 0x80) ? (G711_ULAW_BIAS - t) : (t - G711_ULAW_BIAS)); } /*- End of function --------------------------------------------------------*/ @@ -195,7 +193,7 @@ static __inline__ int16_t ulaw_to_linear(uint8_t ulaw) */ /*! The A-law alternate mark inversion mask */ -#define ALAW_AMI_MASK 0x55 +#define G711_ALAW_AMI_MASK 0x55 /*! \brief Encode a linear sample to A-law \param linear The sample to encode. @@ -209,12 +207,12 @@ static __inline__ uint8_t linear_to_alaw(int linear) if (linear >= 0) { /* Sign (bit 7) bit = 1 */ - mask = ALAW_AMI_MASK | 0x80; + mask = G711_ALAW_AMI_MASK | 0x80; } else { /* Sign (bit 7) bit = 0 */ - mask = ALAW_AMI_MASK; + mask = G711_ALAW_AMI_MASK; linear = -linear - 1; } @@ -244,7 +242,7 @@ static __inline__ int16_t alaw_to_linear(uint8_t alaw) int i; int seg; - alaw ^= ALAW_AMI_MASK; + alaw ^= G711_ALAW_AMI_MASK; i = ((alaw & 0x0F) << 4); seg = (((int) alaw & 0x70) >> 4); if (seg) diff --git a/libs/spandsp/src/spandsp/g722.h b/libs/spandsp/src/spandsp/g722.h index 66e5d79b78..1716e0a0db 100644 --- a/libs/spandsp/src/spandsp/g722.h +++ b/libs/spandsp/src/spandsp/g722.h @@ -27,8 +27,6 @@ ***** Copyright (c) CMU 1993 ***** * Computer Science, Speech Group * Chengxiang Lu and Alex Hauptmann - * - * $Id: g722.h,v 1.26 2009/04/12 09:12:10 steveu Exp $ */ diff --git a/libs/spandsp/src/spandsp/g726.h b/libs/spandsp/src/spandsp/g726.h index f585b0e864..f7c6fd60bf 100644 --- a/libs/spandsp/src/spandsp/g726.h +++ b/libs/spandsp/src/spandsp/g726.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: g726.h,v 1.26 2009/04/12 09:12:10 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/gsm0610.h b/libs/spandsp/src/spandsp/gsm0610.h index b31b7db3e4..e65c7efe26 100644 --- a/libs/spandsp/src/spandsp/gsm0610.h +++ b/libs/spandsp/src/spandsp/gsm0610.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: gsm0610.h,v 1.21 2009/02/10 13:06:47 steveu Exp $ */ #if !defined(_SPANDSP_GSM0610_H_) diff --git a/libs/spandsp/src/spandsp/hdlc.h b/libs/spandsp/src/spandsp/hdlc.h index 9ff9fb1073..a6259a4544 100644 --- a/libs/spandsp/src/spandsp/hdlc.h +++ b/libs/spandsp/src/spandsp/hdlc.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: hdlc.h,v 1.45 2009/06/02 16:03:56 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/ima_adpcm.h b/libs/spandsp/src/spandsp/ima_adpcm.h index 7ef7154905..27be7ec736 100644 --- a/libs/spandsp/src/spandsp/ima_adpcm.h +++ b/libs/spandsp/src/spandsp/ima_adpcm.h @@ -25,8 +25,6 @@ * * Based on a bit from here, a bit from there, eye of toad, * ear of bat, etc - plus, of course, my own 2 cents. - * - * $Id: ima_adpcm.h,v 1.25 2009/04/11 18:11:19 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/logging.h b/libs/spandsp/src/spandsp/logging.h index 9a93f82394..0133b80926 100644 --- a/libs/spandsp/src/spandsp/logging.h +++ b/libs/spandsp/src/spandsp/logging.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: logging.h,v 1.20 2009/02/10 17:44:18 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/lpc10.h b/libs/spandsp/src/spandsp/lpc10.h index d43955065d..b3202cc1cb 100644 --- a/libs/spandsp/src/spandsp/lpc10.h +++ b/libs/spandsp/src/spandsp/lpc10.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: lpc10.h,v 1.22 2009/04/11 18:11:19 steveu Exp $ */ #if !defined(_SPANDSP_LPC10_H_) diff --git a/libs/spandsp/src/spandsp/modem_connect_tones.h b/libs/spandsp/src/spandsp/modem_connect_tones.h index c104e2352f..db3831bf28 100644 --- a/libs/spandsp/src/spandsp/modem_connect_tones.h +++ b/libs/spandsp/src/spandsp/modem_connect_tones.h @@ -23,8 +23,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: modem_connect_tones.h,v 1.24 2009/06/02 16:03:56 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/modem_echo.h b/libs/spandsp/src/spandsp/modem_echo.h index 77ffe6b535..acfe7506a2 100644 --- a/libs/spandsp/src/spandsp/modem_echo.h +++ b/libs/spandsp/src/spandsp/modem_echo.h @@ -24,8 +24,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: modem_echo.h,v 1.14 2009/09/22 13:11:04 steveu Exp $ */ /*! \file */ @@ -95,7 +93,7 @@ extern "C" \param len The length of the canceller, in samples. eturn The new canceller context, or NULL if the canceller could not be created. */ -SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_create(int len); +SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_init(int len); /*! Free a modem echo canceller context. \param ec The echo canceller context. diff --git a/libs/spandsp/src/spandsp/noise.h b/libs/spandsp/src/spandsp/noise.h index eca1136864..9014e482ef 100644 --- a/libs/spandsp/src/spandsp/noise.h +++ b/libs/spandsp/src/spandsp/noise.h @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: noise.h,v 1.17 2009/02/10 13:06:47 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/oki_adpcm.h b/libs/spandsp/src/spandsp/oki_adpcm.h index c9bfef7ef3..c3707f07f8 100644 --- a/libs/spandsp/src/spandsp/oki_adpcm.h +++ b/libs/spandsp/src/spandsp/oki_adpcm.h @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: oki_adpcm.h,v 1.24 2009/02/10 13:06:47 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/playout.h b/libs/spandsp/src/spandsp/playout.h index abe3584a06..41d4a0cb46 100644 --- a/libs/spandsp/src/spandsp/playout.h +++ b/libs/spandsp/src/spandsp/playout.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: playout.h,v 1.14 2009/02/10 13:06:47 steveu Exp $ */ #if !defined(_SPANDSP_PLAYOUT_H_) diff --git a/libs/spandsp/src/spandsp/plc.h b/libs/spandsp/src/spandsp/plc.h index f4cbade794..801c6ac65f 100644 --- a/libs/spandsp/src/spandsp/plc.h +++ b/libs/spandsp/src/spandsp/plc.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: plc.h,v 1.21 2009/02/10 13:06:47 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/power_meter.h b/libs/spandsp/src/spandsp/power_meter.h index 6e03b60bea..5eff21fccd 100644 --- a/libs/spandsp/src/spandsp/power_meter.h +++ b/libs/spandsp/src/spandsp/power_meter.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: power_meter.h,v 1.19 2009/05/19 14:15:09 steveu Exp $ */ #if !defined(_POWER_METER_H_) diff --git a/libs/spandsp/src/spandsp/private/adsi.h b/libs/spandsp/src/spandsp/private/adsi.h index 251cb0ec82..676e05ab40 100644 --- a/libs/spandsp/src/spandsp/private/adsi.h +++ b/libs/spandsp/src/spandsp/private/adsi.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: adsi.h,v 1.4 2009/04/12 04:20:01 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/private/async.h b/libs/spandsp/src/spandsp/private/async.h index dd75f5d560..c3837641df 100644 --- a/libs/spandsp/src/spandsp/private/async.h +++ b/libs/spandsp/src/spandsp/private/async.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: async.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_ASYNC_H_) diff --git a/libs/spandsp/src/spandsp/private/at_interpreter.h b/libs/spandsp/src/spandsp/private/at_interpreter.h index efe4f7901e..da13b5a2bb 100644 --- a/libs/spandsp/src/spandsp/private/at_interpreter.h +++ b/libs/spandsp/src/spandsp/private/at_interpreter.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: at_interpreter.h,v 1.1 2008/11/30 05:43:37 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/private/awgn.h b/libs/spandsp/src/spandsp/private/awgn.h index 9ee57951c5..908a465f9f 100644 --- a/libs/spandsp/src/spandsp/private/awgn.h +++ b/libs/spandsp/src/spandsp/private/awgn.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: awgn.h,v 1.1 2008/11/30 12:38:27 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_AWGN_H_) diff --git a/libs/spandsp/src/spandsp/private/bell_r2_mf.h b/libs/spandsp/src/spandsp/private/bell_r2_mf.h index 91be0fe947..234e4c9ba0 100644 --- a/libs/spandsp/src/spandsp/private/bell_r2_mf.h +++ b/libs/spandsp/src/spandsp/private/bell_r2_mf.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bell_r2_mf.h,v 1.2 2008/10/13 14:19:18 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_BELL_R2_MF_H_) diff --git a/libs/spandsp/src/spandsp/private/bert.h b/libs/spandsp/src/spandsp/private/bert.h index a1b0c3a178..f58bc70943 100644 --- a/libs/spandsp/src/spandsp/private/bert.h +++ b/libs/spandsp/src/spandsp/private/bert.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bert.h,v 1.2 2009/04/14 16:04:54 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_BERT_H_) diff --git a/libs/spandsp/src/spandsp/private/bitstream.h b/libs/spandsp/src/spandsp/private/bitstream.h index fe80c0bdbd..aec8d5e124 100644 --- a/libs/spandsp/src/spandsp/private/bitstream.h +++ b/libs/spandsp/src/spandsp/private/bitstream.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: bitstream.h,v 1.1.4.1 2009/12/28 12:20:47 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_BITSTREAM_H_) diff --git a/libs/spandsp/src/spandsp/private/dtmf.h b/libs/spandsp/src/spandsp/private/dtmf.h index 017cc26800..eeacff16d3 100644 --- a/libs/spandsp/src/spandsp/private/dtmf.h +++ b/libs/spandsp/src/spandsp/private/dtmf.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: dtmf.h,v 1.1 2008/10/13 13:14:01 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_DTMF_H_) diff --git a/libs/spandsp/src/spandsp/private/echo.h b/libs/spandsp/src/spandsp/private/echo.h index 4a91798315..98153ef0f8 100644 --- a/libs/spandsp/src/spandsp/private/echo.h +++ b/libs/spandsp/src/spandsp/private/echo.h @@ -23,8 +23,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: echo.h,v 1.1 2009/09/22 13:11:04 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/private/fax.h b/libs/spandsp/src/spandsp/private/fax.h index 8db77dc2ff..c75f4fa01e 100644 --- a/libs/spandsp/src/spandsp/private/fax.h +++ b/libs/spandsp/src/spandsp/private/fax.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: fax.h,v 1.1 2008/10/13 13:14:01 steveu Exp $ */ /*! \file */ @@ -38,9 +36,11 @@ struct fax_state_s { /*! \brief The T.30 back-end */ t30_state_t t30; - + /*! \brief The analogue modem front-end */ fax_modems_state_t modems; + /*! \brief V.8 */ + //v8_state_t v8; /*! \brief Error and flow logging control */ logging_state_t logging; diff --git a/libs/spandsp/src/spandsp/private/fax_modems.h b/libs/spandsp/src/spandsp/private/fax_modems.h index a46749c0cf..67422bbe40 100644 --- a/libs/spandsp/src/spandsp/private/fax_modems.h +++ b/libs/spandsp/src/spandsp/private/fax_modems.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: fax_modems.h,v 1.4 2009/09/04 14:38:47 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/private/fsk.h b/libs/spandsp/src/spandsp/private/fsk.h index 0fbbf03049..b08a9294fd 100644 --- a/libs/spandsp/src/spandsp/private/fsk.h +++ b/libs/spandsp/src/spandsp/private/fsk.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: fsk.h,v 1.5 2009/04/01 13:22:40 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_FSK_H_) diff --git a/libs/spandsp/src/spandsp/private/g711.h b/libs/spandsp/src/spandsp/private/g711.h index 4e9021e008..5ebc17100d 100644 --- a/libs/spandsp/src/spandsp/private/g711.h +++ b/libs/spandsp/src/spandsp/private/g711.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: g711.h,v 1.2 2009/04/12 09:12:11 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_G711_H_) diff --git a/libs/spandsp/src/spandsp/private/g722.h b/libs/spandsp/src/spandsp/private/g722.h index 7d3b5d16f1..5cb2e0b77f 100644 --- a/libs/spandsp/src/spandsp/private/g722.h +++ b/libs/spandsp/src/spandsp/private/g722.h @@ -27,8 +27,6 @@ ***** Copyright (c) CMU 1993 ***** * Computer Science, Speech Group * Chengxiang Lu and Alex Hauptmann - * - * $Id: g722.h,v 1.2 2009/04/12 09:12:11 steveu Exp $ */ diff --git a/libs/spandsp/src/spandsp/private/g726.h b/libs/spandsp/src/spandsp/private/g726.h index 18d8f29f8a..9d69d00ec2 100644 --- a/libs/spandsp/src/spandsp/private/g726.h +++ b/libs/spandsp/src/spandsp/private/g726.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: g726.h,v 1.4 2009/04/12 09:12:11 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_G726_H_) diff --git a/libs/spandsp/src/spandsp/private/gsm0610.h b/libs/spandsp/src/spandsp/private/gsm0610.h index 2414fd81f2..103a6ebd2c 100644 --- a/libs/spandsp/src/spandsp/private/gsm0610.h +++ b/libs/spandsp/src/spandsp/private/gsm0610.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: gsm0610.h,v 1.2 2008/11/15 14:27:29 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_GSM0610_H_) diff --git a/libs/spandsp/src/spandsp/private/hdlc.h b/libs/spandsp/src/spandsp/private/hdlc.h index f3ffb6c290..e58ef8720c 100644 --- a/libs/spandsp/src/spandsp/private/hdlc.h +++ b/libs/spandsp/src/spandsp/private/hdlc.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: hdlc.h,v 1.3 2009/02/12 12:38:39 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_HDLC_H_) diff --git a/libs/spandsp/src/spandsp/private/ima_adpcm.h b/libs/spandsp/src/spandsp/private/ima_adpcm.h index 5ca9f5bd8c..1685906c28 100644 --- a/libs/spandsp/src/spandsp/private/ima_adpcm.h +++ b/libs/spandsp/src/spandsp/private/ima_adpcm.h @@ -25,8 +25,6 @@ * * Based on a bit from here, a bit from there, eye of toad, * ear of bat, etc - plus, of course, my own 2 cents. - * - * $Id: ima_adpcm.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_IMA_ADPCM_H_) diff --git a/libs/spandsp/src/spandsp/private/logging.h b/libs/spandsp/src/spandsp/private/logging.h index ad3ec915eb..0e59d267b3 100644 --- a/libs/spandsp/src/spandsp/private/logging.h +++ b/libs/spandsp/src/spandsp/private/logging.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: logging.h,v 1.1 2008/11/30 13:44:35 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_LOGGING_H_) diff --git a/libs/spandsp/src/spandsp/private/lpc10.h b/libs/spandsp/src/spandsp/private/lpc10.h index d983d95002..ae9b9528bb 100644 --- a/libs/spandsp/src/spandsp/private/lpc10.h +++ b/libs/spandsp/src/spandsp/private/lpc10.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: lpc10.h,v 1.3 2009/04/12 09:12:11 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_LPC10_H_) diff --git a/libs/spandsp/src/spandsp/private/modem_connect_tones.h b/libs/spandsp/src/spandsp/private/modem_connect_tones.h index 331402c1e4..feb602bdef 100644 --- a/libs/spandsp/src/spandsp/private/modem_connect_tones.h +++ b/libs/spandsp/src/spandsp/private/modem_connect_tones.h @@ -23,8 +23,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: modem_connect_tones.h,v 1.3 2009/11/02 13:25:20 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/private/modem_echo.h b/libs/spandsp/src/spandsp/private/modem_echo.h index 082cb8d569..24bc7577b0 100644 --- a/libs/spandsp/src/spandsp/private/modem_echo.h +++ b/libs/spandsp/src/spandsp/private/modem_echo.h @@ -24,8 +24,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: modem_echo.h,v 1.1 2009/09/22 13:11:04 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/private/noise.h b/libs/spandsp/src/spandsp/private/noise.h index 4f6ecc99e5..73b908497f 100644 --- a/libs/spandsp/src/spandsp/private/noise.h +++ b/libs/spandsp/src/spandsp/private/noise.h @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: noise.h,v 1.1 2008/11/30 12:45:09 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/private/oki_adpcm.h b/libs/spandsp/src/spandsp/private/oki_adpcm.h index 4894775a4d..f039213c43 100644 --- a/libs/spandsp/src/spandsp/private/oki_adpcm.h +++ b/libs/spandsp/src/spandsp/private/oki_adpcm.h @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: oki_adpcm.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/private/queue.h b/libs/spandsp/src/spandsp/private/queue.h index 006ac68109..b621ee9fc5 100644 --- a/libs/spandsp/src/spandsp/private/queue.h +++ b/libs/spandsp/src/spandsp/private/queue.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: queue.h,v 1.2 2009/01/31 08:48:11 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_QUEUE_H_) diff --git a/libs/spandsp/src/spandsp/private/schedule.h b/libs/spandsp/src/spandsp/private/schedule.h index 8e059dad86..1e37b99005 100644 --- a/libs/spandsp/src/spandsp/private/schedule.h +++ b/libs/spandsp/src/spandsp/private/schedule.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: schedule.h,v 1.1 2008/11/30 05:43:37 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_SCHEDULE_H_) diff --git a/libs/spandsp/src/spandsp/private/sig_tone.h b/libs/spandsp/src/spandsp/private/sig_tone.h index 514be52334..1bbeef0466 100644 --- a/libs/spandsp/src/spandsp/private/sig_tone.h +++ b/libs/spandsp/src/spandsp/private/sig_tone.h @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: sig_tone.h,v 1.9 2010/03/11 14:22:30 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_SIG_TONE_H_) diff --git a/libs/spandsp/src/spandsp/private/silence_gen.h b/libs/spandsp/src/spandsp/private/silence_gen.h index bae49defaf..6068c41171 100644 --- a/libs/spandsp/src/spandsp/private/silence_gen.h +++ b/libs/spandsp/src/spandsp/private/silence_gen.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: silence_gen.h,v 1.1 2009/04/12 03:29:58 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_SILENCE_GEN_H_) diff --git a/libs/spandsp/src/spandsp/private/super_tone_rx.h b/libs/spandsp/src/spandsp/private/super_tone_rx.h index 09fbc694e8..1f0fd98564 100644 --- a/libs/spandsp/src/spandsp/private/super_tone_rx.h +++ b/libs/spandsp/src/spandsp/private/super_tone_rx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: super_tone_rx.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_SUPER_TONE_RX_H_) diff --git a/libs/spandsp/src/spandsp/private/super_tone_tx.h b/libs/spandsp/src/spandsp/private/super_tone_tx.h index 0078544835..b6efced965 100644 --- a/libs/spandsp/src/spandsp/private/super_tone_tx.h +++ b/libs/spandsp/src/spandsp/private/super_tone_tx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: super_tone_tx.h,v 1.1 2008/11/30 10:22:19 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_SUPER_TONE_TX_H_) diff --git a/libs/spandsp/src/spandsp/private/swept_tone.h b/libs/spandsp/src/spandsp/private/swept_tone.h index ce8e5a634e..52a9a03f90 100644 --- a/libs/spandsp/src/spandsp/private/swept_tone.h +++ b/libs/spandsp/src/spandsp/private/swept_tone.h @@ -10,19 +10,17 @@ * 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. + * it under the terms of the GNU Lesser General Public License version 2.1, + * 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. + * GNU Lesser 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 + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: swept_tone.h,v 1.1 2009/09/22 12:54:33 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_SWEPT_TONE_H_) diff --git a/libs/spandsp/src/spandsp/private/t30.h b/libs/spandsp/src/spandsp/private/t30.h index 64ae2c5fd5..6e4ee0a704 100644 --- a/libs/spandsp/src/spandsp/private/t30.h +++ b/libs/spandsp/src/spandsp/private/t30.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t30.h,v 1.5.4.1 2009/12/19 09:47:56 steveu Exp $ */ /*! \file */ @@ -36,23 +34,50 @@ */ struct t30_state_s { - /* This must be kept the first thing in the structure, so it can be pointed - to reliably as the structures change over time. */ /*! \brief T.4 context for reading or writing image data. */ - t4_state_t t4; - + union + { + t4_state_t rx; + t4_state_t tx; + } t4; /*! \brief The type of FAX operation currently in progress */ int operation_in_progress; /*! \brief TRUE if behaving as the calling party */ int calling_party; + /*! \brief Internet aware FAX mode bit mask. */ + int iaf; + /*! \brief A bit mask of the currently supported modem types. */ + int supported_modems; + /*! \brief A bit mask of the currently supported image compression modes. */ + int supported_compressions; + /*! \brief A bit mask of the currently supported image resolutions. */ + int supported_resolutions; + /*! \brief A bit mask of the currently supported image sizes. */ + int supported_image_sizes; + /*! \brief A bit mask of the currently supported T.30 special features. */ + int supported_t30_features; + /*! \brief TRUE is ECM mode handling is enabled. */ + int ecm_allowed; +#if 0 + /*! \brief TRUE if we are capable of retransmitting pages */ + int retransmit_capable; +#endif + /*! \brief The received DCS, formatted as an ASCII string, for inclusion in the TIFF file. */ char rx_dcs_string[T30_MAX_DIS_DTC_DCS_LEN*3 + 1]; /*! \brief The text which will be used in FAX page header. No text results in no header line. */ char header_info[T30_MAX_PAGE_HEADER_INFO + 1]; +#if 0 + /*! \brief TRUE for FAX page headers to overlay (i.e. replace) the beginning of the + page image. FALSE for FAX page headers to add to the overall length of + the page. */ + int header_overlays_image; +#endif + /*! \brief The information fields received. */ t30_exchanged_info_t rx_info; /*! \brief The information fields to be transmitted. */ @@ -134,9 +159,6 @@ struct t30_state_s /*! \brief TRUE if a valid DIS has been received from the far end. */ int dis_received; - /*! \brief A flag to indicate a message is in progress. */ - int in_message; - /*! \brief TRUE if the short training sequence should be used. */ int short_train; @@ -253,27 +275,18 @@ struct t30_state_s int tx_stop_page; /*! \brief The current completion status. */ int current_status; - /*! \brief Internet aware FAX mode bit mask. */ - int iaf; - /*! \brief A bit mask of the currently supported modem types. */ - int supported_modems; - /*! \brief A bit mask of the currently supported image compression modes. */ - int supported_compressions; - /*! \brief A bit mask of the currently supported image resolutions. */ - int supported_resolutions; - /*! \brief A bit mask of the currently supported image sizes. */ - int supported_image_sizes; - /*! \brief A bit mask of the currently supported T.30 special features. */ - int supported_t30_features; - /*! \brief TRUE is ECM mode handling is enabled. */ - int ecm_allowed; - + +#if 0 + /*! \brief The number of RTP events */ + int rtp_events; + /*! \brief The number of RTN events */ + int rtn_events; +#endif + /*! \brief the FCF2 field of the last PPS message we received. */ uint8_t last_pps_fcf2; - /*! \brief The number of the first ECM frame which we do not currently received correctly. For - a partial page received correctly, this will be one greater than the number of frames it - contains. */ - int ecm_first_bad_frame; + /*! \brief TRUE if all frames of the current received ECM block are now OK */ + int rx_ecm_block_ok; /*! \brief A count of successfully received ECM frames, to assess progress as a basis for deciding whether to continue error correction when PPRs keep repeating. */ int ecm_progress; diff --git a/libs/spandsp/src/spandsp/private/t30_dis_dtc_dcs_bits.h b/libs/spandsp/src/spandsp/private/t30_dis_dtc_dcs_bits.h index 7db4df98e9..1c8735c996 100644 --- a/libs/spandsp/src/spandsp/private/t30_dis_dtc_dcs_bits.h +++ b/libs/spandsp/src/spandsp/private/t30_dis_dtc_dcs_bits.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t30_dis_dtc_dcs_bits.h,v 1.1.4.1 2009/12/19 09:47:57 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/private/t31.h b/libs/spandsp/src/spandsp/private/t31.h index c061e0121a..a2d8f97199 100644 --- a/libs/spandsp/src/spandsp/private/t31.h +++ b/libs/spandsp/src/spandsp/private/t31.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t31.h,v 1.7 2009/02/12 12:38:39 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_T31_H_) @@ -35,6 +33,7 @@ typedef struct { fax_modems_state_t modems; + //v8_state_t v8; /*! The transmit signal handler to be used when the current one has finished sending. */ span_tx_handler_t *next_tx_handler; diff --git a/libs/spandsp/src/spandsp/private/t38_core.h b/libs/spandsp/src/spandsp/private/t38_core.h index 2de5e8aa08..8f71321dda 100644 --- a/libs/spandsp/src/spandsp/private/t38_core.h +++ b/libs/spandsp/src/spandsp/private/t38_core.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t38_core.h,v 1.4 2009/07/14 13:54:22 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_T38_CORE_H_) diff --git a/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h b/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h index 247233f58e..78604420a9 100644 --- a/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h +++ b/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t38_non_ecm_buffer.h,v 1.2.4.1 2009/12/19 06:43:28 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_T38_NON_ECM_BUFFER_H_) diff --git a/libs/spandsp/src/spandsp/private/t38_terminal.h b/libs/spandsp/src/spandsp/private/t38_terminal.h index af5cbff80d..6681f9321c 100644 --- a/libs/spandsp/src/spandsp/private/t38_terminal.h +++ b/libs/spandsp/src/spandsp/private/t38_terminal.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t38_terminal.h,v 1.2 2008/12/31 13:57:13 steveu Exp $ */ /*! \file */ @@ -97,6 +95,8 @@ typedef struct int32_t samples; /*! \brief The value for samples at the next transmission point. */ int32_t next_tx_samples; + /*! \brief The current transmit timeout. */ + //int32_t timeout_tx_samples; /*! \brief The current receive timeout. */ int32_t timeout_rx_samples; } t38_terminal_front_end_state_t; diff --git a/libs/spandsp/src/spandsp/private/t4_rx.h b/libs/spandsp/src/spandsp/private/t4_rx.h index 6511ace1f8..ba0d4ca74f 100644 --- a/libs/spandsp/src/spandsp/private/t4_rx.h +++ b/libs/spandsp/src/spandsp/private/t4_rx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t4_rx.h,v 1.6.2.8 2009/12/21 17:18:40 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_T4_RX_H_) @@ -38,9 +36,6 @@ typedef struct /*! \brief The libtiff context for the current TIFF file */ TIFF *tiff_file; - /*! \brief The number of pages in the current image file. */ - int pages_in_file; - /*! \brief The compression type for output to the TIFF file. */ int32_t output_compression; /*! \brief The TIFF photometric setting for the current page. */ @@ -50,6 +45,9 @@ typedef struct /*! \brief The TIFF G3 FAX options. */ int32_t output_t4_options; + /*! \brief The number of pages in the current image file. */ + int pages_in_file; + /* "Background" information about the FAX, which can be stored in the image file. */ /*! \brief The vendor of the machine which produced the file. */ const char *vendor; @@ -70,62 +68,5 @@ typedef struct int stop_page; } t4_tiff_state_t; -typedef struct t4_t6_decode_state_s t4_t6_decode_state_t; - -/*! - T.4 1D, T4 2D and T6 decompressor state. -*/ -struct t4_t6_decode_state_s -{ - /*! \brief Callback function to write a row of pixels to the image destination. */ - t4_row_write_handler_t row_write_handler; - /*! \brief Opaque pointer passed to row_write_handler. */ - void *row_write_user_data; - - /*! \brief Incoming bit buffer for decompression. */ - uint32_t rx_bitstream; - /*! \brief The number of bits currently in rx_bitstream. */ - int rx_bits; - /*! \brief The number of bits to be skipped before trying to match the next code word. */ - int rx_skip_bits; - - /*! \brief This variable is used to count the consecutive EOLS we have seen. If it - reaches six, this is the end of the image. It is initially set to -1 for - 1D and 2D decoding, as an indicator that we must wait for the first EOL, - before decoding any image data. */ - int consecutive_eols; - - /*! \brief The reference or starting changing element on the coding line. At the - start of the coding line, a0 is set on an imaginary white changing element - situated just before the first element on the line. During the coding of - the coding line, the position of a0 is defined by the previous coding mode. - (See T.4/4.2.1.3.2.). */ - int a0; - /*! \brief The first changing element on the reference line to the right of a0 and of - opposite colour to a0. */ - int b1; - /*! \brief The length of the in-progress run of black or white. */ - int run_length; - /*! \brief 2D horizontal mode control. */ - int black_white; - /*! \brief TRUE if the current run is black */ - int its_black; - - /*! \brief The current step into the current row run-lengths buffer. */ - int a_cursor; - /*! \brief The current step into the reference row run-lengths buffer. */ - int b_cursor; - - /*! \brief A pointer into the image buffer indicating where the last row begins */ - int last_row_starts_at; - - /*! \brief The current number of consecutive bad rows. */ - int curr_bad_row_run; - /*! \brief The longest run of consecutive bad rows seen in the current page. */ - int longest_bad_row_run; - /*! \brief The total number of bad rows in the current page. */ - int bad_rows; -}; - #endif /*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/spandsp/private/t4_tx.h b/libs/spandsp/src/spandsp/private/t4_tx.h index a65d0b4155..236523a590 100644 --- a/libs/spandsp/src/spandsp/private/t4_tx.h +++ b/libs/spandsp/src/spandsp/private/t4_tx.h @@ -21,48 +21,11 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t4_tx.h,v 1.7.2.4 2009/12/21 17:18:40 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_T4_TX_H_) #define _SPANDSP_PRIVATE_T4_TX_H_ -typedef struct t4_t6_encode_state_s t4_t6_encode_state_t; - -/*! - T.4 1D, T4 2D and T6 compressor state. -*/ -struct t4_t6_encode_state_s -{ - /*! \brief The minimum number of encoded bits per row. This is a timing thing - for hardware FAX machines. */ - int min_bits_per_row; - /*! \brief The current maximum contiguous rows that may be 2D encoded. */ - int max_rows_to_next_1d_row; - - /*! \brief The text which will be used in FAX page header. No text results - in no header line. */ - const char *header_info; - - /*! \brief Number of rows left that can be 2D encoded, before a 1D encoded row - must be used. */ - int rows_to_next_1d_row; - - /*! \brief The number of runs currently in the reference row. */ - int ref_steps; - - /*! \brief Pointer to the byte containing the next image bit to transmit. */ - int bit_pos; - /*! \brief Pointer to the bit within the byte containing the next image bit to transmit. */ - int bit_ptr; - - /*! \brief Callback function to read a row of pixels from the image source. */ - t4_row_read_handler_t row_read_handler; - /*! \brief Opaque pointer passed to row_read_handler. */ - void *row_read_user_data; -}; - /*! T.4 FAX compression/decompression descriptor. This defines the working state for a single instance of a T.4 FAX compression or decompression channel. @@ -79,6 +42,12 @@ struct t4_state_s /*! \brief The time at which handling of the current page began. */ time_t page_start_time; + /*! \brief The text which will be used in FAX page header. No text results + in no header line. */ + const char *header_info; + /*! \brief Optional per instance time zone for the FAX pager header timestamp. */ + struct tz_s *tz; + /*! \brief The size of the compressed image on the line side, in bits. */ int line_image_size; diff --git a/libs/spandsp/src/spandsp/private/time_scale.h b/libs/spandsp/src/spandsp/private/time_scale.h index 85d3975ad6..775046161d 100644 --- a/libs/spandsp/src/spandsp/private/time_scale.h +++ b/libs/spandsp/src/spandsp/private/time_scale.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: time_scale.h,v 1.1 2008/11/15 14:27:29 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_TIME_SCALE_H_) diff --git a/libs/spandsp/src/spandsp/private/tone_detect.h b/libs/spandsp/src/spandsp/private/tone_detect.h index 3d67e52397..2b4a1d276b 100644 --- a/libs/spandsp/src/spandsp/private/tone_detect.h +++ b/libs/spandsp/src/spandsp/private/tone_detect.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: tone_detect.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_TONE_DETECT_H_) diff --git a/libs/spandsp/src/spandsp/private/tone_generate.h b/libs/spandsp/src/spandsp/private/tone_generate.h index a1443be87e..12dfaeb5d4 100644 --- a/libs/spandsp/src/spandsp/private/tone_generate.h +++ b/libs/spandsp/src/spandsp/private/tone_generate.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: tone_generate.h,v 1.1 2008/11/30 10:17:31 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_TONE_GENERATE_H_) diff --git a/libs/spandsp/src/spandsp/private/v17rx.h b/libs/spandsp/src/spandsp/private/v17rx.h index bc8ad1b63c..03b320c11b 100644 --- a/libs/spandsp/src/spandsp/private/v17rx.h +++ b/libs/spandsp/src/spandsp/private/v17rx.h @@ -29,10 +29,11 @@ /* Target length for the equalizer is about 63 taps, to deal with the worst stuff in V.56bis. */ /*! The length of the equalizer buffer */ -#define V17_EQUALIZER_LEN 33 - +//#define V17_EQUALIZER_LEN 33 +#define V17_EQUALIZER_LEN 17 /*! Samples before the target position in the equalizer buffer */ -#define V17_EQUALIZER_PRE_LEN 16 +//#define V17_EQUALIZER_PRE_LEN 16 +#define V17_EQUALIZER_PRE_LEN 8 /*! The number of taps in the pulse shaping/bandpass filter */ #define V17_RX_FILTER_STEPS 27 diff --git a/libs/spandsp/src/spandsp/private/v17tx.h b/libs/spandsp/src/spandsp/private/v17tx.h index c93ba08c35..4d4582f69d 100644 --- a/libs/spandsp/src/spandsp/private/v17tx.h +++ b/libs/spandsp/src/spandsp/private/v17tx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v17tx.h,v 1.2.4.1 2009/12/24 16:52:30 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/private/v18.h b/libs/spandsp/src/spandsp/private/v18.h index 79471fd68f..6f7d987bea 100644 --- a/libs/spandsp/src/spandsp/private/v18.h +++ b/libs/spandsp/src/spandsp/private/v18.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v18.h,v 1.5 2009/11/04 15:52:06 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V18_H_) diff --git a/libs/spandsp/src/spandsp/private/v22bis.h b/libs/spandsp/src/spandsp/private/v22bis.h index a2e07d5392..92317f6d72 100644 --- a/libs/spandsp/src/spandsp/private/v22bis.h +++ b/libs/spandsp/src/spandsp/private/v22bis.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v22bis.h,v 1.12 2009/11/04 15:52:06 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V22BIS_H_) @@ -37,7 +35,7 @@ #define V22BIS_TX_FILTER_STEPS 9 /*! The number of taps in the receive pulse shaping/bandpass filter */ -#define V22BIS_RX_FILTER_STEPS 37 +#define V22BIS_RX_FILTER_STEPS 27 /*! Segments of the training sequence on the receive side */ enum @@ -96,12 +94,16 @@ struct v22bis_state_s struct { /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */ - float rrc_filter[2*V22BIS_RX_FILTER_STEPS]; +#if defined(SPANDSP_USE_FIXED_POINTx) + int16_t rrc_filter[V22BIS_RX_FILTER_STEPS]; +#else + float rrc_filter[V22BIS_RX_FILTER_STEPS]; +#endif /*! \brief Current offset into the RRC pulse shaping filter buffer. */ int rrc_filter_step; /*! \brief The register for the data scrambler. */ - unsigned int scramble_reg; + uint32_t scramble_reg; /*! \brief A counter for the number of consecutive bits of repeating pattern through the scrambler. */ int scrambler_pattern_count; diff --git a/libs/spandsp/src/spandsp/private/v27ter_rx.h b/libs/spandsp/src/spandsp/private/v27ter_rx.h index 63566de622..bc26c2d106 100644 --- a/libs/spandsp/src/spandsp/private/v27ter_rx.h +++ b/libs/spandsp/src/spandsp/private/v27ter_rx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v27ter_rx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V27TER_RX_H_) @@ -30,10 +28,10 @@ /* Target length for the equalizer is about 43 taps for 4800bps and 32 taps for 2400bps to deal with the worst stuff in V.56bis. */ -/*! Samples before the target position in the equalizer buffer */ -#define V27TER_EQUALIZER_PRE_LEN 16 /* This much before the real event */ -/*! Samples after the target position in the equalizer buffer */ -#define V27TER_EQUALIZER_POST_LEN 14 /* This much after the real event (must be even) */ +/*! The length of the equalizer buffer. Must be a power of 2 */ +#define V27TER_EQUALIZER_LEN 32 +/*! Samples before the target central position in the equalizer buffer */ +#define V27TER_EQUALIZER_PRE_LEN 16 /*! The number of taps in the 4800bps pulse shaping/bandpass filter */ #define V27TER_RX_4800_FILTER_STEPS 27 @@ -155,11 +153,11 @@ struct v27ter_rx_state_s /*! \brief The current delta factor for updating the equalizer coefficients. */ float eq_delta; /*! \brief The adaptive equalizer coefficients. */ - /*complexi16_t*/ complexf_t eq_coeff[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN]; + /*complexi16_t*/ complexf_t eq_coeff[V27TER_EQUALIZER_LEN]; /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */ - /*complexi16_t*/ complexf_t eq_coeff_save[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN]; + /*complexi16_t*/ complexf_t eq_coeff_save[V27TER_EQUALIZER_LEN]; /*! \brief The equalizer signal buffer. */ - /*complexi16_t*/ complexf_t eq_buf[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN]; + /*complexi16_t*/ complexf_t eq_buf[V27TER_EQUALIZER_LEN]; #else /*! \brief The scaling factor accessed by the AGC algorithm. */ float agc_scaling; @@ -169,11 +167,11 @@ struct v27ter_rx_state_s /*! \brief The current delta factor for updating the equalizer coefficients. */ float eq_delta; /*! \brief The adaptive equalizer coefficients. */ - complexf_t eq_coeff[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN]; + complexf_t eq_coeff[V27TER_EQUALIZER_LEN]; /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */ - complexf_t eq_coeff_save[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN]; + complexf_t eq_coeff_save[V27TER_EQUALIZER_LEN]; /*! \brief The equalizer signal buffer. */ - complexf_t eq_buf[V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN]; + complexf_t eq_buf[V27TER_EQUALIZER_LEN]; #endif /*! \brief Integration variable for damping the Gardner algorithm tests. */ diff --git a/libs/spandsp/src/spandsp/private/v27ter_tx.h b/libs/spandsp/src/spandsp/private/v27ter_tx.h index 28e455cd85..12d77510d4 100644 --- a/libs/spandsp/src/spandsp/private/v27ter_tx.h +++ b/libs/spandsp/src/spandsp/private/v27ter_tx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v27ter_tx.h,v 1.3 2009/07/09 13:52:09 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V27TER_TX_H_) diff --git a/libs/spandsp/src/spandsp/private/v29rx.h b/libs/spandsp/src/spandsp/private/v29rx.h index 6dbb3a727d..3f6433bad9 100644 --- a/libs/spandsp/src/spandsp/private/v29rx.h +++ b/libs/spandsp/src/spandsp/private/v29rx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v29rx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V29RX_H_) @@ -30,10 +28,10 @@ /* Target length for the equalizer is about 63 taps, to deal with the worst stuff in V.56bis. */ +/*! The length of the equalizer buffer */ +#define V29_EQUALIZER_LEN 33 /*! Samples before the target position in the equalizer buffer */ #define V29_EQUALIZER_PRE_LEN 16 -/*! Samples after the target position in the equalizer buffer */ -#define V29_EQUALIZER_POST_LEN 14 /*! The number of taps in the pulse shaping/bandpass filter */ #define V29_RX_FILTER_STEPS 27 @@ -73,7 +71,7 @@ struct v29_rx_state_s int rrc_filter_step; /*! \brief The register for the data scrambler. */ - unsigned int scramble_reg; + uint32_t scramble_reg; /*! \brief The register for the training scrambler. */ uint8_t training_scramble_reg; /*! \brief The current step in the table of CD constellation positions. */ @@ -146,11 +144,11 @@ struct v29_rx_state_s /*! \brief The current delta factor for updating the equalizer coefficients. */ int16_t eq_delta; /*! \brief The adaptive equalizer coefficients. */ - complexi16_t eq_coeff[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; + complexi16_t eq_coeff[V29_EQUALIZER_LEN]; /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */ - complexi16_t eq_coeff_save[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; + complexi16_t eq_coeff_save[V29_EQUALIZER_LEN]; /*! \brief The equalizer signal buffer. */ - complexi16_t eq_buf[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; + complexi16_t eq_buf[V29_EQUALIZER_LEN]; /*! Low band edge filter for symbol sync. */ int32_t symbol_sync_low[2]; @@ -169,11 +167,11 @@ struct v29_rx_state_s /*! \brief The current delta factor for updating the equalizer coefficients. */ float eq_delta; /*! \brief The adaptive equalizer coefficients. */ - complexf_t eq_coeff[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; + complexf_t eq_coeff[V29_EQUALIZER_LEN]; /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */ - complexf_t eq_coeff_save[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; + complexf_t eq_coeff_save[V29_EQUALIZER_LEN]; /*! \brief The equalizer signal buffer. */ - complexf_t eq_buf[V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN]; + complexf_t eq_buf[V29_EQUALIZER_LEN]; /*! Low band edge filter for symbol sync. */ float symbol_sync_low[2]; diff --git a/libs/spandsp/src/spandsp/private/v29tx.h b/libs/spandsp/src/spandsp/private/v29tx.h index 129f68c09a..bb95dba527 100644 --- a/libs/spandsp/src/spandsp/private/v29tx.h +++ b/libs/spandsp/src/spandsp/private/v29tx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v29tx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V29TX_H_) diff --git a/libs/spandsp/src/spandsp/private/v42.h b/libs/spandsp/src/spandsp/private/v42.h index 1a1347c746..0689c1d01a 100644 --- a/libs/spandsp/src/spandsp/private/v42.h +++ b/libs/spandsp/src/spandsp/private/v42.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v42.h,v 1.2 2009/11/04 15:52:06 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V42_H_) diff --git a/libs/spandsp/src/spandsp/private/v42bis.h b/libs/spandsp/src/spandsp/private/v42bis.h index 96538f2e08..287c26bd2c 100644 --- a/libs/spandsp/src/spandsp/private/v42bis.h +++ b/libs/spandsp/src/spandsp/private/v42bis.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v42bis.h,v 1.1 2008/11/15 14:43:08 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V42BIS_H_) diff --git a/libs/spandsp/src/spandsp/private/v8.h b/libs/spandsp/src/spandsp/private/v8.h index 45d56aab9f..2fb481d0b2 100644 --- a/libs/spandsp/src/spandsp/private/v8.h +++ b/libs/spandsp/src/spandsp/private/v8.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v8.h,v 1.3.4.1 2009/12/28 12:20:47 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V8_H_) @@ -30,10 +28,12 @@ struct v8_state_s { - /*! \brief TRUE if we are the calling modem */ + /*! \brief TRUE if we are the calling party */ int calling_party; + /*! \brief A handler to process the V.8 signals */ v8_result_handler_t *result_handler; + /*! \brief An opaque pointer passed to result_handler */ void *result_handler_user_data; /*! \brief The current state of the V.8 protocol */ @@ -49,12 +49,12 @@ struct v8_state_s modem_connect_tones_tx_state_t ansam_tx; modem_connect_tones_rx_state_t ansam_rx; - /*! \brief Modulation schemes available at this end. */ - unsigned int far_end_modulations; - v8_parms_t parms; v8_parms_t result; + /*! \brief The number of modulation bytes to use when sending. */ + int modulation_bytes; + /* V.8 data parsing */ uint32_t bit_stream; int bit_cnt; diff --git a/libs/spandsp/src/spandsp/queue.h b/libs/spandsp/src/spandsp/queue.h index d5e58d4496..cbb4357916 100644 --- a/libs/spandsp/src/spandsp/queue.h +++ b/libs/spandsp/src/spandsp/queue.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: queue.h,v 1.21 2009/02/10 13:06:47 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/saturated.h b/libs/spandsp/src/spandsp/saturated.h index 2038b25216..958167b4ec 100644 --- a/libs/spandsp/src/spandsp/saturated.h +++ b/libs/spandsp/src/spandsp/saturated.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: saturated.h,v 1.4 2009/02/05 12:21:36 steveu Exp $ */ /*! \file */ @@ -44,6 +42,7 @@ extern "C" { #endif +/* This is the same as saturate16(), but is here for historic reasons */ static __inline__ int16_t saturate(int32_t amp) { int16_t amp16; @@ -58,6 +57,20 @@ static __inline__ int16_t saturate(int32_t amp) } /*- End of function --------------------------------------------------------*/ +static __inline__ int16_t saturate16(int32_t amp) +{ + int16_t amp16; + + /* Hopefully this is optimised for the common case - not clipping */ + amp16 = (int16_t) amp; + if (amp == amp16) + return amp16; + if (amp > INT16_MAX) + return INT16_MAX; + return INT16_MIN; +} +/*- End of function --------------------------------------------------------*/ + /*! Saturate to 15 bits, rather than the usual 16 bits. This is often a useful function. */ static __inline__ int16_t saturate15(int32_t amp) { @@ -69,6 +82,34 @@ static __inline__ int16_t saturate15(int32_t amp) } /*- End of function --------------------------------------------------------*/ +static __inline__ uint16_t saturateu16(int32_t amp) +{ + uint16_t amp16; + + /* Hopefully this is optimised for the common case - not clipping */ + amp16 = (uint16_t) amp; + if (amp == amp16) + return amp16; + if (amp > UINT16_MAX) + return UINT16_MAX; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ uint8_t saturateu8(int32_t amp) +{ + uint8_t amp8; + + /* Hopefully this is optimised for the common case - not clipping */ + amp8 = (uint8_t) amp; + if (amp == amp8) + return amp8; + if (amp > UINT8_MAX) + return UINT8_MAX; + return 0; +} +/*- End of function --------------------------------------------------------*/ + static __inline__ int16_t fsaturatef(float famp) { if (famp > (float) INT16_MAX) @@ -135,7 +176,7 @@ static __inline__ double ffsaturate(double famp) static __inline__ int16_t saturated_add16(int16_t a, int16_t b) { -#if defined(__GNUC__) && defined(__i386__) +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) __asm__ __volatile__( " addw %2,%0;\n" " jno 0f;\n" @@ -147,6 +188,15 @@ static __inline__ int16_t saturated_add16(int16_t a, int16_t b) : "cc" ); return a; +#elif defined(__GNUC__) && defined(__arm5__) + int16_t result; + + __asm__ __volatile__( + " sadd16 %0,%1,%2;\n" + : "=r" (result) + : "0" (a), "ir" (b) + ); + return result; #else return saturate((int32_t) a + (int32_t) b); #endif @@ -155,7 +205,7 @@ static __inline__ int16_t saturated_add16(int16_t a, int16_t b) static __inline__ int32_t saturated_add32(int32_t a, int32_t b) { -#if defined(__GNUC__) && defined(__i386__) +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) __asm__ __volatile__( " addl %2,%0;\n" " jno 0f;\n" @@ -167,30 +217,92 @@ static __inline__ int32_t saturated_add32(int32_t a, int32_t b) : "cc" ); return a; -#else - uint32_t A; +#elif defined(__GNUC__) && defined(__arm5__) + int32_t result; - if (a < 0) + __asm__ __volatile__( + " qadd %0,%1,%2;\n" + : "=r" (result) + : "0" (a), "ir" (b) + ); + return result; +#else + int32_t sum; + + sum = a + b; + if ((a ^ b) >= 0) { - if (b >= 0) - return a + b; - /*endif*/ - A = (uint32_t) -(a + 1) + (uint32_t) -(b + 1); - return (A >= INT32_MAX) ? INT32_MIN : -(int32_t) A - 2; + if ((sum ^ a) < 0) + sum = (a < 0) ? INT32_MIN : INT32_MAX; } - /*endif*/ - if (b <= 0) - return a + b; - /*endif*/ - A = (uint32_t) a + (uint32_t) b; - return (A > INT32_MAX) ? INT32_MAX : A; + return sum; #endif } /*- End of function --------------------------------------------------------*/ static __inline__ int16_t saturated_sub16(int16_t a, int16_t b) { +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + __asm__ __volatile__( + " subw %2,%0;\n" + " jno 0f;\n" + " movw $0x8000,%0;\n" + " sbbw $0,%0;\n" + "0:" + : "=r" (a) + : "0" (a), "ir" (b) + : "cc" + ); + return a; +#elif defined(__GNUC__) && defined(__arm5__) + int16_t result; + + __asm__ __volatile__( + " ssub16 %0,%1,%2;\n" + : "=r" (result) + : "0" (a), "ir" (b) + ); + return result; +#else return saturate((int32_t) a - (int32_t) b); +#endif +} +/*- End of function --------------------------------------------------------*/ + +static __inline__ int32_t saturated_sub32(int32_t a, int32_t b) +{ +#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + __asm__ __volatile__( + " subl %2,%0;\n" + " jno 0f;\n" + " movl $0x80000000,%0;\n" + " sbbl $0,%0;\n" + "0:" + : "=r" (a) + : "0" (a), "ir" (b) + : "cc" + ); + return a; +#elif defined(__GNUC__) && defined(__arm5__) + int32_t result; + + __asm__ __volatile__( + " qsub %0,%1,%2;\n" + : "=r" (result) + : "0" (a), "ir" (b) + ); + return result; +#else + int32_t diff; + + diff = a - b; + if ((a ^ b) < 0) + { + if ((diff ^ a) & INT32_MIN) + diff = (a < 0L) ? INT32_MIN : INT32_MAX; + } + return diff; +#endif } /*- End of function --------------------------------------------------------*/ @@ -203,7 +315,7 @@ static __inline__ int16_t saturated_mul16(int16_t a, int16_t b) } /*- End of function --------------------------------------------------------*/ -static __inline__ int32_t saturated_mul_16_32(int16_t a, int16_t b) +static __inline__ int32_t saturated_mul16_32(int16_t a, int16_t b) { return ((int32_t) a*(int32_t) b) << 1; } diff --git a/libs/spandsp/src/spandsp/schedule.h b/libs/spandsp/src/spandsp/schedule.h index 20c99f1577..95509e016a 100644 --- a/libs/spandsp/src/spandsp/schedule.h +++ b/libs/spandsp/src/spandsp/schedule.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: schedule.h,v 1.20 2009/02/10 13:06:47 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/sig_tone.h b/libs/spandsp/src/spandsp/sig_tone.h index 649f1e10a6..8213e1ca73 100644 --- a/libs/spandsp/src/spandsp/sig_tone.h +++ b/libs/spandsp/src/spandsp/sig_tone.h @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: sig_tone.h,v 1.23 2010/03/09 13:43:04 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/silence_gen.h b/libs/spandsp/src/spandsp/silence_gen.h index 467408d75b..c2300c845c 100644 --- a/libs/spandsp/src/spandsp/silence_gen.h +++ b/libs/spandsp/src/spandsp/silence_gen.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: silence_gen.h,v 1.19 2009/09/04 14:38:47 steveu Exp $ */ #if !defined(_SPANDSP_SILENCE_GEN_H_) diff --git a/libs/spandsp/src/spandsp/super_tone_rx.h b/libs/spandsp/src/spandsp/super_tone_rx.h index 790c694e69..702069856c 100644 --- a/libs/spandsp/src/spandsp/super_tone_rx.h +++ b/libs/spandsp/src/spandsp/super_tone_rx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: super_tone_rx.h,v 1.21 2009/02/10 13:06:47 steveu Exp $ */ #if !defined(_SPANDSP_SUPER_TONE_RX_H_) diff --git a/libs/spandsp/src/spandsp/super_tone_tx.h b/libs/spandsp/src/spandsp/super_tone_tx.h index b2de99fbb7..9f7ed6d6a1 100644 --- a/libs/spandsp/src/spandsp/super_tone_tx.h +++ b/libs/spandsp/src/spandsp/super_tone_tx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: super_tone_tx.h,v 1.17 2009/02/10 13:06:47 steveu Exp $ */ #if !defined(_SPANDSP_SUPER_TONE_TX_H_) diff --git a/libs/spandsp/src/spandsp/swept_tone.h b/libs/spandsp/src/spandsp/swept_tone.h index 414f951fb3..917b507fff 100644 --- a/libs/spandsp/src/spandsp/swept_tone.h +++ b/libs/spandsp/src/spandsp/swept_tone.h @@ -10,19 +10,17 @@ * 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. + * it under the terms of the GNU Lesser General Public License version 2.1, + * 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. + * GNU Lesser 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 + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: swept_tone.h,v 1.1 2009/09/22 12:54:33 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/t30.h b/libs/spandsp/src/spandsp/t30.h index 3c1b441030..9b01d3b62b 100644 --- a/libs/spandsp/src/spandsp/t30.h +++ b/libs/spandsp/src/spandsp/t30.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t30.h,v 1.126.4.1 2009/12/19 09:47:56 steveu Exp $ */ /*! \file */ @@ -321,6 +319,7 @@ enum T30_MODEM_V27TER, T30_MODEM_V29, T30_MODEM_V17, + T30_MODEM_V34HDX, T30_MODEM_DONE }; @@ -346,7 +345,7 @@ enum /*! Support the V.17 modem (14400, 12000, 9600 and 7200bps) for image transfer. */ T30_SUPPORT_V17 = 0x04, /*! Support the V.34 modem (up to 33,600bps) for image transfer. */ - T30_SUPPORT_V34 = 0x08, + T30_SUPPORT_V34HDX = 0x08, /*! Support the Internet aware FAX mode (no bit rate limit) for image transfer. */ T30_SUPPORT_IAF = 0x10 }; @@ -361,18 +360,20 @@ enum T30_SUPPORT_T4_2D_COMPRESSION = 0x04, /*! T.6 2D compression */ T30_SUPPORT_T6_COMPRESSION = 0x08, - /*! T.85 monochrome JBIG compression */ + /*! T.85 monochrome JBIG compression, with fixed L0 */ T30_SUPPORT_T85_COMPRESSION = 0x10, + /*! T.85 monochrome JBIG compression, with variable L0 */ + T30_SUPPORT_T85_L0_COMPRESSION = 0x20, /*! T.43 colour JBIG compression */ - T30_SUPPORT_T43_COMPRESSION = 0x20, + T30_SUPPORT_T43_COMPRESSION = 0x40, /*! T.45 run length colour compression */ - T30_SUPPORT_T45_COMPRESSION = 0x40, + T30_SUPPORT_T45_COMPRESSION = 0x80, /*! T.81 + T.30 Annex E colour JPEG compression */ - T30_SUPPORT_T81_COMPRESSION = 0x80, + T30_SUPPORT_T81_COMPRESSION = 0x100, /*! T.81 + T.30 Annex K colour sYCC-JPEG compression */ - T30_SUPPORT_SYCC_T81_COMPRESSION = 0x100, + T30_SUPPORT_SYCC_T81_COMPRESSION = 0x200, /*! T.88 monochrome JBIG2 compression */ - T30_SUPPORT_T88_COMPRESSION = 0x200 + T30_SUPPORT_T88_COMPRESSION = 0x400 }; enum @@ -544,8 +545,14 @@ typedef struct int longest_bad_row_run; /*! \brief The number of HDLC frame retries, if error correcting mode is used. */ int error_correcting_mode_retries; - /*! \brief Current status */ + /*! \brief Current status. */ int current_status; +#if 0 + /*! \brief The number of RTP events in this call. */ + int rtp_events; + /*! \brief The number of RTN events in this call. */ + int rtn_events; +#endif } t30_stats_t; #if defined(__cplusplus) diff --git a/libs/spandsp/src/spandsp/t30_api.h b/libs/spandsp/src/spandsp/t30_api.h index 9151e9b55d..d758c8e871 100644 --- a/libs/spandsp/src/spandsp/t30_api.h +++ b/libs/spandsp/src/spandsp/t30_api.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t30_api.h,v 1.10 2009/04/12 09:12:10 steveu Exp $ */ /*! \file */ @@ -227,9 +225,9 @@ SPAN_DECLARE(const char *) t30_get_tx_password(t30_state_t *s); \return A pointer to the password. */ SPAN_DECLARE(const char *) t30_get_rx_password(t30_state_t *s); -/*! Set the transmitted ??? (i.e. the one we will send to the far +/*! Set the transmitted TSA (i.e. the one we will send to the far end) associated with a T.30 context. - \brief Set the transmitted ??? associated with a T.30 context. + \brief Set the transmitted TSA associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. @@ -237,27 +235,26 @@ SPAN_DECLARE(const char *) t30_get_rx_password(t30_state_t *s); \return 0 for OK, else -1. */ SPAN_DECLARE(int) t30_set_tx_tsa(t30_state_t *s, int type, const char *address, int len); -/*! Get the received ??? (i.e. the one we will send to the far +/*! Get the transmitted TSA (i.e. the one we will send to the far end) associated with a T.30 context. - \brief Get the received ??? associated with a T.30 context. + \brief Get the received TSA associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. \return The length of the address. */ SPAN_DECLARE(size_t) t30_get_tx_tsa(t30_state_t *s, int *type, const char *address[]); -/*! Get the received ??? (i.e. the one we will send to the far - end) associated with a T.30 context. - \brief Get the received ??? associated with a T.30 context. +/*! Get the received TSA associated with a T.30 context. + \brief Get the received TSA associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. \return The length of the address. */ SPAN_DECLARE(size_t) t30_get_rx_tsa(t30_state_t *s, int *type, const char *address[]); -/*! Set the transmitted ??? (i.e. the one we will send to the far +/*! Set the transmitted IRA (i.e. the one we will send to the far end) associated with a T.30 context. - \brief Set the transmitted ??? associated with a T.30 context. + \brief Set the transmitted IRA associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. @@ -265,27 +262,26 @@ SPAN_DECLARE(size_t) t30_get_rx_tsa(t30_state_t *s, int *type, const char *addre \return 0 for OK, else -1. */ SPAN_DECLARE(int) t30_set_tx_ira(t30_state_t *s, int type, const char *address, int len); -/*! Get the received ??? (i.e. the one we will send to the far +/*! Get the transmitted IRA (i.e. the one we will send to the far end) associated with a T.30 context. - \brief Get the received ??? associated with a T.30 context. + \brief Get the received IRA associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. \return The length of the address. */ SPAN_DECLARE(size_t) t30_get_tx_ira(t30_state_t *s, int *type, const char *address[]); -/*! Get the received ??? (i.e. the one we will send to the far - end) associated with a T.30 context. - \brief Get the received ??? associated with a T.30 context. +/*! Get the received IRA associated with a T.30 context. + \brief Get the received IRA associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. \return The length of the address. */ SPAN_DECLARE(size_t) t30_get_rx_ira(t30_state_t *s, int *type, const char *address[]); -/*! Set the transmitted ??? (i.e. the one we will send to the far +/*! Set the transmitted CIA (i.e. the one we will send to the far end) associated with a T.30 context. - \brief Set the transmitted ??? associated with a T.30 context. + \brief Set the transmitted CIA associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. @@ -293,27 +289,26 @@ SPAN_DECLARE(size_t) t30_get_rx_ira(t30_state_t *s, int *type, const char *addre \return 0 for OK, else -1. */ SPAN_DECLARE(int) t30_set_tx_cia(t30_state_t *s, int type, const char *address, int len); -/*! Get the received ??? (i.e. the one we will send to the far +/*! Get the transmitted CIA (i.e. the one we will send to the far end) associated with a T.30 context. - \brief Get the received ??? associated with a T.30 context. + \brief Get the received CIA associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. \return The length of the address. */ SPAN_DECLARE(size_t) t30_get_tx_cia(t30_state_t *s, int *type, const char *address[]); -/*! Get the received ??? (i.e. the one we will send to the far - end) associated with a T.30 context. - \brief Get the received ??? associated with a T.30 context. +/*! Get the received CIA associated with a T.30 context. + \brief Get the received CIA associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. \return 0 for OK, else -1. */ SPAN_DECLARE(size_t) t30_get_rx_cia(t30_state_t *s, int *type, const char *address[]); -/*! Set the transmitted ??? (i.e. the one we will send to the far +/*! Set the transmitted ISP (i.e. the one we will send to the far end) associated with a T.30 context. - \brief Set the transmitted ??? associated with a T.30 context. + \brief Set the transmitted ISP associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. @@ -321,27 +316,26 @@ SPAN_DECLARE(size_t) t30_get_rx_cia(t30_state_t *s, int *type, const char *addre \return 0 for OK, else -1. */ SPAN_DECLARE(int) t30_set_tx_isp(t30_state_t *s, int type, const char *address, int len); -/*! Get the received ??? (i.e. the one we will send to the far +/*! Get the transmitted ISP (i.e. the one we will send to the far end) associated with a T.30 context. - \brief Get the received ??? associated with a T.30 context. + \brief Get the received ISP associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. \return 0 for OK, else -1. */ SPAN_DECLARE(size_t) t30_get_tx_isp(t30_state_t *s, int *type, const char *address[]); -/*! Get the received ??? (i.e. the one we will send to the far - end) associated with a T.30 context. - \brief Get the received ??? associated with a T.30 context. +/*! Get the received ISP associated with a T.30 context. + \brief Get the received ISP associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. \return 0 for OK, else -1. */ SPAN_DECLARE(size_t) t30_get_rx_isp(t30_state_t *s, int *type, const char *address[]); -/*! Set the transmitted ??? (i.e. the one we will send to the far +/*! Set the transmitted CSA (i.e. the one we will send to the far end) associated with a T.30 context. - \brief Set the transmitted ??? associated with a T.30 context. + \brief Set the transmitted CSA associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. @@ -349,24 +343,29 @@ SPAN_DECLARE(size_t) t30_get_rx_isp(t30_state_t *s, int *type, const char *addre \return 0 for OK, else -1. */ SPAN_DECLARE(int) t30_set_tx_csa(t30_state_t *s, int type, const char *address, int len); -/*! Get the received ??? (i.e. the one we will send to the far +/*! Get the transmitted CSA (i.e. the one we will send to the far end) associated with a T.30 context. - \brief Get the received ??? associated with a T.30 context. + \brief Get the received CSA associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. \return The length of the address. */ SPAN_DECLARE(size_t) t30_get_tx_csa(t30_state_t *s, int *type, const char *address[]); -/*! Get the received ??? (i.e. the one we will send to the far - end) associated with a T.30 context. - \brief Get the received ??? associated with a T.30 context. +/*! Get the received CSA associated with a T.30 context. + \brief Get the received CSA associated with a T.30 context. \param s The T.30 context. \param type The type of address. \param address A pointer to the address. \return 0 for OK, else -1. */ SPAN_DECLARE(size_t) t30_get_rx_csa(t30_state_t *s, int *type, const char *address[]); +/*! Set page header extends or overlays the image mode. + \brief Set page header overlay mode. + \param s The T.30 context. + \param header_overlays_image TRUE for overlay, or FALSE for extend the page. */ +SPAN_DECLARE(int) t30_set_tx_page_header_overlays_image(t30_state_t *s, int header_overlays_image); + /*! Set the transmitted header information associated with a T.30 context. \brief Set the transmitted header information associated with a T.30 context. \param s The T.30 context. @@ -374,6 +373,13 @@ SPAN_DECLARE(size_t) t30_get_rx_csa(t30_state_t *s, int *type, const char *addre \return 0 for OK, else -1. */ SPAN_DECLARE(int) t30_set_tx_page_header_info(t30_state_t *s, const char *info); +/*! Set the transmitted header timestamp timezone associated with a T.30 context. + \brief Set the transmitted header timestamp timezone associated with a T.30 context. + \param s The T.30 context. + \param info A pointer to the POSIZ timezone string. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t30_set_tx_page_header_tz(t30_state_t *s, const char *tzstring); + /*! Get the header information associated with a T.30 context. \brief Get the header information associated with a T.30 context. \param s The T.30 context. diff --git a/libs/spandsp/src/spandsp/t30_fcf.h b/libs/spandsp/src/spandsp/t30_fcf.h index a303fb4f93..7414497247 100644 --- a/libs/spandsp/src/spandsp/t30_fcf.h +++ b/libs/spandsp/src/spandsp/t30_fcf.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t30_fcf.h,v 1.18 2009/10/08 15:14:31 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/t30_logging.h b/libs/spandsp/src/spandsp/t30_logging.h index cd68fdca97..2dc9bb321c 100644 --- a/libs/spandsp/src/spandsp/t30_logging.h +++ b/libs/spandsp/src/spandsp/t30_logging.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t30_logging.h,v 1.4 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/t31.h b/libs/spandsp/src/spandsp/t31.h index ffb47a98df..25f826d42c 100644 --- a/libs/spandsp/src/spandsp/t31.h +++ b/libs/spandsp/src/spandsp/t31.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t31.h,v 1.59 2009/03/13 12:59:26 steveu Exp $ */ /*! \file */ @@ -67,7 +65,7 @@ SPAN_DECLARE(int) t31_at_rx(t31_state_t *s, const char *t, int len); \param amp The audio sample buffer. \param len The number of samples in the buffer. \return The number of samples unprocessed. */ -SPAN_DECLARE(int) t31_rx(t31_state_t *s, int16_t amp[], int len); +SPAN_DECLARE_NONSTD(int) t31_rx(t31_state_t *s, int16_t amp[], int len); /*! Fake processing of a missing block of received T.31 modem audio samples (e.g due to packet loss). @@ -75,7 +73,7 @@ SPAN_DECLARE(int) t31_rx(t31_state_t *s, int16_t amp[], int len); \param s The T.31 modem context. \param len The number of samples to fake. \return The number of samples unprocessed. */ -SPAN_DECLARE(int) t31_rx_fillin(t31_state_t *s, int len); +SPAN_DECLARE_NONSTD(int) t31_rx_fillin(t31_state_t *s, int len); /*! Generate a block of T.31 modem audio samples. \brief Generate a block of T.31 modem audio samples. @@ -84,7 +82,7 @@ SPAN_DECLARE(int) t31_rx_fillin(t31_state_t *s, int len); \param max_len The number of samples to be generated. \return The number of samples actually generated. */ -SPAN_DECLARE(int) t31_tx(t31_state_t *s, int16_t amp[], int max_len); +SPAN_DECLARE_NONSTD(int) t31_tx(t31_state_t *s, int16_t amp[], int max_len); SPAN_DECLARE(int) t31_t38_send_timeout(t31_state_t *s, int samples); diff --git a/libs/spandsp/src/spandsp/t35.h b/libs/spandsp/src/spandsp/t35.h index bdfbe0bc6a..553b6212e0 100644 --- a/libs/spandsp/src/spandsp/t35.h +++ b/libs/spandsp/src/spandsp/t35.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t35.h,v 1.15 2009/01/31 08:48:11 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/t38_core.h b/libs/spandsp/src/spandsp/t38_core.h index f6b0b12ea0..1476969eeb 100644 --- a/libs/spandsp/src/spandsp/t38_core.h +++ b/libs/spandsp/src/spandsp/t38_core.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t38_core.h,v 1.39 2009/07/14 13:54:22 steveu Exp $ */ /*! \file */ @@ -253,10 +251,16 @@ SPAN_DECLARE(int) t38_core_send_indicator(t38_core_state_t *s, int indicator); /*! \brief Find the delay to allow for HDLC flags after sending an indicator \param s The T.38 context. - \param indicator The indicator to send. + \param indicator The indicator to check. \return The delay to allow for initial HDLC flags after this indicator is sent. */ SPAN_DECLARE(int) t38_core_send_flags_delay(t38_core_state_t *s, int indicator); +/*! \brief Find the delay to allow for modem training after sending an indicator + \param s The T.38 context. + \param indicator The indicator to check. + \return The delay to allow for modem training after this indicator is sent. */ +SPAN_DECLARE(int) t38_core_send_training_delay(t38_core_state_t *s, int indicator); + /*! \brief Send a data packet \param s The T.38 context. \param data_type The packet's data type. @@ -282,7 +286,7 @@ SPAN_DECLARE(int) t38_core_send_data_multi_field(t38_core_state_t *s, int data_t \param len The length of the packet contents. \param seq_no The packet sequence number. \return 0 for OK, else -1. */ -SPAN_DECLARE_NONSTD(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no); +SPAN_DECLARE(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no); /*! Set the method to be used for data rate management, as per the T.38 spec. \param s The T.38 context. @@ -365,6 +369,12 @@ SPAN_DECLARE(void) t38_set_tep_handling(t38_core_state_t *s, int allow_for_tep); */ SPAN_DECLARE(logging_state_t *) t38_core_get_logging_state(t38_core_state_t *s); +/*! Restart a T.38 core context. + \brief Restart a T.38 core context. + \param s The T.38 context. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t38_core_restart(t38_core_state_t *s); + /*! Initialise a T.38 core context. \brief Initialise a T.38 core context. \param s The T.38 context. diff --git a/libs/spandsp/src/spandsp/t38_gateway.h b/libs/spandsp/src/spandsp/t38_gateway.h index b2a1c1f6e9..fa6db4bec5 100644 --- a/libs/spandsp/src/spandsp/t38_gateway.h +++ b/libs/spandsp/src/spandsp/t38_gateway.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t38_gateway.h,v 1.63 2009/04/12 09:12:10 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h b/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h index 8ffffde18b..744643aa40 100644 --- a/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h +++ b/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t38_non_ecm_buffer.h,v 1.7.4.1 2009/12/19 06:43:28 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/t38_terminal.h b/libs/spandsp/src/spandsp/t38_terminal.h index 4bcb1e0d28..c751b477da 100644 --- a/libs/spandsp/src/spandsp/t38_terminal.h +++ b/libs/spandsp/src/spandsp/t38_terminal.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t38_terminal.h,v 1.41 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -39,6 +37,19 @@ /* Make sure the HDLC frame buffers are big enough for ECM frames. */ #define T38_MAX_HDLC_LEN 260 +enum +{ + /*! This option enables the continuous streaming of FAX data, with no allowance for + FAX machine speeds. This is usually used with TCP/TPKT transmission of T.38 FAXes */ + T38_TERMINAL_OPTION_NO_PACING = 0x01, + /*! This option enables the regular repeat transmission of indicator signals, + during periods when no FAX signal transmission occurs. */ + T38_TERMINAL_OPTION_REGULAR_INDICATORS = 0x02, + /*! This option enables the regular repeat transmission of indicator signals for the + first 2s, during periods when no FAX signal transmission occurs. */ + T38_TERMINAL_OPTION_2S_REPEATING_INDICATORS = 0x04 +}; + typedef struct t38_terminal_state_s t38_terminal_state_t; #if defined(__cplusplus) @@ -48,7 +59,12 @@ extern "C" SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples); -SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int without_pacing); +/*! Set configuration options. + \brief Set configuration options. + \param s The T.38 context. + \param config A combinations of T38_TERMINAL_OPTION_* bits. +*/ +SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int config); /*! Select whether the time for talker echo protection tone will be allowed for when sending. \brief Select whether TEP time will be allowed for. @@ -87,6 +103,14 @@ SPAN_DECLARE(t38_core_state_t *) t38_terminal_get_t38_core_state(t38_terminal_st */ SPAN_DECLARE(logging_state_t *) t38_terminal_get_logging_state(t38_terminal_state_t *s); +/*! \brief Reinitialise a termination mode T.38 context. + \param s The T.38 context. + \param calling_party TRUE if the context is for a calling party. FALSE if the + context is for an answering party. + \return 0 for OK, else -1. */ +SPAN_DECLARE(int) t38_terminal_restart(t38_terminal_state_t *s, + int calling_party); + /*! \brief Initialise a termination mode T.38 context. \param s The T.38 context. \param calling_party TRUE if the context is for a calling party. FALSE if the diff --git a/libs/spandsp/src/spandsp/t4_rx.h b/libs/spandsp/src/spandsp/t4_rx.h index 1cc8873251..b1b0a96e18 100644 --- a/libs/spandsp/src/spandsp/t4_rx.h +++ b/libs/spandsp/src/spandsp/t4_rx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t4_rx.h,v 1.3.2.3 2009/12/21 17:18:40 steveu Exp $ */ /*! \file */ @@ -54,16 +52,18 @@ typedef enum T4_COMPRESSION_ITU_T4_2D = 2, /*! T.6 2D compression */ T4_COMPRESSION_ITU_T6 = 3, - /*! T.85 monochrome JBIG coding */ + /*! T.85 monochrome JBIG coding with L0 fixed. */ T4_COMPRESSION_ITU_T85 = 4, + /*! T.85 monochrome JBIG coding with L0 variable. */ + T4_COMPRESSION_ITU_T85_L0 = 5, /*! T.43 colour JBIG coding */ - T4_COMPRESSION_ITU_T43 = 5, + T4_COMPRESSION_ITU_T43 = 6, /*! T.45 run length colour compression */ - T4_COMPRESSION_ITU_T45 = 6, + T4_COMPRESSION_ITU_T45 = 7, /*! T.81 + T.30 Annex E colour JPEG coding */ - T4_COMPRESSION_ITU_T81 = 7, + T4_COMPRESSION_ITU_T81 = 8, /*! T.81 + T.30 Annex K colour sYCC-JPEG coding */ - T4_COMPRESSION_ITU_SYCC_T81 = 8 + T4_COMPRESSION_ITU_SYCC_T81 = 9 } t4_image_compression_t; /*! Supported X resolutions, in pixels per metre. */ @@ -328,7 +328,7 @@ SPAN_DECLARE(void) t4_rx_set_model(t4_state_t *s, const char *model); \brief Get the current transfer statistics. \param s The T.4 context. \param t A pointer to a statistics structure. */ -SPAN_DECLARE(void) t4_get_transfer_statistics(t4_state_t *s, t4_stats_t *t); +SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_state_t *s, t4_stats_t *t); /*! Get the short text name of an encoding format. \brief Get the short text name of an encoding format. diff --git a/libs/spandsp/src/spandsp/t4_tx.h b/libs/spandsp/src/spandsp/t4_tx.h index c30386c03d..0d32297ef3 100644 --- a/libs/spandsp/src/spandsp/t4_tx.h +++ b/libs/spandsp/src/spandsp/t4_tx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t4_tx.h,v 1.2.2.3 2009/12/21 17:18:40 steveu Exp $ */ /*! \file */ @@ -123,7 +121,7 @@ SPAN_DECLARE(void) t4_tx_set_tx_encoding(t4_state_t *s, int encoding); time specified by a remote receiving machine. \param s The T.4 context. \param bits The minimum number of bits per row. */ -SPAN_DECLARE(void) t4_tx_set_min_row_bits(t4_state_t *s, int bits); +SPAN_DECLARE(void) t4_tx_set_min_bits_per_row(t4_state_t *s, int bits); /*! \brief Set the identity of the local machine, for inclusion in page headers. \param s The T.4 context. @@ -139,6 +137,13 @@ SPAN_DECLARE(void) t4_tx_set_local_ident(t4_state_t *s, const char *ident); \param info A string, of up to 50 bytes, which will form the info field. */ SPAN_DECLARE(void) t4_tx_set_header_info(t4_state_t *s, const char *info); +/*! Set the time zone for the time stamp in page header lines. If this function is not used + the current time zone of the program's environment is used. + \brief Set the header timezone. + \param s The T.4 context. + \param info A POSIX timezone description string. */ +SPAN_DECLARE(void) t4_tx_set_header_tz(t4_state_t *s, const char *tzstring); + /*! \brief Set the row read handler for a T.4 transmit context. \param s The T.4 transmit context. \param handler A pointer to the handler routine. @@ -171,6 +176,12 @@ SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_state_t *s); \return The page number, or -1 if there is an error. */ SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_state_t *s); +/*! Get the current image transfer statistics. + \brief Get the current transfer statistics. + \param s The T.4 context. + \param t A pointer to a statistics structure. */ +SPAN_DECLARE(void) t4_tx_get_transfer_statistics(t4_state_t *s, t4_stats_t *t); + #if defined(__cplusplus) } #endif diff --git a/libs/spandsp/src/spandsp/telephony.h b/libs/spandsp/src/spandsp/telephony.h index 703c0bd966..f6998e09f5 100644 --- a/libs/spandsp/src/spandsp/telephony.h +++ b/libs/spandsp/src/spandsp/telephony.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: telephony.h,v 1.18.4.2 2009/12/21 18:38:06 steveu Exp $ */ #if !defined(_SPANDSP_TELEPHONY_H_) diff --git a/libs/spandsp/src/spandsp/time_scale.h b/libs/spandsp/src/spandsp/time_scale.h index 7b7a60eda7..666cca7a78 100644 --- a/libs/spandsp/src/spandsp/time_scale.h +++ b/libs/spandsp/src/spandsp/time_scale.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: time_scale.h,v 1.20 2009/02/10 13:06:47 steveu Exp $ */ #if !defined(_SPANDSP_TIME_SCALE_H_) diff --git a/libs/spandsp/src/spandsp/timing.h b/libs/spandsp/src/spandsp/timing.h index 85f3ce5f43..01e7c99146 100644 --- a/libs/spandsp/src/spandsp/timing.h +++ b/libs/spandsp/src/spandsp/timing.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: timing.h,v 1.14 2009/09/04 14:38:47 steveu Exp $ */ #if !defined(_SPANDSP_TIMING_H_) diff --git a/libs/spandsp/src/spandsp/tone_detect.h b/libs/spandsp/src/spandsp/tone_detect.h index 6822fff676..bf779ca41e 100644 --- a/libs/spandsp/src/spandsp/tone_detect.h +++ b/libs/spandsp/src/spandsp/tone_detect.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: tone_detect.h,v 1.45 2009/02/10 13:06:47 steveu Exp $ */ #if !defined(_SPANDSP_TONE_DETECT_H_) diff --git a/libs/spandsp/src/spandsp/tone_generate.h b/libs/spandsp/src/spandsp/tone_generate.h index 4cd7ff93a0..545335af51 100644 --- a/libs/spandsp/src/spandsp/tone_generate.h +++ b/libs/spandsp/src/spandsp/tone_generate.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: tone_generate.h,v 1.40 2010/05/22 13:20:18 steveu Exp $ */ /*! \file */ @@ -88,6 +86,9 @@ SPAN_DECLARE(tone_gen_descriptor_t *) tone_gen_descriptor_init(tone_gen_descript int d4, int repeat); +/* For backwards compatibility */ +#define make_tone_gen_descriptor tone_gen_descriptor_init + SPAN_DECLARE(void) tone_gen_descriptor_free(tone_gen_descriptor_t *s); SPAN_DECLARE_NONSTD(int) tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples); diff --git a/libs/spandsp/src/spandsp/v17rx.h b/libs/spandsp/src/spandsp/v17rx.h index da4514d316..164fa25232 100644 --- a/libs/spandsp/src/spandsp/v17rx.h +++ b/libs/spandsp/src/spandsp/v17rx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v17rx.h,v 1.65 2009/07/09 13:52:09 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/v17tx.h b/libs/spandsp/src/spandsp/v17tx.h index 01b0f82056..e288817e7a 100644 --- a/libs/spandsp/src/spandsp/v17tx.h +++ b/libs/spandsp/src/spandsp/v17tx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v17tx.h,v 1.43.4.1 2009/12/24 16:52:30 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/v18.h b/libs/spandsp/src/spandsp/v18.h index 7e964cdba6..53da9d099f 100644 --- a/libs/spandsp/src/spandsp/v18.h +++ b/libs/spandsp/src/spandsp/v18.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v18.h,v 1.6 2009/11/04 15:52:06 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/v22bis.h b/libs/spandsp/src/spandsp/v22bis.h index aa2a50a05d..5bdc1791a3 100644 --- a/libs/spandsp/src/spandsp/v22bis.h +++ b/libs/spandsp/src/spandsp/v22bis.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v22bis.h,v 1.46 2009/11/04 15:52:06 steveu Exp $ */ /*! \file */ @@ -84,7 +82,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l \param s The modem context. \param len The number of samples to fake. \return The number of samples unprocessed. */ -SPAN_DECLARE(int) v22bis_rx_fillin(v22bis_state_t *s, int len); +SPAN_DECLARE_NONSTD(int) v22bis_rx_fillin(v22bis_state_t *s, int len); /*! Get a snapshot of the current equalizer coefficients. \brief Get a snapshot of the current equalizer coefficients. @@ -156,7 +154,7 @@ SPAN_DECLARE(int) v22bis_remote_loopback(v22bis_state_t *s, int enable); /*! Report the current operating bit rate of a V.22bis modem context. \brief Report the current operating bit rate of a V.22bis modem context \param s The modem context. */ -SPAN_DECLARE(int) v22bis_current_bit_rate(v22bis_state_t *s); +SPAN_DECLARE(int) v22bis_get_current_bit_rate(v22bis_state_t *s); /*! Initialise a V.22bis modem context. This must be called before the first use of the context, to initialise its contents. diff --git a/libs/spandsp/src/spandsp/v27ter_rx.h b/libs/spandsp/src/spandsp/v27ter_rx.h index bf365df9a1..baa04b54fe 100644 --- a/libs/spandsp/src/spandsp/v27ter_rx.h +++ b/libs/spandsp/src/spandsp/v27ter_rx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v27ter_rx.h,v 1.61 2009/07/09 13:52:09 steveu Exp $ */ /*! \file */ @@ -122,7 +120,7 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], in \param len The number of samples to fake. \return The number of samples unprocessed. */ -SPAN_DECLARE(int) v27ter_rx_fillin(v27ter_rx_state_t *s, int len); +SPAN_DECLARE_NONSTD(int) v27ter_rx_fillin(v27ter_rx_state_t *s, int len); /*! Get a snapshot of the current equalizer coefficients. \brief Get a snapshot of the current equalizer coefficients. diff --git a/libs/spandsp/src/spandsp/v27ter_tx.h b/libs/spandsp/src/spandsp/v27ter_tx.h index 0d332e3470..ce5f440272 100644 --- a/libs/spandsp/src/spandsp/v27ter_tx.h +++ b/libs/spandsp/src/spandsp/v27ter_tx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v27ter_tx.h,v 1.43 2009/07/09 13:52:09 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/v29rx.h b/libs/spandsp/src/spandsp/v29rx.h index 7ee67b763c..dc8c7b4367 100644 --- a/libs/spandsp/src/spandsp/v29rx.h +++ b/libs/spandsp/src/spandsp/v29rx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v29rx.h,v 1.72 2009/07/09 13:52:09 steveu Exp $ */ /*! \file */ @@ -196,7 +194,7 @@ SPAN_DECLARE_NONSTD(int) v29_rx(v29_rx_state_t *s, const int16_t amp[], int len) \param s The modem context. \param len The number of samples to fake. \return The number of samples unprocessed. */ -SPAN_DECLARE(int) v29_rx_fillin(v29_rx_state_t *s, int len); +SPAN_DECLARE_NONSTD(int) v29_rx_fillin(v29_rx_state_t *s, int len); /*! Get a snapshot of the current equalizer coefficients. \brief Get a snapshot of the current equalizer coefficients. diff --git a/libs/spandsp/src/spandsp/v29tx.h b/libs/spandsp/src/spandsp/v29tx.h index 522eee7e40..8a765445c2 100644 --- a/libs/spandsp/src/spandsp/v29tx.h +++ b/libs/spandsp/src/spandsp/v29tx.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v29tx.h,v 1.41 2009/07/09 13:52:09 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/v42.h b/libs/spandsp/src/spandsp/v42.h index bba70af5be..22d6122b60 100644 --- a/libs/spandsp/src/spandsp/v42.h +++ b/libs/spandsp/src/spandsp/v42.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v42.h,v 1.31 2009/11/04 15:52:06 steveu Exp $ */ /*! \page v42_page V.42 modem error correction diff --git a/libs/spandsp/src/spandsp/v42bis.h b/libs/spandsp/src/spandsp/v42bis.h index f13e5c5acb..35d5be3f42 100644 --- a/libs/spandsp/src/spandsp/v42bis.h +++ b/libs/spandsp/src/spandsp/v42bis.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v42bis.h,v 1.27 2009/04/11 18:11:19 steveu Exp $ */ /*! \page v42bis_page V.42bis modem data compression @@ -36,10 +34,12 @@ conjunction with the error correction scheme defined in V.42. #if !defined(_SPANDSP_V42BIS_H_) #define _SPANDSP_V42BIS_H_ -#define V42BIS_MAX_BITS 12 -#define V42BIS_MAX_CODEWORDS 4096 /* 2^V42BIS_MAX_BITS */ -#define V42BIS_TABLE_SIZE 5021 /* This should be a prime >(2^V42BIS_MAX_BITS) */ -#define V42BIS_MAX_STRING_SIZE 250 +#define V42BIS_MIN_STRING_SIZE 6 +#define V42BIS_MAX_STRING_SIZE 250 +#define V42BIS_MIN_DICTIONARY_SIZE 512 +#define V42BIS_MAX_BITS 12 +#define V42BIS_MAX_CODEWORDS 4096 /* 2^V42BIS_MAX_BITS */ +#define V42BIS_TABLE_SIZE 5021 /* This should be a prime >(2^V42BIS_MAX_BITS) */ enum { diff --git a/libs/spandsp/src/spandsp/v8.h b/libs/spandsp/src/spandsp/v8.h index a8bd2e4d40..25449fb6c1 100644 --- a/libs/spandsp/src/spandsp/v8.h +++ b/libs/spandsp/src/spandsp/v8.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v8.h,v 1.31.4.1 2009/12/28 12:20:47 steveu Exp $ */ /*! \file */ @@ -64,19 +62,17 @@ enum v8_modulation_e V8_MOD_V17 = (1 << 0), /* V.17 half-duplex */ V8_MOD_V21 = (1 << 1), /* V.21 duplex */ V8_MOD_V22 = (1 << 2), /* V.22/V22.bis duplex */ - V8_MOD_V23HALF = (1 << 3), /* V.23 half-duplex */ + V8_MOD_V23HDX = (1 << 3), /* V.23 half-duplex */ V8_MOD_V23 = (1 << 4), /* V.23 duplex */ V8_MOD_V26BIS = (1 << 5), /* V.23 duplex */ V8_MOD_V26TER = (1 << 6), /* V.23 duplex */ V8_MOD_V27TER = (1 << 7), /* V.23 duplex */ V8_MOD_V29 = (1 << 8), /* V.29 half-duplex */ V8_MOD_V32 = (1 << 9), /* V.32/V32.bis duplex */ - V8_MOD_V34HALF = (1 << 10), /* V.34 half-duplex */ + V8_MOD_V34HDX = (1 << 10), /* V.34 half-duplex */ V8_MOD_V34 = (1 << 11), /* V.34 duplex */ V8_MOD_V90 = (1 << 12), /* V.90 duplex */ - V8_MOD_V92 = (1 << 13), /* V.92 duplex */ - - V8_MOD_FAILED = (1 << 15) /* Indicates failure to negotiate */ + V8_MOD_V92 = (1 << 13) /* V.92 duplex */ }; enum v8_protocol_e @@ -100,10 +96,27 @@ enum v8_pcm_modem_availability_e V8_PSTN_PCM_MODEM_V91 = 0x04 }; +enum v8_status_e +{ + /*! V.8 negotiation is in progress. */ + V8_STATUS_IN_PROGRESS = 0, + /*! V.8 has been offered by the other (calling) party. */ + V8_STATUS_V8_OFFERED = 1, + /*! V.8 has been successfully negotiated. Note that this only means the V.8 + message exchange has successfully completed. The actual exchanged parameters + must be checked, to see if the call can proceed properly. */ + V8_STATUS_V8_CALL = 2, + /*! A non-V.8 is being received. */ + V8_STATUS_NON_V8_CALL = 3, + /*! V.8 negotiation failed. */ + V8_STATUS_FAILED = 4 +}; + typedef struct v8_state_s v8_state_t; struct v8_parms_s { + int status; int modem_connect_tone; int call_function; unsigned int modulations; diff --git a/libs/spandsp/src/spandsp/vector_float.h b/libs/spandsp/src/spandsp/vector_float.h index d9aa6616a0..97d95f3007 100644 --- a/libs/spandsp/src/spandsp/vector_float.h +++ b/libs/spandsp/src/spandsp/vector_float.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: vector_float.h,v 1.15 2009/01/31 08:48:11 steveu Exp $ */ #if !defined(_SPANDSP_VECTOR_FLOAT_H_) diff --git a/libs/spandsp/src/spandsp/vector_int.h b/libs/spandsp/src/spandsp/vector_int.h index 04a632fe17..c20f02a7d9 100644 --- a/libs/spandsp/src/spandsp/vector_int.h +++ b/libs/spandsp/src/spandsp/vector_int.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: vector_int.h,v 1.14 2009/01/31 08:48:11 steveu Exp $ */ #if !defined(_SPANDSP_VECTOR_INT_H_) diff --git a/libs/spandsp/src/spandsp/version.h b/libs/spandsp/src/spandsp/version.h index 611d321042..a07f2f061d 100644 --- a/libs/spandsp/src/spandsp/version.h +++ b/libs/spandsp/src/spandsp/version.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: version.h.in,v 1.3.4.1 2009/12/19 09:47:56 steveu Exp $ */ #if !defined(_SPANDSP_VERSION_H_) @@ -30,9 +28,9 @@ /* The date and time of the version are in UTC form. */ -#define SPANDSP_RELEASE_DATE 20091228 -#define SPANDSP_RELEASE_TIME 123351 -#define SPANDSP_RELEASE_DATETIME_STRING "20091228 123351" +#define SPANDSP_RELEASE_DATE 20100724 +#define SPANDSP_RELEASE_TIME 163333 +#define SPANDSP_RELEASE_DATETIME_STRING "20100724 163333" #endif /*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/spandsp/version.h.in b/libs/spandsp/src/spandsp/version.h.in index 8a547f1e13..c5d137a01c 100644 --- a/libs/spandsp/src/spandsp/version.h.in +++ b/libs/spandsp/src/spandsp/version.h.in @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: version.h.in,v 1.3.4.1 2009/12/19 09:47:56 steveu Exp $ */ #if !defined(_SPANDSP_VERSION_H_) diff --git a/libs/spandsp/src/super_tone_rx.c b/libs/spandsp/src/super_tone_rx.c index 8822577de6..767a1893ff 100644 --- a/libs/spandsp/src/super_tone_rx.c +++ b/libs/spandsp/src/super_tone_rx.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: super_tone_rx.c,v 1.33.4.1 2009/12/19 09:47:56 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/super_tone_tx.c b/libs/spandsp/src/super_tone_tx.c index 1d1beee280..7725858f5d 100644 --- a/libs/spandsp/src/super_tone_tx.c +++ b/libs/spandsp/src/super_tone_tx.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: super_tone_tx.c,v 1.30 2009/02/10 17:44:18 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/swept_tone.c b/libs/spandsp/src/swept_tone.c index 78555ab8fa..f2b5eb7e24 100644 --- a/libs/spandsp/src/swept_tone.c +++ b/libs/spandsp/src/swept_tone.c @@ -10,19 +10,17 @@ * 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. + * it under the terms of the GNU Lesser General Public License version 2.1, + * 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. + * GNU Lesser 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 + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: swept_tone.c,v 1.2 2009/09/23 16:02:59 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index b89c2e6485..97c7ed8cc7 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t30.c,v 1.305.4.4 2009/12/23 14:23:49 steveu Exp $ */ /*! \file */ @@ -62,6 +60,12 @@ #include "spandsp/v27ter_tx.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/t81_t82_arith_coding.h" +#include "spandsp/t85.h" +#endif +#include "spandsp/t4_t6_decode.h" +#include "spandsp/t4_t6_encode.h" #include "spandsp/t30_fcf.h" #include "spandsp/t35.h" #include "spandsp/t30.h" @@ -69,6 +73,12 @@ #include "spandsp/t30_logging.h" #include "spandsp/private/logging.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/private/t81_t82_arith_coding.h" +#include "spandsp/private/t85.h" +#endif +#include "spandsp/private/t4_t6_decode.h" +#include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" #include "spandsp/private/t30.h" @@ -182,7 +192,7 @@ enum }; /*! These are internal assessments of received image quality, used to determine whether we - continue, retrain, or abandon the call. */ + continue, retrain, or abandon the call. This is only relevant to non-ECM operation. */ enum { T30_COPY_QUALITY_PERFECT = 0, @@ -204,12 +214,14 @@ enum }; /*! There are high level indications of what is happening at any instant, to guide the cleanup - process if the call is abandoned. */ + continue, retrain, or abandoning of the call. */ enum { OPERATION_IN_PROGRESS_NONE = 0, OPERATION_IN_PROGRESS_T4_RX, - OPERATION_IN_PROGRESS_T4_TX + OPERATION_IN_PROGRESS_T4_TX, + OPERATION_IN_PROGRESS_POST_T4_RX, + OPERATION_IN_PROGRESS_POST_T4_TX }; /* All timers specified in milliseconds */ @@ -401,20 +413,21 @@ static int terminate_operation_in_progress(t30_state_t *s) switch (s->operation_in_progress) { case OPERATION_IN_PROGRESS_T4_TX: - t4_tx_release(&s->t4); + t4_tx_release(&s->t4.tx); + s->operation_in_progress = OPERATION_IN_PROGRESS_POST_T4_TX; break; case OPERATION_IN_PROGRESS_T4_RX: - t4_rx_release(&s->t4); + t4_rx_release(&s->t4.rx); + s->operation_in_progress = OPERATION_IN_PROGRESS_POST_T4_RX; break; } - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; return 0; } /*- End of function --------------------------------------------------------*/ static int tx_start_page(t30_state_t *s) { - if (t4_tx_start_page(&s->t4)) + if (t4_tx_start_page(&s->t4.tx)) { terminate_operation_in_progress(s); return -1; @@ -429,7 +442,7 @@ static int tx_start_page(t30_state_t *s) static int tx_end_page(t30_state_t *s) { s->retries = 0; - if (t4_tx_end_page(&s->t4) == 0) + if (t4_tx_end_page(&s->t4.tx) == 0) { s->tx_page_number++; s->ecm_block = 0; @@ -442,20 +455,20 @@ static int rx_start_page(t30_state_t *s) { int i; - t4_rx_set_image_width(&s->t4, s->image_width); - t4_rx_set_sub_address(&s->t4, s->rx_info.sub_address); - t4_rx_set_dcs(&s->t4, s->rx_dcs_string); - t4_rx_set_far_ident(&s->t4, s->rx_info.ident); - t4_rx_set_vendor(&s->t4, s->vendor); - t4_rx_set_model(&s->t4, s->model); + t4_rx_set_image_width(&s->t4.rx, s->image_width); + t4_rx_set_sub_address(&s->t4.rx, s->rx_info.sub_address); + t4_rx_set_dcs(&s->t4.rx, s->rx_dcs_string); + t4_rx_set_far_ident(&s->t4.rx, s->rx_info.ident); + t4_rx_set_vendor(&s->t4.rx, s->vendor); + t4_rx_set_model(&s->t4.rx, s->model); - t4_rx_set_rx_encoding(&s->t4, s->line_encoding); - t4_rx_set_x_resolution(&s->t4, s->x_resolution); - t4_rx_set_y_resolution(&s->t4, s->y_resolution); + t4_rx_set_rx_encoding(&s->t4.rx, s->line_encoding); + t4_rx_set_x_resolution(&s->t4.rx, s->x_resolution); + t4_rx_set_y_resolution(&s->t4.rx, s->y_resolution); - if (t4_rx_start_page(&s->t4)) + if (t4_rx_start_page(&s->t4.rx)) return -1; - /* Clear the buffer */ + /* Clear the ECM buffer */ for (i = 0; i < 256; i++) s->ecm_len[i] = -1; s->ecm_block = 0; @@ -468,7 +481,7 @@ static int rx_start_page(t30_state_t *s) static int rx_end_page(t30_state_t *s) { - if (t4_rx_end_page(&s->t4) == 0) + if (t4_rx_end_page(&s->t4.rx) == 0) { s->rx_page_number++; s->ecm_block = 0; @@ -477,12 +490,27 @@ static int rx_end_page(t30_state_t *s) } /*- End of function --------------------------------------------------------*/ +static void report_rx_ecm_page_result(t30_state_t *s) +{ + t4_stats_t stats; + + /* This is only used for ECM pages, as copy_quality() does a similar job for non-ECM + pages as a byproduct of assessing copy quality. */ + t4_rx_get_transfer_statistics(&s->t4.rx, &stats); + span_log(&s->logging, SPAN_LOG_FLOW, "Page no = %d\n", stats.pages_transferred); + span_log(&s->logging, SPAN_LOG_FLOW, "Image size = %d x %d pixels\n", stats.width, stats.length); + span_log(&s->logging, SPAN_LOG_FLOW, "Image resolution = %d/m x %d/m\n", stats.x_resolution, stats.y_resolution); + span_log(&s->logging, SPAN_LOG_FLOW, "Compression = %s (%d)\n", t4_encoding_to_str(stats.encoding), stats.encoding); + span_log(&s->logging, SPAN_LOG_FLOW, "Compressed image size = %d bytes\n", stats.line_image_size); +} +/*- End of function --------------------------------------------------------*/ + static int copy_quality(t30_state_t *s) { t4_stats_t stats; int quality; - t4_get_transfer_statistics(&s->t4, &stats); + t4_rx_get_transfer_statistics(&s->t4.rx, &stats); /* There is no specification for judging copy quality. However, we need to classify it at three levels, to control what we do next: OK; tolerable, but retrain; intolerable. */ @@ -491,9 +519,13 @@ static int copy_quality(t30_state_t *s) <15% bad rows to be tolerable, but retrain >15% bad rows to be intolerable */ + /* This is called before the page is confirmed, so we need to add one to get the page + number right */ span_log(&s->logging, SPAN_LOG_FLOW, "Page no = %d\n", stats.pages_transferred + 1); span_log(&s->logging, SPAN_LOG_FLOW, "Image size = %d x %d pixels\n", stats.width, stats.length); span_log(&s->logging, SPAN_LOG_FLOW, "Image resolution = %d/m x %d/m\n", stats.x_resolution, stats.y_resolution); + span_log(&s->logging, SPAN_LOG_FLOW, "Compression = %s (%d)\n", t4_encoding_to_str(stats.encoding), stats.encoding); + span_log(&s->logging, SPAN_LOG_FLOW, "Compressed image size = %d bytes\n", stats.line_image_size); span_log(&s->logging, SPAN_LOG_FLOW, "Bad rows = %d\n", stats.bad_rows); span_log(&s->logging, SPAN_LOG_FLOW, "Longest bad row run = %d\n", stats.longest_bad_row_run); /* Don't treat a page as perfect because it has zero bad rows out of zero total rows. A zero row @@ -522,6 +554,22 @@ static int copy_quality(t30_state_t *s) } /*- End of function --------------------------------------------------------*/ +static void report_tx_result(t30_state_t *s, int result) +{ + t4_stats_t stats; + + if (span_log_test(&s->logging, SPAN_LOG_FLOW)) + { + t4_tx_get_transfer_statistics(&s->t4.tx, &stats); + span_log(&s->logging, + SPAN_LOG_FLOW, + "%s - delivered %d pages\n", + (result) ? "Success" : "Failure", + stats.pages_transferred); + } +} +/*- End of function --------------------------------------------------------*/ + static void release_resources(t30_state_t *s) { if (s->tx_info.nsf) @@ -619,7 +667,7 @@ static uint8_t check_next_tx_step(t30_state_t *s) int res; int more; - res = t4_tx_next_page_has_different_format(&s->t4); + res = t4_tx_next_page_has_different_format(&s->t4.tx); if (res == 0) { span_log(&s->logging, SPAN_LOG_FLOW, "More pages to come with the same format\n"); @@ -628,7 +676,7 @@ static uint8_t check_next_tx_step(t30_state_t *s) if (res > 0) { span_log(&s->logging, SPAN_LOG_FLOW, "More pages to come with a different format\n"); - s->tx_start_page = t4_tx_get_current_page_in_file(&s->t4) + 1; + s->tx_start_page = t4_tx_get_current_page_in_file(&s->t4.tx) + 1; return (s->local_interrupt_pending) ? T30_PRI_EOM : T30_EOM; } /* Call a user handler, if one is set, to check if another document is to be sent. @@ -671,7 +719,7 @@ static int get_partial_ecm_page(t30_state_t *s) /* These frames contain a frame sequence number within the partial page (one octet) followed by some image data. */ s->ecm_data[i][3] = (uint8_t) i; - if ((len = t4_tx_get_chunk(&s->t4, &s->ecm_data[i][4], s->octets_per_ecm_frame)) < s->octets_per_ecm_frame) + if ((len = t4_tx_get_chunk(&s->t4.tx, &s->ecm_data[i][4], s->octets_per_ecm_frame)) < s->octets_per_ecm_frame) { /* The image is not big enough to fill the entire buffer */ /* We need to pad to a full frame, as most receivers expect that. */ @@ -690,40 +738,11 @@ static int get_partial_ecm_page(t30_state_t *s) /* We filled the entire buffer */ s->ecm_frames = 256; span_log(&s->logging, SPAN_LOG_FLOW, "Partial page buffer full (%d per frame)\n", s->octets_per_ecm_frame); - s->ecm_at_page_end = ((t4_tx_check_bit(&s->t4) & 2) != 0); + s->ecm_at_page_end = ((t4_tx_check_bit(&s->t4.tx) & 2) != 0); return 256; } /*- End of function --------------------------------------------------------*/ -static int t30_ecm_commit_partial_page(t30_state_t *s) -{ - int i; - int image_ended; - - span_log(&s->logging, SPAN_LOG_FLOW, "Commiting partial page - block %d, %d frames\n", s->ecm_block, s->ecm_frames); - image_ended = FALSE; - for (i = 0; i < s->ecm_frames; i++) - { - if (t4_rx_put_chunk(&s->t4, s->ecm_data[i], s->ecm_len[i])) - { - /* This is the end of the document */ - /* Clear the buffer */ - for (i = 0; i < 256; i++) - s->ecm_len[i] = -1; - s->ecm_frames = -1; - image_ended = TRUE; - break; - } - } - /* Clear the buffer */ - for (i = 0; i < 256; i++) - s->ecm_len[i] = -1; - s->ecm_block++; - s->ecm_frames = -1; - return (image_ended) ? -1 : 0; -} -/*- End of function --------------------------------------------------------*/ - static int send_next_ecm_frame(t30_state_t *s) { int i; @@ -1132,7 +1151,6 @@ int t30_build_dis_or_dtc(t30_state_t *s) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE); if ((s->supported_compressions & T30_SUPPORT_T43_COMPRESSION)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE); -#if 0 if ((s->supported_compressions & T30_SUPPORT_T45_COMPRESSION)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE); if ((s->supported_compressions & T30_SUPPORT_T81_COMPRESSION)) @@ -1140,13 +1158,13 @@ int t30_build_dis_or_dtc(t30_state_t *s) if ((s->supported_compressions & T30_SUPPORT_SYCC_T81_COMPRESSION)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE); if ((s->supported_compressions & T30_SUPPORT_T85_COMPRESSION)) + { set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE); - /* No T.85 optional L0. */ - //if ((s->supported_compressions & T30_SUPPORT_T85_L0_COMPRESSION)) - // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE); + if ((s->supported_compressions & T30_SUPPORT_T85_L0_COMPRESSION)) + set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE); + } //if ((s->supported_compressions & T30_SUPPORT_T89_COMPRESSION)) // set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T89_CAPABLE); -#endif } if ((s->supported_t30_features & T30_SUPPORT_FIELD_NOT_VALID)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FNV_CAPABLE); @@ -1236,7 +1254,7 @@ int t30_build_dis_or_dtc(t30_state_t *s) /* No k > 4 */ if ((s->iaf & T30_IAF_MODE_CONTINUOUS_FLOW)) set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T38_FAX_CAPABLE); - /* No T.89 profile */ + /* No T.88/T.89 profile */ s->local_dis_dtc_len = 19; //t30_decode_dis_dtc_dcs(s, s->local_dis_dtc_frame, s->local_dis_dtc_len); return 0; @@ -1294,13 +1312,16 @@ static int build_dcs(t30_state_t *s) /* Select the compression to use. */ switch (s->line_encoding) { -#if 0 case T4_COMPRESSION_ITU_T85: set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_MODE); - //set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_L0_MODE); + clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_L0_MODE); + set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); + break; + case T4_COMPRESSION_ITU_T85_L0: + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_MODE); + set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_L0_MODE); set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); break; -#endif case T4_COMPRESSION_ITU_T6: set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T6_MODE); set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21); @@ -1605,7 +1626,7 @@ static int step_fallback_entry(t30_state_t *s) current page, though it is benign - fallback will only result in an excessive minimum. */ min_row_bits = set_min_scan_time_code(s); - t4_tx_set_min_row_bits(&s->t4, min_row_bits); + t4_tx_set_min_bits_per_row(&s->t4.tx, min_row_bits); /* We need to rebuild the DCS message we will send. */ build_dcs(s); return s->current_fallback; @@ -1837,16 +1858,7 @@ static void disconnect(t30_state_t *s) span_log(&s->logging, SPAN_LOG_FLOW, "Disconnecting\n"); /* Make sure any FAX in progress is tidied up. If the tidying up has already happened, repeating it here is harmless. */ - switch (s->operation_in_progress) - { - case OPERATION_IN_PROGRESS_T4_TX: - t4_tx_release(&s->t4); - break; - case OPERATION_IN_PROGRESS_T4_RX: - t4_rx_release(&s->t4); - break; - } - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + terminate_operation_in_progress(s); s->timer_t0_t1 = 0; s->timer_t2_t4 = 0; s->timer_t3 = 0; @@ -1920,34 +1932,33 @@ static int start_sending_document(t30_state_t *s) return -1; } span_log(&s->logging, SPAN_LOG_FLOW, "Start sending document\n"); - if (t4_tx_init(&s->t4, s->tx_file, s->tx_start_page, s->tx_stop_page) == NULL) + if (t4_tx_init(&s->t4.tx, s->tx_file, s->tx_start_page, s->tx_stop_page) == NULL) { span_log(&s->logging, SPAN_LOG_WARNING, "Cannot open source TIFF file '%s'\n", s->tx_file); s->current_status = T30_ERR_FILEERROR; return -1; } s->operation_in_progress = OPERATION_IN_PROGRESS_T4_TX; - t4_tx_get_pages_in_file(&s->t4); - t4_tx_set_tx_encoding(&s->t4, s->line_encoding); - t4_tx_set_local_ident(&s->t4, s->tx_info.ident); - t4_tx_set_header_info(&s->t4, s->header_info); + t4_tx_get_pages_in_file(&s->t4.tx); + t4_tx_set_tx_encoding(&s->t4.tx, s->line_encoding); + t4_tx_set_local_ident(&s->t4.tx, s->tx_info.ident); + t4_tx_set_header_info(&s->t4.tx, s->header_info); - s->x_resolution = t4_tx_get_x_resolution(&s->t4); - s->y_resolution = t4_tx_get_y_resolution(&s->t4); + s->x_resolution = t4_tx_get_x_resolution(&s->t4.tx); + s->y_resolution = t4_tx_get_y_resolution(&s->t4.tx); /* The minimum scan time to be used can't be evaluated until we know the Y resolution, and must be evaluated before the minimum scan row bits can be evaluated. */ if ((min_row_bits = set_min_scan_time_code(s)) < 0) { - t4_tx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + terminate_operation_in_progress(s); return -1; } span_log(&s->logging, SPAN_LOG_FLOW, "Minimum bits per row will be %d\n", min_row_bits); - t4_tx_set_min_row_bits(&s->t4, min_row_bits); + t4_tx_set_min_bits_per_row(&s->t4.tx, min_row_bits); if (tx_start_page(s)) return -1; - s->image_width = t4_tx_get_image_width(&s->t4); + s->image_width = t4_tx_get_image_width(&s->t4.tx); if (s->error_correcting_mode) { if (get_partial_ecm_page(s) == 0) @@ -1959,7 +1970,7 @@ static int start_sending_document(t30_state_t *s) static int restart_sending_document(t30_state_t *s) { - t4_tx_restart_page(&s->t4); + t4_tx_restart_page(&s->t4.tx); s->retries = 0; s->ecm_block = 0; send_dcs_sequence(s, TRUE); @@ -2032,19 +2043,34 @@ static int process_rx_dis_dtc(t30_state_t *s, const uint8_t *msg, int len) /* 256 octets per ECM frame */ s->octets_per_ecm_frame = 256; /* Select the compression to use. */ -#if 0 - if (s->error_correcting_mode && (s->supported_compressions & T30_SUPPORT_T85_COMPRESSION) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE)) + if (s->error_correcting_mode + && + (s->supported_compressions & T30_SUPPORT_T85_COMPRESSION) + && + test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE)) { - s->line_encoding = T4_COMPRESSION_ITU_T85; + if (s->supported_compressions & T30_SUPPORT_T85_L0_COMPRESSION + && + test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE)) + { + s->line_encoding = T4_COMPRESSION_ITU_T85_L0; + } + else + { + s->line_encoding = T4_COMPRESSION_ITU_T85; + } } - else if (s->error_correcting_mode && (s->supported_compressions & T30_SUPPORT_T6_COMPRESSION) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE)) -#else - if (s->error_correcting_mode && (s->supported_compressions & T30_SUPPORT_T6_COMPRESSION) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE)) -#endif + else if (s->error_correcting_mode + && + (s->supported_compressions & T30_SUPPORT_T6_COMPRESSION) + && + test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE)) { s->line_encoding = T4_COMPRESSION_ITU_T6; } - else if ((s->supported_compressions & T30_SUPPORT_T4_2D_COMPRESSION) && test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE)) + else if ((s->supported_compressions & T30_SUPPORT_T4_2D_COMPRESSION) + && + test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE)) { s->line_encoding = T4_COMPRESSION_ITU_T4_2D; } @@ -2252,19 +2278,26 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) s->image_width = widths[i][dcs_frame[5] & (DISBIT2 | DISBIT1)]; /* Check which compression we will use. */ -#if 0 if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_MODE)) - s->line_encoding = T4_COMPRESSION_ITU_T85; + { + if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_L0_MODE)) + s->line_encoding = T4_COMPRESSION_ITU_T85_L0; + else + s->line_encoding = T4_COMPRESSION_ITU_T85; + } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T6_MODE)) -#else - if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T6_MODE)) -#endif + { s->line_encoding = T4_COMPRESSION_ITU_T6; + } else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_2D_CODING)) + { s->line_encoding = T4_COMPRESSION_ITU_T4_2D; + } else + { s->line_encoding = T4_COMPRESSION_ITU_T4_1D; - span_log(&s->logging, SPAN_LOG_FLOW, "Selected compression %d\n", s->line_encoding); + } + span_log(&s->logging, SPAN_LOG_FLOW, "Selected compression %s (%d)\n", t4_encoding_to_str(s->line_encoding), s->line_encoding); if (!test_ctrl_bit(dcs_frame, T30_DCS_BIT_RECEIVE_FAX_DOCUMENT)) span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Remote is not requesting receive in DCS\n"); @@ -2300,9 +2333,9 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) send_dcn(s); return -1; } - if (!s->in_message) + if (s->operation_in_progress != OPERATION_IN_PROGRESS_T4_RX) { - if (t4_rx_init(&s->t4, s->rx_file, s->output_encoding) == NULL) + if (t4_rx_init(&s->t4.rx, s->rx_file, s->output_encoding) == NULL) { span_log(&s->logging, SPAN_LOG_WARNING, "Cannot open target TIFF file '%s'\n", s->rx_file); s->current_status = T30_ERR_FILEERROR; @@ -2323,27 +2356,11 @@ static int process_rx_dcs(t30_state_t *s, const uint8_t *msg, int len) } /*- End of function --------------------------------------------------------*/ -static int send_deferred_pps_response(t30_state_t *s) +static int send_response_to_pps(t30_state_t *s) { queue_phase(s, T30_PHASE_D_TX); - if (s->ecm_first_bad_frame >= s->ecm_frames) + if (s->rx_ecm_block_ok) { - /* Everything was OK. We can accept the data and move on. */ - t30_ecm_commit_partial_page(s); - switch (s->last_pps_fcf2) - { - case T30_NULL: - /* We can confirm this partial page. */ - break; - default: - /* We can confirm the whole page. */ - s->next_rx_step = s->last_pps_fcf2; - rx_end_page(s); - if (s->phase_d_handler) - s->phase_d_handler(s, s->phase_d_user_data, s->last_pps_fcf2); - rx_start_page(s); - break; - } set_state(s, T30_STATE_F_POST_RCP_MCF); send_simple_frame(s, T30_MCF); } @@ -2368,6 +2385,8 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len) int i; int j; int frame_no; + int first_bad_frame; + int image_ended; if (len < 7) { @@ -2375,8 +2394,6 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len) return -1; } s->last_pps_fcf2 = msg[3] & 0xFE; - page = msg[4]; - block = msg[5]; /* The frames count is not well specified in T.30. In practice it seems it might be the number of frames in the current block, or it might be the number of frames in the @@ -2384,6 +2401,9 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len) than the actual size of the block. If we only accept the number when it exceeds previous values, we should get the real number of frames in the block. */ frames = msg[6] + 1; + block = msg[5]; + page = msg[4]; + if (s->ecm_frames < 0) { /* First time. Take the number and believe in it. */ @@ -2401,17 +2421,54 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len) frames = 0; } } - span_log(&s->logging, SPAN_LOG_FLOW, "Received PPS + %s - page %d, block %d, %d frames\n", t30_frametype(msg[3]), page, block, frames); - if (page != s->rx_page_number) + span_log(&s->logging, + SPAN_LOG_FLOW, + "Received PPS + %s - page %d, block %d, %d frames\n", + t30_frametype(msg[3]), + page, + block, + frames); + /* Check that we have received the page and block we expected. If the far end missed + our last response, it might have repeated the previous chunk. */ + if ((s->rx_page_number & 0xFF) != page || (s->ecm_block & 0xFF) != block) { - span_log(&s->logging, SPAN_LOG_FLOW, "ECM rx page mismatch - expected %d, but received %d.\n", s->rx_page_number, page); - } - if (block != s->ecm_block) - { - span_log(&s->logging, SPAN_LOG_FLOW, "ECM rx block mismatch - expected %d, but received %d.\n", s->ecm_block, block); + span_log(&s->logging, + SPAN_LOG_FLOW, + "ECM rx page/block mismatch - expected %d/%d, but received %d/%d.\n", + (s->rx_page_number & 0xFF), + (s->ecm_block & 0xFF), + page, + block); + /* Look for this being a repeat, because the other end missed the last response + we sent - which would have been a T30_MCF - If the block is for the previous + page, or the previous block of the current page, we can assume we have hit this + condition. */ + if (((s->rx_page_number & 0xFF) == page && (s->ecm_block & 0xFF) == block) + || + (((s->rx_page_number - 1) & 0xFF) == page && s->ecm_block == 0)) + { + /* This must be a repeat of the last thing the far end sent, while we are expecting + the first transfer of a new block. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Looks like a repeat from the previous page/block - send MCF again.\n"); + /* Clear the ECM buffer */ + for (i = 0; i < 256; i++) + s->ecm_len[i] = -1; + s->ecm_frames = -1; + queue_phase(s, T30_PHASE_D_TX); + set_state(s, T30_STATE_F_POST_RCP_MCF); + send_simple_frame(s, T30_MCF); + } + else + { + /* Give up */ + s->current_status = T30_ERR_RX_ECMPHD; + send_dcn(s); + } + return 0; } + /* Build a bit map of which frames we now have stored OK */ - s->ecm_first_bad_frame = 256; + first_bad_frame = 256; for (i = 0; i < 32; i++) { s->ecm_frame_map[i + 3] = 0; @@ -2421,14 +2478,50 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len) if (s->ecm_len[frame_no] < 0) { s->ecm_frame_map[i + 3] |= (1 << j); - if (frame_no < s->ecm_first_bad_frame) - s->ecm_first_bad_frame = frame_no; + if (frame_no < first_bad_frame) + first_bad_frame = frame_no; if (frame_no < s->ecm_frames) s->error_correcting_mode_retries++; } } } - /* Are there any bad frames, or does our scan represent things being OK? */ + s->rx_ecm_block_ok = (first_bad_frame >= s->ecm_frames); + if (s->rx_ecm_block_ok) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Partial page OK - committing block %d, %d frames\n", s->ecm_block, s->ecm_frames); + image_ended = FALSE; + for (i = 0; i < s->ecm_frames; i++) + { + if (t4_rx_put_chunk(&s->t4.rx, s->ecm_data[i], s->ecm_len[i])) + { + /* This is the end of the document */ + image_ended = TRUE; + break; + } + } + /* Clear the ECM buffer */ + for (i = 0; i < 256; i++) + s->ecm_len[i] = -1; + s->ecm_block++; + s->ecm_frames = -1; + + switch (s->last_pps_fcf2) + { + case T30_NULL: + /* We can accept only this partial page. */ + break; + default: + /* We can accept and confirm the whole page. */ + s->next_rx_step = s->last_pps_fcf2; + rx_end_page(s); + report_rx_ecm_page_result(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, s->last_pps_fcf2); + rx_start_page(s); + break; + } + } + switch (s->last_pps_fcf2) { case T30_NULL: @@ -2448,7 +2541,7 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len) } else { - send_deferred_pps_response(s); + send_response_to_pps(s); } break; default: @@ -3056,8 +3149,6 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg, switch (fcf) { case T30_MPS: - if (s->phase_d_handler) - s->phase_d_handler(s, s->phase_d_user_data, fcf); s->next_rx_step = fcf; queue_phase(s, T30_PHASE_D_TX); switch (copy_quality(s)) @@ -3065,17 +3156,23 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg, case T30_COPY_QUALITY_PERFECT: case T30_COPY_QUALITY_GOOD: rx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); rx_start_page(s); set_state(s, T30_STATE_III_Q_MCF); send_simple_frame(s, T30_MCF); break; case T30_COPY_QUALITY_POOR: rx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); rx_start_page(s); set_state(s, T30_STATE_III_Q_RTP); send_simple_frame(s, T30_RTP); break; case T30_COPY_QUALITY_BAD: + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); rx_start_page(s); set_state(s, T30_STATE_III_Q_RTN); send_simple_frame(s, T30_RTN); @@ -3083,38 +3180,42 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg, } break; case T30_PRI_MPS: - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } s->next_rx_step = fcf; switch (copy_quality(s)) { case T30_COPY_QUALITY_PERFECT: case T30_COPY_QUALITY_GOOD: rx_end_page(s); - t4_rx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; - s->in_message = FALSE; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + terminate_operation_in_progress(s); set_state(s, T30_STATE_III_Q_MCF); break; case T30_COPY_QUALITY_POOR: rx_end_page(s); - t4_rx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; - s->in_message = FALSE; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + terminate_operation_in_progress(s); set_state(s, T30_STATE_III_Q_RTP); break; case T30_COPY_QUALITY_BAD: + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } set_state(s, T30_STATE_III_Q_RTN); break; } break; case T30_EOM: case T30_EOS: - if (s->phase_d_handler) - s->phase_d_handler(s, s->phase_d_user_data, fcf); s->next_rx_step = fcf; /* Return to phase B */ queue_phase(s, T30_PHASE_B_TX); @@ -3123,17 +3224,23 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg, case T30_COPY_QUALITY_PERFECT: case T30_COPY_QUALITY_GOOD: rx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); rx_start_page(s); set_state(s, T30_STATE_III_Q_MCF); send_simple_frame(s, T30_MCF); break; case T30_COPY_QUALITY_POOR: rx_end_page(s); + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); rx_start_page(s); set_state(s, T30_STATE_III_Q_RTP); send_simple_frame(s, T30_RTP); break; case T30_COPY_QUALITY_BAD: + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); rx_start_page(s); set_state(s, T30_STATE_III_Q_RTN); send_simple_frame(s, T30_RTN); @@ -3141,37 +3248,41 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg, } break; case T30_PRI_EOM: - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } s->next_rx_step = fcf; switch (copy_quality(s)) { case T30_COPY_QUALITY_PERFECT: case T30_COPY_QUALITY_GOOD: rx_end_page(s); - t4_rx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; - s->in_message = FALSE; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + terminate_operation_in_progress(s); set_state(s, T30_STATE_III_Q_MCF); break; case T30_COPY_QUALITY_POOR: rx_end_page(s); - t4_rx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; - s->in_message = FALSE; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + terminate_operation_in_progress(s); set_state(s, T30_STATE_III_Q_RTP); break; case T30_COPY_QUALITY_BAD: + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } set_state(s, T30_STATE_III_Q_RTN); break; } break; case T30_EOP: - if (s->phase_d_handler) - s->phase_d_handler(s, s->phase_d_user_data, fcf); s->next_rx_step = fcf; queue_phase(s, T30_PHASE_D_TX); switch (copy_quality(s)) @@ -3179,51 +3290,59 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg, case T30_COPY_QUALITY_PERFECT: case T30_COPY_QUALITY_GOOD: rx_end_page(s); - t4_rx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; - s->in_message = FALSE; + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + terminate_operation_in_progress(s); set_state(s, T30_STATE_III_Q_MCF); send_simple_frame(s, T30_MCF); break; case T30_COPY_QUALITY_POOR: rx_end_page(s); - t4_rx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; - s->in_message = FALSE; + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); + terminate_operation_in_progress(s); set_state(s, T30_STATE_III_Q_RTP); send_simple_frame(s, T30_RTP); break; case T30_COPY_QUALITY_BAD: + if (s->phase_d_handler) + s->phase_d_handler(s, s->phase_d_user_data, fcf); set_state(s, T30_STATE_III_Q_RTN); send_simple_frame(s, T30_RTN); break; } break; case T30_PRI_EOP: - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } s->next_rx_step = fcf; switch (copy_quality(s)) { case T30_COPY_QUALITY_PERFECT: case T30_COPY_QUALITY_GOOD: rx_end_page(s); - t4_rx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; - s->in_message = FALSE; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + terminate_operation_in_progress(s); set_state(s, T30_STATE_III_Q_MCF); break; case T30_COPY_QUALITY_POOR: rx_end_page(s); - t4_rx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; - s->in_message = FALSE; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + terminate_operation_in_progress(s); set_state(s, T30_STATE_III_Q_RTP); break; case T30_COPY_QUALITY_BAD: + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } set_state(s, T30_STATE_III_Q_RTN); break; } @@ -3404,7 +3523,8 @@ static void process_state_f_post_rcp_rnr(t30_state_t *s, const uint8_t *msg, int } else { - send_deferred_pps_response(s); + /* Now we send the deferred response */ + send_response_to_pps(s); } break; case T30_CRP: @@ -3526,7 +3646,6 @@ static void process_state_ii(t30_state_t *s, const uint8_t *msg, int len) static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) { - t4_stats_t stats; uint8_t fcf; fcf = msg[2] & 0xFE; @@ -3555,13 +3674,8 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); - t4_tx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; - if (span_log_test(&s->logging, SPAN_LOG_FLOW)) - { - t4_get_transfer_statistics(&s->t4, &stats); - span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); - } + terminate_operation_in_progress(s); + report_tx_result(s, TRUE); return_to_phase_b(s, FALSE); break; case T30_EOP: @@ -3569,14 +3683,9 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); - t4_tx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + terminate_operation_in_progress(s); send_dcn(s); - if (span_log_test(&s->logging, SPAN_LOG_FLOW)) - { - t4_get_transfer_statistics(&s->t4, &stats); - span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); - } + report_tx_result(s, TRUE); break; } break; @@ -3614,7 +3723,7 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); - t4_tx_release(&s->t4); + t4_tx_release(&s->t4.tx); /* TODO: should go back to T, and resend */ return_to_phase_b(s, TRUE); break; @@ -3623,7 +3732,7 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); - t4_tx_release(&s->t4); + t4_tx_release(&s->t4.tx); send_dcn(s); break; } @@ -3887,7 +3996,6 @@ static void process_state_iv(t30_state_t *s, const uint8_t *msg, int len) static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int len) { - t4_stats_t stats; uint8_t fcf; fcf = msg[2] & 0xFE; @@ -3934,13 +4042,8 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); - t4_tx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; - if (span_log_test(&s->logging, SPAN_LOG_FLOW)) - { - t4_get_transfer_statistics(&s->t4, &stats); - span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); - } + terminate_operation_in_progress(s); + report_tx_result(s, TRUE); return_to_phase_b(s, FALSE); break; case T30_EOP: @@ -3948,14 +4051,9 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); - t4_tx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + terminate_operation_in_progress(s); send_dcn(s); - if (span_log_test(&s->logging, SPAN_LOG_FLOW)) - { - t4_get_transfer_statistics(&s->t4, &stats); - span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); - } + report_tx_result(s, TRUE); break; } } @@ -3991,7 +4089,6 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len) { - t4_stats_t stats; uint8_t fcf; fcf = msg[2] & 0xFE; @@ -4038,13 +4135,8 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len) tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); - t4_tx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; - if (span_log_test(&s->logging, SPAN_LOG_FLOW)) - { - t4_get_transfer_statistics(&s->t4, &stats); - span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); - } + terminate_operation_in_progress(s); + report_tx_result(s, TRUE); return_to_phase_b(s, FALSE); break; case T30_EOP: @@ -4052,14 +4144,9 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len) tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); - t4_tx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + terminate_operation_in_progress(s); send_dcn(s); - if (span_log_test(&s->logging, SPAN_LOG_FLOW)) - { - t4_get_transfer_statistics(&s->t4, &stats); - span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); - } + report_tx_result(s, TRUE); break; } } @@ -4111,7 +4198,6 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len) static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len) { - t4_stats_t stats; uint8_t fcf; fcf = msg[2] & 0xFE; @@ -4158,13 +4244,8 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); - t4_tx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; - if (span_log_test(&s->logging, SPAN_LOG_FLOW)) - { - t4_get_transfer_statistics(&s->t4, &stats); - span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); - } + terminate_operation_in_progress(s); + report_tx_result(s, TRUE); return_to_phase_b(s, FALSE); break; case T30_EOP: @@ -4172,14 +4253,9 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); - t4_tx_release(&s->t4); - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + terminate_operation_in_progress(s); send_dcn(s); - if (span_log_test(&s->logging, SPAN_LOG_FLOW)) - { - t4_get_transfer_statistics(&s->t4, &stats); - span_log(&s->logging, SPAN_LOG_FLOW, "Success - delivered %d pages\n", stats.pages_transferred); - } + report_tx_result(s, TRUE); break; } } @@ -5253,7 +5329,6 @@ static void t30_non_ecm_rx_status(void *user_data, int status) { /* The training went OK */ s->short_train = TRUE; - s->in_message = TRUE; rx_start_page(s); set_phase(s, T30_PHASE_B_TX); set_state(s, T30_STATE_F_CFR); @@ -5327,7 +5402,7 @@ SPAN_DECLARE_NONSTD(void) t30_non_ecm_put_bit(void *user_data, int bit) break; case T30_STATE_F_DOC_NON_ECM: /* Document transfer */ - if (t4_rx_put_bit(&s->t4, bit)) + if (t4_rx_put_bit(&s->t4.rx, bit)) { /* That is the end of the document */ set_state(s, T30_STATE_F_POST_DOC_NON_ECM); @@ -5343,6 +5418,11 @@ SPAN_DECLARE(void) t30_non_ecm_put_byte(void *user_data, int byte) { t30_state_t *s; + if (byte < 0) + { + t30_non_ecm_rx_status(user_data, byte); + return; + } s = (t30_state_t *) user_data; switch (s->state) { @@ -5363,7 +5443,7 @@ SPAN_DECLARE(void) t30_non_ecm_put_byte(void *user_data, int byte) break; case T30_STATE_F_DOC_NON_ECM: /* Document transfer */ - if (t4_rx_put_byte(&s->t4, (uint8_t) byte)) + if (t4_rx_put_byte(&s->t4.rx, (uint8_t) byte)) { /* That is the end of the document */ set_state(s, T30_STATE_F_POST_DOC_NON_ECM); @@ -5403,7 +5483,7 @@ SPAN_DECLARE(void) t30_non_ecm_put_chunk(void *user_data, const uint8_t buf[], i break; case T30_STATE_F_DOC_NON_ECM: /* Document transfer */ - if (t4_rx_put_chunk(&s->t4, buf, len)) + if (t4_rx_put_chunk(&s->t4.rx, buf, len)) { /* That is the end of the document */ set_state(s, T30_STATE_F_POST_DOC_NON_ECM); @@ -5434,7 +5514,7 @@ SPAN_DECLARE_NONSTD(int) t30_non_ecm_get_bit(void *user_data) break; case T30_STATE_I: /* Transferring real data. */ - bit = t4_tx_get_bit(&s->t4); + bit = t4_tx_get_bit(&s->t4.tx); break; case T30_STATE_D_POST_TCF: case T30_STATE_II_Q: @@ -5469,7 +5549,7 @@ SPAN_DECLARE(int) t30_non_ecm_get_byte(void *user_data) break; case T30_STATE_I: /* Transferring real data. */ - byte = t4_tx_get_byte(&s->t4); + byte = t4_tx_get_byte(&s->t4.tx); break; case T30_STATE_D_POST_TCF: case T30_STATE_II_Q: @@ -5504,7 +5584,7 @@ SPAN_DECLARE(int) t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_ break; case T30_STATE_I: /* Transferring real data. */ - len = t4_tx_get_chunk(&s->t4, buf, max_len); + len = t4_tx_get_chunk(&s->t4.tx, buf, max_len); break; case T30_STATE_D_POST_TCF: case T30_STATE_II_Q: @@ -6131,7 +6211,20 @@ SPAN_DECLARE(void) t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t) t->bit_rate = fallback_sequence[s->current_fallback].bit_rate; t->error_correcting_mode = s->error_correcting_mode; t->error_correcting_mode_retries = s->error_correcting_mode_retries; - t4_get_transfer_statistics(&s->t4, &stats); + switch (s->operation_in_progress) + { + case OPERATION_IN_PROGRESS_T4_TX: + case OPERATION_IN_PROGRESS_POST_T4_TX: + t4_tx_get_transfer_statistics(&s->t4.tx, &stats); + break; + case OPERATION_IN_PROGRESS_T4_RX: + case OPERATION_IN_PROGRESS_POST_T4_RX: + t4_rx_get_transfer_statistics(&s->t4.rx, &stats); + break; + default: + memset(&stats, 0, sizeof(stats)); + break; + } t->pages_tx = s->tx_page_number; t->pages_rx = s->rx_page_number; t->pages_in_file = stats.pages_in_file; @@ -6248,16 +6341,7 @@ SPAN_DECLARE(int) t30_release(t30_state_t *s) { /* Make sure any FAX in progress is tidied up. If the tidying up has already happened, repeating it here is harmless. */ - switch (s->operation_in_progress) - { - case OPERATION_IN_PROGRESS_T4_TX: - t4_tx_release(&s->t4); - break; - case OPERATION_IN_PROGRESS_T4_RX: - t4_rx_release(&s->t4); - break; - } - s->operation_in_progress = OPERATION_IN_PROGRESS_NONE; + terminate_operation_in_progress(s); return 0; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/t30_api.c b/libs/spandsp/src/t30_api.c index 258e3f212d..a98dfeecc6 100644 --- a/libs/spandsp/src/t30_api.c +++ b/libs/spandsp/src/t30_api.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t30_api.c,v 1.13.4.2 2009/12/19 14:18:13 steveu Exp $ */ /*! \file */ @@ -62,6 +60,12 @@ #include "spandsp/v27ter_tx.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/t81_t82_arith_coding.h" +#include "spandsp/t85.h" +#endif +#include "spandsp/t4_t6_decode.h" +#include "spandsp/t4_t6_encode.h" #include "spandsp/t30_fcf.h" #include "spandsp/t35.h" #include "spandsp/t30.h" @@ -69,6 +73,12 @@ #include "spandsp/t30_logging.h" #include "spandsp/private/logging.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/private/t81_t82_arith_coding.h" +#include "spandsp/private/t85.h" +#endif +#include "spandsp/private/t4_t6_decode.h" +#include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" #include "spandsp/private/t30.h" @@ -85,7 +95,7 @@ SPAN_DECLARE(int) t30_set_tx_ident(t30_state_t *s, const char *id) if (strlen(id) > T30_MAX_IDENT_LEN) return -1; strcpy(s->tx_info.ident, id); - t4_tx_set_local_ident(&s->t4, s->tx_info.ident); + t4_tx_set_local_ident(&s->t4.tx, s->tx_info.ident); return 0; } /*- End of function --------------------------------------------------------*/ @@ -536,6 +546,16 @@ SPAN_DECLARE(size_t) t30_get_rx_csa(t30_state_t *s, int *type, const char *addre } /*- End of function --------------------------------------------------------*/ +SPAN_DECLARE(int) t30_set_tx_page_header_overlays_image(t30_state_t *s, int header_overlays_image) +{ +#if 0 + s->header_overlays_image = header_overlays_image; + t4_tx_set_header_overlays_image(&s->t4.tx, s->header_overlays_image); +#endif + return 0; +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE(int) t30_set_tx_page_header_info(t30_state_t *s, const char *info) { if (info == NULL) @@ -546,7 +566,14 @@ SPAN_DECLARE(int) t30_set_tx_page_header_info(t30_state_t *s, const char *info) if (strlen(info) > T30_MAX_PAGE_HEADER_INFO) return -1; strcpy(s->header_info, info); - t4_tx_set_header_info(&s->t4, s->header_info); + t4_tx_set_header_info(&s->t4.tx, s->header_info); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(int) t30_set_tx_page_header_tz(t30_state_t *s, const char *tzstring) +{ + t4_tx_set_header_tz(&s->t4.tx, tzstring); return 0; } /*- End of function --------------------------------------------------------*/ @@ -653,7 +680,19 @@ SPAN_DECLARE(int) t30_set_supported_modems(t30_state_t *s, int supported_modems) SPAN_DECLARE(int) t30_set_supported_compressions(t30_state_t *s, int supported_compressions) { - s->supported_compressions = supported_compressions; + int mask; + + /* Mask out the ones we actually support today. */ + mask = T30_SUPPORT_T4_1D_COMPRESSION + | T30_SUPPORT_T4_2D_COMPRESSION + | T30_SUPPORT_T6_COMPRESSION +#if defined(SPANDSP_SUPPORT_T85) + | T30_SUPPORT_T85_COMPRESSION + | T30_SUPPORT_T85_L0_COMPRESSION; +#else + | 0; +#endif + s->supported_compressions = supported_compressions & mask; t30_build_dis_or_dtc(s); return 0; } diff --git a/libs/spandsp/src/t30_local.h b/libs/spandsp/src/t30_local.h index 177d6dc3eb..3152ad94ea 100644 --- a/libs/spandsp/src/t30_local.h +++ b/libs/spandsp/src/t30_local.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t30_local.h,v 1.2 2008/04/17 14:26:57 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/t30_logging.c b/libs/spandsp/src/t30_logging.c index abc6fa31c5..97a8c02378 100644 --- a/libs/spandsp/src/t30_logging.c +++ b/libs/spandsp/src/t30_logging.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t30_logging.c,v 1.12.4.2 2009/12/19 10:44:10 steveu Exp $ */ /*! \file */ @@ -62,12 +60,24 @@ #include "spandsp/v27ter_tx.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/t81_t82_arith_coding.h" +#include "spandsp/t85.h" +#endif +#include "spandsp/t4_t6_decode.h" +#include "spandsp/t4_t6_encode.h" #include "spandsp/t30_fcf.h" #include "spandsp/t35.h" #include "spandsp/t30.h" #include "spandsp/t30_logging.h" #include "spandsp/private/logging.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/private/t81_t82_arith_coding.h" +#include "spandsp/private/t85.h" +#endif +#include "spandsp/private/t4_t6_decode.h" +#include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" #include "spandsp/private/t30.h" diff --git a/libs/spandsp/src/t31.c b/libs/spandsp/src/t31.c index 6f00df9499..5c9c4066b2 100644 --- a/libs/spandsp/src/t31.c +++ b/libs/spandsp/src/t31.c @@ -24,8 +24,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t31.c,v 1.155.4.1 2009/12/19 10:44:10 steveu Exp $ */ /*! \file */ @@ -55,6 +53,7 @@ #include "spandsp/telephony.h" #include "spandsp/logging.h" #include "spandsp/bit_operations.h" +#include "spandsp/bitstream.h" #include "spandsp/dc_restore.h" #include "spandsp/queue.h" #include "spandsp/power_meter.h" @@ -65,15 +64,19 @@ #include "spandsp/crc.h" #include "spandsp/hdlc.h" #include "spandsp/silence_gen.h" +#include "spandsp/super_tone_rx.h" #include "spandsp/fsk.h" +#include "spandsp/modem_connect_tones.h" +#include "spandsp/v8.h" #include "spandsp/v29tx.h" #include "spandsp/v29rx.h" #include "spandsp/v27ter_tx.h" #include "spandsp/v27ter_rx.h" #include "spandsp/v17tx.h" #include "spandsp/v17rx.h" -#include "spandsp/super_tone_rx.h" -#include "spandsp/modem_connect_tones.h" +#if defined(SPANDSP_SUPPORT_V34) +#include "spandsp/v34.h" +#endif #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" #include "spandsp/t30.h" @@ -86,16 +89,21 @@ #include "spandsp/t30_fcf.h" #include "spandsp/private/logging.h" +#include "spandsp/private/bitstream.h" #include "spandsp/private/t38_core.h" #include "spandsp/private/silence_gen.h" #include "spandsp/private/fsk.h" +#include "spandsp/private/modem_connect_tones.h" +#include "spandsp/private/v8.h" +#if defined(SPANDSP_SUPPORT_V34) +#include "spandsp/private/v34.h" +#endif #include "spandsp/private/v17tx.h" #include "spandsp/private/v17rx.h" #include "spandsp/private/v27ter_tx.h" #include "spandsp/private/v27ter_rx.h" #include "spandsp/private/v29tx.h" #include "spandsp/private/v29rx.h" -#include "spandsp/private/modem_connect_tones.h" #include "spandsp/private/hdlc.h" #include "spandsp/private/fax_modems.h" #include "spandsp/private/at_interpreter.h" @@ -455,12 +463,23 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, with 0xFF it would appear some octets must have been missed before this one. */ if (len <= 0 || buf[0] != 0xFF) fe->rx_data_missing = TRUE; + /*endif*/ } - if (len > 0 && fe->hdlc_rx.len + len <= T31_T38_MAX_HDLC_LEN) + /*endif*/ + if (len > 0) { - bit_reverse(fe->hdlc_rx.buf + fe->hdlc_rx.len, buf, len); - fe->hdlc_rx.len += len; + if (fe->hdlc_rx.len + len <= T31_T38_MAX_HDLC_LEN) + { + bit_reverse(fe->hdlc_rx.buf + fe->hdlc_rx.len, buf, len); + fe->hdlc_rx.len += len; + } + else + { + fe->rx_data_missing = TRUE; + } + /*endif*/ } + /*endif*/ fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); break; case T38_FIELD_HDLC_FCS_OK: @@ -470,6 +489,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, /* The sender has incorrectly included data in this message. It is unclear what we should do with it, to maximise tolerance of buggy implementations. */ } + /*endif*/ /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_OK messages, in IFP packets with incrementing sequence numbers, which are actually repeats. They get through to this point because of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ @@ -479,6 +499,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, crc_itu16_append(fe->hdlc_rx.buf, fe->hdlc_rx.len); hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing); } + /*endif*/ fe->hdlc_rx.len = 0; fe->rx_data_missing = FALSE; fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); @@ -490,6 +511,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, /* The sender has incorrectly included data in this message. We can safely ignore it, as the bad FCS means we will throw away the whole message, anyway. */ } + /*endif*/ /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_BAD messages, in IFP packets with incrementing sequence numbers, which are actually repeats. They get through to this point because of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ @@ -498,6 +520,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean"); hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE); } + /*endif*/ fe->hdlc_rx.len = 0; fe->rx_data_missing = FALSE; fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); @@ -1303,6 +1326,15 @@ static void tone_detected(void *user_data, int tone, int level, int delay) } /*- End of function --------------------------------------------------------*/ +static void v8_handler(void *user_data, v8_parms_t *result) +{ + t31_state_t *s; + + s = (t31_state_t *) user_data; + span_log(&s->logging, SPAN_LOG_FLOW, "V.8 report received\n"); +} +/*- End of function --------------------------------------------------------*/ + static void hdlc_tx_underflow(void *user_data) { t31_state_t *s; @@ -2332,7 +2364,7 @@ static int v29_v21_rx_fillin(void *user_data, int len) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t31_rx(t31_state_t *s, int16_t amp[], int len) +SPAN_DECLARE_NONSTD(int) t31_rx(t31_state_t *s, int16_t amp[], int len) { int i; int32_t power; @@ -2378,7 +2410,7 @@ SPAN_DECLARE(int) t31_rx(t31_state_t *s, int16_t amp[], int len) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t31_rx_fillin(t31_state_t *s, int len) +SPAN_DECLARE_NONSTD(int) t31_rx_fillin(t31_state_t *s, int len) { /* To mitigate the effect of lost packets on a packet network we should try to sustain the status quo. If there is no receive modem running, keep @@ -2436,7 +2468,7 @@ static int set_next_tx_type(t31_state_t *s) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t31_tx(t31_state_t *s, int16_t amp[], int max_len) +SPAN_DECLARE_NONSTD(int) t31_tx(t31_state_t *s, int16_t amp[], int max_len) { int len; @@ -2570,8 +2602,9 @@ SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s, t38_tx_packet_handler_t *tx_t38_packet_handler, void *tx_t38_packet_user_data) { + v8_parms_t v8_parms; int alloced; - + if (at_tx_handler == NULL || modem_control_handler == NULL) return NULL; @@ -2596,6 +2629,28 @@ SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s, non_ecm_get_bit, tone_detected, (void *) s); +#if 0 + v8_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR; + v8_parms.call_function = V8_CALL_T30_RX; + v8_parms.modulations = V8_MOD_V21 +#if 0 + | V8_MOD_V34HALF +#endif + | V8_MOD_V17 + | V8_MOD_V29 + | V8_MOD_V27TER; + v8_parms.protocol = V8_PROTOCOL_NONE; + v8_parms.pcm_modem_availability = 0; + v8_parms.pstn_access = 0; + v8_parms.nsf = -1; + v8_parms.t66 = -1; + v8_init(&s->audio.v8, + FALSE, + &v8_parms, + v8_handler, + s); + +#endif power_meter_init(&(s->audio.rx_power), 4); s->audio.last_sample = 0; s->audio.silence_threshold_power = power_meter_level_dbm0(-36); diff --git a/libs/spandsp/src/t35.c b/libs/spandsp/src/t35.c index 392bc6a440..9d525b5e36 100644 --- a/libs/spandsp/src/t35.c +++ b/libs/spandsp/src/t35.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t35.c,v 1.31 2009/05/16 03:34:45 steveu Exp $ */ /* diff --git a/libs/spandsp/src/t38_core.c b/libs/spandsp/src/t38_core.c index 443608b26d..551d6c0155 100644 --- a/libs/spandsp/src/t38_core.c +++ b/libs/spandsp/src/t38_core.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t38_core.c,v 1.54 2009/10/09 14:53:57 steveu Exp $ */ /*! \file */ @@ -176,7 +174,7 @@ SPAN_DECLARE(const char *) t38_data_type_to_str(int data_type) case T38_DATA_V34_CC_1200: return "v34-CC-1200"; case T38_DATA_V34_PRI_CH: - return "v34-pri-vh"; + return "v34-pri-ch"; case T38_DATA_V33_12000: return "v33-12000"; case T38_DATA_V33_14400: @@ -327,7 +325,7 @@ static __inline__ int classify_seq_no_offset(int expected, int actual) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE_NONSTD(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no) +SPAN_DECLARE(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no) { int i; int t30_indicator; @@ -782,13 +780,17 @@ SPAN_DECLARE(int) t38_core_send_indicator(t38_core_state_t *s, int indicator) uint8_t buf[100]; int len; int delay; + int transmissions; delay = 0; /* Only send an indicator if it represents a change of state. */ + /* If the 0x100 bit is set in indicator it will bypass this test, and force transmission */ if (s->current_tx_indicator != indicator) { /* Zero is a valid count, to suppress the transmission of indicators when the transport means they are not needed - e.g. TPKT/TCP. */ + transmissions = (indicator & 0x100) ? 1 : s->category_control[T38_PACKET_CATEGORY_INDICATOR]; + indicator &= 0xFF; if (s->category_control[T38_PACKET_CATEGORY_INDICATOR]) { if ((len = t38_encode_indicator(s, buf, indicator)) < 0) @@ -797,7 +799,7 @@ SPAN_DECLARE(int) t38_core_send_indicator(t38_core_state_t *s, int indicator) return len; } span_log(&s->logging, SPAN_LOG_FLOW, "Tx %5d: indicator %s\n", s->tx_seq_no, t38_indicator_to_str(indicator)); - s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, s->category_control[T38_PACKET_CATEGORY_INDICATOR]); + s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, transmissions); s->tx_seq_no = (s->tx_seq_no + 1) & 0xFFFF; delay = modem_startup_time[indicator].training; if (s->allow_for_tep) @@ -815,6 +817,12 @@ SPAN_DECLARE(int) t38_core_send_flags_delay(t38_core_state_t *s, int indicator) } /*- End of function --------------------------------------------------------*/ +SPAN_DECLARE(int) t38_core_send_training_delay(t38_core_state_t *s, int indicator) +{ + return modem_startup_time[indicator].training; +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE(int) t38_core_send_data(t38_core_state_t *s, int data_type, int field_type, const uint8_t field[], int field_len, int category) { t38_data_field_t field0; @@ -935,6 +943,26 @@ SPAN_DECLARE(logging_state_t *) t38_core_get_logging_state(t38_core_state_t *s) } /*- End of function --------------------------------------------------------*/ +SPAN_DECLARE(int) t38_core_restart(t38_core_state_t *s) +{ + /* Set the initial current receive states to something invalid, so the + first data received is seen as a change of state. */ + s->current_rx_indicator = -1; + s->current_rx_data_type = -1; + s->current_rx_field_type = -1; + + /* Set the initial current indicator state to something invalid, so the + first attempt to send an indicator will work. */ + s->current_tx_indicator = -1; + + /* We have no initial expectation of the received packet sequence number. + They most often start at 0 or 1 for a UDPTL transport, but random + starting numbers are possible. */ + s->rx_expected_seq_no = -1; + return 0; +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE(t38_core_state_t *) t38_core_init(t38_core_state_t *s, t38_rx_indicator_handler_t *rx_indicator_handler, t38_rx_data_handler_t *rx_data_handler, @@ -971,16 +999,6 @@ SPAN_DECLARE(t38_core_state_t *) t38_core_init(t38_core_state_t *s, s->category_control[T38_PACKET_CATEGORY_IMAGE_DATA] = 1; s->category_control[T38_PACKET_CATEGORY_IMAGE_DATA_END] = 1; - /* Set the initial current receive states to something invalid, so the - first data received is seen as a change of state. */ - s->current_rx_indicator = -1; - s->current_rx_data_type = -1; - s->current_rx_field_type = -1; - - /* Set the initial current indicator state to something invalid, so the - first attempt to send an indicator will work. */ - s->current_tx_indicator = -1; - s->rx_indicator_handler = rx_indicator_handler; s->rx_data_handler = rx_data_handler; s->rx_missing_handler = rx_missing_handler; @@ -988,10 +1006,7 @@ SPAN_DECLARE(t38_core_state_t *) t38_core_init(t38_core_state_t *s, s->tx_packet_handler = tx_packet_handler; s->tx_packet_user_data = tx_packet_user_data; - /* We have no initial expectation of the received packet sequence number. - They most often start at 0 or 1 for a UDPTL transport, but random - starting numbers are possible. */ - s->rx_expected_seq_no = -1; + t38_core_restart(s); return s; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index e4fac8067c..a572b5dad9 100644 --- a/libs/spandsp/src/t38_gateway.c +++ b/libs/spandsp/src/t38_gateway.c @@ -73,6 +73,12 @@ #include "spandsp/modem_connect_tones.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/t81_t82_arith_coding.h" +#include "spandsp/t85.h" +#endif +#include "spandsp/t4_t6_decode.h" +#include "spandsp/t4_t6_encode.h" #include "spandsp/t30_fcf.h" #include "spandsp/t35.h" #include "spandsp/t30.h" @@ -94,6 +100,12 @@ #include "spandsp/private/modem_connect_tones.h" #include "spandsp/private/hdlc.h" #include "spandsp/private/fax_modems.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/private/t81_t82_arith_coding.h" +#include "spandsp/private/t85.h" +#endif +#include "spandsp/private/t4_t6_decode.h" +#include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" #include "spandsp/private/t30.h" @@ -191,6 +203,7 @@ static void set_rx_handler(t38_gateway_state_t *s, span_rx_handler_t *handler, s s->audio.modems.rx_handler = handler; s->audio.modems.rx_fillin_handler = fillin_handler; } + /*endif*/ s->audio.base_rx_handler = handler; s->audio.base_rx_fillin_handler = fillin_handler; s->audio.modems.rx_user_data = user_data; @@ -1014,10 +1027,13 @@ static void queue_missing_indicator(t38_gateway_state_t *s, int data_type) /*endswitch*/ if (expected < 0) return; + /*endif*/ if (t->current_rx_indicator == expected) return; + /*endif*/ if (expected_alt >= 0 && t->current_rx_indicator == expected_alt) return; + /*endif*/ span_log(&s->logging, SPAN_LOG_FLOW, "Queuing missing indicator - %s\n", @@ -1155,13 +1171,20 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, with 0xFF it would appear some octets must have been missed before this one. */ if (len <= 0 || buf[0] != 0xFF) s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in].flags |= HDLC_FLAG_MISSING_DATA; + /*endif*/ hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; } /*endif*/ /* Check if this data would overflow the buffer. */ - if (len <= 0 || hdlc_buf->len + len > T38_MAX_HDLC_LEN) + if (len <= 0) break; /*endif*/ + if (hdlc_buf->len + len > T38_MAX_HDLC_LEN) + { + s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in].flags |= HDLC_FLAG_MISSING_DATA; + break; + } + /*endif*/ hdlc_buf->contents = (data_type | FLAG_DATA); bit_reverse(&hdlc_buf->buf[hdlc_buf->len], buf, len); /* We need to send out the control messages as they are arriving. They are @@ -1389,6 +1412,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, queue_missing_indicator(s, data_type); hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; } + /*endif*/ /* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send this message at the end of non-ECM data. We need to tolerate this. */ if (xx->current_rx_field_class == T38_FIELD_CLASS_NON_ECM) @@ -1423,8 +1447,10 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, queue_missing_indicator(s, data_type); hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; } + /*endif*/ if (len > 0) t38_non_ecm_buffer_inject(&s->core.non_ecm_to_modem, buf, len); + /*endif*/ xx->corrupt_current_frame[0] = FALSE; break; case T38_FIELD_T4_NON_ECM_SIG_END: @@ -1510,7 +1536,8 @@ static void set_octets_per_data_packet(t38_gateway_state_t *s, int bit_rate) { int octets; - octets = s->core.ms_per_tx_chunk*bit_rate/(8*1000); + //octets = s->core.ms_per_tx_chunk*bit_rate/(8*1000); + octets = DEFAULT_MS_PER_TX_CHUNK*bit_rate/(8*1000); if (octets < 1) octets = 1; /*endif*/ @@ -1555,6 +1582,7 @@ static int set_fast_packetisation(t38_gateway_state_t *s) s->t38x.current_tx_data_type = T38_DATA_V17_14400; break; } + /*endswitch*/ break; case T38_V27TER_RX: set_octets_per_data_packet(s, s->core.fast_bit_rate); @@ -1570,6 +1598,7 @@ static int set_fast_packetisation(t38_gateway_state_t *s) s->t38x.current_tx_data_type = T38_DATA_V27TER_4800; break; } + /*endswitch*/ break; case T38_V29_RX: set_octets_per_data_packet(s, s->core.fast_bit_rate); @@ -1585,8 +1614,10 @@ static int set_fast_packetisation(t38_gateway_state_t *s) s->t38x.current_tx_data_type = T38_DATA_V29_9600; break; } + /*endswitch*/ break; } + /*endswitch*/ return ind; } /*- End of function --------------------------------------------------------*/ @@ -1616,8 +1647,10 @@ static void non_ecm_rx_status(void *user_data, int status) s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_FAST_MODEM_SEEN; else s->core.samples_to_timeout = ms_to_samples(500); + /*endif*/ set_fast_packetisation(s); } + /*endif*/ break; case SIG_STATUS_TRAINING_FAILED: break; @@ -1650,14 +1683,17 @@ static void non_ecm_rx_status(void *user_data, int status) non_ecm_push_residue(s); t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL); } + /*endif*/ restart_rx_modem(s); break; } + /*endswitch*/ break; default: span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected non-ECM special bit - %d!\n", status); break; } + /*endswitch*/ } /*- End of function --------------------------------------------------------*/ @@ -1682,6 +1718,7 @@ static void non_ecm_push_residue(t38_gateway_state_t *t) /* There is a fractional octet in progress. We might as well send every last bit we can. */ s->data[s->data_ptr++] = (uint8_t) (s->bit_stream << (8 - s->bit_no)); } + /*endif*/ t38_core_send_data(&t->t38x.t38, t->t38x.current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, s->data, s->data_ptr, T38_PACKET_CATEGORY_IMAGE_DATA_END); s->in_bits += s->bits_absorbed; s->out_octets += s->data_ptr; @@ -1716,6 +1753,7 @@ static void non_ecm_put_bit(void *user_data, int bit) non_ecm_rx_status(user_data, bit); return; } + /*endif*/ t = (t38_gateway_state_t *) user_data; s = &t->core.to_t38; @@ -1727,8 +1765,10 @@ static void non_ecm_put_bit(void *user_data, int bit) s->data[s->data_ptr++] = (uint8_t) s->bit_stream & 0xFF; if (s->data_ptr >= s->octets_per_data_packet) non_ecm_push(t); + /*endif*/ s->bit_no = 0; } + /*endif*/ } /*- End of function --------------------------------------------------------*/ @@ -1742,6 +1782,7 @@ static void non_ecm_remove_fill_and_put_bit(void *user_data, int bit) non_ecm_rx_status(user_data, bit); return; } + /*endif*/ t = (t38_gateway_state_t *) user_data; s = &t->core.to_t38; @@ -1762,16 +1803,20 @@ static void non_ecm_remove_fill_and_put_bit(void *user_data, int bit) end gateway (assuming the far end is a gateway) cannot play them out. */ non_ecm_push(t); } + /*endif*/ return; } + /*endif*/ s->bit_stream = (s->bit_stream << 1) | bit; if (++s->bit_no >= 8) { s->data[s->data_ptr++] = (uint8_t) s->bit_stream & 0xFF; if (s->data_ptr >= s->octets_per_data_packet) non_ecm_push(t); + /*endif*/ s->bit_no = 0; } + /*endif*/ } /*- End of function --------------------------------------------------------*/ @@ -1815,6 +1860,7 @@ static void hdlc_rx_status(hdlc_rx_state_t *t, int status) t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL); t->framing_ok_announced = FALSE; } + /*endif*/ restart_rx_modem(s); if (s->core.timed_mode == TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN) { @@ -1826,11 +1872,13 @@ static void hdlc_rx_status(hdlc_rx_state_t *t, int status) s->core.samples_to_timeout = ms_to_samples(75); s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_PAST_V21_MODEM; } + /*endif*/ break; default: span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected HDLC special bit - %d!\n", status); break; } + /*endswitch*/ } /*- End of function --------------------------------------------------------*/ @@ -2041,7 +2089,13 @@ static int restart_rx_modem(t38_gateway_state_t *s) s->core.to_t38.in_bits = 0; s->core.to_t38.out_octets = 0; } - span_log(&s->logging, SPAN_LOG_FLOW, "Restart rx modem - modem = %d, short train = %d, ECM = %d\n", s->core.fast_rx_modem, s->core.short_train, s->core.ecm_mode); + /*endif*/ + span_log(&s->logging, + SPAN_LOG_FLOW, + "Restart rx modem - modem = %d, short train = %d, ECM = %d\n", + s->core.fast_rx_modem, + s->core.short_train, + s->core.ecm_mode); hdlc_rx_init(&(s->audio.modems.hdlc_rx), FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, NULL, s); s->audio.modems.rx_signal_present = FALSE; @@ -2063,6 +2117,7 @@ static int restart_rx_modem(t38_gateway_state_t *s) put_bit_func = non_ecm_remove_fill_and_put_bit; else put_bit_func = non_ecm_put_bit; + /*endif*/ put_bit_user_data = (void *) s; } /*endif*/ @@ -2150,7 +2205,7 @@ SPAN_DECLARE_NONSTD(int) t38_gateway_rx(t38_gateway_state_t *s, int16_t amp[], i amp[i] = dc_restore(&(s->audio.modems.dc_restore), amp[i]); /*endfor*/ s->audio.modems.rx_handler(s->audio.modems.rx_user_data, amp, len); - return 0; + return 0; } /*- End of function --------------------------------------------------------*/ @@ -2178,7 +2233,7 @@ SPAN_DECLARE_NONSTD(int) t38_gateway_rx_fillin(t38_gateway_state_t *s, int len) update_rx_timing(s, len); /* TODO: handle the modems properly */ s->audio.modems.rx_fillin_handler(s->audio.modems.rx_user_data, len); - return 0; + return 0; } /*- End of function --------------------------------------------------------*/ @@ -2377,8 +2432,8 @@ SPAN_DECLARE(t38_gateway_state_t *) t38_gateway_init(t38_gateway_state_t *s, s->core.to_t38.octets_per_data_packet = 1; s->core.ecm_allowed = TRUE; - s->core.ms_per_tx_chunk = DEFAULT_MS_PER_TX_CHUNK; t38_non_ecm_buffer_init(&s->core.non_ecm_to_modem, FALSE, 0); + //s->core.ms_per_tx_chunk = DEFAULT_MS_PER_TX_CHUNK; restart_rx_modem(s); s->core.timed_mode = TIMED_MODE_STARTUP; s->core.samples_to_timeout = 1; diff --git a/libs/spandsp/src/t38_non_ecm_buffer.c b/libs/spandsp/src/t38_non_ecm_buffer.c index 1820981002..ddf5b49f7a 100644 --- a/libs/spandsp/src/t38_non_ecm_buffer.c +++ b/libs/spandsp/src/t38_non_ecm_buffer.c @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t38_non_ecm_buffer.c,v 1.9.4.1 2009/12/19 06:43:28 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/t38_terminal.c b/libs/spandsp/src/t38_terminal.c index c11a95e943..c9961f665b 100644 --- a/libs/spandsp/src/t38_terminal.c +++ b/libs/spandsp/src/t38_terminal.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t38_terminal.c,v 1.129.4.2 2009/12/19 10:44:10 steveu Exp $ */ /*! \file */ @@ -65,6 +63,12 @@ #include "spandsp/v17rx.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/t81_t82_arith_coding.h" +#include "spandsp/t85.h" +#endif +#include "spandsp/t4_t6_decode.h" +#include "spandsp/t4_t6_encode.h" #include "spandsp/t30_fcf.h" #include "spandsp/t35.h" #include "spandsp/t30.h" @@ -74,6 +78,12 @@ #include "spandsp/t38_terminal.h" #include "spandsp/private/logging.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/private/t81_t82_arith_coding.h" +#include "spandsp/private/t85.h" +#endif +#include "spandsp/private/t4_t6_decode.h" +#include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" #include "spandsp/private/t30.h" @@ -81,7 +91,7 @@ #include "spandsp/private/t38_terminal.h" /* Settings suitable for paced transmission over a UDP transport */ -#define MS_PER_TX_CHUNK 30 +#define DEFAULT_MS_PER_TX_CHUNK 30 #define INDICATOR_TX_COUNT 3 #define DATA_TX_COUNT 1 @@ -97,7 +107,9 @@ enum { T38_CHUNKING_MERGE_FCS_WITH_DATA = 0x0001, T38_CHUNKING_WHOLE_FRAMES = 0x0002, - T38_CHUNKING_ALLOW_TEP_TIME = 0x0004 + T38_CHUNKING_ALLOW_TEP_TIME = 0x0004, + T38_CHUNKING_SEND_REGULAR_INDICATORS = 0x0008, + T38_CHUNKING_SEND_2S_REGULAR_INDICATORS = 0x0010 }; enum @@ -118,7 +130,8 @@ enum T38_TIMED_STEP_CED_3 = 0x32, T38_TIMED_STEP_CNG = 0x40, T38_TIMED_STEP_CNG_2 = 0x41, - T38_TIMED_STEP_PAUSE = 0x50 + T38_TIMED_STEP_PAUSE = 0x50, + T38_TIMED_STEP_NO_SIGNAL = 0x60 }; static __inline__ void front_end_status(t38_terminal_state_t *s, int status) @@ -159,14 +172,18 @@ static int extra_bits_in_stuffed_frame(const uint8_t buf[], int len) ones = 0; stuffed++; } + /*endif*/ } else { ones = 0; } + /*endif*/ bitstream >>= 1; } + /*endfor*/ } + /*endfor*/ /* The total length of the frame is: the number of bits in the body + the number of additional bits in the body due to stuffing @@ -176,7 +193,7 @@ static int extra_bits_in_stuffed_frame(const uint8_t buf[], int len) Lets just allow 3 bits for the CRC, which is the worst case. It avoids calculating the real CRC, and the worst it can do is cause a flag octet's worth of additional output. - */ + */ return stuffed + 16 + 3 + 16; } /*- End of function --------------------------------------------------------*/ @@ -206,6 +223,7 @@ static int process_rx_indicator(t38_core_state_t *t, void *user_data, int indica ignore it. Its harmless. */ return 0; } + /*endif*/ /* In termination mode we don't care very much about indicators telling us training is starting. We only care about V.21 preamble starting, for timeout control, and the actual data. */ @@ -218,6 +236,7 @@ static int process_rx_indicator(t38_core_state_t *t, void *user_data, int indica { hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE); } + /*endif*/ fe->timeout_rx_samples = 0; front_end_status(s, T30_FRONT_END_SIGNAL_ABSENT); break; @@ -307,6 +326,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, span_log(&s->logging, SPAN_LOG_FLOW, "CM profile %d - %s\n", buf[0] - '0', t38_cm_profile_to_str(buf[0])); else span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CM message - %d\n", len); + /*endif*/ //front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE); break; case T38_FIELD_JM_MESSAGE: @@ -314,6 +334,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, span_log(&s->logging, SPAN_LOG_FLOW, "JM - %s\n", t38_jm_to_str(buf, len)); else span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for JM message - %d\n", len); + /*endif*/ //front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE); break; case T38_FIELD_CI_MESSAGE: @@ -321,6 +342,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, span_log(&s->logging, SPAN_LOG_FLOW, "CI 0x%X\n", buf[0]); else span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CI message - %d\n", len); + /*endif*/ //front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE); break; default: @@ -343,6 +365,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, { span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for V34rate message - %d\n", len); } + /*endif*/ break; default: break; @@ -359,19 +382,30 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, if (fe->timeout_rx_samples == 0) { /* HDLC can just start without any signal indicator on some platforms, even when - there is zero packet lost. Nasty, but true. Its a good idea to be tolerant of + there is zero packet loss. Nasty, but true. Its a good idea to be tolerant of loss, though, so accepting a sudden start of HDLC data is the right thing to do. */ fake_rx_indicator(t, s, T38_IND_V21_PREAMBLE); /* All real HDLC messages in the FAX world start with 0xFF. If this one is not starting with 0xFF it would appear some octets must have been missed before this one. */ if (len <= 0 || buf[0] != 0xFF) fe->rx_data_missing = TRUE; + /*endif*/ } - if (len > 0 && fe->hdlc_rx.len + len <= T38_MAX_HDLC_LEN) + /*endif*/ + if (len > 0) { - bit_reverse(fe->hdlc_rx.buf + fe->hdlc_rx.len, buf, len); - fe->hdlc_rx.len += len; + if (fe->hdlc_rx.len + len <= T38_MAX_HDLC_LEN) + { + bit_reverse(fe->hdlc_rx.buf + fe->hdlc_rx.len, buf, len); + fe->hdlc_rx.len += len; + } + else + { + fe->rx_data_missing = TRUE; + } + /*endif*/ } + /*endif*/ fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); break; case T38_FIELD_HDLC_FCS_OK: @@ -381,6 +415,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, /* The sender has incorrectly included data in this message. It is unclear what we should do with it, to maximise tolerance of buggy implementations. */ } + /*endif*/ /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_OK messages, in IFP packets with incrementing sequence numbers, which are actually repeats. They get through to this point because of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ @@ -389,6 +424,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC OK (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean"); hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing); } + /*endif*/ fe->hdlc_rx.len = 0; fe->rx_data_missing = FALSE; fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); @@ -400,6 +436,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, /* The sender has incorrectly included data in this message. We can safely ignore it, as the bad FCS means we will throw away the whole message, anyway. */ } + /*endif*/ /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_BAD messages, in IFP packets with incrementing sequence numbers, which are actually repeats. They get through to this point because of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ @@ -408,6 +445,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean"); hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE); } + /*endif*/ fe->hdlc_rx.len = 0; fe->rx_data_missing = FALSE; fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); @@ -419,6 +457,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, /* The sender has incorrectly included data in this message. It is unclear what we should do with it, to maximise tolerance of buggy implementations. */ } + /*endif*/ /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_OK_SIG_END messages, in IFP packets with incrementing sequence numbers, which are actually repeats. They get through to this point because of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ @@ -428,6 +467,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, !fe->rx_data_missing); hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE); } + /*endif*/ fe->hdlc_rx.len = 0; fe->rx_data_missing = FALSE; /* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */ @@ -440,6 +480,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, /* The sender has incorrectly included data in this message. We can safely ignore it, as the bad FCS means we will throw away the whole message, anyway. */ } + /*endif*/ /* Some T.38 implementations send multiple T38_FIELD_HDLC_FCS_BAD_SIG_END messages, in IFP packets with incrementing sequence numbers, which are actually repeats. They get through to this point because of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ @@ -449,6 +490,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE); hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE); } + /*endif*/ fe->hdlc_rx.len = 0; fe->rx_data_missing = FALSE; /* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */ @@ -461,6 +503,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, /* The sender has incorrectly included data in this message, but there seems nothing meaningful it could be. There could not be an FCS good/bad report beyond this. */ } + /*endif*/ /* Some T.38 implementations send multiple T38_FIELD_HDLC_SIG_END messages, in IFP packets with incrementing sequence numbers, which are actually repeats. They get through to this point because of the incrementing sequence numbers. We need to filter them here in a context sensitive manner. */ @@ -476,6 +519,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, fe->rx_data_missing = FALSE; front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE); } + /*endif*/ /* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */ fake_rx_indicator(t, s, T38_IND_NO_SIGNAL); break; @@ -485,11 +529,13 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, t30_non_ecm_put_bit(&s->t30, SIG_STATUS_TRAINING_SUCCEEDED); fe->rx_signal_present = TRUE; } + /*endif*/ if (len > 0) { bit_reverse(buf2, buf, len); t30_non_ecm_put_chunk(&s->t30, buf2, len); } + /*endif*/ fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT); break; case T38_FIELD_T4_NON_ECM_SIG_END: @@ -505,15 +551,18 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, t30_non_ecm_put_bit(&s->t30, SIG_STATUS_TRAINING_SUCCEEDED); fe->rx_signal_present = TRUE; } + /*endif*/ bit_reverse(buf2, buf, len); t30_non_ecm_put_chunk(&s->t30, buf2, len); } + /*endif*/ /* WORKAROUND: At least some Mediatrix boxes have a bug, where they can send HDLC signal end where they should send non-ECM signal end. It is possible they also do the opposite. We need to tolerate this, so we use the generic receive complete indication, rather than the specific non-ECM carrier down. */ front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE); } + /*endif*/ fe->rx_signal_present = FALSE; /* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */ fake_rx_indicator(t, s, T38_IND_NO_SIGNAL); @@ -542,6 +591,7 @@ static void send_hdlc(void *user_data, const uint8_t *msg, int len) s->t38_fe.hdlc_tx.len = len; s->t38_fe.hdlc_tx.ptr = 0; } + /*endif*/ } /*- End of function --------------------------------------------------------*/ @@ -549,6 +599,7 @@ static __inline__ int bits_to_us(t38_terminal_state_t *s, int bits) { if (s->t38_fe.ms_per_tx_chunk == 0 || s->t38_fe.tx_bit_rate == 0) return 0; + /*endif*/ return bits*1000000/s->t38_fe.tx_bit_rate; } /*- End of function --------------------------------------------------------*/ @@ -562,11 +613,49 @@ static void set_octets_per_data_packet(t38_terminal_state_t *s, int bit_rate) /* Make sure we have a positive number (i.e. we didn't truncate to zero). */ if (s->t38_fe.octets_per_data_packet < 1) s->t38_fe.octets_per_data_packet = 1; + /*endif*/ } else { s->t38_fe.octets_per_data_packet = MAX_OCTETS_PER_UNPACED_CHUNK; } + /*endif*/ +} +/*- End of function --------------------------------------------------------*/ + +static int set_no_signal(t38_terminal_state_t *s) +{ + int delay; + + if ((s->t38_fe.chunking_modes & T38_CHUNKING_SEND_REGULAR_INDICATORS)) + { + t38_core_send_indicator(&s->t38_fe.t38, 0x100 | T38_IND_NO_SIGNAL); + s->t38_fe.timed_step = T38_TIMED_STEP_NO_SIGNAL; +#if 0 + if ((s->t38_fe.chunking_modes & T38_CHUNKING_SEND_2S_REGULAR_INDICATORS)) + s->t38_fe.timeout_tx_samples = s->t38_fe.next_tx_samples + us_to_samples(2000000); + else + s->t38_fe.timeout_tx_samples = 0; + /*endif*/ +#endif + return s->t38_fe.ms_per_tx_chunk*1000; + } + /*endif*/ + delay = t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL); + s->t38_fe.timed_step = T38_TIMED_STEP_NONE; + return delay; +} +/*- End of function --------------------------------------------------------*/ + +static int stream_no_signal(t38_terminal_state_t *s) +{ + t38_core_send_indicator(&s->t38_fe.t38, 0x100 | T38_IND_NO_SIGNAL); +#if 0 + if (s->t38_fe.timeout_tx_samples && s->t38_fe.next_tx_samples >= s->t38_fe.timeout_tx_samples) + s->t38_fe.timed_step = T38_TIMED_STEP_NONE; + /*endif*/ +#endif + return s->t38_fe.ms_per_tx_chunk*1000; } /*- End of function --------------------------------------------------------*/ @@ -588,11 +677,27 @@ static int stream_non_ecm(t38_terminal_state_t *s) delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); else delay = 75000; + /*endif*/ fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_2; +#if 0 + fe->timeout_tx_samples = fe->next_tx_samples + + us_to_samples(t38_core_send_training_delay(&fe->t38, fe->next_tx_indicator)); +#endif fe->next_tx_samples = fe->samples; break; case T38_TIMED_STEP_NON_ECM_MODEM_2: /* Switch on a fast modem, and give the training time to complete */ +#if 0 + if ((s->t38_fe.chunking_modes & T38_CHUNKING_SEND_REGULAR_INDICATORS)) + { + delay = t38_core_send_indicator(&fe->t38, 0x100 | fe->next_tx_indicator); + if (fe->next_tx_samples >= fe->timeout_tx_samples) + fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_3; + /*endif*/ + return fe->ms_per_tx_chunk*1000; + } + /*endif*/ +#endif delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator); fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_3; break; @@ -605,6 +710,7 @@ static int stream_non_ecm(t38_terminal_state_t *s) len = t30_non_ecm_get_chunk(&s->t30, buf, fe->octets_per_data_packet); if (len > 0) bit_reverse(buf, buf, len); + /*endif*/ if (len < fe->octets_per_data_packet) { /* That's the end of the image data. */ @@ -630,7 +736,9 @@ static int stream_non_ecm(t38_terminal_state_t *s) delay = 0; break; } + /*endif*/ } + /*endif*/ t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA); delay = bits_to_us(s, 8*len); break; @@ -649,9 +757,11 @@ static int stream_non_ecm(t38_terminal_state_t *s) delay = bits_to_us(s, 8*len); if (s->t38_fe.ms_per_tx_chunk) delay += 60000; + /*endif*/ front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); break; } + /*endif*/ memset(buf, 0, len); t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA); delay = bits_to_us(s, 8*len); @@ -659,11 +769,11 @@ static int stream_non_ecm(t38_terminal_state_t *s) case T38_TIMED_STEP_NON_ECM_MODEM_5: /* This should not be needed, since the message above indicates the end of the signal, but it seems like it can improve compatibility with quirky implementations. */ - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); - fe->timed_step = T38_TIMED_STEP_NONE; - return delay; + return set_no_signal(s); } + /*endswitch*/ } + /*endfor*/ return delay; } /*- End of function --------------------------------------------------------*/ @@ -689,13 +799,31 @@ static int stream_hdlc(t38_terminal_state_t *s) delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); else delay = 75000; + /*endif*/ fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2; +#if 0 + fe->timeout_tx_samples = fe->next_tx_samples + + us_to_samples(t38_core_send_training_delay(&fe->t38, fe->next_tx_indicator)) + + us_to_samples(t38_core_send_flags_delay(&fe->t38, fe->next_tx_indicator)) + + us_to_samples(delay); +#endif fe->next_tx_samples = fe->samples; break; case T38_TIMED_STEP_HDLC_MODEM_2: /* Send HDLC preambling */ - delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator); - delay += t38_core_send_flags_delay(&fe->t38, fe->next_tx_indicator); +#if 0 + if ((s->t38_fe.chunking_modes & T38_CHUNKING_SEND_REGULAR_INDICATORS)) + { + delay = t38_core_send_indicator(&fe->t38, 0x100 | fe->next_tx_indicator); + if (fe->next_tx_samples >= fe->timeout_tx_samples) + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; + /*endif*/ + return fe->ms_per_tx_chunk*1000; + } + /*endif*/ +#endif + delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator) + + t38_core_send_flags_delay(&fe->t38, fe->next_tx_indicator); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; break; case T38_TIMED_STEP_HDLC_MODEM_3: @@ -731,6 +859,7 @@ static int stream_hdlc(t38_terminal_state_t *s) delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits); if (s->t38_fe.ms_per_tx_chunk) delay += 100000; + /*endif*/ front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); } else @@ -743,8 +872,10 @@ static int stream_hdlc(t38_terminal_state_t *s) fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits); } + /*endif*/ break; } + /*endif*/ category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &fe->hdlc_tx.buf[fe->hdlc_tx.ptr], i, category); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_4; @@ -756,6 +887,7 @@ static int stream_hdlc(t38_terminal_state_t *s) t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &fe->hdlc_tx.buf[fe->hdlc_tx.ptr], i, category); fe->hdlc_tx.ptr += i; } + /*endif*/ delay = bits_to_us(s, i*8); break; case T38_TIMED_STEP_HDLC_MODEM_4: @@ -776,15 +908,18 @@ static int stream_hdlc(t38_terminal_state_t *s) delay = bits_to_us(s, fe->hdlc_tx.extra_bits); if (s->t38_fe.ms_per_tx_chunk) delay += 100000; + /*endif*/ front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); break; } + /*endif*/ if (fe->hdlc_tx.len == 0) { /* Now, how did we get here? We have finished a frame, but have no new frame to send, and no end of transmission condition. */ span_log(&s->logging, SPAN_LOG_FLOW, "No new frame or end transmission condition.\n"); } + /*endif*/ /* Finish the current frame off, and prepare for the next one. */ category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, category); @@ -795,11 +930,11 @@ static int stream_hdlc(t38_terminal_state_t *s) case T38_TIMED_STEP_HDLC_MODEM_5: /* Note that some boxes do not like us sending a T38_FIELD_HDLC_SIG_END at this point. A T38_IND_NO_SIGNAL should always be OK. */ - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); - fe->timed_step = T38_TIMED_STEP_NONE; - return delay; + return set_no_signal(s); } + /*endswitch*/ } + /*endfor*/ return delay; } /*- End of function --------------------------------------------------------*/ @@ -836,7 +971,9 @@ static int stream_ced(t38_terminal_state_t *s) front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); return 0; } + /*endswitch*/ } + /*endfor*/ return delay; } /*- End of function --------------------------------------------------------*/ @@ -870,7 +1007,9 @@ static int stream_cng(t38_terminal_state_t *s) fe->current_tx_data_type = T38_DATA_NONE; return delay; } + /*endswitch*/ } + /*endfor*/ return delay; } /*- End of function --------------------------------------------------------*/ @@ -883,6 +1022,7 @@ SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples fe = &s->t38_fe; if (fe->current_rx_type == T30_MODEM_DONE || fe->current_tx_type == T30_MODEM_DONE) return TRUE; + /*endif*/ fe->samples += samples; t30_timer_update(&s->t30, samples); @@ -892,15 +1032,18 @@ SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples fe->timeout_rx_samples = 0; front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE); } + /*endif*/ if (fe->timed_step == T38_TIMED_STEP_NONE) return FALSE; + /*endif*/ /* Wait until the right time comes along, unless we are working in "no delays" mode, while talking to an IAF terminal. */ if (fe->ms_per_tx_chunk && fe->samples < fe->next_tx_samples) return FALSE; + /*endif*/ /* Its time to send something */ delay = 0; - switch (fe->timed_step & 0xFFF0) + switch ((fe->timed_step & 0xFFF0)) { case T38_TIMED_STEP_NON_ECM_MODEM: delay = stream_non_ecm(s); @@ -919,7 +1062,11 @@ SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples fe->timed_step = T38_TIMED_STEP_NONE; front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); break; + case T38_TIMED_STEP_NO_SIGNAL: + delay = stream_no_signal(s); + break; } + /*endswitch*/ fe->next_tx_samples += us_to_samples(delay); return FALSE; } @@ -946,11 +1093,13 @@ static void start_tx(t38_terminal_front_end_state_t *fe, int use_hdlc) fe->timed_step = (use_hdlc) ? T38_TIMED_STEP_HDLC_MODEM : T38_TIMED_STEP_NON_ECM_MODEM; if (fe->next_tx_samples < fe->samples) fe->next_tx_samples = fe->samples; + /*endif*/ } else { /* Start the fast streaming transmission process. */ } + /*endif*/ } /*- End of function --------------------------------------------------------*/ @@ -964,6 +1113,7 @@ static void set_tx_type(void *user_data, int type, int bit_rate, int short_train span_log(&s->logging, SPAN_LOG_FLOW, "Set tx type %d\n", type); if (fe->current_tx_type == type) return; + /*endif*/ set_octets_per_data_packet(s, bit_rate); switch (type) @@ -972,6 +1122,7 @@ static void set_tx_type(void *user_data, int type, int bit_rate, int short_train /* If a "no signal" indicator is waiting to be played out, don't disturb it. */ if (fe->timed_step != T38_TIMED_STEP_NON_ECM_MODEM_5 && fe->timed_step != T38_TIMED_STEP_HDLC_MODEM_5) fe->timed_step = T38_TIMED_STEP_NONE; + /*endif*/ fe->current_tx_data_type = T38_DATA_NONE; break; case T30_MODEM_PAUSE: @@ -1006,6 +1157,7 @@ static void set_tx_type(void *user_data, int type, int bit_rate, int short_train fe->current_tx_data_type = T38_DATA_V27TER_4800; break; } + /*endswitch*/ start_tx(fe, use_hdlc); break; case T30_MODEM_V29: @@ -1020,6 +1172,7 @@ static void set_tx_type(void *user_data, int type, int bit_rate, int short_train fe->current_tx_data_type = T38_DATA_V29_9600; break; } + /*endswitch*/ start_tx(fe, use_hdlc); break; case T30_MODEM_V17: @@ -1042,6 +1195,7 @@ static void set_tx_type(void *user_data, int type, int bit_rate, int short_train fe->current_tx_data_type = T38_DATA_V17_14400; break; } + /*endswitch*/ start_tx(fe, use_hdlc); break; case T30_MODEM_DONE: @@ -1050,13 +1204,14 @@ static void set_tx_type(void *user_data, int type, int bit_rate, int short_train fe->current_tx_data_type = T38_DATA_NONE; break; } + /*endswitch*/ fe->current_tx_type = type; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int without_pacing) +SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int config) { - if (without_pacing) + if ((config & T38_TERMINAL_OPTION_NO_PACING)) { /* Continuous streaming mode, as used for TPKT over TCP transport */ /* Inhibit indicator packets */ @@ -1066,6 +1221,7 @@ SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int without_ t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA, 1); t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA_END, 1); s->t38_fe.ms_per_tx_chunk = 0; + s->t38_fe.chunking_modes &= ~T38_CHUNKING_SEND_REGULAR_INDICATORS; } else { @@ -1075,8 +1231,19 @@ SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int without_ t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA_END, DATA_END_TX_COUNT); t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA, DATA_TX_COUNT); t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_IMAGE_DATA_END, DATA_END_TX_COUNT); - s->t38_fe.ms_per_tx_chunk = MS_PER_TX_CHUNK; + s->t38_fe.ms_per_tx_chunk = DEFAULT_MS_PER_TX_CHUNK; + if ((config & (T38_TERMINAL_OPTION_REGULAR_INDICATORS | T38_TERMINAL_OPTION_2S_REPEATING_INDICATORS))) + s->t38_fe.chunking_modes |= T38_CHUNKING_SEND_REGULAR_INDICATORS; + else + s->t38_fe.chunking_modes &= ~T38_CHUNKING_SEND_REGULAR_INDICATORS; + /*endif*/ + if ((config & T38_TERMINAL_OPTION_2S_REPEATING_INDICATORS)) + s->t38_fe.chunking_modes |= T38_CHUNKING_SEND_2S_REGULAR_INDICATORS; + else + s->t38_fe.chunking_modes &= ~T38_CHUNKING_SEND_2S_REGULAR_INDICATORS; + /*endif*/ } + /*endif*/ set_octets_per_data_packet(s, 300); } /*- End of function --------------------------------------------------------*/ @@ -1087,6 +1254,7 @@ SPAN_DECLARE(void) t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_te s->t38_fe.chunking_modes |= T38_CHUNKING_ALLOW_TEP_TIME; else s->t38_fe.chunking_modes &= ~T38_CHUNKING_ALLOW_TEP_TIME; + /*endif*/ t38_set_tep_handling(&s->t38_fe.t38, use_tep); } /*- End of function --------------------------------------------------------*/ @@ -1097,6 +1265,7 @@ SPAN_DECLARE(void) t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, in s->t38_fe.iaf |= T30_IAF_MODE_NO_FILL_BITS; else s->t38_fe.iaf &= ~T30_IAF_MODE_NO_FILL_BITS; + /*endif*/ t30_set_iaf_mode(&s->t30, s->t38_fe.iaf); } /*- End of function --------------------------------------------------------*/ @@ -1113,6 +1282,27 @@ SPAN_DECLARE(t38_core_state_t *) t38_terminal_get_t38_core_state(t38_terminal_st } /*- End of function --------------------------------------------------------*/ +static int t38_terminal_t38_fe_restart(t38_terminal_state_t *t) +{ + t38_terminal_front_end_state_t *s; + + s = &t->t38_fe; + t38_core_restart(&s->t38); + + s->rx_signal_present = FALSE; + s->timed_step = T38_TIMED_STEP_NONE; + //s->iaf = T30_IAF_MODE_T37 | T30_IAF_MODE_T38; + s->iaf = T30_IAF_MODE_T38; + + s->current_tx_data_type = T38_DATA_NONE; + s->next_tx_samples = 0; + + s->hdlc_tx.ptr = 0; + + return 0; +} +/*- End of function --------------------------------------------------------*/ + static int t38_terminal_t38_fe_init(t38_terminal_state_t *t, t38_tx_packet_handler_t *tx_packet_handler, void *tx_packet_user_data) @@ -1150,6 +1340,15 @@ SPAN_DECLARE(logging_state_t *) t38_terminal_get_logging_state(t38_terminal_stat } /*- End of function --------------------------------------------------------*/ +SPAN_DECLARE(int) t38_terminal_restart(t38_terminal_state_t *s, + int calling_party) +{ + t38_terminal_t38_fe_restart(s); + t30_restart(&s->t30); + return 0; +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s, int calling_party, t38_tx_packet_handler_t *tx_packet_handler, @@ -1157,19 +1356,22 @@ SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s, { if (tx_packet_handler == NULL) return NULL; + /*endif*/ if (s == NULL) { if ((s = (t38_terminal_state_t *) malloc(sizeof(*s))) == NULL) return NULL; + /*endif*/ } + /*endif*/ memset(s, 0, sizeof(*s)); span_log_init(&s->logging, SPAN_LOG_NONE, NULL); span_log_set_protocol(&s->logging, "T.38T"); t38_terminal_t38_fe_init(s, tx_packet_handler, tx_packet_user_data); - t38_terminal_set_config(s, FALSE); + t38_terminal_set_config(s, 0); t30_init(&s->t30, calling_party, diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index b5321a5540..dfdf914804 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -2,7 +2,7 @@ /* * SpanDSP - a series of DSP components for telephony * - * t4_rx.c - ITU T.4 FAX receive processing + * t4_rx.c - ITU T.4 FAX image receive processing * * Written by Steve Underwood * @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t4_rx.c,v 1.12.2.8 2009/12/21 17:18:39 steveu Exp $ */ /* @@ -86,9 +84,21 @@ #include "spandsp/async.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/t81_t82_arith_coding.h" +#include "spandsp/t85.h" +#endif +#include "spandsp/t4_t6_decode.h" +#include "spandsp/t4_t6_encode.h" #include "spandsp/version.h" #include "spandsp/private/logging.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/private/t81_t82_arith_coding.h" +#include "spandsp/private/t85.h" +#endif +#include "spandsp/private/t4_t6_decode.h" +#include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" @@ -102,6 +112,8 @@ /*! The number of EOLs to check at the end of a T.6 page */ #define EOLS_TO_END_T6_RX_PAGE 2 +#include "t4_t6_decode_states.h" + #if defined(T4_STATE_DEBUGGING) static void STATE_TRACE(const char *format, ...) { @@ -116,19 +128,6 @@ static void STATE_TRACE(const char *format, ...) #define STATE_TRACE(...) /**/ #endif -/*! T.4 run length table entry */ -typedef struct -{ - /*! Length of T.4 code, in bits */ - uint16_t length; - /*! T.4 code */ - uint16_t code; - /*! Run length, in bits */ - int16_t run_length; -} t4_run_table_entry_t; - -#include "t4_t6_decode_states.h" - #if defined(HAVE_LIBTIFF) static int set_tiff_directory_info(t4_state_t *s) { @@ -1195,7 +1194,7 @@ SPAN_DECLARE(void) t4_rx_set_model(t4_state_t *s, const char *model) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(void) t4_get_transfer_statistics(t4_state_t *s, t4_stats_t *t) +SPAN_DECLARE(void) t4_rx_get_transfer_statistics(t4_state_t *s, t4_stats_t *t) { t->pages_transferred = s->current_page - s->tiff.start_page; t->pages_in_file = s->tiff.pages_in_file; @@ -1214,12 +1213,26 @@ SPAN_DECLARE(const char *) t4_encoding_to_str(int encoding) { switch (encoding) { + case T4_COMPRESSION_NONE: + return "None"; case T4_COMPRESSION_ITU_T4_1D: return "T.4 1-D"; case T4_COMPRESSION_ITU_T4_2D: return "T.4 2-D"; case T4_COMPRESSION_ITU_T6: return "T.6"; + case T4_COMPRESSION_ITU_T85: + return "T.85"; + case T4_COMPRESSION_ITU_T85_L0: + return "T.85(L0)"; + case T4_COMPRESSION_ITU_T43: + return "T.43"; + case T4_COMPRESSION_ITU_T45: + return "T.45"; + case T4_COMPRESSION_ITU_T81: + return "T.81"; + case T4_COMPRESSION_ITU_SYCC_T81: + return "sYCC T.81"; } return "???"; } diff --git a/libs/spandsp/src/t4_t6_decode_states.h b/libs/spandsp/src/t4_t6_decode_states.h index 71619e5d6a..daf0e1a711 100644 --- a/libs/spandsp/src/t4_t6_decode_states.h +++ b/libs/spandsp/src/t4_t6_decode_states.h @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t4_t6_decode_states.h,v 1.1.2.4 2009/12/19 10:21:43 steveu Exp $ */ /* Legitimate runs of zero bits which are the tail end of one code diff --git a/libs/spandsp/src/t4_tx.c b/libs/spandsp/src/t4_tx.c index 4efb3ad449..55f15477f4 100644 --- a/libs/spandsp/src/t4_tx.c +++ b/libs/spandsp/src/t4_tx.c @@ -2,7 +2,7 @@ /* * SpanDSP - a series of DSP components for telephony * - * t4_tx.c - ITU T.4 FAX transmit processing + * t4_tx.c - ITU T.4 FAX image transmit processing * * Written by Steve Underwood * @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: t4_tx.c,v 1.13.2.9 2009/12/21 17:18:40 steveu Exp $ */ /* @@ -81,11 +79,23 @@ #include "spandsp/logging.h" #include "spandsp/bit_operations.h" #include "spandsp/async.h" +#include "spandsp/timezone.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" -#include "spandsp/version.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/t81_t82_arith_coding.h" +#include "spandsp/t85.h" +#endif +#include "spandsp/t4_t6_decode.h" +#include "spandsp/t4_t6_encode.h" #include "spandsp/private/logging.h" +#if defined(SPANDSP_SUPPORT_T85) +#include "spandsp/private/t81_t82_arith_coding.h" +#include "spandsp/private/t85.h" +#endif +#include "spandsp/private/t4_t6_decode.h" +#include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/t4_rx.h" #include "spandsp/private/t4_tx.h" @@ -371,7 +381,10 @@ static void make_header(t4_state_t *s, char *header) }; time(&now); - tm = *localtime(&now); + if (s->tz) + tz_localtime(s->tz, &tm, now); + else + tm = *localtime(&now); snprintf(header, 132, " %2d-%s-%d %02d:%02d %-50s %-21s p.%d", @@ -380,8 +393,8 @@ static void make_header(t4_state_t *s, char *header) tm.tm_year + 1900, tm.tm_hour, tm.tm_min, - s->t4_t6_tx.header_info, - s->tiff.local_ident, + s->header_info, + (s->tiff.local_ident) ? s->tiff.local_ident : "", s->current_page + 1); } /*- End of function --------------------------------------------------------*/ @@ -1321,7 +1334,7 @@ SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s) s->min_row_bits = INT_MAX; s->max_row_bits = 0; - if (s->t4_t6_tx.header_info && s->t4_t6_tx.header_info[0]) + if (s->header_info && s->header_info[0]) { if (t4_tx_put_fax_header(s)) return -1; @@ -1482,7 +1495,7 @@ SPAN_DECLARE(void) t4_tx_set_tx_encoding(t4_state_t *s, int encoding) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(void) t4_tx_set_min_row_bits(t4_state_t *s, int bits) +SPAN_DECLARE(void) t4_tx_set_min_bits_per_row(t4_state_t *s, int bits) { s->t4_t6_tx.min_bits_per_row = bits; } @@ -1496,7 +1509,13 @@ SPAN_DECLARE(void) t4_tx_set_local_ident(t4_state_t *s, const char *ident) SPAN_DECLARE(void) t4_tx_set_header_info(t4_state_t *s, const char *info) { - s->t4_t6_tx.header_info = (info && info[0]) ? info : NULL; + s->header_info = (info && info[0]) ? info : NULL; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_tx_set_header_tz(t4_state_t *s, const char *tzstring) +{ + s->tz = tz_init(s->tz, tzstring); } /*- End of function --------------------------------------------------------*/ @@ -1536,4 +1555,19 @@ SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_state_t *s) return s->current_page; } /*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t4_tx_get_transfer_statistics(t4_state_t *s, t4_stats_t *t) +{ + t->pages_transferred = s->current_page - s->tiff.start_page; + t->pages_in_file = s->tiff.pages_in_file; + t->width = s->image_width; + t->length = s->image_length; + t->bad_rows = s->t4_t6_rx.bad_rows; + t->longest_bad_row_run = s->t4_t6_rx.longest_bad_row_run; + t->x_resolution = s->x_resolution; + t->y_resolution = s->y_resolution; + t->encoding = s->line_encoding; + t->line_image_size = s->line_image_size/8; +} +/*- End of function --------------------------------------------------------*/ /*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/testcpuid.c b/libs/spandsp/src/testcpuid.c index c55c349ab9..98c46a0581 100644 --- a/libs/spandsp/src/testcpuid.c +++ b/libs/spandsp/src/testcpuid.c @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: testcpuid.c,v 1.13 2009/01/05 13:48:31 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/time_scale.c b/libs/spandsp/src/time_scale.c index cd3f7d028a..3a85cae71c 100644 --- a/libs/spandsp/src/time_scale.c +++ b/libs/spandsp/src/time_scale.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: time_scale.c,v 1.30 2009/02/10 13:06:47 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/tone_detect.c b/libs/spandsp/src/tone_detect.c index 7ac1a12dba..2887af51d6 100644 --- a/libs/spandsp/src/tone_detect.c +++ b/libs/spandsp/src/tone_detect.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: tone_detect.c,v 1.53 2009/04/12 09:12:10 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/tone_generate.c b/libs/spandsp/src/tone_generate.c index 4b65610289..437865b3d3 100644 --- a/libs/spandsp/src/tone_generate.c +++ b/libs/spandsp/src/tone_generate.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: tone_generate.c,v 1.56 2010/05/23 14:02:21 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h b/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h index a84950dcc7..ad9b1fa499 100644 --- a/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h +++ b/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h @@ -23,8 +23,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v17_v32bis_rx_constellation_maps.h,v 1.1.4.1 2009/12/24 16:52:30 steveu Exp $ */ /* The following table maps the 8 soft-decisions associated with every possible point in the diff --git a/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h b/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h index d2a231c233..4abe80d93d 100644 --- a/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h +++ b/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h @@ -23,8 +23,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v17_v32bis_tx_constellation_maps.h,v 1.1.4.1 2009/12/24 16:52:30 steveu Exp $ */ #if defined(SPANDSP_USE_FIXED_POINTx) diff --git a/libs/spandsp/src/v17rx.c b/libs/spandsp/src/v17rx.c index 78311a8a43..974448b46a 100644 --- a/libs/spandsp/src/v17rx.c +++ b/libs/spandsp/src/v17rx.c @@ -289,6 +289,7 @@ static void tune_equalizer(v17_rx_state_t *s, const complexf_t *z, const complex cvec_circular_lmsf(s->eq_buf, s->eq_coeff, V17_EQUALIZER_LEN, s->eq_step, &err); } #endif +/*- End of function --------------------------------------------------------*/ static int descramble(v17_rx_state_t *s, int in_bit) { @@ -1370,8 +1371,8 @@ SPAN_DECLARE(int) v17_rx_restart(v17_rx_state_t *s, int bit_rate, int short_trai #endif } s->last_sample = 0; - span_log(&s->logging, SPAN_LOG_FLOW, "Phase rates %f %f\n", dds_frequencyf(s->carrier_phase_rate), dds_frequencyf(s->carrier_phase_rate_save)); span_log(&s->logging, SPAN_LOG_FLOW, "Gains %f %f\n", s->agc_scaling_save, s->agc_scaling); + span_log(&s->logging, SPAN_LOG_FLOW, "Phase rates %f %f\n", dds_frequencyf(s->carrier_phase_rate), dds_frequencyf(s->carrier_phase_rate_save)); /* Initialise the working data for symbol timing synchronisation */ #if defined(SPANDSP_USE_FIXED_POINTx) diff --git a/libs/spandsp/src/v17tx.c b/libs/spandsp/src/v17tx.c index 83c6bcce9c..8cce8940e9 100644 --- a/libs/spandsp/src/v17tx.c +++ b/libs/spandsp/src/v17tx.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v17tx.c,v 1.75.4.1 2009/12/24 16:52:30 steveu Exp $ */ /*! \file */ @@ -49,6 +47,8 @@ #include "spandsp/complex.h" #include "spandsp/vector_float.h" #include "spandsp/complex_vector_float.h" +#include "spandsp/vector_int.h" +#include "spandsp/complex_vector_int.h" #include "spandsp/async.h" #include "spandsp/dds.h" #include "spandsp/power_meter.h" @@ -410,7 +410,7 @@ SPAN_DECLARE(int) v17_tx_restart(v17_tx_state_t *s, int bit_rate, int tep, int s /* NB: some modems seem to use 3 instead of 1 for long training */ s->diff = (short_train) ? 0 : 1; #if defined(SPANDSP_USE_FIXED_POINT) - memset(s->rrc_filter, 0, sizeof(s->rrc_filter)); + cvec_zeroi16(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); #else cvec_zerof(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); #endif diff --git a/libs/spandsp/src/v18.c b/libs/spandsp/src/v18.c index 067bd9e251..d84b56edc4 100644 --- a/libs/spandsp/src/v18.c +++ b/libs/spandsp/src/v18.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v18.c,v 1.12 2009/11/04 15:52:06 steveu Exp $ */ /*! \file */ @@ -114,19 +112,19 @@ static const struct dtmf_to_ascii_s dtmf_to_ascii[] = {"##9", 'Z'}, {"##0", ' '}, #if defined(WIN32) - {"#*1", 'X'}, // (Note 1) 111 1011 - {"#*2", 'X'}, // (Note 1) 111 1100 - {"#*3", 'X'}, // (Note 1) 111 1101 - {"#*4", 'X'}, // (Note 1) 101 1011 - {"#*5", 'X'}, // (Note 1) 101 1100 - {"#*6", 'X'}, // (Note 1) 101 1101 + {"#*1", 'X'}, // (Note 1) 111 1011 + {"#*2", 'X'}, // (Note 1) 111 1100 + {"#*3", 'X'}, // (Note 1) 111 1101 + {"#*4", 'X'}, // (Note 1) 101 1011 + {"#*5", 'X'}, // (Note 1) 101 1100 + {"#*6", 'X'}, // (Note 1) 101 1101 #else - {"#*1", 'æ'}, // (Note 1) 111 1011 - {"#*2", 'ø'}, // (Note 1) 111 1100 - {"#*3", 'å'}, // (Note 1) 111 1101 - {"#*4", 'Æ'}, // (Note 1) 101 1011 - {"#*5", 'Ø'}, // (Note 1) 101 1100 - {"#*6", 'Å'}, // (Note 1) 101 1101 + {"#*1", 0xE6}, // (Note 1) 111 1011 + {"#*2", 0xF8}, // (Note 1) 111 1100 + {"#*3", 0xE5}, // (Note 1) 111 1101 + {"#*4", 0xC6}, // (Note 1) 101 1011 + {"#*5", 0xD8}, // (Note 1) 101 1100 + {"#*6", 0xC5}, // (Note 1) 101 1101 #endif {"#0", '?'}, {"#1", 'c'}, @@ -221,7 +219,7 @@ static const char *ascii_to_dtmf[128] = "", /* $ */ "**5", /* % */ "**1", /* & >> + */ - "", /* ’ */ + "", /* 0x92 */ "**6", /* ( */ "**7", /* ) */ "#9", /* _ >> . */ @@ -273,12 +271,12 @@ static const char *ascii_to_dtmf[128] = "###8", /* X */ "##*9", /* Y */ "##9", /* Z */ - "#*4", /* Æ (National code) */ - "#*5", /* Ø (National code) */ - "#*6", /* Å (National code) */ + "#*4", /* 0xC6 (National code) */ + "#*5", /* 0xD8 (National code) */ + "#*6", /* 0xC5 (National code) */ "", /* ^ */ "0", /* _ >> SPACE */ - "", /* ’ */ + "", /* 0x92 */ "*1", /* a */ "1", /* b */ "#1", /* c */ @@ -305,9 +303,9 @@ static const char *ascii_to_dtmf[128] = "#8", /* x */ "*9", /* y */ "9", /* z */ - "#*1", /* æ (National code) */ - "#*2", /* ø (National code) */ - "#*3", /* å (National code) */ + "#*1", /* 0xE6 (National code) */ + "#*2", /* 0xF8 (National code) */ + "#*3", /* 0xE5 (National code) */ "0", /* ~ >> SPACE */ "*0" /* DEL >> BACK SPACE */ }; @@ -582,13 +580,7 @@ static int v18_tdd_get_async_byte(void *user_data) s = (v18_state_t *) user_data; if ((ch = queue_read_byte(&s->queue.queue)) >= 0) - { - int space; - int cont; - space = queue_free_space(&s->queue.queue); - cont = queue_contents(&s->queue.queue); return ch; - } if (s->tx_signal_on) { /* The FSK should now be switched off. */ diff --git a/libs/spandsp/src/v22bis_rx.c b/libs/spandsp/src/v22bis_rx.c index fc5e3a9f23..91b009ce85 100644 --- a/libs/spandsp/src/v22bis_rx.c +++ b/libs/spandsp/src/v22bis_rx.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v22bis_rx.c,v 1.69 2009/11/04 15:52:06 steveu Exp $ */ /*! \file */ @@ -57,6 +55,8 @@ #include "spandsp/complex.h" #include "spandsp/vector_float.h" #include "spandsp/complex_vector_float.h" +#include "spandsp/vector_int.h" +#include "spandsp/complex_vector_int.h" #include "spandsp/async.h" #include "spandsp/power_meter.h" #include "spandsp/arctan2.h" @@ -694,7 +694,6 @@ static void process_half_baud(v22bis_state_t *s, const complexf_t *sample) SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int len) { int i; - int j; int step; complexf_t z; complexf_t zz; @@ -708,8 +707,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l /* Complex bandpass filter the signal, using a pair of FIRs, and RRC coeffs shifted to centre at 1200Hz or 2400Hz. The filters support 12 fractional phase shifts, to permit signal extraction very close to the middle of a symbol. */ - s->rx.rrc_filter[s->rx.rrc_filter_step] = - s->rx.rrc_filter[s->rx.rrc_filter_step + V22BIS_RX_FILTER_STEPS] = amp[i]; + s->rx.rrc_filter[s->rx.rrc_filter_step] = amp[i]; if (++s->rx.rrc_filter_step >= V22BIS_RX_FILTER_STEPS) s->rx.rrc_filter_step = 0; @@ -718,15 +716,19 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l own transmitted signal suppressed. */ if (s->calling_party) { - ii = rx_pulseshaper_2400_re[6][0]*s->rx.rrc_filter[s->rx.rrc_filter_step]; - for (j = 1; j < V22BIS_RX_FILTER_STEPS; j++) - ii += rx_pulseshaper_2400_re[6][j]*s->rx.rrc_filter[j + s->rx.rrc_filter_step]; +#if defined(SPANDSP_USE_FIXED_POINT) + ii = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_2400_re[6], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); +#else + ii = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_2400_re[6], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); +#endif } else { - ii = rx_pulseshaper_1200_re[6][0]*s->rx.rrc_filter[s->rx.rrc_filter_step]; - for (j = 1; j < V22BIS_RX_FILTER_STEPS; j++) - ii += rx_pulseshaper_1200_re[6][j]*s->rx.rrc_filter[j + s->rx.rrc_filter_step]; +#if defined(SPANDSP_USE_FIXED_POINT) + ii = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_1200_re[6], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); +#else + ii = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_1200_re[6], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); +#endif } power = power_meter_update(&(s->rx.rx_power), (int16_t) ii); if (s->rx.signal_present) @@ -771,23 +773,23 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l s->rx.eq_put_step += PULSESHAPER_COEFF_SETS*40/(3*2); if (s->calling_party) { - ii = rx_pulseshaper_2400_re[step][0]*s->rx.rrc_filter[s->rx.rrc_filter_step]; - qq = rx_pulseshaper_2400_im[step][0]*s->rx.rrc_filter[s->rx.rrc_filter_step]; - for (j = 1; j < V22BIS_RX_FILTER_STEPS; j++) - { - ii += rx_pulseshaper_2400_re[step][j]*s->rx.rrc_filter[j + s->rx.rrc_filter_step]; - qq += rx_pulseshaper_2400_im[step][j]*s->rx.rrc_filter[j + s->rx.rrc_filter_step]; - } +#if defined(SPANDSP_USE_FIXED_POINT) + ii = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_2400_re[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); + qq = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_2400_im[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); +#else + ii = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_2400_re[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); + qq = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_2400_im[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); +#endif } else { - ii = rx_pulseshaper_1200_re[step][0]*s->rx.rrc_filter[s->rx.rrc_filter_step]; - qq = rx_pulseshaper_1200_im[step][0]*s->rx.rrc_filter[s->rx.rrc_filter_step]; - for (j = 1; j < V22BIS_RX_FILTER_STEPS; j++) - { - ii += rx_pulseshaper_1200_re[step][j]*s->rx.rrc_filter[j + s->rx.rrc_filter_step]; - qq += rx_pulseshaper_1200_im[step][j]*s->rx.rrc_filter[j + s->rx.rrc_filter_step]; - } +#if defined(SPANDSP_USE_FIXED_POINT) + ii = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_1200_re[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); + qq = vec_circular_dot_prodi16(s->rx.rrc_filter, rx_pulseshaper_1200_im[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); +#else + ii = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_1200_re[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); + qq = vec_circular_dot_prodf(s->rx.rrc_filter, rx_pulseshaper_1200_im[step], V22BIS_RX_FILTER_STEPS, s->rx.rrc_filter_step); +#endif } sample.re = ii*s->rx.agc_scaling; sample.im = qq*s->rx.agc_scaling; @@ -804,7 +806,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx(v22bis_state_t *s, const int16_t amp[], int l } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) v22bis_rx_fillin(v22bis_state_t *s, int len) +SPAN_DECLARE_NONSTD(int) v22bis_rx_fillin(v22bis_state_t *s, int len) { int i; @@ -828,7 +830,11 @@ SPAN_DECLARE(int) v22bis_rx_fillin(v22bis_state_t *s, int len) int v22bis_rx_restart(v22bis_state_t *s) { +#if defined(SPANDSP_USE_FIXED_POINTx) + vec_zeroi16(s->rx.rrc_filter, sizeof(s->rx.rrc_filter)/sizeof(s->rx.rrc_filter[0])); +#else vec_zerof(s->rx.rrc_filter, sizeof(s->rx.rrc_filter)/sizeof(s->rx.rrc_filter[0])); +#endif s->rx.rrc_filter_step = 0; s->rx.scramble_reg = 0; s->rx.scrambler_pattern_count = 0; diff --git a/libs/spandsp/src/v22bis_tx.c b/libs/spandsp/src/v22bis_tx.c index 58a0bd589b..5619e87120 100644 --- a/libs/spandsp/src/v22bis_tx.c +++ b/libs/spandsp/src/v22bis_tx.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v22bis_tx.c,v 1.64 2009/11/04 15:52:06 steveu Exp $ */ /*! \file */ @@ -52,6 +50,8 @@ #include "spandsp/complex.h" #include "spandsp/vector_float.h" #include "spandsp/complex_vector_float.h" +#include "spandsp/vector_int.h" +#include "spandsp/complex_vector_int.h" #include "spandsp/async.h" #include "spandsp/dds.h" #include "spandsp/power_meter.h" @@ -478,7 +478,7 @@ SPAN_DECLARE_NONSTD(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len) /* Now create and modulate the carrier */ z = dds_complexf(&(s->tx.carrier_phase), s->tx.carrier_phase_rate); famp = (x.re*z.re - x.im*z.im)*s->tx.gain; - if (s->tx.guard_phase_rate && (s->tx.rrc_filter[s->tx.rrc_filter_step].re != 0.0f || s->tx.rrc_filter[i + s->tx.rrc_filter_step].im != 0.0f)) + if (s->tx.guard_phase_rate && (s->tx.rrc_filter[s->tx.rrc_filter_step].re != 0.0f || s->tx.rrc_filter[s->tx.rrc_filter_step].im != 0.0f)) { /* Add the guard tone */ famp += dds_modf(&(s->tx.guard_phase), s->tx.guard_phase_rate, s->tx.guard_level, 0); @@ -625,7 +625,7 @@ SPAN_DECLARE(int) v22bis_remote_loopback(v22bis_state_t *s, int enable) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) v22bis_current_bit_rate(v22bis_state_t *s) +SPAN_DECLARE(int) v22bis_get_current_bit_rate(v22bis_state_t *s) { return s->negotiated_bit_rate; } diff --git a/libs/spandsp/src/v27ter_rx.c b/libs/spandsp/src/v27ter_rx.c index 96e94c7ac0..8685ef1d77 100644 --- a/libs/spandsp/src/v27ter_rx.c +++ b/libs/spandsp/src/v27ter_rx.c @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v27ter_rx.c,v 1.131 2009/07/08 15:11:09 steveu Exp $ */ /*! \file */ @@ -99,9 +97,6 @@ /*! The length of training segment 6, in symbols */ #define V27TER_TRAINING_SEG_6_LEN 8 -/*! The length of the equalizer buffer */ -#define V27TER_EQUALIZER_LEN (V27TER_EQUALIZER_PRE_LEN + 1 + V27TER_EQUALIZER_POST_LEN) - enum { TRAINING_STAGE_NORMAL_OPERATION = 0, @@ -220,12 +215,12 @@ static void equalizer_reset(v27ter_rx_state_t *s) /* Start with an equalizer based on everything being perfect. */ #if defined(SPANDSP_USE_FIXED_POINTx) cvec_zeroi16(s->eq_coeff, V27TER_EQUALIZER_LEN); - s->eq_coeff[V27TER_EQUALIZER_PRE_LEN] = complex_seti16(1.414f*FP_FACTOR, 0); + s->eq_coeff[V27TER_EQUALIZER_PRE_LEN + 1] = complex_seti16(1.414f*FP_FACTOR, 0); cvec_zeroi16(s->eq_buf, V27TER_EQUALIZER_LEN); s->eq_delta = 32768.0f*EQUALIZER_DELTA/V27TER_EQUALIZER_LEN); #else cvec_zerof(s->eq_coeff, V27TER_EQUALIZER_LEN); - s->eq_coeff[V27TER_EQUALIZER_PRE_LEN] = complex_setf(1.414f, 0.0f); + s->eq_coeff[V27TER_EQUALIZER_PRE_LEN + 1] = complex_setf(1.414f, 0.0f); cvec_zerof(s->eq_buf, V27TER_EQUALIZER_LEN); s->eq_delta = EQUALIZER_DELTA/V27TER_EQUALIZER_LEN; #endif @@ -485,13 +480,13 @@ static __inline__ void symbol_sync(v27ter_rx_state_t *s) /* This routine adapts the position of the half baud samples entering the equalizer. */ /* Perform a Gardner test for baud alignment */ - p = s->eq_buf[(s->eq_step - 3) & V27TER_EQUALIZER_LEN].re - - s->eq_buf[(s->eq_step - 1) & V27TER_EQUALIZER_LEN].re; - p *= s->eq_buf[(s->eq_step - 2) & V27TER_EQUALIZER_LEN].re; + p = s->eq_buf[(s->eq_step - 3) & (V27TER_EQUALIZER_LEN - 1)].re + - s->eq_buf[(s->eq_step - 1) & (V27TER_EQUALIZER_LEN - 1)].re; + p *= s->eq_buf[(s->eq_step - 2) & (V27TER_EQUALIZER_LEN - 1)].re; - q = s->eq_buf[(s->eq_step - 3) & V27TER_EQUALIZER_LEN].im - - s->eq_buf[(s->eq_step - 1) & V27TER_EQUALIZER_LEN].im; - q *= s->eq_buf[(s->eq_step - 2) & V27TER_EQUALIZER_LEN].im; + q = s->eq_buf[(s->eq_step - 3) & (V27TER_EQUALIZER_LEN - 1)].im + - s->eq_buf[(s->eq_step - 1) & (V27TER_EQUALIZER_LEN - 1)].im; + q *= s->eq_buf[(s->eq_step - 2) & (V27TER_EQUALIZER_LEN - 1)].im; s->gardner_integrate += (p + q > 0.0f) ? s->gardner_step : -s->gardner_step; @@ -706,7 +701,8 @@ static __inline__ void process_half_baud(v27ter_rx_state_t *s, const complexf_t #if defined(SPANDSP_USE_FIXED_POINTx) z1.re = z.re/(float) FP_FACTOR; z1.im = z.im/(float) FP_FACTOR; - zz = complex_subf(&z, target); + zz.re = target->re; + zz.im = target->im; zz = complex_subf(&z1, &zz); s->training_error += powerf(&zz); #else @@ -981,7 +977,7 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx(v27ter_rx_state_t *s, const int16_t amp[], in } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) v27ter_rx_fillin(v27ter_rx_state_t *s, int len) +SPAN_DECLARE_NONSTD(int) v27ter_rx_fillin(v27ter_rx_state_t *s, int len) { int i; diff --git a/libs/spandsp/src/v27ter_tx.c b/libs/spandsp/src/v27ter_tx.c index 1145b75ba6..5f35510231 100644 --- a/libs/spandsp/src/v27ter_tx.c +++ b/libs/spandsp/src/v27ter_tx.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v27ter_tx.c,v 1.76 2009/06/02 16:03:56 steveu Exp $ */ /*! \file */ @@ -49,6 +47,8 @@ #include "spandsp/complex.h" #include "spandsp/vector_float.h" #include "spandsp/complex_vector_float.h" +#include "spandsp/vector_int.h" +#include "spandsp/complex_vector_int.h" #include "spandsp/async.h" #include "spandsp/dds.h" #include "spandsp/power_meter.h" @@ -393,7 +393,7 @@ SPAN_DECLARE(int) v27ter_tx_restart(v27ter_tx_state_t *s, int bit_rate, int tep) return -1; s->bit_rate = bit_rate; #if defined(SPANDSP_USE_FIXED_POINT) - memset(s->rrc_filter, 0, sizeof(s->rrc_filter)); + cvec_zeroi16(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); #else cvec_zerof(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); #endif diff --git a/libs/spandsp/src/v29rx.c b/libs/spandsp/src/v29rx.c index ff4dc95570..17ddada9e8 100644 --- a/libs/spandsp/src/v29rx.c +++ b/libs/spandsp/src/v29rx.c @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v29rx.c,v 1.167.4.5 2009/12/28 12:20:47 steveu Exp $ */ /*! \file */ @@ -89,9 +87,6 @@ /*! The length of training segment 4, in symbols */ #define V29_TRAINING_SEG_4_LEN 48 -/*! The length of the equalizer buffer */ -#define V29_EQUALIZER_LEN (V29_EQUALIZER_PRE_LEN + 1 + V29_EQUALIZER_POST_LEN) - enum { TRAINING_STAGE_NORMAL_OPERATION = 0, @@ -233,12 +228,12 @@ static void equalizer_reset(v29_rx_state_t *s) /* Start with an equalizer based on everything being perfect */ #if defined(SPANDSP_USE_FIXED_POINT) cvec_zeroi16(s->eq_coeff, V29_EQUALIZER_LEN); - s->eq_coeff[V29_EQUALIZER_POST_LEN] = complex_seti16(3*FP_FACTOR, 0*FP_FACTOR); + s->eq_coeff[V29_EQUALIZER_PRE_LEN] = complex_seti16(3*FP_FACTOR, 0*FP_FACTOR); cvec_zeroi16(s->eq_buf, V29_EQUALIZER_LEN); s->eq_delta = 32768.0f*EQUALIZER_DELTA/V29_EQUALIZER_LEN; #else cvec_zerof(s->eq_coeff, V29_EQUALIZER_LEN); - s->eq_coeff[V29_EQUALIZER_POST_LEN] = complex_setf(3.0f, 0.0f); + s->eq_coeff[V29_EQUALIZER_PRE_LEN] = complex_setf(3.0f, 0.0f); cvec_zerof(s->eq_buf, V29_EQUALIZER_LEN); s->eq_delta = EQUALIZER_DELTA/V29_EQUALIZER_LEN; #endif @@ -386,7 +381,7 @@ static __inline__ void put_bit(v29_rx_state_t *s, int bit) bit &= 1; /* Descramble the bit */ - out_bit = (bit ^ (s->scramble_reg >> 17) ^ (s->scramble_reg >> 22)) & 1; + out_bit = (bit ^ (s->scramble_reg >> (18 - 1)) ^ (s->scramble_reg >> (23 - 1))) & 1; s->scramble_reg = (s->scramble_reg << 1) | bit; /* We need to strip the last part of the training - the test period of all 1s - @@ -499,7 +494,7 @@ static __inline__ void symbol_sync(v29_rx_state_t *s) Passband Timing Recovery in an All-Digital Modem Receiver IEEE TRANSACTIONS ON COMMUNICATIONS, VOL. COM-26, NO. 5, MAY 1978 */ - /* This is slightly rearranged for figure 3b of the Godard paper, as this saves a couple of + /* This is slightly rearranged from figure 3b of the Godard paper, as this saves a couple of maths operations */ #if defined(SPANDSP_USE_FIXED_POINT) /* TODO: The scalings used here need more thorough evaluation, to see if overflows are possible. */ @@ -513,12 +508,12 @@ static __inline__ void symbol_sync(v29_rx_state_t *s) s->symbol_sync_dc_filter[0] = v; /* A little integration will now filter away much of the HF noise */ s->baud_phase -= p; - if (abs(s->baud_phase) > 30*FP_FACTOR) + v = labs(s->baud_phase); + if (v > 30*FP_FACTOR) { - if (s->baud_phase > 0) - i = (s->baud_phase > 1000*FP_FACTOR) ? 5 : 1; - else - i = (s->baud_phase < -1000*FP_FACTOR) ? -5 : -1; + i = (v > 1000*FP_FACTOR) ? 5 : 1; + if (s->baud_phase < 0) + i = -i; //printf("v = %10.5f %5d - %f %f %d %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction); s->eq_put_step += i; s->total_baud_timing_correction += i; @@ -534,12 +529,12 @@ static __inline__ void symbol_sync(v29_rx_state_t *s) s->symbol_sync_dc_filter[0] = v; /* A little integration will now filter away much of the HF noise */ s->baud_phase -= p; - if (fabsf(s->baud_phase) > 30.0f) + v = fabsf(s->baud_phase); + if (v > 30.0f) { - if (s->baud_phase > 0.0f) - i = (s->baud_phase > 1000.0f) ? 5 : 1; - else - i = (s->baud_phase < -1000.0f) ? -5 : -1; + i = (v > 1000.0f) ? 5 : 1; + if (s->baud_phase < 0.0f) + i = -i; //printf("v = %10.5f %5d - %f %f %d %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction); s->eq_put_step += i; s->total_baud_timing_correction += i; @@ -996,9 +991,6 @@ SPAN_DECLARE_NONSTD(int) v29_rx(v29_rx_state_t *s, const int16_t amp[], int len) pair of filters. This results in a properly bandpass filtered complex signal, which can be brought directly to baseband by complex mixing. No further filtering, to remove mixer harmonics, is needed. */ - step = -s->eq_put_step; - if (step > RX_PULSESHAPER_COEFF_SETS - 1) - step = RX_PULSESHAPER_COEFF_SETS - 1; s->eq_put_step += RX_PULSESHAPER_COEFF_SETS*10/(3*2); #if defined(SPANDSP_USE_FIXED_POINT) v = vec_circular_dot_prodi16(s->rrc_filter, rx_pulseshaper_im[step], V29_RX_FILTER_STEPS, s->rrc_filter_step); @@ -1025,7 +1017,7 @@ SPAN_DECLARE_NONSTD(int) v29_rx(v29_rx_state_t *s, const int16_t amp[], int len) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) v29_rx_fillin(v29_rx_state_t *s, int len) +SPAN_DECLARE_NONSTD(int) v29_rx_fillin(v29_rx_state_t *s, int len) { int i; @@ -1121,12 +1113,13 @@ SPAN_DECLARE(int) v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train) if (s->old_train) { s->carrier_phase_rate = s->carrier_phase_rate_save; - s->agc_scaling = s->agc_scaling_save; equalizer_restore(s); + s->agc_scaling = s->agc_scaling_save; } else { s->carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ); + equalizer_reset(s); #if defined(SPANDSP_USE_FIXED_POINT) s->agc_scaling_save = 0; s->agc_scaling = (float) FP_FACTOR*32768.0f*0.0017f/RX_PULSESHAPER_GAIN; @@ -1134,7 +1127,6 @@ SPAN_DECLARE(int) v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train) s->agc_scaling_save = 0.0f; s->agc_scaling = 0.0017f/RX_PULSESHAPER_GAIN; #endif - equalizer_reset(s); } #if defined(SPANDSP_USE_FIXED_POINT) s->carrier_track_i = 8000; diff --git a/libs/spandsp/src/v29tx.c b/libs/spandsp/src/v29tx.c index f2f832caac..39c6c99b9a 100644 --- a/libs/spandsp/src/v29tx.c +++ b/libs/spandsp/src/v29tx.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v29tx.c,v 1.89 2009/06/02 16:03:56 steveu Exp $ */ /*! \file */ @@ -49,6 +47,8 @@ #include "spandsp/complex.h" #include "spandsp/vector_float.h" #include "spandsp/complex_vector_float.h" +#include "spandsp/vector_int.h" +#include "spandsp/complex_vector_int.h" #include "spandsp/async.h" #include "spandsp/dds.h" #include "spandsp/power_meter.h" @@ -105,7 +105,7 @@ static __inline__ int get_scrambled_bit(v29_tx_state_t *s) s->in_training = TRUE; bit = 1; } - out_bit = (bit ^ (s->scramble_reg >> 17) ^ (s->scramble_reg >> 22)) & 1; + out_bit = (bit ^ (s->scramble_reg >> (18 - 1)) ^ (s->scramble_reg >> (23 - 1))) & 1; s->scramble_reg = (s->scramble_reg << 1) | out_bit; return out_bit; } @@ -349,7 +349,7 @@ SPAN_DECLARE(int) v29_tx_restart(v29_tx_state_t *s, int bit_rate, int tep) return -1; } #if defined(SPANDSP_USE_FIXED_POINT) - memset(s->rrc_filter, 0, sizeof(s->rrc_filter)); + cvec_zeroi16(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); #else cvec_zerof(s->rrc_filter, sizeof(s->rrc_filter)/sizeof(s->rrc_filter[0])); #endif diff --git a/libs/spandsp/src/v29tx_constellation_maps.h b/libs/spandsp/src/v29tx_constellation_maps.h index 1984c0b28f..01da53e71f 100644 --- a/libs/spandsp/src/v29tx_constellation_maps.h +++ b/libs/spandsp/src/v29tx_constellation_maps.h @@ -22,8 +22,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v29tx_constellation_maps.h,v 1.2 2008/09/04 14:40:05 steveu Exp $ */ #if defined(SPANDSP_USE_FIXED_POINT) diff --git a/libs/spandsp/src/v42.c b/libs/spandsp/src/v42.c index 1c6ed0803d..74630ee84d 100644 --- a/libs/spandsp/src/v42.c +++ b/libs/spandsp/src/v42.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v42.c,v 1.51 2009/11/04 15:52:06 steveu Exp $ */ /* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. */ diff --git a/libs/spandsp/src/v42bis.c b/libs/spandsp/src/v42bis.c index d8d3f3fde1..f4aee8ce93 100644 --- a/libs/spandsp/src/v42bis.c +++ b/libs/spandsp/src/v42bis.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v42bis.c,v 1.37 2009/02/10 13:06:47 steveu Exp $ */ /* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. @@ -58,6 +56,9 @@ #define V42BIS_N5 (V42BIS_N4 + V42BIS_N6) /* Index number of first dictionary entry used to store a string */ #define V42BIS_N6 3 /* Number of control codewords */ +/* V.42bis/9.2 */ +#define V42BIS_ESC_STEP 51 + /* Control code words in compressed mode */ enum { @@ -134,8 +135,16 @@ SPAN_DECLARE(int) v42bis_compress(v42bis_state_t *s, const uint8_t *buf, int len { octet = buf[ptr++]; ss->string_code = octet + V42BIS_N6; - if (ss->transparent) + if (octet == ss->escape_code) + { + push_compressed_octet(ss, ss->escape_code); + ss->escape_code += V42BIS_ESC_STEP; + push_compressed_octet(ss, V42BIS_EID); + } + else + { push_compressed_octet(ss, octet); + } ss->first = FALSE; } while (ptr < len) @@ -273,17 +282,19 @@ SPAN_DECLARE(int) v42bis_compress(v42bis_state_t *s, const uint8_t *buf, int len printf("Going compressed\n"); /* 7.8.1 Transition to compressed mode */ /* Switch out of transparent now, between codes. We need to send the octet which did not - match, just before switching. */ + match, just before switching. */ if (octet == ss->escape_code) { - push_compressed_octet(ss, ss->escape_code++); + push_compressed_octet(ss, ss->escape_code); + ss->escape_code += V42BIS_ESC_STEP; push_compressed_octet(ss, V42BIS_EID); } else { push_compressed_octet(ss, octet); } - push_compressed_octet(ss, ss->escape_code++); + push_compressed_octet(ss, ss->escape_code); + ss->escape_code += V42BIS_ESC_STEP; push_compressed_octet(ss, V42BIS_ECM); ss->transparent = FALSE; } @@ -310,7 +321,8 @@ SPAN_DECLARE(int) v42bis_compress(v42bis_state_t *s, const uint8_t *buf, int len { if (octet == ss->escape_code) { - push_compressed_octet(ss, ss->escape_code++); + push_compressed_octet(ss, ss->escape_code); + ss->escape_code += V42BIS_ESC_STEP; push_compressed_octet(ss, V42BIS_EID); } else @@ -396,7 +408,7 @@ SPAN_DECLARE(int) v42bis_decompress(v42bis_state_t *s, const uint8_t *buf, int l for (;;) { /* Fill up the bit buffer. */ - while (ss->input_bit_count < 32 - 8 && ptr < len) + while (ss->input_bit_count < (32 - 8) && ptr < len) { ss->input_bit_count += 8; ss->input_bit_buffer |= (uint32_t) buf[ptr++] << (32 - ss->input_bit_count); @@ -412,34 +424,33 @@ SPAN_DECLARE(int) v42bis_decompress(v42bis_state_t *s, const uint8_t *buf, int l if (ss->escaped) { ss->escaped = FALSE; - if (code == V42BIS_ECM) + switch (code) { + case V42BIS_ECM: printf("Hit V42BIS_ECM\n"); ss->transparent = FALSE; code_len = ss->v42bis_parm_c2; - } - else if (code == V42BIS_EID) - { + break; + case V42BIS_EID: printf("Hit V42BIS_EID\n"); - ss->output_buf[ss->output_octet_count++] = ss->escape_code - 1; + ss->output_buf[ss->output_octet_count++] = ss->escape_code; + ss->escape_code += V42BIS_ESC_STEP; if (ss->output_octet_count >= ss->max_len - s->v42bis_parm_n7) { ss->handler(ss->user_data, ss->output_buf, ss->output_octet_count); ss->output_octet_count = 0; } - } - else if (code == V42BIS_RESET) - { + break; + case V42BIS_RESET: printf("Hit V42BIS_RESET\n"); - } - else - { + break; + default: printf("Hit V42BIS_???? - %" PRIu32 "\n", code); + break; } } else if (code == ss->escape_code) { - ss->escape_code++; ss->escaped = TRUE; } else @@ -515,6 +526,11 @@ if (code > 4095) {printf("Code is 0x%" PRIu32 "\n", code); exit(2);} ss->octet = code - V42BIS_N6; /* Output the decoded string. */ this_length = V42BIS_MAX_STRING_SIZE - (int) (string - decode_buf); + for (i = 0; i < this_length; i++) + { + if (string[i] == ss->escape_code) + ss->escape_code += V42BIS_ESC_STEP; + } memcpy(ss->output_buf + ss->output_octet_count, string, this_length); ss->output_octet_count += this_length; if (ss->output_octet_count >= ss->max_len - s->v42bis_parm_n7) @@ -627,9 +643,9 @@ SPAN_DECLARE(v42bis_state_t *) v42bis_init(v42bis_state_t *s, { int i; - if (negotiated_p1 < 512 || negotiated_p1 > 65535) + if (negotiated_p1 < V42BIS_MIN_DICTIONARY_SIZE || negotiated_p1 > 65535) return NULL; - if (negotiated_p2 < 6 || negotiated_p2 > V42BIS_MAX_STRING_SIZE) + if (negotiated_p2 < V42BIS_MIN_STRING_SIZE || negotiated_p2 > V42BIS_MAX_STRING_SIZE) return NULL; if (s == NULL) { @@ -677,9 +693,13 @@ SPAN_DECLARE(v42bis_state_t *) v42bis_init(v42bis_state_t *s, s->decompress.dict[i].parent_code = (uint16_t) i; s->compress.string_code = 0xFFFFFFFF; s->compress.latest_code = 0xFFFFFFFF; - + s->compress.transparent = TRUE; + s->compress.first = TRUE; + s->decompress.last_old_code = 0xFFFFFFFF; s->decompress.last_extra_octet = -1; + s->decompress.transparent = TRUE; + s->compress.first = TRUE; s->compress.compression_mode = V42BIS_COMPRESSION_MODE_DYNAMIC; diff --git a/libs/spandsp/src/v8.c b/libs/spandsp/src/v8.c index f95c0783ab..9893bacfd3 100644 --- a/libs/spandsp/src/v8.c +++ b/libs/spandsp/src/v8.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: v8.c,v 1.42.4.3 2009/12/28 12:20:47 steveu Exp $ */ /*! \file */ @@ -124,7 +122,7 @@ SPAN_DECLARE(const char *) v8_call_function_to_str(int call_function) case V8_CALL_V_SERIES: return "V series modem data"; case V8_CALL_FUNCTION_EXTENSION: - return "Call function is in extention octet"; + return "Call function is in extension octet"; } return "???"; } @@ -140,7 +138,7 @@ SPAN_DECLARE(const char *) v8_modulation_to_str(int modulation_scheme) return "V.21 duplex"; case V8_MOD_V22: return "V.22/V.22bis duplex"; - case V8_MOD_V23HALF: + case V8_MOD_V23HDX: return "V.23 half-duplex"; case V8_MOD_V23: return "V.23 duplex"; @@ -154,7 +152,7 @@ SPAN_DECLARE(const char *) v8_modulation_to_str(int modulation_scheme) return "V.29 half-duplex"; case V8_MOD_V32: return "V.32/V.32bis duplex"; - case V8_MOD_V34HALF: + case V8_MOD_V34HDX: return "V.34 half-duplex"; case V8_MOD_V34: return "V.34 duplex"; @@ -162,8 +160,6 @@ SPAN_DECLARE(const char *) v8_modulation_to_str(int modulation_scheme) return "V.90 duplex"; case V8_MOD_V92: return "V.92 duplex"; - case V8_MOD_FAILED: - return "negotiation failed"; } return "???"; } @@ -288,6 +284,14 @@ SPAN_DECLARE(void) v8_log_supported_modulations(v8_state_t *s, int modulation_sc } /*- End of function --------------------------------------------------------*/ +static int report_event(v8_state_t *s) +{ + if (s->result_handler) + s->result_handler(s->result_handler_user_data, &s->result); + return 0; +} +/*- End of function --------------------------------------------------------*/ + static const uint8_t *process_call_function(v8_state_t *s, const uint8_t *p) { s->result.call_function = (*p >> 5) & 0x07; @@ -298,57 +302,64 @@ static const uint8_t *process_call_function(v8_state_t *s, const uint8_t *p) static const uint8_t *process_modulation_mode(v8_state_t *s, const uint8_t *p) { - unsigned int far_end_modulations; + unsigned int modulations; - /* Modulation mode octet */ - far_end_modulations = 0; + /* Modulation mode octets */ + /* We must record the number of bytes of modulation information, so a resulting + JM can be made to have the same number (V.8/8.2.3) */ + modulations = 0; + s->modulation_bytes = 1; if (*p & 0x80) - far_end_modulations |= V8_MOD_V34HALF; + modulations |= V8_MOD_V34HDX; if (*p & 0x40) - far_end_modulations |= V8_MOD_V34; + modulations |= V8_MOD_V34; if (*p & 0x20) - far_end_modulations |= V8_MOD_V90; + modulations |= V8_MOD_V90; + ++p; /* Check for an extension octet */ - if ((*++p & 0x38) == 0x10) + if ((*p & 0x38) == 0x10) { + s->modulation_bytes++; if (*p & 0x80) - far_end_modulations |= V8_MOD_V27TER; + modulations |= V8_MOD_V27TER; if (*p & 0x40) - far_end_modulations |= V8_MOD_V29; + modulations |= V8_MOD_V29; if (*p & 0x04) - far_end_modulations |= V8_MOD_V17; + modulations |= V8_MOD_V17; if (*p & 0x02) - far_end_modulations |= V8_MOD_V22; + modulations |= V8_MOD_V22; if (*p & 0x01) - far_end_modulations |= V8_MOD_V32; + modulations |= V8_MOD_V32; + ++p; /* Check for an extension octet */ - if ((*++p & 0x38) == 0x10) + if ((*p & 0x38) == 0x10) { + s->modulation_bytes++; if (*p & 0x80) - far_end_modulations |= V8_MOD_V21; + modulations |= V8_MOD_V21; if (*p & 0x40) - far_end_modulations |= V8_MOD_V23HALF; + modulations |= V8_MOD_V23HDX; if (*p & 0x04) - far_end_modulations |= V8_MOD_V23; + modulations |= V8_MOD_V23; if (*p & 0x02) - far_end_modulations |= V8_MOD_V26BIS; + modulations |= V8_MOD_V26BIS; if (*p & 0x01) - far_end_modulations |= V8_MOD_V26TER; + modulations |= V8_MOD_V26TER; + ++p; } } - s->far_end_modulations = - s->result.modulations = far_end_modulations; - v8_log_supported_modulations(s, far_end_modulations); - return ++p; + s->result.modulations = modulations; + v8_log_supported_modulations(s, modulations); + return p; } /*- End of function --------------------------------------------------------*/ static const uint8_t *process_protocols(v8_state_t *s, const uint8_t *p) { s->result.protocol = (*p >> 5) & 0x07; - span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_protocol_to_str(s->result.protocol)); + span_log(&s->logging, SPAN_LOG_FLOW, "%s\n", v8_protocol_to_str(s->result.protocol)); return ++p; } /*- End of function --------------------------------------------------------*/ @@ -356,7 +367,7 @@ static const uint8_t *process_protocols(v8_state_t *s, const uint8_t *p) static const uint8_t *process_pstn_access(v8_state_t *s, const uint8_t *p) { s->result.pstn_access = (*p >> 5) & 0x07; - span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_pstn_access_to_str(s->result.pstn_access)); + span_log(&s->logging, SPAN_LOG_FLOW, "%s\n", v8_pstn_access_to_str(s->result.pstn_access)); return ++p; } /*- End of function --------------------------------------------------------*/ @@ -364,7 +375,7 @@ static const uint8_t *process_pstn_access(v8_state_t *s, const uint8_t *p) static const uint8_t *process_non_standard_facilities(v8_state_t *s, const uint8_t *p) { s->result.nsf = (*p >> 5) & 0x07; - span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_nsf_to_str(s->result.nsf)); + span_log(&s->logging, SPAN_LOG_FLOW, "%s\n", v8_nsf_to_str(s->result.nsf)); return p; } /*- End of function --------------------------------------------------------*/ @@ -372,7 +383,7 @@ static const uint8_t *process_non_standard_facilities(v8_state_t *s, const uint8 static const uint8_t *process_pcm_modem_availability(v8_state_t *s, const uint8_t *p) { s->result.pcm_modem_availability = (*p >> 5) & 0x07; - span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_pcm_modem_availability_to_str(s->result.pcm_modem_availability)); + span_log(&s->logging, SPAN_LOG_FLOW, "%s\n", v8_pcm_modem_availability_to_str(s->result.pcm_modem_availability)); return ++p; } /*- End of function --------------------------------------------------------*/ @@ -380,7 +391,7 @@ static const uint8_t *process_pcm_modem_availability(v8_state_t *s, const uint8_ static const uint8_t *process_t66(v8_state_t *s, const uint8_t *p) { s->result.t66 = (*p >> 5) & 0x07; - span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_t66_to_str(s->result.t66)); + span_log(&s->logging, SPAN_LOG_FLOW, "%s\n", v8_t66_to_str(s->result.t66)); return ++p; } /*- End of function --------------------------------------------------------*/ @@ -639,9 +650,8 @@ static void send_cm_jm(v8_state_t *s) { int val; unsigned int offered_modulations; + int bytes; - offered_modulations = s->parms.modulations & s->far_end_modulations; - /* Send a CM, or a JM as appropriate */ v8_put_preamble(s); v8_put_byte(s, V8_CM_JM_SYNC_OCTET); @@ -649,48 +659,53 @@ static void send_cm_jm(v8_state_t *s) v8_put_byte(s, (s->result.call_function << 5) | V8_CALL_FUNCTION_TAG); /* Supported modulations */ + offered_modulations = s->result.modulations; + bytes = 0; val = 0x05; if (offered_modulations & V8_MOD_V90) val |= 0x20; if (offered_modulations & V8_MOD_V34) val |= 0x40; v8_put_byte(s, val); - - val = 0x10; - if (offered_modulations & V8_MOD_V32) - val |= 0x01; - if (offered_modulations & V8_MOD_V22) - val |= 0x02; - if (offered_modulations & V8_MOD_V17) - val |= 0x04; - if (offered_modulations & V8_MOD_V29) - val |= 0x40; - if (offered_modulations & V8_MOD_V27TER) - val |= 0x80; - v8_put_byte(s, val); - - val = 0x10; - if (offered_modulations & V8_MOD_V26TER) - val |= 0x01; - if (offered_modulations & V8_MOD_V26BIS) - val |= 0x02; - if (offered_modulations & V8_MOD_V23) - val |= 0x04; - if (offered_modulations & V8_MOD_V23HALF) - val |= 0x40; - if (offered_modulations & V8_MOD_V21) - val |= 0x80; - v8_put_byte(s, val); + if (++bytes < s->modulation_bytes) + { + val = 0x10; + if (offered_modulations & V8_MOD_V32) + val |= 0x01; + if (offered_modulations & V8_MOD_V22) + val |= 0x02; + if (offered_modulations & V8_MOD_V17) + val |= 0x04; + if (offered_modulations & V8_MOD_V29) + val |= 0x40; + if (offered_modulations & V8_MOD_V27TER) + val |= 0x80; + v8_put_byte(s, val); + } + if (++bytes < s->modulation_bytes) + { + val = 0x10; + if (offered_modulations & V8_MOD_V26TER) + val |= 0x01; + if (offered_modulations & V8_MOD_V26BIS) + val |= 0x02; + if (offered_modulations & V8_MOD_V23) + val |= 0x04; + if (offered_modulations & V8_MOD_V23HDX) + val |= 0x40; + if (offered_modulations & V8_MOD_V21) + val |= 0x80; + v8_put_byte(s, val); + } if (s->parms.protocol) v8_put_byte(s, (s->parms.protocol << 5) | V8_PROTOCOLS_TAG); - if (s->parms.pcm_modem_availability) - v8_put_byte(s, (s->parms.pcm_modem_availability << 5) | V8_PCM_MODEM_AVAILABILITY_TAG); if (s->parms.pstn_access) v8_put_byte(s, (s->parms.pstn_access << 5) | V8_PSTN_ACCESS_TAG); + if (s->parms.pcm_modem_availability) + v8_put_byte(s, (s->parms.pcm_modem_availability << 5) | V8_PCM_MODEM_AVAILABILITY_TAG); if (s->parms.t66 >= 0) v8_put_byte(s, (s->parms.t66 << 5) | V8_T66_TAG); - /* No NSF */ //v8_put_byte(s, (0 << 5) | V8_NSF_TAG); } @@ -762,7 +777,7 @@ static void handle_modem_connect_tone(v8_state_t *s, int tone) tone == MODEM_CONNECT_TONES_ANSAM_PR) { /* Set the Te interval. The spec. says 500ms is the minimum, - but gives reasons why 1 second is a better value. */ + but gives reasons why 1 second is a better value (V.8/8.1.1). */ s->state = V8_HEARD_ANSAM; s->ci_timer = ms_to_samples(1000); } @@ -772,8 +787,8 @@ static void handle_modem_connect_tone(v8_state_t *s, int tone) indicating V.8 startup, we are not going to do V.8 processing. */ span_log(&s->logging, SPAN_LOG_FLOW, "Non-V.8 modem connect tone detected\n"); s->state = V8_PARKED; - if (s->result_handler) - s->result_handler(s->result_handler_user_data, &s->result); + s->result.status = V8_STATUS_NON_V8_CALL; + report_event(s); } } /*- End of function --------------------------------------------------------*/ @@ -806,7 +821,7 @@ SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len) handle_modem_connect_tone(s, tone); break; } - if (queue_empty(s->tx_queue)) + if (!s->fsk_tx_on) { s->state = V8_CI_OFF; s->ci_timer = ms_to_samples(500); @@ -828,8 +843,8 @@ SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len) /* The spec says we should give up now. */ span_log(&s->logging, SPAN_LOG_FLOW, "Timeout waiting for modem connect tone\n"); s->state = V8_PARKED; - if (s->result_handler) - s->result_handler(s->result_handler_user_data, NULL); + s->result.status = V8_STATUS_FAILED; + report_event(s); } else { @@ -873,8 +888,8 @@ SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len) /* Timeout */ span_log(&s->logging, SPAN_LOG_FLOW, "Timeout waiting for JM\n"); s->state = V8_PARKED; - if (s->result_handler) - s->result_handler(s->result_handler_user_data, NULL); + s->result.status = V8_STATUS_FAILED; + report_event(s); } if (queue_contents(s->tx_queue) < 10) { @@ -884,8 +899,9 @@ SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len) break; case V8_CJ_ON: residual_samples = fsk_rx(&s->v21rx, amp, len); - if (queue_empty(s->tx_queue)) + if (!s->fsk_tx_on) { +#if 0 s->negotiation_timer = ms_to_samples(75); s->state = V8_SIGC; } @@ -893,11 +909,12 @@ SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len) case V8_SIGC: if ((s->negotiation_timer -= len) <= 0) { +#endif /* The V.8 negotiation has succeeded. */ span_log(&s->logging, SPAN_LOG_FLOW, "Negotiation succeeded\n"); s->state = V8_PARKED; - if (s->result_handler) - s->result_handler(s->result_handler_user_data, &s->result); + s->result.status = V8_STATUS_V8_CALL; + report_event(s); } break; case V8_CM_WAIT: @@ -906,7 +923,8 @@ SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len) { span_log(&s->logging, SPAN_LOG_FLOW, "CM recognised\n"); - /* TODO: negotiate if the call function is acceptable */ + s->result.status = V8_STATUS_V8_OFFERED; + report_event(s); /* Stop sending ANSam or ANSam/ and send JM instead */ fsk_tx_init(&s->v21tx, &preset_fsk_specs[FSK_V21CH2], get_bit, s); @@ -923,8 +941,8 @@ SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len) /* Timeout */ span_log(&s->logging, SPAN_LOG_FLOW, "Timeout waiting for CM\n"); s->state = V8_PARKED; - if (s->result_handler) - s->result_handler(s->result_handler_user_data, NULL); + s->result.status = V8_STATUS_FAILED; + report_event(s); } break; case V8_JM_ON: @@ -943,8 +961,8 @@ SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len) /* Timeout */ span_log(&s->logging, SPAN_LOG_FLOW, "Timeout waiting for CJ\n"); s->state = V8_PARKED; - if (s->result_handler) - s->result_handler(s->result_handler_user_data, NULL); + s->result.status = V8_STATUS_FAILED; + report_event(s); break; } if (queue_contents(s->tx_queue) < 10) @@ -954,13 +972,14 @@ SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len) } break; case V8_SIGA: - if ((s->negotiation_timer -= len) <= 0) + if (!s->fsk_tx_on) + //if ((s->negotiation_timer -= len) <= 0) { /* The V.8 negotiation has succeeded. */ span_log(&s->logging, SPAN_LOG_FLOW, "Negotiation succeeded\n"); s->state = V8_PARKED; - if (s->result_handler) - s->result_handler(s->result_handler_user_data, &s->result); + s->result.status = V8_STATUS_V8_CALL; + report_event(s); } break; case V8_PARKED: @@ -977,17 +996,20 @@ SPAN_DECLARE(logging_state_t *) v8_get_logging_state(v8_state_t *s) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) v8_restart(v8_state_t *s, - int calling_party, - v8_parms_t *parms) +SPAN_DECLARE(int) v8_restart(v8_state_t *s, int calling_party, v8_parms_t *parms) { memcpy(&s->parms, parms, sizeof(s->parms)); memset(&s->result, 0, sizeof(s->result)); + s->result.status = V8_STATUS_IN_PROGRESS; + s->result.modem_connect_tone = MODEM_CONNECT_TONES_NONE; + s->result.modulations = s->parms.modulations; s->result.call_function = s->parms.call_function; s->result.nsf = -1; s->result.t66 = -1; + s->modulation_bytes = 3; + s->ci_timer = 0; if (calling_party) { @@ -1009,7 +1031,6 @@ SPAN_DECLARE(int) v8_restart(v8_state_t *s, s->negotiation_timer = ms_to_samples(200 + 5000); s->modem_connect_tone_tx_on = ms_to_samples(75) + 1; } - s->result.modem_connect_tone = MODEM_CONNECT_TONES_NONE; if ((s->tx_queue = queue_init(NULL, 1024, 0)) == NULL) return -1; @@ -1035,38 +1056,6 @@ SPAN_DECLARE(v8_state_t *) v8_init(v8_state_t *s, s->result_handler_user_data = user_data; v8_restart(s, calling_party, parms); - - memcpy(&s->parms, parms, sizeof(s->parms)); - - s->result.call_function = s->parms.call_function; - s->result.nsf = -1; - s->result.t66 = -1; - - s->ci_timer = 0; - if (calling_party) - { - s->calling_party = TRUE; - s->state = V8_WAIT_1S; - s->negotiation_timer = ms_to_samples(1000); - s->ci_count = 0; - modem_connect_tones_rx_init(&s->ansam_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL); - fsk_tx_init(&s->v21tx, &preset_fsk_specs[FSK_V21CH1], get_bit, s); - } - else - { - /* Send the ANSam or ANSam/ tone */ - s->calling_party = FALSE; - modem_connect_tones_tx_init(&s->ansam_tx, s->parms.modem_connect_tone); - - v8_decode_init(s); - s->state = V8_CM_WAIT; - s->negotiation_timer = ms_to_samples(200 + 5000); - s->modem_connect_tone_tx_on = ms_to_samples(75) + 1; - } - s->result.modem_connect_tone = MODEM_CONNECT_TONES_NONE; - - if ((s->tx_queue = queue_init(NULL, 1024, 0)) == NULL) - return NULL; return s; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/vector_float.c b/libs/spandsp/src/vector_float.c index ba14bcfdbc..7b5a7efa69 100644 --- a/libs/spandsp/src/vector_float.c +++ b/libs/spandsp/src/vector_float.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: vector_float.c,v 1.22 2009/07/12 09:23:09 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/vector_int.c b/libs/spandsp/src/vector_int.c index db62cecf2b..807b72b2b3 100644 --- a/libs/spandsp/src/vector_int.c +++ b/libs/spandsp/src/vector_int.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: vector_int.c,v 1.26.4.1 2009/12/28 11:54:59 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/test-data/Makefile.am b/libs/spandsp/test-data/Makefile.am index f5797f451c..dab5d61751 100644 --- a/libs/spandsp/test-data/Makefile.am +++ b/libs/spandsp/test-data/Makefile.am @@ -15,8 +15,6 @@ ## You should have received a copy of the GNU Lesser General Public ## License along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.3 2008/07/10 12:44:54 steveu Exp $ SUBDIRS = itu etsi diff --git a/libs/spandsp/test-data/etsi/Makefile.am b/libs/spandsp/test-data/etsi/Makefile.am index f4d26bb780..f220bb29c3 100644 --- a/libs/spandsp/test-data/etsi/Makefile.am +++ b/libs/spandsp/test-data/etsi/Makefile.am @@ -15,8 +15,6 @@ ## You should have received a copy of the GNU Lesser General Public ## License along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.4 2008/07/10 12:44:54 steveu Exp $ SUBDIRS = fax diff --git a/libs/spandsp/test-data/etsi/fax/Makefile.am b/libs/spandsp/test-data/etsi/fax/Makefile.am index 6d2152d8ff..9b31fea137 100644 --- a/libs/spandsp/test-data/etsi/fax/Makefile.am +++ b/libs/spandsp/test-data/etsi/fax/Makefile.am @@ -15,8 +15,6 @@ ## 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. -## -## $Id: Makefile.am,v 1.4 2009/02/25 17:52:51 steveu Exp $ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) diff --git a/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c b/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c index 95c9db3e30..d7cefc6778 100644 --- a/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c +++ b/libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: generate_etsi_300_242_pages.c,v 1.5 2009/03/23 14:34:13 steveu Exp $ */ /*! \file */ @@ -274,7 +272,7 @@ static int create_stairstep_page(TIFF *tiff_file) static int create_diago1_page(TIFF *tiff_file) { - uint8_t image_buffer[1728/8]; + uint8_t image_buffer[1728/8 + 1]; int row; /* ETSI ETS 300 242 B.5.1 One dimensional coding test chart - the DIAGO1 page. */ @@ -301,7 +299,7 @@ static int create_diago1_page(TIFF *tiff_file) static int create_diago2_page(TIFF *tiff_file) { - uint8_t image_buffer[1728/8]; + uint8_t image_buffer[1728/8 + 1]; int row; /* ETSI ETS 300 242 B.5.1 One dimensional coding test chart - the DIAGO2 page. */ @@ -396,7 +394,7 @@ static int create_impress_page(TIFF *tiff_file) static int create_duration1_page(TIFF *tiff_file) { - uint8_t image_buffer[1728/8]; + uint8_t image_buffer[1728/8 + 1]; int row; int i; @@ -468,7 +466,7 @@ static int create_duration2_page(TIFF *tiff_file) static int create_error_page(TIFF *tiff_file) { - uint8_t image_buffer[1728/8]; + uint8_t image_buffer[1728/8 + 1]; int row; int start_pixel; int i; diff --git a/libs/spandsp/test-data/itu/Makefile.am b/libs/spandsp/test-data/itu/Makefile.am index eaa3f1afb1..9e262c2d8e 100644 --- a/libs/spandsp/test-data/itu/Makefile.am +++ b/libs/spandsp/test-data/itu/Makefile.am @@ -15,8 +15,6 @@ ## You should have received a copy of the GNU Lesser General Public ## License along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.3 2008/05/03 10:26:15 steveu Exp $ SUBDIRS = fax diff --git a/libs/spandsp/test-data/itu/fax/Makefile.am b/libs/spandsp/test-data/itu/fax/Makefile.am index 25b1ed24a9..595b5f7e93 100644 --- a/libs/spandsp/test-data/itu/fax/Makefile.am +++ b/libs/spandsp/test-data/itu/fax/Makefile.am @@ -15,8 +15,6 @@ ## You should have received a copy of the GNU General Public License ## License along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.5 2009/02/25 17:52:52 steveu Exp $ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) @@ -99,15 +97,17 @@ EXTRA_DIST = ${ITU_TEST_PAGES_PBM} MAINTAINERCLEANFILES = Makefile.in -nobase_data_DATA = itutests.tif \ - ${ITU_TEST_PAGES} \ +nobase_data_DATA = 100pages.tif \ dithered.tif \ - 100pages.tif \ + itutests.tif \ + ${ITU_TEST_PAGES} \ ${MIXED_SIZE_PAGES} \ - mixed_size_pages.tif + mixed_size_pages.tif \ + striped.tif noinst_PROGRAMS = generate_dithered_tif \ - generate_sized_pages + generate_sized_pages \ + generate_striped_pages generate_dithered_tif_SOURCES = generate_dithered_tif.c generate_dithered_tif_LDADD = -ltiff @@ -115,6 +115,9 @@ generate_dithered_tif_LDADD = -ltiff generate_sized_pages_SOURCES = generate_sized_pages.c generate_sized_pages_LDADD = -ltiff +generate_striped_pages_SOURCES = generate_striped_pages.c +generate_striped_pages_LDADD = -ltiff + clean: rm -f *.tif *.g3 @@ -138,7 +141,7 @@ itutests.tif: ${ITU_TEST_PAGES_G3} .pbm.g3: ${PBM2G3} $*.pbm >$*.g3 - + dithered.tif: generate_dithered_tif$(EXEEXT) ./generate_dithered_tif$(EXEEXT) @@ -147,3 +150,6 @@ ${MIXED_SIZE_PAGES}: generate_sized_pages$(EXEEXT) mixed_size_pages.tif: ${MIXED_SIZE_PAGES} $(TIFFCP) ${MIXED_SIZE_PAGES} $@ + +striped.tif: generate_striped_pages$(EXEEXT) + ./generate_striped_pages$(EXEEXT) diff --git a/libs/spandsp/test-data/itu/fax/generate_dithered_tif.c b/libs/spandsp/test-data/itu/fax/generate_dithered_tif.c index a21bdd0ed4..31c8cb0cc8 100644 --- a/libs/spandsp/test-data/itu/fax/generate_dithered_tif.c +++ b/libs/spandsp/test-data/itu/fax/generate_dithered_tif.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: generate_dithered_tif.c,v 1.2 2008/07/10 13:34:01 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/test-data/itu/fax/generate_sized_pages.c b/libs/spandsp/test-data/itu/fax/generate_sized_pages.c index fe57a2589a..bd7e8cdc91 100644 --- a/libs/spandsp/test-data/itu/fax/generate_sized_pages.c +++ b/libs/spandsp/test-data/itu/fax/generate_sized_pages.c @@ -22,8 +22,6 @@ * 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. - * - * $Id: generate_sized_pages.c,v 1.3 2009/03/01 12:39:02 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/test-data/local/Makefile.am b/libs/spandsp/test-data/local/Makefile.am index 0df6a186eb..5c8ad55a53 100644 --- a/libs/spandsp/test-data/local/Makefile.am +++ b/libs/spandsp/test-data/local/Makefile.am @@ -15,8 +15,6 @@ ## You should have received a copy of the GNU Lesser General Public ## License along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.1 2008/05/03 07:30:19 steveu Exp $ SUBDIRS = @@ -24,6 +22,7 @@ DIST_SUBDIRS = EXTRA_DIST = dam9_lpc55.wav \ dam9.wav \ + lenna-colour.tif \ short_nb_voice.wav \ short_wb_voice.wav diff --git a/libs/spandsp/tests/Makefile.am b/libs/spandsp/tests/Makefile.am index 253d398d31..52769e78d8 100644 --- a/libs/spandsp/tests/Makefile.am +++ b/libs/spandsp/tests/Makefile.am @@ -15,8 +15,6 @@ ## 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. -## -## $Id: Makefile.am,v 1.117 2009/09/22 13:11:04 steveu Exp $ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) @@ -26,6 +24,7 @@ LIBS += $(TESTLIBS) noinst_DATA = sound_c1_8k.wav sound_c3_8k.wav EXTRA_DIST = regression_tests.sh \ + tsb85_extra_tests.sh \ v42bis_tests.sh \ fax_tests.sh \ tsb85_tests.sh \ @@ -60,6 +59,7 @@ noinst_PROGRAMS = adsi_tests \ bell_mf_tx_tests \ bert_tests \ bit_operations_tests \ + bitstream_tests \ complex_tests \ complex_vector_float_tests \ complex_vector_int_tests \ @@ -80,6 +80,7 @@ noinst_PROGRAMS = adsi_tests \ gsm0610_tests \ hdlc_tests \ ima_adpcm_tests \ + image_translate_tests \ line_model_tests \ logging_tests \ lpc10_tests \ @@ -95,6 +96,7 @@ noinst_PROGRAMS = adsi_tests \ r2_mf_rx_tests \ r2_mf_tx_tests \ rfc2198_sim_tests \ + saturated_tests \ schedule_tests \ sig_tone_tests \ super_tone_rx_tests \ @@ -102,6 +104,7 @@ noinst_PROGRAMS = adsi_tests \ swept_tone_tests \ t4_tests \ t31_tests \ + t38_decode \ t38_core_tests \ t38_gateway_tests \ t38_gateway_to_terminal_tests \ @@ -109,6 +112,7 @@ noinst_PROGRAMS = adsi_tests \ t38_terminal_tests \ t38_terminal_to_gateway_tests \ time_scale_tests \ + timezone_tests \ tone_detect_tests \ tone_generate_tests \ tsb85_tests \ @@ -131,7 +135,9 @@ noinst_HEADERS = echo_monitor.h \ fax_utils.h \ line_model_monitor.h \ media_monitor.h \ - modem_monitor.h + modem_monitor.h \ + pcap_parse.h \ + udptl.h adsi_tests_SOURCES = adsi_tests.c adsi_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp @@ -157,6 +163,9 @@ bert_tests_LDADD = $(LIBDIR) -lspandsp bit_operations_tests_SOURCES = bit_operations_tests.c bit_operations_tests_LDADD = $(LIBDIR) -lspandsp +bitstream_tests_SOURCES = bitstream_tests.c +bitstream_tests_LDADD = $(LIBDIR) -lspandsp + complex_tests_SOURCES = complex_tests.c complex_tests_LDADD = $(LIBDIR) -lspandsp @@ -217,6 +226,9 @@ hdlc_tests_LDADD = $(LIBDIR) -lspandsp ima_adpcm_tests_SOURCES = ima_adpcm_tests.c ima_adpcm_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +image_translate_tests_SOURCES = image_translate_tests.c +image_translate_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp + line_model_tests_SOURCES = line_model_tests.c line_model_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp @@ -262,6 +274,9 @@ r2_mf_tx_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -ls rfc2198_sim_tests_SOURCES = rfc2198_sim_tests.c media_monitor.cpp rfc2198_sim_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp +saturated_tests_SOURCES = saturated_tests.c +saturated_tests_LDADD = $(LIBDIR) -lspandsp + schedule_tests_SOURCES = schedule_tests.c schedule_tests_LDADD = $(LIBDIR) -lspandsp @@ -286,6 +301,9 @@ t31_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspands t38_core_tests_SOURCES = t38_core_tests.c t38_core_tests_LDADD = $(LIBDIR) -lspandsp +t38_decode_SOURCES = t38_decode.c fax_utils.c pcap_parse.c udptl.c +t38_decode_LDADD = $(LIBDIR) -lspandsp -lpcap + t38_gateway_tests_SOURCES = t38_gateway_tests.c fax_utils.c media_monitor.cpp t38_gateway_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-sim $(LIBDIR) -lspandsp @@ -304,6 +322,9 @@ t38_terminal_to_gateway_tests_LDADD = -L$(top_builddir)/spandsp-sim -lspandsp-si time_scale_tests_SOURCES = time_scale_tests.c time_scale_tests_LDADD = $(LIBDIR) -lspandsp +timezone_tests_SOURCES = timezone_tests.c +timezone_tests_LDADD = $(LIBDIR) -lspandsp + tone_detect_tests_SOURCES = tone_detect_tests.c tone_detect_tests_LDADD = $(LIBDIR) -lspandsp diff --git a/libs/spandsp/tests/adsi_tests.c b/libs/spandsp/tests/adsi_tests.c index bf348be4e2..66c2f10707 100644 --- a/libs/spandsp/tests/adsi_tests.c +++ b/libs/spandsp/tests/adsi_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: adsi_tests.c,v 1.57 2009/05/30 15:23:13 steveu Exp $ */ /*! \page adsi_tests_page ADSI tests diff --git a/libs/spandsp/tests/async_tests.c b/libs/spandsp/tests/async_tests.c index 4dcacca3b2..98f3211e58 100644 --- a/libs/spandsp/tests/async_tests.c +++ b/libs/spandsp/tests/async_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: async_tests.c,v 1.19 2009/05/30 15:23:13 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/at_interpreter_tests.c b/libs/spandsp/tests/at_interpreter_tests.c index 2b63863751..84cb4b4f92 100644 --- a/libs/spandsp/tests/at_interpreter_tests.c +++ b/libs/spandsp/tests/at_interpreter_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: at_interpreter_tests.c,v 1.24 2009/10/09 14:53:57 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/awgn_tests.c b/libs/spandsp/tests/awgn_tests.c index 389ef14d4b..bb451c447f 100644 --- a/libs/spandsp/tests/awgn_tests.c +++ b/libs/spandsp/tests/awgn_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: awgn_tests.c,v 1.18 2008/11/30 12:38:27 steveu Exp $ */ /*! \page awgn_tests_page AWGN tests @@ -51,7 +49,7 @@ /* Some simple sanity tests for the Gaussian noise generation routines */ -int main (int argc, char *argv[]) +int main(int argc, char *argv[]) { int i; int j; diff --git a/libs/spandsp/tests/bell_mf_rx_tests.c b/libs/spandsp/tests/bell_mf_rx_tests.c index c1aa73633b..4b0112043d 100644 --- a/libs/spandsp/tests/bell_mf_rx_tests.c +++ b/libs/spandsp/tests/bell_mf_rx_tests.c @@ -22,8 +22,6 @@ * 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. - * - * $Id: bell_mf_rx_tests.c,v 1.16 2009/05/30 15:23:13 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/bell_mf_tx_tests.c b/libs/spandsp/tests/bell_mf_tx_tests.c index e9ef383e0b..dd0551f891 100644 --- a/libs/spandsp/tests/bell_mf_tx_tests.c +++ b/libs/spandsp/tests/bell_mf_tx_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: bell_mf_tx_tests.c,v 1.15 2009/05/30 15:23:13 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/bert_tests.c b/libs/spandsp/tests/bert_tests.c index 30db9c5307..9db22b565f 100644 --- a/libs/spandsp/tests/bert_tests.c +++ b/libs/spandsp/tests/bert_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: bert_tests.c,v 1.28 2009/05/30 15:23:13 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/bit_operations_tests.c b/libs/spandsp/tests/bit_operations_tests.c index 337b057582..53cd997023 100644 --- a/libs/spandsp/tests/bit_operations_tests.c +++ b/libs/spandsp/tests/bit_operations_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: bit_operations_tests.c,v 1.14 2008/05/13 13:17:25 steveu Exp $ */ /*! \page bit_operations_tests_page Bit operations tests diff --git a/libs/spandsp/tests/complex_tests.c b/libs/spandsp/tests/complex_tests.c index 77faef145d..54649f5b4b 100644 --- a/libs/spandsp/tests/complex_tests.c +++ b/libs/spandsp/tests/complex_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: complex_tests.c,v 1.2 2009/01/28 03:41:27 steveu Exp $ */ /*! \page complex_tests_page Complex arithmetic tests diff --git a/libs/spandsp/tests/complex_vector_float_tests.c b/libs/spandsp/tests/complex_vector_float_tests.c index 05449caca3..e32ac07591 100644 --- a/libs/spandsp/tests/complex_vector_float_tests.c +++ b/libs/spandsp/tests/complex_vector_float_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: complex_vector_float_tests.c,v 1.3 2009/04/26 07:00:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/tests/complex_vector_int_tests.c b/libs/spandsp/tests/complex_vector_int_tests.c index 5da6a36cee..57fa7a6a58 100644 --- a/libs/spandsp/tests/complex_vector_int_tests.c +++ b/libs/spandsp/tests/complex_vector_int_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: complex_vector_int_tests.c,v 1.2 2009/04/26 07:00:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/tests/crc_tests.c b/libs/spandsp/tests/crc_tests.c index a776f59c4e..2227d28805 100644 --- a/libs/spandsp/tests/crc_tests.c +++ b/libs/spandsp/tests/crc_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: crc_tests.c,v 1.6 2008/05/13 13:17:25 steveu Exp $ */ /*! \file */ @@ -73,9 +71,12 @@ static int cook_up_msg(uint8_t *buf) int main(int argc, char *argv[]) { int i; + int j; int len; + uint16_t crc16a; + uint16_t crc16b; - printf("HDLC module tests\n"); + printf("CRC module tests\n"); /* TODO: This doesn't check every function in the module */ @@ -93,6 +94,24 @@ int main(int argc, char *argv[]) } printf("Test passed.\n\n"); + printf("Testing the CRC-16 byte by byte and bit by bit routines\n"); + for (i = 0; i < 100; i++) + { + ref_len = cook_up_msg(buf); + crc16a = 0xFFFF; + crc16a = crc_itu16_calc(buf, ref_len, crc16a); + + crc16b = 0xFFFF; + for (j = 0; j < ref_len; j++) + crc16b = crc_itu16_bits(buf[j], 8, crc16b); + if (crc16a != crc16b) + { + printf("CRC-16 failure\n"); + exit(2); + } + } + printf("Test passed.\n\n"); + printf("Testing the CRC-32 routines\n"); for (i = 0; i < 100; i++) { diff --git a/libs/spandsp/tests/dc_restore_tests.c b/libs/spandsp/tests/dc_restore_tests.c index bc28bb6216..fd91ef9f24 100644 --- a/libs/spandsp/tests/dc_restore_tests.c +++ b/libs/spandsp/tests/dc_restore_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: dc_restore_tests.c,v 1.24 2008/11/30 12:38:27 steveu Exp $ */ /*! \page dc_restore_tests_page DC restoration tests diff --git a/libs/spandsp/tests/dds_tests.c b/libs/spandsp/tests/dds_tests.c index 9e8410f3ea..e3a43d5158 100644 --- a/libs/spandsp/tests/dds_tests.c +++ b/libs/spandsp/tests/dds_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: dds_tests.c,v 1.26 2009/06/02 14:55:36 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/dtmf_rx_tests.c b/libs/spandsp/tests/dtmf_rx_tests.c index 63c74d48a3..d5fb202ca3 100644 --- a/libs/spandsp/tests/dtmf_rx_tests.c +++ b/libs/spandsp/tests/dtmf_rx_tests.c @@ -22,8 +22,6 @@ * 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. - * - * $Id: dtmf_rx_tests.c,v 1.45 2009/05/30 15:23:13 steveu Exp $ */ /* @@ -156,6 +154,9 @@ int callback_ok; int callback_roll; int step; +int max_forward_twist; +int max_reverse_twist; + int use_dialtone_filter = FALSE; char *decode_test_file = NULL; @@ -322,8 +323,8 @@ static void mitel_cm7291_side_1_tests(void) awgn_state_t noise_source; dtmf_state = dtmf_rx_init(NULL, NULL, NULL); - if (use_dialtone_filter) - dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99); + if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0) + dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99); /* Test 1: Mitel's test 1 isn't really a test. Its a calibration step, which has no meaning here. */ @@ -628,8 +629,8 @@ static void mitel_cm7291_side_2_and_bellcore_tests(void) dtmf_rx_state_t *dtmf_state; dtmf_state = dtmf_rx_init(NULL, NULL, NULL); - if (use_dialtone_filter) - dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99); + if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0) + dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99); /* The remainder of the Mitel tape is the talk-off test */ /* Here we use the Bellcore test tapes (much tougher), in six @@ -695,8 +696,8 @@ static void dial_tone_tolerance_tests(void) tone_gen_state_t dial_tone; dtmf_state = dtmf_rx_init(NULL, NULL, NULL); - if (use_dialtone_filter) - dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99); + if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0) + dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99); /* Test dial tone tolerance */ printf("Test: Dial tone tolerance.\n"); @@ -748,8 +749,9 @@ static void callback_function_tests(void) callback_ok = TRUE; callback_roll = 0; dtmf_state = dtmf_rx_init(NULL, digit_delivery, (void *) 0x12345678); - if (use_dialtone_filter) - dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99); + if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0) + dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99); + my_dtmf_gen_init(0.0f, DEFAULT_DTMF_TX_LEVEL, 0.0f, DEFAULT_DTMF_TX_LEVEL, DEFAULT_DTMF_TX_ON_TIME, DEFAULT_DTMF_TX_OFF_TIME); for (i = 1; i < 10; i++) { @@ -774,8 +776,9 @@ static void callback_function_tests(void) callback_roll = 0; dtmf_rx_init(dtmf_state, NULL, NULL); dtmf_rx_set_realtime_callback(dtmf_state, digit_status, (void *) 0x12345678); - if (use_dialtone_filter) - dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99); + if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0) + dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99); + my_dtmf_gen_init(0.0f, DEFAULT_DTMF_TX_LEVEL, 0.0f, DEFAULT_DTMF_TX_LEVEL, DEFAULT_DTMF_TX_ON_TIME, DEFAULT_DTMF_TX_OFF_TIME); step = 0; for (i = 1; i < 10; i++) @@ -812,8 +815,8 @@ static void decode_test(const char *test_file) int total; dtmf_state = dtmf_rx_init(NULL, NULL, NULL); - if (use_dialtone_filter) - dtmf_rx_parms(dtmf_state, TRUE, -1, -1, -99); + if (use_dialtone_filter || max_forward_twist >= 0 || max_reverse_twist >= 0) + dtmf_rx_parms(dtmf_state, use_dialtone_filter, max_forward_twist, max_reverse_twist, -99); /* We will decode the audio from a file. */ @@ -847,7 +850,9 @@ int main(int argc, char *argv[]) use_dialtone_filter = FALSE; channel_codec = MUNGE_CODEC_NONE; decode_test_file = NULL; - while ((opt = getopt(argc, argv, "c:d:f")) != -1) + max_forward_twist = -1; + max_reverse_twist = -1; + while ((opt = getopt(argc, argv, "c:d:F:fR:")) != -1) { switch (opt) { @@ -857,9 +862,15 @@ int main(int argc, char *argv[]) case 'd': decode_test_file = optarg; break; + case 'F': + max_forward_twist = atoi(optarg); + break; case 'f': use_dialtone_filter = TRUE; break; + case 'R': + max_reverse_twist = atoi(optarg); + break; default: //usage(); exit(2); diff --git a/libs/spandsp/tests/dtmf_tx_tests.c b/libs/spandsp/tests/dtmf_tx_tests.c index 0d990f0033..c092324972 100644 --- a/libs/spandsp/tests/dtmf_tx_tests.c +++ b/libs/spandsp/tests/dtmf_tx_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: dtmf_tx_tests.c,v 1.23 2009/05/30 15:23:13 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/echo_monitor.cpp b/libs/spandsp/tests/echo_monitor.cpp index 4e7a8241da..8a7f6c3928 100644 --- a/libs/spandsp/tests/echo_monitor.cpp +++ b/libs/spandsp/tests/echo_monitor.cpp @@ -21,8 +21,6 @@ * 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. - * - * $Id: echo_monitor.cpp,v 1.13 2008/09/08 16:10:41 steveu Exp $ */ #ifdef HAVE_CONFIG_H diff --git a/libs/spandsp/tests/echo_monitor.h b/libs/spandsp/tests/echo_monitor.h index 0f45a4b4e3..72bc718fb4 100644 --- a/libs/spandsp/tests/echo_monitor.h +++ b/libs/spandsp/tests/echo_monitor.h @@ -21,8 +21,6 @@ * 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. - * - * $Id: echo_monitor.h,v 1.12 2008/04/26 13:39:16 steveu Exp $ */ /*! \page echo_monitor_page Echo canceller performance monitoring diff --git a/libs/spandsp/tests/echo_tests.c b/libs/spandsp/tests/echo_tests.c index 0878bbc67d..1eac4d927d 100644 --- a/libs/spandsp/tests/echo_tests.c +++ b/libs/spandsp/tests/echo_tests.c @@ -24,8 +24,6 @@ * 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. - * - * $Id: echo_tests.c,v 1.39 2009/05/30 15:23:13 steveu Exp $ */ /*! \page echo_can_tests_page Line echo cancellation for voice tests diff --git a/libs/spandsp/tests/fax_decode.c b/libs/spandsp/tests/fax_decode.c index 4b94adf251..d058f329f2 100644 --- a/libs/spandsp/tests/fax_decode.c +++ b/libs/spandsp/tests/fax_decode.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: fax_decode.c,v 1.58 2009/11/02 13:25:20 steveu Exp $ */ /*! \page fax_decode_page FAX decoder @@ -109,6 +107,32 @@ int octets_per_ecm_frame = 256; int error_correcting_mode = FALSE; int current_fallback = 0; +static void decode_20digit_msg(const uint8_t *pkt, int len) +{ + int p; + int k; + char msg[T30_MAX_IDENT_LEN + 1]; + + if (len > T30_MAX_IDENT_LEN + 3) + { + fprintf(stderr, "XXX %d %d\n", len, T30_MAX_IDENT_LEN + 1); + msg[0] = '\0'; + return; + } + pkt += 2; + p = len - 2; + /* Strip trailing spaces */ + while (p > 1 && pkt[p - 1] == ' ') + p--; + /* The string is actually backwards in the message */ + k = 0; + while (p > 1) + msg[k++] = pkt[--p]; + msg[k] = '\0'; + fprintf(stderr, "%s is: \"%s\"\n", t30_frametype(pkt[0]), msg); +} +/*- End of function --------------------------------------------------------*/ + static void print_frame(const char *io, const uint8_t *fr, int frlen) { int i; @@ -124,6 +148,8 @@ static void print_frame(const char *io, const uint8_t *fr, int frlen) type = fr[2] & 0xFE; if (type == T30_DIS || type == T30_DTC || type == T30_DCS) t30_decode_dis_dtc_dcs(&t30_dummy, fr, frlen); + if (type == T30_CSI || type == T30_TSI || type == T30_PWD || type == T30_SEP || type == T30_SUB || type == T30_SID) + decode_20digit_msg(fr, frlen); if (type == T30_NSF || type == T30_NSS || type == T30_NSC) { if (t35_decode(&fr[3], frlen - 3, &country, &vendor, &model)) @@ -282,8 +308,6 @@ static void t4_end(void) { t4_stats_t stats; int i; - int j; - int k; if (!t4_up) return; @@ -291,17 +315,14 @@ static void t4_end(void) { for (i = 0; i < 256; i++) { - for (j = 0; j < ecm_len[i]; j++) - { - for (k = 0; k < 8; k++) - t4_rx_put_bit(&t4_state, (ecm_data[i][j] >> k) & 1); - } - fprintf(stderr, "%d", (ecm_len[i] < 0) ? 0 : 1); + if (ecm_len[i] > 0) + t4_rx_put_chunk(&t4_state, ecm_data[i], ecm_len[i]); + fprintf(stderr, "%d", (ecm_len[i] <= 0) ? 0 : 1); } fprintf(stderr, "\n"); } t4_rx_end_page(&t4_state); - t4_get_transfer_statistics(&t4_state, &stats); + t4_rx_get_transfer_statistics(&t4_state, &stats); fprintf(stderr, "Pages = %d\n", stats.pages_transferred); fprintf(stderr, "Image size = %dx%d\n", stats.width, stats.length); fprintf(stderr, "Image resolution = %dx%d\n", stats.x_resolution, stats.y_resolution); @@ -465,12 +486,12 @@ int main(int argc, char *argv[]) } if (info.samplerate != SAMPLE_RATE) { - printf(" Unexpected sample rate in audio file '%s'\n", filename); + fprintf(stderr, " Unexpected sample rate in audio file '%s'\n", filename); exit(2); } if (info.channels != 1) { - printf(" Unexpected number of channels in audio file '%s'\n", filename); + fprintf(stderr, " Unexpected number of channels in audio file '%s'\n", filename); exit(2); } diff --git a/libs/spandsp/tests/fax_tester.c b/libs/spandsp/tests/fax_tester.c index 0a3ccea7aa..ec2237f883 100644 --- a/libs/spandsp/tests/fax_tester.c +++ b/libs/spandsp/tests/fax_tester.c @@ -1,7 +1,7 @@ /* * SpanDSP - a series of DSP components for telephony * - * faxtester_tests.c + * fax_tester.c * * Written by Steve Underwood * @@ -10,19 +10,17 @@ * All rights reserved. * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 2.1, - * as published by the Free Software Foundation. + * 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 Lesser General Public License for more details. + * GNU General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software + * 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. - * - * $Id: fax_tester.c,v 1.23 2009/11/02 13:25:20 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/fax_tester.h b/libs/spandsp/tests/fax_tester.h index 39bc2d88d5..9735e0f2a5 100644 --- a/libs/spandsp/tests/fax_tester.h +++ b/libs/spandsp/tests/fax_tester.h @@ -10,19 +10,17 @@ * All rights reserved. * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 2.1, - * as published by the Free Software Foundation. + * 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 Lesser General Public License for more details. + * GNU General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software + * 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. - * - * $Id: fax_tester.h,v 1.9 2008/09/12 14:41:55 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/fax_tests.c b/libs/spandsp/tests/fax_tests.c index 6652e121ca..084a2b034f 100644 --- a/libs/spandsp/tests/fax_tests.c +++ b/libs/spandsp/tests/fax_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: fax_tests.c,v 1.102 2009/05/30 15:23:13 steveu Exp $ */ /*! \page fax_tests_page FAX tests @@ -206,6 +204,7 @@ int main(int argc, char *argv[]) float signal_scaling; time_t start_time; time_t end_time; + int scan_line_time; char *page_header_info; int opt; t30_state_t *t30; @@ -225,8 +224,9 @@ int main(int argc, char *argv[]) use_page_limits = FALSE; signal_level = 0; noise_level = -99; + scan_line_time = 0; supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17; - while ((opt = getopt(argc, argv, "ehH:i:I:lm:n:prRs:tTw:")) != -1) + while ((opt = getopt(argc, argv, "ehH:i:I:lm:n:prRs:S:tTw:")) != -1) { switch (opt) { @@ -266,6 +266,9 @@ int main(int argc, char *argv[]) case 's': signal_level = atoi(optarg); break; + case 'S': + scan_line_time = atoi(optarg); + break; case 't': use_tep = TRUE; break; @@ -340,7 +343,7 @@ int main(int argc, char *argv[]) | T30_SUPPORT_SUB_ADDRESSING); if ((mc->chan & 1)) - t30_set_minimum_scan_line_time(t30, 40); + t30_set_minimum_scan_line_time(t30, scan_line_time); t30_set_supported_image_sizes(t30, T30_SUPPORT_US_LETTER_LENGTH | T30_SUPPORT_US_LEGAL_LENGTH @@ -363,7 +366,11 @@ int main(int argc, char *argv[]) | T30_SUPPORT_600_1200_RESOLUTION); t30_set_supported_modems(t30, supported_modems); if (use_ecm) +#if defined(SPANDSP_SUPPORT_T85) + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION | T30_SUPPORT_T85_COMPRESSION); +#else t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); +#endif if ((mc->chan & 1)) { if (polled_mode) @@ -406,9 +413,16 @@ int main(int argc, char *argv[]) logging = t30_get_logging_state(t30); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); span_log_set_tag(logging, mc->tag); - span_log_set_level(&t30->t4.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); - span_log_set_tag(&t30->t4.logging, mc->tag); - + if ((j & 1)) + { + span_log_set_level(&t30->t4.rx.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_tag(&t30->t4.rx.logging, mc->tag); + } + else + { + span_log_set_level(&t30->t4.tx.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_tag(&t30->t4.tx.logging, mc->tag); + } logging = fax_get_logging_state(mc->fax); span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); span_log_set_tag(logging, mc->tag); diff --git a/libs/spandsp/tests/fax_tests.sh b/libs/spandsp/tests/fax_tests.sh index 02fb8c7e44..a798ff8a6a 100755 --- a/libs/spandsp/tests/fax_tests.sh +++ b/libs/spandsp/tests/fax_tests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # spandsp fax tests # @@ -14,9 +14,6 @@ # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: fax_tests.sh,v 1.5 2008/03/30 18:33:31 steveu Exp $ -# run_fax_test() { diff --git a/libs/spandsp/tests/fax_utils.c b/libs/spandsp/tests/fax_utils.c index 9903109a6b..7e1a927bb8 100644 --- a/libs/spandsp/tests/fax_utils.c +++ b/libs/spandsp/tests/fax_utils.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: fax_utils.c,v 1.3.4.1 2009/12/19 09:47:57 steveu Exp $ */ #if defined(HAVE_CONFIG_H) @@ -91,16 +89,17 @@ void log_transfer_statistics(t30_state_t *s, const char *tag) t30_stats_t t; t30_get_transfer_statistics(s, &t); - printf("%s: bit rate %d\n", tag, t.bit_rate); - printf("%s: ECM %s\n", tag, (t.error_correcting_mode) ? "on" : "off"); printf("%s: tx pages %d, rx pages %d\n", tag, t.pages_tx, t.pages_rx); printf("%s: pages in the file %d\n", tag, t.pages_in_file); + printf("%s: compression type %s (%d)\n", tag, t4_encoding_to_str(t.encoding), t.encoding); + printf("%s: compressed image size %d bytes\n", tag, t.image_size); printf("%s: image size %d pels x %d pels\n", tag, t.width, t.length); printf("%s: image resolution %d pels/m x %d pels/m\n", tag, t.x_resolution, t.y_resolution); + printf("%s: bit rate %d\n", tag, t.bit_rate); + printf("%s: ECM %s\n", tag, (t.error_correcting_mode) ? "on" : "off"); printf("%s: bad rows %d, longest bad row run %d\n", tag, t.bad_rows, t.longest_bad_row_run); printf("%s: bad ECM frames %d\n", tag, t.error_correcting_mode_retries); - printf("%s: compression type %d\n", tag, t.encoding); - printf("%s: image size %d bytes\n", tag, t.image_size); + //printf("%s: RTP events %d. RTN events %d\n", tag, t.rtp_events, t.rtn_events); #if defined(WITH_SPANDSP_INTERNALS) printf("%s: bits per row - min %d, max %d\n", tag, s->t4.min_row_bits, s->t4.max_row_bits); #endif diff --git a/libs/spandsp/tests/fax_utils.h b/libs/spandsp/tests/fax_utils.h index 16ebf630a9..973c63a572 100644 --- a/libs/spandsp/tests/fax_utils.h +++ b/libs/spandsp/tests/fax_utils.h @@ -21,8 +21,6 @@ * 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. - * - * $Id: fax_utils.h,v 1.1 2009/02/20 12:34:20 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/fsk_tests.c b/libs/spandsp/tests/fsk_tests.c index a54f0d3bcb..a2fa50ab5a 100644 --- a/libs/spandsp/tests/fsk_tests.c +++ b/libs/spandsp/tests/fsk_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: fsk_tests.c,v 1.59 2009/11/02 13:25:20 steveu Exp $ */ /*! \page fsk_tests_page FSK modem tests @@ -210,7 +208,7 @@ int main(int argc, char *argv[]) modem_under_test_2 = FSK_V21CH2; log_audio = FALSE; modems_set = 0; - while ((opt = getopt(argc, argv, "c:dlm:nr:s:")) != -1) + while ((opt = getopt(argc, argv, "c:d:lm:nr:s:")) != -1) { switch (opt) { @@ -389,7 +387,16 @@ int main(int argc, char *argv[]) bert_set_report(&caller_bert, 100000, reporter, (void *) (intptr_t) 1); bert_init(&answerer_bert, bits_per_test, BERT_PATTERN_ITU_O152_11, test_bps, 20); bert_set_report(&answerer_bert, 100000, reporter, (void *) (intptr_t) 2); - if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, line_model_no, (float) noise_level, channel_codec, rbs_pattern)) == NULL) + if ((model = both_ways_line_model_init(line_model_no, + (float) noise_level, + -15.0f, + -15.0f, + line_model_no, + (float) noise_level, + -15.0f, + -15.0f, + channel_codec, + rbs_pattern)) == NULL) { fprintf(stderr, " Failed to create line model\n"); exit(2); @@ -488,7 +495,16 @@ int main(int argc, char *argv[]) fsk_rx_set_modem_status_handler(caller_rx, rx_status, (void *) &caller_rx); } noise_level++; - if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, line_model_no, noise_level, channel_codec, 0)) == NULL) + if ((model = both_ways_line_model_init(line_model_no, + (float) noise_level, + line_model_no, + -15.0f, + -15.0f, + noise_level, + channel_codec, + -15.0f, + -15.0f, + 0)) == NULL) { fprintf(stderr, " Failed to create line model\n"); exit(2); diff --git a/libs/spandsp/tests/g1050_tests.c b/libs/spandsp/tests/g1050_tests.c index 95a2333e2d..74f8beebac 100644 --- a/libs/spandsp/tests/g1050_tests.c +++ b/libs/spandsp/tests/g1050_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: g1050_tests.c,v 1.18 2009/05/30 15:23:13 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/tests/g168_tests.c b/libs/spandsp/tests/g168_tests.c index 0484aac7d6..61a42ec453 100644 --- a/libs/spandsp/tests/g168_tests.c +++ b/libs/spandsp/tests/g168_tests.c @@ -23,8 +23,6 @@ * 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. - * - * $Id: g168_tests.c,v 1.20 2009/05/30 15:23:13 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/tests/g711_tests.c b/libs/spandsp/tests/g711_tests.c index 134463b3d6..1975bbba11 100644 --- a/libs/spandsp/tests/g711_tests.c +++ b/libs/spandsp/tests/g711_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: g711_tests.c,v 1.17 2009/05/30 15:23:13 steveu Exp $ */ /*! \page g711_tests_page A-law and u-law conversion tests diff --git a/libs/spandsp/tests/g722_tests.c b/libs/spandsp/tests/g722_tests.c index 4b9f61865f..afb2025c38 100644 --- a/libs/spandsp/tests/g722_tests.c +++ b/libs/spandsp/tests/g722_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: g722_tests.c,v 1.32 2009/06/02 14:55:36 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/g726_tests.c b/libs/spandsp/tests/g726_tests.c index abd77435c3..f48607bdc5 100644 --- a/libs/spandsp/tests/g726_tests.c +++ b/libs/spandsp/tests/g726_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: g726_tests.c,v 1.33 2009/05/30 15:23:13 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/gsm0610_tests.c b/libs/spandsp/tests/gsm0610_tests.c index 6d522bf357..2e0bb50853 100644 --- a/libs/spandsp/tests/gsm0610_tests.c +++ b/libs/spandsp/tests/gsm0610_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: gsm0610_tests.c,v 1.25 2009/05/30 15:23:13 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/hdlc_tests.c b/libs/spandsp/tests/hdlc_tests.c index a4dd3e4e3b..bf7a63995d 100644 --- a/libs/spandsp/tests/hdlc_tests.c +++ b/libs/spandsp/tests/hdlc_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: hdlc_tests.c,v 1.48 2008/11/30 05:43:37 steveu Exp $ */ /*! \file */ @@ -817,6 +815,7 @@ static void decode_bitstream(const char *in_file_name) { char buf[1024]; int bit; + int num; hdlc_rx_state_t rx; FILE *in; @@ -829,8 +828,10 @@ static void decode_bitstream(const char *in_file_name) hdlc_rx_init(&rx, FALSE, TRUE, 2, decode_handler, NULL); while (fgets(buf, 1024, in)) { - if (sscanf(buf, "Rx bit %*d - %d", &bit) == 1) + if (sscanf(buf, "Rx bit %d - %d", &num, &bit) == 2) { + //printf("Rx bit %d - %d\n", num, bit); + //printf("Rx bit %d\n", bit); hdlc_rx_put_bit(&rx, bit); } } diff --git a/libs/spandsp/tests/ima_adpcm_tests.c b/libs/spandsp/tests/ima_adpcm_tests.c index 61fdb8142a..53a6314762 100644 --- a/libs/spandsp/tests/ima_adpcm_tests.c +++ b/libs/spandsp/tests/ima_adpcm_tests.c @@ -22,8 +22,6 @@ * 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. - * - * $Id: ima_adpcm_tests.c,v 1.36 2009/05/30 15:23:14 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/line_model_monitor.cpp b/libs/spandsp/tests/line_model_monitor.cpp index 77454727d4..49af1bdc3a 100644 --- a/libs/spandsp/tests/line_model_monitor.cpp +++ b/libs/spandsp/tests/line_model_monitor.cpp @@ -21,8 +21,6 @@ * 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. - * - * $Id: line_model_monitor.cpp,v 1.5 2008/09/08 16:10:41 steveu Exp $ */ #ifdef HAVE_CONFIG_H diff --git a/libs/spandsp/tests/line_model_monitor.h b/libs/spandsp/tests/line_model_monitor.h index 7af4e8e97f..96c0074a7d 100644 --- a/libs/spandsp/tests/line_model_monitor.h +++ b/libs/spandsp/tests/line_model_monitor.h @@ -21,8 +21,6 @@ * 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. - * - * $Id: line_model_monitor.h,v 1.7 2008/04/26 13:39:17 steveu Exp $ */ /*! \page line_model_monitor_page Telephone line model monitoring diff --git a/libs/spandsp/tests/line_model_tests.c b/libs/spandsp/tests/line_model_tests.c index 309e2e7890..665781e828 100644 --- a/libs/spandsp/tests/line_model_tests.c +++ b/libs/spandsp/tests/line_model_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: line_model_tests.c,v 1.28 2009/09/23 16:02:59 steveu Exp $ */ /*! \page line_model_tests_page Telephony line model tests @@ -209,7 +207,16 @@ static void test_both_ways_model(int line_model_no, int speech_test) awgn_state_t noise1; awgn_state_t noise2; - if ((model = both_ways_line_model_init(line_model_no, -50, line_model_no + 1, -35, channel_codec, rbs_pattern)) == NULL) + if ((model = both_ways_line_model_init(line_model_no, + -50, + -15.0f, + -15.0f, + line_model_no + 1, + -35, + -15.0f, + -15.0f, + channel_codec, + rbs_pattern)) == NULL) { fprintf(stderr, " Failed to create line model\n"); exit(2); diff --git a/libs/spandsp/tests/logging_tests.c b/libs/spandsp/tests/logging_tests.c index 18351ad091..2159b20f8e 100644 --- a/libs/spandsp/tests/logging_tests.c +++ b/libs/spandsp/tests/logging_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: logging_tests.c,v 1.16 2009/02/12 12:38:39 steveu Exp $ */ /*! \page logging_tests_page Logging tests diff --git a/libs/spandsp/tests/lpc10_tests.c b/libs/spandsp/tests/lpc10_tests.c index 6af57d1b7f..2e9a00f220 100644 --- a/libs/spandsp/tests/lpc10_tests.c +++ b/libs/spandsp/tests/lpc10_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: lpc10_tests.c,v 1.24 2009/05/30 15:23:14 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/make_g168_css.c b/libs/spandsp/tests/make_g168_css.c index e485201f62..e31958ecd5 100644 --- a/libs/spandsp/tests/make_g168_css.c +++ b/libs/spandsp/tests/make_g168_css.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: make_g168_css.c,v 1.18 2009/05/30 15:23:14 steveu Exp $ */ /*! \page makecss_page CSS construction for G.168 testing diff --git a/libs/spandsp/tests/media_monitor.cpp b/libs/spandsp/tests/media_monitor.cpp index f798862ef7..cc7519bc82 100644 --- a/libs/spandsp/tests/media_monitor.cpp +++ b/libs/spandsp/tests/media_monitor.cpp @@ -21,8 +21,6 @@ * 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. - * - * $Id: media_monitor.cpp,v 1.5 2008/09/08 16:10:41 steveu Exp $ */ #ifdef HAVE_CONFIG_H diff --git a/libs/spandsp/tests/media_monitor.h b/libs/spandsp/tests/media_monitor.h index 20928df16d..5144913054 100644 --- a/libs/spandsp/tests/media_monitor.h +++ b/libs/spandsp/tests/media_monitor.h @@ -21,8 +21,6 @@ * 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. - * - * $Id: media_monitor.h,v 1.6 2008/04/26 13:39:17 steveu Exp $ */ /*! \page media_monitor_page IP streaming media performance monitoring diff --git a/libs/spandsp/tests/modem_connect_tones_tests.c b/libs/spandsp/tests/modem_connect_tones_tests.c index e2e7b14037..57b937922c 100644 --- a/libs/spandsp/tests/modem_connect_tones_tests.c +++ b/libs/spandsp/tests/modem_connect_tones_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: modem_connect_tones_tests.c,v 1.32 2009/11/02 15:04:15 steveu Exp $ */ /*! \page modem_connect_tones_tests_page Modem connect tones tests diff --git a/libs/spandsp/tests/modem_echo_tests.c b/libs/spandsp/tests/modem_echo_tests.c index 42895eff84..74d77074b0 100644 --- a/libs/spandsp/tests/modem_echo_tests.c +++ b/libs/spandsp/tests/modem_echo_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: modem_echo_tests.c,v 1.32 2009/05/30 15:23:14 steveu Exp $ */ /*! \page modem_echo_can_tests_page Line echo cancellation for modems tests @@ -288,7 +286,7 @@ int main(int argc, char *argv[]) line_model_no = atoi(argv[1]); } time(&now); - ctx = modem_echo_can_create(256); + ctx = modem_echo_can_init(256); awgn_init_dbm0(&far_noise_source, 7162534, -50.0f); signal_load(&local_css, "sound_c1_8k.wav"); diff --git a/libs/spandsp/tests/modem_monitor.cpp b/libs/spandsp/tests/modem_monitor.cpp index 7086013d15..4df0b4e1fd 100644 --- a/libs/spandsp/tests/modem_monitor.cpp +++ b/libs/spandsp/tests/modem_monitor.cpp @@ -21,8 +21,6 @@ * 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. - * - * $Id: modem_monitor.cpp,v 1.17 2008/09/04 14:40:05 steveu Exp $ */ #ifdef HAVE_CONFIG_H diff --git a/libs/spandsp/tests/modem_monitor.h b/libs/spandsp/tests/modem_monitor.h index 636ef3f1c5..b1b79fda06 100644 --- a/libs/spandsp/tests/modem_monitor.h +++ b/libs/spandsp/tests/modem_monitor.h @@ -21,8 +21,6 @@ * 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. - * - * $Id: modem_monitor.h,v 1.16 2008/09/03 13:41:42 steveu Exp $ */ /*! \page constel_page Modem performance monitoring diff --git a/libs/spandsp/tests/noise_tests.c b/libs/spandsp/tests/noise_tests.c index 34571a35e9..dc0e7bcbf4 100644 --- a/libs/spandsp/tests/noise_tests.c +++ b/libs/spandsp/tests/noise_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: noise_tests.c,v 1.18 2009/05/30 15:23:14 steveu Exp $ */ /*! \page noise_tests_page Noise generator tests diff --git a/libs/spandsp/tests/pcap_parse.c b/libs/spandsp/tests/pcap_parse.c new file mode 100644 index 0000000000..e5e0014826 --- /dev/null +++ b/libs/spandsp/tests/pcap_parse.c @@ -0,0 +1,202 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * pcap_parse.c + * + * Written by Steve Underwood + * + * Copyright (C) 2009 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. + * + * Some code from SIPP (http://sf.net/projects/sipp) was used as a model + * for how to work with PCAP files. That code was authored by Guillaume + * TEISSIER from FTR&D 02/02/2006, and released under the GPL2 licence. + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#if defined(__HPUX) || defined(__CYGWIN) || defined(__FreeBSD__) +#include +#endif +#include +#ifndef __CYGWIN +#include +#endif +#include + +#include +#include +#include +#include + +#include "udptl.h" +#include "spandsp.h" +#include "pcap_parse.h" + +#if defined(__HPUX) || defined(__DARWIN) || defined(__CYGWIN) || defined(__FreeBSD__) + +struct iphdr +{ +#ifdef _HPUX_LI + unsigned int ihl:4; + unsigned int version:4; +#else + unsigned int version:4; + unsigned int ihl:4; +#endif + uint8_t tos; + uint16_t tot_len; + uint16_t id; + uint16_t frag_off; + uint8_t ttl; + uint8_t protocol; + uint16_t check; + uint32_t saddr; + uint32_t daddr; + /*The options start here. */ +}; + +#endif + +/* We define our own structures for Ethernet Header and IPv6 Header as they are not available on CYGWIN. + * We only need the fields, which are necessary to determine the type of the next header. + * we could also define our own structures for UDP and IPv4. We currently use the structures + * made available by the platform, as we had no problems to get them on all supported platforms. + */ + +typedef struct _ether_hdr +{ + char ether_dst[6]; + char ether_src[6]; + u_int16_t ether_type; /* we only need the type, so we can determine, if the next header is IPv4 or IPv6 */ +} ether_hdr; + +typedef struct _ipv6_hdr +{ + char dontcare[6]; + u_int8_t nxt_header; /* we only need the next header, so we can determine, if the next header is UDP or not */ + char dontcare2[33]; +} ipv6_hdr; + +char errbuf[PCAP_ERRBUF_SIZE]; + +int pcap_scan_pkts(const char *file, + uint32_t src_addr, + uint16_t src_port, + uint32_t dest_addr, + uint16_t dest_port, + pcap_timing_update_handler_t *timing_update_handler, + pcap_packet_handler_t *packet_handler, + void *user_data) +{ + pcap_t *pcap; + struct pcap_pkthdr *pkthdr; + uint8_t *pktdata; + const uint8_t *body; + int body_len; + int total_pkts; + uint32_t pktlen; + ether_hdr *ethhdr; + struct iphdr *iphdr; + ipv6_hdr *ip6hdr; + struct udphdr *udphdr; + + total_pkts = 0; + if ((pcap = pcap_open_offline(file, errbuf)) == NULL) + { + fprintf(stderr, "Can't open PCAP file '%s'\n", file); + return -1; + } + pkthdr = NULL; + pktdata = NULL; +#if defined(HAVE_PCAP_NEXT_EX) + while (pcap_next_ex(pcap, &pkthdr, (const uint8_t **) &pktdata) == 1) + { +#else + if ((pkthdr = (struct pcap_pkthdr *) malloc(sizeof(*pkthdr))) == NULL) + { + fprintf(stderr, "Can't allocate memory for pcap pkthdr\n"); + return -1; + } + while ((pktdata = (uint8_t *) pcap_next(pcap, pkthdr)) != NULL) + { +#endif + ethhdr = (ether_hdr *) pktdata; + if (ntohs(ethhdr->ether_type) != 0x0800 /* IPv4 */ + && + ntohs(ethhdr->ether_type) != 0x86dd) /* IPv6 */ + { + continue; + } + iphdr = (struct iphdr *) ((uint8_t *) ethhdr + sizeof(*ethhdr)); + if (iphdr && iphdr->version == 6) + { + /* ipv6 */ + pktlen = (uint32_t) pkthdr->len - sizeof(*ethhdr) - sizeof(*ip6hdr); + ip6hdr = (ipv6_hdr *) (void *) iphdr; + if (ip6hdr->nxt_header != IPPROTO_UDP) + continue; + udphdr = (struct udphdr *) ((uint8_t *) ip6hdr + sizeof(*ip6hdr)); + } + else + { + /* ipv4 */ + if (iphdr->protocol != IPPROTO_UDP) + continue; +#if defined(__DARWIN) || defined(__CYGWIN) || defined(__FreeBSD__) + udphdr = (struct udphdr *) ((uint8_t *) iphdr + (iphdr->ihl << 2) + 4); + pktlen = (uint32_t) ntohs(udphdr->uh_ulen); +#elif defined ( __HPUX) + udphdr = (struct udphdr *) ((uint8_t *) iphdr + (iphdr->ihl << 2)); + pktlen = (uint32_t) pkthdr->len - sizeof(*ethhdr) - sizeof(*iphdr); +#else + udphdr = (struct udphdr *) ((uint8_t *) iphdr + (iphdr->ihl << 2)); + pktlen = (uint32_t) ntohs(udphdr->len); +#endif + } + timing_update_handler(user_data, &pkthdr->ts); + if (src_addr && ntohl(iphdr->saddr) != src_addr) + continue; + if (src_port && ntohs(udphdr->source) != src_port) + continue; + if (dest_addr && ntohl(iphdr->daddr) != dest_addr) + continue; + if (dest_port && ntohs(udphdr->dest) != dest_port) + continue; + + body = (const uint8_t *) udphdr; + body += sizeof(udphdr); + body_len = pktlen - sizeof(udphdr); + packet_handler(user_data, body, body_len); + + total_pkts++; + } + fprintf(stderr, "In pcap %s, npkts %d\n", file, total_pkts); + pcap_close(pcap); + + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/tests/pcap_parse.h b/libs/spandsp/tests/pcap_parse.h new file mode 100644 index 0000000000..eabaf69d83 --- /dev/null +++ b/libs/spandsp/tests/pcap_parse.h @@ -0,0 +1,54 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * pcap_parse.h + * + * Written by Steve Underwood + * + * Copyright (C) 2009 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. + */ + +/*! \file */ + +#if !defined(_SPANDSP_PCAP_PARSE_H_) +#define _SPANDSP_PCAP_PARSE_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +typedef int (pcap_timing_update_handler_t)(void *user_data, struct timeval *ts); +typedef int (pcap_packet_handler_t)(void *user_data, const uint8_t *pkt, int len); + + +int pcap_scan_pkts(const char *file, + uint32_t src_addr, + uint16_t src_port, + uint32_t dest_addr, + uint16_t dest_port, + pcap_timing_update_handler_t *timing_update_handler, + pcap_packet_handler_t *packet_handler, + void *user_data); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/tests/playout_tests.c b/libs/spandsp/tests/playout_tests.c index 736b3bd624..8f72469a89 100644 --- a/libs/spandsp/tests/playout_tests.c +++ b/libs/spandsp/tests/playout_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: playout_tests.c,v 1.29 2009/05/30 15:23:14 steveu Exp $ */ /*! \page playout_tests_page Playout (jitter buffering) tests diff --git a/libs/spandsp/tests/plc_tests.c b/libs/spandsp/tests/plc_tests.c index 6d9c21196d..a0703ac99e 100644 --- a/libs/spandsp/tests/plc_tests.c +++ b/libs/spandsp/tests/plc_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: plc_tests.c,v 1.26 2009/05/30 15:23:14 steveu Exp $ */ /*! \page plc_tests_page Packet loss concealment tests diff --git a/libs/spandsp/tests/power_meter_tests.c b/libs/spandsp/tests/power_meter_tests.c index fc4888150b..37ef1b41e1 100644 --- a/libs/spandsp/tests/power_meter_tests.c +++ b/libs/spandsp/tests/power_meter_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: power_meter_tests.c,v 1.24 2009/05/30 15:23:14 steveu Exp $ */ /*! \page power_meter_tests_page Power meter tests diff --git a/libs/spandsp/tests/queue_tests.c b/libs/spandsp/tests/queue_tests.c index 86ff0f4cd5..4bc6a30bc7 100644 --- a/libs/spandsp/tests/queue_tests.c +++ b/libs/spandsp/tests/queue_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: queue_tests.c,v 1.13 2009/04/11 17:43:04 steveu Exp $ */ /* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. */ @@ -570,7 +568,7 @@ static void functional_message_tests(void) if (monitored_queue_write_msg(buf, MSG_LEN) != MSG_LEN) break; } - printf("Full at chunk %d (expected %u)\n", i, BUF_LEN/(MSG_LEN + sizeof(uint16_t)) + 1); + printf("Full at chunk %d (expected %lu)\n", i, (unsigned long int) BUF_LEN/(MSG_LEN + sizeof(uint16_t)) + 1); if (i != BUF_LEN/(MSG_LEN + sizeof(uint16_t)) + 1) tests_failed(); if ((len = monitored_queue_write_msg(buf, 5)) == 5) @@ -628,7 +626,7 @@ static void functional_message_tests(void) } printf("Free space = %d (%d)\n", queue_free_space(queue), BUF_LEN - (total_in - total_out)); display_queue_pointers(); - printf("Full at chunk %d (expected %u)\n", i, BUF_LEN/(MSG_LEN + sizeof(uint16_t))); + printf("Full at chunk %d (expected %lu)\n", i, (unsigned long int) BUF_LEN/(MSG_LEN + sizeof(uint16_t))); if (i != BUF_LEN/(MSG_LEN + sizeof(uint16_t))) tests_failed(); display_queue_pointers(); diff --git a/libs/spandsp/tests/r2_mf_rx_tests.c b/libs/spandsp/tests/r2_mf_rx_tests.c index f36aec25d8..6f71965291 100644 --- a/libs/spandsp/tests/r2_mf_rx_tests.c +++ b/libs/spandsp/tests/r2_mf_rx_tests.c @@ -22,8 +22,6 @@ * 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. - * - * $Id: r2_mf_rx_tests.c,v 1.14 2009/05/30 15:23:14 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/r2_mf_tx_tests.c b/libs/spandsp/tests/r2_mf_tx_tests.c index 3988c43b66..8dcee259d1 100644 --- a/libs/spandsp/tests/r2_mf_tx_tests.c +++ b/libs/spandsp/tests/r2_mf_tx_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: r2_mf_tx_tests.c,v 1.16 2009/05/30 15:23:14 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/regression_tests.sh b/libs/spandsp/tests/regression_tests.sh index efd02619fb..56f628fdd3 100755 --- a/libs/spandsp/tests/regression_tests.sh +++ b/libs/spandsp/tests/regression_tests.sh @@ -16,9 +16,6 @@ # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: regression_tests.sh,v 1.59 2009/09/22 13:28:18 steveu Exp $ -# ITUTESTS_TIF=../test-data/itu/fax/itutests.tif MIXEDSIZES_TIF=../test-data/itu/fax/mixed_size_pages.tif @@ -224,7 +221,7 @@ rm -f fax_tests_1.tif RETVAL=$? if [ $RETVAL != 0 ] then - echo fax_tests failed! + echo fax_tests mixed-sizes failed! exit $RETVAL fi # Now use tiffcmp to check the results. It will return non-zero if any page images differ. The -t @@ -233,7 +230,7 @@ tiffcmp -t ${MIXEDSIZES_TIF} fax_tests_1.tif >/dev/null RETVAL=$? if [ $RETVAL != 0 ] then - echo fax_tests failed! + echo fax_tests mixed-sizes failed! exit $RETVAL fi echo fax_tests completed OK @@ -310,6 +307,15 @@ then fi echo ima_adpcm_tests completed OK +./image_translate_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo image_translate_tests failed! + exit $RETVAL +fi +echo image_translate_tests completed OK + ./logging_tests >$STDOUT_DEST 2>$STDERR_DEST RETVAL=$? if [ $RETVAL != 0 ] @@ -429,6 +435,15 @@ echo r2_mf_tx_tests completed OK #fi #echo rfc2198_sim_tests completed OK +./saturated_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo saturated_tests failed! + exit $RETVAL +fi +echo saturated_tests completed OK + ./schedule_tests >$STDOUT_DEST 2>$STDERR_DEST RETVAL=$? if [ $RETVAL != 0 ] @@ -666,6 +681,37 @@ then fi echo t4_tests completed OK +#rm -f t4_t6_tests_receive.tif +#./t4_t6_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo t4_t6_tests failed! +# exit $RETVAL +#fi +#echo t4_t6_tests completed OK +#rm -f t81_t82_arith_coding_tests_receive.tif +#./t4_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo t81_t82_arith_coding_tests failed! +# exit $RETVAL +#fi +#echo t81_t82_arith_coding_tests completed OK +echo t81_t82_arith_coding_tests not enabled + +#rm -f t85_tests_receive.tif +#./t4_tests >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo t85_tests failed! +# exit $RETVAL +#fi +#echo t85_tests completed OK +echo t85_tests not enabled + #./time_scale_tests >$STDOUT_DEST 2>$STDERR_DEST #RETVAL=$? #if [ $RETVAL != 0 ] @@ -676,6 +722,15 @@ echo t4_tests completed OK #echo time_scale_tests completed OK echo time_scale_tests not enabled +./timezone_tests >$STDOUT_DEST 2>$STDERR_DEST +RETVAL=$? +if [ $RETVAL != 0 ] +then + echo timezone_tests failed! + exit $RETVAL +fi +echo timezone_tests completed OK + #./tone_detect_tests >$STDOUT_DEST 2>$STDERR_DEST #RETVAL=$? #if [ $RETVAL != 0 ] @@ -782,6 +837,15 @@ then fi echo v29_tests completed OK +#./v32bis_tests -b 14400 -s -42 -n -66 >$STDOUT_DEST 2>$STDERR_DEST +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo v32bis_tests failed! +# exit $RETVAL +#fi +#echo v32bis_tests completed OK + #./v42_tests >$STDOUT_DEST 2>$STDERR_DEST #RETVAL=$? #if [ $RETVAL != 0 ] @@ -792,14 +856,15 @@ echo v29_tests completed OK #echo v42_tests completed OK echo v42_tests not enabled -./v42bis_tests.sh >/dev/null -RETVAL=$? -if [ $RETVAL != 0 ] -then - echo v42bis_tests failed! - exit $RETVAL -fi -echo v42bis_tests completed OK +#./v42bis_tests.sh >/dev/null +#RETVAL=$? +#if [ $RETVAL != 0 ] +#then +# echo v42bis_tests failed! +# exit $RETVAL +#fi +#echo v42bis_tests completed OK +echo v42bis_tests not enabled ./v8_tests >$STDOUT_DEST 2>$STDERR_DEST RETVAL=$? diff --git a/libs/spandsp/tests/rfc2198_sim_tests.c b/libs/spandsp/tests/rfc2198_sim_tests.c index ecb124048a..34a19ad265 100644 --- a/libs/spandsp/tests/rfc2198_sim_tests.c +++ b/libs/spandsp/tests/rfc2198_sim_tests.c @@ -23,8 +23,6 @@ * 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. - * - * $Id: rfc2198_sim_tests.c,v 1.7 2009/05/30 15:23:14 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/tests/schedule_tests.c b/libs/spandsp/tests/schedule_tests.c index 2255d9181a..576d08a1c4 100644 --- a/libs/spandsp/tests/schedule_tests.c +++ b/libs/spandsp/tests/schedule_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: schedule_tests.c,v 1.20 2008/11/30 05:43:37 steveu Exp $ */ /*! \page schedule_tests_page Event scheduler tests diff --git a/libs/spandsp/tests/sig_tone_tests.c b/libs/spandsp/tests/sig_tone_tests.c index 78da9fb4c6..ac47daaef6 100644 --- a/libs/spandsp/tests/sig_tone_tests.c +++ b/libs/spandsp/tests/sig_tone_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: sig_tone_tests.c,v 1.32 2010/03/11 14:22:30 steveu Exp $ */ /*! \file */ @@ -40,6 +38,7 @@ #endif #include +#include #include #include #include diff --git a/libs/spandsp/tests/super_tone_rx_tests.c b/libs/spandsp/tests/super_tone_rx_tests.c index 5e4e4825e2..32832f11ed 100644 --- a/libs/spandsp/tests/super_tone_rx_tests.c +++ b/libs/spandsp/tests/super_tone_rx_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: super_tone_rx_tests.c,v 1.33 2009/06/02 14:55:36 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/super_tone_tx_tests.c b/libs/spandsp/tests/super_tone_tx_tests.c index 1349bb11b9..5ab6ddcb50 100644 --- a/libs/spandsp/tests/super_tone_tx_tests.c +++ b/libs/spandsp/tests/super_tone_tx_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: super_tone_tx_tests.c,v 1.26 2009/05/30 15:23:14 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/swept_tone_tests.c b/libs/spandsp/tests/swept_tone_tests.c index 010fbcd3d5..f9b4dfb338 100644 --- a/libs/spandsp/tests/swept_tone_tests.c +++ b/libs/spandsp/tests/swept_tone_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: swept_tone_tests.c,v 1.2 2009/09/22 13:28:18 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/t31_tests.c b/libs/spandsp/tests/t31_tests.c index e06f30f559..49919d052d 100644 --- a/libs/spandsp/tests/t31_tests.c +++ b/libs/spandsp/tests/t31_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: t31_tests.c,v 1.72 2009/05/30 15:23:14 steveu Exp $ */ /*! \file */ @@ -192,6 +190,74 @@ static const struct command_response_s fax_receive_test_seq[] = EXCHANGE("ATH0\r", "\r\nOK\r\n") }; +static const struct command_response_s v34_fax_send_test_seq[] = +{ + EXCHANGE("ATE0\r", "ATE0\r\r\nOK\r\n"), + EXCHANGE("AT+A8E=3,,\r", "\r\nOK\r\n"), + EXCHANGE("AT+FCLASS=1.0\r", "\r\nOK\r\n"), + EXCHANGE("AT+F34=14,4,2\r", "\r\nOK\r\n"), + EXCHANGE("ATD123456789\r", "\r\n+A8A:1\r\nOK\r\n"), + EXCHANGE("AT+A8M=8185D490\r", "\r\n+A8M:8185D490\r\nOK\r\n"), + EXCHANGE("ATO\r", "\r\n+A8J:1\r\n+F34=14,2\r\nCONNECT\r\n"), + // + RESPONSE("\x10\x6B\x10\x7D\x10\x6F" "\xFF\x13\x80\x00\xEE\xF8\x80\x80\x91\x80\x80\x80\x18\x78\x57\x10\x03"), // For audio FAXing + //RESPONSE("\x10\x6B\x10\x7D\x10\x6F" ""\xFF\x13\x80\x04\xEE\xF8\x80\x80\x91\x80\x80\x80\x18\xE4\xE7\x10\x03"), // For T.38 FAXing + // + // + EXCHANGE("\xFF\x13\x83\x01\xC6\x80\x80\x80\x80\x01\xFD\x13\x10\x03", "\xFF\x13\x84\xEA\x7D\x10\x03"), + EXCHANGE("\x10\x04", "\x10\x04\x10\x7D"), + // + EXCHANGE("\x10\x6B", "\x10\x6B\x10\x79\x10\x6F"), + // + // + // + EXCHANGE("\x10\x03", "\xFF\x13\x8C\xA2\xF1\x10\x03"), + // + EXCHANGE("\xFF\x13\xFB\x10\x03\x10\x04", "\r\nOK\r\n"), + EXCHANGE("ATH\r", "\r\nOK\r\n") +}; + +static const struct command_response_s v34_fax_receive_test_seq[] = +{ + EXCHANGE("ATE0\r", "ATE0\r\r\nOK\r\n"), + EXCHANGE("AT+A8E=,2,\r", "\r\nOK\r\n"), + EXCHANGE("AT+FCLASS=1.0\r", "\r\nOK\r\n"), + EXCHANGE("AT+F34=10\r", "\r\nOK\r\n"), + RESPONSE("\r\nRING\r\n"), + EXCHANGE("ATA\r", "\r\n+A8M:8185D490\r\nOK\r\n"), + EXCHANGE("AT+A8M=8185D490;O\r", "\r\n+A8J:1\r\n+F34:10,1\r\nCONNECT\r\n"), + RESPONSE("\x10\x10\x10"), + EXCHANGE("ATH\r", "\r\nOK\r\n") +}; + +static const struct command_response_s v34_fax_receive_a_test_seq[] = +{ + EXCHANGE("ATE0\r", "ATE0\r\r\nOK\r\n"), + EXCHANGE("AT+A8E=,3,\r", "\r\nOK\r\n"), + EXCHANGE("AT+FCLASS=1.0\r", "\r\nOK\r\n"), + EXCHANGE("AT+F34=10\r", "\r\nOK\r\n"), + RESPONSE("\r\nRING\r\n"), + EXCHANGE("ATA\r", "\r\n+A8C:1\r\n+A8C:1\r\n"), + EXCHANGE("X", "\r\nOK\r\n"), + EXCHANGE("AT+A8E=,2,\r", "\r\n+A8M:8185D490\r\nOK\r\n"), + EXCHANGE("AT+A8M=8185D490\r", "\r\n+A8J:1\r\n+F34:10,1\r\nCONNECT\r\n"), + RESPONSE("\x10\x10\x10"), + EXCHANGE("ATH\r", "\r\nOK\r\n") +}; + +static const struct command_response_s v34_fax_receive_b_test_seq[] = +{ + EXCHANGE("ATE0\r", "ATE0\r\r\nOK\r\n"), + EXCHANGE("AT+A8E=,3,\r", "\r\nOK\r\n"), + EXCHANGE("AT+FCLASS=1.0\r", "\r\nOK\r\n"), + EXCHANGE("AT+F34=10\r", "\r\nOK\r\n"), + RESPONSE("\r\nRING\r\n"), + EXCHANGE("ATA\r", "\r\nA8I:81\r\n"), + RESPONSE("A8I:81\r\n"), + EXCHANGE("X", "\r\nOK\r\n"), + EXCHANGE("AT+A8E=,2,\r", "\r\n+A8M:8185D490\r\nOK\r\n") +}; + char *decode_test_file = NULL; int countdown = 0; int command_response_test_step = -1; @@ -345,7 +411,7 @@ static int at_tx_handler(at_state_t *s, void *user_data, const uint8_t *buf, siz for (i = 0; i < response_buf_ptr; i++) printf("%02x ", response_buf[i] & 0xFF); printf("\n"); -printf("Match %d against %d\n", response_buf_ptr, fax_test_seq[test_seq_ptr].len_response); + printf("Match %d against %d\n", response_buf_ptr, fax_test_seq[test_seq_ptr].len_response); if (response_buf_ptr >= fax_test_seq[test_seq_ptr].len_response && memcmp(fax_test_seq[test_seq_ptr].response, response_buf, fax_test_seq[test_seq_ptr].len_response) == 0) @@ -444,8 +510,9 @@ static int t38_tests(int use_gui, int test_sending, int model_no, int speed_patt span_log_set_tag(logging, "T.31"); t38_core = t31_get_t38_core_state(t31_state); - span_log_set_level(&t38_core->logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); - span_log_set_tag(&t38_core->logging, "T.31"); + logging = t38_core_get_logging_state(t38_core); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.31"); span_log_set_level(&t31_state->at_state.logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); span_log_set_tag(&t31_state->at_state.logging, "T.31"); @@ -859,8 +926,12 @@ static int t30_tests(int log_audio, int test_sending) if (fax_rx(fax_state, t31_amp, SAMPLES_PER_CHUNK)) break; - span_log_bump_samples(&fax_state->logging, SAMPLES_PER_CHUNK); - span_log_bump_samples(&t30->logging, SAMPLES_PER_CHUNK); + logging = fax_get_logging_state(fax_state); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + logging = t30_get_logging_state(t30); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + logging = t31_get_logging_state(t31_state); + span_log_bump_samples(logging, SAMPLES_PER_CHUNK); if (log_audio) { diff --git a/libs/spandsp/tests/t38_core_tests.c b/libs/spandsp/tests/t38_core_tests.c index 57562452e5..1b0fa30b53 100644 --- a/libs/spandsp/tests/t38_core_tests.c +++ b/libs/spandsp/tests/t38_core_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: t38_core_tests.c,v 1.16 2009/07/14 13:54:22 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/t38_decode.c b/libs/spandsp/tests/t38_decode.c new file mode 100644 index 0000000000..39c8ec6b4b --- /dev/null +++ b/libs/spandsp/tests/t38_decode.c @@ -0,0 +1,277 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * pcap-parse.c + * + * Written by Steve Underwood + * + * Copyright (C) 2009 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. + * + * Some code from SIPP (http://sf.net/projects/sipp) was used as a model + * for how to work with PCAP files. That code was authored by Guillaume + * TEISSIER from FTR&D 02/02/2006, and released under the GPL2 licence. + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#if !defined(_WIN32) +#include +#endif + +#include "udptl.h" +#include "spandsp.h" + +#include "fax_utils.h" +#include "pcap_parse.h" + +#define INPUT_FILE_NAME "t38.pcap" +#define OUTPUT_FILE_NAME "t38pcap.tif" + +t38_terminal_state_t *t38_state; + +static int phase_b_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase B", i); + printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_rx_parameters(s, tag); + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static int phase_d_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase D", i); + printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + return T30_ERR_OK; +} +/*- End of function --------------------------------------------------------*/ + +static void phase_e_handler(t30_state_t *s, void *user_data, int result) +{ + int i; + t30_stats_t t; + char tag[20]; + + i = (int) (intptr_t) user_data; + snprintf(tag, sizeof(tag), "%c: Phase E", i); + printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result)); + log_transfer_statistics(s, tag); + log_tx_parameters(s, tag); + log_rx_parameters(s, tag); + t30_get_transfer_statistics(s, &t); +} +/*- End of function --------------------------------------------------------*/ + +static int tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int timing_update(void *user_data, struct timeval *ts) +{ + t30_state_t *t30; + t38_core_state_t *t38_core; + logging_state_t *logging; + int samples; + static int64_t current = 0; + int64_t when; + int64_t diff; + + when = ts->tv_sec*1000000LL + ts->tv_usec; + if (current == 0) + current = when; + + diff = when - current; + samples = diff/125LL; + if (samples > 0) + { + logging = t38_terminal_get_logging_state(t38_state); + span_log_bump_samples(logging, samples); + t38_core = t38_terminal_get_t38_core_state(t38_state); + logging = t38_core_get_logging_state(t38_core); + span_log_bump_samples(logging, samples); + t30 = t38_terminal_get_t30_state(t38_state); + logging = t30_get_logging_state(t30); + span_log_bump_samples(logging, samples); + + t38_terminal_send_timeout(t38_state, samples); + current = when; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int ifp_handler(void *user_data, const uint8_t msg[], int len, int seq_no) +{ + t38_core_state_t *t38_core; + int i; + + printf("%5d >>> ", seq_no); + for (i = 0; i < len; i++) + printf("%02X ", msg[i]); + printf("\n"); + + t38_core = t38_terminal_get_t38_core_state(t38_state); + t38_core_rx_ifp_packet(t38_core, msg, len, seq_no); + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int process_packet(void *user_data, const uint8_t *pkt, int len) +{ + static udptl_state_t *state = NULL; + + if (state == NULL) + state = udptl_init(NULL, UDPTL_ERROR_CORRECTION_REDUNDANCY, 3, 3, ifp_handler, NULL); + + udptl_rx_packet(state, pkt, len); + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + t30_state_t *t30; + t38_core_state_t *t38_core; + logging_state_t *logging; + const char *input_file_name; + int t38_version; + int use_ecm; + int use_tep; + int options; + int supported_modems; + int fill_removal; + int opt; + uint32_t src_addr; + uint16_t src_port; + uint32_t dest_addr; + uint16_t dest_port; + + + use_ecm = FALSE; + t38_version = 1; + input_file_name = INPUT_FILE_NAME; + fill_removal = FALSE; + use_tep = FALSE; + supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17; + src_addr = 0; + src_port = 0; + dest_addr = 0; + dest_port = 0; + while ((opt = getopt(argc, argv, "D:d:eFi:m:S:s:tv:")) != -1) + { + switch (opt) + { + case 'D': + dest_addr = atoi(optarg); + break; + case 'd': + dest_port = atoi(optarg); + break; + case 'e': + use_ecm = TRUE; + break; + case 'F': + fill_removal = TRUE; + break; + case 'i': + input_file_name = optarg; + break; + case 'm': + supported_modems = atoi(optarg); + break; + case 'S': + src_addr = atoi(optarg); + break; + case 's': + src_port = atoi(optarg); + break; + case 't': + use_tep = TRUE; + break; + case 'v': + t38_version = atoi(optarg); + break; + default: + //usage(); + exit(2); + break; + } + } + + if ((t38_state = t38_terminal_init(NULL, FALSE, tx_packet_handler, NULL)) == NULL) + { + fprintf(stderr, "Cannot start the T.38 channel\n"); + exit(2); + } + t30 = t38_terminal_get_t30_state(t38_state); + t38_core = t38_terminal_get_t38_core_state(t38_state); + t38_set_t38_version(t38_core, t38_version); + t38_terminal_set_config(t38_state, options); + t38_terminal_set_tep_mode(t38_state, use_tep); + + logging = t38_terminal_get_logging_state(t38_state); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38"); + + logging = t38_core_get_logging_state(t38_core); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38"); + + logging = t30_get_logging_state(t30); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38"); + + t30_set_supported_modems(t30, supported_modems); + t30_set_tx_ident(t30, "11111111"); + t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12); + t30_set_rx_file(t30, OUTPUT_FILE_NAME, -1); + t30_set_phase_b_handler(t30, phase_b_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_ecm_capability(t30, TRUE); + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION | T30_SUPPORT_T85_COMPRESSION); + + if (pcap_scan_pkts(input_file_name, src_addr, src_port, dest_addr, dest_port, timing_update, process_packet, NULL)) + exit(2); +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/tests/t38_gateway_tests.c b/libs/spandsp/tests/t38_gateway_tests.c index aa7b98e7d2..f15a16ed9a 100644 --- a/libs/spandsp/tests/t38_gateway_tests.c +++ b/libs/spandsp/tests/t38_gateway_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: t38_gateway_tests.c,v 1.82.4.1 2009/12/19 09:47:57 steveu Exp $ */ /*! \file */ @@ -73,10 +71,6 @@ These tests exercise the path #define INPUT_FILE_NAME "../test-data/itu/fax/itutests.tif" #define OUTPUT_FILE_NAME "t38.tif" #define OUTPUT_FILE_NAME_WAVE "t38_gateway.wav" -#define OUTPUT_FILE_NAME_T30A "t38_gateway_t30a.wav" -#define OUTPUT_FILE_NAME_T38A "t38_gateway_t38a.wav" -#define OUTPUT_FILE_NAME_T30B "t38_gateway_t30b.wav" -#define OUTPUT_FILE_NAME_T38B "t38_gateway_t38b.wav" fax_state_t *fax_state_a; t38_gateway_state_t *t38_state_a; @@ -243,14 +237,16 @@ int main(int argc, char *argv[]) const char *input_file_name; int i; int seq_no; - int model_no; - int speed_pattern_no; + int g1050_model_no; + int g1050_speed_pattern_no; double tx_when; double rx_when; int supported_modems; int fill_removal; int use_gui; int opt; + int drop_frame; + int drop_frame_rate; t38_stats_t stats; fax_state_t *fax; t30_state_t *t30; @@ -263,18 +259,24 @@ int main(int argc, char *argv[]) t38_version = 1; input_file_name = INPUT_FILE_NAME; simulate_incrementing_repeats = FALSE; - model_no = 0; - speed_pattern_no = 1; + g1050_model_no = 0; + g1050_speed_pattern_no = 1; fill_removal = FALSE; use_gui = FALSE; use_tep = FALSE; feedback_audio = FALSE; use_transmit_on_idle = TRUE; supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17; - while ((opt = getopt(argc, argv, "efFgi:Ilm:M:s:tv:")) != -1) + drop_frame = 0; + drop_frame_rate = 0; + while ((opt = getopt(argc, argv, "D:efFgi:Ilm:M:s:tv:")) != -1) { switch (opt) { + case 'D': + drop_frame_rate = + drop_frame = atoi(optarg); + break; case 'e': use_ecm = TRUE; break; @@ -305,10 +307,10 @@ int main(int argc, char *argv[]) supported_modems = atoi(optarg); break; case 'M': - model_no = optarg[0] - 'A' + 1; + g1050_model_no = optarg[0] - 'A' + 1; break; case 's': - speed_pattern_no = atoi(optarg); + g1050_speed_pattern_no = atoi(optarg); break; case 't': use_tep = TRUE; @@ -339,12 +341,12 @@ int main(int argc, char *argv[]) memset(silence, 0, sizeof(silence)); srand48(0x1234567); - if ((path_a_to_b = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + if ((path_a_to_b = g1050_init(g1050_model_no, g1050_speed_pattern_no, 100, 33)) == NULL) { fprintf(stderr, "Failed to start IP network path model\n"); exit(2); } - if ((path_b_to_a = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + if ((path_b_to_a = g1050_init(g1050_model_no, g1050_speed_pattern_no, 100, 33)) == NULL) { fprintf(stderr, "Failed to start IP network path model\n"); exit(2); @@ -514,8 +516,17 @@ int main(int argc, char *argv[]) t30_amp_a[i] += t38_amp_hist_a[hist_ptr][i] >> 1; memcpy(t38_amp_hist_a[hist_ptr], t38_amp_a, sizeof(int16_t)*SAMPLES_PER_CHUNK); } - if (t38_gateway_rx(t38_state_a, t30_amp_a, t30_len_a)) - break; + if (drop_frame_rate && --drop_frame == 0) + { + drop_frame = drop_frame_rate; + if (t38_gateway_rx_fillin(t38_state_a, t30_len_a)) + break; + } + else + { + if (t38_gateway_rx(t38_state_a, t30_amp_a, t30_len_a)) + break; + } t38_len_a = t38_gateway_tx(t38_state_a, t38_amp_a, SAMPLES_PER_CHUNK); if (!use_transmit_on_idle) @@ -557,8 +568,17 @@ int main(int argc, char *argv[]) t30_amp_b[i] += t38_amp_hist_b[hist_ptr][i] >> 1; memcpy(t38_amp_hist_b[hist_ptr], t38_amp_b, sizeof(int16_t)*SAMPLES_PER_CHUNK); } - if (t38_gateway_rx(t38_state_b, t30_amp_b, t30_len_b)) - break; + if (drop_frame_rate && --drop_frame == 0) + { + drop_frame = drop_frame_rate; + if (t38_gateway_rx_fillin(t38_state_b, t30_len_b)) + break; + } + else + { + if (t38_gateway_rx(t38_state_b, t30_amp_b, t30_len_b)) + break; + } t38_len_b = t38_gateway_tx(t38_state_b, t38_amp_b, SAMPLES_PER_CHUNK); if (!use_transmit_on_idle) diff --git a/libs/spandsp/tests/t38_gateway_to_terminal_tests.c b/libs/spandsp/tests/t38_gateway_to_terminal_tests.c index 8c2e47c2d3..9a27985794 100644 --- a/libs/spandsp/tests/t38_gateway_to_terminal_tests.c +++ b/libs/spandsp/tests/t38_gateway_to_terminal_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: t38_gateway_to_terminal_tests.c,v 1.66.4.1 2009/12/19 09:47:57 steveu Exp $ */ /*! \file */ @@ -88,6 +86,15 @@ int succeeded[2] = {FALSE, FALSE}; int simulate_incrementing_repeats = FALSE; +int t38_version; +int use_ecm; +int use_tep; +int use_transmit_on_idle; +int supported_modems; +int use_gui; +int g1050_model_no; +int g1050_speed_pattern_no; + static int phase_b_handler(t30_state_t *s, void *user_data, int result) { int i; @@ -192,6 +199,179 @@ static int tx_packet_handler_b(t38_core_state_t *s, void *user_data, const uint8 } /*- End of function --------------------------------------------------------*/ +static int decode_test(const char *decode_test_file) +{ + int16_t t38_amp_a[SAMPLES_PER_CHUNK]; + int16_t t30_amp_a[SAMPLES_PER_CHUNK]; + SNDFILE *wave_handle; + t30_state_t *t30; + t38_core_state_t *t38_core; + logging_state_t *logging; + int t38_len_a; + int t30_len_a; + int msg_len; + uint8_t msg[1024]; + int seq_no; + double tx_when; + double rx_when; + + printf("Decode test data file '%s'\n", decode_test_file); + + if ((wave_handle = sf_open_telephony_read(decode_test_file, 1)) == NULL) + { + fprintf(stderr, " Cannot open audio file '%s'\n", decode_test_file); + exit(2); + } + + srand48(0x1234567); + if ((path_a_to_b = g1050_init(g1050_model_no, g1050_speed_pattern_no, 100, 33)) == NULL) + { + fprintf(stderr, "Failed to start IP network path model\n"); + exit(2); + } + if ((path_b_to_a = g1050_init(g1050_model_no, g1050_speed_pattern_no, 100, 33)) == NULL) + { + fprintf(stderr, "Failed to start IP network path model\n"); + exit(2); + } + + memset(t30_amp_a, 0, sizeof(t30_amp_a)); + + if ((t38_state_a = t38_gateway_init(NULL, tx_packet_handler_a, t38_state_b)) == NULL) + { + fprintf(stderr, "Cannot start the T.38 channel\n"); + exit(2); + } + t38_core = t38_gateway_get_t38_core_state(t38_state_a); + t38_gateway_set_transmit_on_idle(t38_state_a, use_transmit_on_idle); + t38_set_t38_version(t38_core, t38_version); + t38_gateway_set_ecm_capability(t38_state_a, use_ecm); + + logging = t38_gateway_get_logging_state(t38_state_a); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-A"); + + logging = t38_core_get_logging_state(t38_core); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-A"); + + logging = &t38_state_a->audio.modems.v17_rx.logging; + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "V.17-A"); + + memset(t38_amp_a, 0, sizeof(t38_amp_a)); + + if ((t38_state_b = t38_terminal_init(NULL, FALSE, tx_packet_handler_b, t38_state_a)) == NULL) + { + fprintf(stderr, "Cannot start the T.38 channel\n"); + exit(2); + } + t30 = t38_terminal_get_t30_state(t38_state_b); + t38_core = t38_terminal_get_t38_core_state(t38_state_b); + t38_set_t38_version(t38_core, t38_version); + + logging = t38_terminal_get_logging_state(t38_state_b); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-B"); + + logging = t38_core_get_logging_state(t38_core); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-B"); + + logging = t30_get_logging_state(t30); + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "T.38-B"); + + t30_set_supported_modems(t30, supported_modems); + t30_set_tx_ident(t30, "22222222"); + t30_set_rx_file(t30, OUTPUT_FILE_NAME, -1); + t30_set_phase_b_handler(t30, phase_b_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_ecm_capability(t30, use_ecm); + if (use_ecm) + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + +#if defined(ENABLE_GUI) + if (use_gui) + start_media_monitor(); +#endif + for (;;) + { + t30_len_a = sf_readf_short(wave_handle, t30_amp_a, SAMPLES_PER_CHUNK); + + logging = t38_gateway_get_logging_state(t38_state_a); + span_log_bump_samples(logging, t30_len_a); + t38_core = t38_gateway_get_t38_core_state(t38_state_a); + logging = t38_core_get_logging_state(t38_core); + span_log_bump_samples(logging, t30_len_a); + logging = &t38_state_a->audio.modems.v17_rx.logging; + span_log_bump_samples(logging, t30_len_a); + + logging = t38_terminal_get_logging_state(t38_state_b); + span_log_bump_samples(logging, t30_len_a); + t38_core = t38_terminal_get_t38_core_state(t38_state_b); + logging = t38_core_get_logging_state(t38_core); + span_log_bump_samples(logging, t30_len_a); + + t30 = t38_terminal_get_t30_state(t38_state_b); + logging = t30_get_logging_state(t30); + span_log_bump_samples(logging, t30_len_a); + + t38_terminal_send_timeout(t38_state_b, t30_len_a); + + if (t38_gateway_rx(t38_state_a, t30_amp_a, t30_len_a)) + break; + + t38_len_a = t38_gateway_tx(t38_state_a, t38_amp_a, t30_len_a); + if (!use_transmit_on_idle) + { + if (t38_len_a < SAMPLES_PER_CHUNK) + { + memset(t38_amp_a + t38_len_a, 0, sizeof(int16_t)*(t30_len_a - t38_len_a)); + t38_len_a = t30_len_a; + } + } + + when += (float) t30_len_a/(float) SAMPLE_RATE; + + while ((msg_len = g1050_get(path_a_to_b, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0) + { +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_rx(seq_no, tx_when, rx_when); +#endif + t38_core = t38_terminal_get_t38_core_state(t38_state_b); + t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no); + } + while ((msg_len = g1050_get(path_b_to_a, msg, 1024, when, &seq_no, &tx_when, &rx_when)) >= 0) + { +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_rx(seq_no, tx_when, rx_when); +#endif + t38_core = t38_gateway_get_t38_core_state(t38_state_a); + t38_core_rx_ifp_packet(t38_core, msg, msg_len, seq_no); + } + + if (done[0] && done[1]) + break; +#if defined(ENABLE_GUI) + if (use_gui) + media_monitor_update_display(); +#endif + } + t38_gateway_release(t38_state_a); + t38_terminal_release(t38_state_b); + if (sf_close(wave_handle) != 0) + { + fprintf(stderr, " Cannot close audio file '%s'\n", decode_test_file); + exit(2); + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + int main(int argc, char *argv[]) { int16_t t38_amp_a[SAMPLES_PER_CHUNK]; @@ -203,42 +383,39 @@ int main(int argc, char *argv[]) uint8_t msg[1024]; int log_audio; int outframes; - int t38_version; - int use_ecm; - int use_tep; int feedback_audio; - int use_transmit_on_idle; SNDFILE *wave_handle; const char *input_file_name; int i; int seq_no; - int model_no; - int speed_pattern_no; double tx_when; double rx_when; - int supported_modems; - int use_gui; int opt; t30_state_t *t30; t38_core_state_t *t38_core; logging_state_t *logging; + char *decode_test_file; log_audio = FALSE; t38_version = 1; use_ecm = FALSE; input_file_name = INPUT_FILE_NAME; simulate_incrementing_repeats = FALSE; - model_no = 0; - speed_pattern_no = 1; + g1050_model_no = 0; + g1050_speed_pattern_no = 1; use_gui = FALSE; use_tep = FALSE; feedback_audio = FALSE; use_transmit_on_idle = TRUE; supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17; - while ((opt = getopt(argc, argv, "efgi:Ilm:M:s:tv:")) != -1) + decode_test_file = NULL; + while ((opt = getopt(argc, argv, "d:efgi:Ilm:M:s:tv:")) != -1) { switch (opt) { + case 'd': + decode_test_file = optarg; + break; case 'e': use_ecm = TRUE; break; @@ -266,10 +443,10 @@ int main(int argc, char *argv[]) supported_modems = atoi(optarg); break; case 'M': - model_no = optarg[0] - 'A' + 1; + g1050_model_no = optarg[0] - 'A' + 1; break; case 's': - speed_pattern_no = atoi(optarg); + g1050_speed_pattern_no = atoi(optarg); break; case 't': use_tep = TRUE; @@ -288,6 +465,12 @@ int main(int argc, char *argv[]) if (use_ecm) printf("Using ECM\n"); + if (decode_test_file) + { + decode_test(decode_test_file); + return 0; + } + wave_handle = NULL; if (log_audio) { @@ -299,12 +482,12 @@ int main(int argc, char *argv[]) } srand48(0x1234567); - if ((path_a_to_b = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + if ((path_a_to_b = g1050_init(g1050_model_no, g1050_speed_pattern_no, 100, 33)) == NULL) { fprintf(stderr, "Failed to start IP network path model\n"); exit(2); } - if ((path_b_to_a = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + if ((path_b_to_a = g1050_init(g1050_model_no, g1050_speed_pattern_no, 100, 33)) == NULL) { fprintf(stderr, "Failed to start IP network path model\n"); exit(2); @@ -357,6 +540,10 @@ int main(int argc, char *argv[]) span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); span_log_set_tag(logging, "T.38-A"); + logging = &t38_state_a->audio.modems.v17_rx.logging; + span_log_set_level(logging, SPAN_LOG_DEBUG | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME); + span_log_set_tag(logging, "V.17-A"); + memset(t38_amp_a, 0, sizeof(t38_amp_a)); if ((t38_state_b = t38_terminal_init(NULL, FALSE, tx_packet_handler_b, t38_state_a)) == NULL) @@ -401,11 +588,15 @@ int main(int argc, char *argv[]) t30 = fax_get_t30_state(fax_state_a); logging = t30_get_logging_state(t30); span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + logging = t38_gateway_get_logging_state(t38_state_a); span_log_bump_samples(logging, SAMPLES_PER_CHUNK); t38_core = t38_gateway_get_t38_core_state(t38_state_a); logging = t38_core_get_logging_state(t38_core); span_log_bump_samples(logging, SAMPLES_PER_CHUNK); + logging = &t38_state_a->audio.modems.v17_rx.logging; + span_log_bump_samples(logging, t30_len_a); + logging = t38_terminal_get_logging_state(t38_state_b); span_log_bump_samples(logging, SAMPLES_PER_CHUNK); t38_core = t38_terminal_get_t38_core_state(t38_state_b); @@ -495,6 +686,7 @@ int main(int argc, char *argv[]) #endif } fax_release(fax_state_a); + t38_gateway_release(t38_state_a); t38_terminal_release(t38_state_b); if (log_audio) { diff --git a/libs/spandsp/tests/t38_non_ecm_buffer_tests.c b/libs/spandsp/tests/t38_non_ecm_buffer_tests.c index e8384c1f8c..64d81f71ac 100644 --- a/libs/spandsp/tests/t38_non_ecm_buffer_tests.c +++ b/libs/spandsp/tests/t38_non_ecm_buffer_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: t38_non_ecm_buffer_tests.c,v 1.5.4.1 2009/12/19 06:43:28 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/t38_terminal_tests.c b/libs/spandsp/tests/t38_terminal_tests.c index 9dbece39a7..f0bda0b7f0 100644 --- a/libs/spandsp/tests/t38_terminal_tests.c +++ b/libs/spandsp/tests/t38_terminal_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: t38_terminal_tests.c,v 1.67.4.1 2009/12/19 09:47:57 steveu Exp $ */ /*! \file */ @@ -199,10 +197,10 @@ int main(int argc, char *argv[]) int t38_version; int seq_no; int use_ecm; - int without_pacing; + int options; int use_tep; - int model_no; - int speed_pattern_no; + int g1050_model_no; + int g1050_speed_pattern_no; const char *input_file_name; double tx_when; double rx_when; @@ -214,16 +212,16 @@ int main(int argc, char *argv[]) logging_state_t *logging; t38_version = 1; - without_pacing = FALSE; + options = 0; use_tep = FALSE; input_file_name = INPUT_FILE_NAME; use_ecm = FALSE; simulate_incrementing_repeats = FALSE; - model_no = 0; - speed_pattern_no = 1; + g1050_model_no = 0; + g1050_speed_pattern_no = 1; use_gui = FALSE; supported_modems = T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17; - while ((opt = getopt(argc, argv, "efgi:Im:M:ps:tv:")) != -1) + while ((opt = getopt(argc, argv, "efgi:Im:M:o:s:tv:")) != -1) { switch (opt) { @@ -248,13 +246,13 @@ int main(int argc, char *argv[]) supported_modems = atoi(optarg); break; case 'M': - model_no = optarg[0] - 'A' + 1; + g1050_model_no = optarg[0] - 'A' + 1; break; - case 'p': - without_pacing = TRUE; + case 'o': + options = atoi(optarg); break; case 's': - speed_pattern_no = atoi(optarg); + g1050_speed_pattern_no = atoi(optarg); break; case 't': use_tep = TRUE; @@ -274,12 +272,12 @@ int main(int argc, char *argv[]) printf("Using ECM\n"); srand48(0x1234567); - if ((path_a_to_b = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + if ((path_a_to_b = g1050_init(g1050_model_no, g1050_speed_pattern_no, 100, 33)) == NULL) { fprintf(stderr, "Failed to start IP network path model\n"); exit(2); } - if ((path_b_to_a = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + if ((path_b_to_a = g1050_init(g1050_model_no, g1050_speed_pattern_no, 100, 33)) == NULL) { fprintf(stderr, "Failed to start IP network path model\n"); exit(2); @@ -293,7 +291,7 @@ int main(int argc, char *argv[]) t30 = t38_terminal_get_t30_state(t38_state_a); t38_core = t38_terminal_get_t38_core_state(t38_state_a); t38_set_t38_version(t38_core, t38_version); - t38_terminal_set_config(t38_state_a, without_pacing); + t38_terminal_set_config(t38_state_a, options); t38_terminal_set_tep_mode(t38_state_a, use_tep); logging = t38_terminal_get_logging_state(t38_state_a); @@ -317,7 +315,7 @@ int main(int argc, char *argv[]) t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A'); t30_set_ecm_capability(t30, use_ecm); if (use_ecm) - t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION | T30_SUPPORT_T85_COMPRESSION); if ((t38_state_b = t38_terminal_init(NULL, FALSE, tx_packet_handler_b, t38_state_a)) == NULL) { @@ -327,7 +325,7 @@ int main(int argc, char *argv[]) t30 = t38_terminal_get_t30_state(t38_state_b); t38_core = t38_terminal_get_t38_core_state(t38_state_b); t38_set_t38_version(t38_core, t38_version); - t38_terminal_set_config(t38_state_b, without_pacing); + t38_terminal_set_config(t38_state_b, options); t38_terminal_set_tep_mode(t38_state_b, use_tep); logging = t38_terminal_get_logging_state(t38_state_b); @@ -351,7 +349,7 @@ int main(int argc, char *argv[]) t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'B'); t30_set_ecm_capability(t30, use_ecm); if (use_ecm) - t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION); + t30_set_supported_compressions(t30, T30_SUPPORT_T4_1D_COMPRESSION | T30_SUPPORT_T4_2D_COMPRESSION | T30_SUPPORT_T6_COMPRESSION | T30_SUPPORT_T85_COMPRESSION); #if defined(ENABLE_GUI) if (use_gui) diff --git a/libs/spandsp/tests/t38_terminal_to_gateway_tests.c b/libs/spandsp/tests/t38_terminal_to_gateway_tests.c index f982f90926..d9484a0660 100644 --- a/libs/spandsp/tests/t38_terminal_to_gateway_tests.c +++ b/libs/spandsp/tests/t38_terminal_to_gateway_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: t38_terminal_to_gateway_tests.c,v 1.65.4.1 2009/12/19 09:47:57 steveu Exp $ */ /*! \file */ @@ -212,8 +210,8 @@ int main(int argc, char *argv[]) const char *input_file_name; int i; int seq_no; - int model_no; - int speed_pattern_no; + int g1050_model_no; + int g1050_speed_pattern_no; double tx_when; double rx_when; int use_gui; @@ -228,8 +226,8 @@ int main(int argc, char *argv[]) use_ecm = FALSE; input_file_name = INPUT_FILE_NAME; simulate_incrementing_repeats = FALSE; - model_no = 0; - speed_pattern_no = 1; + g1050_model_no = 0; + g1050_speed_pattern_no = 1; use_gui = FALSE; use_tep = FALSE; feedback_audio = FALSE; @@ -266,10 +264,10 @@ int main(int argc, char *argv[]) supported_modems = atoi(optarg); break; case 'M': - model_no = optarg[0] - 'A' + 1; + g1050_model_no = optarg[0] - 'A' + 1; break; case 's': - speed_pattern_no = atoi(optarg); + g1050_speed_pattern_no = atoi(optarg); break; case 't': use_tep = TRUE; @@ -299,12 +297,12 @@ int main(int argc, char *argv[]) } srand48(0x1234567); - if ((path_a_to_b = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + if ((path_a_to_b = g1050_init(g1050_model_no, g1050_speed_pattern_no, 100, 33)) == NULL) { fprintf(stderr, "Failed to start IP network path model\n"); exit(2); } - if ((path_b_to_a = g1050_init(model_no, speed_pattern_no, 100, 33)) == NULL) + if ((path_b_to_a = g1050_init(g1050_model_no, g1050_speed_pattern_no, 100, 33)) == NULL) { fprintf(stderr, "Failed to start IP network path model\n"); exit(2); diff --git a/libs/spandsp/tests/t4_tests.c b/libs/spandsp/tests/t4_tests.c index 6d6830e9de..3b3188dd08 100644 --- a/libs/spandsp/tests/t4_tests.c +++ b/libs/spandsp/tests/t4_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: t4_tests.c,v 1.69.4.1 2009/12/19 09:47:57 steveu Exp $ */ /*! \file */ @@ -99,6 +97,9 @@ static const char t4_test_patterns[][1728 + 1] = /* Line end codes to V(0) H(7,0). */ }; +int rows_written = 0; +int rows_read = 0; + static void dump_image_as_xxx(t4_state_t *state) { uint8_t *s; @@ -114,9 +115,7 @@ static void dump_image_as_xxx(t4_state_t *state) for (j = 0; j < state->bytes_per_row; j++) { for (k = 0; k < 8; k++) - { printf((state->image_buffer[i*state->bytes_per_row + j] & (0x80 >> k)) ? "X" : " "); - } } printf("\n"); } @@ -127,8 +126,10 @@ static void display_page_stats(t4_state_t *s) { t4_stats_t stats; - t4_get_transfer_statistics(s, &stats); + t4_rx_get_transfer_statistics(s, &stats); printf("Pages = %d\n", stats.pages_transferred); + printf("Compression = %s\n", t4_encoding_to_str(stats.encoding)); + printf("Compressed size = %d\n", stats.line_image_size); printf("Image size = %d pels x %d pels\n", stats.width, stats.length); printf("Image resolution = %d pels/m x %d pels/m\n", stats.x_resolution, stats.y_resolution); printf("Bad rows = %d\n", stats.bad_rows); @@ -142,12 +143,11 @@ static int row_read_handler(void *user_data, uint8_t buf[], size_t len) int i; int j; const char *s; - static int row = 0; /* Send the test pattern. */ - s = t4_test_patterns[row++]; - if (row >= 16) + if (rows_read >= 16) return 0; + s = t4_test_patterns[rows_read++]; memset(buf, 0, len); for (i = 0; i < len; i++) { @@ -158,7 +158,7 @@ static int row_read_handler(void *user_data, uint8_t buf[], size_t len) } } if (*s) - printf("Oops - '%c' at end of row %d\n", *s, row); + printf("Oops - '%c' at end of row %d\n", *s, rows_read); return len; } /*- End of function --------------------------------------------------------*/ @@ -168,15 +168,12 @@ static int row_write_handler(void *user_data, const uint8_t buf[], size_t len) int i; int j; const char *s; - static int row = 0; uint8_t ref[8192]; /* Verify that what is received matches the test pattern. */ if (len == 0) return 0; - s = t4_test_patterns[row++]; - if (row >= 16) - row = 0; + s = t4_test_patterns[rows_written++]; memset(ref, 0, len); for (i = 0; i < len; i++) { @@ -187,13 +184,13 @@ static int row_write_handler(void *user_data, const uint8_t buf[], size_t len) } } if (*s) - printf("Oops - '%c' at end of row %d\n", *s, row); + printf("Oops - '%c' at end of row %d\n", *s, rows_written); if (memcmp(buf, ref, len)) { - printf("Test failed at row %d\n", row); + printf("Test failed at row %d\n", rows_written); exit(2); } - return len; + return 0; } /*- End of function --------------------------------------------------------*/ @@ -223,7 +220,7 @@ static int detect_page_end(int bit, int page_ended) eol_zeros = 11; eol_ones = (page_ended == T4_COMPRESSION_ITU_T4_2D) ? 2 : 1; expected_eols = (page_ended == T4_COMPRESSION_ITU_T6) ? 2 : 6; - return FALSE; + return 0; } /* Monitor whether the EOLs are there in the correct amount */ @@ -286,11 +283,15 @@ int main(int argc, char *argv[]) T4_COMPRESSION_ITU_T4_1D, T4_COMPRESSION_ITU_T4_2D, T4_COMPRESSION_ITU_T6, - //T4_COMPRESSION_ITU_T85, +#if defined(SPANDSP_SUPPORT_T85) + T4_COMPRESSION_ITU_T85, + T4_COMPRESSION_ITU_T85_L0, +#endif //T4_COMPRESSION_ITU_T43, //T4_COMPRESSION_ITU_T45, //T4_COMPRESSION_ITU_T81, - //T4_COMPRESSION_ITU_SYCC_T81 + //T4_COMPRESSION_ITU_SYCC_T81, + -1 }; int sends; int page_no; @@ -301,6 +302,7 @@ int main(int argc, char *argv[]) int compression; int compression_step; int add_page_headers; + int overlay_page_headers; int min_row_bits; int restart_pages; int block_size; @@ -308,6 +310,7 @@ int main(int argc, char *argv[]) uint8_t block[1024]; const char *in_file_name; const char *decode_file_name; + const char *page_header_tz; int opt; int i; int bit_error_rate; @@ -322,16 +325,18 @@ int main(int argc, char *argv[]) compression = -1; compression_step = 0; add_page_headers = FALSE; + overlay_page_headers = FALSE; restart_pages = FALSE; in_file_name = IN_FILE_NAME; decode_file_name = NULL; + page_header_tz = NULL; /* Use a non-zero default minimum row length to ensure we test the consecutive EOLs part properly. */ min_row_bits = 50; - block_size = 0; + block_size = 1; bit_error_rate = 0; dump_as_xxx = FALSE; - while ((opt = getopt(argc, argv, "126b:d:ehri:m:x")) != -1) + while ((opt = getopt(argc, argv, "1268b:d:ehHri:m:t:x")) != -1) { switch (opt) { @@ -347,6 +352,12 @@ int main(int argc, char *argv[]) compression = T4_COMPRESSION_ITU_T6; compression_step = -1; break; +#if defined(SPANDSP_SUPPORT_T85) + case '8': + compression = T4_COMPRESSION_ITU_T85; + compression_step = -1; + break; +#endif case 'b': block_size = atoi(optarg); if (block_size > 1024) @@ -360,6 +371,11 @@ int main(int argc, char *argv[]) break; case 'h': add_page_headers = TRUE; + overlay_page_headers = FALSE; + break; + case 'H': + add_page_headers = TRUE; + overlay_page_headers = TRUE; break; case 'r': restart_pages = TRUE; @@ -370,6 +386,9 @@ int main(int argc, char *argv[]) case 'm': min_row_bits = atoi(optarg); break; + case 't': + page_header_tz = optarg; + break; case 'x': dump_as_xxx = TRUE; break; @@ -394,7 +413,7 @@ int main(int argc, char *argv[]) printf("Failed to init T.4 rx\n"); exit(2); } - span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); t4_rx_set_rx_encoding(&receive_state, compression); t4_rx_set_x_resolution(&receive_state, T4_X_RESOLUTION_R8); //t4_rx_set_y_resolution(&receive_state, T4_Y_RESOLUTION_FINE); @@ -444,6 +463,32 @@ int main(int argc, char *argv[]) break; } } + else if (strlen(buf) > 2 && sscanf(buf, "T.30 Rx: %x %x", (unsigned int *) &bit, (unsigned int *) &bit) == 2) + { + /* Useful for breaking up ECM logs */ + if (pkt_no != last_pkt_no + 1) + printf("Packet %u\n", pkt_no); + last_pkt_no = pkt_no; + for (i = 0; i < 256; i++) + { + if (sscanf(&buf[22 + 3*i], "%x", (unsigned int *) &bit) != 1) + break; + bit = bit_reverse8(bit); + if ((end_of_page = t4_rx_put_byte(&receive_state, bit))) + break; + } + } + else if (sscanf(buf, "%04x %02x %02x %02x", (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit) == 4) + { + for (i = 0; i < 16; i++) + { + if (sscanf(&buf[6 + 3*i], "%x", (unsigned int *) &bit) != 1) + break; + bit = bit_reverse8(bit); + if ((end_of_page = t4_rx_put_byte(&receive_state, bit))) + break; + } + } else if (sscanf(buf, "%08x %02x %02x %02x", (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit, (unsigned int *) &bit) == 4) { for (i = 0; i < 16; i++) @@ -481,9 +526,9 @@ int main(int argc, char *argv[]) printf("Failed to init T.4 tx\n"); exit(2); } - span_log_set_level(&send_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_level(&send_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); t4_tx_set_row_read_handler(&send_state, row_read_handler, NULL); - t4_tx_set_min_row_bits(&send_state, min_row_bits); + t4_tx_set_min_bits_per_row(&send_state, min_row_bits); t4_tx_set_local_ident(&send_state, "111 2222 3333"); /* Receive end puts TIFF to a function. */ @@ -492,7 +537,7 @@ int main(int argc, char *argv[]) printf("Failed to init T.4 rx\n"); exit(2); } - span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); t4_rx_set_row_write_handler(&receive_state, row_write_handler, NULL); t4_rx_set_image_width(&receive_state, t4_tx_get_image_width(&send_state)); t4_rx_set_x_resolution(&receive_state, t4_tx_get_x_resolution(&send_state)); @@ -509,32 +554,86 @@ int main(int argc, char *argv[]) if (compression_step >= 0) { compression = compression_sequence[compression_step++]; - if (compression_step > 3) + if (compression < 0) break; } t4_tx_set_tx_encoding(&send_state, compression); t4_rx_set_rx_encoding(&receive_state, compression); + rows_read = 0; + rows_written = 0; if (t4_tx_start_page(&send_state)) break; - t4_rx_start_page(&receive_state); - do + if (t4_rx_start_page(&receive_state)) + break; + switch (block_size) { - bit = t4_tx_get_bit(&send_state); - if (bit == SIG_STATUS_END_OF_DATA) + case 0: + do { - if (++end_marks > 50) + bit = t4_tx_get_bit(&send_state); + if (bit == SIG_STATUS_END_OF_DATA) { - printf("Receiver missed the end of page mark\n"); - tests_failed++; - break; + if (++end_marks > 50) + { + printf("Receiver missed the end of page mark\n"); + tests_failed++; + break; + } + } + end_of_page = t4_rx_put_bit(&receive_state, bit & 1); + } + while (!end_of_page); + break; + case 1: + do + { + bit = t4_tx_get_byte(&send_state); + if ((bit & 0x100)) + { + if (++end_marks > 50) + { + printf("Receiver missed the end of page mark\n"); + tests_failed++; + break; + } + } + end_of_page = t4_rx_put_byte(&receive_state, bit & 0xFF); + } + while (!end_of_page); + if ((t4_tx_get_byte(&send_state) & 0x100) == 0) + { + printf("Page ended, but source is not reporting end of data\n"); + tests_failed++; + } + break; + default: + do + { + bit = t4_tx_get_chunk(&send_state, block, block_size); + if (bit > 0) + end_of_page = t4_rx_put_chunk(&receive_state, block, bit); + if (bit < block_size) + { + if (++end_marks > 50) + { + printf("Receiver missed the end of page mark\n"); + tests_failed++; + break; + } } } - end_of_page = t4_rx_put_bit(&receive_state, bit & 1); + while (!end_of_page); + break; } - while (!end_of_page); + display_page_stats(&receive_state); t4_tx_end_page(&send_state); t4_rx_end_page(&receive_state); + if (rows_read != (15 + 1) || rows_written != (15 + 1)) + { + printf("Test failed: %d rows read, %d rows written\n", rows_read, rows_written); + exit(2); + } if (compression_step < 0) break; } @@ -549,8 +648,8 @@ int main(int argc, char *argv[]) printf("Failed to init T.4 send\n"); exit(2); } - span_log_set_level(&send_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); - t4_tx_set_min_row_bits(&send_state, min_row_bits); + span_log_set_level(&send_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); + t4_tx_set_min_bits_per_row(&send_state, min_row_bits); t4_tx_set_local_ident(&send_state, "111 2222 3333"); /* Receive end puts TIFF to a new file. */ @@ -559,7 +658,7 @@ int main(int argc, char *argv[]) printf("Failed to init T.4 rx for '%s'\n", OUT_FILE_NAME); exit(2); } - span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); + span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_FLOW); t4_rx_set_x_resolution(&receive_state, t4_tx_get_x_resolution(&send_state)); t4_rx_set_y_resolution(&receive_state, t4_tx_get_y_resolution(&send_state)); t4_rx_set_image_width(&receive_state, t4_tx_get_image_width(&send_state)); @@ -578,6 +677,9 @@ int main(int argc, char *argv[]) t4_tx_set_header_info(&send_state, "Header"); else t4_tx_set_header_info(&send_state, NULL); + if (page_header_tz && page_header_tz[0]) + t4_tx_set_header_tz(&send_state, page_header_tz); + //t4_tx_set_header_overlays_image(&send_state, overlay_page_headers); if (restart_pages && (sends & 1)) { /* Use restart, to send the page a second time */ @@ -589,8 +691,11 @@ int main(int argc, char *argv[]) if (compression_step >= 0) { compression = compression_sequence[compression_step++]; - if (compression_step > 2) + if (compression < 0) + { compression_step = 0; + compression = compression_sequence[compression_step++]; + } } t4_tx_set_tx_encoding(&send_state, compression); t4_rx_set_rx_encoding(&receive_state, compression); @@ -601,8 +706,9 @@ int main(int argc, char *argv[]) t4_rx_start_page(&receive_state); detect_page_end(-1000000, compression); page_ended = FALSE; - if (block_size == 0) + switch (block_size) { + case 0: for (;;) { bit = t4_tx_get_bit(&send_state); @@ -629,9 +735,8 @@ int main(int argc, char *argv[]) { t4_rx_put_bit(&receive_state, (rand() >> 10) & 1); } - } - else if (block_size == 1) - { + break; + case 1: do { bit = t4_tx_get_byte(&send_state); @@ -647,9 +752,13 @@ int main(int argc, char *argv[]) end_of_page = t4_rx_put_byte(&receive_state, bit & 0xFF); } while (!end_of_page); - } - else - { + if ((t4_tx_get_byte(&send_state) & 0x100) == 0) + { + printf("Page ended, but source is not reporting end of data\n"); + tests_failed++; + } + break; + default: do { bit = t4_tx_get_chunk(&send_state, block, block_size); @@ -666,6 +775,7 @@ int main(int argc, char *argv[]) } } while (!end_of_page); + break; } if (dump_as_xxx) dump_image_as_xxx(&receive_state); diff --git a/libs/spandsp/tests/testadsi.c b/libs/spandsp/tests/testadsi.c index d98fa19de1..dc578a6ecd 100644 --- a/libs/spandsp/tests/testadsi.c +++ b/libs/spandsp/tests/testadsi.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: testadsi.c,v 1.23 2009/05/30 15:23:14 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/tests/testfax.c b/libs/spandsp/tests/testfax.c index 2e4a75d082..e484ee898c 100644 --- a/libs/spandsp/tests/testfax.c +++ b/libs/spandsp/tests/testfax.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: testfax.c,v 1.33 2009/05/30 15:23:14 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/tests/time_scale_tests.c b/libs/spandsp/tests/time_scale_tests.c index 3f66e9a813..b642b0c72e 100644 --- a/libs/spandsp/tests/time_scale_tests.c +++ b/libs/spandsp/tests/time_scale_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: time_scale_tests.c,v 1.24 2009/05/30 15:23:14 steveu Exp $ */ /*! \page time_scale_tests_page Time scaling tests diff --git a/libs/spandsp/tests/tone_detect_tests.c b/libs/spandsp/tests/tone_detect_tests.c index 4ae6c703f9..9375f157a2 100644 --- a/libs/spandsp/tests/tone_detect_tests.c +++ b/libs/spandsp/tests/tone_detect_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: tone_detect_tests.c,v 1.12 2009/05/30 15:23:14 steveu Exp $ */ /*! \page tone_detect_tests_page Tone detection tests diff --git a/libs/spandsp/tests/tone_generate_tests.c b/libs/spandsp/tests/tone_generate_tests.c index 1e5035510f..d1614f1626 100644 --- a/libs/spandsp/tests/tone_generate_tests.c +++ b/libs/spandsp/tests/tone_generate_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: tone_generate_tests.c,v 1.23 2010/05/22 13:20:18 steveu Exp $ */ /*! \page tone_generate_tests_page Tone generation tests diff --git a/libs/spandsp/tests/tsb85_tests.c b/libs/spandsp/tests/tsb85_tests.c index d8b5da7c96..ffab4e7737 100644 --- a/libs/spandsp/tests/tsb85_tests.c +++ b/libs/spandsp/tests/tsb85_tests.c @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: tsb85_tests.c,v 1.32 2009/05/30 15:23:14 steveu Exp $ */ /*! \file */ @@ -449,16 +447,16 @@ static int string_to_msg(uint8_t msg[], uint8_t mask[], const char buf[]) while (*t) { /* Skip white space */ - while (isspace(*t)) + while (isspace((int) *t)) t++; /* If we find ... we allow arbitrary addition info beyond this point in the message */ if (t[0] == '.' && t[1] == '.' && t[2] == '.') { return -i; } - else if (isxdigit(*t)) + else if (isxdigit((int) *t)) { - for ( ; isxdigit(*t); t++) + for ( ; isxdigit((int) *t); t++) { x = *t; if (x >= 'a') @@ -474,7 +472,7 @@ static int string_to_msg(uint8_t msg[], uint8_t mask[], const char buf[]) { /* There is a mask following the byte */ mask[i] = 0; - for (t++; isxdigit(*t); t++) + for (t++; isxdigit((int) *t); t++) { x = *t; if (x >= 'a') @@ -486,7 +484,7 @@ static int string_to_msg(uint8_t msg[], uint8_t mask[], const char buf[]) mask[i] = (mask[i] << 4) | x; } } - if (*t && !isspace(*t)) + if (*t && !isspace((int) *t)) { /* Bad string */ return 0; @@ -557,12 +555,12 @@ static void corrupt_image(faxtester_state_t *s, uint8_t image[], int len, const t = bad_rows; while (*t) { - while (isspace(*t)) + while (isspace((int) *t)) t++; if (sscanf(t, "%d", &list[x]) < 1) break; x++; - while (isdigit(*t)) + while (isdigit((int) *t)) t++; if (*t == ',') t++; @@ -630,7 +628,7 @@ static int next_step(faxtester_state_t *s) int compression_type; int timer; int len; - t4_state_t t4_state; + t4_state_t t4_tx_state; t30_state_t *t30; if (s->cur == NULL) @@ -966,14 +964,14 @@ printf("Push '%s'\n", next_tx_file); /* A non-ECM page */ min_row_bits = (min_bits) ? atoi((const char *) min_bits) : 0; sprintf(path, "%s/%s", image_path, (const char *) value); - if (t4_tx_init(&t4_state, path, -1, -1) == NULL) + if (t4_tx_init(&t4_tx_state, path, -1, -1) == NULL) { span_log(&s->logging, SPAN_LOG_FLOW, "Failed to init T.4 send\n"); printf("Test failed\n"); exit(2); } - t4_tx_set_min_row_bits(&t4_state, min_row_bits); - t4_tx_set_header_info(&t4_state, NULL); + t4_tx_set_min_bits_per_row(&t4_tx_state, min_row_bits); + t4_tx_set_header_info(&t4_tx_state, NULL); compression_type = T4_COMPRESSION_ITU_T4_1D; if (compression) { @@ -982,20 +980,20 @@ printf("Push '%s'\n", next_tx_file); else if (strcasecmp((const char *) compression, "T.6") == 0) compression_type = T4_COMPRESSION_ITU_T6; } - t4_tx_set_tx_encoding(&t4_state, compression_type); - if (t4_tx_start_page(&t4_state)) + t4_tx_set_tx_encoding(&t4_tx_state, compression_type); + if (t4_tx_start_page(&t4_tx_state)) { span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n"); printf("Test failed\n"); exit(2); } - len = t4_tx_get_chunk(&t4_state, image, sizeof(image)); + len = t4_tx_get_chunk(&t4_tx_state, image, sizeof(image)); if (bad_rows) { span_log(&s->logging, SPAN_LOG_FLOW, "We need to corrupt the image\n"); corrupt_image(s, image, len, (const char *) bad_rows); } - t4_tx_release(&t4_state); + t4_tx_release(&t4_tx_state); span_log(&s->logging, SPAN_LOG_FLOW, "Non-ECM image is %d bytes\n", len); faxtester_set_non_ecm_image_buffer(s, image, len); } @@ -1006,14 +1004,14 @@ printf("Push '%s'\n", next_tx_file); ecm_frame_size = (frame_size) ? atoi((const char *) frame_size) : 64; i = (crc_error) ? atoi((const char *) crc_error) : -1; sprintf(path, "%s/%s", image_path, (const char *) value); - if (t4_tx_init(&t4_state, path, -1, -1) == NULL) + if (t4_tx_init(&t4_tx_state, path, -1, -1) == NULL) { span_log(&s->logging, SPAN_LOG_FLOW, "Failed to init T.4 send\n"); printf("Test failed\n"); exit(2); } - t4_tx_set_min_row_bits(&t4_state, min_row_bits); - t4_tx_set_header_info(&t4_state, NULL); + t4_tx_set_min_bits_per_row(&t4_tx_state, min_row_bits); + t4_tx_set_header_info(&t4_tx_state, NULL); compression_type = T4_COMPRESSION_ITU_T4_1D; if (compression) { @@ -1022,22 +1020,22 @@ printf("Push '%s'\n", next_tx_file); else if (strcasecmp((const char *) compression, "T.6") == 0) compression_type = T4_COMPRESSION_ITU_T6; } - t4_tx_set_tx_encoding(&t4_state, compression_type); - if (t4_tx_start_page(&t4_state)) + t4_tx_set_tx_encoding(&t4_tx_state, compression_type); + if (t4_tx_start_page(&t4_tx_state)) { span_log(&s->logging, SPAN_LOG_FLOW, "Failed to start T.4 send\n"); printf("Test failed\n"); exit(2); } /*endif*/ - len = t4_tx_get_chunk(&t4_state, image, sizeof(image)); + len = t4_tx_get_chunk(&t4_tx_state, image, sizeof(image)); if (bad_rows) { span_log(&s->logging, SPAN_LOG_FLOW, "We need to corrupt the image\n"); corrupt_image(s, image, len, (const char *) bad_rows); } /*endif*/ - t4_tx_release(&t4_state); + t4_tx_release(&t4_tx_state); span_log(&s->logging, SPAN_LOG_FLOW, "ECM image is %d bytes\n", len); faxtester_set_ecm_image_buffer(s, image, len, ecm_block, ecm_frame_size, i); } @@ -1287,20 +1285,40 @@ static int get_test_set(faxtester_state_t *s, const char *test_file, const char int main(int argc, char *argv[]) { + const char *xml_file_name; const char *test_name; + int opt; - //string_test(); +#if 0 + string_test(); +#endif + xml_file_name = "../spandsp/tsb85.xml"; test_name = "MRGN01"; - if (argc > 1) - test_name = argv[1]; + while ((opt = getopt(argc, argv, "x:")) != -1) + { + switch (opt) + { + case 'x': + xml_file_name = optarg; + break; + default: + //usage(); + exit(2); + break; + } + } + argc -= optind; + argv += optind; + if (argc > 0) + test_name = argv[0]; strcpy(image_path, "."); faxtester_init(&state, TRUE); memset(&expected_rx_info, 0, sizeof(expected_rx_info)); span_log_set_level(&state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW); span_log_set_tag(&state.logging, "B"); - get_test_set(&state, "../spandsp/tsb85.xml", test_name); + get_test_set(&state, xml_file_name, test_name); printf("Done\n"); return 0; } diff --git a/libs/spandsp/tests/tsb85_tests.sh b/libs/spandsp/tests/tsb85_tests.sh index 31cf6aedae..adb0e53a84 100755 --- a/libs/spandsp/tests/tsb85_tests.sh +++ b/libs/spandsp/tests/tsb85_tests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # spandsp fax tests # @@ -14,9 +14,6 @@ # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: tsb85_tests.sh,v 1.8 2009/05/24 07:18:36 steveu Exp $ -# run_tsb85_test() { diff --git a/libs/spandsp/tests/udptl.c b/libs/spandsp/tests/udptl.c new file mode 100644 index 0000000000..553eba20e7 --- /dev/null +++ b/libs/spandsp/tests/udptl.c @@ -0,0 +1,592 @@ +//#define UDPTL_DEBUG +/* + * SpanDSP - a series of DSP components for telephony + * + * udptl.c + * + * Written by Steve Underwood + * + * Copyright (C) 2009 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. + */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include "udptl.h" + +#define FALSE 0 +#define TRUE (!FALSE) + +static int decode_length(const uint8_t *buf, int limit, int *len, int *pvalue) +{ + if (*len >= limit) + return -1; + if ((buf[*len] & 0x80) == 0) + { + *pvalue = buf[(*len)++]; + return 0; + } + if ((buf[*len] & 0x40) == 0) + { + if (*len >= limit - 1) + return -1; + *pvalue = (buf[(*len)++] & 0x3F) << 8; + *pvalue |= buf[(*len)++]; + return 0; + } + *pvalue = (buf[(*len)++] & 0x3F) << 14; + /* Indicate we have a fragment */ + return 1; +} +/*- End of function --------------------------------------------------------*/ + +static int decode_open_type(const uint8_t *buf, int limit, int *len, const uint8_t ** p_object, int *p_num_octets) +{ + int octet_cnt; + int octet_idx; + int stat; + int i; + const uint8_t **pbuf; + + for (octet_idx = 0, *p_num_octets = 0;; octet_idx += octet_cnt) + { + if ((stat = decode_length(buf, limit, len, &octet_cnt)) < 0) + return -1; + if (octet_cnt > 0) + { + *p_num_octets += octet_cnt; + + pbuf = &p_object[octet_idx]; + i = 0; + /* Make sure the buffer contains at least the number of bits requested */ + if ((*len + octet_cnt) > limit) + return -1; + + *pbuf = &buf[*len]; + *len += octet_cnt; + } + if (stat == 0) + break; + } + return 0; +} +/*- End of function --------------------------------------------------------*/ + +static int encode_length(uint8_t *buf, int *len, int value) +{ + int multiplier; + + if (value < 0x80) + { + /* 1 octet */ + buf[(*len)++] = value; + return value; + } + if (value < 0x4000) + { + /* 2 octets */ + /* Set the first bit of the first octet */ + buf[(*len)++] = ((0x8000 | value) >> 8) & 0xFF; + buf[(*len)++] = value & 0xFF; + return value; + } + /* Fragmentation */ + multiplier = (value < 0x10000) ? (value >> 14) : 4; + /* Set the first 2 bits of the octet */ + buf[(*len)++] = 0xC0 | multiplier; + return multiplier << 14; +} +/*- End of function --------------------------------------------------------*/ + +static int encode_open_type(uint8_t *buf, int *len, const uint8_t *data, int num_octets) +{ + int enclen; + int octet_idx; + uint8_t zero_byte; + + /* If open type is of zero length, add a single zero byte (10.1) */ + if (num_octets == 0) + { + zero_byte = 0; + data = &zero_byte; + num_octets = 1; + } + /* Encode the open type */ + for (octet_idx = 0;; num_octets -= enclen, octet_idx += enclen) + { + if ((enclen = encode_length(buf, len, num_octets)) < 0) + return -1; + if (enclen > 0) + { + memcpy(&buf[*len], &data[octet_idx], enclen); + *len += enclen; + } + if (enclen >= num_octets) + break; + } + + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len) +{ + int stat; + int stat2; + int i; + int j; + int k; + int l; + int m; + int x; + int limit; + int which; + int ptr; + int count; + int total_count; + int seq_no; + const uint8_t *msg; + const uint8_t *data; + int msg_len; + int repaired[16]; + const uint8_t *bufs[16]; + int lengths[16]; + int span; + int entries; + + ptr = 0; + /* Decode seq_number */ + if (ptr + 2 > len) + return -1; + seq_no = (buf[0] << 8) | buf[1]; + ptr += 2; + /* Break out the primary packet */ + if ((stat = decode_open_type(buf, len, &ptr, &msg, &msg_len)) != 0) + return -1; + /* Decode error_recovery */ + if (ptr + 1 > len) + return -1; + /* Our buffers cannot tolerate overlength packets */ + if (msg_len > LOCAL_FAX_MAX_DATAGRAM) + return -1; + /* Update any missed slots in the buffer */ + for (i = s->rx_seq_no; seq_no > i; i++) + { + x = i & UDPTL_BUF_MASK; + s->rx[x].buf_len = -1; + s->rx[x].fec_len[0] = 0; + s->rx[x].fec_span = 0; + s->rx[x].fec_entries = 0; + } + /* Save the new packet. Pure redundancy mode won't use this, but some systems will switch + into FEC mode after sending some redundant packets. */ + x = seq_no & UDPTL_BUF_MASK; + memcpy(s->rx[x].buf, msg, msg_len); + s->rx[x].buf_len = msg_len; + s->rx[x].fec_len[0] = 0; + s->rx[x].fec_span = 0; + s->rx[x].fec_entries = 0; + if ((buf[ptr++] & 0x80) == 0) + { + /* Secondary packet mode for error recovery */ + /* We might have the packet we want, but we need to check through + the redundant stuff, and verify the integrity of the UDPTL. + This greatly reduces our chances of accepting garbage. */ + total_count = 0; + do + { + if ((stat2 = decode_length(buf, len, &ptr, &count)) < 0) + return -1; + for (i = 0; i < count; i++) + { + if ((stat = decode_open_type(buf, len, &ptr, &bufs[total_count + i], &lengths[total_count + i])) != 0) + return -1; + } + total_count += count; + } + while (stat2 > 0); + /* We should now be exactly at the end of the packet. If not, this is a fault. */ + if (ptr != len) + return -1; + if (seq_no > s->rx_seq_no) + { + /* We received a later packet than we expected, so we need to check if we can fill in the gap from the + secondary packets. */ + /* Step through in reverse order, so we go oldest to newest */ + for (i = total_count; i > 0; i--) + { + if (seq_no - i >= s->rx_seq_no) + { + /* This one wasn't seen before */ + /* Decode the secondary packet */ +#if defined(UDPTL_DEBUG) + fprintf(stderr, "Secondary %d, len %d\n", seq_no - i, lengths[i - 1]); +#endif + /* Save the new packet. Redundancy mode won't use this, but some systems will switch into + FEC mode after sending some redundant packets, and this may then be important. */ + x = (seq_no - i) & UDPTL_BUF_MASK; + memcpy(s->rx[x].buf, bufs[i - 1], lengths[i - 1]); + s->rx[x].buf_len = lengths[i - 1]; + s->rx[x].fec_len[0] = 0; + s->rx[x].fec_span = 0; + s->rx[x].fec_entries = 0; + if (s->rx_packet_handler(s->user_data, bufs[i - 1], lengths[i - 1], seq_no - i) < 0) + fprintf(stderr, "Bad IFP\n"); + } + } + } + } + else + { + /* FEC mode for error recovery */ + + /* Decode the FEC packets */ + /* The span is defined as an unconstrained integer, but will never be more + than a small value. */ + if (ptr + 2 > len) + return -1; + if (buf[ptr++] != 1) + return -1; + span = buf[ptr++]; + + x = seq_no & UDPTL_BUF_MASK; + + s->rx[x].fec_span = span; + + memset(repaired, 0, sizeof(repaired)); + repaired[x] = TRUE; + + /* The number of entries is defined as a length, but will only ever be a small + value. Treat it as such. */ + if (ptr + 1 > len) + return -1; + entries = buf[ptr++]; + s->rx[x].fec_entries = entries; + + /* Decode the elements */ + for (i = 0; i < entries; i++) + { + if ((stat = decode_open_type(buf, len, &ptr, &data, &s->rx[x].fec_len[i])) != 0) + return -1; + if (s->rx[x].fec_len[i] > LOCAL_FAX_MAX_DATAGRAM) + return -1; + + /* Save the new FEC data */ + memcpy(s->rx[x].fec[i], data, s->rx[x].fec_len[i]); +#if 0 + fprintf(stderr, "FEC: "); + for (j = 0; j < s->rx[x].fec_len[i]; j++) + fprintf(stderr, "%02X ", data[j]); + fprintf(stderr, "\n"); +#endif + } + /* We should now be exactly at the end of the packet. If not, this is a fault. */ + if (ptr != len) + return -1; + /* See if we can reconstruct anything which is missing */ + /* TODO: this does not comprehensively hunt back and repair everything that is possible */ + for (l = x; l != ((x - (16 - span * entries)) & UDPTL_BUF_MASK); l = (l - 1) & UDPTL_BUF_MASK) + { + if (s->rx[l].fec_len[0] <= 0) + continue; + for (m = 0; m < s->rx[l].fec_entries; m++) + { + limit = (l + m) & UDPTL_BUF_MASK; + for (which = -1, k = (limit - s->rx[l].fec_span * s->rx[l].fec_entries) & UDPTL_BUF_MASK; k != limit; + k = (k + s->rx[l].fec_entries) & UDPTL_BUF_MASK) + { + if (s->rx[k].buf_len <= 0) + which = (which == -1) ? k : -2; + } + if (which >= 0) + { + /* Repairable */ + for (j = 0; j < s->rx[l].fec_len[m]; j++) + { + s->rx[which].buf[j] = s->rx[l].fec[m][j]; + for (k = (limit - s->rx[l].fec_span * s->rx[l].fec_entries) & UDPTL_BUF_MASK; k != limit; + k = (k + s->rx[l].fec_entries) & UDPTL_BUF_MASK) + s->rx[which].buf[j] ^= (s->rx[k].buf_len > j) ? s->rx[k].buf[j] : 0; + } + s->rx[which].buf_len = s->rx[l].fec_len[m]; + repaired[which] = TRUE; + } + } + } + /* Now play any new packets forwards in time */ + for (l = (x + 1) & UDPTL_BUF_MASK, j = seq_no - UDPTL_BUF_MASK; l != x; l = (l + 1) & UDPTL_BUF_MASK, j++) + { + if (repaired[l]) + { +#if defined(UDPTL_DEBUG) + fprintf(stderr, "Fixed packet %d, len %d\n", j, l); +#endif + if (s->rx_packet_handler(s->user_data, s->rx[l].buf, s->rx[l].buf_len, j) < 0) + fprintf(stderr, "Bad IFP\n"); + } + } + } + /* If packets are received out of sequence, we may have already processed this packet from the error + recovery information in a packet already received. */ + if (seq_no >= s->rx_seq_no) + { + /* Decode the primary packet */ +#if defined(UDPTL_DEBUG) + fprintf(stderr, "Primary packet %d, len %d\n", seq_no, msg_len); +#endif + if (s->rx_packet_handler(s->user_data, msg, msg_len, seq_no) < 0) + fprintf(stderr, "Bad IFP\n"); + } + + s->rx_seq_no = (seq_no + 1) & 0xFFFF; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int msg_len) +{ + uint8_t fec[LOCAL_FAX_MAX_DATAGRAM]; + int i; + int j; + int seq; + int entry; + int entries; + int span; + int m; + int len; + int limit; + int high_tide; + + /* UDPTL cannot cope with zero length messages, and our buffering for redundancy limits their + maximum length. */ + if (msg_len < 1 || msg_len > LOCAL_FAX_MAX_DATAGRAM) + return -1; + seq = s->tx_seq_no & 0xFFFF; + + /* Map the sequence number to an entry in the circular buffer */ + entry = seq & UDPTL_BUF_MASK; + + /* We save the message in a circular buffer, for generating FEC or + redundancy sets later on. */ + s->tx[entry].buf_len = msg_len; + memcpy(s->tx[entry].buf, msg, msg_len); + + /* Build the UDPTL packet */ + + len = 0; + /* Encode the sequence number */ + buf[len++] = (seq >> 8) & 0xFF; + buf[len++] = seq & 0xFF; + + /* Encode the primary packet */ + if (encode_open_type(buf, &len, msg, msg_len) < 0) + return -1; + + /* Encode the appropriate type of error recovery information */ + switch (s->error_correction_scheme) + { + case UDPTL_ERROR_CORRECTION_NONE: + /* Encode the error recovery type */ + buf[len++] = 0x00; + /* The number of entries will always be zero, so it is pointless allowing + for the fragmented case here. */ + if (encode_length(buf, &len, 0) < 0) + return -1; + break; + case UDPTL_ERROR_CORRECTION_REDUNDANCY: + /* Encode the error recovery type */ + buf[len++] = 0x00; + if (s->tx_seq_no > s->error_correction_entries) + entries = s->error_correction_entries; + else + entries = s->tx_seq_no; + /* The number of entries will always be small, so it is pointless allowing + for the fragmented case here. */ + if (encode_length(buf, &len, entries) < 0) + return -1; + /* Encode the elements */ + for (i = 0; i < entries; i++) + { + j = (entry - i - 1) & UDPTL_BUF_MASK; + if (encode_open_type(buf, &len, s->tx[j].buf, s->tx[j].buf_len) < 0) + return -1; + } + break; + case UDPTL_ERROR_CORRECTION_FEC: + span = s->error_correction_span; + entries = s->error_correction_entries; + if (seq < s->error_correction_span * s->error_correction_entries) + { + /* In the initial stages, wind up the FEC smoothly */ + entries = seq / s->error_correction_span; + if (seq < s->error_correction_span) + span = 0; + } + /* Encode the error recovery type */ + buf[len++] = 0x80; + /* Span is defined as an inconstrained integer, which it dumb. It will only + ever be a small value. Treat it as such. */ + buf[len++] = 1; + buf[len++] = span; + /* The number of entries is defined as a length, but will only ever be a small + value. Treat it as such. */ + buf[len++] = entries; + for (m = 0; m < entries; m++) + { + /* Make an XOR'ed entry the maximum length */ + limit = (entry + m) & UDPTL_BUF_MASK; + high_tide = 0; + for (i = (limit - span * entries) & UDPTL_BUF_MASK; i != limit; i = (i + entries) & UDPTL_BUF_MASK) + { + if (high_tide < s->tx[i].buf_len) + { + for (j = 0; j < high_tide; j++) + fec[j] ^= s->tx[i].buf[j]; + for (; j < s->tx[i].buf_len; j++) + fec[j] = s->tx[i].buf[j]; + high_tide = s->tx[i].buf_len; + } + else + { + for (j = 0; j < s->tx[i].buf_len; j++) + fec[j] ^= s->tx[i].buf[j]; + } + } + if (encode_open_type(buf, &len, fec, high_tide) < 0) + return -1; + } + break; + } + + if (s->verbose) + fprintf(stderr, "\n"); + s->tx_seq_no++; + return len; +} +/*- End of function --------------------------------------------------------*/ + +int udptl_set_error_correction(udptl_state_t *s, int ec_scheme, int span, int entries) +{ + switch (ec_scheme) + { + case UDPTL_ERROR_CORRECTION_FEC: + case UDPTL_ERROR_CORRECTION_REDUNDANCY: + case UDPTL_ERROR_CORRECTION_NONE: + s->error_correction_scheme = ec_scheme; + break; + case -1: + /* Just don't change the scheme */ + break; + default: + return -1; + } + if (span >= 0) + s->error_correction_span = span; + if (entries >= 0) + s->error_correction_entries = entries; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int udptl_get_error_correction(udptl_state_t *s, int *ec_scheme, int *span, int *entries) +{ + if (ec_scheme) + *ec_scheme = s->error_correction_scheme; + if (span) + *span = s->error_correction_span; + if (entries) + *entries = s->error_correction_entries; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int udptl_set_local_max_datagram(udptl_state_t *s, int max_datagram) +{ + s->local_max_datagram_size = max_datagram; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int udptl_get_local_max_datagram(udptl_state_t *s) +{ + return s->local_max_datagram_size; +} +/*- End of function --------------------------------------------------------*/ + +int udptl_set_far_max_datagram(udptl_state_t *s, int max_datagram) +{ + s->far_max_datagram_size = max_datagram; + return 0; +} +/*- End of function --------------------------------------------------------*/ + +int udptl_get_far_max_datagram(udptl_state_t *s) +{ + return s->far_max_datagram_size; +} +/*- End of function --------------------------------------------------------*/ + +udptl_state_t *udptl_init(udptl_state_t *s, int ec_scheme, int span, int entries, udptl_rx_packet_handler_t rx_packet_handler, void *user_data) +{ + int i; + + if (rx_packet_handler == NULL) + return NULL; + + if (s == NULL) + { + if ((s = (udptl_state_t *) malloc(sizeof(*s))) == NULL) + return NULL; + } + memset(s, 0, sizeof(*s)); + + s->error_correction_scheme = ec_scheme; + s->error_correction_span = span; + s->error_correction_entries = entries; + + s->far_max_datagram_size = LOCAL_FAX_MAX_DATAGRAM; + s->local_max_datagram_size = LOCAL_FAX_MAX_DATAGRAM; + + memset(&s->rx, 0, sizeof(s->rx)); + memset(&s->tx, 0, sizeof(s->tx)); + for (i = 0; i <= UDPTL_BUF_MASK; i++) + { + s->rx[i].buf_len = -1; + s->tx[i].buf_len = -1; + } + + s->rx_packet_handler = rx_packet_handler; + s->user_data = user_data; + + return s; +} +/*- End of function --------------------------------------------------------*/ + +int udptl_release(udptl_state_t *s) +{ + return 0; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/tests/udptl.h b/libs/spandsp/tests/udptl.h new file mode 100644 index 0000000000..23563ad484 --- /dev/null +++ b/libs/spandsp/tests/udptl.h @@ -0,0 +1,158 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * udptl.c + * + * Written by Steve Underwood + * + * Copyright (C) 2009 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. + */ + +#if !defined(_SPANDSP_UDPTL_H_) +#define _SPANDSP_UDPTL_H_ + +#define LOCAL_FAX_MAX_DATAGRAM 400 +#define LOCAL_FAX_MAX_FEC_PACKETS 5 + +#define UDPTL_BUF_MASK 15 + +typedef int (udptl_rx_packet_handler_t) (void *user_data, const uint8_t msg[], int len, int seq_no); + +typedef struct +{ + int buf_len; + uint8_t buf[LOCAL_FAX_MAX_DATAGRAM]; +} udptl_fec_tx_buffer_t; + +typedef struct +{ + int buf_len; + uint8_t buf[LOCAL_FAX_MAX_DATAGRAM]; + int fec_len[LOCAL_FAX_MAX_FEC_PACKETS]; + uint8_t fec[LOCAL_FAX_MAX_FEC_PACKETS][LOCAL_FAX_MAX_DATAGRAM]; + int fec_span; + int fec_entries; +} udptl_fec_rx_buffer_t; + +struct udptl_state_s +{ + udptl_rx_packet_handler_t *rx_packet_handler; + void *user_data; + + /*! This option indicates the error correction scheme used in transmitted UDPTL + packets. */ + int error_correction_scheme; + + /*! This option indicates the number of error correction entries transmitted in + UDPTL packets. */ + int error_correction_entries; + + /*! This option indicates the span of the error correction entries in transmitted + UDPTL packets (FEC only). */ + int error_correction_span; + + /*! This option indicates the maximum size of a datagram that can be accepted by + the remote device. */ + int far_max_datagram_size; + + /*! This option indicates the maximum size of a datagram that we are prepared to + accept. */ + int local_max_datagram_size; + + int verbose; + + int tx_seq_no; + int rx_seq_no; + int rx_expected_seq_no; + + udptl_fec_tx_buffer_t tx[UDPTL_BUF_MASK + 1]; + udptl_fec_rx_buffer_t rx[UDPTL_BUF_MASK + 1]; +}; + +enum +{ + UDPTL_ERROR_CORRECTION_NONE, + UDPTL_ERROR_CORRECTION_FEC, + UDPTL_ERROR_CORRECTION_REDUNDANCY +}; + +typedef struct udptl_state_s udptl_state_t; + +#if defined(__cplusplus) +extern "C" { +#endif + +/*! \brief Process an arriving UDPTL packet. + \param s The UDPTL context. + \param buf The UDPTL packet buffer. + \param len The length of the packet. + \return 0 for OK. */ +int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len); + +/*! \brief Construct a UDPTL packet, ready for transmission. + \param s The UDPTL context. + \param buf The UDPTL packet buffer. + \param msg The primary packet. + \param len The length of the primary packet. + \return The length of the constructed UDPTL packet. */ +int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int msg_len); + +/*! \brief Change the error correction settings of a UDPTL context. + \param s The UDPTL context. + \param ec_scheme One of the optional error correction schemes. + \param span The packet span over which error correction should be applied. + \param entries The number of error correction entries to include in packets. + \return 0 for OK. */ +int udptl_set_error_correction(udptl_state_t *s, int ec_scheme, int span, int entries); + +/*! \brief Check the error correction settings of a UDPTL context. + \param s The UDPTL context. + \param ec_scheme One of the optional error correction schemes. + \param span The packet span over which error correction is being applied. + \param entries The number of error correction being included in packets. + \return 0 for OK. */ +int udptl_get_error_correction(udptl_state_t *s, int *ec_scheme, int *span, int *entries); + +int udptl_set_local_max_datagram(udptl_state_t *s, int max_datagram); + +int udptl_get_local_max_datagram(udptl_state_t *s); + +int udptl_set_far_max_datagram(udptl_state_t *s, int max_datagram); + +int udptl_get_far_max_datagram(udptl_state_t *s); + +/*! \brief Initialise a UDPTL context. + \param s The UDPTL context. + \param ec_scheme One of the optional error correction schemes. + \param span The packet span over which error correction should be applied. + \param entries The number of error correction entries to include in packets. + \param rx_packet_handler The callback function, used to report arriving IFP packets. + \param user_data An opaque pointer supplied to rx_packet_handler. + \return A pointer to the UDPTL context, or NULL if there was a problem. */ +udptl_state_t *udptl_init(udptl_state_t *s, int ec_scheme, int span, int entries, udptl_rx_packet_handler_t rx_packet_handler, void *user_data); + +/*! \brief Release a UDPTL context. + \param s The UDPTL context. + \return 0 for OK. */ +int udptl_release(udptl_state_t *s); + +#if defined(__cplusplus) +} +#endif +#endif +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/tests/v17_tests.c b/libs/spandsp/tests/v17_tests.c index ec9b901866..22d793c2df 100644 --- a/libs/spandsp/tests/v17_tests.c +++ b/libs/spandsp/tests/v17_tests.c @@ -22,8 +22,6 @@ * 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. - * - * $Id: v17_tests.c,v 1.104 2009/07/09 13:52:09 steveu Exp $ */ /*! \page v17_tests_page V.17 modem tests @@ -63,6 +61,10 @@ display of modem status is maintained. #include #include #include +#include +#if defined(HAVE_FENV_H) +#include +#endif //#if defined(WITH_SPANDSP_INTERNALS) #define SPANDSP_EXPOSE_INTERNAL_STRUCTURES @@ -219,6 +221,64 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex } /*- End of function --------------------------------------------------------*/ +#if defined(HAVE_FENV_H) +static void sigfpe_handler(int sig_num, siginfo_t *info, void *data) +{ + switch (sig_num) + { + case SIGFPE: + switch (info->si_code) + { + case FPE_INTDIV: + fprintf(stderr, "integer divide by zero at %p\n", info->si_addr); + break; + case FPE_INTOVF: + fprintf(stderr, "integer overflow at %p\n", info->si_addr); + break; + case FPE_FLTDIV: + fprintf(stderr, "FP divide by zero at %p\n", info->si_addr); + break; + case FPE_FLTOVF: + fprintf(stderr, "FP overflow at %p\n", info->si_addr); + break; + case FPE_FLTUND: + fprintf(stderr, "FP underflow at %p\n", info->si_addr); + break; + case FPE_FLTRES: + fprintf(stderr, "FP inexact result at %p\n", info->si_addr); + break; + case FPE_FLTINV: + fprintf(stderr, "FP invalid operation at %p\n", info->si_addr); + break; + case FPE_FLTSUB: + fprintf(stderr, "subscript out of range at %p\n", info->si_addr); + break; + } + break; + default: + fprintf(stderr, "Unexpected signal %d\n", sig_num); + break; + } + exit(2); +} +/*- End of function --------------------------------------------------------*/ + +static void fpe_trap_setup(void) +{ + struct sigaction trap; + + sigemptyset(&trap.sa_mask); + trap.sa_flags = SA_SIGINFO; + trap.sa_sigaction = sigfpe_handler; + + sigaction(SIGFPE, &trap, NULL); + //feenableexcept(FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW); + //feenableexcept(FE_ALL_EXCEPT); + feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); +} +/*- End of function --------------------------------------------------------*/ +#endif + int main(int argc, char *argv[]) { v17_rx_state_t *rx; @@ -259,8 +319,17 @@ int main(int argc, char *argv[]) { case 'b': test_bps = atoi(optarg); - if (test_bps != 14400 && test_bps != 12000 && test_bps != 9600 && test_bps != 7200) + if (test_bps != 14400 + && + test_bps != 12000 + && + test_bps != 9600 + && + test_bps != 7200 + && + test_bps != 4800) { + /* 4800 is an extension of V.17, to provide full coverage of the V.32bis modes */ fprintf(stderr, "Invalid bit rate specified\n"); exit(2); } @@ -309,6 +378,10 @@ int main(int argc, char *argv[]) inhandle = NULL; outhandle = NULL; +#if defined(HAVE_FENV_H) + fpe_trap_setup(); +#endif + if (log_audio) { if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) @@ -401,7 +474,7 @@ int main(int argc, char *argv[]) printf("Restarting on zero output\n"); /* Push a little silence through, to ensure all the data bits get out of the buffers */ - memset(amp, 0, BLOCK_LEN*sizeof(int16_t)); + vec_zeroi16(amp, BLOCK_LEN); v17_rx(rx, amp, BLOCK_LEN); /* Note that we might get a few bad bits as the carrier shuts down. */ diff --git a/libs/spandsp/tests/v18_tests.c b/libs/spandsp/tests/v18_tests.c index 7cd498ac20..f1dcff1d83 100644 --- a/libs/spandsp/tests/v18_tests.c +++ b/libs/spandsp/tests/v18_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: v18_tests.c,v 1.8 2009/05/30 15:23:14 steveu Exp $ */ /*! \page v18_tests_page V.18 tests diff --git a/libs/spandsp/tests/v22bis_tests.c b/libs/spandsp/tests/v22bis_tests.c index 74c4347dbe..603f35df30 100644 --- a/libs/spandsp/tests/v22bis_tests.c +++ b/libs/spandsp/tests/v22bis_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: v22bis_tests.c,v 1.63 2009/07/09 13:52:09 steveu Exp $ */ /*! \page v22bis_tests_page V.22bis modem tests @@ -127,7 +125,7 @@ static void v22bis_putbit(void *user_data, int bit) switch (bit) { case SIG_STATUS_TRAINING_SUCCEEDED: - bit_rate = v22bis_current_bit_rate(s->v22bis); + bit_rate = v22bis_get_current_bit_rate(s->v22bis); printf("Negotiated bit rate: %d\n", bit_rate); len = v22bis_rx_equalizer_state(s->v22bis, &coeffs); printf("Equalizer:\n"); @@ -225,9 +223,11 @@ int main(int argc, char *argv[]) int signal_level; int log_audio; int channel_codec; + int rbs_pattern; int opt; channel_codec = MUNGE_CODEC_NONE; + rbs_pattern = 0; test_bps = 2400; line_model_no = 0; decode_test_file = NULL; @@ -235,7 +235,7 @@ int main(int argc, char *argv[]) signal_level = -13; bits_per_test = 50000; log_audio = FALSE; - while ((opt = getopt(argc, argv, "b:B:c:d:glm:n:s:")) != -1) + while ((opt = getopt(argc, argv, "b:B:c:d:glm:n:r:s:")) != -1) { switch (opt) { @@ -273,6 +273,9 @@ int main(int argc, char *argv[]) case 'n': noise_level = atoi(optarg); break; + case 'r': + rbs_pattern = atoi(optarg); + break; case 's': signal_level = atoi(optarg); break; @@ -328,7 +331,16 @@ int main(int argc, char *argv[]) endpoint[1].qam_monitor = qam_monitor_init(6.0f, "Answering modem"); } #endif - if ((model = both_ways_line_model_init(line_model_no, (float) noise_level, line_model_no, (float) noise_level, channel_codec, 0)) == NULL) + if ((model = both_ways_line_model_init(line_model_no, + (float) noise_level, + -15.0f, + -15.0f, + line_model_no, + (float) noise_level, + -15.0f, + -15.0f, + channel_codec, + rbs_pattern)) == NULL) { fprintf(stderr, " Failed to create line model\n"); exit(2); diff --git a/libs/spandsp/tests/v27ter_tests.c b/libs/spandsp/tests/v27ter_tests.c index 6fa3e4b307..dc2053c692 100644 --- a/libs/spandsp/tests/v27ter_tests.c +++ b/libs/spandsp/tests/v27ter_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: v27ter_tests.c,v 1.106 2009/07/09 13:52:09 steveu Exp $ */ /*! \page v27ter_tests_page V.27ter modem tests @@ -62,6 +60,10 @@ display of modem status is maintained. #include #include #include +#include +#if defined(HAVE_FENV_H) +#include +#endif //#if defined(WITH_SPANDSP_INTERNALS) #define SPANDSP_EXPOSE_INTERNAL_STRUCTURES @@ -218,6 +220,64 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex } /*- End of function --------------------------------------------------------*/ +#if defined(HAVE_FENV_H) +static void sigfpe_handler(int sig_num, siginfo_t *info, void *data) +{ + switch (sig_num) + { + case SIGFPE: + switch (info->si_code) + { + case FPE_INTDIV: + fprintf(stderr, "integer divide by zero at %p\n", info->si_addr); + break; + case FPE_INTOVF: + fprintf(stderr, "integer overflow at %p\n", info->si_addr); + break; + case FPE_FLTDIV: + fprintf(stderr, "FP divide by zero at %p\n", info->si_addr); + break; + case FPE_FLTOVF: + fprintf(stderr, "FP overflow at %p\n", info->si_addr); + break; + case FPE_FLTUND: + fprintf(stderr, "FP underflow at %p\n", info->si_addr); + break; + case FPE_FLTRES: + fprintf(stderr, "FP inexact result at %p\n", info->si_addr); + break; + case FPE_FLTINV: + fprintf(stderr, "FP invalid operation at %p\n", info->si_addr); + break; + case FPE_FLTSUB: + fprintf(stderr, "subscript out of range at %p\n", info->si_addr); + break; + } + break; + default: + fprintf(stderr, "Unexpected signal %d\n", sig_num); + break; + } + exit(2); +} +/*- End of function --------------------------------------------------------*/ + +static void fpe_trap_setup(void) +{ + struct sigaction trap; + + sigemptyset(&trap.sa_mask); + trap.sa_flags = SA_SIGINFO; + trap.sa_sigaction = sigfpe_handler; + + sigaction(SIGFPE, &trap, NULL); + //feenableexcept(FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW); + //feenableexcept(FE_ALL_EXCEPT); + feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); +} +/*- End of function --------------------------------------------------------*/ +#endif + int main(int argc, char *argv[]) { v27ter_rx_state_t *rx; @@ -309,6 +369,10 @@ int main(int argc, char *argv[]) inhandle = NULL; outhandle = NULL; +#if defined(HAVE_FENV_H) + fpe_trap_setup(); +#endif + if (log_audio) { if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) @@ -392,7 +456,7 @@ int main(int argc, char *argv[]) printf("Restarting on zero output\n"); /* Push a little silence through, to ensure all the data bits get out of the buffers */ - memset(amp, 0, BLOCK_LEN*sizeof(int16_t)); + vec_zeroi16(amp, BLOCK_LEN); v27ter_rx(rx, amp, BLOCK_LEN); v27ter_rx(rx, amp, BLOCK_LEN); v27ter_rx(rx, amp, BLOCK_LEN); diff --git a/libs/spandsp/tests/v29_tests.c b/libs/spandsp/tests/v29_tests.c index fc9ee96711..8644ac286d 100644 --- a/libs/spandsp/tests/v29_tests.c +++ b/libs/spandsp/tests/v29_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: v29_tests.c,v 1.120 2009/07/09 13:52:09 steveu Exp $ */ /*! \page v29_tests_page V.29 modem tests @@ -62,6 +60,10 @@ display of modem status is maintained. #include #include #include +#include +#if defined(HAVE_FENV_H) +#include +#endif //#if defined(WITH_SPANDSP_INTERNALS) #define SPANDSP_EXPOSE_INTERNAL_STRUCTURES @@ -241,6 +243,64 @@ static void qam_report(void *user_data, const complexf_t *constel, const complex } /*- End of function --------------------------------------------------------*/ +#if defined(HAVE_FENV_H) +static void sigfpe_handler(int sig_num, siginfo_t *info, void *data) +{ + switch (sig_num) + { + case SIGFPE: + switch (info->si_code) + { + case FPE_INTDIV: + fprintf(stderr, "integer divide by zero at %p\n", info->si_addr); + break; + case FPE_INTOVF: + fprintf(stderr, "integer overflow at %p\n", info->si_addr); + break; + case FPE_FLTDIV: + fprintf(stderr, "FP divide by zero at %p\n", info->si_addr); + break; + case FPE_FLTOVF: + fprintf(stderr, "FP overflow at %p\n", info->si_addr); + break; + case FPE_FLTUND: + fprintf(stderr, "FP underflow at %p\n", info->si_addr); + break; + case FPE_FLTRES: + fprintf(stderr, "FP inexact result at %p\n", info->si_addr); + break; + case FPE_FLTINV: + fprintf(stderr, "FP invalid operation at %p\n", info->si_addr); + break; + case FPE_FLTSUB: + fprintf(stderr, "subscript out of range at %p\n", info->si_addr); + break; + } + break; + default: + fprintf(stderr, "Unexpected signal %d\n", sig_num); + break; + } + exit(2); +} +/*- End of function --------------------------------------------------------*/ + +static void fpe_trap_setup(void) +{ + struct sigaction trap; + + sigemptyset(&trap.sa_mask); + trap.sa_flags = SA_SIGINFO; + trap.sa_sigaction = sigfpe_handler; + + sigaction(SIGFPE, &trap, NULL); + //feenableexcept(FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW); + //feenableexcept(FE_ALL_EXCEPT); + feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); +} +/*- End of function --------------------------------------------------------*/ +#endif + int main(int argc, char *argv[]) { v29_rx_state_t *rx; @@ -332,6 +392,10 @@ int main(int argc, char *argv[]) inhandle = NULL; outhandle = NULL; +#if defined(HAVE_FENV_H) + fpe_trap_setup(); +#endif + if (log_audio) { if ((outhandle = sf_open_telephony_write(OUT_FILE_NAME, 1)) == NULL) @@ -420,7 +484,7 @@ int main(int argc, char *argv[]) if (samples == 0) { /* Push a little silence through, to ensure all the data bits get out of the buffers */ - memset(amp, 0, BLOCK_LEN*sizeof(int16_t)); + vec_zeroi16(amp, BLOCK_LEN); v29_rx(rx, amp, BLOCK_LEN); /* Note that we might get a few bad bits as the carrier shuts down. */ diff --git a/libs/spandsp/tests/v42_tests.c b/libs/spandsp/tests/v42_tests.c index 468d27ad95..7968ff6199 100644 --- a/libs/spandsp/tests/v42_tests.c +++ b/libs/spandsp/tests/v42_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: v42_tests.c,v 1.28 2008/11/30 10:17:31 steveu Exp $ */ /* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. */ diff --git a/libs/spandsp/tests/v42bis_tests.c b/libs/spandsp/tests/v42bis_tests.c index d77e1b475c..2218d1a94b 100644 --- a/libs/spandsp/tests/v42bis_tests.c +++ b/libs/spandsp/tests/v42bis_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: v42bis_tests.c,v 1.24 2008/11/15 14:43:08 steveu Exp $ */ /* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. */ diff --git a/libs/spandsp/tests/v42bis_tests.sh b/libs/spandsp/tests/v42bis_tests.sh index 626158a3ba..39ae75e0df 100755 --- a/libs/spandsp/tests/v42bis_tests.sh +++ b/libs/spandsp/tests/v42bis_tests.sh @@ -14,9 +14,6 @@ # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: v42bis_tests.sh,v 1.5 2008/05/03 09:34:26 steveu Exp $ -# BASE=../test-data/itu/v56ter diff --git a/libs/spandsp/tests/v8_tests.c b/libs/spandsp/tests/v8_tests.c index ca8a972cc2..f88ff212fb 100644 --- a/libs/spandsp/tests/v8_tests.c +++ b/libs/spandsp/tests/v8_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: v8_tests.c,v 1.36.4.1 2009/12/28 12:32:53 steveu Exp $ */ /*! \page v8_tests_page V.8 tests @@ -56,63 +54,108 @@ int negotiations_ok = 0; +#if 0 static int select_modulation(int mask) { /* Select the fastest data modem available */ if (mask & V8_MOD_V90) return V8_MOD_V90; + /*endif*/ if (mask & V8_MOD_V34) return V8_MOD_V34; + /*endif*/ if (mask & V8_MOD_V32) return V8_MOD_V32; + /*endif*/ if (mask & V8_MOD_V23) return V8_MOD_V23; + /*endif*/ if (mask & V8_MOD_V21) return V8_MOD_V21; - return V8_MOD_FAILED; + /*endif*/ + return -1; } /*- End of function --------------------------------------------------------*/ +#endif static void handler(void *user_data, v8_parms_t *result) { const char *s; s = (const char *) user_data; - - if (result == NULL) + + printf("%s ", s); + switch (result->status) { - printf("%s V.8 negotiation failed\n", s); + case V8_STATUS_IN_PROGRESS: + printf("V.8 negotiation in progress\n"); return; + break; + case V8_STATUS_V8_OFFERED: + printf("V.8 offered by the other party\n"); + break; + case V8_STATUS_V8_CALL: + printf("V.8 call negotiation successful\n"); + break; + case V8_STATUS_NON_V8_CALL: + printf("Non-V.8 call negotiation successful\n"); + break; + case V8_STATUS_FAILED: + printf("V.8 call negotiation failed\n"); + return; + default: + printf("Unexpected V.8 status %d\n", result->status); + break; } - if (result->modem_connect_tone == MODEM_CONNECT_TONES_ANSAM - || - result->modem_connect_tone == MODEM_CONNECT_TONES_ANSAM_PR - || - result->modem_connect_tone == MODEM_CONNECT_TONES_NONE) + /*endswitch*/ + + printf(" Modem connect tone '%s' (%d)\n", modem_connect_tone_to_str(result->modem_connect_tone), result->modem_connect_tone); + printf(" Call function '%s' (%d)\n", v8_call_function_to_str(result->call_function), result->call_function); + printf(" Far end modulations 0x%X\n", result->modulations); + printf(" Protocol '%s' (%d)\n", v8_protocol_to_str(result->protocol), result->protocol); + printf(" PSTN access '%s' (%d)\n", v8_pstn_access_to_str(result->pstn_access), result->pstn_access); + printf(" PCM modem availability '%s' (%d)\n", v8_pcm_modem_availability_to_str(result->pcm_modem_availability), result->pcm_modem_availability); + if (result->t66 >= 0) + printf(" T.66 '%s' (%d)\n", v8_t66_to_str(result->t66), result->t66); + /*endif*/ + if (result->nsf >= 0) + printf(" NSF %d\n", result->nsf); + /*endif*/ + + switch (result->status) { - printf("%s V.8 negotiation result:\n", s); - printf(" Modem connect tone '%s' (%d)\n", modem_connect_tone_to_str(result->modem_connect_tone), result->modem_connect_tone); - printf(" Call function '%s' (%d)\n", v8_call_function_to_str(result->call_function), result->call_function); - printf(" Far end modulations 0x%X\n", result->modulations); - printf(" Protocol '%s' (%d)\n", v8_protocol_to_str(result->protocol), result->protocol); - printf(" PSTN access '%s' (%d)\n", v8_pstn_access_to_str(result->pstn_access), result->pstn_access); - printf(" PCM modem availability '%s' (%d)\n", v8_pcm_modem_availability_to_str(result->pcm_modem_availability), result->pcm_modem_availability); - if (result->t66 >= 0) - printf(" T.66 '%s' (%d)\n", v8_t66_to_str(result->t66), result->t66); - if (result->nsf >= 0) - printf(" NSF %d\n", result->nsf); + case V8_STATUS_V8_OFFERED: + /* Edit the result information appropriately */ + //result->call_function = V8_CALL_T30_TX; + result->modulations &= (V8_MOD_V17 + | V8_MOD_V21 + //| V8_MOD_V22 + //| V8_MOD_V23HDX + //| V8_MOD_V23 + //| V8_MOD_V26BIS + //| V8_MOD_V26TER + | V8_MOD_V27TER + | V8_MOD_V29 + //| V8_MOD_V32 + | V8_MOD_V34HDX + //| V8_MOD_V34 + //| V8_MOD_V90 + | V8_MOD_V92); + break; + case V8_STATUS_V8_CALL: if (result->call_function == V8_CALL_V_SERIES && result->protocol == V8_PROTOCOL_LAPM_V42) { negotiations_ok++; } + /*endif*/ + break; + case V8_STATUS_NON_V8_CALL: + negotiations_ok = 42; + break; } - else - { - printf("%s V.8 negotiation result:\n", s); - printf(" Modem connect tone '%s' (%d)\n", modem_connect_tone_to_str(result->modem_connect_tone), result->modem_connect_tone); - } + /*endswitch*/ } /*- End of function --------------------------------------------------------*/ @@ -136,28 +179,28 @@ static int v8_calls_v8_tests(SNDFILE *outhandle) caller_available_modulations = V8_MOD_V17 | V8_MOD_V21 | V8_MOD_V22 - | V8_MOD_V23HALF + | V8_MOD_V23HDX | V8_MOD_V23 | V8_MOD_V26BIS | V8_MOD_V26TER | V8_MOD_V27TER | V8_MOD_V29 | V8_MOD_V32 - | V8_MOD_V34HALF + | V8_MOD_V34HDX | V8_MOD_V34 | V8_MOD_V90 | V8_MOD_V92; answerer_available_modulations = V8_MOD_V17 | V8_MOD_V21 | V8_MOD_V22 - | V8_MOD_V23HALF + | V8_MOD_V23HDX | V8_MOD_V23 | V8_MOD_V26BIS | V8_MOD_V26TER | V8_MOD_V27TER | V8_MOD_V29 | V8_MOD_V32 - | V8_MOD_V34HALF + | V8_MOD_V34HDX | V8_MOD_V34 | V8_MOD_V90 | V8_MOD_V92; @@ -200,33 +243,44 @@ static int v8_calls_v8_tests(SNDFILE *outhandle) samples = v8_tx(v8_caller, amp, SAMPLES_PER_CHUNK); if (samples < SAMPLES_PER_CHUNK) { - memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples)); + vec_zeroi16(amp + samples, SAMPLES_PER_CHUNK - samples); samples = SAMPLES_PER_CHUNK; } + /*endif*/ span_log_bump_samples(caller_logging, samples); remnant = v8_rx(v8_answerer, amp, samples); for (i = 0; i < samples; i++) out_amp[2*i] = amp[i]; - + /*endfor*/ + samples = v8_tx(v8_answerer, amp, SAMPLES_PER_CHUNK); if (samples < SAMPLES_PER_CHUNK) { - memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples)); + vec_zeroi16(amp + samples, SAMPLES_PER_CHUNK - samples); samples = SAMPLES_PER_CHUNK; } + /*endif*/ span_log_bump_samples(answerer_logging, samples); if (v8_rx(v8_caller, amp, samples) && remnant) break; + /*endif*/ for (i = 0; i < samples; i++) out_amp[2*i + 1] = amp[i]; + /*endfor*/ - outframes = sf_writef_short(outhandle, out_amp, samples); - if (outframes != samples) + if (outhandle) { - fprintf(stderr, " Error writing audio file\n"); - exit(2); + outframes = sf_writef_short(outhandle, out_amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + /*endif*/ } + /*endif*/ } + /*endfor*/ v8_free(v8_caller); v8_free(v8_answerer); @@ -235,6 +289,7 @@ static int v8_calls_v8_tests(SNDFILE *outhandle) printf("Tests failed.\n"); exit(2); } + /*endif*/ return 0; } /*- End of function --------------------------------------------------------*/ @@ -258,14 +313,14 @@ static int non_v8_calls_v8_tests(SNDFILE *outhandle) answerer_available_modulations = V8_MOD_V17 | V8_MOD_V21 | V8_MOD_V22 - | V8_MOD_V23HALF + | V8_MOD_V23HDX | V8_MOD_V23 | V8_MOD_V26BIS | V8_MOD_V26TER | V8_MOD_V27TER | V8_MOD_V29 | V8_MOD_V32 - | V8_MOD_V34HALF + | V8_MOD_V34HDX | V8_MOD_V34 | V8_MOD_V90 | V8_MOD_V92; @@ -295,21 +350,25 @@ static int non_v8_calls_v8_tests(SNDFILE *outhandle) samples = silence_gen(non_v8_caller_tx, amp, SAMPLES_PER_CHUNK); if (samples < SAMPLES_PER_CHUNK) { - memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples)); + vec_zeroi16(amp + samples, SAMPLES_PER_CHUNK - samples); samples = SAMPLES_PER_CHUNK; } + /*endif*/ remnant = v8_rx(v8_answerer, amp, samples); if (remnant) break; + /*endif*/ for (i = 0; i < samples; i++) out_amp[2*i] = amp[i]; - + /*endfor*/ + samples = v8_tx(v8_answerer, amp, SAMPLES_PER_CHUNK); if (samples < SAMPLES_PER_CHUNK) { - memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples)); + vec_zeroi16(amp + samples, SAMPLES_PER_CHUNK - samples); samples = SAMPLES_PER_CHUNK; } + /*endif*/ span_log_bump_samples(answerer_logging, samples); modem_connect_tones_rx(non_v8_caller_rx, amp, samples); if ((tone = modem_connect_tones_rx_get(non_v8_caller_rx)) != MODEM_CONNECT_TONES_NONE) @@ -317,17 +376,26 @@ static int non_v8_calls_v8_tests(SNDFILE *outhandle) printf("Detected %s (%d)\n", modem_connect_tone_to_str(tone), tone); if (tone == MODEM_CONNECT_TONES_ANSAM_PR) negotiations_ok++; + /*endif*/ } + /*endif*/ for (i = 0; i < samples; i++) out_amp[2*i + 1] = amp[i]; + /*endfor*/ - outframes = sf_writef_short(outhandle, out_amp, samples); - if (outframes != samples) + if (outhandle) { - fprintf(stderr, " Error writing audio file\n"); - exit(2); + outframes = sf_writef_short(outhandle, out_amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + /*endif*/ } + /*endif*/ } + /*endfor*/ silence_gen_free(non_v8_caller_tx); modem_connect_tones_rx_free(non_v8_caller_rx); v8_free(v8_answerer); @@ -337,6 +405,7 @@ static int non_v8_calls_v8_tests(SNDFILE *outhandle) printf("Tests failed.\n"); exit(2); } + /*endif*/ return 0; } /*- End of function --------------------------------------------------------*/ @@ -357,14 +426,14 @@ static int v8_calls_non_v8_tests(SNDFILE *outhandle) caller_available_modulations = V8_MOD_V17 | V8_MOD_V21 | V8_MOD_V22 - | V8_MOD_V23HALF + | V8_MOD_V23HDX | V8_MOD_V23 | V8_MOD_V26BIS | V8_MOD_V26TER | V8_MOD_V27TER | V8_MOD_V29 | V8_MOD_V32 - | V8_MOD_V34HALF + | V8_MOD_V34HDX | V8_MOD_V34 | V8_MOD_V90 | V8_MOD_V92; @@ -392,41 +461,51 @@ static int v8_calls_non_v8_tests(SNDFILE *outhandle) samples = v8_tx(v8_caller, amp, SAMPLES_PER_CHUNK); if (samples < SAMPLES_PER_CHUNK) { - memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples)); + vec_zeroi16(amp + samples, SAMPLES_PER_CHUNK - samples); samples = SAMPLES_PER_CHUNK; } + /*endif*/ span_log_bump_samples(caller_logging, samples); for (i = 0; i < samples; i++) out_amp[2*i] = amp[i]; - + /*endfor*/ + samples = modem_connect_tones_tx(non_v8_answerer_tx, amp, SAMPLES_PER_CHUNK); if (samples < SAMPLES_PER_CHUNK) { - memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples)); + vec_zeroi16(amp + samples, SAMPLES_PER_CHUNK - samples); samples = SAMPLES_PER_CHUNK; } + /*endif*/ if (v8_rx(v8_caller, amp, samples)) break; + /*endif*/ for (i = 0; i < samples; i++) out_amp[2*i + 1] = amp[i]; + /*endfor*/ - outframes = sf_writef_short(outhandle, out_amp, samples); - if (outframes != samples) + if (outhandle) { - fprintf(stderr, " Error writing audio file\n"); - exit(2); + outframes = sf_writef_short(outhandle, out_amp, samples); + if (outframes != samples) + { + fprintf(stderr, " Error writing audio file\n"); + exit(2); + } + /*endif*/ } + /*endif*/ } + /*endfor*/ v8_free(v8_caller); modem_connect_tones_tx_free(non_v8_answerer_tx); -#if 0 - if (negotiations_ok != 1) + if (negotiations_ok != 42) { printf("Tests failed.\n"); exit(2); } -#endif + /*endif*/ return 0; } /*- End of function --------------------------------------------------------*/ @@ -441,6 +520,7 @@ int main(int argc, char *argv[]) SNDFILE *inhandle; SNDFILE *outhandle; int opt; + int log_audio; char *decode_test_file; v8_state_t *v8_caller; v8_state_t *v8_answerer; @@ -449,13 +529,17 @@ int main(int argc, char *argv[]) logging_state_t *logging; decode_test_file = NULL; - while ((opt = getopt(argc, argv, "d:")) != -1) + log_audio = FALSE; + while ((opt = getopt(argc, argv, "d:l")) != -1) { switch (opt) { case 'd': decode_test_file = optarg; break; + case 'l': + log_audio = TRUE; + break; default: //usage(); exit(2); @@ -463,62 +547,37 @@ int main(int argc, char *argv[]) } } - caller_available_modulations = V8_MOD_V17 - | V8_MOD_V21 - | V8_MOD_V22 - | V8_MOD_V23HALF - | V8_MOD_V23 - | V8_MOD_V26BIS - | V8_MOD_V26TER - | V8_MOD_V27TER - | V8_MOD_V29 - | V8_MOD_V32 - | V8_MOD_V34HALF - | V8_MOD_V34 - | V8_MOD_V90 - | V8_MOD_V92; - answerer_available_modulations = V8_MOD_V17 - | V8_MOD_V21 - | V8_MOD_V22 - | V8_MOD_V23HALF - | V8_MOD_V23 - | V8_MOD_V26BIS - | V8_MOD_V26TER - | V8_MOD_V27TER - | V8_MOD_V29 - | V8_MOD_V32 - | V8_MOD_V34HALF - | V8_MOD_V34 - | V8_MOD_V90 - | V8_MOD_V92; - - if (decode_test_file == NULL) + if (decode_test_file) { - if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 2)) == NULL) - { - fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME); - exit(2); - } + caller_available_modulations = V8_MOD_V17 + | V8_MOD_V21 + | V8_MOD_V22 + | V8_MOD_V23HDX + | V8_MOD_V23 + | V8_MOD_V26BIS + | V8_MOD_V26TER + | V8_MOD_V27TER + | V8_MOD_V29 + | V8_MOD_V32 + | V8_MOD_V34HDX + | V8_MOD_V34 + | V8_MOD_V90 + | V8_MOD_V92; + answerer_available_modulations = V8_MOD_V17 + | V8_MOD_V21 + | V8_MOD_V22 + | V8_MOD_V23HDX + | V8_MOD_V23 + | V8_MOD_V26BIS + | V8_MOD_V26TER + | V8_MOD_V27TER + | V8_MOD_V29 + | V8_MOD_V32 + | V8_MOD_V34HDX + | V8_MOD_V34 + | V8_MOD_V90 + | V8_MOD_V92; - printf("Test 1: V.8 terminal calls V.8 terminal\n"); - v8_calls_v8_tests(outhandle); - - printf("Test 2: non-V.8 terminal calls V.8 terminal\n"); - non_v8_calls_v8_tests(outhandle); - - printf("Test 3: V.8 terminal calls non-V.8 terminal\n"); - v8_calls_non_v8_tests(outhandle); - - if (sf_close(outhandle)) - { - fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); - exit(2); - } - - printf("Tests passed.\n"); - } - else - { printf("Decode file '%s'\n", decode_test_file); v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE; v8_call_parms.call_function = V8_CALL_V_SERIES; @@ -579,7 +638,43 @@ int main(int argc, char *argv[]) } /*endif*/ } - return 0; + else + { + outhandle = NULL; + if (log_audio) + { + if ((outhandle = sf_open_telephony_write(OUTPUT_FILE_NAME, 2)) == NULL) + { + fprintf(stderr, " Cannot create audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + /*endif*/ + } + /*endif*/ + + printf("Test 1: V.8 terminal calls V.8 terminal\n"); + v8_calls_v8_tests(outhandle); + + printf("Test 2: non-V.8 terminal calls V.8 terminal\n"); + non_v8_calls_v8_tests(outhandle); + + printf("Test 3: V.8 terminal calls non-V.8 terminal\n"); + v8_calls_non_v8_tests(outhandle); + + if (outhandle) + { + if (sf_close(outhandle)) + { + fprintf(stderr, " Cannot close audio file '%s'\n", OUTPUT_FILE_NAME); + exit(2); + } + /*endif*/ + } + /*endif*/ + + printf("Tests passed.\n"); + } + return 0; } /*- End of function --------------------------------------------------------*/ /*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/tests/vector_float_tests.c b/libs/spandsp/tests/vector_float_tests.c index ec578bef41..2d388fc9dc 100644 --- a/libs/spandsp/tests/vector_float_tests.c +++ b/libs/spandsp/tests/vector_float_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: vector_float_tests.c,v 1.13 2009/04/26 07:00:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/tests/vector_int_tests.c b/libs/spandsp/tests/vector_int_tests.c index f8c147e955..53f0b07949 100644 --- a/libs/spandsp/tests/vector_int_tests.c +++ b/libs/spandsp/tests/vector_int_tests.c @@ -21,8 +21,6 @@ * 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. - * - * $Id: vector_int_tests.c,v 1.11 2009/04/26 07:00:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/unpack_g722_data.sh b/libs/spandsp/unpack_g722_data.sh index 695e0fc7a7..a73c345a3b 100755 --- a/libs/spandsp/unpack_g722_data.sh +++ b/libs/spandsp/unpack_g722_data.sh @@ -16,9 +16,6 @@ # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: unpack_g722_data.sh,v 1.5 2008/05/03 07:55:04 steveu Exp $ -# ITUDATA="../../../T-REC-G.722-198703-I!AppII!ZPF-E.zip" diff --git a/libs/spandsp/unpack_g726_data.sh b/libs/spandsp/unpack_g726_data.sh index c4b9062f9f..8e3bbf3d6b 100755 --- a/libs/spandsp/unpack_g726_data.sh +++ b/libs/spandsp/unpack_g726_data.sh @@ -16,9 +16,6 @@ # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: unpack_g726_data.sh,v 1.6 2008/05/03 07:55:04 steveu Exp $ -# ITUDATA="../../../T-REC-G.726-199103-I!AppII!SOFT-ZST-E.zip" diff --git a/libs/spandsp/unpack_gsm0610_data.sh b/libs/spandsp/unpack_gsm0610_data.sh index a1f889ec2b..d1f8b92a23 100755 --- a/libs/spandsp/unpack_gsm0610_data.sh +++ b/libs/spandsp/unpack_gsm0610_data.sh @@ -16,9 +16,6 @@ # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: unpack_gsm0610_data.sh,v 1.7 2008/05/03 10:59:44 steveu Exp $ -# # The ETSI distribution file extracts to 5 ZIP files, called DISK1.ZIP to DISK5.ZIP # These were originally the contents of 5 floppy disks. Disks 1 to 3 contain data @@ -167,11 +164,47 @@ then # to make the .EXE files actually executable. chmod 755 *.EXE ./FR_HOM_A.EXE >/dev/null + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot run ./FR_HOM_A.EXE + exit $RETVAL + fi ./FR_SYN_A.EXE >/dev/null + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot run ./FR_HOM_A.EXE + exit $RETVAL + fi ./FR_A.EXE >/dev/null + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot run ./FR_HOM_A.EXE + exit $RETVAL + fi ./FR_HOM_U.EXE >/dev/null + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot run ./FR_HOM_A.EXE + exit $RETVAL + fi ./FR_SYN_U.EXE >/dev/null + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot run ./FR_HOM_A.EXE + exit $RETVAL + fi ./FR_U.EXE >/dev/null + RETVAL=$? + if [ $RETVAL != 0 ] + then + echo Cannot run ./FR_HOM_A.EXE + exit $RETVAL + fi rm -rf READ_FRA.TXT fi diff --git a/libs/spandsp/unpack_v56ter_data.sh b/libs/spandsp/unpack_v56ter_data.sh index c5f38ec957..28b8276679 100755 --- a/libs/spandsp/unpack_v56ter_data.sh +++ b/libs/spandsp/unpack_v56ter_data.sh @@ -16,9 +16,6 @@ # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: unpack_v56ter_data.sh,v 1.5 2008/05/03 07:55:04 steveu Exp $ -# ITUDATA="../../../T-REC-V.56ter-199608-I!!ZPF-E.zip"