]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Various tweaks to spandsp. Cleaned up a few MSVC issues with spandsp
authorSteve Underwood <steveu@coppice.org>
Wed, 18 Jul 2012 13:46:58 +0000 (21:46 +0800)
committerSteve Underwood <steveu@coppice.org>
Wed, 18 Jul 2012 13:46:58 +0000 (21:46 +0800)
17 files changed:
libs/spandsp/src/fax_modems.c
libs/spandsp/src/msvc/inttypes.h
libs/spandsp/src/msvc/spandsp.h
libs/spandsp/src/spandsp/private/fax_modems.h
libs/spandsp/src/spandsp/private/v17rx.h
libs/spandsp/src/spandsp/private/v22bis.h
libs/spandsp/src/spandsp/private/v27ter_rx.h
libs/spandsp/src/spandsp/private/v29rx.h
libs/spandsp/src/spandsp/private/v29tx.h
libs/spandsp/src/spandsp/v17rx.h
libs/spandsp/src/spandsp/v22bis.h
libs/spandsp/src/spandsp/v27ter_rx.h
libs/spandsp/src/spandsp/v29rx.h
libs/spandsp/src/t30.c
libs/spandsp/src/t31.c
libs/spandsp/src/t4_tx.c
libs/spandsp/src/t85_encode.c

index 6bc7e05ea8f545bdce80377dd3cc5e8f6ac610c0..c2d20df2b75a20c3900f0ecf14a9e9dc31d813a8 100644 (file)
@@ -100,6 +100,7 @@ SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx(void *user_data, const int16_t am
         s->rx_handler = (span_rx_handler_t) &fsk_rx;
         s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin;
         s->rx_user_data = &s->v21_rx;
+        s->rx_fillin_user_data = &s->v21_rx;
     }
     /*endif*/
     return 0;
@@ -131,6 +132,7 @@ SPAN_DECLARE_NONSTD(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t
         s->rx_handler = (span_rx_handler_t) &fsk_rx;
         s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin;
         s->rx_user_data = &s->v21_rx;
+        s->rx_fillin_user_data = &s->v21_rx;
     }
     /*endif*/
     return 0;
@@ -162,6 +164,7 @@ SPAN_DECLARE_NONSTD(int) fax_modems_v29_v21_rx(void *user_data, const int16_t am
         s->rx_handler = (span_rx_handler_t) &fsk_rx;
         s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin;
         s->rx_user_data = &s->v21_rx;
+        s->rx_fillin_user_data = &s->v21_rx;
     }
     /*endif*/
     return 0;
@@ -201,6 +204,7 @@ static void v17_rx_status_handler(void *user_data, int status)
         s->rx_handler = (span_rx_handler_t) &v17_rx;
         s->rx_fillin_handler = (span_rx_fillin_handler_t) &v17_rx_fillin;
         s->rx_user_data = &s->fast_modems.v17_rx;
+        s->rx_fillin_user_data = &s->fast_modems.v17_rx;
         break;
     }
     /*endswitch*/
@@ -219,6 +223,7 @@ static void v27ter_rx_status_handler(void *user_data, int status)
         s->rx_handler = (span_rx_handler_t) &v27ter_rx;
         s->rx_fillin_handler = (span_rx_fillin_handler_t) &v27ter_rx_fillin;
         s->rx_user_data = &s->fast_modems.v27ter_rx;
+        s->rx_fillin_user_data = &s->fast_modems.v27ter_rx;
         break;
     }
     /*endswitch*/
@@ -237,6 +242,7 @@ static void v29_rx_status_handler(void *user_data, int status)
         s->rx_handler = (span_rx_handler_t) &v29_rx;
         s->rx_fillin_handler = (span_rx_fillin_handler_t) &v29_rx_fillin;
         s->rx_user_data = &s->fast_modems.v29_rx;
+        s->rx_fillin_user_data = &s->fast_modems.v29_rx;
         break;
     }
     /*endswitch*/
@@ -326,6 +332,7 @@ SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s,
     s->rx_handler = (span_rx_handler_t) &span_dummy_rx;
     s->rx_fillin_handler = (span_rx_fillin_handler_t) &span_dummy_rx;
     s->rx_user_data = NULL;
+    s->rx_fillin_user_data = NULL;
     s->tx_handler = (span_tx_handler_t) &silence_gen;
     s->tx_user_data = &s->silence_gen;
     return s;
index 81ab70dec4ae3fc9c26234c9996eb0673d03c04e..beb93cae10b8aedc5cc57e30474ef03f6913ebdf 100644 (file)
@@ -43,6 +43,9 @@ typedef __int64                       int64_t;
 #if !defined(UINT16_MAX)
 #define UINT16_MAX  0xFFFF
 #endif
+#if !defined(UINT32_MAX)
+#define UINT32_MAX     0xFFFFFFFF
+#endif
 
 #if !defined(INT16_MAX)
 #define INT16_MAX   0x7FFF 
index 0abd28068f1cc1d4578e63f13a048c9abfd6d80c..f6d7f0cd3b9b8c8cc182930139869fb944a4aa5e 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 */
 
 #define SPANDSP_USE_EXPORT_CAPABILITY 1
 
+#undef SPANDSP_SUPPORT_T42
+#undef SPANDSP_SUPPORT_T43
+#undef SPANDSP_SUPPORT_V34
+
 #include <stdlib.h>
 #include <msvc/inttypes.h>
 #include <string.h>
@@ -56,6 +58,7 @@
 #include <spandsp/schedule.h>
 #include <spandsp/g711.h>
 #include <spandsp/timing.h>
+#include <spandsp/math_fixed.h>
 #include <spandsp/vector_float.h>
 #include <spandsp/complex_vector_float.h>
 #include <spandsp/vector_int.h>
@@ -88,6 +91,9 @@
 #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/v22bis.h>
 #include <spandsp/v27ter_rx.h>
 #include <spandsp/v27ter_tx.h>
-#include <spandsp/v8.h>
 #include <spandsp/v18.h>
-#include <spandsp/v42.h>
-#include <spandsp/v42bis.h>
 #include <spandsp/timezone.h>
 #include <spandsp/t4_rx.h>
 #include <spandsp/t4_tx.h>
-#include <spandsp/t4_t6_decode.h>\r
+#include <spandsp/image_translate.h>
+#include <spandsp/t4_t6_decode.h>
 #include <spandsp/t4_t6_encode.h>
-#include <spandsp/t81_t82_arith_coding.h>\r
+#include <spandsp/t81_t82_arith_coding.h>
 #include <spandsp/t85.h>
+#if defined(SPANDSP_SUPPORT_T42)
+#include <spandsp/t42.h>
+#endif
+#if defined(SPANDSP_SUPPORT_T43)
+#include <spandsp/t43.h>
+#endif
 #include <spandsp/t30.h>
 #include <spandsp/t30_api.h>
 #include <spandsp/t30_fcf.h>
index f45969bb94754eda9a61c65505207afdd00d6f71..90aa47367a79496d593f0892a2cfb21a0439e5aa 100644 (file)
@@ -99,6 +99,7 @@ struct fax_modems_state_s
     /*! \brief The current receive missing signal fill-in handler */
     span_rx_fillin_handler_t rx_fillin_handler;
     void *rx_user_data;
+    void *rx_fillin_user_data;
 
     /*! \brief The current transmit signal handler */
     span_tx_handler_t tx_handler;
@@ -109,12 +110,12 @@ struct fax_modems_state_s
     span_tx_handler_t next_tx_handler;
     void *next_tx_user_data;
 
-    /*! The current bit rate of the transmitter. */
+    /*! \brief The current bit rate of the transmitter. */
     int tx_bit_rate;
-    /*! The current bit rate of the receiver. */
+    /*! \brief The current bit rate of the receiver. */
     int rx_bit_rate;
 
-    /*! If TRUE, transmission is in progress */
+    /*! \brief If TRUE, transmission is in progress */
     int transmit;
     /*! \brief Audio logging file handle for received audio. */
     int audio_rx_log;
index 8da0967a4a860eb1eb2d10c1d16fe0f0c17af79c..81c7027cb2fad49fce3816e484a4bb6c66ecfcc2 100644 (file)
@@ -73,7 +73,7 @@ struct v17_rx_state_s
     void *qam_user_data;
 
 #if defined(SPANDSP_USE_FIXED_POINTx)
-    /*! \brief The scaling factor accessed by the AGC algorithm. */
+    /*! \brief The scaling factor assessed by the AGC algorithm. */
     float agc_scaling;
     /*! \brief The previous value of agc_scaling, needed to reuse old training. */
     float agc_scaling_save;
@@ -110,7 +110,7 @@ struct v17_rx_state_s
     /*! \brief A pointer to the current constellation. */
     const complexi16_t *constellation;
 #else
-    /*! \brief The scaling factor accessed by the AGC algorithm. */
+    /*! \brief The scaling factor assessed by the AGC algorithm. */
     float agc_scaling;
     /*! \brief The previous value of agc_scaling, needed to reuse old training. */
     float agc_scaling_save;
@@ -150,7 +150,7 @@ struct v17_rx_state_s
     /*! \brief Current offset into the RRC pulse shaping filter buffer. */
     int rrc_filter_step;
 
-    /*! \brief The state of the differential decoder */
+    /*! \brief The current state of the differential decoder */
     int diff;
     /*! \brief The register for the data scrambler. */
     uint32_t scramble_reg;
@@ -228,7 +228,6 @@ struct v17_rx_state_s
                from the last states of the trellis. */
     float distances[8];
 #endif
-
     /*! \brief Error and flow logging control */
     logging_state_t logging;
 };
index dca574df77710939335e6aee530d74b13ca4bd22..48e4c427146e26e35a00957ff9461b4cd85ec637 100644 (file)
@@ -65,6 +65,12 @@ enum
     V22BIS_TX_TRAINING_STAGE_PARKED
 };
 
+#if defined(SPANDSP_USE_FIXED_POINTx)
+extern const complexi16_t v22bis_constellation[16];
+#else
+extern const complexf_t v22bis_constellation[16];
+#endif
+
 /*!
     V.22bis modem descriptor. This defines the working state for a single instance
     of a V.22bis modem.
@@ -93,10 +99,11 @@ struct v22bis_state_s
     /* Receive section */
     struct
     {
-        /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
 #if defined(SPANDSP_USE_FIXED_POINTx)
+        /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
         int16_t rrc_filter[V22BIS_RX_FILTER_STEPS];
 #else
+        /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
         float rrc_filter[V22BIS_RX_FILTER_STEPS];
 #endif
         /*! \brief Current offset into the RRC pulse shaping filter buffer. */
@@ -156,7 +163,9 @@ struct v22bis_state_s
         /*! \brief The equalizer signal buffer. */
         complexi_t eq_buf[V22BIS_EQUALIZER_MASK + 1];
 #else
+        /*! \brief The adaptive equalizer coefficients. */
         complexf_t eq_coeff[2*V22BIS_EQUALIZER_LEN + 1];
+        /*! \brief The equalizer signal buffer. */
         complexf_t eq_buf[V22BIS_EQUALIZER_MASK + 1];
 #endif
         /*! \brief Current offset into the equalizer buffer. */
@@ -186,7 +195,7 @@ struct v22bis_state_s
         /*! \brief The gain factor needed to achieve the specified output power. */
         float gain;
 
-        /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
+        /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
         complexf_t rrc_filter[2*V22BIS_TX_FILTER_STEPS];
         /*! \brief Current offset into the RRC pulse shaping filter buffer. */
         int rrc_filter_step;
index 4a991ba3f5e7e0bbe79cd806f8d778643604aa5b..c491c905df2ea48e973060c75e947dee0475a278 100644 (file)
@@ -70,7 +70,7 @@ struct v27ter_rx_state_s
     void *qam_user_data;
 
 #if defined(SPANDSP_USE_FIXED_POINT)
-    /*! \brief The scaling factor accessed by the AGC algorithm. */
+    /*! \brief The scaling factor assessed by the AGC algorithm. */
     int16_t agc_scaling;
     /*! \brief The previous value of agc_scaling, needed to reuse old training. */
     int16_t agc_scaling_save;
@@ -95,7 +95,7 @@ struct v27ter_rx_state_s
     /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
     int16_t rrc_filter[V27TER_RX_FILTER_STEPS];
 #else
-    /*! \brief The scaling factor accessed by the AGC algorithm. */
+    /*! \brief The scaling factor assessed by the AGC algorithm. */
     float agc_scaling;
     /*! \brief The previous value of agc_scaling, needed to reuse old training. */
     float agc_scaling_save;
index ee7cd9932c348aa20ef2819dad02b0f6e74f29ca..c86c87fe2e07e78840d04a4a06180a9872e7d955 100644 (file)
@@ -61,10 +61,73 @@ struct v29_rx_state_s
                routine. */
     void *qam_user_data;
 
-    /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
 #if defined(SPANDSP_USE_FIXED_POINT)
+    /*! \brief The scaling factor assessed by the AGC algorithm. */
+    int16_t agc_scaling;
+    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
+    int16_t agc_scaling_save;
+
+    /*! \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_LEN];
+    /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
+    complexi16_t eq_coeff_save[V29_EQUALIZER_LEN];
+    /*! \brief The equalizer signal buffer. */
+    complexi16_t eq_buf[V29_EQUALIZER_LEN];
+
+    /*! Low band edge filter for symbol sync. */
+    int32_t symbol_sync_low[2];
+    /*! High band edge filter for symbol sync. */
+    int32_t symbol_sync_high[2];
+    /*! DC filter for symbol sync. */
+    int32_t symbol_sync_dc_filter[2];
+    /*! Baud phase for symbol sync. */
+    int32_t baud_phase;
+
+    /*! \brief A measure of how much mismatch there is between the real constellation,
+               and the decoded symbol positions. */
+    float training_error;
+
+    /*! \brief The proportional part of the carrier tracking filter. */
+    int32_t carrier_track_p;
+    /*! \brief The integral part of the carrier tracking filter. */
+    int32_t carrier_track_i;
+    /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
     int16_t rrc_filter[V29_RX_FILTER_STEPS];
 #else
+    /*! \brief The scaling factor assessed by the AGC algorithm. */
+    float agc_scaling;
+    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
+    float agc_scaling_save;
+
+    /*! \brief The current delta factor for updating the equalizer coefficients. */
+    float eq_delta;
+    /*! \brief The adaptive equalizer coefficients. */
+    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_LEN];
+    /*! \brief The equalizer signal buffer. */
+    complexf_t eq_buf[V29_EQUALIZER_LEN];
+
+    /*! Low band edge filter for symbol sync. */
+    float symbol_sync_low[2];
+    /*! High band edge filter for symbol sync. */
+    float symbol_sync_high[2];
+    /*! DC filter for symbol sync. */
+    float symbol_sync_dc_filter[2];
+    /*! Baud phase for symbol sync. */
+    float baud_phase;
+
+    /*! \brief A measure of how much mismatch there is between the real constellation,
+               and the decoded symbol positions. */
+    float training_error;
+
+    /*! \brief The proportional part of the carrier tracking filter. */
+    float carrier_track_p;
+    /*! \brief The integral part of the carrier tracking filter. */
+    float carrier_track_i;
+    /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
     float rrc_filter[V29_RX_FILTER_STEPS];
 #endif
     /*! \brief Current offset into the RRC pulse shaping filter buffer. */
@@ -82,9 +145,6 @@ struct v29_rx_state_s
     int training_stage;
     /*! \brief A count of how far through the current training step we are. */
     int training_count;
-    /*! \brief A measure of how much mismatch there is between the real constellation,
-        and the decoded symbol positions. */
-    float training_error;
     /*! \brief The value of the last signal sample, using the a simple HPF for signal power estimation. */
     int16_t last_sample;
     /*! \brief >0 if a signal above the minimum is present. It may or may not be a V.29 signal. */
@@ -96,27 +156,12 @@ struct v29_rx_state_s
     /*! \brief A highest magnitude sample seen. */
     int16_t high_sample;
 
-    /*! \brief The position of the current symbol in the constellation, used for
-               differential decoding. */
-    int constellation_state;
-
     /*! \brief The current phase of the carrier (i.e. the DDS parameter). */
     uint32_t carrier_phase;
     /*! \brief The update rate for the phase of the carrier (i.e. the DDS increment). */
     int32_t carrier_phase_rate;
     /*! \brief The carrier update rate saved for reuse when using short training. */
     int32_t carrier_phase_rate_save;
-#if defined(SPANDSP_USE_FIXED_POINT)
-    /*! \brief The proportional part of the carrier tracking filter. */
-    int32_t carrier_track_p;
-    /*! \brief The integral part of the carrier tracking filter. */
-    int32_t carrier_track_i;
-#else
-    /*! \brief The proportional part of the carrier tracking filter. */
-    float carrier_track_p;
-    /*! \brief The integral part of the carrier tracking filter. */
-    float carrier_track_i;
-#endif
 
     /*! \brief A power meter, to measure the HPF'ed signal power in the channel. */    
     power_meter_t power;
@@ -135,54 +180,6 @@ struct v29_rx_state_s
     /*! \brief The current half of the baud. */
     int baud_half;
 
-#if defined(SPANDSP_USE_FIXED_POINT)
-    /*! \brief The scaling factor accessed by the AGC algorithm. */
-    int16_t agc_scaling;
-    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
-    int16_t agc_scaling_save;
-
-    /*! \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_LEN];
-    /*! \brief A saved set of adaptive equalizer coefficients for use after restarts. */
-    complexi16_t eq_coeff_save[V29_EQUALIZER_LEN];
-    /*! \brief The equalizer signal buffer. */
-    complexi16_t eq_buf[V29_EQUALIZER_LEN];
-
-    /*! Low band edge filter for symbol sync. */
-    int32_t symbol_sync_low[2];
-    /*! High band edge filter for symbol sync. */
-    int32_t symbol_sync_high[2];
-    /*! DC filter for symbol sync. */
-    int32_t symbol_sync_dc_filter[2];
-    /*! Baud phase for symbol sync. */
-    int32_t baud_phase;
-#else
-    /*! \brief The scaling factor accessed by the AGC algorithm. */
-    float agc_scaling;
-    /*! \brief The previous value of agc_scaling, needed to reuse old training. */
-    float agc_scaling_save;
-
-    /*! \brief The current delta factor for updating the equalizer coefficients. */
-    float eq_delta;
-    /*! \brief The adaptive equalizer coefficients. */
-    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_LEN];
-    /*! \brief The equalizer signal buffer. */
-    complexf_t eq_buf[V29_EQUALIZER_LEN];
-
-    /*! Low band edge filter for symbol sync. */
-    float symbol_sync_low[2];
-    /*! High band edge filter for symbol sync. */
-    float symbol_sync_high[2];
-    /*! DC filter for symbol sync. */
-    float symbol_sync_dc_filter[2];
-    /*! Baud phase for symbol sync. */
-    float baud_phase;
-#endif
-
     /*! \brief The total symbol timing correction since the carrier came up.
                This is only for performance analysis purposes. */
     int total_baud_timing_correction;
@@ -191,6 +188,11 @@ struct v29_rx_state_s
     int32_t start_angles[2];
     /*! \brief History list of phase angles for the coarse carrier aquisition step. */
     int32_t angles[16];
+
+    /*! \brief The position of the current symbol in the constellation, used for
+               differential decoding. */
+    int constellation_state;
+
     /*! \brief Error and flow logging control */
     logging_state_t logging;
 };
index 062ef7ee5c05787136aa9bdd6cae5b6f536eeb44..034631ef87b563d21a593fa76115b7a9a3a4502f 100644 (file)
@@ -47,21 +47,23 @@ struct v29_tx_state_s
     /*! \brief A user specified opaque pointer passed to the status function. */
     void *status_user_data;
 
+#if defined(SPANDSP_USE_FIXED_POINT)
     /*! \brief Gain required to achieve the specified output power, not allowing
                for the size of the current constellation. */
     float base_gain;
     /*! \brief Gain required to achieve the specified output power, allowing
                for the size of the current constellation. */
-#if defined(SPANDSP_USE_FIXED_POINT)
     int32_t gain;
-#else
-    float gain;
-#endif
-
-    /*! \brief The route raised cosine (RRC) pulse shaping filter buffer. */
-#if defined(SPANDSP_USE_FIXED_POINT)
+    /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
     complexi16_t rrc_filter[2*V29_TX_FILTER_STEPS];
 #else
+    /*! \brief Gain required to achieve the specified output power, not allowing
+               for the size of the current constellation. */
+    float base_gain;
+    /*! \brief Gain required to achieve the specified output power, allowing
+               for the size of the current constellation. */
+    float gain;
+    /*! \brief The root raised cosine (RRC) pulse shaping filter buffer. */
     complexf_t rrc_filter[2*V29_TX_FILTER_STEPS];
 #endif
     /*! \brief Current offset into the RRC pulse shaping filter buffer. */
index d6ac46caa10f745e9b5cb75b77bf6fe74d3cc65c..4c01befd37bd02a6631b7b4c3b199964743f2b61 100644 (file)
@@ -293,7 +293,7 @@ SPAN_DECLARE_NONSTD(int) v17_rx_fillin(v17_rx_state_t *s, int len);
     \param coeffs The vector of complex coefficients.
     \return The number of coefficients in the vector. */
 #if defined(SPANDSP_USE_FIXED_POINTx)
-SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexi_t **coeffs);
+SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexi16_t **coeffs);
 #else
 SPAN_DECLARE(int) v17_rx_equalizer_state(v17_rx_state_t *s, complexf_t **coeffs);
 #endif
index 073fb7135adb0b815eae6cbce2135528d0cdb2a8..6ecd91773e9ba398b1f7f202eef40cad0634ee55 100644 (file)
@@ -61,8 +61,6 @@ enum
 */
 typedef struct v22bis_state_s v22bis_state_t;
 
-extern const complexf_t v22bis_constellation[16];
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -88,7 +86,11 @@ SPAN_DECLARE_NONSTD(int) v22bis_rx_fillin(v22bis_state_t *s, int len);
     \brief Get a snapshot of the current equalizer coefficients.
     \param coeffs The vector of complex coefficients.
     \return The number of coefficients in the vector. */
+#if defined(SPANDSP_USE_FIXED_POINTx)
+SPAN_DECLARE(int) v22bis_rx_equalizer_state(v22bis_state_t *s, complexi16_t **coeffs);
+#else
 SPAN_DECLARE(int) v22bis_rx_equalizer_state(v22bis_state_t *s, complexf_t **coeffs);
+#endif
 
 /*! Get the current received carrier frequency.
     \param s The modem context.
index bb12801b50ed74386d6f6b2d289b8ea896b2db5a..8e8de0d0738ceb16121b011ffcc699fbf117fa11 100644 (file)
@@ -126,7 +126,11 @@ SPAN_DECLARE_NONSTD(int) v27ter_rx_fillin(v27ter_rx_state_t *s, int len);
     \brief Get a snapshot of the current equalizer coefficients.
     \param coeffs The vector of complex coefficients.
     \return The number of coefficients in the vector. */
+#if defined(SPANDSP_USE_FIXED_POINTx)
+SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexi16_t **coeffs);
+#else
 SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexf_t **coeffs);
+#endif
 
 /*! Get the current received carrier frequency.
     \param s The modem context.
index d7874b68dc968a9f3a3474923d8bfba5c804520b..8c89407ce3a673b46e46800807e5a70cfbdfa65c 100644 (file)
@@ -118,7 +118,11 @@ scrambler register) cannot be trusted for the test. The receive modem,
 therefore, only tests that bits starting at bit 24 are really ones. 
 */
 
+#if defined(SPANDSP_USE_FIXED_POINTx)
+typedef void (*qam_report_handler_t)(void *user_data, const complexi16_t *constel, const complexi16_t *target, int symbol);
+#else
 typedef void (*qam_report_handler_t)(void *user_data, const complexf_t *constel, const complexf_t *target, int symbol);
+#endif
 
 /*!
     V.29 modem receive side descriptor. This defines the working state for a
index 5db995ddc772ee71541c3b5ef6a5e964588ff10e..e25e77b41a256f38c1fd68a9f152df98e0c5f75b 100644 (file)
@@ -5633,7 +5633,7 @@ SPAN_DECLARE(int) t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_
         break;
     default:
         span_log(&s->logging, SPAN_LOG_WARNING, "t30_non_ecm_get_chunk in bad state %d\n", s->state);
-        len = 0;
+        len = -1;
         break;
     }
     return len;
index 2ed6a9e24d3dddc1557157f6a07aff70d192713a..a1af29d577bb6df4d732b7915d9a70c5998862a7 100644 (file)
@@ -724,13 +724,21 @@ 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);
+            {
+                if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL)) < 0)
+                {
+                    /* ???????? */
+                }
+            }
             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);
+            if ((delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator)) < 0)
+            {
+                /* ???????? */
+            }
             fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_3;
             break;
         case T38_TIMED_STEP_NON_ECM_MODEM_3:
@@ -762,12 +770,18 @@ 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, T38_PACKET_CATEGORY_IMAGE_DATA_END);
+                    if (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) < 0)
+                    {
+                        /* ???????? */
+                    }
                     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, T38_PACKET_CATEGORY_IMAGE_DATA);
+            if (t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA) < 0)
+            {
+                /* ???????? */
+            }
             delay = bits_to_us(s, 8*len);
             break;
         case T38_TIMED_STEP_NON_ECM_MODEM_4:
@@ -778,7 +792,10 @@ 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, T38_PACKET_CATEGORY_IMAGE_DATA_END);
+                if (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) < 0)
+                {
+                    /* ???????? */
+                }
                 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. */
@@ -789,13 +806,19 @@ 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, T38_PACKET_CATEGORY_IMAGE_DATA);
+            if (t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA) < 0)
+            {
+                /* ???????? */
+            }
             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);
+            if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL)) < 0)
+            {
+                /* ???????? */
+            }
             fe->timed_step = T38_TIMED_STEP_NONE;
             return delay;
         }
@@ -822,13 +845,21 @@ 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);
+            {
+                if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL)) < 0)
+                {
+                    /* ???????? */
+                }
+            }
             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);
+            if ((delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator)) < 0)
+            {
+                /* ???????? */
+            }
             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;
@@ -864,7 +895,10 @@ static int stream_hdlc(t31_state_t *s)
                         data_fields[1].field = NULL;
                         data_fields[1].field_len = 0;
                         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);
+                        if (t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category) < 0)
+                        {
+                            /* ???????? */
+                        }
                         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. */
@@ -880,7 +914,10 @@ static int stream_hdlc(t31_state_t *s)
                         data_fields[1].field = NULL;
                         data_fields[1].field_len = 0;
                         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);
+                        if (t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category) < 0)
+                        {
+                            /* ???????? */
+                        }
                         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);
@@ -888,14 +925,20 @@ static int stream_hdlc(t31_state_t *s)
                     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);
+                if (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) < 0)
+                {
+                    /* ???????? */
+                }
                 fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_4;
             }
             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);
+                if (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) < 0)
+                {
+                    /* ???????? */
+                }
                 s->hdlc_tx.ptr += i;
             }
             delay = bits_to_us(s, i*8);
@@ -911,7 +954,10 @@ static int stream_hdlc(t31_state_t *s)
                 s->hdlc_tx.len = 0;
                 s->hdlc_tx.final = FALSE;
                 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);
+                if (t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, category) < 0)
+                {
+                    /* ???????? */
+                }
                 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. */
@@ -923,7 +969,10 @@ static int stream_hdlc(t31_state_t *s)
             }
             /* 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);
+            if (t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, category) < 0)
+            {
+                /* ???????? */
+            }
             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. */
@@ -935,8 +984,14 @@ static int stream_hdlc(t31_state_t *s)
             /* 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. */
             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);
+            if (t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_SIG_END, NULL, 0, category) < 0)
+            {
+                /* ???????? */
+            }
+            if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL)) < 0)
+            {
+                /* ???????? */
+            }
             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);
@@ -963,14 +1018,20 @@ 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);
+            if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL)) < 0)
+            {
+                /* ???????? */
+            }
             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);
+            if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_CED)) < 0)
+            {
+                /* ???????? */
+            }
             fe->current_tx_data_type = T38_DATA_NONE;
             break;
         case T38_TIMED_STEP_CED_3:
@@ -1000,7 +1061,10 @@ 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);
+            if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL)) < 0)
+            {
+                /* ???????? */
+            }
             delay = 200000;
             fe->next_tx_samples = fe->samples;
             break;
@@ -1009,7 +1073,10 @@ 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);
+            if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_CNG)) < 0)
+            {
+                /* ???????? */
+            }
             fe->current_tx_data_type = T38_DATA_NONE;
             return delay;
         }
@@ -1775,7 +1842,10 @@ 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);
+            if (t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL) < 0)
+            {
+                /* ???????? */
+            }
             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;
@@ -1802,7 +1872,10 @@ 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);
+            if (t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL) < 0)
+            {
+                /* ???????? */
+            }
         }
         else
         {
index 7da6ea93a12e06fff488a5e94c64373e2d27d4ed..3961bfa94d706771ca1b397b959b3d217a3e7bf7 100644 (file)
 
 #include "faxfont.h"
 
-#ifndef UINT32_MAX
-#define UINT32_MAX 0xffffffff
-#endif
-
 /*! The number of centimetres in one inch */
 #define CM_PER_INCH                 2.54f
 
index 7577f270d9f6b936e70599921bcad79cc4b8d964..6bcb3441f5c4cb26487443373d9c5e6bb28cd586 100644 (file)
 #include "spandsp/private/t81_t82_arith_coding.h"
 #include "spandsp/private/t85.h"
 
-#ifndef UINT32_MAX
-#define UINT32_MAX 0xffffffff
-#endif
-
 /* Image length update status */
 enum
 {