diff --git a/libs/spandsp/configure.ac b/libs/spandsp/configure.ac index 11c5100d2a..7efaa0557e 100644 --- a/libs/spandsp/configure.ac +++ b/libs/spandsp/configure.ac @@ -16,7 +16,7 @@ # 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.70 2009/06/02 11:51:57 steveu Exp $ +# $Id: configure.ac,v 1.71 2009/07/12 09:29:18 steveu Exp $ # @start 1 @@ -124,7 +124,7 @@ AC_ARG_ENABLE(mmx, [ --enable-mmx Enable MMX support]) AC_ARG_ENABLE(sse, [ --enable-sse Enable SSE support]) AC_ARG_ENABLE(sse2, [ --enable-sse2 Enable SSE2 support]) AC_ARG_ENABLE(sse3, [ --enable-sse3 Enable SSE3 support]) -AC_ARG_ENABLE(sse3, [ --enable-sse3 Enable SSE3 support]) +AC_ARG_ENABLE(ssse3, [ --enable-ssse3 Enable SSSE3 support]) AC_ARG_ENABLE(sse4_1, [ --enable-sse4-1 Enable SSE4.1 support]) AC_ARG_ENABLE(sse4_2, [ --enable-sse4-2 Enable SSE4.2 support]) AC_ARG_ENABLE(sse4a, [ --enable-sse4a Enable SSE4A support]) @@ -305,6 +305,9 @@ gnu) 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 @@ -357,6 +360,7 @@ AM_CONDITIONAL([COND_MMX], [test "$enable_mmx" = yes]) AM_CONDITIONAL([COND_SSE], [test "$enable_sse" = yes]) AM_CONDITIONAL([COND_SSE2], [test "$enable_sse2" = yes]) AM_CONDITIONAL([COND_SSE3], [test "$enable_sse3" = yes]) +AM_CONDITIONAL([COND_SSSE3], [test "$enable_ssse3" = yes]) AM_CONDITIONAL([COND_SSE4_1], [test "$enable_sse4_1" = yes]) AM_CONDITIONAL([COND_SSE4_2], [test "$enable_sse4_2" = yes]) AM_CONDITIONAL([COND_SSE4A], [test "$enable_sse4a" = yes]) @@ -389,6 +393,10 @@ if test "$enable_sse4_2" = "yes" ; then fi if test "$enable_sse4_1" = "yes" ; then AC_DEFINE([SPANDSP_USE_SSE4_1], [1], [Use the SSE4.1 instruction set (i386 and x86_64 only).]) + enable_ssse3="yes" +fi +if test "$enable_ssse3" = "yes" ; then + AC_DEFINE([SPANDSP_USE_SSSE3], [1], [Use the SSSE3 instruction set (i386 and x86_64 only).]) enable_sse3="yes" fi if test "$enable_sse3" = "yes" ; then diff --git a/libs/spandsp/src/Makefile.am b/libs/spandsp/src/Makefile.am index 65ab6356a5..84dae2c53a 100644 --- a/libs/spandsp/src/Makefile.am +++ b/libs/spandsp/src/Makefile.am @@ -16,7 +16,7 @@ ## 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.134 2009/06/02 11:51:57 steveu Exp $ +## $Id: Makefile.am,v 1.135 2009/07/12 09:23:09 steveu Exp $ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) @@ -275,6 +275,7 @@ noinst_HEADERS = faxfont.h \ filter_tools.h \ gsm0610_local.h \ lpc10_encdecs.h \ + mmx_sse_decs.h \ t30_local.h \ t4_states.h \ v17_v32bis_rx_constellation_maps.h \ diff --git a/libs/spandsp/src/at_interpreter.c b/libs/spandsp/src/at_interpreter.c index a71f0a7d25..7da04d2e67 100644 --- a/libs/spandsp/src/at_interpreter.c +++ b/libs/spandsp/src/at_interpreter.c @@ -25,7 +25,7 @@ * 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.39 2009/04/24 22:35:25 steveu Exp $ + * $Id: at_interpreter.c,v 1.40 2009/07/10 13:15:56 steveu Exp $ */ /*! \file */ @@ -76,7 +76,7 @@ enum static at_profile_t profiles[3] = { { -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__sunos) || defined(__solaris) /*.echo =*/ TRUE, /*.verbose =*/ TRUE, /*.result_code_format =*/ ASCII_RESULT_CODES, diff --git a/libs/spandsp/src/complex_vector_float.c b/libs/spandsp/src/complex_vector_float.c index c6230f377c..3dffbb08ca 100644 --- a/libs/spandsp/src/complex_vector_float.c +++ b/libs/spandsp/src/complex_vector_float.c @@ -22,7 +22,7 @@ * 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.15 2009/02/03 16:28:39 steveu Exp $ + * $Id: complex_vector_float.c,v 1.16 2009/07/12 09:23:09 steveu Exp $ */ /*! \file */ @@ -41,33 +41,10 @@ #if defined(HAVE_MATH_H) #include #endif -#include "floating_fudge.h" #include -#if defined(SPANDSP_USE_MMX) -#include -#endif -#if defined(SPANDSP_USE_SSE) -#include -#endif -#if defined(SPANDSP_USE_SSE2) -#include -#endif -#if defined(SPANDSP_USE_SSE3) -#include -#endif -#if defined(SPANDSP_USE_SSE4_1) -#include -#endif -#if defined(SPANDSP_USE_SSE4_2) -#include -#endif -#if defined(SPANDSP_USE_SSE4A) -#include -#endif -#if defined(SPANDSP_USE_SSE5) -#include -#endif +#include "floating_fudge.h" +#include "mmx_sse_decs.h" #include "spandsp/telephony.h" #include "spandsp/logging.h" diff --git a/libs/spandsp/src/complex_vector_int.c b/libs/spandsp/src/complex_vector_int.c index 7f00bdfd9e..d55009d491 100644 --- a/libs/spandsp/src/complex_vector_int.c +++ b/libs/spandsp/src/complex_vector_int.c @@ -22,7 +22,7 @@ * 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.8 2009/02/21 04:27:46 steveu Exp $ + * $Id: complex_vector_int.c,v 1.9 2009/07/12 09:23:09 steveu Exp $ */ /*! \file */ @@ -41,33 +41,10 @@ #if defined(HAVE_MATH_H) #include #endif -#include "floating_fudge.h" #include -#if defined(SPANDSP_USE_MMX) -#include -#endif -#if defined(SPANDSP_USE_SSE) -#include -#endif -#if defined(SPANDSP_USE_SSE2) -#include -#endif -#if defined(SPANDSP_USE_SSE3) -#include -#endif -#if defined(SPANDSP_USE_SSE4_1) -#include -#endif -#if defined(SPANDSP_USE_SSE4_2) -#include -#endif -#if defined(SPANDSP_USE_SSE4A) -#include -#endif -#if defined(SPANDSP_USE_SSE5) -#include -#endif +#include "floating_fudge.h" +#include "mmx_sse_decs.h" #include "spandsp/telephony.h" #include "spandsp/logging.h" diff --git a/libs/spandsp/src/make_modem_filter.c b/libs/spandsp/src/make_modem_filter.c index e2a63c4b2f..7621878a3c 100644 --- a/libs/spandsp/src/make_modem_filter.c +++ b/libs/spandsp/src/make_modem_filter.c @@ -23,7 +23,7 @@ * 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.15 2009/06/02 11:51:57 steveu Exp $ + * $Id: make_modem_filter.c,v 1.16 2009/07/10 13:15:56 steveu Exp $ */ #if defined(HAVE_CONFIG_H) @@ -44,6 +44,9 @@ #include #include #include +#if defined(__sunos) || defined(__solaris) +#include +#endif #include "spandsp/telephony.h" #include "spandsp/complex.h" diff --git a/libs/spandsp/src/mmx_sse_decs.h b/libs/spandsp/src/mmx_sse_decs.h new file mode 100644 index 0000000000..40dca542b5 --- /dev/null +++ b/libs/spandsp/src/mmx_sse_decs.h @@ -0,0 +1,61 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * mmx_sse_decs.h - Pull in the appropriate systems headers for the MMX/SSE settings. + * + * Written by Steve Underwood + * + * Copyright (C) 2009 Steve Underwood + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser 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 + * 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_) +#define _MMX_SSE_DECS_H_ + +#if defined(SPANDSP_USE_MMX) +#include +#endif +#if defined(SPANDSP_USE_SSE) +#include +#endif +#if defined(SPANDSP_USE_SSE2) +#include +#endif +#if defined(SPANDSP_USE_SSE3) +#include +#endif +#if defined(SPANDSP_USE_SSSE3) +#include +#endif +#if defined(SPANDSP_USE_SSE4_1) +#include +#endif +#if defined(SPANDSP_USE_SSE4_2) +#include +#endif +#if defined(SPANDSP_USE_SSE4A) +#include +#endif +#if defined(SPANDSP_USE_SSE5) +#include +#endif + +#endif + +/*- End of include ---------------------------------------------------------*/ diff --git a/libs/spandsp/src/spandsp/bit_operations.h b/libs/spandsp/src/spandsp/bit_operations.h index a0b218f878..56850ffd35 100644 --- a/libs/spandsp/src/spandsp/bit_operations.h +++ b/libs/spandsp/src/spandsp/bit_operations.h @@ -22,7 +22,7 @@ * 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.26 2009/02/26 16:08:50 steveu Exp $ + * $Id: bit_operations.h,v 1.27 2009/07/10 13:15:56 steveu Exp $ */ /*! \file */ @@ -30,6 +30,12 @@ #if !defined(_SPANDSP_BIT_OPERATIONS_H_) #define _SPANDSP_BIT_OPERATIONS_H_ +#if defined(__i386__) || defined(__x86_64__) +#if !defined(__SUNPRO_C) || (__SUNPRO_C >= 0x0590) +#define SPANDSP_USE_86_ASM +#endif +#endif + #if defined(__cplusplus) extern "C" { @@ -40,7 +46,7 @@ extern "C" \return The bit number of the highest set bit, or -1 if the word is zero. */ static __inline__ int top_bit(unsigned int bits) { -#if defined(__i386__) || defined(__x86_64__) +#if defined(SPANDSP_USE_86_ASM) int res; __asm__ (" xorl %[res],%[res];\n" @@ -141,7 +147,7 @@ static __inline__ int bottom_bit(unsigned int bits) { int res; -#if defined(__i386__) || defined(__x86_64__) +#if defined(SPANDSP_USE_86_ASM) __asm__ (" xorl %[res],%[res];\n" " decl %[res];\n" " bsfl %[bits],%[res]\n" diff --git a/libs/spandsp/src/spandsp/fast_convert.h b/libs/spandsp/src/spandsp/fast_convert.h index add8135b13..a8170818cd 100644 --- a/libs/spandsp/src/spandsp/fast_convert.h +++ b/libs/spandsp/src/spandsp/fast_convert.h @@ -22,7 +22,7 @@ * 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.7 2009/04/18 03:18:41 steveu Exp $ + * $Id: fast_convert.h,v 1.8 2009/07/10 13:15:56 steveu Exp $ */ #if !defined(_SPANDSP_FAST_CONVERT_H_) @@ -403,7 +403,7 @@ extern "C" the accuracy issues related to changing the rounding scheme are of little concern to us. */ - #if !defined(__sgi) + #if !defined(__sgi) && !defined(__sunos) && !defined(__solaris) #warning "No usable lrint() and lrintf() functions available." #warning "Replacing these functions with a simple C cast." #endif diff --git a/libs/spandsp/src/spandsp/private/t38_core.h b/libs/spandsp/src/spandsp/private/t38_core.h index adf5266f03..2de5e8aa08 100644 --- a/libs/spandsp/src/spandsp/private/t38_core.h +++ b/libs/spandsp/src/spandsp/private/t38_core.h @@ -22,7 +22,7 @@ * 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.3 2009/04/12 14:18:02 steveu Exp $ + * $Id: t38_core.h,v 1.4 2009/07/14 13:54:22 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_T38_CORE_H_) @@ -97,19 +97,11 @@ struct t38_core_state_s /*! \brief The fastest data rate supported by the T.38 channel. */ int fastest_image_data_rate; - /*! \brief The number of times an indicator packet will be sent. Numbers greater than one - will increase reliability for UDP transmission. Zero is valid, to suppress all - indicator packets for TCP transmission. */ - int indicator_tx_count; - - /*! \brief The number of times a data packet which does not end transmission will be sent. - Numbers greater than one will increase reliability for UDP transmission. Zero - is not valid. */ - int data_tx_count; - - /*! \brief The number of times a data packet which ends transmission will be sent. Numbers - greater than one will increase reliability for UDP transmission. Zero is not valid. */ - int data_end_tx_count; + /*! \brief The number of times each packet type will be sent (low byte). The + depth of redundancy (2nd byte). Higher numbers may increase reliability + for UDP transmission. Zero is valid for the indicator packet category, + to suppress all indicator packets (typicaly for TCP transmission). */ + int category_control[5]; /*! \brief TRUE if IFP packet sequence numbers are relevant. For some transports, like TPKT over TCP they are not relevent. */ diff --git a/libs/spandsp/src/spandsp/private/v17rx.h b/libs/spandsp/src/spandsp/private/v17rx.h index ae4fc7dc32..53ec71e502 100644 --- a/libs/spandsp/src/spandsp/private/v17rx.h +++ b/libs/spandsp/src/spandsp/private/v17rx.h @@ -22,12 +22,31 @@ * 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.1 2008/10/13 13:14:01 steveu Exp $ + * $Id: v17rx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V17RX_H_) #define _SPANDSP_PRIVATE_V17RX_H_ +/* Target length for the equalizer is about 63 taps, to deal with the worst stuff + in V.56bis. */ +/*! Samples before the target position in the equalizer buffer */ +#define V17_EQUALIZER_PRE_LEN 8 +/*! Samples after the target position in the equalizer buffer */ +#define V17_EQUALIZER_POST_LEN 8 + +/*! The number of taps in the pulse shaping/bandpass filter */ +#define V17_RX_FILTER_STEPS 27 + +/* We can store more trellis depth that we look back over, so that we can push out a group + of symbols in one go, giving greater processing efficiency, at the expense of a bit more + latency through the modem. */ +/* Right now we don't take advantage of this optimisation. */ +/*! The depth of the trellis buffer */ +#define V17_TRELLIS_STORAGE_DEPTH 16 +/*! How far we look back into history for trellis decisions */ +#define V17_TRELLIS_LOOKBACK_DEPTH 16 + /*! V.17 modem receive side descriptor. This defines the working state for a single instance of a V.17 modem receiver. diff --git a/libs/spandsp/src/spandsp/private/v17tx.h b/libs/spandsp/src/spandsp/private/v17tx.h index 09f20396ff..4644e99348 100644 --- a/libs/spandsp/src/spandsp/private/v17tx.h +++ b/libs/spandsp/src/spandsp/private/v17tx.h @@ -22,7 +22,7 @@ * 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.1 2008/10/13 13:14:01 steveu Exp $ + * $Id: v17tx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $ */ /*! \file */ @@ -30,6 +30,9 @@ #if !defined(_SPANDSP_PRIVATE_V17TX_H_) #define _SPANDSP_PRIVATE_V17TX_H_ +/*! The number of taps in the pulse shaping/bandpass filter */ +#define V17_TX_FILTER_STEPS 9 + /*! V.17 modem transmit side descriptor. This defines the working state for a single instance of a V.17 modem transmitter. diff --git a/libs/spandsp/src/spandsp/private/v22bis.h b/libs/spandsp/src/spandsp/private/v22bis.h index b9dbb643cd..6a82dcef6e 100644 --- a/libs/spandsp/src/spandsp/private/v22bis.h +++ b/libs/spandsp/src/spandsp/private/v22bis.h @@ -22,12 +22,23 @@ * 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.10 2009/04/29 12:37:45 steveu Exp $ + * $Id: v22bis.h,v 1.11 2009/07/09 13:52:09 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V22BIS_H_) #define _SPANDSP_PRIVATE_V22BIS_H_ +/*! The number of steps to the left and to the right of the target position in the equalizer buffer. */ +#define V22BIS_EQUALIZER_LEN 7 +/*! One less than a power of 2 >= (2*V22BIS_EQUALIZER_LEN + 1) */ +#define V22BIS_EQUALIZER_MASK 15 + +/*! The number of taps in the transmit pulse shaping filter */ +#define V22BIS_TX_FILTER_STEPS 9 + +/*! The number of taps in the receive pulse shaping/bandpass filter */ +#define V22BIS_RX_FILTER_STEPS 37 + /*! Segments of the training sequence on the receive side */ enum { diff --git a/libs/spandsp/src/spandsp/private/v27ter_rx.h b/libs/spandsp/src/spandsp/private/v27ter_rx.h index eb698002d3..63566de622 100644 --- a/libs/spandsp/src/spandsp/private/v27ter_rx.h +++ b/libs/spandsp/src/spandsp/private/v27ter_rx.h @@ -22,12 +22,30 @@ * 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.1 2008/10/13 13:14:01 steveu Exp $ + * $Id: v27ter_rx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V27TER_RX_H_) #define _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 number of taps in the 4800bps pulse shaping/bandpass filter */ +#define V27TER_RX_4800_FILTER_STEPS 27 +/*! The number of taps in the 2400bps pulse shaping/bandpass filter */ +#define V27TER_RX_2400_FILTER_STEPS 27 + +#if V27TER_RX_4800_FILTER_STEPS > V27TER_RX_2400_FILTER_STEPS +#define V27TER_RX_FILTER_STEPS V27TER_RX_4800_FILTER_STEPS +#else +#define V27TER_RX_FILTER_STEPS V27TER_RX_2400_FILTER_STEPS +#endif + /*! V.27ter modem receive side descriptor. This defines the working state for a single instance of a V.27ter modem receiver. diff --git a/libs/spandsp/src/spandsp/private/v27ter_tx.h b/libs/spandsp/src/spandsp/private/v27ter_tx.h index 4e3d747d88..28e455cd85 100644 --- a/libs/spandsp/src/spandsp/private/v27ter_tx.h +++ b/libs/spandsp/src/spandsp/private/v27ter_tx.h @@ -22,12 +22,15 @@ * 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.2 2008/12/06 14:35:04 steveu Exp $ + * $Id: v27ter_tx.h,v 1.3 2009/07/09 13:52:09 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V27TER_TX_H_) #define _SPANDSP_PRIVATE_V27TER_TX_H_ +/*! The number of taps in the pulse shaping/bandpass filter */ +#define V27TER_TX_FILTER_STEPS 9 + /*! V.27ter modem transmit side descriptor. This defines the working state for a single instance of a V.27ter modem transmitter. diff --git a/libs/spandsp/src/spandsp/private/v29rx.h b/libs/spandsp/src/spandsp/private/v29rx.h index 613edf18af..6dbb3a727d 100644 --- a/libs/spandsp/src/spandsp/private/v29rx.h +++ b/libs/spandsp/src/spandsp/private/v29rx.h @@ -22,12 +22,22 @@ * 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.1 2008/10/13 13:14:01 steveu Exp $ + * $Id: v29rx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V29RX_H_) #define _SPANDSP_PRIVATE_V29RX_H_ +/* Target length for the equalizer is about 63 taps, to deal with the worst stuff + in V.56bis. */ +/*! 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 + /*! V.29 modem receive side descriptor. This defines the working state for a single instance of a V.29 modem receiver. diff --git a/libs/spandsp/src/spandsp/private/v29tx.h b/libs/spandsp/src/spandsp/private/v29tx.h index 86cf957007..129f68c09a 100644 --- a/libs/spandsp/src/spandsp/private/v29tx.h +++ b/libs/spandsp/src/spandsp/private/v29tx.h @@ -22,12 +22,15 @@ * 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.1 2008/10/13 13:14:01 steveu Exp $ + * $Id: v29tx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $ */ #if !defined(_SPANDSP_PRIVATE_V29TX_H_) #define _SPANDSP_PRIVATE_V29TX_H_ +/*! The number of taps in the pulse shaping/bandpass filter */ +#define V29_TX_FILTER_STEPS 9 + /*! V.29 modem transmit side descriptor. This defines the working state for a single instance of a V.29 modem transmitter. diff --git a/libs/spandsp/src/spandsp/t38_core.h b/libs/spandsp/src/spandsp/t38_core.h index 1f35bb5044..9170ecd4d5 100644 --- a/libs/spandsp/src/spandsp/t38_core.h +++ b/libs/spandsp/src/spandsp/t38_core.h @@ -22,7 +22,7 @@ * 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.38 2009/04/12 14:18:02 steveu Exp $ + * $Id: t38_core.h,v 1.39 2009/07/14 13:54:22 steveu Exp $ */ /*! \file */ @@ -167,6 +167,22 @@ enum t38_data_rate_management_types_e T38_DATA_RATE_MANAGEMENT_TRANSFERRED_TCF = 2 }; +/*! T.38 Packet categories used for setting the redundancy level and packet repeat + counts on a packet by packet basis. */ +enum t38_packet_categories_e +{ + /*! \brief Indicator packet */ + T38_PACKET_CATEGORY_INDICATOR = 0, + /*! \brief Control data packet */ + T38_PACKET_CATEGORY_CONTROL_DATA = 1, + /*! \brief Terminating control data packet */ + T38_PACKET_CATEGORY_CONTROL_DATA_END = 2, + /*! \brief Image data packet */ + T38_PACKET_CATEGORY_IMAGE_DATA = 3, + /*! \brief Terminating image data packet */ + T38_PACKET_CATEGORY_IMAGE_DATA_END = 4 +}; + #define T38_RX_BUF_LEN 2048 #define T38_TX_BUF_LEN 16384 @@ -232,9 +248,8 @@ SPAN_DECLARE(int) t38_v34rate_to_bps(const uint8_t *data, int len); /*! \brief Send an indicator packet \param s The T.38 context. \param indicator The indicator to send. - \param count The number of copies of the packet to send. \return The delay to allow after this indicator is sent. */ -SPAN_DECLARE(int) t38_core_send_indicator(t38_core_state_t *s, int indicator, int count); +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. @@ -248,18 +263,18 @@ SPAN_DECLARE(int) t38_core_send_flags_delay(t38_core_state_t *s, int indicator); \param field_type The packet's field type. \param field The message data content for the packet. \param field_len The length of the message data, in bytes. - \param count The number of copies of the packet to send. + \param category The category of the packet being sent. This should be one of the values defined for t38_packet_categories_e. \return ??? */ -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 count); +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); /*! \brief Send a data packet \param s The T.38 context. \param data_type The packet's data type. \param field The list of fields. \param fields The number of fields in the list. - \param count The number of copies of the packet to send. + \param category The category of the packet being sent. This should be one of the values defined for t38_packet_categories_e. \return ??? */ -SPAN_DECLARE(int) t38_core_send_data_multi_field(t38_core_state_t *s, int data_type, const t38_data_field_t field[], int fields, int count); +SPAN_DECLARE(int) t38_core_send_data_multi_field(t38_core_state_t *s, int data_type, const t38_data_field_t field[], int fields, int category); /*! \brief Process a received T.38 IFP packet. \param s The T.38 context. @@ -299,10 +314,29 @@ SPAN_DECLARE(void) t38_set_mmr_transcoding(t38_core_state_t *s, int mmr_transcod */ SPAN_DECLARE(void) t38_set_jbig_transcoding(t38_core_state_t *s, int jbig_transcoding); +/*! Set the maximum buffer size for received data at the far end. + \param s The T.38 context. + \param max_buffer_size The maximum buffer size. +*/ SPAN_DECLARE(void) t38_set_max_buffer_size(t38_core_state_t *s, int max_buffer_size); +/*! Set the maximum size of an IFP packet that is acceptable by the far end. + \param s The T.38 context. + \param max_datagram_size The maximum IFP packet length, in bytes. +*/ SPAN_DECLARE(void) t38_set_max_datagram_size(t38_core_state_t *s, int max_datagram_size); +/*! \brief Send a data packet + \param s The T.38 context. + \param category The category of the packet being sent. This should be one of the values defined for t38_packet_categories_e. + \param setting The repeat count for the category. This should be at least one for all categories other an indicator packets. + Zero is valid for indicator packets, as it suppresses the sending of indicator packets, as an application using + TCP for the transport would require. As the setting is passed through to the transmission channel, additional + information may be encoded in it, such as the redundancy depth for the particular packet category. */ +SPAN_DECLARE(void) t38_set_redundancy_control(t38_core_state_t *s, int category, int setting); + +SPAN_DECLARE(void) t38_set_fastest_image_data_rate(t38_core_state_t *s, int max_rate); + SPAN_DECLARE(int) t38_get_fastest_image_data_rate(t38_core_state_t *s); /*! Set the T.38 version to be emulated. diff --git a/libs/spandsp/src/spandsp/v17rx.h b/libs/spandsp/src/spandsp/v17rx.h index ef92c8b0ee..2ab84151d3 100644 --- a/libs/spandsp/src/spandsp/v17rx.h +++ b/libs/spandsp/src/spandsp/v17rx.h @@ -22,7 +22,7 @@ * 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.64 2009/06/02 16:03:56 steveu Exp $ + * $Id: v17rx.h,v 1.65 2009/07/09 13:52:09 steveu Exp $ */ /*! \file */ @@ -211,25 +211,6 @@ working only on the most optimal lines, and being widely usable across most phon TCM absolutely transformed the phone line modem business. */ -/* Target length for the equalizer is about 63 taps, to deal with the worst stuff - in V.56bis. */ -/*! Samples before the target position in the equalizer buffer */ -#define V17_EQUALIZER_PRE_LEN 8 -/*! Samples after the target position in the equalizer buffer */ -#define V17_EQUALIZER_POST_LEN 8 - -/*! The number of taps in the pulse shaping/bandpass filter */ -#define V17_RX_FILTER_STEPS 27 - -/* We can store more trellis depth that we look back over, so that we can push out a group - of symbols in one go, giving greater processing efficiency, at the expense of a bit more - latency through the modem. */ -/* Right now we don't take advantage of this optimisation. */ -/*! The depth of the trellis buffer */ -#define V17_TRELLIS_STORAGE_DEPTH 16 -/*! How far we look back into history for trellis decisions */ -#define V17_TRELLIS_LOOKBACK_DEPTH 16 - /*! V.17 modem receive side descriptor. This defines the working state for a single instance of a V.17 modem receiver. diff --git a/libs/spandsp/src/spandsp/v17tx.h b/libs/spandsp/src/spandsp/v17tx.h index ee811fddd7..5fb3e07ed8 100644 --- a/libs/spandsp/src/spandsp/v17tx.h +++ b/libs/spandsp/src/spandsp/v17tx.h @@ -22,7 +22,7 @@ * 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.42 2009/06/02 16:03:56 steveu Exp $ + * $Id: v17tx.h,v 1.43 2009/07/09 13:52:09 steveu Exp $ */ /*! \file */ @@ -81,9 +81,6 @@ suits the receiver better, so the same signal generator is also used for the transmitter. */ -/*! The number of taps in the pulse shaping/bandpass filter */ -#define V17_TX_FILTER_STEPS 9 - /*! V.17 modem transmit side descriptor. This defines the working state for a single instance of a V.17 modem transmitter. diff --git a/libs/spandsp/src/spandsp/v22bis.h b/libs/spandsp/src/spandsp/v22bis.h index 4884cf34fe..237f5baf81 100644 --- a/libs/spandsp/src/spandsp/v22bis.h +++ b/libs/spandsp/src/spandsp/v22bis.h @@ -22,7 +22,7 @@ * 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.43 2009/06/02 16:03:56 steveu Exp $ + * $Id: v22bis.h,v 1.45 2009/07/09 13:52:09 steveu Exp $ */ /*! \file */ @@ -57,17 +57,6 @@ enum V22BIS_GUARD_TONE_1800HZ }; -/*! The number of steps to the left and to the right of the target position in the equalizer buffer. */ -#define V22BIS_EQUALIZER_LEN 7 -/*! One less than a power of 2 >= (2*V22BIS_EQUALIZER_LEN + 1) */ -#define V22BIS_EQUALIZER_MASK 15 - -/*! The number of taps in the transmit pulse shaping filter */ -#define V22BIS_TX_FILTER_STEPS 9 - -/*! The number of taps in the receive pulse shaping/bandpass filter */ -#define V22BIS_RX_FILTER_STEPS 37 - /*! V.22bis modem descriptor. This defines the working state for a single instance of a V.22bis modem. diff --git a/libs/spandsp/src/spandsp/v27ter_rx.h b/libs/spandsp/src/spandsp/v27ter_rx.h index d75362e540..bf365df9a1 100644 --- a/libs/spandsp/src/spandsp/v27ter_rx.h +++ b/libs/spandsp/src/spandsp/v27ter_rx.h @@ -22,7 +22,7 @@ * 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.60 2009/06/02 16:03:56 steveu Exp $ + * $Id: v27ter_rx.h,v 1.61 2009/07/09 13:52:09 steveu Exp $ */ /*! \file */ @@ -46,24 +46,6 @@ at the start of transmission, which makes the design of a V.27ter receiver relat straightforward. */ -/* 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 number of taps in the 4800bps pulse shaping/bandpass filter */ -#define V27TER_RX_4800_FILTER_STEPS 27 -/*! The number of taps in the 2400bps pulse shaping/bandpass filter */ -#define V27TER_RX_2400_FILTER_STEPS 27 - -#if V27TER_RX_4800_FILTER_STEPS > V27TER_RX_2400_FILTER_STEPS -#define V27TER_RX_FILTER_STEPS V27TER_RX_4800_FILTER_STEPS -#else -#define V27TER_RX_FILTER_STEPS V27TER_RX_2400_FILTER_STEPS -#endif - /*! V.27ter modem receive side descriptor. This defines the working state for a single instance of a V.27ter modem receiver. diff --git a/libs/spandsp/src/spandsp/v27ter_tx.h b/libs/spandsp/src/spandsp/v27ter_tx.h index c6d42bdad0..0d332e3470 100644 --- a/libs/spandsp/src/spandsp/v27ter_tx.h +++ b/libs/spandsp/src/spandsp/v27ter_tx.h @@ -22,7 +22,7 @@ * 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.42 2009/06/02 16:03:56 steveu Exp $ + * $Id: v27ter_tx.h,v 1.43 2009/07/09 13:52:09 steveu Exp $ */ /*! \file */ @@ -64,9 +64,6 @@ suits the receiver better, so then same signal generator is also used for the transmitter. */ -/*! The number of taps in the pulse shaping/bandpass filter */ -#define V27TER_TX_FILTER_STEPS 9 - /*! V.27ter modem transmit side descriptor. This defines the working state for a single instance of a V.27ter modem transmitter. diff --git a/libs/spandsp/src/spandsp/v29rx.h b/libs/spandsp/src/spandsp/v29rx.h index ce990f768f..7ee67b763c 100644 --- a/libs/spandsp/src/spandsp/v29rx.h +++ b/libs/spandsp/src/spandsp/v29rx.h @@ -22,7 +22,7 @@ * 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.71 2009/06/02 16:03:56 steveu Exp $ + * $Id: v29rx.h,v 1.72 2009/07/09 13:52:09 steveu Exp $ */ /*! \file */ @@ -120,16 +120,6 @@ scrambler register) cannot be trusted for the test. The receive modem, therefore, only tests that bits starting at bit 24 are really ones. */ -/* Target length for the equalizer is about 63 taps, to deal with the worst stuff - in V.56bis. */ -/*! 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 - typedef void (*qam_report_handler_t)(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol); /*! diff --git a/libs/spandsp/src/spandsp/v29tx.h b/libs/spandsp/src/spandsp/v29tx.h index 65d8a8f7e6..522eee7e40 100644 --- a/libs/spandsp/src/spandsp/v29tx.h +++ b/libs/spandsp/src/spandsp/v29tx.h @@ -22,7 +22,7 @@ * 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.40 2009/06/02 16:03:56 steveu Exp $ + * $Id: v29tx.h,v 1.41 2009/07/09 13:52:09 steveu Exp $ */ /*! \file */ @@ -94,9 +94,6 @@ gives */ -/*! The number of taps in the pulse shaping/bandpass filter */ -#define V29_TX_FILTER_STEPS 9 - /*! V.29 modem transmit side descriptor. This defines the working state for a single instance of a V.29 modem transmitter. diff --git a/libs/spandsp/src/spandsp/version.h b/libs/spandsp/src/spandsp/version.h index e8d0b668e4..88a8ab76df 100644 --- a/libs/spandsp/src/spandsp/version.h +++ b/libs/spandsp/src/spandsp/version.h @@ -30,9 +30,9 @@ /* The date and time of the version are in UTC form. */ -#define SPANDSP_RELEASE_DATE 20090602 -#define SPANDSP_RELEASE_TIME 160509 -#define SPANDSP_RELEASE_DATETIME_STRING "20090602 160509" +#define SPANDSP_RELEASE_DATE 20090714 +#define SPANDSP_RELEASE_TIME 135534 +#define SPANDSP_RELEASE_DATETIME_STRING "20090714 135534" #endif /*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/t31.c b/libs/spandsp/src/t31.c index 2b12fddfcc..c9871a19b2 100644 --- a/libs/spandsp/src/t31.c +++ b/libs/spandsp/src/t31.c @@ -25,7 +25,7 @@ * 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.150 2009/04/12 09:12:10 steveu Exp $ + * $Id: t31.c,v 1.151 2009/07/14 13:54:22 steveu Exp $ */ /*! \file */ @@ -696,13 +696,13 @@ static int stream_non_ecm(t31_state_t *s) case T38_TIMED_STEP_NON_ECM_MODEM: /* Create a 75ms silence */ if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL) - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_2; 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 */ - delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator); fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_3; break; case T38_TIMED_STEP_NON_ECM_MODEM_3: @@ -734,12 +734,12 @@ static int stream_non_ecm(t31_state_t *s) else { /* If we are sending quickly there seems no point in doing any padding */ - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, fe->t38.data_end_tx_count); + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END); fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5; delay = 0; } } - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, fe->t38.data_tx_count); + 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; case T38_TIMED_STEP_NON_ECM_MODEM_4: @@ -750,7 +750,7 @@ static int stream_non_ecm(t31_state_t *s) { len += fe->non_ecm_trailer_bytes; memset(buf, 0, len); - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, fe->t38.data_end_tx_count); + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END); fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5; /* Allow a bit more time than the data will take to play out, to ensure the far ATA does not cut things short. */ @@ -761,13 +761,13 @@ static int stream_non_ecm(t31_state_t *s) break; } memset(buf, 0, len); - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, fe->t38.data_tx_count); + 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; 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->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); fe->timed_step = T38_TIMED_STEP_NONE; return delay; } @@ -784,6 +784,7 @@ static int stream_hdlc(t31_state_t *s) int previous; int delay; int i; + int category; fe = &s->t38_fe; for (delay = 0; delay == 0; ) @@ -793,13 +794,13 @@ static int stream_hdlc(t31_state_t *s) case T38_TIMED_STEP_HDLC_MODEM: /* Create a 75ms silence */ if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL) - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2; fe->next_tx_samples = fe->samples + ms_to_samples(75); break; case T38_TIMED_STEP_HDLC_MODEM_2: /* Send HDLC preambling */ - delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator); delay += t38_core_send_flags_delay(&fe->t38, fe->next_tx_indicator); at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; @@ -834,7 +835,8 @@ static int stream_hdlc(t31_state_t *s) data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK_SIG_END; data_fields[1].field = NULL; data_fields[1].field_len = 0; - t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, fe->t38.data_tx_count); + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA_END : T38_PACKET_CATEGORY_IMAGE_DATA_END; + t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_5; /* We add a bit of extra time here, as with some implementations the carrier falling too abruptly causes data loss. */ @@ -849,23 +851,26 @@ static int stream_hdlc(t31_state_t *s) data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK; data_fields[1].field = NULL; data_fields[1].field_len = 0; - t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, fe->t38.data_tx_count); + 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_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits); at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); } + break; } - else - { - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i, fe->t38.data_tx_count); - fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_4; - delay = bits_to_us(s, i*8); - } - break; + 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, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i, category); + fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_4; } - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &s->hdlc_tx.buf[s->hdlc_tx.ptr], fe->octets_per_data_packet, fe->t38.data_tx_count); - s->hdlc_tx.ptr += fe->octets_per_data_packet; - delay = bits_to_us(s, fe->octets_per_data_packet*8); + else + { + i = fe->octets_per_data_packet; + 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, &s->hdlc_tx.buf[s->hdlc_tx.ptr], i, category); + s->hdlc_tx.ptr += i; + } + delay = bits_to_us(s, i*8); break; case T38_TIMED_STEP_HDLC_MODEM_4: /* End of HDLC frame */ @@ -877,7 +882,8 @@ static int stream_hdlc(t31_state_t *s) /* End of transmission */ s->hdlc_tx.len = 0; s->hdlc_tx.final = FALSE; - t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, fe->t38.data_tx_count); + 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); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_5; /* We add a bit of extra time here, as with some implementations the carrier falling too abruptly causes data loss. */ @@ -888,7 +894,8 @@ static int stream_hdlc(t31_state_t *s) break; } /* Finish the current frame off, and prepare for the next one. */ - t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, fe->t38.data_tx_count); + 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); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; at_put_response_code(&s->at_state, AT_RESPONSE_CODE_CONNECT); /* We should now wait enough time for everything to clear through an analogue modem at the far end. */ @@ -899,8 +906,9 @@ static int stream_hdlc(t31_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. */ - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_SIG_END, NULL, 0, fe->t38.data_end_tx_count); - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count); + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA_END : T38_PACKET_CATEGORY_IMAGE_DATA_END; + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_SIG_END, NULL, 0, category); + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); fe->timed_step = T38_TIMED_STEP_NONE; at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK); t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); @@ -927,14 +935,14 @@ static int stream_ced(t31_state_t *s) of silence, starting the delay with a no signal indication makes sense. We do need a 200ms delay, as that is a specification requirement. */ fe->timed_step = T38_TIMED_STEP_CED_2; - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); delay = 200000; fe->next_tx_samples = fe->samples; break; case T38_TIMED_STEP_CED_2: /* Initial 200ms delay over. Send the CED indicator */ fe->timed_step = T38_TIMED_STEP_CED_3; - delay = t38_core_send_indicator(&fe->t38, T38_IND_CED, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_CED); fe->current_tx_data_type = T38_DATA_NONE; break; case T38_TIMED_STEP_CED_3: @@ -964,7 +972,7 @@ static int stream_cng(t31_state_t *s) be sending 200ms of silence, according to T.30, starting that delay with a no signal indication makes sense. */ fe->timed_step = T38_TIMED_STEP_CNG_2; - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); delay = 200000; fe->next_tx_samples = fe->samples; break; @@ -973,7 +981,7 @@ static int stream_cng(t31_state_t *s) coming the other way interrupts it, or a long timeout controlled by the T.30 engine expires. */ fe->timed_step = T38_TIMED_STEP_NONE; - delay = t38_core_send_indicator(&fe->t38, T38_IND_CNG, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_CNG); fe->current_tx_data_type = T38_DATA_NONE; return delay; } @@ -1728,7 +1736,7 @@ static int restart_modem(t31_state_t *s, int new_modem) case FAX_MODEM_SILENCE_TX: if (s->t38_mode) { - t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL, INDICATOR_TX_COUNT); + t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL); s->t38_fe.next_tx_samples = s->t38_fe.samples + ms_to_samples(700); s->t38_fe.timed_step = T38_TIMED_STEP_PAUSE; s->t38_fe.current_tx_data_type = T38_DATA_NONE; @@ -1755,7 +1763,7 @@ static int restart_modem(t31_state_t *s, int new_modem) /* Send 200ms of silence to "push" the last audio out */ if (s->t38_mode) { - t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL, INDICATOR_TX_COUNT); + t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL); } else { @@ -2424,17 +2432,21 @@ SPAN_DECLARE(void) t31_set_t38_config(t31_state_t *s, int without_pacing) { /* Continuous streaming mode, as used for TPKT over TCP transport */ /* Inhibit indicator packets */ - s->t38_fe.t38.indicator_tx_count = 0; - s->t38_fe.t38.data_tx_count = 1; - s->t38_fe.t38.data_end_tx_count = 1; + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_INDICATOR, 0); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA, 1); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA_END, 1); + 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; } else { /* Paced streaming mode, as used for UDP transports */ - s->t38_fe.t38.indicator_tx_count = INDICATOR_TX_COUNT; - s->t38_fe.t38.data_tx_count = DATA_TX_COUNT; - s->t38_fe.t38.data_end_tx_count = DATA_END_TX_COUNT; + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_INDICATOR, INDICATOR_TX_COUNT); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA, DATA_TX_COUNT); + 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; } set_octets_per_data_packet(s, 300); diff --git a/libs/spandsp/src/t38_core.c b/libs/spandsp/src/t38_core.c index 63e1603639..c360d4e4fb 100644 --- a/libs/spandsp/src/t38_core.c +++ b/libs/spandsp/src/t38_core.c @@ -22,7 +22,7 @@ * 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.52 2009/02/10 13:06:46 steveu Exp $ + * $Id: t38_core.c,v 1.53 2009/07/14 13:54:22 steveu Exp $ */ /*! \file */ @@ -777,7 +777,7 @@ static int t38_encode_data(t38_core_state_t *s, uint8_t buf[], int data_type, co } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t38_core_send_indicator(t38_core_state_t *s, int indicator, int count) +SPAN_DECLARE(int) t38_core_send_indicator(t38_core_state_t *s, int indicator) { uint8_t buf[100]; int len; @@ -789,7 +789,7 @@ SPAN_DECLARE(int) t38_core_send_indicator(t38_core_state_t *s, int indicator, in { /* Zero is a valid count, to suppress the transmission of indicators when the transport means they are not needed - e.g. TPKT/TCP. */ - if (count) + if (s->category_control[T38_PACKET_CATEGORY_INDICATOR]) { if ((len = t38_encode_indicator(s, buf, indicator)) < 0) { @@ -797,7 +797,7 @@ SPAN_DECLARE(int) t38_core_send_indicator(t38_core_state_t *s, int indicator, in 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, count); + s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, s->category_control[T38_PACKET_CATEGORY_INDICATOR]); s->tx_seq_no = (s->tx_seq_no + 1) & 0xFFFF; delay = modem_startup_time[indicator].training; if (s->allow_for_tep) @@ -815,7 +815,7 @@ SPAN_DECLARE(int) t38_core_send_flags_delay(t38_core_state_t *s, int indicator) } /*- 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 count) +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; uint8_t buf[1000]; @@ -829,13 +829,13 @@ SPAN_DECLARE(int) t38_core_send_data(t38_core_state_t *s, int data_type, int fie span_log(&s->logging, SPAN_LOG_FLOW, "T.38 data len is %d\n", len); return len; } - s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, count); + s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, s->category_control[category]); s->tx_seq_no = (s->tx_seq_no + 1) & 0xFFFF; return 0; } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t38_core_send_data_multi_field(t38_core_state_t *s, int data_type, const t38_data_field_t field[], int fields, int count) +SPAN_DECLARE(int) t38_core_send_data_multi_field(t38_core_state_t *s, int data_type, const t38_data_field_t field[], int fields, int category) { uint8_t buf[1000]; int len; @@ -845,7 +845,7 @@ SPAN_DECLARE(int) t38_core_send_data_multi_field(t38_core_state_t *s, int data_t span_log(&s->logging, SPAN_LOG_FLOW, "T.38 data len is %d\n", len); return len; } - s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, count); + s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, s->category_control[category]); s->tx_seq_no = (s->tx_seq_no + 1) & 0xFFFF; return 0; } @@ -911,6 +911,18 @@ SPAN_DECLARE(void) t38_set_tep_handling(t38_core_state_t *s, int allow_for_tep) } /*- End of function --------------------------------------------------------*/ +SPAN_DECLARE(void) t38_set_redundancy_control(t38_core_state_t *s, int category, int setting) +{ + s->category_control[category] = setting; +} +/*- End of function --------------------------------------------------------*/ + +SPAN_DECLARE(void) t38_set_fastest_image_data_rate(t38_core_state_t *s, int max_rate) +{ + s->fastest_image_data_rate = max_rate; +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE(int) t38_get_fastest_image_data_rate(t38_core_state_t *s) { return s->fastest_image_data_rate; @@ -952,6 +964,13 @@ SPAN_DECLARE(t38_core_state_t *) t38_core_init(t38_core_state_t *s, s->t38_version = 0; s->check_sequence_numbers = TRUE; + /* Set some defaults */ + s->category_control[T38_PACKET_CATEGORY_INDICATOR] = 1; + s->category_control[T38_PACKET_CATEGORY_CONTROL_DATA] = 1; + s->category_control[T38_PACKET_CATEGORY_CONTROL_DATA_END] = 1; + 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; diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index 1f98d3f86d..7b221017f4 100644 --- a/libs/spandsp/src/t38_gateway.c +++ b/libs/spandsp/src/t38_gateway.c @@ -23,7 +23,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: t38_gateway.c,v 1.163 2009/05/16 03:34:45 steveu Exp $ + * $Id: t38_gateway.c,v 1.164 2009/07/14 13:54:22 steveu Exp $ */ /*! \file */ @@ -1498,7 +1498,7 @@ static int set_fast_packetisation(t38_gateway_state_t *s) static void announce_training(t38_gateway_state_t *s) { - t38_core_send_indicator(&s->t38x.t38, set_fast_packetisation(s), s->t38x.t38.indicator_tx_count); + t38_core_send_indicator(&s->t38x.t38, set_fast_packetisation(s)); } /*- End of function --------------------------------------------------------*/ @@ -1552,7 +1552,7 @@ static void non_ecm_rx_status(void *user_data, int status) /* TODO: If the carrier really did fall for good during the 500ms TEP blocking timeout, we won't declare the no-signal condition. */ non_ecm_push_residue(s); - t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL, s->t38x.t38.indicator_tx_count); + t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL); } restart_rx_modem(s); break; @@ -1586,7 +1586,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)); } - 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, t->t38x.t38.data_end_tx_count); + 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; s->data_ptr = 0; @@ -1600,7 +1600,7 @@ static void non_ecm_push(t38_gateway_state_t *t) s = &t->core.to_t38; if (s->data_ptr) { - t38_core_send_data(&t->t38x.t38, t->t38x.current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, s->data, s->data_ptr, t->t38x.t38.data_tx_count); + t38_core_send_data(&t->t38x.t38, t->t38x.current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, s->data, s->data_ptr, T38_PACKET_CATEGORY_IMAGE_DATA); s->in_bits += s->bits_absorbed; s->out_octets += s->data_ptr; s->bits_absorbed = 0; @@ -1682,6 +1682,7 @@ static void non_ecm_remove_fill_and_put_bit(void *user_data, int bit) static void hdlc_rx_status(hdlc_rx_state_t *t, int status) { t38_gateway_state_t *s; + int category; s = (t38_gateway_state_t *) t->frame_user_data; span_log(&s->logging, SPAN_LOG_FLOW, "HDLC signal status is %s (%d)\n", signal_status_to_str(status), status); @@ -1712,8 +1713,9 @@ static void hdlc_rx_status(hdlc_rx_state_t *t, int status) case SIG_STATUS_CARRIER_DOWN: if (t->framing_ok_announced) { - t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_SIG_END, NULL, 0, s->t38x.t38.data_end_tx_count); - t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL, s->t38x.t38.indicator_tx_count); + category = (s->t38x.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA_END : T38_PACKET_CATEGORY_IMAGE_DATA_END; + t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_SIG_END, NULL, 0, category); + t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL); t->framing_ok_announced = FALSE; } restart_rx_modem(s); @@ -1739,6 +1741,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *t) { t38_gateway_state_t *s; t38_gateway_to_t38_state_t *u; + int category; s = (t38_gateway_state_t *) t->frame_user_data; u = &s->core.to_t38; @@ -1757,6 +1760,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *t) /* Hit HDLC flag */ if (t->flags_seen >= t->framing_ok_threshold) { + category = (s->t38x.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; if (t->len) { /* This is not back-to-back flags */ @@ -1765,7 +1769,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *t) if (u->data_ptr) { bit_reverse(u->data, t->buffer + t->len - 2 - u->data_ptr, u->data_ptr); - t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_DATA, u->data, u->data_ptr, s->t38x.t38.data_tx_count); + t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_DATA, u->data, u->data_ptr, category); } /*endif*/ if (t->num_bits != 7) @@ -1775,7 +1779,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *t) /* It seems some boxes may not like us sending a _SIG_END here, and then another when the carrier actually drops. Lets just send T38_FIELD_HDLC_FCS_OK here. */ if (t->len > 2) - t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_BAD, NULL, 0, s->t38x.t38.data_tx_count); + t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_BAD, NULL, 0, category); /*endif*/ } else if ((u->crc & 0xFFFF) != 0xF0B8) @@ -1785,7 +1789,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *t) /* It seems some boxes may not like us sending a _SIG_END here, and then another when the carrier actually drops. Lets just send T38_FIELD_HDLC_FCS_OK here. */ if (t->len > 2) - t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_BAD, NULL, 0, s->t38x.t38.data_tx_count); + t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_BAD, NULL, 0, category); /*endif*/ } else @@ -1810,7 +1814,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *t) /*endif*/ /* It seems some boxes may not like us sending a _SIG_END here, and then another when the carrier actually drops. Lets just send T38_FIELD_HDLC_FCS_OK here. */ - t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_OK, NULL, 0, s->t38x.t38.data_tx_count); + t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_FCS_OK, NULL, 0, category); } /*endif*/ } @@ -1835,7 +1839,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *t) { if (s->t38x.current_tx_data_type == T38_DATA_V21) { - t38_core_send_indicator(&s->t38x.t38, set_slow_packetisation(s), s->t38x.t38.indicator_tx_count); + t38_core_send_indicator(&s->t38x.t38, set_slow_packetisation(s)); s->audio.modems.rx_signal_present = TRUE; } /*endif*/ @@ -1861,6 +1865,7 @@ static void t38_hdlc_rx_put_bit(hdlc_rx_state_t *t, int new_bit) { t38_gateway_state_t *s; t38_gateway_to_t38_state_t *u; + int category; if (new_bit < 0) { @@ -1914,7 +1919,8 @@ static void t38_hdlc_rx_put_bit(hdlc_rx_state_t *t, int new_bit) if (++u->data_ptr >= u->octets_per_data_packet) { bit_reverse(u->data, t->buffer + t->len - 2 - u->data_ptr, u->data_ptr); - t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_DATA, u->data, u->data_ptr, s->t38x.t38.data_tx_count); + category = (s->t38x.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; + t38_core_send_data(&s->t38x.t38, s->t38x.current_tx_data_type, T38_FIELD_HDLC_DATA, u->data, u->data_ptr, category); /* Since we delay transmission by 2 octets, we should now have sent the last of the data octets when we have just received the last of the CRC octets. */ u->data_ptr = 0; @@ -2028,7 +2034,7 @@ SPAN_DECLARE(int) t38_gateway_rx(t38_gateway_state_t *s, int16_t amp[], int len) break; case TIMED_MODE_STARTUP: /* Ensure a no-signal condition goes out the moment the received audio starts */ - t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL, s->t38x.t38.indicator_tx_count); + t38_core_send_indicator(&s->t38x.t38, T38_IND_NO_SIGNAL); s->core.timed_mode = TIMED_MODE_IDLE; break; } @@ -2127,11 +2133,11 @@ SPAN_DECLARE(void) t38_gateway_set_supported_modems(t38_gateway_state_t *s, int { s->core.supported_modems = supported_modems; if ((s->core.supported_modems & T30_SUPPORT_V17)) - s->t38x.t38.fastest_image_data_rate = 14400; + t38_set_fastest_image_data_rate(&s->t38x.t38, 14400); else if ((s->core.supported_modems & T30_SUPPORT_V29)) - s->t38x.t38.fastest_image_data_rate = 9600; + t38_set_fastest_image_data_rate(&s->t38x.t38, 9600); else - s->t38x.t38.fastest_image_data_rate = 4800; + t38_set_fastest_image_data_rate(&s->t38x.t38, 4800); /*endif*/ } /*- End of function --------------------------------------------------------*/ @@ -2160,8 +2166,8 @@ SPAN_DECLARE(void) t38_gateway_set_fill_bit_removal(t38_gateway_state_t *s, int /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(void) t38_gateway_set_real_time_frame_handler(t38_gateway_state_t *s, - t38_gateway_real_time_frame_handler_t *handler, - void *user_data) + t38_gateway_real_time_frame_handler_t *handler, + void *user_data) { s->core.real_time_frame_handler = handler; s->core.real_time_frame_user_data = user_data; @@ -2191,8 +2197,8 @@ static int t38_gateway_audio_init(t38_gateway_state_t *s) /*- End of function --------------------------------------------------------*/ static int t38_gateway_t38_init(t38_gateway_state_t *t, - t38_tx_packet_handler_t *tx_packet_handler, - void *tx_packet_user_data) + t38_tx_packet_handler_t *tx_packet_handler, + void *tx_packet_user_data) { t38_gateway_t38_state_t *s; @@ -2204,9 +2210,11 @@ static int t38_gateway_t38_init(t38_gateway_state_t *t, (void *) t, tx_packet_handler, tx_packet_user_data); - s->t38.indicator_tx_count = INDICATOR_TX_COUNT; - s->t38.data_tx_count = DATA_TX_COUNT; - s->t38.data_end_tx_count = DATA_END_TX_COUNT; + t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_INDICATOR, INDICATOR_TX_COUNT); + t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_CONTROL_DATA, DATA_TX_COUNT); + t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_CONTROL_DATA_END, DATA_END_TX_COUNT); + t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_IMAGE_DATA, DATA_TX_COUNT); + t38_set_redundancy_control(&s->t38, T38_PACKET_CATEGORY_IMAGE_DATA_END, DATA_END_TX_COUNT); return 0; } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/t38_terminal.c b/libs/spandsp/src/t38_terminal.c index d1e0709603..4ea4dd4579 100644 --- a/libs/spandsp/src/t38_terminal.c +++ b/libs/spandsp/src/t38_terminal.c @@ -22,7 +22,7 @@ * 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.125 2009/05/02 04:43:48 steveu Exp $ + * $Id: t38_terminal.c,v 1.127 2009/07/14 13:54:22 steveu Exp $ */ /*! \file */ @@ -565,7 +565,7 @@ static int stream_non_ecm(t38_terminal_state_t *s) case T38_TIMED_STEP_NON_ECM_MODEM: /* Create a 75ms silence */ if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL) - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); else delay = 75000; fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_2; @@ -573,7 +573,7 @@ static int stream_non_ecm(t38_terminal_state_t *s) break; case T38_TIMED_STEP_NON_ECM_MODEM_2: /* Switch on a fast modem, and give the training time to complete */ - delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator); fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_3; break; case T38_TIMED_STEP_NON_ECM_MODEM_3: @@ -605,12 +605,13 @@ static int stream_non_ecm(t38_terminal_state_t *s) else { /* If we are sending quickly there seems no point in doing any padding */ - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, fe->t38.data_end_tx_count); + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END); fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5; delay = 0; + break; } } - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, fe->t38.data_tx_count); + 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; case T38_TIMED_STEP_NON_ECM_MODEM_4: @@ -621,7 +622,7 @@ static int stream_non_ecm(t38_terminal_state_t *s) { len += fe->non_ecm_trailer_bytes; memset(buf, 0, len); - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, fe->t38.data_end_tx_count); + t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END); fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5; /* Allow a bit more time than the data will take to play out, to ensure the far ATA does not cut things short. */ @@ -632,13 +633,13 @@ static int stream_non_ecm(t38_terminal_state_t *s) break; } memset(buf, 0, len); - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, fe->t38.data_tx_count); + 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; 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->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); fe->timed_step = T38_TIMED_STEP_NONE; return delay; } @@ -652,6 +653,7 @@ static int stream_hdlc(t38_terminal_state_t *s) t38_terminal_front_end_state_t *fe; uint8_t buf[MAX_OCTETS_PER_UNPACED_CHUNK + 50]; t38_data_field_t data_fields[2]; + int category; int previous; int delay; int i; @@ -664,7 +666,7 @@ static int stream_hdlc(t38_terminal_state_t *s) case T38_TIMED_STEP_HDLC_MODEM: /* Create a 75ms silence */ if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL) - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); else delay = 75000; fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2; @@ -672,7 +674,7 @@ static int stream_hdlc(t38_terminal_state_t *s) break; case T38_TIMED_STEP_HDLC_MODEM_2: /* Send HDLC preambling */ - delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator); delay += t38_core_send_flags_delay(&fe->t38, fe->next_tx_indicator); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; break; @@ -701,7 +703,8 @@ static int stream_hdlc(t38_terminal_state_t *s) data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK_SIG_END; data_fields[1].field = NULL; data_fields[1].field_len = 0; - t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, fe->t38.data_tx_count); + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA_END : T38_PACKET_CATEGORY_IMAGE_DATA_END; + t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_5; /* We add a bit of extra time here, as with some implementations the carrier falling too abruptly causes data loss. */ @@ -715,22 +718,25 @@ static int stream_hdlc(t38_terminal_state_t *s) data_fields[1].field_type = T38_FIELD_HDLC_FCS_OK; data_fields[1].field = NULL; data_fields[1].field_len = 0; - t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, fe->t38.data_tx_count); + 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_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits); } + break; } - else - { - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &fe->hdlc_tx.buf[fe->hdlc_tx.ptr], i, fe->t38.data_tx_count); - fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_4; - delay = bits_to_us(s, i*8); - } - break; + 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; } - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &fe->hdlc_tx.buf[fe->hdlc_tx.ptr], fe->octets_per_data_packet, fe->t38.data_tx_count); - fe->hdlc_tx.ptr += fe->octets_per_data_packet; - delay = bits_to_us(s, fe->octets_per_data_packet*8); + else + { + i = fe->octets_per_data_packet; + 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->hdlc_tx.ptr += i; + } + delay = bits_to_us(s, i*8); break; case T38_TIMED_STEP_HDLC_MODEM_4: /* End of HDLC frame */ @@ -742,7 +748,8 @@ static int stream_hdlc(t38_terminal_state_t *s) if (fe->hdlc_tx.len < 0) { /* End of transmission */ - t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK_SIG_END, NULL, 0, fe->t38.data_end_tx_count); + category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA_END : T38_PACKET_CATEGORY_IMAGE_DATA_END; + t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK_SIG_END, NULL, 0, category); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_5; /* We add a bit of extra time here, as with some implementations the carrier falling too abruptly causes data loss. */ @@ -759,7 +766,8 @@ static int stream_hdlc(t38_terminal_state_t *s) span_log(&s->logging, SPAN_LOG_FLOW, "No new frame or end transmission condition.\n"); } /* Finish the current frame off, and prepare for the next one. */ - t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, fe->t38.data_tx_count); + 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); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; /* We should now wait enough time for everything to clear through an analogue modem at the far end. */ delay = bits_to_us(s, fe->hdlc_tx.extra_bits); @@ -767,7 +775,7 @@ 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->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); fe->timed_step = T38_TIMED_STEP_NONE; return delay; } @@ -792,14 +800,14 @@ static int stream_ced(t38_terminal_state_t *s) of silence, starting the delay with a no signal indication makes sense. We do need a 200ms delay, as that is a specification requirement. */ fe->timed_step = T38_TIMED_STEP_CED_2; - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); delay = 200000; fe->next_tx_samples = fe->samples; break; case T38_TIMED_STEP_CED_2: /* Initial 200ms delay over. Send the CED indicator */ fe->timed_step = T38_TIMED_STEP_CED_3; - delay = t38_core_send_indicator(&fe->t38, T38_IND_CED, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_CED); fe->current_tx_data_type = T38_DATA_NONE; break; case T38_TIMED_STEP_CED_3: @@ -829,7 +837,7 @@ static int stream_cng(t38_terminal_state_t *s) be sending 200ms of silence, according to T.30, starting that delay with a no signal indication makes sense. */ fe->timed_step = T38_TIMED_STEP_CNG_2; - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); delay = 200000; fe->next_tx_samples = fe->samples; break; @@ -838,7 +846,7 @@ static int stream_cng(t38_terminal_state_t *s) coming the other way interrupts it, or a long timeout controlled by the T.30 engine expires. */ fe->timed_step = T38_TIMED_STEP_NONE; - delay = t38_core_send_indicator(&fe->t38, T38_IND_CNG, fe->t38.indicator_tx_count); + delay = t38_core_send_indicator(&fe->t38, T38_IND_CNG); fe->current_tx_data_type = T38_DATA_NONE; return delay; } @@ -1032,17 +1040,21 @@ SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int without_ { /* Continuous streaming mode, as used for TPKT over TCP transport */ /* Inhibit indicator packets */ - s->t38_fe.t38.indicator_tx_count = 0; - s->t38_fe.t38.data_tx_count = 1; - s->t38_fe.t38.data_end_tx_count = 1; + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_INDICATOR, 0); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA, 1); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA_END, 1); + 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; } else { /* Paced streaming mode, as used for UDP transports */ - s->t38_fe.t38.indicator_tx_count = INDICATOR_TX_COUNT; - s->t38_fe.t38.data_tx_count = DATA_TX_COUNT; - s->t38_fe.t38.data_end_tx_count = DATA_END_TX_COUNT; + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_INDICATOR, INDICATOR_TX_COUNT); + t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_CONTROL_DATA, DATA_TX_COUNT); + 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; } set_octets_per_data_packet(s, 300); @@ -1095,7 +1107,7 @@ static int t38_terminal_t38_fe_init(t38_terminal_state_t *t, (void *) t, tx_packet_handler, tx_packet_user_data); - s->t38.fastest_image_data_rate = 14400; + t38_set_fastest_image_data_rate(&s->t38, 14400); s->rx_signal_present = FALSE; s->timed_step = T38_TIMED_STEP_NONE; diff --git a/libs/spandsp/src/v17rx.c b/libs/spandsp/src/v17rx.c index a10d078f6b..322bd155bb 100644 --- a/libs/spandsp/src/v17rx.c +++ b/libs/spandsp/src/v17rx.c @@ -23,7 +23,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: v17rx.c,v 1.149 2009/06/02 16:03:56 steveu Exp $ + * $Id: v17rx.c,v 1.153 2009/07/09 14:17:57 steveu Exp $ */ /*! \file */ @@ -262,24 +262,30 @@ static __inline__ complexf_t equalizer_get(v17_rx_state_t *s) #if defined(SPANDSP_USE_FIXED_POINTx) static void tune_equalizer(v17_rx_state_t *s, const complexi16_t *z, const complexi16_t *target) +{ + complexi16_t err; + + /* Find the x and y mismatch from the exact constellation position. */ + err.re = target->re*FP_FACTOR - z->re; + err.im = target->im*FP_FACTOR - z->im; + //span_log(&s->logging, SPAN_LOG_FLOW, "Equalizer error %f\n", sqrt(err.re*err.re + err.im*err.im)); + err.re = ((int32_t) err.re*(int32_t) s->eq_delta) >> 15; + err.im = ((int32_t) err.im*(int32_t) s->eq_delta) >> 15; + cvec_circular_lmsi16(s->eq_buf, s->eq_coeff, V17_EQUALIZER_LEN, s->eq_step, &err); +} #else static void tune_equalizer(v17_rx_state_t *s, const complexf_t *z, const complexf_t *target) -#endif { complexf_t err; /* Find the x and y mismatch from the exact constellation position. */ err = complex_subf(target, z); - //span_log(&s->logging, SPAN_LOG_FLOW, "Equalizer error %f\n", sqrt(ez.re*ez.re + ez.im*ez.im)); - err.re *= s->eq_delta; - err.im *= s->eq_delta; - - err = complex_subf(target, z); + //span_log(&s->logging, SPAN_LOG_FLOW, "Equalizer error %f\n", sqrt(err.re*err.re + err.im*err.im)); err.re *= s->eq_delta; err.im *= s->eq_delta; cvec_circular_lmsf(s->eq_buf, s->eq_coeff, V17_EQUALIZER_LEN, s->eq_step, &err); } -/*- End of function --------------------------------------------------------*/ +#endif static int descramble(v17_rx_state_t *s, int in_bit) { diff --git a/libs/spandsp/src/v27ter_rx.c b/libs/spandsp/src/v27ter_rx.c index 992f701083..96e94c7ac0 100644 --- a/libs/spandsp/src/v27ter_rx.c +++ b/libs/spandsp/src/v27ter_rx.c @@ -23,7 +23,7 @@ * 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.130 2009/06/02 16:03:56 steveu Exp $ + * $Id: v27ter_rx.c,v 1.131 2009/07/08 15:11:09 steveu Exp $ */ /*! \file */ @@ -271,11 +271,7 @@ static __inline__ complexf_t equalizer_get(v27ter_rx_state_t *s) #if defined(SPANDSP_USE_FIXED_POINTx) static void tune_equalizer(v27ter_rx_state_t *s, const complexi16_t *z, const complexi16_t *target) -#else -static void tune_equalizer(v27ter_rx_state_t *s, const complexf_t *z, const complexf_t *target) -#endif { -#if defined(SPANDSP_USE_FIXED_POINTx) complexi16_t err; /* Find the x and y mismatch from the exact constellation position. */ @@ -284,7 +280,10 @@ static void tune_equalizer(v27ter_rx_state_t *s, const complexf_t *z, const comp err.re = ((int32_t) err.re*(int32_t) s->eq_delta) >> 15; err.im = ((int32_t) err.im*(int32_t) s->eq_delta) >> 15; cvec_circular_lmsi16(s->eq_buf, s->eq_coeff, V27TER_EQUALIZER_LEN, s->eq_step, &err); +} #else +static void tune_equalizer(v27ter_rx_state_t *s, const complexf_t *z, const complexf_t *target) +{ complexf_t err; /* Find the x and y mismatch from the exact constellation position. */ @@ -292,8 +291,8 @@ static void tune_equalizer(v27ter_rx_state_t *s, const complexf_t *z, const comp err.re *= s->eq_delta; err.im *= s->eq_delta; cvec_circular_lmsf(s->eq_buf, s->eq_coeff, V27TER_EQUALIZER_LEN, s->eq_step, &err); -#endif } +#endif /*- End of function --------------------------------------------------------*/ #if defined(SPANDSP_USE_FIXED_POINTx) diff --git a/libs/spandsp/src/v29rx.c b/libs/spandsp/src/v29rx.c index a3d89c70b5..47fa1b24f1 100644 --- a/libs/spandsp/src/v29rx.c +++ b/libs/spandsp/src/v29rx.c @@ -23,7 +23,7 @@ * 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.166 2009/06/02 16:03:56 steveu Exp $ + * $Id: v29rx.c,v 1.167 2009/07/08 15:11:09 steveu Exp $ */ /*! \file */ @@ -278,11 +278,7 @@ static __inline__ complexf_t equalizer_get(v29_rx_state_t *s) #if defined(SPANDSP_USE_FIXED_POINT) static void tune_equalizer(v29_rx_state_t *s, const complexi16_t *z, const complexi16_t *target) -#else -static void tune_equalizer(v29_rx_state_t *s, const complexf_t *z, const complexf_t *target) -#endif { -#if defined(SPANDSP_USE_FIXED_POINT) complexi16_t err; /* Find the x and y mismatch from the exact constellation position. */ @@ -291,7 +287,10 @@ static void tune_equalizer(v29_rx_state_t *s, const complexf_t *z, const complex err.re = ((int32_t) err.re*(int32_t) s->eq_delta) >> 15; err.im = ((int32_t) err.im*(int32_t) s->eq_delta) >> 15; cvec_circular_lmsi16(s->eq_buf, s->eq_coeff, V29_EQUALIZER_LEN, s->eq_step, &err); +} #else +static void tune_equalizer(v29_rx_state_t *s, const complexf_t *z, const complexf_t *target) +{ complexf_t err; /* Find the x and y mismatch from the exact constellation position. */ @@ -299,8 +298,8 @@ static void tune_equalizer(v29_rx_state_t *s, const complexf_t *z, const complex err.re *= s->eq_delta; err.im *= s->eq_delta; cvec_circular_lmsf(s->eq_buf, s->eq_coeff, V29_EQUALIZER_LEN, s->eq_step, &err); -#endif } +#endif /*- End of function --------------------------------------------------------*/ static int scrambled_training_bit(v29_rx_state_t *s) diff --git a/libs/spandsp/src/v8.c b/libs/spandsp/src/v8.c index 4cbcb6e860..69e9e92b3e 100644 --- a/libs/spandsp/src/v8.c +++ b/libs/spandsp/src/v8.c @@ -22,7 +22,7 @@ * 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.38 2009/02/03 16:28:40 steveu Exp $ + * $Id: v8.c,v 1.39 2009/06/24 00:34:38 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/vector_float.c b/libs/spandsp/src/vector_float.c index b08f3f27c1..ba14bcfdbc 100644 --- a/libs/spandsp/src/vector_float.c +++ b/libs/spandsp/src/vector_float.c @@ -22,7 +22,7 @@ * 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.21 2009/02/05 15:57:27 steveu Exp $ + * $Id: vector_float.c,v 1.22 2009/07/12 09:23:09 steveu Exp $ */ /*! \file */ @@ -41,33 +41,10 @@ #if defined(HAVE_MATH_H) #include #endif -#include "floating_fudge.h" #include -#if defined(SPANDSP_USE_MMX) -#include -#endif -#if defined(SPANDSP_USE_SSE) -#include -#endif -#if defined(SPANDSP_USE_SSE2) -#include -#endif -#if defined(SPANDSP_USE_SSE3) -#include -#endif -#if defined(SPANDSP_USE_SSE4_1) -#include -#endif -#if defined(SPANDSP_USE_SSE4_2) -#include -#endif -#if defined(SPANDSP_USE_SSE4A) -#include -#endif -#if defined(SPANDSP_USE_SSE5) -#include -#endif +#include "floating_fudge.h" +#include "mmx_sse_decs.h" #include "spandsp/telephony.h" #include "spandsp/vector_float.h" diff --git a/libs/spandsp/src/vector_int.c b/libs/spandsp/src/vector_int.c index 4ce779f551..71da667ee7 100644 --- a/libs/spandsp/src/vector_int.c +++ b/libs/spandsp/src/vector_int.c @@ -22,7 +22,7 @@ * 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.25 2009/02/21 04:27:46 steveu Exp $ + * $Id: vector_int.c,v 1.26 2009/07/12 09:23:09 steveu Exp $ */ /*! \file */ @@ -41,33 +41,10 @@ #if defined(HAVE_MATH_H) #include #endif -#include "floating_fudge.h" #include -#if defined(SPANDSP_USE_MMX) -#include -#endif -#if defined(SPANDSP_USE_SSE) -#include -#endif -#if defined(SPANDSP_USE_SSE2) -#include -#endif -#if defined(SPANDSP_USE_SSE3) -#include -#endif -#if defined(SPANDSP_USE_SSE4_1) -#include -#endif -#if defined(SPANDSP_USE_SSE4_2) -#include -#endif -#if defined(SPANDSP_USE_SSE4A) -#include -#endif -#if defined(SPANDSP_USE_SSE5) -#include -#endif +#include "floating_fudge.h" +#include "mmx_sse_decs.h" #include "spandsp/telephony.h" #include "spandsp/vector_int.h" diff --git a/libs/spandsp/tests/fsk_tests.c b/libs/spandsp/tests/fsk_tests.c index bdb1da838b..40d83ceb08 100644 --- a/libs/spandsp/tests/fsk_tests.c +++ b/libs/spandsp/tests/fsk_tests.c @@ -22,7 +22,7 @@ * 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.57 2009/05/30 15:23:13 steveu Exp $ + * $Id: fsk_tests.c,v 1.58 2009/07/09 13:52:09 steveu Exp $ */ /*! \page fsk_tests_page FSK modem tests @@ -126,37 +126,37 @@ static void reporter(void *user_data, int reason, bert_results_t *results) switch (reason) { case BERT_REPORT_SYNCED: - printf("%d: BERT report synced\n", channel); + fprintf(stderr, "%d: BERT report synced\n", channel); break; case BERT_REPORT_UNSYNCED: - printf("%d: BERT report unsync'ed\n", channel); + fprintf(stderr, "%d: BERT report unsync'ed\n", channel); break; case BERT_REPORT_REGULAR: - printf("%d: BERT report regular - %d bits, %d bad bits, %d resyncs\n", channel, results->total_bits, results->bad_bits, results->resyncs); + fprintf(stderr, "%d: BERT report regular - %d bits, %d bad bits, %d resyncs\n", channel, results->total_bits, results->bad_bits, results->resyncs); break; case BERT_REPORT_GT_10_2: - printf("%d: BERT report > 1 in 10^2\n", channel); + fprintf(stderr, "%d: BERT report > 1 in 10^2\n", channel); break; case BERT_REPORT_LT_10_2: - printf("%d: BERT report < 1 in 10^2\n", channel); + fprintf(stderr, "%d: BERT report < 1 in 10^2\n", channel); break; case BERT_REPORT_LT_10_3: - printf("%d: BERT report < 1 in 10^3\n", channel); + fprintf(stderr, "%d: BERT report < 1 in 10^3\n", channel); break; case BERT_REPORT_LT_10_4: - printf("%d: BERT report < 1 in 10^4\n", channel); + fprintf(stderr, "%d: BERT report < 1 in 10^4\n", channel); break; case BERT_REPORT_LT_10_5: - printf("%d: BERT report < 1 in 10^5\n", channel); + fprintf(stderr, "%d: BERT report < 1 in 10^5\n", channel); break; case BERT_REPORT_LT_10_6: - printf("%d: BERT report < 1 in 10^6\n", channel); + fprintf(stderr, "%d: BERT report < 1 in 10^6\n", channel); break; case BERT_REPORT_LT_10_7: - printf("%d: BERT report < 1 in 10^7\n", channel); + fprintf(stderr, "%d: BERT report < 1 in 10^7\n", channel); break; default: - printf("%d: BERT report reason %d\n", channel, reason); + fprintf(stderr, "%d: BERT report reason %d\n", channel, reason); break; } } diff --git a/libs/spandsp/tests/t38_core_tests.c b/libs/spandsp/tests/t38_core_tests.c index 307855dc4a..57562452e5 100644 --- a/libs/spandsp/tests/t38_core_tests.c +++ b/libs/spandsp/tests/t38_core_tests.c @@ -22,7 +22,7 @@ * 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.15 2009/04/25 14:17:47 steveu Exp $ + * $Id: t38_core_tests.c,v 1.16 2009/07/14 13:54:22 steveu Exp $ */ /*! \file */ @@ -138,7 +138,7 @@ static int encode_decode_tests(t38_core_state_t *a, t38_core_state_t *b) for (i = 0; i < 100; i++) { current_indicator = i; - if (t38_core_send_indicator(a, i, 3) < 0) + if (t38_core_send_indicator(a, i) < 0) break; } @@ -150,7 +150,7 @@ static int encode_decode_tests(t38_core_state_t *a, t38_core_state_t *b) current_data_type = i; current_field_type = j; skip = 99; - if (t38_core_send_data(a, i, j, (uint8_t *) "", 0, 1) < 0) + if (t38_core_send_data(a, i, j, (uint8_t *) "", 0, T38_PACKET_CATEGORY_CONTROL_DATA) < 0) break; } if (j == 0) @@ -165,7 +165,7 @@ static int encode_decode_tests(t38_core_state_t *a, t38_core_state_t *b) current_data_type = i; current_field_type = j; skip = 99; - if (t38_core_send_data(a, i, j, (uint8_t *) "ABCD", 4, 1) < 0) + if (t38_core_send_data(a, i, j, (uint8_t *) "ABCD", 4, T38_PACKET_CATEGORY_CONTROL_DATA) < 0) break; } if (j == 0) @@ -190,7 +190,7 @@ static int encode_decode_tests(t38_core_state_t *a, t38_core_state_t *b) field[1].field_type = T38_FIELD_T4_NON_ECM_SIG_END; field[1].field = field_body[1]; field[1].field_len = field_len[1]; - if (t38_core_send_data_multi_field(a, i, field, 2, 1) < 0) + if (t38_core_send_data_multi_field(a, i, field, 2, T38_PACKET_CATEGORY_CONTROL_DATA) < 0) break; } if (j == 0) diff --git a/libs/spandsp/tests/v17_tests.c b/libs/spandsp/tests/v17_tests.c index 41d9adc56d..ec9b901866 100644 --- a/libs/spandsp/tests/v17_tests.c +++ b/libs/spandsp/tests/v17_tests.c @@ -23,7 +23,7 @@ * 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.103 2009/05/30 15:23:14 steveu Exp $ + * $Id: v17_tests.c,v 1.104 2009/07/09 13:52:09 steveu Exp $ */ /*! \page v17_tests_page V.17 modem tests @@ -104,11 +104,11 @@ static void reporter(void *user_data, int reason, bert_results_t *results) switch (reason) { case BERT_REPORT_REGULAR: - printf("BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs); + fprintf(stderr, "BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs); memcpy(&latest_results, results, sizeof(latest_results)); break; default: - printf("BERT report %s\n", bert_event_to_str(reason)); + fprintf(stderr, "BERT report %s\n", bert_event_to_str(reason)); break; } } diff --git a/libs/spandsp/tests/v22bis_tests.c b/libs/spandsp/tests/v22bis_tests.c index 725748936f..74c4347dbe 100644 --- a/libs/spandsp/tests/v22bis_tests.c +++ b/libs/spandsp/tests/v22bis_tests.c @@ -22,7 +22,7 @@ * 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.62 2009/05/30 15:23:14 steveu Exp $ + * $Id: v22bis_tests.c,v 1.63 2009/07/09 13:52:09 steveu Exp $ */ /*! \page v22bis_tests_page V.22bis modem tests @@ -94,17 +94,18 @@ static void reporter(void *user_data, int reason, bert_results_t *results) switch (reason) { case BERT_REPORT_REGULAR: - printf("V.22bis rx %p BERT report regular - %d bits, %d bad bits, %d resyncs\n", - user_data, - results->total_bits, - results->bad_bits, - results->resyncs); + fprintf(stderr, "V.22bis rx %p BERT report regular - %d bits, %d bad bits, %d resyncs\n", + user_data, + results->total_bits, + results->bad_bits, + results->resyncs); memcpy(&s->latest_results, results, sizeof(s->latest_results)); break; default: - printf("V.22bis rx %p BERT report %s\n", - user_data, - bert_event_to_str(reason)); + fprintf(stderr, + "V.22bis rx %p BERT report %s\n", + user_data, + bert_event_to_str(reason)); break; } } diff --git a/libs/spandsp/tests/v27ter_tests.c b/libs/spandsp/tests/v27ter_tests.c index 35ecc10fce..6fa3e4b307 100644 --- a/libs/spandsp/tests/v27ter_tests.c +++ b/libs/spandsp/tests/v27ter_tests.c @@ -22,7 +22,7 @@ * 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.105 2009/05/30 15:23:14 steveu Exp $ + * $Id: v27ter_tests.c,v 1.106 2009/07/09 13:52:09 steveu Exp $ */ /*! \page v27ter_tests_page V.27ter modem tests @@ -100,11 +100,11 @@ static void reporter(void *user_data, int reason, bert_results_t *results) switch (reason) { case BERT_REPORT_REGULAR: - printf("BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs); + fprintf(stderr, "BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs); memcpy(&latest_results, results, sizeof(latest_results)); break; default: - printf("BERT report %s\n", bert_event_to_str(reason)); + fprintf(stderr, "BERT report %s\n", bert_event_to_str(reason)); break; } } diff --git a/libs/spandsp/tests/v29_tests.c b/libs/spandsp/tests/v29_tests.c index d295a2dfae..fc9ee96711 100644 --- a/libs/spandsp/tests/v29_tests.c +++ b/libs/spandsp/tests/v29_tests.c @@ -22,7 +22,7 @@ * 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.119 2009/05/30 15:23:14 steveu Exp $ + * $Id: v29_tests.c,v 1.120 2009/07/09 13:52:09 steveu Exp $ */ /*! \page v29_tests_page V.29 modem tests @@ -99,11 +99,11 @@ static void reporter(void *user_data, int reason, bert_results_t *results) switch (reason) { case BERT_REPORT_REGULAR: - printf("BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs); + fprintf(stderr, "BERT report regular - %d bits, %d bad bits, %d resyncs\n", results->total_bits, results->bad_bits, results->resyncs); memcpy(&latest_results, results, sizeof(latest_results)); break; default: - printf("BERT report %s\n", bert_event_to_str(reason)); + fprintf(stderr, "BERT report %s\n", bert_event_to_str(reason)); break; } }