mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-18 09:32:34 +00:00
update to snapshot spandsp-20090204
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11612 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
9c3234706c
commit
8e5eed8999
libs/spandsp
spandsp-sim
src
Makefile.amadsi.casync.cat_interpreter.cawgn.cbell_r2_mf.cbert.cbit_operations.cbitstream.ccomplex_filters.ccomplex_vector_float.ccomplex_vector_int.ccrc.cdds_float.cdds_int.cdtmf.cecho.cfax.cfloating_fudge.hfsk.cg711.cg722.cg726.cgsm0610_decode.cgsm0610_encode.cgsm0610_long_term.cgsm0610_lpc.cgsm0610_preprocess.cgsm0610_rpe.cgsm0610_short_term.chdlc.cima_adpcm.clibspandsp.dsplibspandsp.vcprojlogging.clpc10_decode.clpc10_encode.clpc10_voicing.cmodem_connect_tones.cmodem_echo.c
msvc
noise.coki_adpcm.cplayout.cplc.cpower_meter.cqueue.cschedule.csig_tone.csilence_gen.cspandsp.h.inspandsp
adsi.hasync.hat_interpreter.hawgn.hbell_r2_mf.hbert.hbitstream.hcomplex_filters.hdtmf.hecho.hfast_convert.hfax.hfax_modems.hfsk.hg711.hg722.hg726.hgsm0610.hhdlc.hima_adpcm.hlpc10.hmodem_connect_tones.hmodem_echo.hnoise.hoki_adpcm.hplayout.hplc.hpower_meter.hqueue.hsaturated.hschedule.hsig_tone.hsilence_gen.hsuper_tone_rx.hsuper_tone_tx.ht30.ht30_api.ht30_logging.ht31.ht38_core.ht38_gateway.ht38_non_ecm_buffer.ht38_terminal.h
@ -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 <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <audiofile.h>
|
||||
#include "floating_fudge.h"
|
||||
#if defined(HAVE_TGMATH_H)
|
||||
#include <tgmath.h>
|
||||
#endif
|
||||
@ -45,6 +44,7 @@
|
||||
#define GEN_CONST
|
||||
#include <math.h>
|
||||
#endif
|
||||
#include "floating_fudge.h"
|
||||
|
||||
#include "spandsp.h"
|
||||
#include "spandsp/g1050.h"
|
||||
|
@ -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 <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <audiofile.h>
|
||||
#include "floating_fudge.h"
|
||||
#if defined(HAVE_TGMATH_H)
|
||||
#include <tgmath.h>
|
||||
#endif
|
||||
@ -45,6 +44,7 @@
|
||||
#define GEN_CONST
|
||||
#include <math.h>
|
||||
#endif
|
||||
#include "floating_fudge.h"
|
||||
|
||||
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
|
||||
#include "spandsp.h"
|
||||
|
@ -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 <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "floating_fudge.h"
|
||||
#if defined(HAVE_FFTW3_H)
|
||||
#include <fftw3.h>
|
||||
#else
|
||||
#include <fftw.h>
|
||||
#endif
|
||||
#if defined(HAVE_TGMATH_H)
|
||||
#include <tgmath.h>
|
||||
#endif
|
||||
#if defined(HAVE_MATH_H)
|
||||
#include <math.h>
|
||||
#endif
|
||||
#include "floating_fudge.h"
|
||||
#if defined(HAVE_FFTW3_H)
|
||||
#include <fftw3.h>
|
||||
#else
|
||||
#include <fftw.h>
|
||||
#endif
|
||||
|
||||
#include "spandsp.h"
|
||||
|
||||
|
@ -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 <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <audiofile.h>
|
||||
#include "floating_fudge.h"
|
||||
#if defined(HAVE_TGMATH_H)
|
||||
#include <tgmath.h>
|
||||
#endif
|
||||
@ -45,6 +44,7 @@
|
||||
#define GEN_CONST
|
||||
#include <math.h>
|
||||
#endif
|
||||
#include "floating_fudge.h"
|
||||
|
||||
#include "spandsp.h"
|
||||
#include "spandsp/g1050.h"
|
||||
|
@ -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 <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "floating_fudge.h"
|
||||
#if defined(HAVE_TGMATH_H)
|
||||
#include <tgmath.h>
|
||||
#endif
|
||||
#if defined(HAVE_MATH_H)
|
||||
#include <math.h>
|
||||
#endif
|
||||
#include "floating_fudge.h"
|
||||
#include <time.h>
|
||||
#include <fcntl.h>
|
||||
#include <audiofile.h>
|
||||
|
@ -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 \
|
||||
|
@ -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 <assert.h>
|
||||
|
||||
#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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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 ------------------------------------------------------------*/
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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 <fcntl.h>
|
||||
|
||||
#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;
|
||||
|
@ -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 <stdio.h>
|
||||
|
||||
#include "spandsp/telephony.h"
|
||||
#include "spandsp/fast_convert.h"
|
||||
#include "spandsp/logging.h"
|
||||
#include "spandsp/saturated.h"
|
||||
#include "spandsp/dc_restore.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: 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 */
|
||||
|
@ -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 <erikd@mega-nerd.com>
|
||||
*
|
||||
* 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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -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 <memory.h>
|
||||
|
||||
#include "spandsp/telephony.h"
|
||||
#include "spandsp/fast_convert.h"
|
||||
#include "spandsp/bitstream.h"
|
||||
#include "spandsp/saturated.h"
|
||||
#include "spandsp/gsm0610.h"
|
||||
|
@ -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 <memory.h>
|
||||
|
||||
#include "spandsp/telephony.h"
|
||||
#include "spandsp/fast_convert.h"
|
||||
#include "spandsp/bitstream.h"
|
||||
#include "spandsp/saturated.h"
|
||||
#include "spandsp/gsm0610.h"
|
||||
|
@ -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 <stdlib.h>
|
||||
|
||||
#include "spandsp/telephony.h"
|
||||
#include "spandsp/fast_convert.h"
|
||||
#include "spandsp/bitstream.h"
|
||||
#include "spandsp/saturated.h"
|
||||
#include "spandsp/gsm0610.h"
|
||||
|
@ -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 <memory.h>
|
||||
|
||||
#include "spandsp/telephony.h"
|
||||
#include "spandsp/fast_convert.h"
|
||||
#include "spandsp/bitstream.h"
|
||||
#include "spandsp/bit_operations.h"
|
||||
#include "spandsp/saturated.h"
|
||||
|
@ -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 <stdlib.h>
|
||||
|
||||
#include "spandsp/telephony.h"
|
||||
#include "spandsp/fast_convert.h"
|
||||
#include "spandsp/bitstream.h"
|
||||
#include "spandsp/saturated.h"
|
||||
#include "spandsp/gsm0610.h"
|
||||
|
@ -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 <stdlib.h>
|
||||
|
||||
#include "spandsp/telephony.h"
|
||||
#include "spandsp/fast_convert.h"
|
||||
#include "spandsp/bitstream.h"
|
||||
#include "spandsp/saturated.h"
|
||||
#include "spandsp/gsm0610.h"
|
||||
|
@ -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 <stdlib.h>
|
||||
|
||||
#include "spandsp/telephony.h"
|
||||
#include "spandsp/fast_convert.h"
|
||||
#include "spandsp/bitstream.h"
|
||||
#include "spandsp/saturated.h"
|
||||
#include "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: 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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||
|
@ -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 <memory.h>
|
||||
|
||||
#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;
|
||||
|
@ -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)
|
||||
|
@ -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. */
|
||||
|
@ -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 <stdio.h>
|
||||
|
||||
#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)
|
||||
{
|
||||
|
@ -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 */
|
||||
|
@ -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 <steveu@coppice.org>
|
||||
*
|
||||
@ -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
|
||||
|
@ -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 <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
@ -43,6 +44,7 @@
|
||||
#include <tiffio.h>
|
||||
|
||||
#include <spandsp/telephony.h>
|
||||
#include <spandsp/fast_convert.h>
|
||||
#include <spandsp/logging.h>
|
||||
#include <spandsp/complex.h>
|
||||
#include <spandsp/bit_operations.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.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"
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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 <limits.h>
|
||||
|
||||
#include "spandsp/telephony.h"
|
||||
#include "spandsp/fast_convert.h"
|
||||
#include "spandsp/saturated.h"
|
||||
#include "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: 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 */
|
||||
|
@ -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 */
|
||||
|
@ -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)
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 <tiffio.h>
|
||||
|
||||
#include <spandsp/telephony.h>
|
||||
#include <spandsp/fast_convert.h>
|
||||
#include <spandsp/logging.h>
|
||||
#include <spandsp/complex.h>
|
||||
#include <spandsp/bit_operations.h>
|
||||
|
@ -22,7 +22,7 @@
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* $Id: 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 */
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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 */
|
||||
|
@ -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.
|
||||
|
@ -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_)
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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_)
|
||||
|
@ -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.
|
||||
|
@ -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 */
|
||||
|
402
libs/spandsp/src/spandsp/fast_convert.h
Normal file
402
libs/spandsp/src/spandsp/fast_convert.h
Normal file
@ -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 <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2009 Steve Underwood
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU 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 <erikd@mega-nerd.com>
|
||||
*
|
||||
* 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 ------------------------------------------------------------*/
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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.
|
||||
|
@ -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 */
|
||||
|
@ -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 $
|
||||
*/
|
||||
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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_)
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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_)
|
||||
|
@ -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.
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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.
|
||||
|
@ -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_)
|
||||
|
@ -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 */
|
||||
|
@ -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_)
|
||||
|
@ -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 */
|
||||
|
@ -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 --------------------------------------------------------*/
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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.
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user