]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Moved spandsp to a more recent version. A huge number of little changes occur here...
authorSteve Underwood <steveu@coppice.org>
Sat, 24 Jul 2010 19:29:44 +0000 (03:29 +0800)
committerSteve Underwood <steveu@coppice.org>
Sat, 24 Jul 2010 19:29:44 +0000 (03:29 +0800)
lost all the $Id$ entries the source files had for the dark old days of CVS

355 files changed:
libs/spandsp/Makefile.am
libs/spandsp/autogen.sh
libs/spandsp/configure.ac
libs/spandsp/doc/Makefile.am
libs/spandsp/doc/t38_manual.xml
libs/spandsp/spandsp-sim/Makefile.am
libs/spandsp/spandsp-sim/g1050.c
libs/spandsp/spandsp-sim/line_model.c
libs/spandsp/spandsp-sim/make_line_models.c
libs/spandsp/spandsp-sim/rfc2198_sim.c
libs/spandsp/spandsp-sim/spandsp-sim.h
libs/spandsp/spandsp-sim/spandsp/g1050.h
libs/spandsp/spandsp-sim/spandsp/line_model.h
libs/spandsp/spandsp-sim/spandsp/line_models.h
libs/spandsp/spandsp-sim/spandsp/rfc2198_sim.h
libs/spandsp/spandsp-sim/spandsp/test_utils.h
libs/spandsp/spandsp-sim/test_utils.c
libs/spandsp/spandsp/global-tones.xml
libs/spandsp/spandsp/tsb85.xml
libs/spandsp/src/Makefile.am
libs/spandsp/src/adsi.c
libs/spandsp/src/async.c
libs/spandsp/src/at_interpreter.c
libs/spandsp/src/awgn.c
libs/spandsp/src/bell_r2_mf.c
libs/spandsp/src/bert.c
libs/spandsp/src/bit_operations.c
libs/spandsp/src/bitstream.c
libs/spandsp/src/complex_filters.c
libs/spandsp/src/complex_vector_float.c
libs/spandsp/src/complex_vector_int.c
libs/spandsp/src/crc.c
libs/spandsp/src/dds_float.c
libs/spandsp/src/dds_int.c
libs/spandsp/src/dtmf.c
libs/spandsp/src/echo.c
libs/spandsp/src/fax.c
libs/spandsp/src/fax_modems.c
libs/spandsp/src/faxfont.h
libs/spandsp/src/filter_tools.c
libs/spandsp/src/filter_tools.h
libs/spandsp/src/floating_fudge.h
libs/spandsp/src/fsk.c
libs/spandsp/src/g711.c
libs/spandsp/src/g722.c
libs/spandsp/src/g726.c
libs/spandsp/src/gsm0610_decode.c
libs/spandsp/src/gsm0610_encode.c
libs/spandsp/src/gsm0610_local.h
libs/spandsp/src/gsm0610_long_term.c
libs/spandsp/src/gsm0610_lpc.c
libs/spandsp/src/gsm0610_preprocess.c
libs/spandsp/src/gsm0610_rpe.c
libs/spandsp/src/gsm0610_short_term.c
libs/spandsp/src/hdlc.c
libs/spandsp/src/ima_adpcm.c
libs/spandsp/src/logging.c
libs/spandsp/src/lpc10_analyse.c
libs/spandsp/src/lpc10_decode.c
libs/spandsp/src/lpc10_encdecs.h
libs/spandsp/src/lpc10_encode.c
libs/spandsp/src/lpc10_placev.c
libs/spandsp/src/lpc10_voicing.c
libs/spandsp/src/make_at_dictionary.c
libs/spandsp/src/make_modem_filter.c
libs/spandsp/src/mmx_sse_decs.h
libs/spandsp/src/modem_connect_tones.c
libs/spandsp/src/modem_echo.c
libs/spandsp/src/msvc/config.h
libs/spandsp/src/noise.c
libs/spandsp/src/playout.c
libs/spandsp/src/plc.c
libs/spandsp/src/power_meter.c
libs/spandsp/src/queue.c
libs/spandsp/src/schedule.c
libs/spandsp/src/sig_tone.c
libs/spandsp/src/silence_gen.c
libs/spandsp/src/spandsp.h.in
libs/spandsp/src/spandsp/adsi.h
libs/spandsp/src/spandsp/arctan2.h
libs/spandsp/src/spandsp/async.h
libs/spandsp/src/spandsp/at_interpreter.h
libs/spandsp/src/spandsp/awgn.h
libs/spandsp/src/spandsp/bell_r2_mf.h
libs/spandsp/src/spandsp/bert.h
libs/spandsp/src/spandsp/biquad.h
libs/spandsp/src/spandsp/bit_operations.h
libs/spandsp/src/spandsp/bitstream.h
libs/spandsp/src/spandsp/complex.h
libs/spandsp/src/spandsp/complex_filters.h
libs/spandsp/src/spandsp/complex_vector_float.h
libs/spandsp/src/spandsp/complex_vector_int.h
libs/spandsp/src/spandsp/crc.h
libs/spandsp/src/spandsp/dc_restore.h
libs/spandsp/src/spandsp/dds.h
libs/spandsp/src/spandsp/dtmf.h
libs/spandsp/src/spandsp/echo.h
libs/spandsp/src/spandsp/expose.h
libs/spandsp/src/spandsp/fast_convert.h
libs/spandsp/src/spandsp/fax.h
libs/spandsp/src/spandsp/fax_modems.h
libs/spandsp/src/spandsp/fir.h
libs/spandsp/src/spandsp/fsk.h
libs/spandsp/src/spandsp/g168models.h
libs/spandsp/src/spandsp/g711.h
libs/spandsp/src/spandsp/g722.h
libs/spandsp/src/spandsp/g726.h
libs/spandsp/src/spandsp/gsm0610.h
libs/spandsp/src/spandsp/hdlc.h
libs/spandsp/src/spandsp/ima_adpcm.h
libs/spandsp/src/spandsp/logging.h
libs/spandsp/src/spandsp/lpc10.h
libs/spandsp/src/spandsp/modem_connect_tones.h
libs/spandsp/src/spandsp/modem_echo.h
libs/spandsp/src/spandsp/noise.h
libs/spandsp/src/spandsp/oki_adpcm.h
libs/spandsp/src/spandsp/playout.h
libs/spandsp/src/spandsp/plc.h
libs/spandsp/src/spandsp/power_meter.h
libs/spandsp/src/spandsp/private/adsi.h
libs/spandsp/src/spandsp/private/async.h
libs/spandsp/src/spandsp/private/at_interpreter.h
libs/spandsp/src/spandsp/private/awgn.h
libs/spandsp/src/spandsp/private/bell_r2_mf.h
libs/spandsp/src/spandsp/private/bert.h
libs/spandsp/src/spandsp/private/bitstream.h
libs/spandsp/src/spandsp/private/dtmf.h
libs/spandsp/src/spandsp/private/echo.h
libs/spandsp/src/spandsp/private/fax.h
libs/spandsp/src/spandsp/private/fax_modems.h
libs/spandsp/src/spandsp/private/fsk.h
libs/spandsp/src/spandsp/private/g711.h
libs/spandsp/src/spandsp/private/g722.h
libs/spandsp/src/spandsp/private/g726.h
libs/spandsp/src/spandsp/private/gsm0610.h
libs/spandsp/src/spandsp/private/hdlc.h
libs/spandsp/src/spandsp/private/ima_adpcm.h
libs/spandsp/src/spandsp/private/logging.h
libs/spandsp/src/spandsp/private/lpc10.h
libs/spandsp/src/spandsp/private/modem_connect_tones.h
libs/spandsp/src/spandsp/private/modem_echo.h
libs/spandsp/src/spandsp/private/noise.h
libs/spandsp/src/spandsp/private/oki_adpcm.h
libs/spandsp/src/spandsp/private/queue.h
libs/spandsp/src/spandsp/private/schedule.h
libs/spandsp/src/spandsp/private/sig_tone.h
libs/spandsp/src/spandsp/private/silence_gen.h
libs/spandsp/src/spandsp/private/super_tone_rx.h
libs/spandsp/src/spandsp/private/super_tone_tx.h
libs/spandsp/src/spandsp/private/swept_tone.h
libs/spandsp/src/spandsp/private/t30.h
libs/spandsp/src/spandsp/private/t30_dis_dtc_dcs_bits.h
libs/spandsp/src/spandsp/private/t31.h
libs/spandsp/src/spandsp/private/t38_core.h
libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h
libs/spandsp/src/spandsp/private/t38_terminal.h
libs/spandsp/src/spandsp/private/t4_rx.h
libs/spandsp/src/spandsp/private/t4_tx.h
libs/spandsp/src/spandsp/private/time_scale.h
libs/spandsp/src/spandsp/private/tone_detect.h
libs/spandsp/src/spandsp/private/tone_generate.h
libs/spandsp/src/spandsp/private/v17rx.h
libs/spandsp/src/spandsp/private/v17tx.h
libs/spandsp/src/spandsp/private/v18.h
libs/spandsp/src/spandsp/private/v22bis.h
libs/spandsp/src/spandsp/private/v27ter_rx.h
libs/spandsp/src/spandsp/private/v27ter_tx.h
libs/spandsp/src/spandsp/private/v29rx.h
libs/spandsp/src/spandsp/private/v29tx.h
libs/spandsp/src/spandsp/private/v42.h
libs/spandsp/src/spandsp/private/v42bis.h
libs/spandsp/src/spandsp/private/v8.h
libs/spandsp/src/spandsp/queue.h
libs/spandsp/src/spandsp/saturated.h
libs/spandsp/src/spandsp/schedule.h
libs/spandsp/src/spandsp/sig_tone.h
libs/spandsp/src/spandsp/silence_gen.h
libs/spandsp/src/spandsp/super_tone_rx.h
libs/spandsp/src/spandsp/super_tone_tx.h
libs/spandsp/src/spandsp/swept_tone.h
libs/spandsp/src/spandsp/t30.h
libs/spandsp/src/spandsp/t30_api.h
libs/spandsp/src/spandsp/t30_fcf.h
libs/spandsp/src/spandsp/t30_logging.h
libs/spandsp/src/spandsp/t31.h
libs/spandsp/src/spandsp/t35.h
libs/spandsp/src/spandsp/t38_core.h
libs/spandsp/src/spandsp/t38_gateway.h
libs/spandsp/src/spandsp/t38_non_ecm_buffer.h
libs/spandsp/src/spandsp/t38_terminal.h
libs/spandsp/src/spandsp/t4_rx.h
libs/spandsp/src/spandsp/t4_tx.h
libs/spandsp/src/spandsp/telephony.h
libs/spandsp/src/spandsp/time_scale.h
libs/spandsp/src/spandsp/timing.h
libs/spandsp/src/spandsp/tone_detect.h
libs/spandsp/src/spandsp/tone_generate.h
libs/spandsp/src/spandsp/v17rx.h
libs/spandsp/src/spandsp/v17tx.h
libs/spandsp/src/spandsp/v18.h
libs/spandsp/src/spandsp/v22bis.h
libs/spandsp/src/spandsp/v27ter_rx.h
libs/spandsp/src/spandsp/v27ter_tx.h
libs/spandsp/src/spandsp/v29rx.h
libs/spandsp/src/spandsp/v29tx.h
libs/spandsp/src/spandsp/v42.h
libs/spandsp/src/spandsp/v42bis.h
libs/spandsp/src/spandsp/v8.h
libs/spandsp/src/spandsp/vector_float.h
libs/spandsp/src/spandsp/vector_int.h
libs/spandsp/src/spandsp/version.h
libs/spandsp/src/spandsp/version.h.in
libs/spandsp/src/super_tone_rx.c
libs/spandsp/src/super_tone_tx.c
libs/spandsp/src/swept_tone.c
libs/spandsp/src/t30.c
libs/spandsp/src/t30_api.c
libs/spandsp/src/t30_local.h
libs/spandsp/src/t30_logging.c
libs/spandsp/src/t31.c
libs/spandsp/src/t35.c
libs/spandsp/src/t38_core.c
libs/spandsp/src/t38_gateway.c
libs/spandsp/src/t38_non_ecm_buffer.c
libs/spandsp/src/t38_terminal.c
libs/spandsp/src/t4_rx.c
libs/spandsp/src/t4_t6_decode_states.h
libs/spandsp/src/t4_tx.c
libs/spandsp/src/testcpuid.c
libs/spandsp/src/time_scale.c
libs/spandsp/src/tone_detect.c
libs/spandsp/src/tone_generate.c
libs/spandsp/src/v17_v32bis_rx_constellation_maps.h
libs/spandsp/src/v17_v32bis_tx_constellation_maps.h
libs/spandsp/src/v17rx.c
libs/spandsp/src/v17tx.c
libs/spandsp/src/v18.c
libs/spandsp/src/v22bis_rx.c
libs/spandsp/src/v22bis_tx.c
libs/spandsp/src/v27ter_rx.c
libs/spandsp/src/v27ter_tx.c
libs/spandsp/src/v29rx.c
libs/spandsp/src/v29tx.c
libs/spandsp/src/v29tx_constellation_maps.h
libs/spandsp/src/v42.c
libs/spandsp/src/v42bis.c
libs/spandsp/src/v8.c
libs/spandsp/src/vector_float.c
libs/spandsp/src/vector_int.c
libs/spandsp/test-data/Makefile.am
libs/spandsp/test-data/etsi/Makefile.am
libs/spandsp/test-data/etsi/fax/Makefile.am
libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c
libs/spandsp/test-data/itu/Makefile.am
libs/spandsp/test-data/itu/fax/Makefile.am
libs/spandsp/test-data/itu/fax/generate_dithered_tif.c
libs/spandsp/test-data/itu/fax/generate_sized_pages.c
libs/spandsp/test-data/local/Makefile.am
libs/spandsp/tests/Makefile.am
libs/spandsp/tests/adsi_tests.c
libs/spandsp/tests/async_tests.c
libs/spandsp/tests/at_interpreter_tests.c
libs/spandsp/tests/awgn_tests.c
libs/spandsp/tests/bell_mf_rx_tests.c
libs/spandsp/tests/bell_mf_tx_tests.c
libs/spandsp/tests/bert_tests.c
libs/spandsp/tests/bit_operations_tests.c
libs/spandsp/tests/complex_tests.c
libs/spandsp/tests/complex_vector_float_tests.c
libs/spandsp/tests/complex_vector_int_tests.c
libs/spandsp/tests/crc_tests.c
libs/spandsp/tests/dc_restore_tests.c
libs/spandsp/tests/dds_tests.c
libs/spandsp/tests/dtmf_rx_tests.c
libs/spandsp/tests/dtmf_tx_tests.c
libs/spandsp/tests/echo_monitor.cpp
libs/spandsp/tests/echo_monitor.h
libs/spandsp/tests/echo_tests.c
libs/spandsp/tests/fax_decode.c
libs/spandsp/tests/fax_tester.c
libs/spandsp/tests/fax_tester.h
libs/spandsp/tests/fax_tests.c
libs/spandsp/tests/fax_tests.sh
libs/spandsp/tests/fax_utils.c
libs/spandsp/tests/fax_utils.h
libs/spandsp/tests/fsk_tests.c
libs/spandsp/tests/g1050_tests.c
libs/spandsp/tests/g168_tests.c
libs/spandsp/tests/g711_tests.c
libs/spandsp/tests/g722_tests.c
libs/spandsp/tests/g726_tests.c
libs/spandsp/tests/gsm0610_tests.c
libs/spandsp/tests/hdlc_tests.c
libs/spandsp/tests/ima_adpcm_tests.c
libs/spandsp/tests/line_model_monitor.cpp
libs/spandsp/tests/line_model_monitor.h
libs/spandsp/tests/line_model_tests.c
libs/spandsp/tests/logging_tests.c
libs/spandsp/tests/lpc10_tests.c
libs/spandsp/tests/make_g168_css.c
libs/spandsp/tests/media_monitor.cpp
libs/spandsp/tests/media_monitor.h
libs/spandsp/tests/modem_connect_tones_tests.c
libs/spandsp/tests/modem_echo_tests.c
libs/spandsp/tests/modem_monitor.cpp
libs/spandsp/tests/modem_monitor.h
libs/spandsp/tests/noise_tests.c
libs/spandsp/tests/pcap_parse.c [new file with mode: 0644]
libs/spandsp/tests/pcap_parse.h [new file with mode: 0644]
libs/spandsp/tests/playout_tests.c
libs/spandsp/tests/plc_tests.c
libs/spandsp/tests/power_meter_tests.c
libs/spandsp/tests/queue_tests.c
libs/spandsp/tests/r2_mf_rx_tests.c
libs/spandsp/tests/r2_mf_tx_tests.c
libs/spandsp/tests/regression_tests.sh
libs/spandsp/tests/rfc2198_sim_tests.c
libs/spandsp/tests/schedule_tests.c
libs/spandsp/tests/sig_tone_tests.c
libs/spandsp/tests/super_tone_rx_tests.c
libs/spandsp/tests/super_tone_tx_tests.c
libs/spandsp/tests/swept_tone_tests.c
libs/spandsp/tests/t31_tests.c
libs/spandsp/tests/t38_core_tests.c
libs/spandsp/tests/t38_decode.c [new file with mode: 0644]
libs/spandsp/tests/t38_gateway_tests.c
libs/spandsp/tests/t38_gateway_to_terminal_tests.c
libs/spandsp/tests/t38_non_ecm_buffer_tests.c
libs/spandsp/tests/t38_terminal_tests.c
libs/spandsp/tests/t38_terminal_to_gateway_tests.c
libs/spandsp/tests/t4_tests.c
libs/spandsp/tests/testadsi.c
libs/spandsp/tests/testfax.c
libs/spandsp/tests/time_scale_tests.c
libs/spandsp/tests/tone_detect_tests.c
libs/spandsp/tests/tone_generate_tests.c
libs/spandsp/tests/tsb85_tests.c
libs/spandsp/tests/tsb85_tests.sh
libs/spandsp/tests/udptl.c [new file with mode: 0644]
libs/spandsp/tests/udptl.h [new file with mode: 0644]
libs/spandsp/tests/v17_tests.c
libs/spandsp/tests/v18_tests.c
libs/spandsp/tests/v22bis_tests.c
libs/spandsp/tests/v27ter_tests.c
libs/spandsp/tests/v29_tests.c
libs/spandsp/tests/v42_tests.c
libs/spandsp/tests/v42bis_tests.c
libs/spandsp/tests/v42bis_tests.sh
libs/spandsp/tests/v8_tests.c
libs/spandsp/tests/vector_float_tests.c
libs/spandsp/tests/vector_int_tests.c
libs/spandsp/unpack_g722_data.sh
libs/spandsp/unpack_g726_data.sh
libs/spandsp/unpack_gsm0610_data.sh
libs/spandsp/unpack_v56ter_data.sh

index 69f1b068233d57c10298c8a870a4f659be2a7760..193c108c6b3f4e53e036ba3cfe0caf5a068a5876 100644 (file)
@@ -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 \
index a32d63e370f6f6c1fd18540b06fff4e56cc298f4..2d9a0670da2bd99568766124e6255ffb6a62a48b 100755 (executable)
@@ -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`
 
index bfc348584ccbdef39b130feb560349094cec198a..3aeb44ff52fed1b5fe0b81a63a3a02ec00aaf3b4 100644 (file)
 # 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)
index ba4386a156c5f09cf9edca0edf28db685ef80759..b85883f4f76e116779c69399ae2a7ca02bacb07a 100644 (file)
@@ -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
 
index 095d7d7d03525e07ec48eede4073781dadcab1d9..7edcd9583ce10b4c87936dca9d61da23fa07090c 100644 (file)
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="iso8859-1"?>
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
                "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
-<!-- $Id: t38_manual.xml,v 1.5 2007/12/08 16:25:17 steveu Exp $ -->
 <book>
   <bookinfo>
     <date>2007-11-14</date>
index 63fb09473b5539de37a623b7dd1a4838fd691a2c..d33575a55c770e1c4205b05d7e2540a293af800b 100644 (file)
@@ -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)
index 10b77532264d5f8b04c1c5de19dd3a9131b72aa3..afdcf82d63bb95f8b808a149fb32b4dd35386cc2 100644 (file)
@@ -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)
index 88af203ab0d236b8b897224366f181f5df9dfa18..001af2c581c5a100689332a08ce17af921b9eec0 100644 (file)
@@ -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;
 }
index 42fac11fa88148a524c9eb744fef257607620291..fd7b81f72fb5049a7ece0410cd484fb5e5474987 100644 (file)
@@ -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
index 16929bf1588416c645805b021001ceb76877574e..b187ae6e1539b762995b70de461137d6b2a07dc0 100644 (file)
@@ -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)
index 8dfa9b3374222fce33e4fa5bf2a373cfd4bc6254..ea15435665c328c273c73127353215a16223213b 100644 (file)
@@ -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 */
index b7ffb8057448819483eba45280de8b6a5a48c619..731947b39c32516a61cdf5e5c3d827db383dba3c 100644 (file)
@@ -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 */
index ce8f7ddd093bb421ea7939bd5f16e8c0973302c6..550e8a80fea3a4730e437abbe8ccf909c24d2d4a 100644 (file)
@@ -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);
 
index bf68f936deba56e57fb52ead6675559a594a78a6..3acdd4492c16b81255a2d4f7c74bb597ccda2287 100644 (file)
@@ -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 */
index 51618028dc9f6cfe17641456a083e941ca6dd6ff..a0c3d64b624cc723e714393133925107d18b9dc2 100644 (file)
@@ -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 */
index f64c83837465502516f914a01c058bc8e642329c..22815a35c637e32d08628e00e0e40bb26bda3ff2 100644 (file)
@@ -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 */
index 992da5cba8c473407f72101d96934f8ff683c5f1..d2fc2fc7e56f48b6c514519d7c3ae54185f98702 100644 (file)
@@ -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 */
index a1012bab93474ac9ccbb73bf0bcf258e75f6574a..466dae5d2f3c1ef0ddaede0d4d8f9f58befd9c90 100644 (file)
       <step freq="525" level="-12" length="0.1"/>
       <step length="0.1"/>
     </offering-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Austria" uncode="at">
     <dial-tone>
       <step freq="380+420" level="-12" length="0.4"/>
       <step length="0.4"/>
     </negative-indication-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Bahamas" uncode="bs">
     <ringback-tone>
       <step freq="1380" level="-12" length="0.333"/>
       <step freq="1860" level="-12" length="0.333"/>
     </special-information-tone>
+    <!-- Billing signal: 16kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Benin" uncode="bj">
     <ringback-tone>
       <step freq="440" level="-12" length="0.05"/>
       <step length="0.05"/>
     </route-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Canada" uncode="ca">
     <dial-tone>
       <step freq="12000" level="-12" length="0.15"/>
       <step length="0.15"/>
     </pay-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Channel Islands: Jersey" uncode="??">
     <dial-tone>
       <step freq="425" level="-12" length="0.333"/>
       <step length="1.5"/>
     </offering-tone>
+    <!-- Billing signal: 16kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Denmark" uncode="dk">
     <dial-tone>
       <step freq="1400+950" level="-12" length="0.2"/>
       <step length="2.0"/>
     </payphone-recognition-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Diego Garcia" uncode="??">
     <dial-tone>
       <step freq="1800" level="-12" length="0.33"/>
       <step length="0.3"/>
     </waiting-tone>
+    <!-- Billing signal: 16kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Ethiopia" uncode="et">
     <dial-tone>
       <step freq="425" level="-12" length="0.15"/>
       <step length="8.0"/>
     </waiting-tone>
+    <!-- Billing signal: 16kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="France" uncode="fr">
     <dial-tone>
       <step freq="440" level="-12" length="0.05"/>
       <step length="0.05"/>
     </route-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="French Polynesia" uncode="pf">
     <dial-tone>
         <step length="2.0"/>
       </step>
     </payphone-recognition-tone>
+    <!-- Billing signal: 16kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Ghana" uncode="gh">
     <dial-tone>
         <step freq="450" level="-12"/>
       </step>
     </number-unobtainable-tone>
+    <!-- Billing signal: 16kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Greenland" uncode="gl">
     <dial-tone>
       <step freq="750+1450" level="-12" length="0.2"/>
       <step length="2.0"/>
     </payphone-recognition-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Israel" uncode="il">
     <dial-tone>
       <step freq="400" level="-12" length="0.05"/>
       <step length="2.0"/>
     </holding-tone>
+    <!-- Billing signal: 16kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Italy" uncode="it">
     <dial-tone>
         <step length="0.2"/>
       </step>
     </busy-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Ivory Coast" uncode="ci">
     <dial-tone>
       <step freq="425" level="-12" length="0.05"/>
       <step length="0.05"/>
     </route-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Jamaica" uncode="jm">
     <dial-tone>
       <step freq="400" level="-12" length="0.15"/>
       <step length="0.15"/>
     </pay-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Martinique (French Dep.)" uncode="mq">
     <dial-tone>
       <step freq="425 || 450" level="-12" length="0.0625"/>
       <step length="0.0625"/>
     </negative-indication-tone>
+    <!-- Billing signal: 50Hz/~50Vrms, longitudinal/~160ms -->
   </tone-set>
   <tone-set country="New Caledonia" uncode="nc">
     <dial-tone>
         <step length="2.0"/>
       </step>
     </payphone-recognition-tone>
+    <!-- Billing signal: 16kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Oman" uncode="om">
     <dial-tone>
       <step freq="941" level="-12" length="0.2"/>
       <step length="2.0"/>
     </payphone-recognition-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Puerto Rico" uncode="pr">
     <payphone-recognition-tone>
       <step freq="440" level="-12" length="0.05"/>
       <step length="0.05"/>
     </route-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="St. Helena" uncode="sh">
     <dial-tone>
     <warning-tone type="conference">
       <step freq="425" level="-12" length="0.66"/>
     </warning-tone>
+    <!-- Billing signal: 16kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Slovenia" uncode="si">
     <dial-tone>
       <step freq="1600" level="-12" length="0.05"/>
       <step length="1.5"/>
     </payphone-recognition-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Sri Lanka" uncode="lk">
     <dial-tone>
         <step length="3.6"/>
       </step>
     </pay-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Switzerland" uncode="ch">
     <dial-tone>
       <step freq="750+1450" level="-12" length="0.2"/>
       <step length="2.0"/>
     </payphone-recognition-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Syria" uncode="sy">
     <dial-tone>
         <step length="0.167"/>
       </step>
     </congestion-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Turkey" uncode="tr">
     <dial-tone>
       <step freq="450" level="-12" length="0.04"/>
       <step length="0.04"/>
     </confirmation-tone>
+    <!-- Billing signal: 12kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Turkmenistan" uncode="tm">
     <dial-tone>
         <step length="0.125"/>
       </step>
     </pay-tone>
+    <!-- Billing signal: 50Hz/~50Vrms, longitudinal/~160ms -->
   </tone-set>
   <tone-set country="United States" uncode="us">
     <dial-tone>
       <step freq="1800" level="-12" length="0.333"/>
       <step length="1.0"/>
     </special-information-tone>
+    <!-- Billing signal: 16kHz/~2Vrms, differential/~125ms -->
   </tone-set>
   <tone-set country="Zambia" uncode="zm">
     <dial-tone>
index 01ebf29efa4fc13f93317b6e4a2a8d1e6d508839..cd0d5db807f6245e9d9d06563b4de3e7cbfa90d9 100644 (file)
@@ -1,7 +1,6 @@
 <?xml version="1.0"?>
 <!DOCTYPE fax-tests SYSTEM "./fax-tests.dtd">
 <fax-tests>
-<!-- $Id: tsb85.xml,v 1.22 2009/05/24 07:18:36 steveu Exp $ -->
 <config>
     <path type="IMAGE" value="../test-data/etsi/fax"/>
 </config>
         <step dir="T" type="POSTAMBLE"/>
         <step type="WAIT" value="75"/>
         <step dir="T" type="PREAMBLE" modem="V.21"/>
-        <step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 00 00 08"/>
+        <step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 00 80 08"/>
         <step dir="T" type="POSTAMBLE"/>
 
         <possible-step>
         <step dir="T" type="POSTAMBLE"/>
         <step type="WAIT" value="75"/>
         <step dir="T" type="PREAMBLE" modem="V.21"/>
-        <step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 00 00 08"/>
+        <step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 80 00 08"/>
         <step dir="T" type="POSTAMBLE"/>
 
         <possible-step>
index 3ed16a618b18532be2283369e094f86c02554e30..7e8af50f5f36441cdb16ad0ddfb3a17f1aacb5d9 100644 (file)
@@ -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.$(OBJEXT): ${V17_V32BIS_TX_INCL}
 
-v17tx.lo: v17_v32bis_tx_fixed_rrc.h v17_v32bis_tx_floating_rrc.h
+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.$(OBJEXT): ${V22BIS_RX_INCL}
 
-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.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_.$(OBJEXT): ${V27TER_TX_INCL}
 
-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.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.$(OBJEXT): ${V29_TX_INCL}
 
-v29tx.lo: v29tx_fixed_rrc.h v29tx_floating_rrc.h
+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 <msvc\/inttypes.h>/" \
             -e "s/\@INSERT_MATH_HEADER\@/#include <math.h>/" $(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
index 2e4de25ad18d81225afddf68b6bb071cea12bfca..207c893e09bd62ccd9f6d5e44c26a388009e3cee 100644 (file)
@@ -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 */
index 29974df2de93e5fb6bdcd34f19c6cf5417ed3764..e24d84343b659c1f1bfb09818b9689eb1d253527 100644 (file)
@@ -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 */
index f34d87598100b1c0beac4fcace1f451336a8133f..9bf0d4aa1a18d9d3dbe63010b2facb5a39f28dfc 100644 (file)
@@ -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
index f0e246a1fbd19f6ddda668e29aa0a8596c453a8a..e97dd6be0bdfe34af71e3153ac3698cf9e0def7c 100644 (file)
@@ -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 */
index ae124759212919c73bdab45ad5b44fba0a5c27a8..e61b782dc585fd4e6ee37638ab4e851355e1fd1e 100644 (file)
@@ -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 */
index 69defc1dc2fabdc2a12c2a9c4624af7ea60e09d7..c697b39a7a94930a83038823e0a55fbfc7407250 100644 (file)
@@ -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)
index 547536b68c1a3bd04c7f6807d7e6534e7fa858b9..a301c03ec296ca6515ec7fefabef8dc599c6f73c 100644 (file)
@@ -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 */
index 25468d7391199631ef19416acc9d6aa118084d2b..9a8c0bc9ddbf7379cf0ae65aabe03e3ac35f1adc 100644 (file)
@@ -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_flush(bitstream_state_t *s, uint8_t **c)
+SPAN_DECLARE(void) bitstream_emit(bitstream_state_t *s, uint8_t **c)
 {
+    uint32_t bitstream;
+
     if (s->residue > 0)
     {
-        s->bitstream &= ((1 << s->residue) - 1);
+        bitstream = s->bitstream & ((1 << s->residue) - 1);
         if (s->lsb_first)
-            *(*c)++ = (uint8_t) s->bitstream;
+            *(*c) = (uint8_t) bitstream;
         else
-            *(*c)++ = (uint8_t) (s->bitstream << (8 - s->residue));
+            *(*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)
+    {
+        bitstream_emit(s, c);
+        (*c)++;
         s->residue = 0;
     }
     s->bitstream = 0;
index 7ae4a1323e7804a27662c93cdf0bc9e63dfab26f..36af84b36a26fcf1c107af1c88fb341c99a02913 100644 (file)
@@ -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)
index 3dffbb08ca928752cd28bbb1b93d5190ff455433..ebb6accba4000217d377d03151c01474b2bc62ea 100644 (file)
@@ -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 */
index d55009d49131f6f4f57e8336ffeadf1d8351a1f1..0bf7eb8a98c9d31fc0d20ee731d3d0d2162d9070 100644 (file)
@@ -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 */
index c82c58e3ab964ae9c9909dd66a2072fdec2a446a..f970fe8a2c763800d0507a676b844a804aa92209 100644 (file)
@@ -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 */
 
 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;
index 8acf7c0c3b8a4a4fd49a164d25f9119879b39e8d..4acaa1eaf96035d0f51b63948971e31a35aa53e8 100644 (file)
@@ -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 */
index 9f30d83c80d0c9a3ed5efb1fe77120a9f3247173..cf75ecc9c3481ddc55226ce85cc616f84461ebf5 100644 (file)
@@ -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 */
index fca60dd4d1306a89eb2a40448eba9a58fbacacca..b07f8ec120f5bb01c015abd5397e02f7fc13aefa 100644 (file)
@@ -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 */
index 23bb868bbd162fab113f5ed77f369ef09cfd3a61..13a685d316e77e4a13174f9b9e0e060dfc43b0d1 100644 (file)
@@ -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 */
index 99808d86ef8d9333fa5bcc9fff8bfb2f84ed3ee9..ae10069e82439d1e7c9af6c4e87c4c11502b459f 100644 (file)
@@ -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"
 #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"
 #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 --------------------------------------------------------*/
index bc8404036c07a5f7e1f857190afb8e4488827dd9..29392be1a44f1a0b91fae38002bd8c5cad3650bc 100644 (file)
@@ -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,
index 38ce2f6ffff2066e8b212121afd2ddd7ddb3e978..08ed46ad9d7cfa2dd17efb1106242abf723c66a7 100644 (file)
@@ -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_)
index bef04e89e918ec0dc48fae6837991a3084766f09..17437471668d77a8fc980e48542983316a922b99 100644 (file)
@@ -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)
index da0c99dfff61e0bd361e78a0e53a720a15a94ce3..4df89adab473f357ac3c3505c04a05ce791ac4b3 100644 (file)
@@ -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_)
index a959e20f85b77076d68e492e36e4d818518170c2..2ef0423399f0606b8ddb967836e4892baf725878 100644 (file)
@@ -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_)
index 8e07ada8840bbf3f990b8a1c9f4af29f3c04643b..088c54bb88f3c164b7977b58f34df7b20e612331 100644 (file)
@@ -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
index fad1882011edf495d1d3384492eea3c2a55c0866..17403d8f92a3868d22c8708538756c142153915c 100644 (file)
@@ -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 */
index 1bc84be738dde6662bd35c2bf83a7d37ef50e08e..f2cca6b179066847593a528b531582418d573290 100644 (file)
@@ -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 */
index 3d666f0be27c11f2bc666d815bd224c5d038cb99..2bf1236d80ad74756266cac2a7aba50006fa6ffe 100644 (file)
@@ -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 */
index 1ab1e8e6bb36ab7adff947dc3b735b1f74183d9a..783acda4b3197555000820a75fe0de577cabed50 100644 (file)
@@ -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 */
index 091e4fb4580d14946d12d3a2e180f52c9e80ab28..10a27540df96072d31613e367b5a511addfe9eec 100644 (file)
@@ -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 */
index 42a38c54d4431787e0a5ae5218b382b688bc870f..e3150f62de7dca511fd43f2b75071f97bac33c1d 100644 (file)
@@ -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_)
index a9255fc3a240c64c2798fb613216a4b8dd38d507..d2578325261cbfc58556fbe5cf7e62761db8a662 100644 (file)
@@ -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 */
index b8ec8d4aa223e2c5bc9cf7b94899e74346cf93a1..4b2c553d87250867ece75bdd9b4454353e130d40 100644 (file)
@@ -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 */
index 3e94fa043d902b2bb992e1474ab2757460ac0869..ea0edfd64eb57257a1853439d25edbbdf96eb2c1 100644 (file)
@@ -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 */
index 8d61ef272a476c166e05e9bb05a9b86031c00917..28b1a72e796f2b968a65df2cd64cf7e1f5452f1e 100644 (file)
@@ -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
index 7b1dfe082ab6072db9788c38ee36e58f543b9c5a..226ac1f6eba8ad695e72132b61e97941df8c7512 100644 (file)
@@ -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 */
index 4d84af3df5b74ea0948c28177639092071ccdb9c..a07eb3e9fc1a7d5ad158db3c084e21598d5906ff 100644 (file)
@@ -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 */
index dc6fe29b443725429e2610a33c4a0b71ddebb6ff..299d0d113774c7713b40d35820be8596ef02ebd3 100644 (file)
@@ -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 */
index 2ca54a1d269694194b5ac0617b322b0583326045..726e7bd3223bfe93d8a187bad4d7aa4ad31c70c7 100644 (file)
@@ -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 */
index de294de284a8444c72db5a5aeb415233c5b628ae..7c852c4e12dadc8ecc338a097becfaad7d211ee6 100644 (file)
@@ -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)
index d71272c7637d3b58285350d1c9fe24f6adb79aef..bfb169edaa97f6ae65779a0b329a9cc5e5f1214d 100644 (file)
@@ -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)
index e0c78a65c0919eff229cc26d07b66d04cc73638e..1e276e374b56823fc19058f1b08e17d42c7df798 100644 (file)
@@ -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
index 2f3608019745346f6a19e941450deeb9cf8c0ce7..1a080b65c09bc09c31bfb90ff3c4559502ccb5b8 100644 (file)
@@ -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)
index 6c77cb1414491b5e594309e244ccfe858efc5c76..78723dd6cf1178eb29727ea1485363c524057b45 100644 (file)
@@ -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)
index d11572d21b358db835989c8c10546c88e27825e8..c4754b46b1bb6cc4d79e76348fbc507b9d2a7024 100644 (file)
@@ -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)
index 874bd5469c3f6f6a9869b0a62c0bfaa2b04728b5..b5fee707a51be5d0baced77483b8a533bfd16210 100644 (file)
  * 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)
index 94feb885e2668f1a56288e8f4a4665aae0ff53d4..aa58ac301b2384a80803edf8c3debb2c4d9279e6 100644 (file)
@@ -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,70 +366,76 @@ 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";
+        rx_tag = "_2400";
+        tx_tag = "_2400";
     }
-    else if (strcmp(modem, "V.27ter4800") == 0)
+    else if (strcmp(modem, "V.27ter2400") == 0)
     {
-        rx_coeff_sets = 8;
+        rx_coeff_sets = 12;
         rx_coeffs_per_filter = 27;
         rx_excess_bandwidth = 0.5;
-        tx_coeff_sets = 5;
+        tx_coeff_sets = 20;
         tx_coeffs_per_filter = 9;
         tx_excess_bandwidth = 0.5;
         carrier = 1800.0;
-        baud_rate = 1600.0;
-        tag = "_4800";
+        baud_rate = 1200.0;
+        rx_tag = "_2400";
+        tx_tag = "_2400";
     }
-    else if (strcmp(modem, "V.27ter2400") == 0)
+    else if (strcmp(modem, "V.27ter4800") == 0)
     {
-        rx_coeff_sets = 12;
+        rx_coeff_sets = 8;
         rx_coeffs_per_filter = 27;
         rx_excess_bandwidth = 0.5;
-        tx_coeff_sets = 20;
+        tx_coeff_sets = 5;
         tx_coeffs_per_filter = 9;
         tx_excess_bandwidth = 0.5;
         carrier = 1800.0;
-        baud_rate = 1200.0;
-        tag = "_2400";
+        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;
 }
index 40dca542b58eb605c61fb4649c31fee2dc84873d..4dff6fe26afdfa4b5751913fd9b8481516ee94a9 100644 (file)
@@ -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_)
index 93e0b31485322d6add879479ad72bc580d98b576..25e96b04d2555570fd74af9b0fc97bb7fd439bdc 100644 (file)
@@ -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 <steveu@coppice.org>
  *
@@ -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 */
index c31d4cba3182da213f479c4a81726a30203526d8..e4203e15e5a3086ea77aa31b0857c3a9b8100ed1 100644 (file)
@@ -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 */
 
 #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;
index f1bdab324f92102a633dc5f267b74967208c14ba..a1eaae16a6210637a0748cc3bc49eccc73fe7b62 100644 (file)
@@ -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_)
index 4eaccae911a2272e566a2fe4357ce5dc7df29915..5d7fe23aad0fa4f86757f184dac8549b556acd1d 100644 (file)
@@ -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 */
index 0f3eabc715a4d054a2e5687a5875378d00db2e21..073c4bf96b442f0da44a0eaca5da1480ea793aa0 100644 (file)
@@ -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)
index 56f3a72fa0f6d1d42b3e21ef2875e4cba6e02cb8..fb1cea78be8a2e5eeeb4cc6585f60d09b5b8b7c4 100644 (file)
@@ -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 */
index ed13bd2f039437dd39124c12785df5682ae147dc..fc752c3846a97acb6e100c30edda348cec6d7887 100644 (file)
@@ -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 */
index c671b1e148686d29c4b559d19a720c89b98f6a05..51774a181083184ae1b9112b8d923a2719114aa0 100644 (file)
@@ -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 */
index 010806a12971281d0194815c5dce79751694ef99..60ba12bc1f020981c00714d64e0181d512ad7c34 100644 (file)
@@ -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)
index f25119c97d3869b8f3f4619be4b45c67ed5db01e..99b04440230e289cc234d7988904300f76df364b 100644 (file)
@@ -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
     
index 4998f8bc0ec2ca5ddc027f222289502a0aed9bf0..96559d5d141fda23a1854dea742e373fceeb032c 100644 (file)
@@ -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 */
index 3293bb5027454f89aae00ec4c952c232b790d790..9167c1c2cc2b0c50e2614bbfd887e283708e9a66 100644 (file)
@@ -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 */
 #include <spandsp/fsk.h>
 #include <spandsp/modem_connect_tones.h>
 #include <spandsp/silence_gen.h>
+#include <spandsp/v8.h>
+#include <spandsp/v42.h>
+#include <spandsp/v42bis.h>
 #include <spandsp/v29rx.h>
 #include <spandsp/v29tx.h>
 #include <spandsp/v17rx.h>
 #include <spandsp/v17tx.h>
+/*#include <spandsp/v32bis.h>*/
 #include <spandsp/v22bis.h>
 #include <spandsp/v27ter_rx.h>
 #include <spandsp/v27ter_tx.h>
-#include <spandsp/v8.h>
+/*#include <spandsp/v34.h>*/
 #include <spandsp/v18.h>
-#include <spandsp/v42.h>
-#include <spandsp/v42bis.h>
 #include <spandsp/t4_rx.h>
 #include <spandsp/t4_tx.h>
+#include <spandsp/image_translate.h>
+#include <spandsp/t4_t6_decode.h>
+#include <spandsp/t4_t6_encode.h>
+/*#include <spandsp/t81_t82_arith_coding.h>*/
+/*#include <spandsp/t85.h>*/
 #include <spandsp/t30.h>
 #include <spandsp/t30_api.h>
 #include <spandsp/t30_fcf.h>
 #include <spandsp/gsm0610.h>
 #include <spandsp/plc.h>
 #include <spandsp/playout.h>
+#include <spandsp/timezone.h>
 
 #endif
 
index d8c8294355fda68b938662a2bfc816af8deabead..72275de9af63b77459939a3f845485c119d8a0c2 100644 (file)
@@ -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 */
index e732601eed1761e7f6dca17f73a245d3000a9f26..628a55998726d3bc68f496b287283a5cbfd5fdf2 100644 (file)
@@ -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 */
index 50eb6e445565550d6b5dd1fb164829eb06e805ad..9c6c66cf8aa1d08f6361839c2869260c953cfc67 100644 (file)
@@ -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 */
index 90cf06169977d2e5cb83cbec8500b8e85e4476a2..6f844599f0b8fd005f92ec12e1508e61f6c0fc06 100644 (file)
@@ -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 */
index ef4ff09d145e4268cbc3780e5993369d03b357ae..7f8b780273c4dbf59e9729e53b7c9846d180b374 100644 (file)
@@ -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 */
index 398a9c583b9a6516ecaf121fcdbde1bbcf4eb8e6..6421a36a417559017d458220ad9a3bf17fc5b5d7 100644 (file)
@@ -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 */
index 3871255bad1dd3c779cd720e207c58f605216b46..93d8d08c13e579aa6588fb3c4639749ba3a5ca20 100644 (file)
@@ -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_)
index 1373dfef79e40564d25a46c1b19e926a61998c14..f17ca95fab6ef68d6449aa11618dbcae27f63d5f 100644 (file)
@@ -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
index 56850ffd35413da0c788bdf6c75e416ab633a22f..df308d9ec2571c5e32d55022f92c8f4cd5579b45 100644 (file)
@@ -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 */
index a934a77edbf3ee726652571b19c504e7664ba703..b55e4afd16b4fc6fcf8d8c1f0011262c1cda6e5f 100644 (file)
@@ -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);
index 4575f68b6f219b523091aa1739d6436e29798333..3bc8c5407d6bcad160479fae268bc37006880bb9 100644 (file)
@@ -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 */
index efc99ab85cc03bcb829ddebc7a7addcddee554c1..51d3c61c00a9df5f45485cf4b314d7efef05f9c9 100644 (file)
@@ -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_)
index abfb8bd0ef4558650fbc4b98407aa06a563056e6..4dc3569f7af002dd1a09304944a5af4401442e3d 100644 (file)
@@ -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_)
index 114d00e438f612efaa87778e4b0345507a2d5be7..320457d57f0f185236a136893c104f25bd8092d9 100644 (file)
@@ -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_)
index d2dab65398c28836632566a6755390b6f1a05643..a4d9b8040a336b77c2c0f2ff4cc742607b70f8c9 100644 (file)
@@ -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.
index 4061f41137d33fc2431f1b422b2edce35652764e..94ff6c7e70c5f46ec0397414b45f1d64c7007f45 100644 (file)
@@ -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 */
index a2228a47a5cb395bf849933eef6a603db4893c3e..10bf99fdf759e2872c58c64e494dc64d64ad2eb5 100644 (file)
@@ -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 */
index d3f81eaa19e72157c47d5b42ded3384c6a2e1473..60b2f651839ef55f8209432f93e51d1676e513a7 100644 (file)
@@ -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_)
index b4769091815551b3f5bada973866dbe4dc2525c2..ec8c53b023e2a6898657649088a54576e7024eae 100644 (file)
@@ -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 */
index da14722aae41b4888f2449ec4409a270599c73b5..6cef9bf7c9b6130ad111079cabdcef7fe6e7d82f 100644 (file)
@@ -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 */
 #include <spandsp/private/modem_echo.h>
 #include <spandsp/private/async.h>
 #include <spandsp/private/fsk.h>
-#include <spandsp/private/v29rx.h>
-#include <spandsp/private/v29tx.h>
+#include <spandsp/private/modem_connect_tones.h>
+#include <spandsp/private/v8.h>
 #include <spandsp/private/v17rx.h>
 #include <spandsp/private/v17tx.h>
 #include <spandsp/private/v22bis.h>
 #include <spandsp/private/v27ter_rx.h>
 #include <spandsp/private/v27ter_tx.h>
-#include <spandsp/private/modem_connect_tones.h>
+#include <spandsp/private/v29rx.h>
+#include <spandsp/private/v29tx.h>
+/*#include <spandsp/private/v32bis.h>*/
+/*#include <spandsp/private/v34.h>*/
 #include <spandsp/private/at_interpreter.h>
 #include <spandsp/private/fax_modems.h>
+#include <spandsp/private/image_translate.h>
+#include <spandsp/private/t4_t6_decode.h>
+#include <spandsp/private/t4_t6_encode.h>
+/*#include <spandsp/private/t81_t82_arith_coding.h>*/
+/*#include <spandsp/private/t85.h>*/
 #include <spandsp/private/t4_rx.h>
 #include <spandsp/private/t4_tx.h>
 #include <spandsp/private/t30.h>
@@ -80,7 +86,7 @@
 #include <spandsp/private/t38_gateway.h>
 #include <spandsp/private/t38_terminal.h>
 #include <spandsp/private/t31.h>
-#include <spandsp/private/v8.h>
+#include <spandsp/private/timezone.h>
 #include <spandsp/private/v18.h>
 #include <spandsp/private/v42.h>
 #include <spandsp/private/v42bis.h>
index ccf275aaf3e13b600b26027d65891a4eb30e4e59..10679eab4da2ad5e63625bafb1bf061eeeeeca26 100644 (file)
@@ -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.
      */
index fe0598b1a78166ef179093ef6103ae2e2e7ca310..9d268770bc272125923a7b0bef36d691bee9c90a 100644 (file)
@@ -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.
index ad48b8f240892d1a38596af2f844dfcb79040aeb..a3b5ef6f681890820e288d38f276320859ef3115 100644 (file)
@@ -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,
index c3944c1761870157e2b6b5bba0eb498d56ee889b..52aab24db0b0945fda866be7a4cf12591cd08357 100644 (file)
@@ -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
index 854d9e6a22218817e7130f9b1b37809f59573d95..df6829514e9263fb4a76d163bd22ea919b82ac72 100644 (file)
@@ -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);
 
index 887dffdc65490a6978acf94d01ee1ffcaa08029b..ff57491f0beb1c4060933e5813bba5e44aa0f920 100644 (file)
@@ -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 */
index 274c61d62e48a2af8a48cfa35245e6c103868ef4..a2e094843ed5f524ef7feeeb1bc5d5443275514f 100644 (file)
@@ -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)
index 66e5d79b78103a579bfd4d84899e883f5afc4b96..1716e0a0dbda0e3747ed4192a60ea8c04be1b673 100644 (file)
@@ -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 $
  */
 
 
index f585b0e8649b9e98921fcd65aac48a85e1ea9134..f7c6fd60bf3b3a9658fb973c700b5c6fa4142fe7 100644 (file)
@@ -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 */
index b31b7db3e4cda064caf421a47514a2e43b2262d9..e65c7efe265cdfb4cfe764f5d39b4b07b541c7d5 100644 (file)
@@ -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_)
index 9ff9fb1073f6c4189c067ddde1ac8c9da2f89495..a6259a4544ccdefda1b1d8f6c174f4396f43ab15 100644 (file)
@@ -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 */
index 7ef71549056291ab4c9bd07fc3b44fb2365a0907..27be7ec7364120a4724a2bfeb4e1de68046344cf 100644 (file)
@@ -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 */
index 9a93f823946f6eeaf68023df55622a150e6170e5..0133b80926b762494d5a9134f65a8f6ae5af0a76 100644 (file)
@@ -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 */
index d43955065ddceb224156079e1c823cd5f40f8e54..b3202cc1cb6e25a33e6477bc46134a7ff100ca0d 100644 (file)
@@ -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_)
index c104e2352f1d1fcfd72d8c3b55a5fd3789cc4b6d..db3831bf28ee6f8360c4928cd1796d8db95fd3d4 100644 (file)
@@ -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 */
index 77ffe6b535057d9b8e0616a7360ad214087b7432..acfe7506a2e3b4f132db454313b2cfdcb3e975ce 100644 (file)
@@ -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.
index eca1136864e804e8117b7000d623a87bb9abfd69..9014e482ef0e8d3d51516faab61a9c9e802d252c 100644 (file)
@@ -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 */
index c9bfef7ef375350904a8f6324a4c0c6ced7383a7..c3707f07f8887c3701fb527a09a0e571cc3b113a 100644 (file)
@@ -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 */
index abe3584a06353b5045ba0e16ffa9f331b0f89092..41d4a0cb46d7b6938253307f1f4a7c1a2f02fbde 100644 (file)
@@ -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_)
index f4cbade794e7ebf769984f72db8e46864af5cce1..801c6ac65f793e154612ec964bd0483d61edecb8 100644 (file)
@@ -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 */
index 6e03b60beab819e9c8bf9950ca8e8c38d1deee02..5eff21fccddff5f3d02168a53eb184e618706f11 100644 (file)
@@ -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_)
index 251cb0ec8223886a90a1f23511e044f76f32f720..676e05ab4023f9850c582aaf5ae4dc836c5d305a 100644 (file)
@@ -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 */
index dd75f5d56033f45c8f3b972fd7a17cb5c862f098..c3837641dfc2bc3f6df7ee5d99b53c9b0cef924a 100644 (file)
@@ -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_)
index efe4f7901ebe6bc4f3cd5f0eae703e0fa4ed3407..da13b5a2bb2be5ef5886d9a56fbeb8235c1d031b 100644 (file)
@@ -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 */
index 9ee57951c53403d0bfb0384dd93ba6e212a64fbf..908a465f9f949f6a7088cf12f95597a8131de41c 100644 (file)
@@ -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_)
index 91be0fe9476ff3a04ce3ee5500574479aeea19a9..234e4c9ba0e0af75050324bc7ec462e9137d370a 100644 (file)
@@ -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_)
index a1b0c3a1782c0bb492f25bed728d8c4fb35c7dd2..f58bc70943fd058d1b0777f438d7933c9758985a 100644 (file)
@@ -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_)
index fe80c0bdbdcb0b9e23e7a5945fb511839ca39fb7..aec8d5e12489d6d5466bfc7ef1bb931aec8cab27 100644 (file)
@@ -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_)
index 017cc26800a87f4a3b4ab0232e657ca81b2c611c..eeacff16d39fc9a0e09fa2c2f212b459070462f2 100644 (file)
@@ -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_)
index 4a9179831578e304dccb0589437194204062419e..98153ef0f8a48bf941db04ef307cc2e71abcb295 100644 (file)
@@ -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 */
index 8db77dc2ffcb33d0327a32e01a2906d880355e73..c75f4fa01e4a57937fc4f40be1a1f492a0c7c441 100644 (file)
@@ -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;
index a46749c0cfd868e8878f5ecfe80fb539707f0552..67422bbe409f338b7aed256161ce75f13beb3ebf 100644 (file)
@@ -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 */
index 0fbbf030493cc4f450d09829578cba6c9ec8333b..b08a9294fdc7bd04cd458e102a19a34a10e82ccf 100644 (file)
@@ -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_)
index 4e9021e008280a5c583eda0122737026b388bcaa..5ebc17100da90d2315e93bef41ad9ca4d350df35 100644 (file)
@@ -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_)
index 7d3b5d16f1e453f91e3611826c46536fd6971698..5cb2e0b77fd300be377d13cbb91b56475089a1e7 100644 (file)
@@ -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 $
  */
 
 
index 18d8f29f8a124189d8b348023270237ff9c056e4..9d69d00ec28935c111c976a3ff5d3fc4be15868a 100644 (file)
@@ -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_)
index 2414fd81f26fd36b39ec888eb0066ee2c0d5998b..103a6ebd2ca42c2f4de3b48926c6499b56f25e35 100644 (file)
@@ -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_)
index f3ffb6c2904c9ac2e455572111b5a503cb0db14b..e58ef8720c39dd067a6ff11b9f15de31955951cf 100644 (file)
@@ -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_)
index 5ca9f5bd8c4ba29bc619d03f39e287df0dd8b74a..1685906c287567597888939ae2576f9d60e93c1d 100644 (file)
@@ -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_)
index ad3ec915ebe3ee784e412505124a96e16392e818..0e59d267b341b51d7525b5fbfb43d7c42e7097d8 100644 (file)
@@ -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_)
index d983d95002ab9ee79ee2f1deffcf8b280c15bb61..ae9b9528bb9b1ff8f598154ee7aea22c91cb2442 100644 (file)
@@ -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_)
index 331402c1e4ea076b2e82eb44ca1c435233fc957f..feb602bdef143774d4b5be599ffa50d4c23b525f 100644 (file)
@@ -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 */
index 082cb8d569ba18c3640496c8f3ad3a003f01173a..24bc7577b0bcfe2c9469162f0619d559e237019f 100644 (file)
@@ -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 */
index 4f6ecc99e582a6fa0ec86a4a02485f828af404fa..73b908497fdbb8bca151084c6cf586d49699fd42 100644 (file)
@@ -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 */
index 4894775a4d7ab540ae1b54c8ce7b478a1a4c61ab..f039213c433279fab7ab4971413f8c2a5938a9fc 100644 (file)
@@ -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 */
index 006ac681093b1d2927cad8318abda904682cafd1..b621ee9fc5dc58905aae4902a469514bafeec205 100644 (file)
@@ -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_)
index 8e059dad869a41e5a578b531864852fd4af681f3..1e37b99005dfc7975a899eb89e3044c80421c97a 100644 (file)
@@ -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_)
index 514be52334b5d8ad8e65d012664419bc6e7edd22..1bbeef0466093a09438d7908f1edcb7cfa9b0855 100644 (file)
@@ -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_)
index bae49defaf0425de8f0a76f387f93dea3ec32fb2..6068c41171394d7983ae0be8f7c9cf0cd1ea0363 100644 (file)
@@ -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_)
index 09fbc694e891ff5a9c5d54cf92f225c098b2935d..1f0fd985645b5da88efdac2337a014cb4c8fc172 100644 (file)
@@ -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_)
index 00785448351557899abe248d169c997454115756..b6efced96548ec8afef852ba67d276bf7c211c59 100644 (file)
@@ -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_)
index ce8e5a634e126c7064d41747c177598aae0ebb60..52a9a03f907338f5d7cd889e8002e233f9f16392 100644 (file)
  * 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_)
index 64ae2c5fd525e927df7e4fb05b6f69517b1fae85..6e4ee0a70449821f113b5228a1c3b8f2821ffb47 100644 (file)
@@ -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 */
 */
 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;
index 7db4df98e9bd83d1537f0de6549608192877feb0..1c8735c99652716ac039381051786b65ed9bb349 100644 (file)
@@ -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 */
index c061e0121aa60f0afc7385a3e236078da1e400d0..a2d8f97199bc6ada941462469f144131594d2f32 100644 (file)
@@ -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;
index 2de5e8aa089358b164ff7346ab9ed9a5ee76e281..8f71321ddabee2d2ddc7bbe4958db6873df56f10 100644 (file)
@@ -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_)
index 247233f58e48d9f1dacb88d395456c0c0c93efee..78604420a9448141cddcf0038ea6329e898bdc41 100644 (file)
@@ -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_)
index af5cbff80d29d0e994f0eb8e86cf70326d7a968b..6681f9321c7c629976aaf9978eda29705c5e94ba 100644 (file)
@@ -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;
index 6511ace1f8f8bf8c4ff55e26f518b56151c15f4b..ba0d4ca74f3517140ef1e2cfb5a07d311d0473fa 100644 (file)
@@ -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 ------------------------------------------------------------*/
index a65d0b4155ce624c3dbfbab4ccc3617c6c629d8c..236523a590f61b8aedc4a1f7fa5d944bb5fbb223 100644 (file)
  * 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;
 
index 85d3975ad661397f159caac358c7d35b012d1480..775046161d1b87ec8f87acf8d0a4e0dcb915260c 100644 (file)
@@ -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_)
index 3d67e52397d5538988db0b0a52a78f6749fa89bc..2b4a1d276bfa29ab1b2c3393fb784d28d108e218 100644 (file)
@@ -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_)
index a1443be87ea07132ea2b8158754881bafa7e5a8c..12dfaeb5d406b9aff6893d6da048e049808df883 100644 (file)
@@ -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_)
index bc8ad1b63c49d96bf4cf04032bdf6b2f97f0713d..03b320c11be352149325e585bfac6f41317222b1 100644 (file)
 /* 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
index c93ba08c35b07a057b8711fad15e1f731f49626d..4d4582f69d51ec64d3a1951e5f12fe5adb0f8823 100644 (file)
@@ -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 */
index 79471fd68fbecafed353c6ab639e37a1daec4b90..6f7d987bea793cd4b9d90bd36d2ad4ab19e5ffd8 100644 (file)
@@ -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_)
index a2e07d5392bc771574afc923ef853795c438f020..92317f6d72f0da0256e201cbf0990583fb3c1170 100644 (file)
@@ -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;
index 63566de62265dc53b6f608c4c463205007ed1d77..bc26c2d106c4464259b29ff14861016d415b971e 100644 (file)
@@ -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_)
 
 /* 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. */
index 28e455cd8566b2bf7d9224fe329657d357ab5704..12d77510d4aa83241a93ce5bdb13f793e44eb38c 100644 (file)
@@ -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_)
index 6dbb3a727d40364760299d8d1dbb3c0b93e2a8b1..3f6433bad993ec402abcf179a210bbd5704ec93c 100644 (file)
@@ -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_)
 
 /* 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];
index 129f68c09a11ea92569426c852cb4c77416a7241..bb95dba527e834de6617e5180a019eea003c63e0 100644 (file)
@@ -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_)
index 1a1347c746332dc303b55400b6eb0593c0800532..0689c1d01a5bae05a56cb82fbfc468d09d87c6ea 100644 (file)
@@ -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_)
index 96538f2e083b18138e2f82dfcc37119049634a7d..287c26bd2c429502184e14f0109dbe34a2c93dd7 100644 (file)
@@ -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_)
index 45d56aab9ff451c254399c2908da42f8bcea2014..2fb481d0b273282e278f923d9594e3465417bce8 100644 (file)
@@ -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_)
 
 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;
index d5e58d44963f2a3623b45d031bd9ec1f7846b890..cbb4357916d941ffa21cd68f1799edc8057e7cba 100644 (file)
@@ -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 */
index 2038b25216c43401ec61ebe9894b97aaf008bc81..958167b4ecf7bf09e417bb46675d3f5a652ca71c 100644 (file)
@@ -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;
+#elif defined(__GNUC__)  &&  defined(__arm5__)
+    int32_t result;
+
+    __asm__ __volatile__(
+        " qadd %0,%1,%2;\n"
+        : "=r" (result)
+        : "0" (a), "ir" (b)
+    );
+    return result;
 #else
-    uint32_t A;
+    int32_t sum;
 
-    if (a < 0)
+    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;
 }
index 20c99f1577eb1aecc80a8beafd40308bbceb17ad..95509e016aee08cd9fce79809261dd1e9dd689d4 100644 (file)
@@ -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 */
index 649f1e10a6e46d33e1f8d498376b7fc49adf32c7..8213e1ca732a367291e3b973a5243e9fb7865338 100644 (file)
@@ -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 */
index 467408d75ba1456f20b40abe03e61b4efd80ffe3..c2300c845c54c048837cbb722c09acf8f7077faa 100644 (file)
@@ -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_)
index 790c694e691d5387387e9608cc97024de3f936ff..702069856c9bc48b1e2ce3d8a1b7e4e64f459b96 100644 (file)
@@ -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_)
index b2de99fbb73be9f7819bb3aada377a328676f005..9f7ed6d6a1c467d6c0ec1034e828b631e2ea520f 100644 (file)
@@ -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_)
index 414f951fb33d825d595b40fad4a1a9ed7045fadf..917b507fffbe32a244aae132b850824f94d07a8f 100644 (file)
  * 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 */
index 3c1b4410305ddf8442c23bcd942b26e548a6dffc..9b01d3b62b87e010bce18d598cea035ed43086b1 100644 (file)
@@ -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)
index 9151e9b55d34989f0a140feb35eae0509aa052ed..d758c8e871072fdadd19bcc9365c28a0e84eda97 100644 (file)
@@ -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.
index a303fb4f93c78ed229834cf040dac6c19e96f6de..7414497247ad49fa2b2eaae6599933cb33201409 100644 (file)
@@ -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 */
index cd68fdca973e4834151d8f29b53a012f0597eb4e..2dc9bb321c64ccb0ef602eb326b2ddd66d07c153 100644 (file)
@@ -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 */
index ffb47a98dffb4fb11a4a5187eb38d1ec6375a2cb..25f826d42c186d75e86d0c5f3ac872faee695de4 100644 (file)
@@ -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);
 
index bdfbe0bc6af8ca2636e5da60ceb67557cd9f7b0e..553b6212e0173d6551cf71c80285bf053dc8cdd4 100644 (file)
@@ -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 */
index f6b0b12ea0b376307c795a4d521a88ae0fac0470..1476969eeb62dfc7026f5f70cc4dc3b14acb080f 100644 (file)
@@ -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.
index b2a1c1f6e9d8581f3eab9b42f1969c5bd6c7ae39..fa6db4bec5b73bc66ca6627df335c31e2087f344 100644 (file)
@@ -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 */
index 8ffffde18b1d7ef905e894693ddb7e836f020b67..744643aa409a68d530ea853e0237dbf0c1ed8b53 100644 (file)
@@ -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 */
index 4bcb1e0d28f4a832f1dbcd904ac80d13af50b4d2..c751b477dad810aef2bd89597925cd42deeb4cd4 100644 (file)
@@ -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 */
 /* 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
index 1cc8873251ee33b0c37f8ca665e3b0790d25e1cc..b1b0a96e1897876c6b4104528f9eb1e0905715ae 100644 (file)
@@ -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.
index c30386c03df22c73f9ca637fad6e77840799865d..0d32297ef3ccb11c80253af9061b95fb437161df 100644 (file)
@@ -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
index 703c0bd966691ebade3a3379c3fe07b876c4f641..f6998e09f562eda72c539564bd4e7e43b890ad06 100644 (file)
@@ -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_)
index 7b7a60eda78befcdf38b909144d56715e108fc19..666cca7a78a9eb3658f65b1154d408c327057c99 100644 (file)
@@ -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_)
index 85f3ce5f43eabdb1f76e98c04b0f2509ff073ef8..01e7c9914675217bfb21d604dd8ed36c739faf21 100644 (file)
@@ -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_)
index 6822fff6765655b687cd65fb33c42ba1a2fe6e51..bf779ca41eaed91af3ce8a0604f088c6c7296847 100644 (file)
@@ -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_)
index 4cd7ff93a0a0ca09c0d0d2f4eb8a2a3c92a37f1b..545335af5112c65a85197b32408dd3ae8b6fb057 100644 (file)
@@ -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);
index da4514d316237327839e6d833ce3ea724e9aff3f..164fa25232181d6521e99ffa2c35ec65dc1eaf44 100644 (file)
@@ -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 */
index 01b0f82056dc83570a948f590d5163705599777a..e288817e7ac022b5bf1847651516f83e4e32db52 100644 (file)
@@ -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 */
index 7e964cdba66e869a42de58dd234ca9711a226a4c..53da9d099f69d3136618a969e43653dcfc811c03 100644 (file)
@@ -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 */
index aa2a50a05d555b1d2841f0ba862ab274285be2e4..5bdc1791a36cbaedda2540c08965dd76712a8a34 100644 (file)
@@ -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.
index bf365df9a17efc24d05edc7e6ac420e862d1c325..baa04b54fe2085c351c7ae263e6f83e346ad4bbf 100644 (file)
@@ -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.
index 0d332e3470a565dfc7e0a2cfdb720e72237c08a2..ce5f440272272db1241b6021254ac5fb36f78a84 100644 (file)
@@ -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 */
index 7ee67b763c83e202a3743ebc98b0071a9e490566..dc8c7b436723d42146e0cfc8be2e2bd7edf8eb14 100644 (file)
@@ -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.
index 522eee7e40168326c2170fe61f67b8b5d7644ae4..8a765445c28db7c344a90cf892bb2d87656cfaf2 100644 (file)
@@ -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 */
index bba70af5be738ca0875c39bf225046528b69724d..22d6122b606e116e2eea345af408982ffea3620b 100644 (file)
@@ -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
index f13e5c5acb965500138edd5668a8a67bf4415d20..35d5be3f429eaebf428d27f539e24e642fba5903 100644 (file)
@@ -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
 {
index a8bd2e4d40313be3d44cfbee91359e32f0c4cae6..25449fb6c100b112df4394bc3a8c90797eff1343 100644 (file)
@@ -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;
index d9aa6616a0f8ba80132d8dfca9d02d5677f3d831..97d95f30076ac1ab7f14fa65ae15fd9715dc9371 100644 (file)
@@ -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_)
index 04a632fe17cb52e6d75822d88d0a5455b81c60e0..c20f02a7d990e1835616facbc82a1f962953e96a 100644 (file)
@@ -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_)
index 611d32104277e261342958eaa2383d39972451b2..a07f2f061deaeee8d781dff6c2bab0bad5fa49ab 100644 (file)
@@ -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 ------------------------------------------------------------*/
index 8a547f1e13df1b69b842f317dfdd067b597ac61a..c5d137a01cf6c3efac4fd834b7d51db4fe8bbf49 100644 (file)
@@ -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_)
index 8822577de6768075b5d47e6cb4ce538b812419e6..767a1893ff9f2af9962993c6de99c381bbe5779d 100644 (file)
@@ -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 */
index 1d1beee28092ea69560dff8417d9432743c56412..7725858f5de4fb48f8952325affd222a6beacf0b 100644 (file)
@@ -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 */
index 78555ab8fa740ec03146a99161a25c3ed30b8a06..f2b5eb7e24584f902d3835f73aef095f023f31b4 100644 (file)
  * 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 */
index b89c2e6485ba1df38560c766ce10e9b6b95a7217..97c7ed8cc78b8e5c9a42af767ecd76d52bf420ca 100644 (file)
@@ -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 */
 #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"
@@ -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))
-    {
-        s->line_encoding = T4_COMPRESSION_ITU_T85;
+    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->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, "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,
+             "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 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 --------------------------------------------------------*/
index 258e3f212d9769a846871eae81a50880e617b6a9..a98dfeecc6ef3c31a1f5651288a8dd016a1effdd 100644 (file)
@@ -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 */
 #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"
@@ -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;
 }
index 177d6dc3ebd2a7b0f66f45630e9d38bf6a4f7ddb..3152ad94eab9c05b4dc42e31989de807f4df10f8 100644 (file)
@@ -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 */
index abc6fa31c57b5ac35d3951cdacbdb9079804c4f5..97a8c02378d703573550e370215abfcbc7ab2106 100644 (file)
@@ -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 */
 #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"
index 6f00df9499b51e40261cbdf6b8d51ff22b6593ee..5c9c4066b249e9cdc417a1edd7a1b82396daf76a 100644 (file)
@@ -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"
 #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"
 #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);
index 392bc6a440c7d09f5b5bc9bf2eb97a18173619dd..9d525b5e36c6ab3cef35af230a0b6aecd9ee8549 100644 (file)
@@ -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 $
  */
 
 /*
index 443608b26d191d9e38a53c73379e1252bb304735..551d6c015537ed6c0247ff75de1834ae9b1c778f 100644 (file)
@@ -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 --------------------------------------------------------*/
index e4fac8067c431835a4a45998c6eb43e56f594703..a572b5dad9de013e294d126b8ae61b39c4011dd0 100644 (file)
 #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"
 #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;
index 182098100281a79105302d9c529787bb2c180432..ddf5b49f7a647df47c5d76090f1ea73f09e65260 100644 (file)
@@ -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 */
index c11a95e94350c67997fcf4059f63d15a160bd484..c9961f665b3051724b80b57f0bfd31a529153116 100644 (file)
@@ -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 */
 #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"
 #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,
index b5321a55407773e8413b8efae1768dae324568a3..dfdf9148043d8848e807af68fcb346120c3c6d97 100644 (file)
@@ -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 <steveu@coppice.org>
  *
@@ -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 $
  */
 
 /*
 #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"
 
 /*! 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 "???";
 }
index 71619e5d6a352e98609204add0685fedc6e3cafc..daf0e1a711c74d61609cc3a4e2ea0c89fbf5ba37 100644 (file)
@@ -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
index 4efb3ad449608e017754b70acc22466fb1dd24ea..55f15477f4ce6c21e6037d73013ab9b28c41d195 100644 (file)
@@ -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 <steveu@coppice.org>
  *
@@ -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 $
  */
 
 /*
 #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 ------------------------------------------------------------*/
index c55c349ab9fef579bafe5b5b4d03ae910b8b1c72..98c46a0581d57a31ccb6f140a85cae1112494498 100644 (file)
@@ -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 */
index cd3f7d028a8cf56b6041bcea1b88f48558f0d511..3a85cae71c24314cbcf7c0c6399b75364a86456c 100644 (file)
@@ -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 */
index 7ac1a12dbac27649b2c3838a2af72323e125b233..2887af51d6cd12948b4dddcaa73c63f7fc64ff4e 100644 (file)
@@ -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 */
index 4b65610289c3b4854546dabed3938d1914ece3d0..437865b3d3b48d6831c3c9588c02db3ed7d55b42 100644 (file)
@@ -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 */
index a84950dcc79b6cc17521be82e9c807727dda5c82..ad9b1fa4996a5c6c972fe7a4266da27892af2d7f 100644 (file)
@@ -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
index d2a231c2334e380baab723250cd6de5a8c72945c..4abe80d93d8cca090a691ff163216b700f5928aa 100644 (file)
@@ -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)
index 78311a8a43ced98378d30313612fff40b99fc89c..974448b46a1e9a934ae55a8ea51c5ce927dd1bec 100644 (file)
@@ -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)
index 83c6bcce9cb9ebf180cee9db3b3fb00694c179fa..8cce8940e9904aad97d116e6b0922cd0307c646f 100644 (file)
@@ -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
index 067bd9e2515b04a69572e324383a14f5bcf3cf28..d84b56edc4c69b791de8dffe3cd2d3ea6f3aee74 100644 (file)
@@ -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",      /* & >> + */
-    "",         /* \92 */
+    "",         /* 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 */
-    "",         /* \92 */
+    "",         /* 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. */
index fc5e3a9f23da083dcd3374129f46b5bb8bf107af..91b009ce85b4df82a83ae2d494bf8d3c3064f578 100644 (file)
@@ -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;
index 58a0bd589bf83c54a99d31f9eadb17674e5df7e5..5619e87120c0afd8c4339c4d20d31611919c4629 100644 (file)
@@ -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;
 }
index 96e94c7ac00157dbea5de7e863e70ef228dc81d6..8685ef1d7797dfabb950b59cd97b1705ada70e0f 100644 (file)
@@ -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;
 
index 1145b75ba60f65cd3769c06d3f7b0cfc5f3dcbc0..5f35510231aa6b1b628ae8ba6d651bed94558e48 100644 (file)
@@ -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
index ff4dc955708c039dd5e6101c8b927f409ceead44..17ddada9e8dfd755f5957fb33043b9435d93c1e1 100644 (file)
@@ -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;
index f2f832caac867e17c3df4e732c0b729428f7c37b..39c6c99b9ac70c3f269f3b2eec6eb06e7a88ccf5 100644 (file)
@@ -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
index 1984c0b28f6a07efaf45c6fd1006cfbdfef2b05b..01da53e71ff01ba0340dd24cab6de42b60fb4c4a 100644 (file)
@@ -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)
index 1c6ed0803dc9cfce564cf99c49c9d1b108407443..74630ee84d2aedb67fce22f6fdd37fa4fbdba1a0 100644 (file)
@@ -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. */
index d8d3f3fde1bd52c6c61bb2cff59dd21cb04ef687..f4aee8ce93c12cf23d35900c42747c34383102a3 100644 (file)
@@ -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;
 
index f95c0783abc18130006f55586e0c7c1733db250a..9893bacfd321e70c0445ccb3a643336fcb574404 100644 (file)
@@ -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 --------------------------------------------------------*/
index ba14bcfdbcd9588ed98798d69be2b71db20eef66..7b5a7efa691d95645a33e03f5963b8bcf07203c6 100644 (file)
@@ -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 */
index db62cecf2b1f350b059c2ab909e9ee03cd9ae6a3..807b72b2b33141ed73e5ec7361b8275bcd56cee0 100644 (file)
@@ -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 */
index f5797f451c444eda31a27da78a03592a94dd3c58..dab5d61751f58a724c0428fdda440c60925b8ea7 100644 (file)
@@ -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
 
index f4d26bb78008b5f18a19bcff2cc915098709c05c..f220bb29c3eff16d355a13eeb001adfe4bf52385 100644 (file)
@@ -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
 
index 6d2152d8ffcda15bed1e5c3ba3c83081a6df542e..9b31fea13797a1352301651b84c55258c14209ff 100644 (file)
@@ -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)
 
index 95c9db3e30f2f51f471ba218533312a4e1fab99a..d7cefc6778584fdfd42fda091ab0d9eb1f9cac11 100644 (file)
@@ -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;
index eaa3f1afb16f245bda2299a2eaa0e6c6082c4f02..9e262c2d8e0fade53ee97806df73e03dc5c309d0 100644 (file)
@@ -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
 
index 25b1ed24a9c442f118a212c72d787531519153e7..595b5f7e93200fa66be8f04d7fcccaa4c5b5a413 100644 (file)
@@ -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)
index a21bdd0ed4cf6575f52e1c8dfde2e5da65cb272f..31c8cb0cc8aa1bb73a6880ccda99f6f15f30465d 100644 (file)
@@ -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 */
index fe57a2589a640979a1874369d2f4d1465e39619d..bd7e8cdc910acfae5b4fb63f5f4bc429af479a20 100644 (file)
@@ -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 */
index 0df6a186eb4e937d699a49c253f403c020203240..5c8ad55a53af89ebd97a4e59849309e937858253 100644 (file)
@@ -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
 
index 253d398d315b2e866adacbc6767b8aacc80aa775..52769e78d8237c8ff90212ea4815408cbe5bba9d 100644 (file)
@@ -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
 
index bf348be4e2dfdebdc43028462cc068cfeab7e30a..66c2f10707188cb1859113ac5f09f8e5d039c537 100644 (file)
@@ -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
index 4dcacca3b2c0667fce8edcf0b0b77cab6208852a..98f3211e5898a25164dd5797c5b8beeec459df70 100644 (file)
@@ -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 */
index 2b638637511ea1b7260a465c4133ec550535043b..84cb4b4f92be9387aedf9e430cf71f1a9639312c 100644 (file)
@@ -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 */
index 389ef14d4bbb8ac1cd89d4c65d47a24f24a38e4d..bb451c447fab32ba09d7ac2649a129a28e18073d 100644 (file)
@@ -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;
index c1aa73633bb32538244b845d273b43cd3a9c9654..4b0112043d0d5ac99b9d88ccbe6bacf4f4111a64 100644 (file)
@@ -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 */
index e9ef383e0b4704158def86b0907ba85dbd06edac..dd0551f891bb5565798a937e0fecfa7512762b1b 100644 (file)
@@ -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 */
index 30db9c5307a5b565821c9d2ada6b788106267321..9db22b565f4e7d607ed09e44736efc4f185a17fe 100644 (file)
@@ -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 */
index 337b057582fae072d7970b6cdaff21971f2f91ec..53cd997023fae25caedaf8729120f807b9dc657b 100644 (file)
@@ -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
index 77faef145d29d8ff93d15cabbca31fe04fe9e734..54649f5b4bdf0d8017b6522151fd5162054ba0c2 100644 (file)
@@ -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
index 05449caca337c19ebcb583fe2cd891f864ae346d..e32ac07591058695117c4421899fabec32bff607 100644 (file)
@@ -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)
index 5da6a36ceef88f3bc31b21398dcd7b9913c0103e..57fa7a6a585947735e860e30dea83f5e308f8929 100644 (file)
@@ -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)
index a776f59c4ed668cf3c402a9f250364413ea4183a..2227d28805199b328b401cef16ff1735d14a3075 100644 (file)
@@ -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++)
     {
index bc28bb6216c22bc52d45cd22f94a5871476985bd..fd91ef9f24095255bf1ec65ca37a66a4e39c49c7 100644 (file)
@@ -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
index 9e8410f3ea6d40b6277280f6d43b209888f42111..e3a43d51585bfa08a948c1d2364d87bbd583e4c1 100644 (file)
@@ -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 */
index 63c74d48a3b2484205d277fbb976651a9be8dda8..d5fb202ca36c08045c5bf66f6195462c5ca7ee06 100644 (file)
@@ -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);
index 0d990f00336342da2ecb82f535509777521b7421..c0923249723361cfab8934bbc4e71dd5e5ed7524 100644 (file)
@@ -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 */
index 4e7a8241da93b2aab496299b1d1fccf3cab6977d..8a7f6c3928409df1e325504b2852ff83118d2268 100644 (file)
@@ -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
index 0f45a4b4e3ca7a96bef682219afde518499119ce..72bc718fb4058ffcbc51e8d81f34b77176b6b15d 100644 (file)
@@ -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
index 0878bbc67d77e83526234c8f837fdd229916d2e9..1eac4d927d751453a233abf9f9586a001890d4e3 100644 (file)
@@ -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
index 4b94adf25185c0be42ee6ad47528022bbb55e76c..d058f329f207935c9854818402b1338fd1879fa5 100644 (file)
@@ -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);
     }
 
index 0a3ccea7aa6f05e3b90db24cc717619c330cb7fb..ec2237f8836f44f02fde77bddb34a77b681f7fb8 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * SpanDSP - a series of DSP components for telephony
  *
- * faxtester_tests.c
+ * fax_tester.c
  *
  * Written by Steve Underwood <steveu@coppice.org>
  *
  * 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 */
index 39bc2d88d503ad6273ddc2547626a14994012e3c..9735e0f2a5df8d1c777b496b40e8d719fd13af21 100644 (file)
  * 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 */
index 6652e121ca711142a7c5f592d2cc4fb8afb01400..084a2b034fa6e66cd9cadbfc376ce77eee72a8e8 100644 (file)
@@ -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);
index 02fb8c7e44b4d065afff5859d8409a9631c66629..a798ff8a6af46521f1fbe096571ae80fb753410e 100755 (executable)
@@ -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()
 {
index 9903109a6b998281216ddace1436042c8beba9fa..7e1a927bb8dbf6ceb76950719e19a0bd8a874e3a 100644 (file)
@@ -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
index 16ebf630a94d87b8362709b376224a743b694552..973c63a5721304d60ad6a2a4fc398ab80fcf2f2b 100644 (file)
@@ -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 */
index a54f0d3bcbf8a4f1ebf4abab5934920ea127d279..a2fa50ab5a844ea6e0e8007e006e9e8b403d3ed3 100644 (file)
@@ -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);
index 95a2333e2d5cb78622db5c95836f8ddf9fb1429c..74f8beebac6e1e02e282621f4d107472615875e5 100644 (file)
@@ -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)
index 0484aac7d6c526103fee20d8e0a3aa289dd31bd5..61a42ec453fb3958d05e2ef65660a3b9a4973fbb 100644 (file)
@@ -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)
index 134463b3d6fed89f23a90ada961f92a0d8a42ae8..1975bbba11875bbc1fca0e9561a96ac872f08e0c 100644 (file)
@@ -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
index 4b9f61865fa99ce634ac5d053d775dfc2fcde759..afb2025c382df518121bead7c7f513db8f86dfec 100644 (file)
@@ -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 */
index abd77435c3fd00d584c387ffe3a83945a3792da4..f48607bdc5eb2dbb309a4dc641ab2b54eec5dbdd 100644 (file)
@@ -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 */
index 6d522bf35765398bc7b6753bb773aa47b7c9f59a..2e0bb508537fd8d2f3eb5c9f6a7b857f6178fe46 100644 (file)
@@ -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 */
index a4dd3e4e3b8a84c1825f2433fd6b657060eb482a..bf7a63995dba58c2d3bfea0156af0a938e39ffc2 100644 (file)
@@ -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);
         }
     }
index 61fdb8142a2beccf1490e04463bf9f35b61f10aa..53a6314762628a8b7c97bdaa12aaf9210986d040 100644 (file)
@@ -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 */
index 77454727d475699e62e1acf6b9fc0ce23b5b4a7a..49af1bdc3a1d591374bdf4260ecf8ea9eae2ec41 100644 (file)
@@ -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
index 7af4e8e97f6cb81b3b62dd508a9644f2c903a41d..96c0074a7d0842195f3f2ced440ce999b69bf5ec 100644 (file)
@@ -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
index 309e2e7890758569457206cc4bf934e0377ee5c9..665781e828bc192a1ceee38155a0b876a67ae58e 100644 (file)
@@ -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);
index 18351ad0910ce081c4babb0fa0157217e04f9f24..2159b20f8effa34db577ffc4910c6351879e3821 100644 (file)
@@ -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
index 6af57d1b7f3214cc86296ce7dbb5addf7bea6c25..2e9a00f2207926a493924ccd02ba76629993eedf 100644 (file)
@@ -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 */
index e485201f628e4572738e30bfc524f24486885317..e31958ecd5f412967db60d6c9453cc3bf8b83a3f 100644 (file)
@@ -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
index f798862ef7033dbe188284b23be0802fb1c55f2b..cc7519bc825eb6e8f2ca078ff737999265abb192 100644 (file)
@@ -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
index 20928df16d0dc7893c7eebc60d6197d2b12fd17c..51449130546ff7572f85ca5e0aa18889f39518c0 100644 (file)
@@ -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
index e2e7b140378d95df7da85b3551c0ecf174fd7988..57b937922ca2b9795c16b19651487bea617a8c42 100644 (file)
@@ -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
index 42895eff843d375c175b4b3d50dea8a3946b7763..74d77074b0989e29cf17d0d2aaf64ba357046ed0 100644 (file)
@@ -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");
index 7086013d1587a65211477f191225518ad2d889dc..4df0b4e1fda82d0208efe488acf4fc9d8c9e8cc0 100644 (file)
@@ -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
index 636ef3f1c524547f0b11bca64f17104ee5c00ddd..b1b79fda06e36af340985bc6a4897f87d6a3221d 100644 (file)
@@ -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
index 34571a35e9507e021d5ae018ffbac820b2d6235a..dc0e7bcbf47e7b586be8a6e34e6326da84b591be 100644 (file)
@@ -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 (file)
index 0000000..e5e0014
--- /dev/null
@@ -0,0 +1,202 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * pcap_parse.c
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * 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 <inttypes.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <pcap.h>
+#include <netinet/in.h>
+#include <netinet/udp.h>
+#if defined(__HPUX)  ||  defined(__CYGWIN)  ||  defined(__FreeBSD__)
+#include <netinet/in_systm.h>
+#endif
+#include <netinet/ip.h>
+#ifndef __CYGWIN
+#include <netinet/ip6.h>
+#endif
+#include <string.h>
+
+#include <pcap.h>
+#include <netinet/in.h>
+#include <netinet/udp.h>
+#include <time.h>
+
+#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 (file)
index 0000000..eabaf69
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * pcap_parse.h
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * 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 ------------------------------------------------------------*/
index 736b3bd6248a71b592e9ad1e6cd235dd17ba3165..8f72469a896d08507525b18c6f8efe239e44b5ed 100644 (file)
@@ -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
index 6d9c21196d7c4f07de26ca8e1a2060d3eb01cdaa..a0703ac99e4df3330871bc4ff676f7d99c843370 100644 (file)
@@ -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
index fc4888150b7c7d7698fe57a3b5d3941d749b5a00..37ef1b41e1a627cf70c2916220c63ccbf1dd18de 100644 (file)
@@ -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
index 86ff0f4cd5aa389ebce5898b3ba2aa1d238e9cd7..4bc6a30bc7ee8f1b631e5bbe4e955f653d86815a 100644 (file)
@@ -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();
index f36aec25d8e69a7c111998c61d6229e419cb3a5b..6f71965291e9cf6793c0540c671ce6a329d765ff 100644 (file)
@@ -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 */
index 3988c43b66f582bacda12ac08c021736a9556336..8dcee259d15174cd01bcbdd392b20515aabe7426 100644 (file)
@@ -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 */
index efd02619fb8eacf5e1c3b615e34e182aca52bb95..56f628fdd3a8d4bc95fcab375ccdb675258f2aa0 100755 (executable)
@@ -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=$?
index ecb124048a1e450084f2838b24efe04890abf6b2..34a19ad2655c57b02c46610869af891f30bf677c 100644 (file)
@@ -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)
index 2255d9181adf9568be1f8ac5654fa6e6a25a444e..576d08a1c41ca006286fa8b141651c4e0704a48a 100644 (file)
@@ -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
index 78da9fb4c694461112ce0895541c0bd759c045e1..ac47daaef6a65898e6787ae17e1c121c93f7a6f9 100644 (file)
@@ -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 <stdlib.h>
+#include <unistd.h>
 #include <stdio.h>
 #include <memory.h>
 #include <sndfile.h>
index 5e4e4825e285429bba8bee166e67242f5ffc81ea..32832f11ed7fd511fed4dc65339f28d42fa093a7 100644 (file)
@@ -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 */
index 1349bb11b95b38b655ccc07aff180c46b2678d2f..5ab6ddcb50aa46dcb22f885e45ad5b06f9bc324f 100644 (file)
@@ -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 */
index 010fbcd3d5a16e843b0faf71c8b8ed81fcedde3c..f9b4dfb338868dc3ab582213207296582b1c845a 100644 (file)
@@ -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 */
index e06f30f559d81b84c0e95865e80cf17e066bba8b..49919d052d178890dedf6e4b80cb6bfc74e9d187 100644 (file)
@@ -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"),
+    //<DIS frame data>
+    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
+    //<DCS frame data>
+    //<CFR frame data>
+    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"),
+    //<FCD frames>
+    EXCHANGE("\x10\x6B", "\x10\x6B\x10\x79\x10\x6F"),
+    //<PPS-MPS frame>
+    //<FCD frames>
+    //<PPS-EOP frame>
+    EXCHANGE("\x10\x03", "\xFF\x13\x8C\xA2\xF1\x10\x03"),
+    //<DCN frame>
+    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<ctrl>\x10<p224>\x10<C12>"),
+    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<ctrl>\x10<p224>\x10<C12>"),
+    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)
         {
index 57562452e5a9f8982b09991211452928b1de5123..1b0fa30b53f512ed76a3c0171ac4358e54066090 100644 (file)
@@ -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 (file)
index 0000000..39c8ec6
--- /dev/null
@@ -0,0 +1,277 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * pcap-parse.c
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * 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 <stdlib.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <string.h>
+#include <assert.h>
+#include <errno.h>
+#include <time.h>
+#if !defined(_WIN32)
+#include <unistd.h>
+#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 ------------------------------------------------------------*/
index aa7b98e7d2de74318bfbdf9f0c6badacb7c75c0d..f15a16ed9ab22e724e0086aa6536c75ddd1f9811 100644 (file)
@@ -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)
index 8c2e47c2d3f287079ab1f2eb892b3adddfc86362..9a279857941468361ffdd5d53c76e27f3abfed63 100644 (file)
@@ -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)
     {
index e8384c1f8c03da81ff03214e6f7a0e8e2b871df9..64d81f71acc647b27b0f72ea632c12aa7dfcbb83 100644 (file)
@@ -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 */
index 9dbece39a71d7177da94234228d21f60be844526..f0bda0b7f066f93fb564afbe4455110528a5982d 100644 (file)
@@ -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)
index f982f909263627a5a52e6300d1fd6cccb58f5483..d9484a066002dac110af07f2d31508f25147e761 100644 (file)
@@ -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);
index 6d6830e9deb650f56ecaf83ce4e8e0517a84d97c..3b3188dd08904d46a8f1a48b4997c82be9098371 100644 (file)
@@ -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);
                 }
-                end_of_page = t4_rx_put_bit(&receive_state, bit & 1);
+                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;
+                        }
+                    }
+                }
+                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);
index d98fa19de18302aec343cd7af8328ed5d02267ee..dc578a6ecd0912f74dbf4da9ff8b4d39fbdb4d08 100644 (file)
@@ -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)
index 2e4a75d082ed0a90080337e6cb397791a2947c66..e484ee898c8be1026b9c067b3e076285f53e2e75 100644 (file)
@@ -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)
index 3f66e9a8136f269af617c5f904921280746f39e2..b642b0c72ed187741231dfe41042a5665c21f282 100644 (file)
@@ -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
index 4ae6c703f963ae30f35b03f50d16487550c49067..9375f157a2059a856ceed845aad6ca55138686a0 100644 (file)
@@ -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
index 1e5035510ff46a35adae670073b0e2d8177f4441..d1614f162645854de341cc34f68b16ac1efc5fc4 100644 (file)
@@ -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
index d8b5da7c9631463710ed948e9839c7590f0bb9d4..ffab4e773709e62575c328c97542f5fb31759a44 100644 (file)
@@ -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;
 }
index 31cf6aedaecc686f88ee9e8a04ec00b41aa7d32b..adb0e53a844a710824c95b8b73cb00955a524269 100755 (executable)
@@ -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 (file)
index 0000000..553eba2
--- /dev/null
@@ -0,0 +1,592 @@
+//#define UDPTL_DEBUG
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * udptl.c
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <inttypes.h>
+#include <memory.h>
+
+#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 (file)
index 0000000..23563ad
--- /dev/null
@@ -0,0 +1,158 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * udptl.c
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * 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 ------------------------------------------------------------*/
index ec9b901866efd633bad9dbbb364349d391287a25..22d793c2df2125896c3ba60b230e191b19f057a9 100644 (file)
@@ -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 <unistd.h>
 #include <string.h>
 #include <sndfile.h>
+#include <signal.h>
+#if defined(HAVE_FENV_H)
+#include <fenv.h>
+#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. */
index 7cd498ac2067e979a2ba1e6fe71c94c398cc5a41..f1dcff1d8398cf21eb3feedd22657392a8d563a9 100644 (file)
@@ -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
index 74c4347dbe6fcde24b36a13c31fe348ca0aeac9f..603f35df30721c757d956a6c2664611bb0540d4b 100644 (file)
@@ -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);
index 6fa3e4b3078349fc85bdd34bd6231b0964c66bd7..dc2053c69201f449e032bbf919b8c746060c542d 100644 (file)
@@ -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 <unistd.h>
 #include <string.h>
 #include <sndfile.h>
+#include <signal.h>
+#if defined(HAVE_FENV_H)
+#include <fenv.h>
+#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);
index fc9ee96711673516ef34342d1cecb8edbb1c5c8f..8644ac286dc76da47d1ae09e47570505706aa851 100644 (file)
@@ -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 <unistd.h>
 #include <string.h>
 #include <sndfile.h>
+#include <signal.h>
+#if defined(HAVE_FENV_H)
+#include <fenv.h>
+#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. */
index 468d27ad95aded6e8f7c029562e5dfd9a22dd654..7968ff6199971dd68fde221b957be14f582945bc 100644 (file)
@@ -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. */
index d77e1b475c92a2fe73f7ec26989a6a8db1b2517c..2218d1a94bf1dabc6b662cd75ee746451e273434 100644 (file)
@@ -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. */
index 626158a3ba1380482427ce7f61d805f195170c16..39ae75e0df4d8ff255595bbd82b5dc7252723dce 100755 (executable)
@@ -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
 
index ca8a972cc2ff5b087da693dbe6ce59fd7cf1b7f7..f88ff212fb5720befeaa75cc4594fb53e8c45111 100644 (file)
@@ -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
 
 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 ------------------------------------------------------------*/
index ec578bef41ee5141b684939228e24b8025b9692a..2d388fc9dc60428aae932db5e8ce6ad7b51ec1bd 100644 (file)
@@ -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)
index f8c147e9554434b7360dc8e8d37135d9085fd24f..53f0b079497b59c54ef60db3b4285609f87d760e 100644 (file)
@@ -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)
index 695e0fc7a78f449485130e01527603cff0b5c78d..a73c345a3bac8ef591f854ec5f22edea172b3fe9 100755 (executable)
@@ -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"
 
index c4b9062f9f6bb2457b5b7a04901db721606d7270..8e3bbf3d6b8b4fba664dcd94b0fb8c269640ca26 100755 (executable)
@@ -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"
 
index a1f889ec2b32a39da8b26e578021eaa06b69fbd1..d1f8b92a2347bf529882ecb2892952b9eb2f5582 100755 (executable)
@@ -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
index c5f38ec95751c5c5a3850a5660549eb06b6069ab..28b8276679d51a630929a2f31a22ace26af70995 100755 (executable)
@@ -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"