From 8e5eed8999fafd4f4aeeb3660f4f65277f682b98 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Tue, 3 Feb 2009 18:50:18 +0000 Subject: [PATCH] update to snapshot spandsp-20090204 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11612 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/spandsp/spandsp-sim/g1050.c | 4 +- libs/spandsp/spandsp-sim/line_model.c | 4 +- libs/spandsp/spandsp-sim/make_line_models.c | 14 +- libs/spandsp/spandsp-sim/rfc2198_sim.c | 4 +- libs/spandsp/spandsp-sim/test_utils.c | 4 +- libs/spandsp/src/Makefile.am | 3 +- libs/spandsp/src/adsi.c | 17 +- libs/spandsp/src/async.c | 30 +- libs/spandsp/src/at_interpreter.c | 10 +- libs/spandsp/src/awgn.c | 3 +- libs/spandsp/src/bell_r2_mf.c | 13 +- libs/spandsp/src/bert.c | 2 +- libs/spandsp/src/bit_operations.c | 4 +- libs/spandsp/src/bitstream.c | 16 +- libs/spandsp/src/complex_filters.c | 9 +- libs/spandsp/src/complex_vector_float.c | 6 +- libs/spandsp/src/complex_vector_int.c | 2 +- libs/spandsp/src/crc.c | 2 +- libs/spandsp/src/dds_float.c | 2 +- libs/spandsp/src/dds_int.c | 2 +- libs/spandsp/src/dtmf.c | 21 +- libs/spandsp/src/echo.c | 3 +- libs/spandsp/src/fax.c | 2 +- libs/spandsp/src/floating_fudge.h | 363 +----- libs/spandsp/src/fsk.c | 16 +- libs/spandsp/src/g711.c | 20 +- libs/spandsp/src/g722.c | 3 +- libs/spandsp/src/g726.c | 14 +- libs/spandsp/src/gsm0610_decode.c | 3 +- libs/spandsp/src/gsm0610_encode.c | 3 +- libs/spandsp/src/gsm0610_long_term.c | 3 +- libs/spandsp/src/gsm0610_lpc.c | 3 +- libs/spandsp/src/gsm0610_preprocess.c | 3 +- libs/spandsp/src/gsm0610_rpe.c | 3 +- libs/spandsp/src/gsm0610_short_term.c | 3 +- libs/spandsp/src/hdlc.c | 24 +- libs/spandsp/src/ima_adpcm.c | 15 +- libs/spandsp/src/libspandsp.dsp | 4 + libs/spandsp/src/libspandsp.vcproj | 1033 ++++------------- libs/spandsp/src/logging.c | 4 +- libs/spandsp/src/lpc10_decode.c | 5 +- libs/spandsp/src/lpc10_encode.c | 2 +- libs/spandsp/src/lpc10_voicing.c | 19 +- libs/spandsp/src/modem_connect_tones.c | 27 +- libs/spandsp/src/modem_echo.c | 2 +- libs/spandsp/src/msvc/config.h | 6 +- libs/spandsp/src/msvc/spandsp.h | 4 +- libs/spandsp/src/noise.c | 3 +- libs/spandsp/src/oki_adpcm.c | 14 +- libs/spandsp/src/playout.c | 2 +- libs/spandsp/src/plc.c | 3 +- libs/spandsp/src/power_meter.c | 2 +- libs/spandsp/src/queue.c | 2 +- libs/spandsp/src/schedule.c | 2 +- libs/spandsp/src/sig_tone.c | 3 +- libs/spandsp/src/silence_gen.c | 4 +- libs/spandsp/src/spandsp.h.in | 3 +- libs/spandsp/src/spandsp/adsi.h | 2 +- libs/spandsp/src/spandsp/async.h | 30 +- libs/spandsp/src/spandsp/at_interpreter.h | 10 +- libs/spandsp/src/spandsp/awgn.h | 2 +- libs/spandsp/src/spandsp/bell_r2_mf.h | 12 +- libs/spandsp/src/spandsp/bert.h | 2 +- libs/spandsp/src/spandsp/bitstream.h | 16 +- libs/spandsp/src/spandsp/complex_filters.h | 2 +- libs/spandsp/src/spandsp/dtmf.h | 6 +- libs/spandsp/src/spandsp/echo.h | 2 +- libs/spandsp/src/spandsp/fast_convert.h | 402 +++++++ libs/spandsp/src/spandsp/fax.h | 2 +- libs/spandsp/src/spandsp/fax_modems.h | 2 +- libs/spandsp/src/spandsp/fsk.h | 16 +- libs/spandsp/src/spandsp/g711.h | 2 +- libs/spandsp/src/spandsp/g722.h | 2 +- libs/spandsp/src/spandsp/g726.h | 2 +- libs/spandsp/src/spandsp/gsm0610.h | 2 +- libs/spandsp/src/spandsp/hdlc.h | 22 +- libs/spandsp/src/spandsp/ima_adpcm.h | 6 +- libs/spandsp/src/spandsp/lpc10.h | 2 +- .../spandsp/src/spandsp/modem_connect_tones.h | 10 +- libs/spandsp/src/spandsp/modem_echo.h | 2 +- libs/spandsp/src/spandsp/noise.h | 2 +- libs/spandsp/src/spandsp/oki_adpcm.h | 4 +- libs/spandsp/src/spandsp/playout.h | 2 +- libs/spandsp/src/spandsp/plc.h | 2 +- libs/spandsp/src/spandsp/power_meter.h | 2 +- libs/spandsp/src/spandsp/queue.h | 2 +- libs/spandsp/src/spandsp/saturated.h | 8 +- libs/spandsp/src/spandsp/schedule.h | 2 +- libs/spandsp/src/spandsp/sig_tone.h | 2 +- libs/spandsp/src/spandsp/silence_gen.h | 4 +- libs/spandsp/src/spandsp/super_tone_rx.h | 8 +- libs/spandsp/src/spandsp/super_tone_tx.h | 14 +- libs/spandsp/src/spandsp/t30.h | 22 +- libs/spandsp/src/spandsp/t30_api.h | 2 +- libs/spandsp/src/spandsp/t30_logging.h | 2 +- libs/spandsp/src/spandsp/t31.h | 14 +- libs/spandsp/src/spandsp/t38_core.h | 14 +- libs/spandsp/src/spandsp/t38_gateway.h | 6 +- libs/spandsp/src/spandsp/t38_non_ecm_buffer.h | 4 +- libs/spandsp/src/spandsp/t38_terminal.h | 8 +- libs/spandsp/src/spandsp/t4.h | 2 +- libs/spandsp/src/spandsp/telephony.h | 34 +- libs/spandsp/src/spandsp/time_scale.h | 2 +- libs/spandsp/src/spandsp/tone_detect.h | 24 +- libs/spandsp/src/spandsp/tone_generate.h | 2 +- libs/spandsp/src/spandsp/v17rx.h | 2 +- libs/spandsp/src/spandsp/v17tx.h | 2 +- libs/spandsp/src/spandsp/v22bis.h | 14 +- libs/spandsp/src/spandsp/v27ter_rx.h | 2 +- libs/spandsp/src/spandsp/v27ter_tx.h | 2 +- libs/spandsp/src/spandsp/v29rx.h | 2 +- libs/spandsp/src/spandsp/v29tx.h | 2 +- libs/spandsp/src/spandsp/v42.h | 4 +- libs/spandsp/src/spandsp/v42bis.h | 20 +- libs/spandsp/src/spandsp/v8.h | 10 +- libs/spandsp/src/spandsp/version.h | 4 +- libs/spandsp/src/super_tone_rx.c | 21 +- libs/spandsp/src/super_tone_tx.c | 19 +- libs/spandsp/src/t30.c | 22 +- libs/spandsp/src/t30_api.c | 2 +- libs/spandsp/src/t30_logging.c | 2 +- libs/spandsp/src/t31.c | 70 +- libs/spandsp/src/t35.c | 4 +- libs/spandsp/src/t38_core.c | 14 +- libs/spandsp/src/t38_gateway.c | 22 +- libs/spandsp/src/t38_non_ecm_buffer.c | 4 +- libs/spandsp/src/t38_terminal.c | 56 +- libs/spandsp/src/t4.c | 2 +- libs/spandsp/src/time_scale.c | 3 +- libs/spandsp/src/tone_detect.c | 20 +- libs/spandsp/src/tone_generate.c | 25 +- libs/spandsp/src/v17rx.c | 2 +- libs/spandsp/src/v17tx.c | 5 +- libs/spandsp/src/v22bis_rx.c | 2 +- libs/spandsp/src/v22bis_tx.c | 17 +- libs/spandsp/src/v27ter_rx.c | 2 +- libs/spandsp/src/v27ter_tx.c | 7 +- libs/spandsp/src/v29rx.c | 2 +- libs/spandsp/src/v29tx.c | 5 +- libs/spandsp/src/v42.c | 12 +- libs/spandsp/src/v42bis.c | 24 +- libs/spandsp/src/v8.c | 10 +- libs/spandsp/src/vector_float.c | 30 +- libs/spandsp/src/vector_int.c | 2 +- libs/spandsp/tests/t31_tests.c | 5 +- 145 files changed, 1269 insertions(+), 1747 deletions(-) create mode 100644 libs/spandsp/src/spandsp/fast_convert.h diff --git a/libs/spandsp/spandsp-sim/g1050.c b/libs/spandsp/spandsp-sim/g1050.c index ce8d520ddd..fda45b8b43 100644 --- a/libs/spandsp/spandsp-sim/g1050.c +++ b/libs/spandsp/spandsp-sim/g1050.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: g1050.c,v 1.12 2009/01/31 08:48:10 steveu Exp $ + * $Id: g1050.c,v 1.13 2009/02/03 16:28:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) @@ -37,7 +37,6 @@ #include #include #include -#include "floating_fudge.h" #if defined(HAVE_TGMATH_H) #include #endif @@ -45,6 +44,7 @@ #define GEN_CONST #include #endif +#include "floating_fudge.h" #include "spandsp.h" #include "spandsp/g1050.h" diff --git a/libs/spandsp/spandsp-sim/line_model.c b/libs/spandsp/spandsp-sim/line_model.c index c147fe6ba0..890f91dcc1 100644 --- a/libs/spandsp/spandsp-sim/line_model.c +++ b/libs/spandsp/spandsp-sim/line_model.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: line_model.c,v 1.7 2008/11/30 10:17:30 steveu Exp $ + * $Id: line_model.c,v 1.8 2009/02/03 16:28:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) @@ -37,7 +37,6 @@ #include #include #include -#include "floating_fudge.h" #if defined(HAVE_TGMATH_H) #include #endif @@ -45,6 +44,7 @@ #define GEN_CONST #include #endif +#include "floating_fudge.h" #define SPANDSP_EXPOSE_INTERNAL_STRUCTURES #include "spandsp.h" diff --git a/libs/spandsp/spandsp-sim/make_line_models.c b/libs/spandsp/spandsp-sim/make_line_models.c index 2abf08dd1c..62a46f38b3 100644 --- a/libs/spandsp/spandsp-sim/make_line_models.c +++ b/libs/spandsp/spandsp-sim/make_line_models.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: make_line_models.c,v 1.7 2008/07/25 13:56:54 steveu Exp $ + * $Id: make_line_models.c,v 1.8 2009/02/03 16:28:39 steveu Exp $ */ /*! \page make_line_models_page Telephony line model construction @@ -41,18 +41,18 @@ #include #include #include -#include "floating_fudge.h" -#if defined(HAVE_FFTW3_H) -#include -#else -#include -#endif #if defined(HAVE_TGMATH_H) #include #endif #if defined(HAVE_MATH_H) #include #endif +#include "floating_fudge.h" +#if defined(HAVE_FFTW3_H) +#include +#else +#include +#endif #include "spandsp.h" diff --git a/libs/spandsp/spandsp-sim/rfc2198_sim.c b/libs/spandsp/spandsp-sim/rfc2198_sim.c index 0bce601519..15ff7c3732 100644 --- a/libs/spandsp/spandsp-sim/rfc2198_sim.c +++ b/libs/spandsp/spandsp-sim/rfc2198_sim.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: rfc2198_sim.c,v 1.6 2008/07/02 14:48:25 steveu Exp $ + * $Id: rfc2198_sim.c,v 1.7 2009/02/03 16:28:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) @@ -37,7 +37,6 @@ #include #include #include -#include "floating_fudge.h" #if defined(HAVE_TGMATH_H) #include #endif @@ -45,6 +44,7 @@ #define GEN_CONST #include #endif +#include "floating_fudge.h" #include "spandsp.h" #include "spandsp/g1050.h" diff --git a/libs/spandsp/spandsp-sim/test_utils.c b/libs/spandsp/spandsp-sim/test_utils.c index bbde3139d3..1183e30804 100644 --- a/libs/spandsp/spandsp-sim/test_utils.c +++ b/libs/spandsp/spandsp-sim/test_utils.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: test_utils.c,v 1.11 2009/01/31 08:48:10 steveu Exp $ + * $Id: test_utils.c,v 1.12 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -35,13 +35,13 @@ #include #include #include -#include "floating_fudge.h" #if defined(HAVE_TGMATH_H) #include #endif #if defined(HAVE_MATH_H) #include #endif +#include "floating_fudge.h" #include #include #include diff --git a/libs/spandsp/src/Makefile.am b/libs/spandsp/src/Makefile.am index c76a83dfdc..9edd3e27b2 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.121 2009/01/31 12:24:11 steveu Exp $ +## $Id: Makefile.am,v 1.122 2009/02/03 16:33:13 steveu Exp $ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) @@ -143,6 +143,7 @@ nobase_include_HEADERS = spandsp/adsi.h \ spandsp/dds.h \ spandsp/dtmf.h \ spandsp/echo.h \ + spandsp/fast_convert.h \ spandsp/fax.h \ spandsp/fax_modems.h \ spandsp/fir.h \ diff --git a/libs/spandsp/src/adsi.c b/libs/spandsp/src/adsi.c index c40b2036f8..644aad26aa 100644 --- a/libs/spandsp/src/adsi.c +++ b/libs/spandsp/src/adsi.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: adsi.c,v 1.68 2009/01/29 01:41:05 steveu Exp $ + * $Id: adsi.c,v 1.69 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -46,6 +46,7 @@ #include #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/logging.h" #include "spandsp/queue.h" #include "spandsp/complex.h" @@ -412,9 +413,9 @@ SPAN_DECLARE(int) adsi_rx(adsi_rx_state_t *s, const int16_t *amp, int len) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(adsi_rx_state_t *) adsi_rx_init(adsi_rx_state_t *s, - int standard, - put_msg_func_t put_msg, - void *user_data) + int standard, + put_msg_func_t put_msg, + void *user_data) { if (s == NULL) { @@ -490,10 +491,10 @@ SPAN_DECLARE(void) adsi_tx_send_alert_tone(adsi_tx_state_t *s) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(void) adsi_tx_set_preamble(adsi_tx_state_t *s, - int preamble_len, - int preamble_ones_len, - int postamble_ones_len, - int stop_bits) + int preamble_len, + int preamble_ones_len, + int postamble_ones_len, + int stop_bits) { if (preamble_len < 0) { diff --git a/libs/spandsp/src/async.c b/libs/spandsp/src/async.c index 268dd7fa88..1b7ff8813c 100644 --- a/libs/spandsp/src/async.c +++ b/libs/spandsp/src/async.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: async.c,v 1.15 2009/01/05 13:48:31 steveu Exp $ + * $Id: async.c,v 1.16 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -73,12 +73,12 @@ SPAN_DECLARE(const char *) signal_status_to_str(int status) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s, - int data_bits, - int parity, - int stop_bits, - int use_v14, - put_byte_func_t put_byte, - void *user_data) + int data_bits, + int parity, + int stop_bits, + int use_v14, + put_byte_func_t put_byte, + void *user_data) { if (s == NULL) { @@ -103,7 +103,7 @@ SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s, } /*- End of function --------------------------------------------------------*/ -void async_rx_put_bit(void *user_data, int bit) +SPAN_DECLARE(void) async_rx_put_bit(void *user_data, int bit) { async_rx_state_t *s; @@ -185,12 +185,12 @@ void async_rx_put_bit(void *user_data, int bit) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s, - int data_bits, - int parity, - int stop_bits, - int use_v14, - get_byte_func_t get_byte, - void *user_data) + int data_bits, + int parity, + int stop_bits, + int use_v14, + get_byte_func_t get_byte, + void *user_data) { if (s == NULL) { @@ -216,7 +216,7 @@ SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s, } /*- End of function --------------------------------------------------------*/ -int async_tx_get_bit(void *user_data) +SPAN_DECLARE(int) async_tx_get_bit(void *user_data) { async_tx_state_t *s; int bit; diff --git a/libs/spandsp/src/at_interpreter.c b/libs/spandsp/src/at_interpreter.c index 0bda5af19f..bd5d6ee2b1 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.34 2009/01/16 15:13:16 steveu Exp $ + * $Id: at_interpreter.c,v 1.35 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -5292,10 +5292,10 @@ SPAN_DECLARE(void) at_set_class1_handler(at_state_t *s, at_class1_handler_t hand /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(at_state_t *) at_init(at_state_t *s, - at_tx_handler_t *at_tx_handler, - void *at_tx_user_data, - at_modem_control_handler_t *modem_control_handler, - void *modem_control_user_data) + at_tx_handler_t *at_tx_handler, + void *at_tx_user_data, + at_modem_control_handler_t *modem_control_handler, + void *modem_control_user_data) { if (s == NULL) { diff --git a/libs/spandsp/src/awgn.c b/libs/spandsp/src/awgn.c index 005db939fd..9e1095a749 100644 --- a/libs/spandsp/src/awgn.c +++ b/libs/spandsp/src/awgn.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: awgn.c,v 1.20 2009/01/28 03:41:26 steveu Exp $ + * $Id: awgn.c,v 1.21 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -57,6 +57,7 @@ #include "floating_fudge.h" #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/saturated.h" #include "spandsp/awgn.h" diff --git a/libs/spandsp/src/bell_r2_mf.c b/libs/spandsp/src/bell_r2_mf.c index 83dd014d32..0e92cc714b 100644 --- a/libs/spandsp/src/bell_r2_mf.c +++ b/libs/spandsp/src/bell_r2_mf.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: bell_r2_mf.c,v 1.36 2009/01/31 08:48:10 steveu Exp $ + * $Id: bell_r2_mf.c,v 1.37 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -45,6 +45,7 @@ #include "floating_fudge.h" #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/queue.h" #include "spandsp/dc_restore.h" #include "spandsp/complex.h" @@ -612,8 +613,8 @@ SPAN_DECLARE(size_t) bell_mf_rx_get(bell_mf_rx_state_t *s, char *buf, int max) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(bell_mf_rx_state_t *) bell_mf_rx_init(bell_mf_rx_state_t *s, - digits_rx_callback_t callback, - void *user_data) + digits_rx_callback_t callback, + void *user_data) { int i; static int initialised = FALSE; @@ -785,9 +786,9 @@ SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s, - int fwd, - tone_report_func_t callback, - void *user_data) + int fwd, + tone_report_func_t callback, + void *user_data) { int i; static int initialised = FALSE; diff --git a/libs/spandsp/src/bert.c b/libs/spandsp/src/bert.c index 5615ddd307..5ae7688862 100644 --- a/libs/spandsp/src/bert.c +++ b/libs/spandsp/src/bert.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: bert.c,v 1.30 2008/11/30 13:44:35 steveu Exp $ + * $Id: bert.c,v 1.31 2009/02/03 16:28:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/src/bit_operations.c b/libs/spandsp/src/bit_operations.c index 5601dfedad..547536b68c 100644 --- a/libs/spandsp/src/bit_operations.c +++ b/libs/spandsp/src/bit_operations.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: bit_operations.c,v 1.15 2008/06/28 01:13:08 steveu Exp $ + * $Id: bit_operations.c,v 1.16 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -69,7 +69,7 @@ SPAN_DECLARE(uint32_t) bit_reverse_4bytes(uint32_t x) /*- End of function --------------------------------------------------------*/ #if defined(__x86_64__) -uint64_t bit_reverse_8bytes(uint64_t x) +SPAN_DECLARE(uint64_t) bit_reverse_8bytes(uint64_t x) { x = ((x & 0xF0F0F0F0F0F0F0F0LLU) >> 4) | ((x & 0x0F0F0F0F0F0F0F0FLLU) << 4); x = ((x & 0xCCCCCCCCCCCCCCCCLLU) >> 2) | ((x & 0x3333333333333333LLU) << 2); diff --git a/libs/spandsp/src/bitstream.c b/libs/spandsp/src/bitstream.c index 128cc1e638..914836f010 100644 --- a/libs/spandsp/src/bitstream.c +++ b/libs/spandsp/src/bitstream.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: bitstream.c,v 1.16 2009/01/05 13:48:31 steveu Exp $ + * $Id: bitstream.c,v 1.17 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -41,7 +41,7 @@ #include "spandsp/private/bitstream.h" -void bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits) +SPAN_DECLARE(void) bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits) { value &= ((1 << bits) - 1); if (s->residue + bits <= 32) @@ -58,7 +58,7 @@ void bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits) } /*- End of function --------------------------------------------------------*/ -void bitstream_put2(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits) +SPAN_DECLARE(void) bitstream_put2(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits) { value &= ((1 << bits) - 1); if (s->residue + bits <= 32) @@ -74,7 +74,7 @@ void bitstream_put2(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits) } /*- End of function --------------------------------------------------------*/ -uint32_t bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits) +SPAN_DECLARE(uint32_t) bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits) { uint32_t x; @@ -90,7 +90,7 @@ uint32_t bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits) } /*- End of function --------------------------------------------------------*/ -uint32_t bitstream_get2(bitstream_state_t *s, const uint8_t **c, int bits) +SPAN_DECLARE(uint32_t) bitstream_get2(bitstream_state_t *s, const uint8_t **c, int bits) { uint32_t x; @@ -105,7 +105,7 @@ uint32_t bitstream_get2(bitstream_state_t *s, const uint8_t **c, int bits) } /*- End of function --------------------------------------------------------*/ -void bitstream_flush(bitstream_state_t *s, uint8_t **c) +SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c) { if (s->residue > 0) { @@ -115,7 +115,7 @@ void bitstream_flush(bitstream_state_t *s, uint8_t **c) } /*- End of function --------------------------------------------------------*/ -void bitstream_flush2(bitstream_state_t *s, uint8_t **c) +SPAN_DECLARE(void) bitstream_flush2(bitstream_state_t *s, uint8_t **c) { if (s->residue > 0) { @@ -125,7 +125,7 @@ void bitstream_flush2(bitstream_state_t *s, uint8_t **c) } /*- End of function --------------------------------------------------------*/ -bitstream_state_t *bitstream_init(bitstream_state_t *s) +SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s) { if (s == NULL) return NULL; diff --git a/libs/spandsp/src/complex_filters.c b/libs/spandsp/src/complex_filters.c index 79a57c14fb..7ae4a1323e 100644 --- a/libs/spandsp/src/complex_filters.c +++ b/libs/spandsp/src/complex_filters.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_filters.c,v 1.15 2009/01/31 08:48:10 steveu Exp $ + * $Id: complex_filters.c,v 1.16 2009/02/03 16:28:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) @@ -53,17 +53,20 @@ SPAN_DECLARE(filter_t *) filter_create(fspec_t *fs) } return fi; } +/*- End of function --------------------------------------------------------*/ SPAN_DECLARE(void) filter_delete(filter_t *fi) { if (fi) free(fi); } +/*- End of function --------------------------------------------------------*/ SPAN_DECLARE(float) filter_step(filter_t *fi, float x) { return fi->fs->fsf(fi, x); } +/*- End of function --------------------------------------------------------*/ SPAN_DECLARE(cfilter_t *) cfilter_create(fspec_t *fs) { @@ -85,6 +88,7 @@ SPAN_DECLARE(cfilter_t *) cfilter_create(fspec_t *fs) } return cfi; } +/*- End of function --------------------------------------------------------*/ SPAN_DECLARE(void) cfilter_delete(cfilter_t *cfi) { @@ -94,6 +98,7 @@ SPAN_DECLARE(void) cfilter_delete(cfilter_t *cfi) filter_delete(cfi->imf); } } +/*- End of function --------------------------------------------------------*/ SPAN_DECLARE(complexf_t) cfilter_step(cfilter_t *cfi, const complexf_t *z) { @@ -103,3 +108,5 @@ SPAN_DECLARE(complexf_t) cfilter_step(cfilter_t *cfi, const complexf_t *z) cc.im = filter_step(cfi->imf, z->im); return cc; } +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/complex_vector_float.c b/libs/spandsp/src/complex_vector_float.c index 06ba4b5951..c6230f377c 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.14 2009/01/28 03:41:26 steveu Exp $ + * $Id: complex_vector_float.c,v 1.15 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -135,7 +135,7 @@ SPAN_DECLARE(void) cvec_mul(complex_t z[], const complex_t x[], const complex_t /*- End of function --------------------------------------------------------*/ #if defined(HAVE_LONG_DOUBLE) -void cvec_mull(complexl_t z[], const complexl_t x[], const complexl_t y[], int n) +SPAN_DECLARE(void) cvec_mull(complexl_t z[], const complexl_t x[], const complexl_t y[], int n) { int i; @@ -179,7 +179,7 @@ SPAN_DECLARE(complex_t) cvec_dot_prod(const complex_t x[], const complex_t y[], /*- End of function --------------------------------------------------------*/ #if defined(HAVE_LONG_DOUBLE) -complexl_t cvec_dot_prodl(const complexl_t x[], const complexl_t y[], int n) +SPAN_DECLARE(complexl_t) cvec_dot_prodl(const complexl_t x[], const complexl_t y[], int n) { int i; complexl_t z; diff --git a/libs/spandsp/src/complex_vector_int.c b/libs/spandsp/src/complex_vector_int.c index 63afd27308..1d8d0fb423 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.6 2009/01/28 03:41:26 steveu Exp $ + * $Id: complex_vector_int.c,v 1.7 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/crc.c b/libs/spandsp/src/crc.c index 7c8e2988c3..c82c58e3ab 100644 --- a/libs/spandsp/src/crc.c +++ b/libs/spandsp/src/crc.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: crc.c,v 1.5 2009/01/05 13:48:31 steveu Exp $ + * $Id: crc.c,v 1.6 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/dds_float.c b/libs/spandsp/src/dds_float.c index 44e0ee702d..8acf7c0c3b 100644 --- a/libs/spandsp/src/dds_float.c +++ b/libs/spandsp/src/dds_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: dds_float.c,v 1.10 2009/01/28 03:41:26 steveu Exp $ + * $Id: dds_float.c,v 1.11 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/dds_int.c b/libs/spandsp/src/dds_int.c index 04e718b216..56902d6fe1 100644 --- a/libs/spandsp/src/dds_int.c +++ b/libs/spandsp/src/dds_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: dds_int.c,v 1.14 2009/01/29 01:41:05 steveu Exp $ + * $Id: dds_int.c,v 1.15 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/dtmf.c b/libs/spandsp/src/dtmf.c index 50bab6c143..2d5f607ca6 100644 --- a/libs/spandsp/src/dtmf.c +++ b/libs/spandsp/src/dtmf.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: dtmf.c,v 1.49 2009/01/31 08:48:10 steveu Exp $ + * $Id: dtmf.c,v 1.50 2009/02/03 16:28:39 steveu Exp $ */ /*! \file dtmf.h */ @@ -46,6 +46,7 @@ #include #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/queue.h" #include "spandsp/complex.h" #include "spandsp/dds.h" @@ -251,7 +252,7 @@ SPAN_DECLARE(int) dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples) /* Avoid reporting multiple no digit conditions on flaky hits */ if (s->in_digit || hit) { - i = (s->in_digit && !hit) ? -99 : lrintf(log10f(s->energy)*10.0f - DTMF_POWER_OFFSET + DBM0_MAX_POWER); + i = (s->in_digit && !hit) ? -99 : lfastrintf(log10f(s->energy)*10.0f - DTMF_POWER_OFFSET + DBM0_MAX_POWER); s->realtime_callback(s->realtime_callback_data, hit, i, 0); } } @@ -322,8 +323,8 @@ SPAN_DECLARE(size_t) dtmf_rx_get(dtmf_rx_state_t *s, char *buf, int max) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(void) dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s, - tone_report_func_t callback, - void *user_data) + tone_report_func_t callback, + void *user_data) { s->realtime_callback = callback; s->realtime_callback_data = user_data; @@ -331,10 +332,10 @@ SPAN_DECLARE(void) dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s, /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(void) dtmf_rx_parms(dtmf_rx_state_t *s, - int filter_dialtone, - int twist, - int reverse_twist, - int threshold) + int filter_dialtone, + int twist, + int reverse_twist, + int threshold) { float x; @@ -359,8 +360,8 @@ SPAN_DECLARE(void) dtmf_rx_parms(dtmf_rx_state_t *s, /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s, - digits_rx_callback_t callback, - void *user_data) + digits_rx_callback_t callback, + void *user_data) { int i; static int initialised = FALSE; diff --git a/libs/spandsp/src/echo.c b/libs/spandsp/src/echo.c index a10eb3f26e..01ceb3c714 100644 --- a/libs/spandsp/src/echo.c +++ b/libs/spandsp/src/echo.c @@ -27,7 +27,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: echo.c,v 1.30 2009/01/28 03:41:26 steveu Exp $ + * $Id: echo.c,v 1.31 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -95,6 +95,7 @@ #include #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/logging.h" #include "spandsp/saturated.h" #include "spandsp/dc_restore.h" diff --git a/libs/spandsp/src/fax.c b/libs/spandsp/src/fax.c index acbc735443..a34eef5c9e 100644 --- a/libs/spandsp/src/fax.c +++ b/libs/spandsp/src/fax.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: fax.c,v 1.84 2009/01/28 03:41:26 steveu Exp $ + * $Id: fax.c,v 1.85 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/floating_fudge.h b/libs/spandsp/src/floating_fudge.h index 16c5b0b8cf..a959e20f85 100644 --- a/libs/spandsp/src/floating_fudge.h +++ b/libs/spandsp/src/floating_fudge.h @@ -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: floating_fudge.h,v 1.6 2009/01/29 01:41:05 steveu Exp $ + * $Id: floating_fudge.h,v 1.7 2009/02/03 16:28:39 steveu Exp $ */ #if !defined(_FLOATING_FUDGE_H_) @@ -130,367 +130,6 @@ static __inline__ float log10f(float x) } #endif -/* The following code, to handle issues with lrint() and lrintf() on various - * platforms, is adapted from similar code in libsndfile, which is: - * - * Copyright (C) 2001-2004 Erik de Castro Lopo - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * 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. - */ - -/* - * On Intel Pentium processors (especially PIII and probably P4), converting - * from float to int is very slow. To meet the C specs, the code produced by - * most C compilers targeting Pentium needs to change the FPU rounding mode - * before the float to int conversion is performed. - * - * Changing the FPU rounding mode causes the FPU pipeline to be flushed. It - * is this flushing of the pipeline which is so slow. - * - * Fortunately the ISO C99 specification defines the functions lrint, lrintf, - * llrint and llrintf which fix this problem as a side effect. - * - * On Unix-like systems, the configure process should have detected the - * presence of these functions. If they weren't found we have to replace them - * here with a standard C cast. - */ - -/* - * The C99 prototypes for these functions are as follows: - * - * int rintf(float x); - * int rint(double x); - * long int lrintf(float x); - * long int lrint(double x); - * long long int llrintf(float x); - * long long int llrint(double x); - * - * The presence of the required functions are detected during the configure - * process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in - * the config file. - */ - -#if defined(__CYGWIN__) - /* - * CYGWIN has lrint and lrintf functions, but they are slow and buggy: - * http://sourceware.org/ml/cygwin/2005-06/msg00153.html - * http://sourceware.org/ml/cygwin/2005-09/msg00047.html - * The latest version of cygwin seems to have made no effort to fix this. - * These replacement functions (pulled from the Public Domain MinGW - * math.h header) replace the native versions. - */ - static __inline__ long int lrint(double x) - { - long int retval; - - __asm__ __volatile__ - ( - "fistpl %0" - : "=m" (retval) - : "t" (x) - : "st" - ); - - return retval; - } - - static __inline__ long int lrintf(float x) - { - long int retval; - - __asm__ __volatile__ - ( - "fistpl %0" - : "=m" (retval) - : "t" (x) - : "st" - ); - return retval; - } - - static __inline__ long int lfastrint(double x) - { - long int retval; - - __asm__ __volatile__ - ( - "fistpl %0" - : "=m" (retval) - : "t" (x) - : "st" - ); - - return retval; - } - - static __inline__ long int lfastrintf(float x) - { - long int retval; - - __asm__ __volatile__ - ( - "fistpl %0" - : "=m" (retval) - : "t" (x) - : "st" - ); - return retval; - } -#elif defined(HAVE_LRINT) && defined(HAVE_LRINTF) - -#if defined(__i386__) - /* These routines are guaranteed fast on an i386 machine. Using the built in - lrint() and lrintf() should be similar, but they may not always be enabled. - Sometimes, especially with "-O0", you might get slow calls to routines. */ - static __inline__ long int lfastrint(double x) - { - long int retval; - - __asm__ __volatile__ - ( - "fistpl %0" - : "=m" (retval) - : "t" (x) - : "st" - ); - - return retval; - } - - static __inline__ long int lfastrintf(float x) - { - long int retval; - - __asm__ __volatile__ - ( - "fistpl %0" - : "=m" (retval) - : "t" (x) - : "st" - ); - return retval; - } -#elif defined(__x86_64__) - /* On an x86_64 machine, the fastest thing seems to be a pure assignment from a - double or float to an int. It looks like the design on the x86_64 took account - of the default behaviour specified for C. */ - static __inline__ long int lfastrint(double x) - { - return (long int) (x); - } - - static __inline__ long int lfastrintf(float x) - { - return (long int) (x); - } -#elif defined(__ppc__) || defined(__powerpc__) - static __inline__ long int lfastrint(register double x) - { - int res[2]; - - __asm__ __volatile__ - ( - "fctiw %1, %1\n\t" - "stfd %1, %0" - : "=m" (res) /* Output */ - : "f" (x) /* Input */ - : "memory" - ); - - return res[1]; - } - - static __inline__ long int lfastrintf(register float x) - { - int res[2]; - - __asm__ __volatile__ - ( - "fctiw %1, %1\n\t" - "stfd %1, %0" - : "=m" (res) /* Output */ - : "f" (x) /* Input */ - : "memory" - ); - - return res[1]; - } -#endif - -#elif defined(WIN32) || defined(_WIN32) - /* - * Win32 doesn't seem to have the lrint() and lrintf() functions. - * Therefore implement inline versions of these functions here. - */ - __inline long int lrint(double x) - { - long int i; - - _asm - { - fld x - fistp i - }; - return i; - } - - __inline long int lrintf(float x) - { - long int i; - - _asm - { - fld x - fistp i - }; - return i; - } - - __inline float rintf(float flt) - { - _asm - { fld flt - frndint - } - } - - __inline double rint(double dbl) - { - __asm - { - fld dbl - frndint - } - } - - __inline long int lfastrint(double x) - { - long int i; - - _asm - { - fld x - fistp i - }; - return i; - } - - __inline long int lfastrintf(float x) - { - long int i; - - _asm - { - fld x - fistp i - }; - return i; - } -#elif defined(WIN64) || defined(_WIN64) - /* - * Win64 machines will do best with a simple assignment. - */ - __inline long int lfastrint(double x) - { - return (long int) (x); - } - - __inline long int lfastrintf(float x) - { - return (long int) (x); - } -#elif defined(__MWERKS__) && defined(macintosh) - /* This MacOS 9 solution was provided by Stephane Letz */ - - long int __inline__ lfastrint(register double x) - { - long int res[2]; - - asm - { - fctiw x, x - stfd x, res - } - return res[1]; - } - - long int __inline__ lfastrintf(register float x) - { - long int res[2]; - - asm - { - fctiw x, x - stfd x, res - } - return res[1]; - } - -#elif defined(__MACH__) && defined(__APPLE__) && (defined(__ppc__) || defined(__powerpc__)) - /* For Apple Mac OS/X - do recent versions still need this? */ - - static __inline__ long int lfastrint(register double x) - { - int res[2]; - - __asm__ __volatile__ - ( - "fctiw %1, %1\n\t" - "stfd %1, %0" - : "=m" (res) /* Output */ - : "f" (x) /* Input */ - : "memory" - ); - - return res[1]; - } - - static __inline__ long int lfastrintf(register float x) - { - int res[2]; - - __asm__ __volatile__ - ( - "fctiw %1, %1\n\t" - "stfd %1, %0" - : "=m" (res) /* Output */ - : "f" (x) /* Input */ - : "memory" - ); - - return res[1]; - } -#else - /* There is nothing else to do, but use a simple casting operation, instead of a real - rint() type function. Since we are only trying to use rint() to speed up conversions, - the accuracy issues related to changing the rounding scheme are of little concern - to us. */ - - #if !defined(__sgi) - #warning "No usable lrint() and lrintf() functions available." - #warning "Replacing these functions with a simple C cast." - #endif - - static __inline__ long int lfastrint(double x) - { - return (long int) (x); - } - - static __inline__ long int lfastrintf(float x) - { - return (long int) (x); - } - -#endif - #if defined(__cplusplus) } #endif diff --git a/libs/spandsp/src/fsk.c b/libs/spandsp/src/fsk.c index a06197351d..fce99243ad 100644 --- a/libs/spandsp/src/fsk.c +++ b/libs/spandsp/src/fsk.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: fsk.c,v 1.50 2009/01/29 18:30:14 steveu Exp $ + * $Id: fsk.c,v 1.51 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -121,9 +121,9 @@ const fsk_spec_t preset_fsk_specs[] = }; SPAN_DECLARE(fsk_tx_state_t *) fsk_tx_init(fsk_tx_state_t *s, - const fsk_spec_t *spec, - get_bit_func_t get_bit, - void *user_data) + const fsk_spec_t *spec, + get_bit_func_t get_bit, + void *user_data) { if (s == NULL) { @@ -231,10 +231,10 @@ SPAN_DECLARE(void) fsk_rx_set_modem_status_handler(fsk_rx_state_t *s, modem_tx_s /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(fsk_rx_state_t *) fsk_rx_init(fsk_rx_state_t *s, - const fsk_spec_t *spec, - int sync_mode, - put_bit_func_t put_bit, - void *user_data) + const fsk_spec_t *spec, + int sync_mode, + put_bit_func_t put_bit, + void *user_data) { int chop; diff --git a/libs/spandsp/src/g711.c b/libs/spandsp/src/g711.c index 4189334849..eeea9ada04 100644 --- a/libs/spandsp/src/g711.c +++ b/libs/spandsp/src/g711.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: g711.c,v 1.14 2009/01/28 03:41:26 steveu Exp $ + * $Id: g711.c,v 1.15 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -98,9 +98,9 @@ SPAN_DECLARE(uint8_t) ulaw_to_alaw(uint8_t ulaw) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(int) g711_decode(g711_state_t *s, - int16_t amp[], - const uint8_t g711_data[], - int g711_bytes) + int16_t amp[], + const uint8_t g711_data[], + int g711_bytes) { int i; @@ -122,9 +122,9 @@ SPAN_DECLARE(int) g711_decode(g711_state_t *s, /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(int) g711_encode(g711_state_t *s, - uint8_t g711_data[], - const int16_t amp[], - int len) + uint8_t g711_data[], + const int16_t amp[], + int len) { int i; @@ -146,9 +146,9 @@ SPAN_DECLARE(int) g711_encode(g711_state_t *s, /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(int) g711_transcode(g711_state_t *s, - uint8_t g711_out[], - const uint8_t g711_in[], - int g711_bytes) + uint8_t g711_out[], + const uint8_t g711_in[], + int g711_bytes) { int i; diff --git a/libs/spandsp/src/g722.c b/libs/spandsp/src/g722.c index e0559b8ff1..195c31d50c 100644 --- a/libs/spandsp/src/g722.c +++ b/libs/spandsp/src/g722.c @@ -28,7 +28,7 @@ * Computer Science, Speech Group * Chengxiang Lu and Alex Hauptmann * - * $Id: g722.c,v 1.6 2009/01/29 18:30:14 steveu Exp $ + * $Id: g722.c,v 1.7 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -49,6 +49,7 @@ #include "floating_fudge.h" #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/saturated.h" #include "spandsp/vector_int.h" #include "spandsp/g722.h" diff --git a/libs/spandsp/src/g726.c b/libs/spandsp/src/g726.c index f5208d870b..57a0f4bf20 100644 --- a/libs/spandsp/src/g726.c +++ b/libs/spandsp/src/g726.c @@ -48,7 +48,7 @@ * 2550 Garcia Avenue * Mountain View, California 94043 * - * $Id: g726.c,v 1.26 2009/01/28 03:41:26 steveu Exp $ + * $Id: g726.c,v 1.27 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -1065,9 +1065,9 @@ SPAN_DECLARE(int) g726_release(g726_state_t *s) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(int) g726_decode(g726_state_t *s, - int16_t amp[], - const uint8_t g726_data[], - int g726_bytes) + int16_t amp[], + const uint8_t g726_data[], + int g726_bytes) { int i; int samples; @@ -1121,9 +1121,9 @@ SPAN_DECLARE(int) g726_decode(g726_state_t *s, /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(int) g726_encode(g726_state_t *s, - uint8_t g726_data[], - const int16_t amp[], - int len) + uint8_t g726_data[], + const int16_t amp[], + int len) { int i; int g726_bytes; diff --git a/libs/spandsp/src/gsm0610_decode.c b/libs/spandsp/src/gsm0610_decode.c index 1dc0d50ca3..1ab1e8e6bb 100644 --- a/libs/spandsp/src/gsm0610_decode.c +++ b/libs/spandsp/src/gsm0610_decode.c @@ -25,7 +25,7 @@ * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html * - * $Id: gsm0610_decode.c,v 1.24 2009/01/28 03:41:26 steveu Exp $ + * $Id: gsm0610_decode.c,v 1.25 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -47,6 +47,7 @@ #include #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/bitstream.h" #include "spandsp/saturated.h" #include "spandsp/gsm0610.h" diff --git a/libs/spandsp/src/gsm0610_encode.c b/libs/spandsp/src/gsm0610_encode.c index a68a0efd98..b599b7528b 100644 --- a/libs/spandsp/src/gsm0610_encode.c +++ b/libs/spandsp/src/gsm0610_encode.c @@ -25,7 +25,7 @@ * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html * - * $Id: gsm0610_encode.c,v 1.28 2009/01/28 03:41:26 steveu Exp $ + * $Id: gsm0610_encode.c,v 1.29 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -47,6 +47,7 @@ #include #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/bitstream.h" #include "spandsp/saturated.h" #include "spandsp/gsm0610.h" diff --git a/libs/spandsp/src/gsm0610_long_term.c b/libs/spandsp/src/gsm0610_long_term.c index 2fc1df44ae..2f695dacb8 100644 --- a/libs/spandsp/src/gsm0610_long_term.c +++ b/libs/spandsp/src/gsm0610_long_term.c @@ -25,7 +25,7 @@ * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html * - * $Id: gsm0610_long_term.c,v 1.20 2009/01/28 03:41:26 steveu Exp $ + * $Id: gsm0610_long_term.c,v 1.21 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -46,6 +46,7 @@ #include #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/bitstream.h" #include "spandsp/saturated.h" #include "spandsp/gsm0610.h" diff --git a/libs/spandsp/src/gsm0610_lpc.c b/libs/spandsp/src/gsm0610_lpc.c index ac91c6e1fc..827b0b815b 100644 --- a/libs/spandsp/src/gsm0610_lpc.c +++ b/libs/spandsp/src/gsm0610_lpc.c @@ -25,7 +25,7 @@ * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html * - * $Id: gsm0610_lpc.c,v 1.27 2009/01/28 03:41:26 steveu Exp $ + * $Id: gsm0610_lpc.c,v 1.28 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -47,6 +47,7 @@ #include #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/bitstream.h" #include "spandsp/bit_operations.h" #include "spandsp/saturated.h" diff --git a/libs/spandsp/src/gsm0610_preprocess.c b/libs/spandsp/src/gsm0610_preprocess.c index bbccaf5c72..3e94fa043d 100644 --- a/libs/spandsp/src/gsm0610_preprocess.c +++ b/libs/spandsp/src/gsm0610_preprocess.c @@ -25,7 +25,7 @@ * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html * - * $Id: gsm0610_preprocess.c,v 1.16 2009/01/28 03:41:27 steveu Exp $ + * $Id: gsm0610_preprocess.c,v 1.17 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -46,6 +46,7 @@ #include #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/bitstream.h" #include "spandsp/saturated.h" #include "spandsp/gsm0610.h" diff --git a/libs/spandsp/src/gsm0610_rpe.c b/libs/spandsp/src/gsm0610_rpe.c index a564132706..6e48b161fb 100644 --- a/libs/spandsp/src/gsm0610_rpe.c +++ b/libs/spandsp/src/gsm0610_rpe.c @@ -25,7 +25,7 @@ * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html * - * $Id: gsm0610_rpe.c,v 1.24 2009/01/28 03:41:27 steveu Exp $ + * $Id: gsm0610_rpe.c,v 1.25 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -46,6 +46,7 @@ #include #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/bitstream.h" #include "spandsp/saturated.h" #include "spandsp/gsm0610.h" diff --git a/libs/spandsp/src/gsm0610_short_term.c b/libs/spandsp/src/gsm0610_short_term.c index 127d85d9da..7b1dfe082a 100644 --- a/libs/spandsp/src/gsm0610_short_term.c +++ b/libs/spandsp/src/gsm0610_short_term.c @@ -25,7 +25,7 @@ * This code is based on the widely used GSM 06.10 code available from * http://kbs.cs.tu-berlin.de/~jutta/toast.html * - * $Id: gsm0610_short_term.c,v 1.18 2009/01/28 03:41:27 steveu Exp $ + * $Id: gsm0610_short_term.c,v 1.19 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -46,6 +46,7 @@ #include #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/bitstream.h" #include "spandsp/saturated.h" #include "spandsp/gsm0610.h" diff --git a/libs/spandsp/src/hdlc.c b/libs/spandsp/src/hdlc.c index abd91a849f..644a8c602d 100644 --- a/libs/spandsp/src/hdlc.c +++ b/libs/spandsp/src/hdlc.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: hdlc.c,v 1.68 2009/01/31 09:47:59 steveu Exp $ + * $Id: hdlc.c,v 1.69 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -296,11 +296,11 @@ SPAN_DECLARE(void) hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s, - int crc32, - int report_bad_frames, - int framing_ok_threshold, - hdlc_frame_handler_t handler, - void *user_data) + int crc32, + int report_bad_frames, + int framing_ok_threshold, + hdlc_frame_handler_t handler, + void *user_data) { if (s == NULL) { @@ -319,7 +319,7 @@ SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s, /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(int) hdlc_rx_get_stats(hdlc_rx_state_t *s, - hdlc_rx_stats_t *t) + hdlc_rx_stats_t *t) { t->bytes = s->rx_bytes; t->good_frames = s->rx_frames; @@ -547,11 +547,11 @@ SPAN_DECLARE(void) hdlc_tx_set_max_frame_len(hdlc_tx_state_t *s, size_t max_len) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s, - int crc32, - int inter_frame_flags, - int progressive, - hdlc_underflow_handler_t handler, - void *user_data) + int crc32, + int inter_frame_flags, + int progressive, + hdlc_underflow_handler_t handler, + void *user_data) { if (s == NULL) { diff --git a/libs/spandsp/src/ima_adpcm.c b/libs/spandsp/src/ima_adpcm.c index 6e41857b7a..d3daf245eb 100644 --- a/libs/spandsp/src/ima_adpcm.c +++ b/libs/spandsp/src/ima_adpcm.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: ima_adpcm.c,v 1.33 2009/01/28 03:41:27 steveu Exp $ + * $Id: ima_adpcm.c,v 1.34 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -44,6 +44,7 @@ #include "floating_fudge.h" #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/saturated.h" #include "spandsp/ima_adpcm.h" #include "spandsp/private/ima_adpcm.h" @@ -299,9 +300,9 @@ SPAN_DECLARE(int) ima_adpcm_release(ima_adpcm_state_t *s) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(int) ima_adpcm_decode(ima_adpcm_state_t *s, - int16_t amp[], - const uint8_t ima_data[], - int ima_bytes) + int16_t amp[], + const uint8_t ima_data[], + int ima_bytes) { int i; int j; @@ -415,9 +416,9 @@ SPAN_DECLARE(int) ima_adpcm_decode(ima_adpcm_state_t *s, /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(int) ima_adpcm_encode(ima_adpcm_state_t *s, - uint8_t ima_data[], - const int16_t amp[], - int len) + uint8_t ima_data[], + const int16_t amp[], + int len) { int i; int bytes; diff --git a/libs/spandsp/src/libspandsp.dsp b/libs/spandsp/src/libspandsp.dsp index 5ae9103635..bc7855109e 100644 --- a/libs/spandsp/src/libspandsp.dsp +++ b/libs/spandsp/src/libspandsp.dsp @@ -479,6 +479,10 @@ SOURCE=.\spandsp/echo.h # End Source File # Begin Source File +SOURCE=.\spandsp/fast_convert.h +# End Source File +# Begin Source File + SOURCE=.\spandsp/fax.h # End Source File # Begin Source File diff --git a/libs/spandsp/src/libspandsp.vcproj b/libs/spandsp/src/libspandsp.vcproj index c87cace84c..84a56fbe24 100644 --- a/libs/spandsp/src/libspandsp.vcproj +++ b/libs/spandsp/src/libspandsp.vcproj @@ -178,822 +178,217 @@ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/spandsp/src/logging.c b/libs/spandsp/src/logging.c index 0719329861..dbc17c9b7d 100644 --- a/libs/spandsp/src/logging.c +++ b/libs/spandsp/src/logging.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: logging.c,v 1.29 2009/01/20 04:24:45 steveu Exp $ + * $Id: logging.c,v 1.30 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -83,7 +83,7 @@ SPAN_DECLARE(int) span_log_test(logging_state_t *s, int level) } /*- End of function --------------------------------------------------------*/ -int span_log(logging_state_t *s, int level, const char *format, ...) +SPAN_DECLARE(int) span_log(logging_state_t *s, int level, const char *format, ...) { char msg[1024 + 1]; va_list arg_ptr; diff --git a/libs/spandsp/src/lpc10_decode.c b/libs/spandsp/src/lpc10_decode.c index 977750f16d..6a973176c0 100644 --- a/libs/spandsp/src/lpc10_decode.c +++ b/libs/spandsp/src/lpc10_decode.c @@ -26,7 +26,7 @@ * implementation of the LPC-10 2400 bps Voice Coder. They do not * exert copyright claims on their code, and it may be freely used. * - * $Id: lpc10_decode.c,v 1.25 2009/01/28 03:41:27 steveu Exp $ + * $Id: lpc10_decode.c,v 1.26 2009/02/03 16:28:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) @@ -46,6 +46,7 @@ #include #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/dc_restore.h" #include "spandsp/lpc10.h" #include "spandsp/private/lpc10.h" @@ -1102,7 +1103,7 @@ SPAN_DECLARE(int) lpc10_decode(lpc10_decode_state_t *s, int16_t amp[], const uin synths(s, voice, &pitch, &rms, rc, speech); base = i*LPC10_SAMPLES_PER_FRAME; for (j = 0; j < LPC10_SAMPLES_PER_FRAME; j++) - amp[base + j] = (int16_t) lrintf(32768.0f*speech[j]); + amp[base + j] = (int16_t) lfastrintf(32768.0f*speech[j]); } return len*LPC10_SAMPLES_PER_FRAME; diff --git a/libs/spandsp/src/lpc10_encode.c b/libs/spandsp/src/lpc10_encode.c index 56f45932af..4d9182822d 100644 --- a/libs/spandsp/src/lpc10_encode.c +++ b/libs/spandsp/src/lpc10_encode.c @@ -26,7 +26,7 @@ * implementation of the LPC-10 2400 bps Voice Coder. They do not * exert copyright claims on their code, and it may be freely used. * - * $Id: lpc10_encode.c,v 1.26 2009/01/28 03:41:27 steveu Exp $ + * $Id: lpc10_encode.c,v 1.27 2009/02/03 16:28:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/src/lpc10_voicing.c b/libs/spandsp/src/lpc10_voicing.c index efb8120596..d11572d21b 100644 --- a/libs/spandsp/src/lpc10_voicing.c +++ b/libs/spandsp/src/lpc10_voicing.c @@ -26,7 +26,7 @@ * implementation of the LPC-10 2400 bps Voice Coder. They do not * exert copyright claims on their code, and it may be freely used. * - * $Id: lpc10_voicing.c,v 1.17 2009/01/28 03:41:27 steveu Exp $ + * $Id: lpc10_voicing.c,v 1.18 2009/02/03 16:28:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) @@ -46,6 +46,7 @@ #include "floating_fudge.h" #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/dc_restore.h" #include "spandsp/lpc10.h" #include "spandsp/private/lpc10.h" @@ -158,11 +159,11 @@ static void vparms(int32_t vwin[], /* Normalize ZC, LBE, and FBE to old fixed window length of 180. */ /* (The fraction 90/VLEN has a range of 0.58 to 1) */ r2 = (float) (*zc << 1); - *zc = lrintf(r2*(90.0f/vlen)); + *zc = lfastrintf(r2*(90.0f/vlen)); r1 = lp_rms/4*(90.0f/vlen); - *lbe = min(lrintf(r1), 32767); + *lbe = min(lfastrintf(r1), 32767); r1 = ap_rms/4*(90.0f/vlen); - *fbe = min(lrintf(r1), 32767); + *fbe = min(lfastrintf(r1), 32767); } /*- End of function --------------------------------------------------------*/ @@ -323,7 +324,7 @@ void lpc10_voicing(lpc10_encode_state_t *s, /* running average full-band voiced energy to the running average */ /* full-band unvoiced energy. SNR filter has gain of 63. */ r1 = (s->snr + s->fbve/(float) max(s->fbue, 1))*63/64.0f; - s->snr = (float) lrintf(r1); + s->snr = (float) lfastrintf(r1); snr2 = s->snr*s->fbue/max(s->lbue, 1); /* Quantize SNR to SNRL according to VDCL thresholds. */ i1 = nvdcl - 1; @@ -465,18 +466,18 @@ void lpc10_voicing(lpc10_encode_state_t *s, if (s->voibuf[3][half] == 0) { r1 = (s->sfbue*63 + (min(fbe, s->ofbue*3) << 3))/64.0f; - s->sfbue = lrintf(r1); + s->sfbue = lfastrintf(r1); s->fbue = s->sfbue/8; s->ofbue = fbe; r1 = (s->slbue*63 + (min(lbe, s->olbue*3) << 3))/64.0f; - s->slbue = lrintf(r1); + s->slbue = lfastrintf(r1); s->lbue = s->slbue/8; s->olbue = lbe; } else { - s->lbve = lrintf((s->lbve*63 + lbe)/64.0f); - s->fbve = lrintf((s->fbve*63 + fbe)/64.0f); + s->lbve = lfastrintf((s->lbve*63 + lbe)/64.0f); + s->fbve = lfastrintf((s->fbve*63 + fbe)/64.0f); } /* Set dither threshold to yield proper zero crossing rates in the */ /* presence of low frequency noise and low level signal input. */ diff --git a/libs/spandsp/src/modem_connect_tones.c b/libs/spandsp/src/modem_connect_tones.c index f262ddabef..2fd2bacb53 100644 --- a/libs/spandsp/src/modem_connect_tones.c +++ b/libs/spandsp/src/modem_connect_tones.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: modem_connect_tones.c,v 1.32 2009/01/29 18:30:14 steveu Exp $ + * $Id: modem_connect_tones.c,v 1.33 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -45,6 +45,7 @@ #include #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/logging.h" #include "spandsp/complex.h" #include "spandsp/dds.h" @@ -87,8 +88,8 @@ SPAN_DECLARE(const char *) modem_connect_tone_to_str(int tone) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *s, - int16_t amp[], - int len) + int16_t amp[], + int len) { int16_t mod; int i; @@ -197,7 +198,7 @@ SPAN_DECLARE(int) modem_connect_tones_tx(modem_connect_tones_tx_state_t *s, /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem_connect_tones_tx_state_t *s, - int tone_type) + int tone_type) { int alloced; @@ -326,7 +327,7 @@ static void v21_put_bit(void *user_data, int bit) s->flags_seen = 0; if (++s->flags_seen >= HDLC_FRAMING_OK_THRESHOLD && !s->framing_ok_announced) { - report_tone_state(s, MODEM_CONNECT_TONES_FAX_PREAMBLE, lrintf(fsk_rx_signal_power(&(s->v21rx)))); + report_tone_state(s, MODEM_CONNECT_TONES_FAX_PREAMBLE, lfastrintf(fsk_rx_signal_power(&(s->v21rx)))); s->framing_ok_announced = TRUE; } } @@ -366,7 +367,7 @@ SPAN_DECLARE(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s, cons famp = v1 - 1.2994747954630f*s->z1 + s->z2; s->z2 = s->z1; s->z1 = v1; - notched = (int16_t) lrintf(famp); + notched = (int16_t) lfastrintf(famp); /* Estimate the overall energy in the channel, and the energy in the notch (i.e. overall channel energy - tone energy => noise). @@ -379,7 +380,7 @@ SPAN_DECLARE(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s, cons if (s->tone_present != MODEM_CONNECT_TONES_FAX_CNG) { if (++s->tone_cycle_duration >= ms_to_samples(415)) - report_tone_state(s, MODEM_CONNECT_TONES_FAX_CNG, lrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f)); + report_tone_state(s, MODEM_CONNECT_TONES_FAX_CNG, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f)); } } else @@ -409,7 +410,7 @@ SPAN_DECLARE(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s, cons famp = v1 + 0.1567596f*s->z1 + s->z2; s->z2 = s->z1; s->z1 = v1; - notched = (int16_t) lrintf(famp); + notched = (int16_t) lfastrintf(famp); /* Estimate the overall energy in the channel, and the energy in the notch (i.e. overall channel energy - tone energy => noise). Use abs instead of multiply for speed (is it really faster?). @@ -442,7 +443,7 @@ SPAN_DECLARE(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s, cons if (s->tone_cycle_duration >= ms_to_samples(450 - 25)) { if (++s->good_cycles == 3) - report_tone_state(s, MODEM_CONNECT_TONES_ANS_PR, lrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f)); + report_tone_state(s, MODEM_CONNECT_TONES_ANS_PR, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f)); } else { @@ -456,7 +457,7 @@ SPAN_DECLARE(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *s, cons if (s->tone_cycle_duration >= ms_to_samples(550)) { if (s->tone_present == MODEM_CONNECT_TONES_NONE) - report_tone_state(s, MODEM_CONNECT_TONES_ANS, lrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f)); + report_tone_state(s, MODEM_CONNECT_TONES_ANS, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f)); s->good_cycles = 0; s->tone_cycle_duration = ms_to_samples(550); } @@ -500,9 +501,9 @@ SPAN_DECLARE(int) modem_connect_tones_rx_get(modem_connect_tones_rx_state_t *s) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem_connect_tones_rx_state_t *s, - int tone_type, - tone_report_func_t tone_callback, - void *user_data) + int tone_type, + tone_report_func_t tone_callback, + void *user_data) { if (s == NULL) { diff --git a/libs/spandsp/src/modem_echo.c b/libs/spandsp/src/modem_echo.c index 268085398c..8ed03c983b 100644 --- a/libs/spandsp/src/modem_echo.c +++ b/libs/spandsp/src/modem_echo.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: modem_echo.c,v 1.24 2009/01/28 03:41:27 steveu Exp $ + * $Id: modem_echo.c,v 1.25 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/msvc/config.h b/libs/spandsp/src/msvc/config.h index 52a046a804..c7f3be5637 100644 --- a/libs/spandsp/src/msvc/config.h +++ b/libs/spandsp/src/msvc/config.h @@ -1,7 +1,7 @@ /* * SpanDSP - a series of DSP components for telephony * - * inttypes.h - a fudge for MSVC, which lacks this header + * config.h - a fudge for MSVC, which lacks this header * * Written by Steve Underwood * @@ -10,7 +10,7 @@ * * This file is released in the public domain. * - * $Id: config.h,v 1.1 2009/01/29 18:30:14 steveu Exp $ + * $Id: config.h,v 1.2 2009/02/03 16:39:41 steveu Exp $ */ #if !defined(_MSVC_CONFIG_H_) @@ -32,6 +32,8 @@ #define HAVE_MATH_H #define HAVE_TGMATH_H +#define HAVE_LONG_DOUBLE + #define SPANDSP_USE_EXPORT_CAPABILITY 1 #ifdef __cplusplus diff --git a/libs/spandsp/src/msvc/spandsp.h b/libs/spandsp/src/msvc/spandsp.h index 203cdaf6ae..c454e38d97 100644 --- a/libs/spandsp/src/msvc/spandsp.h +++ b/libs/spandsp/src/msvc/spandsp.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: spandsp.h.in,v 1.15 2009/01/31 08:48:10 steveu Exp $ + * $Id: spandsp.h.in,v 1.16 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -33,6 +33,7 @@ #undef SPANDSP_USE_FIXED_POINT #undef SPANDSP_MISALIGNED_ACCESS_FAILS +#define SPANDSP_USE_EXPORT_CAPABILITY 1 #include #include @@ -43,6 +44,7 @@ #include #include +#include #include #include #include diff --git a/libs/spandsp/src/noise.c b/libs/spandsp/src/noise.c index 24b2fb07ac..857124d16a 100644 --- a/libs/spandsp/src/noise.c +++ b/libs/spandsp/src/noise.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: noise.c,v 1.29 2009/01/31 08:48:10 steveu Exp $ + * $Id: noise.c,v 1.30 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -45,6 +45,7 @@ #include "floating_fudge.h" #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/saturated.h" #include "spandsp/noise.h" diff --git a/libs/spandsp/src/oki_adpcm.c b/libs/spandsp/src/oki_adpcm.c index 9093531cf7..ec5b548258 100644 --- a/libs/spandsp/src/oki_adpcm.c +++ b/libs/spandsp/src/oki_adpcm.c @@ -27,7 +27,7 @@ * The actual OKI ADPCM encode and decode method is derived from freely * available code, whose exact origins seem uncertain. * - * $Id: oki_adpcm.c,v 1.30 2009/01/05 13:48:31 steveu Exp $ + * $Id: oki_adpcm.c,v 1.31 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -266,9 +266,9 @@ SPAN_DECLARE(int) oki_adpcm_release(oki_adpcm_state_t *s) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(int) oki_adpcm_decode(oki_adpcm_state_t *s, - int16_t amp[], - const uint8_t oki_data[], - int oki_bytes) + int16_t amp[], + const uint8_t oki_data[], + int oki_bytes) { int i; int x; @@ -319,9 +319,9 @@ SPAN_DECLARE(int) oki_adpcm_decode(oki_adpcm_state_t *s, /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(int) oki_adpcm_encode(oki_adpcm_state_t *s, - uint8_t oki_data[], - const int16_t amp[], - int len) + uint8_t oki_data[], + const int16_t amp[], + int len) { int x; int l; diff --git a/libs/spandsp/src/playout.c b/libs/spandsp/src/playout.c index d350e7525a..9acc3628bf 100644 --- a/libs/spandsp/src/playout.c +++ b/libs/spandsp/src/playout.c @@ -29,7 +29,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: playout.c,v 1.15 2009/01/05 13:48:31 steveu Exp $ + * $Id: playout.c,v 1.16 2009/02/03 16:28:39 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/src/plc.c b/libs/spandsp/src/plc.c index 3153a6fafc..96ed832bf8 100644 --- a/libs/spandsp/src/plc.c +++ b/libs/spandsp/src/plc.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: plc.c,v 1.25 2009/01/28 03:41:27 steveu Exp $ + * $Id: plc.c,v 1.26 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ @@ -45,6 +45,7 @@ #include #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/saturated.h" #include "spandsp/plc.h" diff --git a/libs/spandsp/src/power_meter.c b/libs/spandsp/src/power_meter.c index da19307485..e017635832 100644 --- a/libs/spandsp/src/power_meter.c +++ b/libs/spandsp/src/power_meter.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: power_meter.c,v 1.26 2009/01/28 03:41:27 steveu Exp $ + * $Id: power_meter.c,v 1.27 2009/02/03 16:28:39 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/queue.c b/libs/spandsp/src/queue.c index 51fc251c83..6b53b64786 100644 --- a/libs/spandsp/src/queue.c +++ b/libs/spandsp/src/queue.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: queue.c,v 1.27 2009/01/31 08:48:10 steveu Exp $ + * $Id: queue.c,v 1.28 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/schedule.c b/libs/spandsp/src/schedule.c index e0f64bd085..5c55f428f3 100644 --- a/libs/spandsp/src/schedule.c +++ b/libs/spandsp/src/schedule.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: schedule.c,v 1.20 2009/01/05 13:48:31 steveu Exp $ + * $Id: schedule.c,v 1.21 2009/02/03 16:28:40 steveu Exp $ */ #if defined(HAVE_CONFIG_H) diff --git a/libs/spandsp/src/sig_tone.c b/libs/spandsp/src/sig_tone.c index c026f2b1e1..3003ca993b 100644 --- a/libs/spandsp/src/sig_tone.c +++ b/libs/spandsp/src/sig_tone.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: sig_tone.c,v 1.29 2009/01/30 07:19:25 steveu Exp $ + * $Id: sig_tone.c,v 1.30 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -47,6 +47,7 @@ #undef SPANDSP_USE_FIXED_POINT #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/dc_restore.h" #include "spandsp/saturated.h" #include "spandsp/complex.h" diff --git a/libs/spandsp/src/silence_gen.c b/libs/spandsp/src/silence_gen.c index abdcf4c29c..2423fe6eb2 100644 --- a/libs/spandsp/src/silence_gen.c +++ b/libs/spandsp/src/silence_gen.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: silence_gen.c,v 1.17 2009/01/28 03:41:27 steveu Exp $ + * $Id: silence_gen.c,v 1.18 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -131,7 +131,7 @@ SPAN_DECLARE(silence_gen_state_t *) silence_gen_init(silence_gen_state_t *s, int /* The following dummy routines, to absorb data, don't really have a proper home, so they have been put here. */ -int span_dummy_rx(void *user_data, const int16_t amp[], int len) +SPAN_DECLARE(int) span_dummy_rx(void *user_data, const int16_t amp[], int len) { return 0; } diff --git a/libs/spandsp/src/spandsp.h.in b/libs/spandsp/src/spandsp.h.in index 40fa29e97a..0744559ab0 100644 --- a/libs/spandsp/src/spandsp.h.in +++ b/libs/spandsp/src/spandsp.h.in @@ -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: spandsp.h.in,v 1.15 2009/01/31 08:48:10 steveu Exp $ + * $Id: spandsp.h.in,v 1.16 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -44,6 +44,7 @@ #include #include +#include #include #include #include diff --git a/libs/spandsp/src/spandsp/adsi.h b/libs/spandsp/src/spandsp/adsi.h index ac77d26931..759498affc 100644 --- a/libs/spandsp/src/spandsp/adsi.h +++ b/libs/spandsp/src/spandsp/adsi.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: adsi.h,v 1.34 2009/01/31 08:48:11 steveu Exp $ + * $Id: adsi.h,v 1.35 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/async.h b/libs/spandsp/src/spandsp/async.h index 457c18f939..b6e52c405d 100644 --- a/libs/spandsp/src/spandsp/async.h +++ b/libs/spandsp/src/spandsp/async.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: async.h,v 1.20 2009/01/31 08:48:11 steveu Exp $ + * $Id: async.h,v 1.21 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -151,18 +151,18 @@ SPAN_DECLARE(const char *) signal_status_to_str(int status); \param user_data An opaque pointer. \return A pointer to the initialised context, or NULL if there was a problem. */ SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s, - int data_bits, - int parity_bits, - int stop_bits, - int use_v14, - get_byte_func_t get_byte, - void *user_data); + int data_bits, + int parity_bits, + int stop_bits, + int use_v14, + get_byte_func_t get_byte, + void *user_data); /*! Get the next bit of a transmitted serial bit stream. \brief Get the next bit of a transmitted serial bit stream. \param user_data An opaque point which must point to a transmitter context. \return the next bit, or PUTBIT_END_OF_DATA to indicate the data stream has ended. */ -int async_tx_get_bit(void *user_data); +SPAN_DECLARE(int) async_tx_get_bit(void *user_data); /*! Initialise an asynchronous data receiver context. \brief Initialise an asynchronous data receiver context. @@ -175,12 +175,12 @@ int async_tx_get_bit(void *user_data); \param user_data An opaque pointer. \return A pointer to the initialised context, or NULL if there was a problem. */ SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s, - int data_bits, - int parity_bits, - int stop_bits, - int use_v14, - put_byte_func_t put_byte, - void *user_data); + int data_bits, + int parity_bits, + int stop_bits, + int use_v14, + put_byte_func_t put_byte, + void *user_data); /*! Accept a bit from a received serial bit stream \brief Accept a bit from a received serial bit stream @@ -191,7 +191,7 @@ SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s, - SIG_STATUS_TRAINING_SUCCEEDED - SIG_STATUS_TRAINING_FAILED - SIG_STATUS_END_OF_DATA */ -void async_rx_put_bit(void *user_data, int bit); +SPAN_DECLARE(void) async_rx_put_bit(void *user_data, int bit); #if defined(__cplusplus) } diff --git a/libs/spandsp/src/spandsp/at_interpreter.h b/libs/spandsp/src/spandsp/at_interpreter.h index d8e5c9a5de..44a5712c26 100644 --- a/libs/spandsp/src/spandsp/at_interpreter.h +++ b/libs/spandsp/src/spandsp/at_interpreter.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: at_interpreter.h,v 1.21 2009/01/31 08:48:11 steveu Exp $ + * $Id: at_interpreter.h,v 1.22 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -174,10 +174,10 @@ SPAN_DECLARE(void) at_set_class1_handler(at_state_t *s, at_class1_handler_t hand \param modem_control_user_data x. \return A pointer to the AT context, or NULL if there was a problem. */ SPAN_DECLARE(at_state_t *) at_init(at_state_t *s, - at_tx_handler_t *at_tx_handler, - void *at_tx_user_data, - at_modem_control_handler_t *modem_control_handler, - void *modem_control_user_data); + at_tx_handler_t *at_tx_handler, + void *at_tx_user_data, + at_modem_control_handler_t *modem_control_handler, + void *modem_control_user_data); /*! Free an AT interpreter context. \brief Free an AT interpreter context. diff --git a/libs/spandsp/src/spandsp/awgn.h b/libs/spandsp/src/spandsp/awgn.h index 007e2b68c8..7a18f27ca9 100644 --- a/libs/spandsp/src/spandsp/awgn.h +++ b/libs/spandsp/src/spandsp/awgn.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: awgn.h,v 1.16 2009/01/31 08:48:11 steveu Exp $ + * $Id: awgn.h,v 1.17 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/bell_r2_mf.h b/libs/spandsp/src/spandsp/bell_r2_mf.h index c711c91d6f..5d2a7872ab 100644 --- a/libs/spandsp/src/spandsp/bell_r2_mf.h +++ b/libs/spandsp/src/spandsp/bell_r2_mf.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: bell_r2_mf.h,v 1.22 2009/01/31 08:48:11 steveu Exp $ + * $Id: bell_r2_mf.h,v 1.23 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -206,8 +206,8 @@ SPAN_DECLARE(size_t) bell_mf_rx_get(bell_mf_rx_state_t *s, char *buf, int max); and supplied in callbacks. \return A pointer to the Bell MF receiver context.*/ SPAN_DECLARE(bell_mf_rx_state_t *) bell_mf_rx_init(bell_mf_rx_state_t *s, - digits_rx_callback_t callback, - void *user_data); + digits_rx_callback_t callback, + void *user_data); /*! \brief Free a Bell MF receiver context. \param s The Bell MF receiver context. @@ -238,9 +238,9 @@ SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s); and supplied in callbacks. \return A pointer to the R2 MF receiver context. */ SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s, - int fwd, - tone_report_func_t callback, - void *user_data); + int fwd, + tone_report_func_t callback, + void *user_data); /*! \brief Free an R2 MF receiver context. \param s The R2 MF receiver context. diff --git a/libs/spandsp/src/spandsp/bert.h b/libs/spandsp/src/spandsp/bert.h index 9642f38ff3..240ca44cb1 100644 --- a/libs/spandsp/src/spandsp/bert.h +++ b/libs/spandsp/src/spandsp/bert.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: bert.h,v 1.21 2009/01/31 08:48:11 steveu Exp $ + * $Id: bert.h,v 1.22 2009/02/03 16:28:41 steveu Exp $ */ #if !defined(_SPANDSP_BERT_H_) diff --git a/libs/spandsp/src/spandsp/bitstream.h b/libs/spandsp/src/spandsp/bitstream.h index 87e6e336a0..e97e2f35cb 100644 --- a/libs/spandsp/src/spandsp/bitstream.h +++ b/libs/spandsp/src/spandsp/bitstream.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: bitstream.h,v 1.12 2008/11/30 12:45:09 steveu Exp $ + * $Id: bitstream.h,v 1.13 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -50,30 +50,30 @@ extern "C" \param c A pointer to the bitstream output buffer. \param value The value to be pushed into the output buffer. \param bits The number of bits of value to be pushed. 1 to 25 bits is valid. */ -void bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits); +SPAN_DECLARE(void) bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits); -void bitstream_put2(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits); +SPAN_DECLARE(void) bitstream_put2(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits); /*! \brief Get a chunk of bits from the input buffer. \param s A pointer to the bitstream context. \param c A pointer to the bitstream input buffer. \param bits The number of bits of value to be grabbed. 1 to 25 bits is valid. \return The value retrieved from the input buffer. */ -uint32_t bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits); +SPAN_DECLARE(uint32_t) bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits); -uint32_t bitstream_get2(bitstream_state_t *s, const uint8_t **c, int bits); +SPAN_DECLARE(uint32_t) bitstream_get2(bitstream_state_t *s, const uint8_t **c, int bits); /*! \brief Flush any residual bit to the output buffer. \param s A pointer to the bitstream context. \param c A pointer to the bitstream output buffer. */ -void bitstream_flush(bitstream_state_t *s, uint8_t **c); +SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c); -void bitstream_flush2(bitstream_state_t *s, uint8_t **c); +SPAN_DECLARE(void) bitstream_flush2(bitstream_state_t *s, uint8_t **c); /*! \brief Initialise a bitstream context. \param s A pointer to the bitstream context. \return A pointer to the bitstream context. */ -bitstream_state_t *bitstream_init(bitstream_state_t *s); +SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s); #if defined(__cplusplus) } diff --git a/libs/spandsp/src/spandsp/complex_filters.h b/libs/spandsp/src/spandsp/complex_filters.h index ff128a2f5a..efc99ab85c 100644 --- a/libs/spandsp/src/spandsp/complex_filters.h +++ b/libs/spandsp/src/spandsp/complex_filters.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: complex_filters.h,v 1.13 2009/01/31 08:48:11 steveu Exp $ + * $Id: complex_filters.h,v 1.14 2009/02/03 16:28:41 steveu Exp $ */ #if !defined(_SPANDSP_COMPLEX_FILTERS_H_) diff --git a/libs/spandsp/src/spandsp/dtmf.h b/libs/spandsp/src/spandsp/dtmf.h index 304e1d0580..8063dcbbec 100644 --- a/libs/spandsp/src/spandsp/dtmf.h +++ b/libs/spandsp/src/spandsp/dtmf.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: dtmf.h,v 1.30 2009/01/31 08:48:11 steveu Exp $ + * $Id: dtmf.h,v 1.31 2009/02/03 16:28:41 steveu Exp $ */ #if !defined(_SPANDSP_DTMF_H_) @@ -192,8 +192,8 @@ SPAN_DECLARE(size_t) dtmf_rx_get(dtmf_rx_state_t *s, char *digits, int max); and supplied in callbacks. \return A pointer to the DTMF receiver context. */ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s, - digits_rx_callback_t callback, - void *user_data); + digits_rx_callback_t callback, + void *user_data); /*! \brief Free a DTMF receiver context. \param s The DTMF receiver context. diff --git a/libs/spandsp/src/spandsp/echo.h b/libs/spandsp/src/spandsp/echo.h index 32bf004763..3564d6237d 100644 --- a/libs/spandsp/src/spandsp/echo.h +++ b/libs/spandsp/src/spandsp/echo.h @@ -24,7 +24,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: echo.h,v 1.17 2009/01/31 08:48:11 steveu Exp $ + * $Id: echo.h,v 1.18 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/fast_convert.h b/libs/spandsp/src/spandsp/fast_convert.h new file mode 100644 index 0000000000..7f3b67760f --- /dev/null +++ b/libs/spandsp/src/spandsp/fast_convert.h @@ -0,0 +1,402 @@ +/* + * SpanDSP - a series of DSP components for telephony + * + * fast_convert.h - Quick ways to convert floating point numbers to integers + * + * 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: fast_convert.h,v 1.1 2009/02/03 16:28:41 steveu Exp $ + */ + +#if !defined(_SPANDSP_FAST_CONVERT_H_) +#define _SPANDSP_FAST_CONVERT_H_ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/* The following code, to handle issues with lrint() and lrintf() on various + * platforms, is adapted from similar code in libsndfile, which is: + * + * Copyright (C) 2001-2004 Erik de Castro Lopo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * 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. + */ + +/* + * On Intel Pentium processors (especially PIII and probably P4), converting + * from float to int is very slow. To meet the C specs, the code produced by + * most C compilers targeting Pentium needs to change the FPU rounding mode + * before the float to int conversion is performed. + * + * Changing the FPU rounding mode causes the FPU pipeline to be flushed. It + * is this flushing of the pipeline which is so slow. + * + * Fortunately the ISO C99 specification defines the functions lrint, lrintf, + * llrint and llrintf which fix this problem as a side effect. + * + * On Unix-like systems, the configure process should have detected the + * presence of these functions. If they weren't found we have to replace them + * here with a standard C cast. + */ + +/* + * The C99 prototypes for these functions are as follows: + * + * int rintf(float x); + * int rint(double x); + * long int lrintf(float x); + * long int lrint(double x); + * long long int llrintf(float x); + * long long int llrint(double x); + * + * The presence of the required functions are detected during the configure + * process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in + * the config file. + */ + +#if defined(__CYGWIN__) + /* + * CYGWIN has lrint and lrintf functions, but they are slow and buggy: + * http://sourceware.org/ml/cygwin/2005-06/msg00153.html + * http://sourceware.org/ml/cygwin/2005-09/msg00047.html + * The latest version of cygwin seems to have made no effort to fix this. + * These replacement functions (pulled from the Public Domain MinGW + * math.h header) replace the native versions. + */ +#if 0 + static __inline__ long int lrint(double x) + { + long int retval; + + __asm__ __volatile__ + ( + "fistpl %0" + : "=m" (retval) + : "t" (x) + : "st" + ); + + return retval; + } + + static __inline__ long int lrintf(float x) + { + long int retval; + + __asm__ __volatile__ + ( + "fistpl %0" + : "=m" (retval) + : "t" (x) + : "st" + ); + return retval; + } +#endif + + static __inline__ long int lfastrint(double x) + { + long int retval; + + __asm__ __volatile__ + ( + "fistpl %0" + : "=m" (retval) + : "t" (x) + : "st" + ); + + return retval; + } + + static __inline__ long int lfastrintf(float x) + { + long int retval; + + __asm__ __volatile__ + ( + "fistpl %0" + : "=m" (retval) + : "t" (x) + : "st" + ); + return retval; + } +#elif defined(HAVE_LRINT) && defined(HAVE_LRINTF) + +#if defined(__i386__) + /* These routines are guaranteed fast on an i386 machine. Using the built in + lrint() and lrintf() should be similar, but they may not always be enabled. + Sometimes, especially with "-O0", you might get slow calls to routines. */ + static __inline__ long int lfastrint(double x) + { + long int retval; + + __asm__ __volatile__ + ( + "fistpl %0" + : "=m" (retval) + : "t" (x) + : "st" + ); + + return retval; + } + + static __inline__ long int lfastrintf(float x) + { + long int retval; + + __asm__ __volatile__ + ( + "fistpl %0" + : "=m" (retval) + : "t" (x) + : "st" + ); + return retval; + } +#elif defined(__x86_64__) + /* On an x86_64 machine, the fastest thing seems to be a pure assignment from a + double or float to an int. It looks like the design on the x86_64 took account + of the default behaviour specified for C. */ + static __inline__ long int lfastrint(double x) + { + return (long int) (x); + } + + static __inline__ long int lfastrintf(float x) + { + return (long int) (x); + } +#elif defined(__ppc__) || defined(__powerpc__) + static __inline__ long int lfastrint(register double x) + { + int res[2]; + + __asm__ __volatile__ + ( + "fctiw %1, %1\n\t" + "stfd %1, %0" + : "=m" (res) /* Output */ + : "f" (x) /* Input */ + : "memory" + ); + + return res[1]; + } + + static __inline__ long int lfastrintf(register float x) + { + int res[2]; + + __asm__ __volatile__ + ( + "fctiw %1, %1\n\t" + "stfd %1, %0" + : "=m" (res) /* Output */ + : "f" (x) /* Input */ + : "memory" + ); + + return res[1]; + } +#endif + +#elif defined(WIN32) || defined(_WIN32) + /* + * Win32 doesn't seem to have the lrint() and lrintf() functions. + * Therefore implement inline versions of these functions here. + */ + __inline long int lrint(double x) + { + long int i; + + _asm + { + fld x + fistp i + }; + return i; + } + + __inline long int lrintf(float x) + { + long int i; + + _asm + { + fld x + fistp i + }; + return i; + } + + __inline float rintf(float flt) + { + _asm + { fld flt + frndint + } + } + + __inline double rint(double dbl) + { + __asm + { + fld dbl + frndint + } + } + + __inline long int lfastrint(double x) + { + long int i; + + _asm + { + fld x + fistp i + }; + return i; + } + + __inline long int lfastrintf(float x) + { + long int i; + + _asm + { + fld x + fistp i + }; + return i; + } +#elif defined(WIN64) || defined(_WIN64) + /* Win64 machines will do best with a simple assignment. */ + + __inline long int lfastrint(double x) + { + return (long int) (x); + } + + __inline long int lfastrintf(float x) + { + return (long int) (x); + } +#elif defined(__MWERKS__) && defined(macintosh) + /* This MacOS 9 solution was provided by Stephane Letz */ + + long int __inline__ lfastrint(register double x) + { + long int res[2]; + + asm + { + fctiw x, x + stfd x, res + } + return res[1]; + } + + long int __inline__ lfastrintf(register float x) + { + long int res[2]; + + asm + { + fctiw x, x + stfd x, res + } + return res[1]; + } +#elif defined(__MACH__) && defined(__APPLE__) && (defined(__ppc__) || defined(__powerpc__)) + /* For Apple Mac OS/X - do recent versions still need this? */ + + static __inline__ long int lfastrint(register double x) + { + int res[2]; + + __asm__ __volatile__ + ( + "fctiw %1, %1\n\t" + "stfd %1, %0" + : "=m" (res) /* Output */ + : "f" (x) /* Input */ + : "memory" + ); + + return res[1]; + } + + static __inline__ long int lfastrintf(register float x) + { + int res[2]; + + __asm__ __volatile__ + ( + "fctiw %1, %1\n\t" + "stfd %1, %0" + : "=m" (res) /* Output */ + : "f" (x) /* Input */ + : "memory" + ); + + return res[1]; + } +#else + /* There is nothing else to do, but use a simple casting operation, instead of a real + rint() type function. Since we are only trying to use rint() to speed up conversions, + the accuracy issues related to changing the rounding scheme are of little concern + to us. */ + + #if !defined(__sgi) + #warning "No usable lrint() and lrintf() functions available." + #warning "Replacing these functions with a simple C cast." + #endif + + static __inline__ long int lfastrint(double x) + { + return (long int) (x); + } + + static __inline__ long int lfastrintf(float x) + { + return (long int) (x); + } +#endif + +#if defined(__cplusplus) +} +#endif + +#endif + +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/spandsp/fax.h b/libs/spandsp/src/spandsp/fax.h index 44b61eb0f5..14f419c7dc 100644 --- a/libs/spandsp/src/spandsp/fax.h +++ b/libs/spandsp/src/spandsp/fax.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: fax.h,v 1.37 2009/01/31 08:48:11 steveu Exp $ + * $Id: fax.h,v 1.38 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/fax_modems.h b/libs/spandsp/src/spandsp/fax_modems.h index 5213573a52..6a04cc2365 100644 --- a/libs/spandsp/src/spandsp/fax_modems.h +++ b/libs/spandsp/src/spandsp/fax_modems.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: fax_modems.h,v 1.7 2009/01/31 08:48:11 steveu Exp $ + * $Id: fax_modems.h,v 1.8 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/fsk.h b/libs/spandsp/src/spandsp/fsk.h index cec74529c5..c443cf2f2f 100644 --- a/libs/spandsp/src/spandsp/fsk.h +++ b/libs/spandsp/src/spandsp/fsk.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: fsk.h,v 1.34 2009/01/31 08:48:11 steveu Exp $ + * $Id: fsk.h,v 1.35 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -144,9 +144,9 @@ extern "C" \param user_data An opaque pointer. \return A pointer to the modem context, or NULL if there was a problem. */ SPAN_DECLARE(fsk_tx_state_t *) fsk_tx_init(fsk_tx_state_t *s, - const fsk_spec_t *spec, - get_bit_func_t get_bit, - void *user_data); + const fsk_spec_t *spec, + get_bit_func_t get_bit, + void *user_data); /*! Adjust an FSK modem transmit context's power output. \brief Adjust an FSK modem transmit context's power output. @@ -192,10 +192,10 @@ SPAN_DECLARE(void) fsk_rx_signal_cutoff(fsk_rx_state_t *s, float cutoff); \param user_data An opaque pointer. \return A pointer to the modem context, or NULL if there was a problem. */ SPAN_DECLARE(fsk_rx_state_t *) fsk_rx_init(fsk_rx_state_t *s, - const fsk_spec_t *spec, - int sync_mode, - put_bit_func_t put_bit, - void *user_data); + const fsk_spec_t *spec, + int sync_mode, + put_bit_func_t put_bit, + void *user_data); /*! Process a block of received FSK modem audio samples. \brief Process a block of received FSK modem audio samples. diff --git a/libs/spandsp/src/spandsp/g711.h b/libs/spandsp/src/spandsp/g711.h index bc9d3c7cb8..0ab8a79ce5 100644 --- a/libs/spandsp/src/spandsp/g711.h +++ b/libs/spandsp/src/spandsp/g711.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: g711.h,v 1.16 2009/01/31 08:48:11 steveu Exp $ + * $Id: g711.h,v 1.17 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/g722.h b/libs/spandsp/src/spandsp/g722.h index 657599d99b..3ec29b2857 100644 --- a/libs/spandsp/src/spandsp/g722.h +++ b/libs/spandsp/src/spandsp/g722.h @@ -28,7 +28,7 @@ * Computer Science, Speech Group * Chengxiang Lu and Alex Hauptmann * - * $Id: g722.h,v 1.23 2009/01/31 08:48:11 steveu Exp $ + * $Id: g722.h,v 1.24 2009/02/03 16:28:41 steveu Exp $ */ diff --git a/libs/spandsp/src/spandsp/g726.h b/libs/spandsp/src/spandsp/g726.h index 44e94e8e77..a237fa508e 100644 --- a/libs/spandsp/src/spandsp/g726.h +++ b/libs/spandsp/src/spandsp/g726.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: g726.h,v 1.23 2009/01/31 08:48:11 steveu Exp $ + * $Id: g726.h,v 1.24 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/gsm0610.h b/libs/spandsp/src/spandsp/gsm0610.h index 283af355c1..c4b9361cff 100644 --- a/libs/spandsp/src/spandsp/gsm0610.h +++ b/libs/spandsp/src/spandsp/gsm0610.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: gsm0610.h,v 1.19 2009/01/31 08:48:11 steveu Exp $ + * $Id: gsm0610.h,v 1.20 2009/02/03 16:28:41 steveu Exp $ */ #if !defined(_SPANDSP_GSM0610_H_) diff --git a/libs/spandsp/src/spandsp/hdlc.h b/libs/spandsp/src/spandsp/hdlc.h index 20adceb4df..ac3172001f 100644 --- a/libs/spandsp/src/spandsp/hdlc.h +++ b/libs/spandsp/src/spandsp/hdlc.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: hdlc.h,v 1.41 2009/01/31 08:48:11 steveu Exp $ + * $Id: hdlc.h,v 1.42 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -95,11 +95,11 @@ extern "C" \return A pointer to the HDLC receiver context. */ SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s, - int crc32, - int report_bad_frames, - int framing_ok_threshold, - hdlc_frame_handler_t handler, - void *user_data); + int crc32, + int report_bad_frames, + int framing_ok_threshold, + hdlc_frame_handler_t handler, + void *user_data); /*! \brief Set the maximum frame length for an HDLC receiver context. \param s A pointer to an HDLC receiver context. @@ -151,11 +151,11 @@ SPAN_DECLARE(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], int len) \return A pointer to the HDLC transmitter context. */ SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s, - int crc32, - int inter_frame_flags, - int progressive, - hdlc_underflow_handler_t handler, - void *user_data); + int crc32, + int inter_frame_flags, + int progressive, + hdlc_underflow_handler_t handler, + void *user_data); /*! \brief Set the maximum frame length for an HDLC transmitter context. \param s A pointer to an HDLC transmitter context. diff --git a/libs/spandsp/src/spandsp/ima_adpcm.h b/libs/spandsp/src/spandsp/ima_adpcm.h index 8c06481909..c1b6e8d200 100644 --- a/libs/spandsp/src/spandsp/ima_adpcm.h +++ b/libs/spandsp/src/spandsp/ima_adpcm.h @@ -26,7 +26,7 @@ * Based on a bit from here, a bit from there, eye of toad, * ear of bat, etc - plus, of course, my own 2 cents. * - * $Id: ima_adpcm.h,v 1.22 2009/01/31 08:48:11 steveu Exp $ + * $Id: ima_adpcm.h,v 1.23 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -74,8 +74,8 @@ extern "C" as a chunk. \return A pointer to the IMA ADPCM context, or NULL for error. */ SPAN_DECLARE(ima_adpcm_state_t *) ima_adpcm_init(ima_adpcm_state_t *s, - int variant, - int chunk_size); + int variant, + int chunk_size); /*! Free an IMA ADPCM encode or decode context. \param s The IMA ADPCM context. diff --git a/libs/spandsp/src/spandsp/lpc10.h b/libs/spandsp/src/spandsp/lpc10.h index c46b8149b4..fa5a1241e9 100644 --- a/libs/spandsp/src/spandsp/lpc10.h +++ b/libs/spandsp/src/spandsp/lpc10.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: lpc10.h,v 1.19 2009/01/31 08:48:11 steveu Exp $ + * $Id: lpc10.h,v 1.20 2009/02/03 16:28:41 steveu Exp $ */ #if !defined(_SPANDSP_LPC10_H_) diff --git a/libs/spandsp/src/spandsp/modem_connect_tones.h b/libs/spandsp/src/spandsp/modem_connect_tones.h index 96c45af167..c8dc4e2f5d 100644 --- a/libs/spandsp/src/spandsp/modem_connect_tones.h +++ b/libs/spandsp/src/spandsp/modem_connect_tones.h @@ -24,7 +24,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: modem_connect_tones.h,v 1.20 2009/01/31 08:48:11 steveu Exp $ + * $Id: modem_connect_tones.h,v 1.21 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -105,7 +105,7 @@ extern "C" \param s The context. */ SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem_connect_tones_tx_state_t *s, - int tone_type); + int tone_type); /*! \brief Free an instance of the modem connect tones generator. \param s The context. @@ -148,9 +148,9 @@ SPAN_DECLARE(int) modem_connect_tones_rx_get(modem_connect_tones_rx_state_t *s); \return A pointer to the context. */ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem_connect_tones_rx_state_t *s, - int tone_type, - tone_report_func_t tone_callback, - void *user_data); + int tone_type, + tone_report_func_t tone_callback, + void *user_data); /*! \brief Free an instance of the modem connect tones detector. \param s The context. diff --git a/libs/spandsp/src/spandsp/modem_echo.h b/libs/spandsp/src/spandsp/modem_echo.h index 3e888d19b5..cc9f06e45e 100644 --- a/libs/spandsp/src/spandsp/modem_echo.h +++ b/libs/spandsp/src/spandsp/modem_echo.h @@ -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: modem_echo.h,v 1.12 2009/01/31 08:48:11 steveu Exp $ + * $Id: modem_echo.h,v 1.13 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/noise.h b/libs/spandsp/src/spandsp/noise.h index 6e5f498fc0..d04dbe3204 100644 --- a/libs/spandsp/src/spandsp/noise.h +++ b/libs/spandsp/src/spandsp/noise.h @@ -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: noise.h,v 1.15 2009/01/31 08:48:11 steveu Exp $ + * $Id: noise.h,v 1.16 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/oki_adpcm.h b/libs/spandsp/src/spandsp/oki_adpcm.h index b8b2898e88..dec6b4df8d 100644 --- a/libs/spandsp/src/spandsp/oki_adpcm.h +++ b/libs/spandsp/src/spandsp/oki_adpcm.h @@ -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: oki_adpcm.h,v 1.22 2009/01/31 08:48:11 steveu Exp $ + * $Id: oki_adpcm.h,v 1.23 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -62,7 +62,7 @@ extern "C" The valid rates are 24000 and 32000. \return A pointer to the Oki ADPCM context, or NULL for error. */ SPAN_DECLARE(oki_adpcm_state_t *) oki_adpcm_init(oki_adpcm_state_t *s, - int bit_rate); + int bit_rate); /*! Free an Oki ADPCM encode or decode context. \param s The Oki ADPCM context. diff --git a/libs/spandsp/src/spandsp/playout.h b/libs/spandsp/src/spandsp/playout.h index d6f900e7b1..d6d2a6c8fd 100644 --- a/libs/spandsp/src/spandsp/playout.h +++ b/libs/spandsp/src/spandsp/playout.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: playout.h,v 1.12 2009/01/31 08:48:11 steveu Exp $ + * $Id: playout.h,v 1.13 2009/02/03 16:28:41 steveu Exp $ */ #if !defined(_SPANDSP_PLAYOUT_H_) diff --git a/libs/spandsp/src/spandsp/plc.h b/libs/spandsp/src/spandsp/plc.h index f91ca9ab32..b01fe9af12 100644 --- a/libs/spandsp/src/spandsp/plc.h +++ b/libs/spandsp/src/spandsp/plc.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: plc.h,v 1.19 2009/01/31 08:48:11 steveu Exp $ + * $Id: plc.h,v 1.20 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/power_meter.h b/libs/spandsp/src/spandsp/power_meter.h index 351632b2d0..27a3576dd8 100644 --- a/libs/spandsp/src/spandsp/power_meter.h +++ b/libs/spandsp/src/spandsp/power_meter.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: power_meter.h,v 1.16 2009/01/31 08:48:11 steveu Exp $ + * $Id: power_meter.h,v 1.17 2009/02/03 16:28:41 steveu Exp $ */ #if !defined(_POWER_METER_H_) diff --git a/libs/spandsp/src/spandsp/queue.h b/libs/spandsp/src/spandsp/queue.h index afca056057..cf0d18ae78 100644 --- a/libs/spandsp/src/spandsp/queue.h +++ b/libs/spandsp/src/spandsp/queue.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: queue.h,v 1.19 2009/01/31 08:48:11 steveu Exp $ + * $Id: queue.h,v 1.20 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/saturated.h b/libs/spandsp/src/spandsp/saturated.h index 61cc702054..ad9d3ff0fe 100644 --- a/libs/spandsp/src/spandsp/saturated.h +++ b/libs/spandsp/src/spandsp/saturated.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: saturated.h,v 1.1 2008/09/19 14:02:05 steveu Exp $ + * $Id: saturated.h,v 1.3 2009/02/03 17:25:53 steveu Exp $ */ /*! \file */ @@ -75,7 +75,8 @@ static __inline__ int16_t fsaturatef(float famp) return INT16_MAX; if (famp < (float) INT16_MIN) return INT16_MIN; - return (int16_t) rintf(famp); + //return (int16_t) lfastrintf(famp); + return (int16_t) lrintf(famp); } /*- End of function --------------------------------------------------------*/ @@ -85,7 +86,8 @@ static __inline__ int16_t fsaturate(double damp) return INT16_MAX; if (damp < (double) INT16_MIN) return INT16_MIN; - return (int16_t) rint(damp); + //return (int16_t) lfastrint(damp); + return (int16_t) lrint(damp); } /*- End of function --------------------------------------------------------*/ diff --git a/libs/spandsp/src/spandsp/schedule.h b/libs/spandsp/src/spandsp/schedule.h index 2c60ec275c..d9f607a186 100644 --- a/libs/spandsp/src/spandsp/schedule.h +++ b/libs/spandsp/src/spandsp/schedule.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: schedule.h,v 1.18 2009/01/31 08:48:11 steveu Exp $ + * $Id: schedule.h,v 1.19 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/sig_tone.h b/libs/spandsp/src/spandsp/sig_tone.h index e8573ea600..2f397be749 100644 --- a/libs/spandsp/src/spandsp/sig_tone.h +++ b/libs/spandsp/src/spandsp/sig_tone.h @@ -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: sig_tone.h,v 1.16 2009/01/31 08:48:11 steveu Exp $ + * $Id: sig_tone.h,v 1.17 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/silence_gen.h b/libs/spandsp/src/spandsp/silence_gen.h index 79bf0df88a..48b471c6e1 100644 --- a/libs/spandsp/src/spandsp/silence_gen.h +++ b/libs/spandsp/src/spandsp/silence_gen.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: silence_gen.h,v 1.13 2009/01/31 08:48:11 steveu Exp $ + * $Id: silence_gen.h,v 1.14 2009/02/03 16:28:41 steveu Exp $ */ #if !defined(_SPANDSP_SILENCE_GEN_H_) @@ -117,7 +117,7 @@ SPAN_DECLARE(silence_gen_state_t *) silence_gen_init(silence_gen_state_t *s, int \param len The length of the signal buffer \return 0. */ -int span_dummy_rx(void *user_data, const int16_t amp[], int len); +SPAN_DECLARE(int) span_dummy_rx(void *user_data, const int16_t amp[], int len); /*! A dummy routine to use as a signal modifier callback, when we aren't really trying to process the signal. It just returns without affecting diff --git a/libs/spandsp/src/spandsp/super_tone_rx.h b/libs/spandsp/src/spandsp/super_tone_rx.h index 0fff5477b6..a24bc8b2ef 100644 --- a/libs/spandsp/src/spandsp/super_tone_rx.h +++ b/libs/spandsp/src/spandsp/super_tone_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: super_tone_rx.h,v 1.19 2009/01/31 08:48:11 steveu Exp $ + * $Id: super_tone_rx.h,v 1.20 2009/02/03 16:28:41 steveu Exp $ */ #if !defined(_SPANDSP_SUPER_TONE_RX_H_) @@ -111,9 +111,9 @@ SPAN_DECLARE(int) super_tone_rx_add_element(super_tone_rx_descriptor_t *desc, \return The supervisory tone detector context. */ SPAN_DECLARE(super_tone_rx_state_t *) super_tone_rx_init(super_tone_rx_state_t *s, - super_tone_rx_descriptor_t *desc, - tone_report_func_t callback, - void *user_data); + super_tone_rx_descriptor_t *desc, + tone_report_func_t callback, + void *user_data); /*! Release a supervisory tone detector. \param s The supervisory tone context. diff --git a/libs/spandsp/src/spandsp/super_tone_tx.h b/libs/spandsp/src/spandsp/super_tone_tx.h index a36a45d14b..b6153f8d39 100644 --- a/libs/spandsp/src/spandsp/super_tone_tx.h +++ b/libs/spandsp/src/spandsp/super_tone_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: super_tone_tx.h,v 1.15 2009/01/31 08:48:11 steveu Exp $ + * $Id: super_tone_tx.h,v 1.16 2009/02/03 16:28:41 steveu Exp $ */ #if !defined(_SPANDSP_SUPER_TONE_TX_H_) @@ -51,12 +51,12 @@ extern "C" #endif SPAN_DECLARE(super_tone_tx_step_t *) super_tone_tx_make_step(super_tone_tx_step_t *s, - float f1, - float l1, - float f2, - float l2, - int length, - int cycles); + float f1, + float l1, + float f2, + float l2, + int length, + int cycles); SPAN_DECLARE(void) super_tone_tx_free(super_tone_tx_step_t *s); diff --git a/libs/spandsp/src/spandsp/t30.h b/libs/spandsp/src/spandsp/t30.h index dfbdf39628..614373055f 100644 --- a/libs/spandsp/src/spandsp/t30.h +++ b/libs/spandsp/src/spandsp/t30.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: t30.h,v 1.121 2009/01/31 08:48:11 steveu Exp $ + * $Id: t30.h,v 1.122 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -559,13 +559,13 @@ extern "C" \param send_hdlc_user_data \return A pointer to the context, or NULL if there was a problem. */ SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s, - int calling_party, - t30_set_handler_t *set_rx_type_handler, - void *set_rx_type_user_data, - t30_set_handler_t *set_tx_type_handler, - void *set_tx_type_user_data, - t30_send_hdlc_handler_t *send_hdlc_handler, - void *send_hdlc_user_data); + int calling_party, + t30_set_handler_t *set_rx_type_handler, + void *set_rx_type_user_data, + t30_set_handler_t *set_tx_type_handler, + void *set_tx_type_user_data, + t30_send_hdlc_handler_t *send_hdlc_handler, + void *send_hdlc_user_data); /*! Release a T.30 context. \brief Release a T.30 context. @@ -607,7 +607,7 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status); \brief Get a bit of received non-ECM image data. \param user_data An opaque pointer, which must point to the T.30 context. \return The next bit to transmit. */ -int t30_non_ecm_get_bit(void *user_data); +SPAN_DECLARE(int) t30_non_ecm_get_bit(void *user_data); /*! Get a byte of received non-ECM image data. \brief Get a byte of received non-ECM image data. @@ -627,7 +627,7 @@ SPAN_DECLARE(int) t30_non_ecm_get_chunk(void *user_data, uint8_t buf[], int max_ \brief Process a bit of received non-ECM image data \param user_data An opaque pointer, which must point to the T.30 context. \param bit The received bit. */ -void t30_non_ecm_put_bit(void *user_data, int bit); +SPAN_DECLARE(void) t30_non_ecm_put_bit(void *user_data, int bit); /*! Process a byte of received non-ECM image data. \brief Process a byte of received non-ECM image data @@ -648,7 +648,7 @@ SPAN_DECLARE(void) t30_non_ecm_put_chunk(void *user_data, const uint8_t buf[], i \param msg The HDLC message. \param len The length of the message, in octets. \param ok TRUE if the frame was received without error. */ -void t30_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok); +SPAN_DECLARE(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok); /*! Report the passage of time to the T.30 engine. \brief Report the passage of time to the T.30 engine. diff --git a/libs/spandsp/src/spandsp/t30_api.h b/libs/spandsp/src/spandsp/t30_api.h index 8653de537b..92725a8040 100644 --- a/libs/spandsp/src/spandsp/t30_api.h +++ b/libs/spandsp/src/spandsp/t30_api.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: t30_api.h,v 1.8 2009/01/31 08:48:11 steveu Exp $ + * $Id: t30_api.h,v 1.9 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/t30_logging.h b/libs/spandsp/src/spandsp/t30_logging.h index 2c94777189..cd68fdca97 100644 --- a/libs/spandsp/src/spandsp/t30_logging.h +++ b/libs/spandsp/src/spandsp/t30_logging.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: t30_logging.h,v 1.3 2009/01/31 08:48:11 steveu Exp $ + * $Id: t30_logging.h,v 1.4 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/t31.h b/libs/spandsp/src/spandsp/t31.h index 71b232f1b2..f33d071ac9 100644 --- a/libs/spandsp/src/spandsp/t31.h +++ b/libs/spandsp/src/spandsp/t31.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: t31.h,v 1.56 2009/01/31 08:48:11 steveu Exp $ + * $Id: t31.h,v 1.57 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -127,12 +127,12 @@ SPAN_DECLARE(t38_core_state_t *) t31_get_t38_core_state(t31_state_t *s); \param tx_t38_packet_user_data ??? \return A pointer to the T.31 context. */ SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s, - at_tx_handler_t *at_tx_handler, - void *at_tx_user_data, - t31_modem_control_handler_t *modem_control_handler, - void *modem_control_user_data, - t38_tx_packet_handler_t *tx_t38_packet_handler, - void *tx_t38_packet_user_data); + at_tx_handler_t *at_tx_handler, + void *at_tx_user_data, + t31_modem_control_handler_t *modem_control_handler, + void *modem_control_user_data, + t38_tx_packet_handler_t *tx_t38_packet_handler, + void *tx_t38_packet_user_data); /*! Release a T.31 context. \brief Release a T.31 context. diff --git a/libs/spandsp/src/spandsp/t38_core.h b/libs/spandsp/src/spandsp/t38_core.h index 01e4fded87..1d31e7ff79 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.35 2009/01/31 08:48:11 steveu Exp $ + * $Id: t38_core.h,v 1.36 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -329,12 +329,12 @@ SPAN_DECLARE(void) t38_set_tep_handling(t38_core_state_t *s, int allow_for_tep); SPAN_DECLARE(logging_state_t *) t38_core_get_logging_state(t38_core_state_t *s); SPAN_DECLARE(t38_core_state_t *) t38_core_init(t38_core_state_t *s, - t38_rx_indicator_handler_t *rx_indicator_handler, - t38_rx_data_handler_t *rx_data_handler, - t38_rx_missing_handler_t *rx_missing_handler, - void *rx_user_data, - t38_tx_packet_handler_t *tx_packet_handler, - void *tx_packet_user_data); + t38_rx_indicator_handler_t *rx_indicator_handler, + t38_rx_data_handler_t *rx_data_handler, + t38_rx_missing_handler_t *rx_missing_handler, + void *rx_user_data, + t38_tx_packet_handler_t *tx_packet_handler, + void *tx_packet_user_data); #if defined(__cplusplus) } diff --git a/libs/spandsp/src/spandsp/t38_gateway.h b/libs/spandsp/src/spandsp/t38_gateway.h index 9b5788ad0f..ea6dd25f0a 100644 --- a/libs/spandsp/src/spandsp/t38_gateway.h +++ b/libs/spandsp/src/spandsp/t38_gateway.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_gateway.h,v 1.60 2009/01/31 08:48:11 steveu Exp $ + * $Id: t38_gateway.h,v 1.61 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -83,8 +83,8 @@ extern "C" \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine. \return A pointer to the termination mode T.38 context, or NULL if there was a problem. */ SPAN_DECLARE(t38_gateway_state_t *) t38_gateway_init(t38_gateway_state_t *s, - 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); /*! Free a gateway mode T.38 context. \brief Free a T.38 context. diff --git a/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h b/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h index 6a0a7be0dc..cb6f503023 100644 --- a/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h +++ b/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h @@ -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_non_ecm_buffer.h,v 1.4 2009/01/31 08:48:11 steveu Exp $ + * $Id: t38_non_ecm_buffer.h,v 1.5 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -93,7 +93,7 @@ SPAN_DECLARE(void) t38_non_ecm_buffer_report_output_status(t38_non_ecm_buffer_st /*! \brief Get the next bit of data from a T.38 rate adapting non-ECM buffer context. \param user_data The buffer context, cast to a void pointer. \return The next bit, or one of the values indicating a change of modem status. */ -int t38_non_ecm_buffer_get_bit(void *user_data); +SPAN_DECLARE(int) t38_non_ecm_buffer_get_bit(void *user_data); #if defined(__cplusplus) } diff --git a/libs/spandsp/src/spandsp/t38_terminal.h b/libs/spandsp/src/spandsp/t38_terminal.h index 34a023a420..4bcb1e0d28 100644 --- a/libs/spandsp/src/spandsp/t38_terminal.h +++ b/libs/spandsp/src/spandsp/t38_terminal.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_terminal.h,v 1.40 2009/01/31 08:48:11 steveu Exp $ + * $Id: t38_terminal.h,v 1.41 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -95,9 +95,9 @@ SPAN_DECLARE(logging_state_t *) t38_terminal_get_logging_state(t38_terminal_stat \param tx_packet_user_data An opaque pointer passed to the tx_packet_handler routine. \return A pointer to the termination mode T.38 context, or NULL if there was a problem. */ SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s, - int calling_party, - t38_tx_packet_handler_t *tx_packet_handler, - void *tx_packet_user_data); + int calling_party, + t38_tx_packet_handler_t *tx_packet_handler, + void *tx_packet_user_data); /*! Release a termination mode T.38 context. \brief Release a T.38 context. diff --git a/libs/spandsp/src/spandsp/t4.h b/libs/spandsp/src/spandsp/t4.h index 5e1ea8450e..3717b8ad19 100644 --- a/libs/spandsp/src/spandsp/t4.h +++ b/libs/spandsp/src/spandsp/t4.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: t4.h,v 1.54 2009/01/31 08:48:11 steveu Exp $ + * $Id: t4.h,v 1.55 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/telephony.h b/libs/spandsp/src/spandsp/telephony.h index 7520adcd80..90f23615ec 100644 --- a/libs/spandsp/src/spandsp/telephony.h +++ b/libs/spandsp/src/spandsp/telephony.h @@ -22,30 +22,30 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: telephony.h,v 1.15 2009/01/31 12:12:21 steveu Exp $ + * $Id: telephony.h,v 1.16 2009/02/03 16:28:41 steveu Exp $ */ #if !defined(_SPANDSP_TELEPHONY_H_) #define _SPANDSP_TELEPHONY_H_ #if defined(WIN32) -# if defined(LIBSPANDSP_EXPORTS) -# define SPAN_DECLARE(type) __declspec(dllexport) type __stdcall -# define SPAN_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl -# define SPAN_DECLARE_DATA __declspec(dllexport) -# else -# define SPAN_DECLARE(type) __declspec(dllimport) type __stdcall -# define SPAN_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl -# define SPAN_DECLARE_DATA __declspec(dllimport) -# endif -#elif defined(SPANDSP_USE_EXPORT_CAPABILITY) && (defined(__GNUC__) || defined(__SUNCC__)) -# define SPAN_DECLARE(type) __attribute__((visibility("default"))) type -# define SPAN_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type -# define SPAN_DECLARE_DATA __attribute__((visibility("default"))) +#if defined(LIBSPANDSP_EXPORTS) +#define SPAN_DECLARE(type) __declspec(dllexport) type __stdcall +#define SPAN_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl +#define SPAN_DECLARE_DATA __declspec(dllexport) #else -# define SPAN_DECLARE(type) /**/ type -# define SPAN_DECLARE_NONSTD(type) /**/ type -# define SPAN_DECLARE_DATA /**/ +#define SPAN_DECLARE(type) __declspec(dllimport) type __stdcall +#define SPAN_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl +#define SPAN_DECLARE_DATA __declspec(dllimport) +#endif +#elif defined(SPANDSP_USE_EXPORT_CAPABILITY) && (defined(__GNUC__) || defined(__SUNCC__)) +#define SPAN_DECLARE(type) __attribute__((visibility("default"))) type +#define SPAN_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type +#define SPAN_DECLARE_DATA __attribute__((visibility("default"))) +#else +#define SPAN_DECLARE(type) /**/ type +#define SPAN_DECLARE_NONSTD(type) /**/ type +#define SPAN_DECLARE_DATA /**/ #endif #define SAMPLE_RATE 8000 diff --git a/libs/spandsp/src/spandsp/time_scale.h b/libs/spandsp/src/spandsp/time_scale.h index 487a793617..f42526d75a 100644 --- a/libs/spandsp/src/spandsp/time_scale.h +++ b/libs/spandsp/src/spandsp/time_scale.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: time_scale.h,v 1.18 2009/01/31 08:48:11 steveu Exp $ + * $Id: time_scale.h,v 1.19 2009/02/03 16:28:41 steveu Exp $ */ #if !defined(_SPANDSP_TIME_SCALE_H_) diff --git a/libs/spandsp/src/spandsp/tone_detect.h b/libs/spandsp/src/spandsp/tone_detect.h index 0ec112c31e..07fe02df58 100644 --- a/libs/spandsp/src/spandsp/tone_detect.h +++ b/libs/spandsp/src/spandsp/tone_detect.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: tone_detect.h,v 1.43 2009/01/31 08:48:11 steveu Exp $ + * $Id: tone_detect.h,v 1.44 2009/02/03 16:28:41 steveu Exp $ */ #if !defined(_SPANDSP_TONE_DETECT_H_) @@ -75,29 +75,29 @@ extern "C" #endif /*! \brief Create a descriptor for use with either a Goertzel transform */ -void make_goertzel_descriptor(goertzel_descriptor_t *t, - float freq, - int samples); +SPAN_DECLARE(void) make_goertzel_descriptor(goertzel_descriptor_t *t, + float freq, + int samples); /*! \brief Initialise the state of a Goertzel transform. \param s The Goertzel context. If NULL, a context is allocated with malloc. \param t The Goertzel descriptor. \return A pointer to the Goertzel state. */ -goertzel_state_t *goertzel_init(goertzel_state_t *s, - goertzel_descriptor_t *t); +SPAN_DECLARE(goertzel_state_t *) goertzel_init(goertzel_state_t *s, + goertzel_descriptor_t *t); /*! \brief Reset the state of a Goertzel transform. \param s The Goertzel context. */ -void goertzel_reset(goertzel_state_t *s); +SPAN_DECLARE(void) goertzel_reset(goertzel_state_t *s); /*! \brief Update the state of a Goertzel transform. \param s The Goertzel context. \param amp The samples to be transformed. \param samples The number of samples. \return The number of samples unprocessed */ -int goertzel_update(goertzel_state_t *s, - const int16_t amp[], - int samples); +SPAN_DECLARE(int) goertzel_update(goertzel_state_t *s, + const int16_t amp[], + int samples); /*! \brief Evaluate the final result of a Goertzel transform. \param s The Goertzel context. @@ -106,9 +106,9 @@ int goertzel_update(goertzel_state_t *s, [Floating point] ((samples_per_goertzel_block*32768.0/1.4142)*10^((x - DBM0_MAX_SINE_POWER)/20.0))^2 [Fixed point] ((samples_per_goertzel_block*256.0/1.4142)*10^((x - DBM0_MAX_SINE_POWER)/20.0))^2 */ #if defined(SPANDSP_USE_FIXED_POINT) -int32_t goertzel_result(goertzel_state_t *s); +SPAN_DECLARE(int32_t) goertzel_result(goertzel_state_t *s); #else -float goertzel_result(goertzel_state_t *s); +SPAN_DECLARE(float) goertzel_result(goertzel_state_t *s); #endif /*! \brief Update the state of a Goertzel transform. diff --git a/libs/spandsp/src/spandsp/tone_generate.h b/libs/spandsp/src/spandsp/tone_generate.h index 0b79209b9a..8e78d70fc7 100644 --- a/libs/spandsp/src/spandsp/tone_generate.h +++ b/libs/spandsp/src/spandsp/tone_generate.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: tone_generate.h,v 1.36 2009/01/31 08:48:11 steveu Exp $ + * $Id: tone_generate.h,v 1.37 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/v17rx.h b/libs/spandsp/src/spandsp/v17rx.h index 3bbc622539..8d8d77e71e 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.59 2009/01/31 08:48:11 steveu Exp $ + * $Id: v17rx.h,v 1.60 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/v17tx.h b/libs/spandsp/src/spandsp/v17tx.h index 6cf5a50e12..c02684b3b2 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.38 2009/01/31 08:48:11 steveu Exp $ + * $Id: v17tx.h,v 1.39 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/v22bis.h b/libs/spandsp/src/spandsp/v22bis.h index 896c2525d5..4bb755312b 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.33 2009/01/31 08:48:11 steveu Exp $ + * $Id: v22bis.h,v 1.34 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -145,12 +145,12 @@ SPAN_DECLARE(int) v22bis_restart(v22bis_state_t *s, int bit_rate); \param user_data An opaque pointer, passed in calls to the get and put routines. \return A pointer to the modem context, or NULL if there was a problem. */ SPAN_DECLARE(v22bis_state_t *) v22bis_init(v22bis_state_t *s, - int bit_rate, - int guard, - int caller, - get_bit_func_t get_bit, - put_bit_func_t put_bit, - void *user_data); + int bit_rate, + int guard, + int caller, + get_bit_func_t get_bit, + put_bit_func_t put_bit, + void *user_data); /*! Free a V.22bis modem receive context. \brief Free a V.22bis modem receive context. diff --git a/libs/spandsp/src/spandsp/v27ter_rx.h b/libs/spandsp/src/spandsp/v27ter_rx.h index 43de608f19..7d660a07f8 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.55 2009/01/31 08:48:11 steveu Exp $ + * $Id: v27ter_rx.h,v 1.56 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/v27ter_tx.h b/libs/spandsp/src/spandsp/v27ter_tx.h index 89bede7404..8dcfd9442e 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.38 2009/01/31 08:48:11 steveu Exp $ + * $Id: v27ter_tx.h,v 1.39 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/v29rx.h b/libs/spandsp/src/spandsp/v29rx.h index 06dbe9c2fc..59b0e4c106 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.66 2009/01/31 08:48:11 steveu Exp $ + * $Id: v29rx.h,v 1.67 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/v29tx.h b/libs/spandsp/src/spandsp/v29tx.h index 6334adb5b5..f0fd50e457 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.36 2009/01/31 08:48:11 steveu Exp $ + * $Id: v29tx.h,v 1.37 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/spandsp/v42.h b/libs/spandsp/src/spandsp/v42.h index c1f631f2dd..2b43c5a396 100644 --- a/libs/spandsp/src/spandsp/v42.h +++ b/libs/spandsp/src/spandsp/v42.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: v42.h,v 1.27 2009/01/31 08:48:11 steveu Exp $ + * $Id: v42.h,v 1.28 2009/02/03 16:28:41 steveu Exp $ */ /*! \page v42_page V.42 modem error correction @@ -94,7 +94,7 @@ SPAN_DECLARE(void) lapm_dump(lapm_state_t *s, const uint8_t *frame, int len, int /*! Accept an HDLC packet */ -void lapm_receive(void *user_data, const uint8_t *buf, int len, int ok); +SPAN_DECLARE(void) lapm_receive(void *user_data, const uint8_t *buf, int len, int ok); /*! Transmit a LAP.M frame */ diff --git a/libs/spandsp/src/spandsp/v42bis.h b/libs/spandsp/src/spandsp/v42bis.h index c1c9865077..1f74fc71f9 100644 --- a/libs/spandsp/src/spandsp/v42bis.h +++ b/libs/spandsp/src/spandsp/v42bis.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: v42bis.h,v 1.24 2009/01/31 08:48:11 steveu Exp $ + * $Id: v42bis.h,v 1.25 2009/02/03 16:28:41 steveu Exp $ */ /*! \page v42bis_page V.42bis modem data compression @@ -107,15 +107,15 @@ SPAN_DECLARE(int) v42bis_decompress_flush(v42bis_state_t *s); \param max_data_len The maximum length that should be passed to the data handler. \return The V.42bis context. */ SPAN_DECLARE(v42bis_state_t *) v42bis_init(v42bis_state_t *s, - int negotiated_p0, - int negotiated_p1, - int negotiated_p2, - v42bis_frame_handler_t frame_handler, - void *frame_user_data, - int max_frame_len, - v42bis_data_handler_t data_handler, - void *data_user_data, - int max_data_len); + int negotiated_p0, + int negotiated_p1, + int negotiated_p2, + v42bis_frame_handler_t frame_handler, + void *frame_user_data, + int max_frame_len, + v42bis_data_handler_t data_handler, + void *data_user_data, + int max_data_len); /*! Set the compression mode. \param s The V.42bis context. diff --git a/libs/spandsp/src/spandsp/v8.h b/libs/spandsp/src/spandsp/v8.h index 05723900b6..61533102bd 100644 --- a/libs/spandsp/src/spandsp/v8.h +++ b/libs/spandsp/src/spandsp/v8.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: v8.h,v 1.26 2009/01/31 08:48:11 steveu Exp $ + * $Id: v8.h,v 1.27 2009/02/03 16:28:41 steveu Exp $ */ /*! \file */ @@ -129,10 +129,10 @@ extern "C" \param user_data An opaque pointer passed to the result_handler routine. \return A pointer to the V.8 context, or NULL if there was a problem. */ SPAN_DECLARE(v8_state_t *) v8_init(v8_state_t *s, - int caller, - int available_modulations, - v8_result_handler_t *result_handler, - void *user_data); + int caller, + int available_modulations, + v8_result_handler_t *result_handler, + void *user_data); /*! Release a V.8 context. \brief Release a V.8 context. diff --git a/libs/spandsp/src/spandsp/version.h b/libs/spandsp/src/spandsp/version.h index d0789683cc..c22108a75d 100644 --- a/libs/spandsp/src/spandsp/version.h +++ b/libs/spandsp/src/spandsp/version.h @@ -30,8 +30,8 @@ /* The date and time of the version are in UTC form. */ -#define SPANDSP_RELEASE_DATE 20090131 -#define SPANDSP_RELEASE_TIME 122642 +#define SPANDSP_RELEASE_DATE 20090203 +#define SPANDSP_RELEASE_TIME 172817 #endif /*- End of file ------------------------------------------------------------*/ diff --git a/libs/spandsp/src/super_tone_rx.c b/libs/spandsp/src/super_tone_rx.c index 39e5b97163..840154166d 100644 --- a/libs/spandsp/src/super_tone_rx.c +++ b/libs/spandsp/src/super_tone_rx.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: super_tone_rx.c,v 1.31 2009/01/28 03:41:27 steveu Exp $ + * $Id: super_tone_rx.c,v 1.32 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -47,6 +47,7 @@ #include "floating_fudge.h" #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/complex.h" #include "spandsp/vector_float.h" #include "spandsp/complex_vector_float.h" @@ -120,11 +121,11 @@ SPAN_DECLARE(int) super_tone_rx_add_tone(super_tone_rx_descriptor_t *desc) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(int) super_tone_rx_add_element(super_tone_rx_descriptor_t *desc, - int tone, - int f1, - int f2, - int min, - int max) + int tone, + int f1, + int f2, + int min, + int max) { int step; @@ -224,16 +225,16 @@ SPAN_DECLARE(int) super_tone_rx_free_descriptor(super_tone_rx_descriptor_t *desc /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(void) super_tone_rx_segment_callback(super_tone_rx_state_t *s, - void (*callback)(void *data, int f1, int f2, int duration)) + void (*callback)(void *data, int f1, int f2, int duration)) { s->segment_callback = callback; } /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(super_tone_rx_state_t *) super_tone_rx_init(super_tone_rx_state_t *s, - super_tone_rx_descriptor_t *desc, - tone_report_func_t callback, - void *user_data) + super_tone_rx_descriptor_t *desc, + tone_report_func_t callback, + void *user_data) { int i; diff --git a/libs/spandsp/src/super_tone_tx.c b/libs/spandsp/src/super_tone_tx.c index 4f3ad9342f..99d7616a31 100644 --- a/libs/spandsp/src/super_tone_tx.c +++ b/libs/spandsp/src/super_tone_tx.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: super_tone_tx.c,v 1.27 2009/01/28 03:41:27 steveu Exp $ + * $Id: super_tone_tx.c,v 1.28 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -47,6 +47,7 @@ #include "floating_fudge.h" #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/complex.h" #include "spandsp/dds.h" #include "spandsp/tone_generate.h" @@ -70,12 +71,12 @@ */ SPAN_DECLARE(super_tone_tx_step_t *) super_tone_tx_make_step(super_tone_tx_step_t *s, - float f1, - float l1, - float f2, - float l2, - int length, - int cycles) + float f1, + float l1, + float f2, + float l2, + int length, + int cycles) { if (s == NULL) { @@ -193,7 +194,7 @@ SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max /* There must be two, and only two tones */ xamp = dds_modf(&s->phase[0], -s->tone[0].phase_rate, s->tone[0].gain, 0) *(1.0f + dds_modf(&s->phase[1], s->tone[1].phase_rate, s->tone[1].gain, 0)); - amp[samples] = (int16_t) lrintf(xamp); + amp[samples] = (int16_t) lfastrintf(xamp); } } else @@ -207,7 +208,7 @@ SPAN_DECLARE(int) super_tone_tx(super_tone_tx_state_t *s, int16_t amp[], int max break; xamp += dds_modf(&s->phase[i], s->tone[i].phase_rate, s->tone[i].gain, 0); } - amp[samples] = (int16_t) lrintf(xamp); + amp[samples] = (int16_t) lfastrintf(xamp); } } if (s->current_position) diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index d546ba2bfc..c4c5849005 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.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: t30.c,v 1.282 2009/01/31 09:47:59 steveu Exp $ + * $Id: t30.c,v 1.283 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -4986,7 +4986,7 @@ static void t30_non_ecm_rx_status(void *user_data, int status) } /*- End of function --------------------------------------------------------*/ -void t30_non_ecm_put_bit(void *user_data, int bit) +SPAN_DECLARE(void) t30_non_ecm_put_bit(void *user_data, int bit) { t30_state_t *s; @@ -5102,7 +5102,7 @@ SPAN_DECLARE(void) t30_non_ecm_put_chunk(void *user_data, const uint8_t buf[], i } /*- End of function --------------------------------------------------------*/ -int t30_non_ecm_get_bit(void *user_data) +SPAN_DECLARE(int) t30_non_ecm_get_bit(void *user_data) { int bit; t30_state_t *s; @@ -5302,7 +5302,7 @@ static void t30_hdlc_rx_status(void *user_data, int status) } /*- End of function --------------------------------------------------------*/ -void t30_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok) +SPAN_DECLARE(void) t30_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok) { t30_state_t *s; @@ -5823,13 +5823,13 @@ SPAN_DECLARE(int) t30_restart(t30_state_t *s) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(t30_state_t *) t30_init(t30_state_t *s, - int calling_party, - t30_set_handler_t *set_rx_type_handler, - void *set_rx_type_user_data, - t30_set_handler_t *set_tx_type_handler, - void *set_tx_type_user_data, - t30_send_hdlc_handler_t *send_hdlc_handler, - void *send_hdlc_user_data) + int calling_party, + t30_set_handler_t *set_rx_type_handler, + void *set_rx_type_user_data, + t30_set_handler_t *set_tx_type_handler, + void *set_tx_type_user_data, + t30_send_hdlc_handler_t *send_hdlc_handler, + void *send_hdlc_user_data) { if (s == NULL) { diff --git a/libs/spandsp/src/t30_api.c b/libs/spandsp/src/t30_api.c index 58bc780626..0aa4ccf082 100644 --- a/libs/spandsp/src/t30_api.c +++ b/libs/spandsp/src/t30_api.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: t30_api.c,v 1.12 2009/01/28 03:41:27 steveu Exp $ + * $Id: t30_api.c,v 1.13 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/t30_logging.c b/libs/spandsp/src/t30_logging.c index 77206d0cca..b9fce80b9d 100644 --- a/libs/spandsp/src/t30_logging.c +++ b/libs/spandsp/src/t30_logging.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: t30_logging.c,v 1.10 2009/01/28 03:41:27 steveu Exp $ + * $Id: t30_logging.c,v 1.11 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/t31.c b/libs/spandsp/src/t31.c index 9c77671534..99f562d055 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.137 2009/01/29 01:41:06 steveu Exp $ + * $Id: t31.c,v 1.139 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -633,17 +633,17 @@ static __inline__ int bits_to_us(t31_state_t *s, int bits) static void set_octets_per_data_packet(t31_state_t *s, int bit_rate) { s->t38_fe.tx_bit_rate = bit_rate; - if (s->t38_fe.ms_per_tx_chunk == 0) - { - s->t38_fe.octets_per_data_packet = MAX_OCTETS_PER_UNPACED_CHUNK; - } - else + if (s->t38_fe.ms_per_tx_chunk) { s->t38_fe.octets_per_data_packet = s->t38_fe.ms_per_tx_chunk*bit_rate/(8*1000); /* Make sure we have a positive number (i.e. we didn't truncate to zero). */ if (s->t38_fe.octets_per_data_packet < 1) s->t38_fe.octets_per_data_packet = 1; } + else + { + s->t38_fe.octets_per_data_packet = MAX_OCTETS_PER_UNPACED_CHUNK; + } } /*- End of function --------------------------------------------------------*/ @@ -682,22 +682,34 @@ static int stream_non_ecm(t31_state_t *s) bit_reverse(buf, buf, len); if (len < fe->octets_per_data_packet) { - /* That's the end of the image data. Do a little padding now */ - memset(buf + len, 0, fe->octets_per_data_packet - len); - fe->non_ecm_trailer_bytes = 3*fe->octets_per_data_packet + len; - len = fe->octets_per_data_packet; - fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_4; + /* That's the end of the image data. */ + if (s->t38_fe.ms_per_tx_chunk) + { + /* Pad the end of the data with some zeros. If we just stop abruptly + at the end of the EOLs, some ATAs fail to clean up properly before + shutting down their transmit modem, and the last few rows of the image + are lost or corrupted. Simply delaying the no-signal message does not + help for all implentations. It is usually ignored, which is probably + the right thing to do after receiving a message saying the signal has + ended. */ + memset(buf + len, 0, fe->octets_per_data_packet - len); + fe->non_ecm_trailer_bytes = 3*fe->octets_per_data_packet + len; + len = fe->octets_per_data_packet; + fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_4; + } + 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); + 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); delay = bits_to_us(s, 8*len); break; case T38_TIMED_STEP_NON_ECM_MODEM_4: - /* This pads the end of the data with some zeros. If we just stop abruptly - at the end of the EOLs, some ATAs fail to clean up properly before - shutting down their transmit modem, and the last few rows of the image - are corrupted. Simply delaying the no-signal message does not help for - all implentations. It is usually ignored, which is probably the right - thing to do after receiving a message saying the signal has ended. */ + /* Send padding */ len = fe->octets_per_data_packet; fe->non_ecm_trailer_bytes -= len; if (fe->non_ecm_trailer_bytes <= 0) @@ -708,7 +720,9 @@ static int stream_non_ecm(t31_state_t *s) 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. */ - delay = bits_to_us(s, 8*len) + 60000; + delay = bits_to_us(s, 8*len); + if (s->t38_fe.ms_per_tx_chunk) + delay += 60000; front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); break; } @@ -790,7 +804,9 @@ static int stream_hdlc(t31_state_t *s) 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. */ - delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits) + 100000; + delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits); + if (s->t38_fe.ms_per_tx_chunk) + delay += 100000; at_put_response_code(&s->at_state, AT_RESPONSE_CODE_OK); t31_set_at_rx_mode(s, AT_MODE_OFFHOOK_COMMAND); } @@ -831,7 +847,9 @@ static int stream_hdlc(t31_state_t *s) 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. */ - delay = bits_to_us(s, fe->hdlc_tx.extra_bits) + 100000; + delay = bits_to_us(s, fe->hdlc_tx.extra_bits); + if (s->t38_fe.ms_per_tx_chunk) + delay += 100000; front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); break; } @@ -2446,12 +2464,12 @@ static int t31_t38_fe_init(t31_state_t *t, /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s, - at_tx_handler_t *at_tx_handler, - void *at_tx_user_data, - t31_modem_control_handler_t *modem_control_handler, - void *modem_control_user_data, - t38_tx_packet_handler_t *tx_t38_packet_handler, - void *tx_t38_packet_user_data) + at_tx_handler_t *at_tx_handler, + void *at_tx_user_data, + t31_modem_control_handler_t *modem_control_handler, + void *modem_control_user_data, + t38_tx_packet_handler_t *tx_t38_packet_handler, + void *tx_t38_packet_user_data) { int alloced; diff --git a/libs/spandsp/src/t35.c b/libs/spandsp/src/t35.c index 63eb5f6c3e..03ea01a05b 100644 --- a/libs/spandsp/src/t35.c +++ b/libs/spandsp/src/t35.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: t35.c,v 1.28 2009/01/05 13:48:31 steveu Exp $ + * $Id: t35.c,v 1.29 2009/02/03 16:28:40 steveu Exp $ */ /* @@ -738,7 +738,7 @@ static const nsf_data_t known_nsf[] = }; #if 0 -void nsf_find_station_id(int reverse_order) +SPAN_DECLARE(void) nsf_find_station_id(int reverse_order) { const char *id = NULL; int idSize = 0; diff --git a/libs/spandsp/src/t38_core.c b/libs/spandsp/src/t38_core.c index a07a38ca85..2c501dd390 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.50 2009/01/28 03:41:27 steveu Exp $ + * $Id: t38_core.c,v 1.51 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -924,12 +924,12 @@ SPAN_DECLARE(logging_state_t *) t38_core_get_logging_state(t38_core_state_t *s) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(t38_core_state_t *) t38_core_init(t38_core_state_t *s, - t38_rx_indicator_handler_t *rx_indicator_handler, - t38_rx_data_handler_t *rx_data_handler, - t38_rx_missing_handler_t *rx_missing_handler, - void *rx_user_data, - t38_tx_packet_handler_t *tx_packet_handler, - void *tx_packet_user_data) + t38_rx_indicator_handler_t *rx_indicator_handler, + t38_rx_data_handler_t *rx_data_handler, + t38_rx_missing_handler_t *rx_missing_handler, + void *rx_user_data, + t38_tx_packet_handler_t *tx_packet_handler, + void *tx_packet_user_data) { if (s == NULL) { diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index 7c0912980f..169c73f67f 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.152 2009/01/29 18:30:14 steveu Exp $ + * $Id: t38_gateway.c,v 1.153 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -2151,10 +2151,10 @@ SPAN_DECLARE(void) t38_gateway_set_supported_modems(t38_gateway_state_t *s, int /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(void) t38_gateway_set_nsx_suppression(t38_gateway_state_t *s, - const uint8_t *from_t38, - int from_t38_len, - const uint8_t *from_modem, - int from_modem_len) + const uint8_t *from_t38, + int from_t38_len, + const uint8_t *from_modem, + int from_modem_len) { s->t38x.suppress_nsx_len[0] = (from_t38_len < 0 || from_t38_len < MAX_NSX_SUPPRESSION) ? (from_t38_len + 3) : 0; s->t38x.suppress_nsx_len[1] = (from_modem_len < 0 || from_modem_len < MAX_NSX_SUPPRESSION) ? (from_modem_len + 3) : 0; @@ -2174,8 +2174,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; @@ -2190,8 +2190,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; @@ -2211,8 +2211,8 @@ static int t38_gateway_t38_init(t38_gateway_state_t *t, /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(t38_gateway_state_t *) t38_gateway_init(t38_gateway_state_t *s, - 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) { if (tx_packet_handler == NULL) return NULL; diff --git a/libs/spandsp/src/t38_non_ecm_buffer.c b/libs/spandsp/src/t38_non_ecm_buffer.c index 09fa46e320..fe09d9e572 100644 --- a/libs/spandsp/src/t38_non_ecm_buffer.c +++ b/libs/spandsp/src/t38_non_ecm_buffer.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_non_ecm_buffer.c,v 1.5 2009/01/28 03:41:27 steveu Exp $ + * $Id: t38_non_ecm_buffer.c,v 1.6 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -75,7 +75,7 @@ static void restart_buffer(t38_non_ecm_buffer_state_t *s) } /*- End of function --------------------------------------------------------*/ -int t38_non_ecm_buffer_get_bit(void *user_data) +SPAN_DECLARE(int) t38_non_ecm_buffer_get_bit(void *user_data) { t38_non_ecm_buffer_state_t *s; int bit; diff --git a/libs/spandsp/src/t38_terminal.c b/libs/spandsp/src/t38_terminal.c index 0814690bbc..60b6e93e02 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.120 2009/01/29 01:41:06 steveu Exp $ + * $Id: t38_terminal.c,v 1.122 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -585,24 +585,36 @@ static int stream_non_ecm(t38_terminal_state_t *s) bit_reverse(buf, buf, len); if (len < fe->octets_per_data_packet) { - /* That's the end of the image data. Do a little padding now */ - memset(buf + len, 0, fe->octets_per_data_packet - len); - fe->non_ecm_trailer_bytes = 3*fe->octets_per_data_packet + len; - len = fe->octets_per_data_packet; - fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_4; + /* That's the end of the image data. */ + if (s->t38_fe.ms_per_tx_chunk) + { + /* Pad the end of the data with some zeros. If we just stop abruptly + at the end of the EOLs, some ATAs fail to clean up properly before + shutting down their transmit modem, and the last few rows of the image + are lost or corrupted. Simply delaying the no-signal message does not + help for all implentations. It is usually ignored, which is probably + the right thing to do after receiving a message saying the signal has + ended. */ + memset(buf + len, 0, fe->octets_per_data_packet - len); + fe->non_ecm_trailer_bytes = 3*fe->octets_per_data_packet + len; + len = fe->octets_per_data_packet; + fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_4; + } + 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); + 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); delay = bits_to_us(s, 8*len); break; case T38_TIMED_STEP_NON_ECM_MODEM_4: - /* This pads the end of the data with some zeros. If we just stop abruptly - at the end of the EOLs, some ATAs fail to clean up properly before - shutting down their transmit modem, and the last few rows of the image - are corrupted. Simply delaying the no-signal message does not help for - all implentations. It is usually ignored, which is probably the right - thing to do after receiving a message saying the signal has ended. */ + /* Send padding */ len = fe->octets_per_data_packet; - fe->non_ecm_trailer_bytes -= len; + fe->non_ecm_trailer_bytes -= fe->octets_per_data_packet; if (fe->non_ecm_trailer_bytes <= 0) { len += fe->non_ecm_trailer_bytes; @@ -611,7 +623,9 @@ static int stream_non_ecm(t38_terminal_state_t *s) 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. */ - delay = bits_to_us(s, 8*len) + 60000; + delay = bits_to_us(s, 8*len); + if (s->t38_fe.ms_per_tx_chunk) + delay += 60000; front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); break; } @@ -687,7 +701,9 @@ static int stream_hdlc(t38_terminal_state_t *s) 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. */ - delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits) + 100000; + delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits); + if (s->t38_fe.ms_per_tx_chunk) + delay += 100000; front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); } else @@ -726,7 +742,9 @@ static int stream_hdlc(t38_terminal_state_t *s) 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. */ - delay = bits_to_us(s, fe->hdlc_tx.extra_bits) + 100000; + delay = bits_to_us(s, fe->hdlc_tx.extra_bits); + if (s->t38_fe.ms_per_tx_chunk) + delay += 100000; front_end_status(s, T30_FRONT_END_SEND_STEP_COMPLETE); break; } @@ -1097,9 +1115,9 @@ SPAN_DECLARE(logging_state_t *) t38_terminal_get_logging_state(t38_terminal_stat /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s, - int calling_party, - t38_tx_packet_handler_t *tx_packet_handler, - void *tx_packet_user_data) + int calling_party, + t38_tx_packet_handler_t *tx_packet_handler, + void *tx_packet_user_data) { if (tx_packet_handler == NULL) return NULL; diff --git a/libs/spandsp/src/t4.c b/libs/spandsp/src/t4.c index c39d6b2e9c..b9198b6e2f 100644 --- a/libs/spandsp/src/t4.c +++ b/libs/spandsp/src/t4.c @@ -24,7 +24,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: t4.c,v 1.120 2009/01/31 08:48:10 steveu Exp $ + * $Id: t4.c,v 1.121 2009/02/03 16:28:40 steveu Exp $ */ /* diff --git a/libs/spandsp/src/time_scale.c b/libs/spandsp/src/time_scale.c index a4eee53235..e968f95bad 100644 --- a/libs/spandsp/src/time_scale.c +++ b/libs/spandsp/src/time_scale.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: time_scale.c,v 1.28 2009/01/29 01:41:06 steveu Exp $ + * $Id: time_scale.c,v 1.29 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -47,6 +47,7 @@ #include "floating_fudge.h" #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/time_scale.h" #include "spandsp/saturated.h" diff --git a/libs/spandsp/src/tone_detect.c b/libs/spandsp/src/tone_detect.c index 9ae8924bcc..db2141d733 100644 --- a/libs/spandsp/src/tone_detect.c +++ b/libs/spandsp/src/tone_detect.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: tone_detect.c,v 1.49 2009/01/28 03:41:27 steveu Exp $ + * $Id: tone_detect.c,v 1.50 2009/02/03 16:28:40 steveu Exp $ */ /*! \file tone_detect.h */ @@ -58,7 +58,7 @@ #define M_PI 3.14159265358979323846264338327 #endif -void make_goertzel_descriptor(goertzel_descriptor_t *t, float freq, int samples) +SPAN_DECLARE(void) make_goertzel_descriptor(goertzel_descriptor_t *t, float freq, int samples) { #if defined(SPANDSP_USE_FIXED_POINT) t->fac = 16383.0f*2.0f*cosf(2.0f*M_PI*(freq/(float) SAMPLE_RATE)); @@ -69,8 +69,8 @@ void make_goertzel_descriptor(goertzel_descriptor_t *t, float freq, int samples) } /*- End of function --------------------------------------------------------*/ -goertzel_state_t *goertzel_init(goertzel_state_t *s, - goertzel_descriptor_t *t) +SPAN_DECLARE(goertzel_state_t *) goertzel_init(goertzel_state_t *s, + goertzel_descriptor_t *t) { if (s == NULL) { @@ -91,7 +91,7 @@ goertzel_state_t *goertzel_init(goertzel_state_t *s, } /*- End of function --------------------------------------------------------*/ -void goertzel_reset(goertzel_state_t *s) +SPAN_DECLARE(void) goertzel_reset(goertzel_state_t *s) { #if defined(SPANDSP_USE_FIXED_POINT) s->v2 = @@ -104,9 +104,9 @@ void goertzel_reset(goertzel_state_t *s) } /*- End of function --------------------------------------------------------*/ -int goertzel_update(goertzel_state_t *s, - const int16_t amp[], - int samples) +SPAN_DECLARE(int) goertzel_update(goertzel_state_t *s, + const int16_t amp[], + int samples) { int i; #if defined(SPANDSP_USE_FIXED_POINT) @@ -139,9 +139,9 @@ int goertzel_update(goertzel_state_t *s, /*- End of function --------------------------------------------------------*/ #if defined(SPANDSP_USE_FIXED_POINT) -int32_t goertzel_result(goertzel_state_t *s) +SPAN_DECLARE(int32_t) goertzel_result(goertzel_state_t *s) #else -float goertzel_result(goertzel_state_t *s) +SPAN_DECLARE(float) goertzel_result(goertzel_state_t *s) #endif { #if defined(SPANDSP_USE_FIXED_POINT) diff --git a/libs/spandsp/src/tone_generate.c b/libs/spandsp/src/tone_generate.c index 6d2f801f52..d6e5658bda 100644 --- a/libs/spandsp/src/tone_generate.c +++ b/libs/spandsp/src/tone_generate.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: tone_generate.c,v 1.48 2009/01/28 03:41:27 steveu Exp $ + * $Id: tone_generate.c,v 1.49 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -46,6 +46,7 @@ #include "floating_fudge.h" #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/dc_restore.h" #include "spandsp/complex.h" #include "spandsp/dds.h" @@ -61,15 +62,15 @@ #define ms_to_samples(t) (((t)*SAMPLE_RATE)/1000) SPAN_DECLARE(void) make_tone_gen_descriptor(tone_gen_descriptor_t *s, - int f1, - int l1, - int f2, - int l2, - int d1, - int d2, - int d3, - int d4, - int repeat) + int f1, + int l1, + int f2, + int l2, + int d1, + int d2, + int d3, + int d4, + int repeat) { memset(s, 0, sizeof(*s)); if (f1) @@ -170,7 +171,7 @@ SPAN_DECLARE(int) tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples) #else xamp = dds_modf(&s->phase[0], -s->tone[0].phase_rate, s->tone[0].gain, 0) *(1.0f + dds_modf(&s->phase[1], s->tone[1].phase_rate, s->tone[1].gain, 0)); - amp[samples] = (int16_t) lrintf(xamp); + amp[samples] = (int16_t) lfastrintf(xamp); #endif } } @@ -200,7 +201,7 @@ SPAN_DECLARE(int) tone_gen(tone_gen_state_t *s, int16_t amp[], int max_samples) #if defined(SPANDSP_USE_FIXED_POINT) amp[samples] = xamp; #else - amp[samples] = (int16_t) lrintf(xamp); + amp[samples] = (int16_t) lfastrintf(xamp); #endif } } diff --git a/libs/spandsp/src/v17rx.c b/libs/spandsp/src/v17rx.c index 826bf7f601..5b6602f1df 100644 --- a/libs/spandsp/src/v17rx.c +++ b/libs/spandsp/src/v17rx.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: v17rx.c,v 1.131 2009/01/30 10:22:23 steveu Exp $ + * $Id: v17rx.c,v 1.132 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/v17tx.c b/libs/spandsp/src/v17tx.c index 6f9cef0b26..84b1cd266f 100644 --- a/libs/spandsp/src/v17tx.c +++ b/libs/spandsp/src/v17tx.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: v17tx.c,v 1.69 2009/01/28 03:41:27 steveu Exp $ + * $Id: v17tx.c,v 1.70 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -44,6 +44,7 @@ #include "floating_fudge.h" #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/logging.h" #include "spandsp/complex.h" #include "spandsp/vector_float.h" @@ -301,7 +302,7 @@ SPAN_DECLARE(int) v17_tx(v17_tx_state_t *s, int16_t amp[], int len) /* Now create and modulate the carrier */ z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate); /* Don't bother saturating. We should never clip. */ - amp[sample] = (int16_t) lrintf((x.re*z.re - x.im*z.im)*s->gain); + amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain); #endif } return sample; diff --git a/libs/spandsp/src/v22bis_rx.c b/libs/spandsp/src/v22bis_rx.c index c8ed427de3..57cf3d5a80 100644 --- a/libs/spandsp/src/v22bis_rx.c +++ b/libs/spandsp/src/v22bis_rx.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: v22bis_rx.c,v 1.46 2009/01/28 03:41:27 steveu Exp $ + * $Id: v22bis_rx.c,v 1.47 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/v22bis_tx.c b/libs/spandsp/src/v22bis_tx.c index 6ce2ff45b2..65a6ec2834 100644 --- a/libs/spandsp/src/v22bis_tx.c +++ b/libs/spandsp/src/v22bis_tx.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: v22bis_tx.c,v 1.49 2009/01/28 03:41:27 steveu Exp $ + * $Id: v22bis_tx.c,v 1.50 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -46,6 +46,7 @@ #include "floating_fudge.h" #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/logging.h" #include "spandsp/complex.h" #include "spandsp/vector_float.h" @@ -558,7 +559,7 @@ SPAN_DECLARE(int) v22bis_tx(v22bis_state_t *s, int16_t amp[], int len) famp += dds_modf(&(s->tx.guard_phase), s->tx.guard_phase_rate, s->tx.guard_level, 0); } /* Don't bother saturating. We should never clip. */ - amp[sample] = (int16_t) lrintf(famp); + amp[sample] = (int16_t) lfastrintf(famp); } return sample; } @@ -623,12 +624,12 @@ SPAN_DECLARE(int) v22bis_restart(v22bis_state_t *s, int bit_rate) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(v22bis_state_t *) v22bis_init(v22bis_state_t *s, - int bit_rate, - int guard, - int caller, - get_bit_func_t get_bit, - put_bit_func_t put_bit, - void *user_data) + int bit_rate, + int guard, + int caller, + get_bit_func_t get_bit, + put_bit_func_t put_bit, + void *user_data) { if (s == NULL) { diff --git a/libs/spandsp/src/v27ter_rx.c b/libs/spandsp/src/v27ter_rx.c index ca6b9d1517..760c2de934 100644 --- a/libs/spandsp/src/v27ter_rx.c +++ b/libs/spandsp/src/v27ter_rx.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: v27ter_rx.c,v 1.115 2009/01/30 10:22:23 steveu Exp $ + * $Id: v27ter_rx.c,v 1.116 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/v27ter_tx.c b/libs/spandsp/src/v27ter_tx.c index ecf264f94c..1c0c9c054f 100644 --- a/libs/spandsp/src/v27ter_tx.c +++ b/libs/spandsp/src/v27ter_tx.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: v27ter_tx.c,v 1.71 2009/01/28 03:41:27 steveu Exp $ + * $Id: v27ter_tx.c,v 1.72 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -44,6 +44,7 @@ #include "floating_fudge.h" #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/logging.h" #include "spandsp/complex.h" #include "spandsp/vector_float.h" @@ -292,7 +293,7 @@ SPAN_DECLARE(int) v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len) /* Now create and modulate the carrier */ z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate); /* Don't bother saturating. We should never clip. */ - amp[sample] = (int16_t) lrintf((x.re*z.re - x.im*z.im)*s->gain_4800); + amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain_4800); #endif } } @@ -333,7 +334,7 @@ SPAN_DECLARE(int) v27ter_tx(v27ter_tx_state_t *s, int16_t amp[], int len) /* Now create and modulate the carrier */ z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate); /* Don't bother saturating. We should never clip. */ - amp[sample] = (int16_t) lrintf((x.re*z.re - x.im*z.im)*s->gain_2400); + amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain_2400); #endif } } diff --git a/libs/spandsp/src/v29rx.c b/libs/spandsp/src/v29rx.c index 80d9ab307b..cdd2f5e9a5 100644 --- a/libs/spandsp/src/v29rx.c +++ b/libs/spandsp/src/v29rx.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: v29rx.c,v 1.152 2009/01/30 10:22:23 steveu Exp $ + * $Id: v29rx.c,v 1.153 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/src/v29tx.c b/libs/spandsp/src/v29tx.c index b7964fea68..573b2dfbd7 100644 --- a/libs/spandsp/src/v29tx.c +++ b/libs/spandsp/src/v29tx.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: v29tx.c,v 1.84 2009/01/28 03:41:27 steveu Exp $ + * $Id: v29tx.c,v 1.85 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -44,6 +44,7 @@ #include "floating_fudge.h" #include "spandsp/telephony.h" +#include "spandsp/fast_convert.h" #include "spandsp/logging.h" #include "spandsp/complex.h" #include "spandsp/vector_float.h" @@ -245,7 +246,7 @@ SPAN_DECLARE(int) v29_tx(v29_tx_state_t *s, int16_t amp[], int len) /* Now create and modulate the carrier */ z = dds_complexf(&(s->carrier_phase), s->carrier_phase_rate); /* Don't bother saturating. We should never clip. */ - amp[sample] = (int16_t) lrintf((x.re*z.re - x.im*z.im)*s->gain); + amp[sample] = (int16_t) lfastrintf((x.re*z.re - x.im*z.im)*s->gain); #endif } return sample; diff --git a/libs/spandsp/src/v42.c b/libs/spandsp/src/v42.c index c4384040aa..a00e4faf47 100644 --- a/libs/spandsp/src/v42.c +++ b/libs/spandsp/src/v42.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: v42.c,v 1.47 2009/01/05 13:48:32 steveu Exp $ + * $Id: v42.c,v 1.48 2009/02/03 16:28:40 steveu Exp $ */ /* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. */ @@ -89,8 +89,8 @@ static void t401_expired(span_sched_state_t *s, void *user_data); static void t403_expired(span_sched_state_t *s, void *user_data); -void lapm_reset(lapm_state_t *s); -void lapm_restart(lapm_state_t *s); +SPAN_DECLARE(void) lapm_reset(lapm_state_t *s); +SPAN_DECLARE(void) lapm_restart(lapm_state_t *s); static void lapm_link_down(lapm_state_t *s); @@ -667,7 +667,7 @@ static void lapm_link_down(lapm_state_t *s) } /*- End of function --------------------------------------------------------*/ -void lapm_reset(lapm_state_t *s) +SPAN_DECLARE(void) lapm_reset(lapm_state_t *s) { lapm_frame_queue_t *f; lapm_frame_queue_t *p; @@ -709,7 +709,7 @@ fprintf(stderr, "Deleting T403 e %d\n", s->t403_timer); } /*- End of function --------------------------------------------------------*/ -void lapm_receive(void *user_data, const uint8_t *frame, int len, int ok) +SPAN_DECLARE(void) lapm_receive(void *user_data, const uint8_t *frame, int len, int ok) { lapm_state_t *s; lapm_frame_queue_t *f; @@ -1068,7 +1068,7 @@ static void lapm_hdlc_underflow(void *user_data) } /*- End of function --------------------------------------------------------*/ -void lapm_restart(lapm_state_t *s) +SPAN_DECLARE(void) lapm_restart(lapm_state_t *s) { #if 0 if (s->state != LAPM_RELEASE) diff --git a/libs/spandsp/src/v42bis.c b/libs/spandsp/src/v42bis.c index 5c3c53c82c..cc07c8d791 100644 --- a/libs/spandsp/src/v42bis.c +++ b/libs/spandsp/src/v42bis.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: v42bis.c,v 1.35 2009/01/05 13:48:32 steveu Exp $ + * $Id: v42bis.c,v 1.36 2009/02/03 16:28:40 steveu Exp $ */ /* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. @@ -353,7 +353,7 @@ SPAN_DECLARE(int) v42bis_compress_flush(v42bis_state_t *s) /*- End of function --------------------------------------------------------*/ #if 0 -int v42bis_compress_dump(v42bis_state_t *s) +SPAN_DECLARE(int) v42bis_compress_dump(v42bis_state_t *s) { int i; @@ -583,7 +583,7 @@ SPAN_DECLARE(int) v42bis_decompress_flush(v42bis_state_t *s) /*- End of function --------------------------------------------------------*/ #if 0 -int v42bis_decompress_dump(v42bis_state_t *s) +SPAN_DECLARE(int) v42bis_decompress_dump(v42bis_state_t *s) { int i; @@ -615,15 +615,15 @@ SPAN_DECLARE(void) v42bis_compression_control(v42bis_state_t *s, int mode) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(v42bis_state_t *) v42bis_init(v42bis_state_t *s, - int negotiated_p0, - int negotiated_p1, - int negotiated_p2, - v42bis_frame_handler_t frame_handler, - void *frame_user_data, - int max_frame_len, - v42bis_data_handler_t data_handler, - void *data_user_data, - int max_data_len) + int negotiated_p0, + int negotiated_p1, + int negotiated_p2, + v42bis_frame_handler_t frame_handler, + void *frame_user_data, + int max_frame_len, + v42bis_data_handler_t data_handler, + void *data_user_data, + int max_data_len) { int i; diff --git a/libs/spandsp/src/v8.c b/libs/spandsp/src/v8.c index 7aa30ec8eb..52ad70b900 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.37 2009/01/28 03:41:27 steveu Exp $ + * $Id: v8.c,v 1.38 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -857,10 +857,10 @@ SPAN_DECLARE(logging_state_t *) v8_get_logging_state(v8_state_t *s) /*- End of function --------------------------------------------------------*/ SPAN_DECLARE(v8_state_t *) v8_init(v8_state_t *s, - int caller, - int available_modulations, - v8_result_handler_t *result_handler, - void *user_data) + int caller, + int available_modulations, + v8_result_handler_t *result_handler, + void *user_data) { if (s == NULL) { diff --git a/libs/spandsp/src/vector_float.c b/libs/spandsp/src/vector_float.c index 8b189cf78c..2fcf9597ab 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.19 2009/01/28 03:41:27 steveu Exp $ + * $Id: vector_float.c,v 1.20 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ @@ -118,7 +118,7 @@ SPAN_DECLARE(void) vec_copy(double z[], const double x[], int n) /*- End of function --------------------------------------------------------*/ #if defined(HAVE_LONG_DOUBLE) -void vec_copyl(long double z[], const long double x[], int n) +SPAN_DECLARE(void) vec_copyl(long double z[], const long double x[], int n) { int i; @@ -178,7 +178,7 @@ SPAN_DECLARE(void) vec_negate(double z[], const double x[], int n) /*- End of function --------------------------------------------------------*/ #if defined(HAVE_LONG_DOUBLE) -void vec_negatel(long double z[], const long double x[], int n) +SPAN_DECLARE(void) vec_negatel(long double z[], const long double x[], int n) { int i; @@ -232,7 +232,7 @@ SPAN_DECLARE(void) vec_zero(double z[], int n) /*- End of function --------------------------------------------------------*/ #if defined(HAVE_LONG_DOUBLE) -void vec_zerol(long double z[], int n) +SPAN_DECLARE(void) vec_zerol(long double z[], int n) { int i; @@ -286,7 +286,7 @@ SPAN_DECLARE(void) vec_set(double z[], double x, int n) /*- End of function --------------------------------------------------------*/ #if defined(HAVE_LONG_DOUBLE) -void vec_setl(long double z[], long double x, int n) +SPAN_DECLARE(void) vec_setl(long double z[], long double x, int n) { int i; @@ -344,7 +344,8 @@ SPAN_DECLARE(void) vec_add(double z[], const double x[], const double y[], int n } /*- End of function --------------------------------------------------------*/ -void vec_addl(long double z[], const long double x[], const long double y[], int n) +#if defined(HAVE_LONG_DOUBLE) +SPAN_DECLARE(void) vec_addl(long double z[], const long double x[], const long double y[], int n) { int i; @@ -352,6 +353,7 @@ void vec_addl(long double z[], const long double x[], const long double y[], int z[i] = x[i] + y[i]; } /*- End of function --------------------------------------------------------*/ +#endif #if defined(__GNUC__) && defined(SPANDSP_USE_SSE2) SPAN_DECLARE(void) vec_scaledxy_addf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n) @@ -408,7 +410,7 @@ SPAN_DECLARE(void) vec_scaledxy_add(double z[], const double x[], double x_scale /*- End of function --------------------------------------------------------*/ #if defined(HAVE_LONG_DOUBLE) -void vec_scaledxy_addl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n) +SPAN_DECLARE(void) vec_scaledxy_addl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n) { int i; @@ -470,7 +472,7 @@ SPAN_DECLARE(void) vec_scaledy_add(double z[], const double x[], const double y[ /*- End of function --------------------------------------------------------*/ #if defined(HAVE_LONG_DOUBLE) -void vec_scaledy_addl(long double z[], const long double x[], const long double y[], long double y_scale, int n) +SPAN_DECLARE(void) vec_scaledy_addl(long double z[], const long double x[], const long double y[], long double y_scale, int n) { int i; @@ -529,7 +531,7 @@ SPAN_DECLARE(void) vec_sub(double z[], const double x[], const double y[], int n /*- End of function --------------------------------------------------------*/ #if defined(HAVE_LONG_DOUBLE) -void vec_subl(long double z[], const long double x[], const long double y[], int n) +SPAN_DECLARE(void) vec_subl(long double z[], const long double x[], const long double y[], int n) { int i; @@ -558,7 +560,7 @@ SPAN_DECLARE(void) vec_scaledxy_sub(double z[], const double x[], double x_scale /*- End of function --------------------------------------------------------*/ #if defined(HAVE_LONG_DOUBLE) -void vec_scaledxy_subl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n) +SPAN_DECLARE(void) vec_scaledxy_subl(long double z[], const long double x[], long double x_scale, const long double y[], long double y_scale, int n) { int i; @@ -665,7 +667,7 @@ SPAN_DECLARE(void) vec_scalar_add(double z[], const double x[], double y, int n) /*- End of function --------------------------------------------------------*/ #if defined(HAVE_LONG_DOUBLE) -void vec_scalar_addl(long double z[], const long double x[], long double y, int n) +SPAN_DECLARE(void) vec_scalar_addl(long double z[], const long double x[], long double y, int n) { int i; @@ -724,7 +726,7 @@ SPAN_DECLARE(void) vec_scalar_sub(double z[], const double x[], double y, int n) /*- End of function --------------------------------------------------------*/ #if defined(HAVE_LONG_DOUBLE) -void vec_scalar_subl(long double z[], const long double x[], long double y, int n) +SPAN_DECLARE(void) vec_scalar_subl(long double z[], const long double x[], long double y, int n) { int i; @@ -784,7 +786,7 @@ SPAN_DECLARE(void) vec_mul(double z[], const double x[], const double y[], int n /*- End of function --------------------------------------------------------*/ #if defined(HAVE_LONG_DOUBLE) -void vec_mull(long double z[], const long double x[], const long double y[], int n) +SPAN_DECLARE(void) vec_mull(long double z[], const long double x[], const long double y[], int n) { int i; @@ -858,7 +860,7 @@ SPAN_DECLARE(double) vec_dot_prod(const double x[], const double y[], int n) /*- End of function --------------------------------------------------------*/ #if defined(HAVE_LONG_DOUBLE) -long double vec_dot_prodl(const long double x[], const long double y[], int n) +SPAN_DECLARE(long double) vec_dot_prodl(const long double x[], const long double y[], int n) { int i; long double z; diff --git a/libs/spandsp/src/vector_int.c b/libs/spandsp/src/vector_int.c index b082f549ae..09e057a6f3 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.23 2009/01/28 03:41:27 steveu Exp $ + * $Id: vector_int.c,v 1.24 2009/02/03 16:28:40 steveu Exp $ */ /*! \file */ diff --git a/libs/spandsp/tests/t31_tests.c b/libs/spandsp/tests/t31_tests.c index 64b7cae054..099a5254d5 100644 --- a/libs/spandsp/tests/t31_tests.c +++ b/libs/spandsp/tests/t31_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: t31_tests.c,v 1.69 2009/01/23 16:07:14 steveu Exp $ + * $Id: t31_tests.c,v 1.70 2009/02/02 13:05:28 steveu Exp $ */ /*! \file */ @@ -106,7 +106,8 @@ static const struct command_response_s fax_send_test_seq[] = RESPONSE("\r\nOK\r\n"), EXCHANGE("AT+FRH=3\r", "\r\nCONNECT\r\n"), // - RESPONSE("\xFF\x13\x80\x00\xEE\xF8\x80\x80\x91\x80\x80\x80\x18\x78\x57\x10\x03"), + RESPONSE("\xFF\x13\x80\x00\xEE\xF8\x80\x80\x91\x80\x80\x80\x18\x78\x57\x10\x03"), // For audio FAXing + //RESPONSE("\xFF\x13\x80\x04\xEE\xF8\x80\x80\x91\x80\x80\x80\x18\xE4\xE7\x10\x03"), // For T.38 FAXing RESPONSE("\r\nOK\r\n"), //EXCHANGE("AT+FRH=3\r", "\r\nNO CARRIER\r\n"), EXCHANGE("AT+FTH=3\r", "\r\nCONNECT\r\n"),