Merge pull request #773 from signalwire/spandsp

[Build-System] Remove SpanDSP library from the FreeSWITCH tree and use packages instead.
This commit is contained in:
Andrey Volk 2020-08-05 03:27:52 +04:00 committed by GitHub
commit 97c4bfcc85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
560 changed files with 1624 additions and 226108 deletions

View File

@ -14,7 +14,7 @@ steps:
image: signalwire/freeswitch-public-base
pull: true
commands:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp-dev
- echo "applications/mod_test" >> modules.conf
- echo 'codecs/mod_openh264' >> modules.conf
- sed -i '/applications\\/mod_http_cache/s/^#//g' modules.conf
@ -28,7 +28,7 @@ steps:
image: signalwire/freeswitch-public-base
pull: true
commands:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp-dev
- echo '#!/bin/bash\nmake -j`nproc --all` |& tee ./unit-tests-build-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./build-status.txt\n' > build.sh
- chmod +x build.sh
- ./build.sh
@ -37,7 +37,7 @@ steps:
image: signalwire/freeswitch-public-base
pull: true
commands:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp-dev
- make install || true
- cd tests/unit
- ./run-tests.sh
@ -83,7 +83,7 @@ steps:
image: signalwire/freeswitch-public-base:stretch
pull: true
commands:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp-dev
- cp build/modules.conf.most modules.conf
#Enable/Uncomment mods
- echo 'codecs/mod_openh264' >> modules.conf
@ -113,7 +113,7 @@ steps:
image: signalwire/freeswitch-public-base:stretch
pull: true
commands:
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install libsofia-sip-ua-dev libspandsp-dev
- mkdir -p scan-build
- echo '#!/bin/bash\nscan-build-4.0 -o ./scan-build/ make -j`nproc --all` |& tee ./scan-build-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./scan-build-status.txt\n' > scan.sh
- chmod +x scan.sh
@ -144,6 +144,6 @@ trigger:
---
kind: signature
hmac: 9f536d54b3df4db408a9e23a412185d0c95e66d22d15ba7ff00c7cfc85bff3ab
hmac: c48137f0dee8c2825711979e2c490367a2467a92866d3dfa11cf340a113dbf53
...

1
.gitignore vendored
View File

@ -142,7 +142,6 @@ Release/
/libs/libcodec2/unittest/Makefile
/libs/libcodec2/unittest/Makefile.in
/libs/mpg123-1.13.2/
/libs/spandsp/src/cielab_luts.h
/scripts/fsxs
/scripts/gentls_cert

View File

@ -342,9 +342,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_easyroute", "src\mod\ap
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_lcr", "src\mod\applications\mod_lcr\mod_lcr.2017.vcxproj", "{1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libs\spandsp\src\libtiff.2017.vcxproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libs\win32\libtiff\libtiff.2017.vcxproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libs\spandsp\src\libspandsp.2017.vcxproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libs\win32\spandsp\libspandsp.2017.vcxproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libs\win32\speex\libspeex.2017.vcxproj", "{E972C52F-9E85-4D65-B19C-031E511E9DB4}"
EndProject
@ -358,9 +358,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_skinny", "src\mod\endpo
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_rtmp", "src\mod\endpoints\mod_rtmp\mod_rtmp.2017.vcxproj", "{48414740-C693-4968-9846-EE058020C64F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_at_dictionary", "libs\spandsp\src\msvc\make_at_dictionary.2017.vcxproj", "{DEE932AB-5911-4700-9EEB-8C7090A0A330}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_at_dictionary", "libs\win32\spandsp\make_at_dictionary.2017.vcxproj", "{DEE932AB-5911-4700-9EEB-8C7090A0A330}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_modem_filter", "libs\spandsp\src\msvc\make_modem_filter.2017.vcxproj", "{329A6FA0-0FCC-4435-A950-E670AEFA9838}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_modem_filter", "libs\win32\spandsp\make_modem_filter.2017.vcxproj", "{329A6FA0-0FCC-4435-A950-E670AEFA9838}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_skel", "src\mod\applications\mod_skel\mod_skel.2017.vcxproj", "{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}"
EndProject
@ -484,11 +484,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmltok", "libs\win32\xmlrpc
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup.2017", "w32\Setup\Setup.2017.wixproj", "{47213370-B933-487D-9F45-BCA26D7E2B6F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_math_fixed_tables", "libs\spandsp\src\msvc\make_math_fixed_tables.2017.vcxproj", "{2386B892-35F5-46CF-A0F0-10394D2FBF9B}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_math_fixed_tables", "libs\win32\spandsp\make_math_fixed_tables.2017.vcxproj", "{2386B892-35F5-46CF-A0F0-10394D2FBF9B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcbt", "libs\win32\libcbt\libcbt.2017.vcxproj", "{77BC1DD2-C9A1-44D7-BFFA-1320370CACB9}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_cielab_luts", "libs\spandsp\src\msvc\make_cielab_luts.2017.vcxproj", "{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_cielab_luts", "libs\win32\spandsp\make_cielab_luts.2017.vcxproj", "{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "opus", "opus", "{ED2CA8B5-8E91-4296-A120-02BB0B674652}"
EndProject
@ -504,7 +504,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opus.silk_float", "libs\win
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_opus", "src\mod\codecs\mod_opus\mod_opus.2017.vcxproj", "{64E99CCA-3C6F-4AEB-9FA3-CFAC711257BB}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_t43_gray_code_tables", "libs\spandsp\src\msvc\make_t43_gray_code_tables.2017.vcxproj", "{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_t43_gray_code_tables", "libs\win32\spandsp\make_t43_gray_code_tables.2017.vcxproj", "{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "winFailToBan", "src\mod\languages\mod_managed\managed\examples\winFailToBan\winFailToBan.csproj", "{5BA0D5BD-330D-4EE2-B959-CAFEA04E50E0}"
EndProject

View File

@ -130,7 +130,7 @@ CORE_CFLAGS += -I$(switch_srcdir)/libs/libyuv/include
CORE_CFLAGS += -DSWITCH_HAVE_YUV
endif
CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/crypto/include -Ilibs/srtp/crypto/include
CORE_CFLAGS += -I$(switch_builddir)/libs/spandsp/src -I$(switch_srcdir)/libs/spandsp/src
CORE_CFLAGS += $(SPANDSP_CFLAGS)
if ENABLE_LIBVPX
CORE_CFLAGS += -DSWITCH_HAVE_VPX
endif
@ -184,13 +184,10 @@ endif
##
## libfreeswitch
##
noinst_LTLIBRARIES = libfreeswitch_spandsp.la
noinst_LTLIBRARIES =
if ENABLE_LIBYUV
noinst_LTLIBRARIES += libfreeswitch_libyuv.la
endif
libfreeswitch_spandsp_la_SOURCES = libs/spandsp/src/plc.c libs/spandsp/src/alloc.c libs/spandsp/src/bit_operations.c
libfreeswitch_spandsp_la_CFLAGS = -Ilibs/spandsp/src $(CORE_CFLAGS) $(AM_CFLAGS)
CORE_LIBS+=libfreeswitch_spandsp.la
if ENABLE_LIBYUV
libfreeswitch_libyuv_la_SOURCES = \
@ -251,7 +248,7 @@ endif
lib_LTLIBRARIES = libfreeswitch.la
libfreeswitch_la_CFLAGS = $(CORE_CFLAGS) $(SQLITE_CFLAGS) $(GUMBO_CFLAGS) $(FVAD_CFLAGS) $(FREETYPE_CFLAGS) $(CURL_CFLAGS) $(PCRE_CFLAGS) $(SPEEX_CFLAGS) $(LIBEDIT_CFLAGS) $(openssl_CFLAGS) $(AM_CFLAGS) $(TPL_CFLAGS)
libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_LDFLAGS) -no-undefined
libfreeswitch_la_LIBADD = $(CORE_LIBS) $(APR_LIBS) $(SQLITE_LIBS) $(GUMBO_LIBS) $(FVAD_LIBS) $(FREETYPE_LIBS) $(CURL_LIBS) $(PCRE_LIBS) $(SPEEX_LIBS) $(LIBEDIT_LIBS) $(openssl_LIBS) $(PLATFORM_CORE_LIBS) $(TPL_LIBS)
libfreeswitch_la_LIBADD = $(CORE_LIBS) $(APR_LIBS) $(SQLITE_LIBS) $(GUMBO_LIBS) $(FVAD_LIBS) $(FREETYPE_LIBS) $(CURL_LIBS) $(PCRE_LIBS) $(SPEEX_LIBS) $(LIBEDIT_LIBS) $(openssl_LIBS) $(PLATFORM_CORE_LIBS) $(TPL_LIBS) $(SPANDSP_LIBS)
libfreeswitch_la_DEPENDENCIES = $(BUILT_SOURCES)
if HAVE_PNG
@ -713,9 +710,7 @@ core-install: core_install
clean_core: clean-libLTLIBRARIES
rm -f $(libfreeswitch_la_OBJECTS)
rm -f $(libfreeswitch_spandsp_la_OBJECTS)
rm -f `echo $(libfreeswitch_la_OBJECTS) | sed -e's|.lo|.o|g'`
rm -f `echo $(libfreeswitch_spandsp_la_OBJECTS) | sed -e's|.lo|.o|g'`
install_core: install-libLTLIBRARIES
@ -780,12 +775,6 @@ iks-reconf:
cd libs/iksemel && sh ./configure.gnu $(MY_DEFAULT_ARGS)
$(MAKE) mod_dingaling-clean
spandsp-reconf:
cd libs/spandsp && $(MAKE) clean || echo
cd libs/spandsp && autoreconf -fi
cd libs/spandsp && sh ./configure.gnu $(MY_DEFAULT_ARGS)
cd libs/spandsp && $(MAKE)
cluecon:
@clear
@echo Thank you for updating. This is going to take a while so relax.

View File

@ -8,7 +8,7 @@ BGJOB=false
VERBOSE=false
BASEDIR=`pwd`;
LIBDIR=${BASEDIR}/libs;
SUBDIRS="apr libzrtp iksemel libdingaling srtp freetdm spandsp unimrcp fs";
SUBDIRS="apr libzrtp iksemel libdingaling srtp freetdm unimrcp fs";
while getopts 'jhd:v' o; do
case "$o" in

View File

@ -714,6 +714,11 @@ PKG_CHECK_MODULES([MARIADB], [libmariadb >= 3.0.9],[
])
])
PKG_CHECK_MODULES([SPANDSP], [spandsp >= 1.99],[
AM_CONDITIONAL([HAVE_SPANDSP],[true])],[
AC_MSG_ERROR([no usable spandsp; please install spandsp devel package or equivalent])
])
PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.12.12],[
AM_CONDITIONAL([HAVE_SOFIA_SIP],[true])],[
AC_MSG_ERROR([no usable sofia-sip; please install sofia-sip-ua devel package or equivalent])
@ -2111,7 +2116,6 @@ AC_CONFIG_SUBDIRS([libs/iksemel])
AC_CONFIG_SUBDIRS([libs/libdingaling])
AC_CONFIG_SUBDIRS([libs/freetdm])
AC_CONFIG_SUBDIRS([libs/unimrcp])
AC_CONFIG_SUBDIRS([libs/spandsp])
if test "x${enable_zrtp}" = "xyes"; then
AC_CONFIG_SUBDIRS([libs/libzrtp])
fi

1
debian/bootstrap.sh vendored
View File

@ -333,6 +333,7 @@ Build-Depends:
# used by many modules
libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev,
bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.12.12),
libspandsp-dev (>= 1.99),
# module build-depends
$(debian_wrap "${mod_build_depends}")
Standards-Version: 3.9.3

44
debian/copyright vendored
View File

@ -1310,45 +1310,6 @@ Files: libs/js/nsprpub/pr/tests/tmocon.c
Copyright: 1998-2004 Netscape Communications Corporation
License: MPL-1.1 or GPL-2+
Files: libs/spandsp/*
Copyright: 2001-2012, Steve Underwood
2006 Michael Jerris
1991-1997 Silicon Graphics, Inc.
1990-1997 Sam Leffler
1993 CMU
2004, Horizon Wimba, Inc.
1990, 1995 Frank D. Cringle.
License: LGPL-2.1
Files: libs/spandsp/tests/*
libs/spandsp/spandsp-sim/g1050.c
libs/spandsp/spandsp-sim/line_model.c
libs/spandsp/spandsp-sim/make_line_models.c
libs/spandsp/spandsp-sim/spandsp-sim.h
libs/spandsp/spandsp-sim/test_utils.c
libs/spandsp/src/image_translate.c
libs/spandsp/src/make_at_dictionary.c
libs/spandsp/src/make_cielab_luts.c
libs/spandsp/src/make_math_fixed_tables.c
libs/spandsp/src/make_modem_filter.c
libs/spandsp/test-data/etsi/fax/generate_etsi_300_242_pages.c
libs/spandsp/test-data/itu/fax/generate_dithered_tif.c
libs/spandsp/test-data/itu/fax/generate_sized_pages.c
libs/spandsp/test-data/itu/fax/generate_striped_pages.c
Copyright: 2001-2012, Steve Underwood
License: GPL-2
Files: libs/spandsp/tests/ademco_contactid_tests.c
libs/spandsp/tests/regression_tests.sh
libs/spandsp/tests/timezone_tests.c
libs/spandsp/tests/tsb85_extra_tests.sh
libs/spandsp/tests/tsb85_tests.c
libs/spandsp/tests/tsb85_tests.sh
libs/spandsp/tests/v42bis_tests.sh
libs/spandsp/tests/fax_tests.sh
Copyright: 2001-2012, Steve Underwood
License: LGPL-2.1
Files: src/mod/applications/mod_cluechoo/sl.h
Copyright: 1993 Toyoda Masashi
License: FIXME
@ -1441,11 +1402,6 @@ Files: libs/libsndfile/src/G72x/*
Copyright: Abandoned, Sun Microsystems, Inc.
License: public-domain
Files: libs/spandsp/src/spandsp/fast_convert.h
Copyright: 2001-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
2009 Steve Underwood
License: LGPL-2.1
Files: libs/libsndfile/*
libs/win32/libsndfile/*
Copyright: 1999-2009 Erik de Castro Lopo <erikd@mega-nerd.com>

View File

@ -162,15 +162,6 @@ Rules:
Matches: the\sLicense\sat\shttp://www.mozilla.org/MPL/
Matches: GNU\sGeneral\sPublic\sLicense\sVersion\s2\sor\slater
License: MPL-1.1 or GPL-2+
-
Glob: libs/spandsp/tests/g726_tests.c
Matches: Copyright\s(C)\s2006\sSteve\sUnderwood
Matches: specification.\sThese\sare\scopyright\smaterial,\sand\sso\scannot\sbe\sdistributed\swith\sthis\stest\ssoftware.
Copyright: 2006 Steve Underwood
-
Glob: libs/spandsp/*/g722.[ch]
Matches: Copyright\s\(c\)\sCMU\s+1993
Copyright: 1993 CMU
-
Glob: libs/libwebsockets/win32port/zlib/inftrees.c
Matches: Copyright\s1995-2010\sMark\sAdler\s.;

View File

@ -153,6 +153,7 @@ BuildRequires: libtool >= 1.5.17
BuildRequires: ncurses-devel
BuildRequires: openssl-devel >= 1.0.1e
BuildRequires: sofia-sip-devel >= 1.12.12
BuildRequires: spandsp-devel >= 1.99
BuildRequires: pcre-devel
BuildRequires: speex-devel
BuildRequires: sqlite-devel

69
libs/.gitignore vendored
View File

@ -486,70 +486,6 @@ opal
/sounds/
/soundtouch/
/soundtouch-*/
/spandsp/config-h.in
/spandsp/doc/doxygen
/spandsp/doc/Makefile
/spandsp/doc/Makefile.in
/spandsp/Makefile
/spandsp/Makefile.in
/spandsp/m4/libtool.m4
/spandsp/m4/ltoptions.m4
/spandsp/m4/ltsugar.m4
/spandsp/m4/ltversion.m4
/spandsp/m4/lt~obsolete.m4
/spandsp/spandsp-sim/Makefile
/spandsp/spandsp-sim/Makefile.in
/spandsp/src/at_interpreter_dictionary.h
/spandsp/src/config.h
/spandsp/src/make_at_dictionary
/spandsp/src/Makefile
/spandsp/src/Makefile.in
/spandsp/src/make_math_fixed_tables
/spandsp/src/make_modem_filter
/spandsp/src/make_t43_gray_code_tables
/spandsp/src/math_fixed_tables.h
/spandsp/src/msvc/All/BuildLog make_at_dictionary.htm
/spandsp/src/msvc/All/BuildLog make_modem_filter.htm
/spandsp/src/spandsp.h
/spandsp/src/stamp-h1
/spandsp/src/t43_gray_code_tables.h
/spandsp/src/v17_v32bis_rx_fixed_rrc.h
/spandsp/src/v17_v32bis_rx_floating_rrc.h
/spandsp/src/v17_v32bis_tx_fixed_rrc.h
/spandsp/src/v17_v32bis_tx_floating_rrc.h
/spandsp/src/v22bis_rx_1200_fixed_rrc.h
/spandsp/src/v22bis_rx_1200_floating_rrc.h
/spandsp/src/v22bis_rx_2400_fixed_rrc.h
/spandsp/src/v22bis_rx_2400_floating_rrc.h
/spandsp/src/v22bis_tx_fixed_rrc.h
/spandsp/src/v22bis_tx_floating_rrc.h
/spandsp/src/v27ter_rx_2400_fixed_rrc.h
/spandsp/src/v27ter_rx_2400_floating_rrc.h
/spandsp/src/v27ter_rx_4800_fixed_rrc.h
/spandsp/src/v27ter_rx_4800_floating_rrc.h
/spandsp/src/v27ter_tx_2400_fixed_rrc.h
/spandsp/src/v27ter_tx_2400_floating_rrc.h
/spandsp/src/v27ter_tx_4800_fixed_rrc.h
/spandsp/src/v27ter_tx_4800_floating_rrc.h
/spandsp/src/v29rx_fixed_rrc.h
/spandsp/src/v29rx_floating_rrc.h
/spandsp/src/v29tx_fixed_rrc.h
/spandsp/src/v29tx_floating_rrc.h
/spandsp/test-data/etsi/fax/Makefile
/spandsp/test-data/etsi/fax/Makefile.in
/spandsp/test-data/etsi/Makefile
/spandsp/test-data/etsi/Makefile.in
/spandsp/test-data/itu/fax/Makefile
/spandsp/test-data/itu/fax/Makefile.in
/spandsp/test-data/itu/Makefile
/spandsp/test-data/itu/Makefile.in
/spandsp/test-data/local/Makefile
/spandsp/test-data/local/Makefile.in
/spandsp/test-data/Makefile
/spandsp/test-data/Makefile.in
/spandsp/tests/Makefile
/spandsp/tests/Makefile.in
/spandsp/src/make_cielab_luts
/sphinxbase-*/
/srtp/aes_tables
/srtp/config_in.h
@ -819,7 +755,6 @@ broadvoice/config/compile
ilbc/config/compile
libg722_1/config/compile
pcre/compile
spandsp/config/compile
srtp/build/compile
unimrcp/build/compile
/pcre-*/
@ -837,7 +772,6 @@ iksemel/configure
libdingaling/configure
libyuv/Makefile
libyuv/convert
spandsp/configure
srtp/configure
tiff-4.0.2/configure
unimrcp/configure
@ -863,3 +797,6 @@ signalwire-client-c-*/
signalwire-client-c-*
mariadb-connector-c-*/
mariadb-connector-c-*
/spandsp*/
/spandsp*
win32/spandsp/spandsp.h

View File

@ -1,14 +0,0 @@
src/v17_v32bis_rx_rrc.h
src/v17_v32bis_tx_rrc.h
src/v22bis_rx_1200_rrc.h
src/v22bis_rx_2400_rrc.h
src/v22bis_tx_rrc.h
src/v27ter_rx_2400_rrc.h
src/v27ter_rx_4800_rrc.h
src/v27ter_tx_2400_rrc.h
src/v27ter_tx_4800_rrc.h
src/v29rx_rrc.h
src/v29tx_rrc.h
INSTALL
test-data/itu/tiff-fx/Makefile
test-data/itu/tiff-fx/Makefile.in

View File

@ -1 +0,0 @@
Tue Jul 22 07:25:58 CDT 2014

View File

@ -1 +0,0 @@
Steve Underwood <steveu@coppice.org>

View File

@ -1,853 +0,0 @@
The spandsp library is licenced under LGPL 2.1. The test suite, and some of
the supporting code, are licenced under GPL 2. The full text of both licences
may be found below.
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library 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 library 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 library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@ -1,47 +0,0 @@
07.08.29 - 0.0.4 - Steve Underwood <steveu@coppice.org>
-
06.05.23 - 0.0.3 - Steve Underwood <steveu@coppice.org>
- T.38 now implemented, though it needs further polishing.
- G.726 and G.722 now implemented.
04.08.29 - 0.0.2 - Steve Underwood <steveu@coppice.org>
- T.4 no longer uses libtiff for compresion and decompression on the line side
(it is still used to handle the TIFF files). Spandsp no longer depends on
accessing the "internals" of libtiff. New 1D and 2D compression and
decompression code now handles the line side. This should be more robust than
using libtiff, and handles the fudging of bad scan lines rather better.
- T.30 line turn-around timing corrected.
- T.30 DCS header contents corrected.
- T.30 provision for V.17 added, as an option.
- T.30 now has a statistics interface, for applications to find details about
image transfers.
- T.30 processing now correctly closes TIFF files are they have been sent.
- FAX header line insertion is now supported for transmitted FAXes.
- asynchronous serial processing now has a V.14 compatible rate adaption option.
- V.8 modem negotiation module added.
- OKI ADPCM now supports Dialogic compatible operation at 6k samples/second, as
well as 8k samples/second, using its own sample rate converter.
- message queuing added to ease things like T.31 handling
- incomplete skeleton (still rather nasty, to be honest) T.31 processing.
- incomplete skeleton of V.22bis added. There is probably quite a bit to do
to get this complete and robust. It probably requires the T.31 processing
be expanded to something more like V.250, so it doesn't just handle FAX.
- Incomplete V.17 added (there could be an IBM patent related to the TCM part of
V.17, but I think it has expired. Don't distribute binaries of spandsp built
with V.17 enabled until this is resolved - and the modem is completed, of
course :-) ). The current version transmits OK. It receives OK with the
long training sequence, but the symbol and carrier syncing isn't good enough
for robust receiving with the short training sequence.
- A basic BER tester has been added.
- The faster modems now have proper shutdown procedures, whether one is defined in
the spec. or not.
- The modems (except simple FSK) now have APIs to access performance information.
- A common GUI (using FLTK) added for the modem tests.
- A bit more documentation added.
- Some API inconsistencies cleaned up.
- The usual bundle of assorted buglet fixes and polishing.
04.04.29 - 0.0.1k - Steve Underwood <steveu@coppice.org>
- The first version which gives solid faxing for a large number of people.

View File

@ -1,55 +0,0 @@
Intellectual Property Due Diligence
-----------------------------------
Modems and voice coding are heavily patented areas. Implementing these without
serious consideration of IP issues would be foolish. This document describes
the basis on which the software has been implemented.
A check of the intellectual property information at the ITU web site shows a
number of patent claims against the current standards implemented by spandsp.
It is important to realise, however, that some of these patents have long
since expired (group III fax dates back to the 1970s). Also, many are
related to recent additions to the FAX standard, such as colour FAX handling,
which few people ever use.
The V.14 rate adaption standard seems free of patent encumberance.
One patent is listed as relevant to the V.17 standard. It is a patent from
IBM, but the ITU database does not specify its nature. I believe it is
related to the trellis coding used, and I think it has expired. I do not
know for sure. The techniques used in the implementation should be free of
patent encumberance. Most of the implementation is similar to the V.29
modem. The key addition the trellis code processing. The trellis encoding
is trivial. The decoding uses Viterbi techniques, which are quite old.
The V.21 standard dates from the 1950s. The V.23 standard is also very old.
There is no possibility that any patents related to it are still in force.
However, the implementation also needs to be free of patented techniques.
The implementation only uses very mature numerical oscillator and quadrature
correlation techniques, so there should be no patent issues.
Only one patent is listed as relevant to the V.29 standard. This dates from
the 1970s, and must have expired. The modem has been implemented using only
very mature techniques, none of which can be less than 20 years old. There
seem no possibility, therefore, that any patents are still in force related
to the techniques used.
Some aspect of the V.8 standard seems to have patents associated with it,
according to the ITU patent database. I am unclear what these are. V.8 is a
very simple standard. There seems to be nothing innovative about it.
Many patents are listed as relevant to the T.30 standard. However, they all
appear to relate to newer features, such as colour FAX, added in recent years.
The current implementation only covers the original features from the late
1970s, where there appear to be patent issues.
The T.4 standard defines the image compression and decompression techniques
used for group 3 FAXes. The spandsp implementation is based on code derived
from freely available implementations of T.4. These have existed for a number
of years without IP issues. The standard is old enough for any patents to have
expired, anyway.
V.42bis compression uses the LZW algorithm. This is the same algorithm used in
GIF files. Unisys patented this algorithm. However, the Unisys patent has now
expired.

View File

@ -1,91 +0,0 @@
##
## SpanDSP - a series of DSP components for telephony
##
## Makefile.am - Process this file with automake to produce Makefile.in
##
## 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.
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
noinst_SCRIPTS = spandsp.spec
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = autogen.sh \
DueDiligence \
debian/changelog \
debian/compat \
debian/control \
debian/copyright \
debian/libspandsp6.install \
debian/libspandsp-dev.install \
debian/libspandsp-doc.install \
debian/rules \
debian/watch \
README.testdata \
spandsp.spec \
spandsp/fax-tests.dtd \
spandsp/fax-tests.xml \
spandsp/global-tones.xml \
spandsp/tones.dtd \
spandsp/tsb85.xml \
unpack_g722_data.sh \
unpack_g726_data.sh \
unpack_gsm0610_data.sh \
unpack_v56ter_data.sh \
wrapper.xsl \
yum-prepare.sh
if COND_DOC
MAYBE_DOC=doc
endif
if COND_TESTS
MAYBE_TESTS=spandsp-sim test-data tests
endif
SUBDIRS = src $(MAYBE_DOC) $(MAYBE_TESTS)
DIST_SUBDIRS = src doc test-data spandsp-sim tests
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = spandsp.pc
faq: faq.xml
cd faq ; xsltproc ../wrapper.xsl ../faq.xml
rpm: rpm-build
rpm-build:
$(MAKE) -$(MAKEFLAGS) bump.rpm.release
$(MAKE) -$(MAKEFLAGS) dist
rm -rf rpm/BUILD/*
rm -f rpm/RPMS/*/*
rm -f rpm/SOURCES/*
rm -f rpm/SPECS/*
rm -f rpm/SRPMS/*
rpmbuild -ta --sign @PACKAGE@-@VERSION@.tar.gz
bump.rpm.release: spandsp.spec
VERSION="x"; \
test -f $(srcdir)/rpm.release && . $(srcdir)/rpm.release; \
NEXT_RELEASE=0; \
test "$$VERSION" = "@VERSION@" && NEXT_RELEASE="$$RELEASE"; \
RELEASE=`expr $$NEXT_RELEASE + 1`; \
echo "VERSION=@VERSION@" >$(srcdir)/rpm.release; \
echo "RELEASE=$$RELEASE" >>$(srcdir)/rpm.release; \
sed 's/^Release: .*/Release: '$$RELEASE'/' \
<spandsp.spec >spandsp.spec.new; \
mv spandsp.spec.new spandsp.spec

View File

@ -1 +0,0 @@
No news is good news!

View File

@ -1,35 +0,0 @@
spandsp 0.0.6 - A DSP library for telephony
-------------------------------------------
SpanDSP is a library of DSP functions for telephony, in the 8000 sample per
second world of E1s, T1s, and higher order PCM channels. It contains low level
functions, such as basic filters. It also contains higher level functions, such
as cadenced supervisory tone detection, and a complete software FAX machine.
The software has been designed to avoid intellectual property issues, using
mature techniques where all relevant patents have expired. See the file
DueDiligence for important information about these intellectual property issues.
The library is licenced under the LGPL 2.1 licence. The test suite, and some support
programs are licenced under the GPL 2 licence. The full text of these licences can
be found in the file COPYING.
Dependencies
------------
spandsp depends on various other packages for various tasks. Most of these
dependencies relate to building the test suite.
libtiff (and libtiff-devel on most Linux distributions) is required to
build the spandsp library.
libaudiofile (and libaudiofile-devel) is required to build the test suite
fftw (and fftw-devel) is required to build the test suite. Version 2 or 3 of
FFTW may be used. Spandsp adapts to the differences between them.
fltk (and fltk-devel), Fl_Cartesian and Fl_Audio_Meter are required to build
the test suite with GUI interfaces for some of the tests. The tests will build
without these packages, but the GUI features will not be available.
Fl_Cartesian and Fl_Audio_Meter can be downloaded from
http://www.soft-switch.org/downloads.
Steve Underwood <steveu@coppice.org>

View File

@ -1,53 +0,0 @@
Setting up test data for the supplied suite of test programs.
-------------------------------------------------------------
Some of the tests in the test suite for this package require test data files. These test
data files fall into four categories:
- Some data files, such as those for some of the FAX tests, are generated by programs
in the package.
- Some are freely distributable data files, from various sources. These are supplied
with the package.
- Some are test data files from a standards body. These are the copyright material of
the standards body, and so cannot be distributed with this package. However, most of
these files can currently be downloaded at no charge from the standards body's web
site. This file describes which files are needed, and how they may be processed to
produce the right files in the right places for the tests.
- The two industry standard sources of test data for DTMF decoders are Bellcore/Telcordia
and Mitel. Neither of these is either free, or supplied in a form directly usable
with the test suite. These data sources are expected by several tests, and not just
the DTMF decoder tests. Sad to say, you are on your own when trying to source data
for these tests.
For the G.722 tests, obtain the file T-REC-G.722-198703-I!AppII!ZPF-E.zip from the ITU web site,
and place it in this directory. Then run
./unpack_g722_data.sh
For the G.726 tests, obtain the file T-REC-G.726-199103-I!AppII!SOFT-ZST-E.zip from the ITU web
site, and place it in this directory. Then run
./unpack_g726_data.sh
For the GSM 06.10 tests, obtain the file en_300961v080101p0.zip from the ETSI web site,
and place it in this directory. If you are able to run .exe (i.e. MS DOS or Windows)
files you can simply run
./unpack_gsm0610_data.sh
If you are unable to run .exe files on the machine you are using (e.e. you are not using Cygwin,
Mingw, Wine, FreeDOS or something of that sort) you will need to find a machine which will. First,
run
./unpack_gsm0610_data.sh --no-exe
This will leave 6 .EXE files in the etsitetss/gsm0610 directory. Take these to a machine which
can run .EXE files, and execute all of them. This should result in a number of files which end
with .COD, INP and .OUT. Copy these to the etsitests/gsm0610 directory, and run
./unpack_gsm0610_data.sh --no-exe-continue
The remainder of the extraction and repacking of files should then take place.

View File

@ -1,129 +0,0 @@
#!/usr/bin/env sh
#
# SpanDSP - a series of DSP components for telephony
#
# autogen script
#
# 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 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.
UNAME=`uname`
if [ "x$UNAME" = "xFreeBSD" ]; then
echo ""
echo ""
echo "******************************************"
echo "*** NOTICE ***"
echo "******************************************"
echo " "
echo "FreeBSD is buggy. Please use this "
echo "workaround if you want to bootstrap "
echo "on FreeBSD. "
echo " "
echo "cd /usr/local/share/aclocal19 "
echo "ln -s ../aclocal/libtool15.m4 . "
echo "ln -s ../aclocal/ltdl15.m4 . "
echo " "
echo "******************************************"
echo ""
fi
debug ()
{
# Outputs debug statments if DEBUG var is set
if [ ! -z "$DEBUG" ]; then
echo "DEBUG: $1"
fi
}
version_compare()
{
# Checks a command is found and the version is high enough
PROGRAM=$1
MAJOR=$2
MINOR=$3
MICRO=$4
test -z "$MAJOR" && MAJOR=0
test -z "$MINOR" && MINOR=0
test -z "$MICRO" && MICRO=0
debug "Checking $PROGRAM >= $MAJOR.$MINOR.$MICRO"
WHICH_PATH=`whereis which | cut -f2 -d' '`
COMMAND=`$WHICH_PATH $PROGRAM`
if [ -z $COMMAND ]; then
echo "$PROGRAM-$MAJOR.$MINOR.$MICRO is required and was not found."
return 1
else
debug "Found $COMMAND"
fi
INS_VER=`$COMMAND --version | head -1 | sed 's/[^0-9]*//' | cut -d' ' -f1`
INS_MAJOR=`echo $INS_VER | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
INS_MINOR=`echo $INS_VER | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
INS_MICRO=`echo $INS_VER | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
test -z "$INS_MAJOR" && INS_MAJOR=0
test -z "$INS_MINOR" && INS_MINOR=0
test -z "$INS_MICRO" && INS_MICRO=0
debug "Installed version: $INS_VER"
if [ "$INS_MAJOR" -gt "$MAJOR" ]; then
debug "MAJOR: $INS_MAJOR > $MAJOR"
return 0
elif [ "$INS_MAJOR" -eq "$MAJOR" ]; then
debug "MAJOR: $INS_MAJOR = $MAJOR"
if [ "$INS_MINOR" -gt "$MINOR" ]; then
debug "MINOR: $INS_MINOR > $MINOR"
return 0
elif [ "$INS_MINOR" -eq "$MINOR" ]; then
if [ "$INS_MICRO" -ge "$MICRO" ]; then
debug "MICRO: $INS_MICRO >= $MICRO"
return 0
else
debug "MICRO: $INS_MICRO < $MICRO"
fi
else
debug "MINOR: $INS_MINOR < $MINOR"
fi
else
debug "MAJOR: $INS_MAJOR < $MAJOR"
fi
echo "You have the wrong version of $PROGRAM. The minimum required version is $MAJOR.$MINOR.$MICRO"
echo " and the version installed is $INS_MAJOR.$INS_MINOR.$INS_MICRO ($COMMAND)."
return 1
}
# Check for required version and die if unhappy
mkdir config
if [ "x$UNAME" = "xFreeBSD" ]; then
version_compare libtoolize 1 5 16 || exit 1
version_compare automake19 1 9 5 || exit 1
version_compare autoconf259 2 59 || exit 1
else
version_compare libtoolize 1 5 16 || exit 1
version_compare automake 1 9 5 || exit 1
version_compare autoconf 2 59 || exit 1
fi
autoreconf -fi
#chmod ug+x debian/rules
if [ "x$UNAME" = "xNetBSD" ]; then
echo ""
echo "Please remember to run gmake instead of make on NetBSD"
echo ""
fi

View File

@ -1,646 +0,0 @@
#
# SpanDSP - a series of DSP components for telephony
#
# configure.ac - Process this file with autoconf to produce configure
#
# 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.
# @start 1
AC_PREREQ([2.59])
AC_INIT([spandsp], [1.99.0])
CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
SPANDSP_LT_CURRENT=3
SPANDSP_LT_REVISION=0
SPANDSP_LT_AGE=0
m4_include(m4/ax_compiler_vendor.m4)
m4_include(m4/ax_check_real_file.m4)
m4_include(m4/ax_fixed_point_machine.m4)
m4_include(m4/ax_misaligned_access_fails.m4)
m4_include(m4/ax_c99_features.m4)
m4_include(m4/ax_check_export_capability.m4)
m4_include(m4/ax_check_arm_neon.m4)
m4_include(m4/ax_func_aligned_alloc.m4)
m4_include(m4/ac_func_memmove.m4)
AC_CONFIG_SRCDIR([src/tone_generate.c])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([src/config.h:config-h.in])
AM_INIT_AUTOMAKE([1.9.5])
AC_CANONICAL_HOST
#AC_CANONICAL_BUILD
AC_PROG_CC
AC_PROG_CXX
AC_PROG_GCC_TRADITIONAL
AC_PROG_LIBTOOL
AC_LANG([C])
AX_COMPILER_VENDOR
if test "${build}" != "${host}"
then
# If we are doing a Canadian Cross, in which the host and build systems
# are not the same, we set reasonable default values for the tools.
CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)"
CC=${CC-${host_alias}-gcc}
CFLAGS=${CFLAGS-"-g -O2"}
CXX=${CXX-${host_alias}-c++}
CXXFLAGS=${CXXFLAGS-"-g -O2"}
else
# Set reasonable default values for some tools even if not Canadian.
# Of course, these are different reasonable default values, originally
# specified directly in the Makefile.
# We don't export, so that autoconf can do its job.
# Note that all these settings are above the fragment inclusion point
# in Makefile.in, so can still be overridden by fragments.
# This is all going to change when we autoconfiscate...
CC_FOR_BUILD="\$(CC)"
CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)"
AC_PROG_CC
# We must set the default linker to the linker used by gcc for the correct
# operation of libtool. If LD is not defined and we are using gcc, try to
# set the LD default to the ld used by gcc.
if test -z "$LD"
then
if test "$GCC" = yes
then
case $build in
*-*-mingw*)
gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
*)
gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
esac
case $gcc_prog_ld in
# Accept absolute paths.
[[\\/]* | [A-Za-z]:[\\/]*)]
LD="$gcc_prog_ld" ;;
esac
fi
fi
CXX=${CXX-"c++"}
CFLAGS=${CFLAGS-"-g -O2"}
CXXFLAGS=${CXXFLAGS-"-g -O2"}
fi
AC_DEFUN([REMOVE_FROM_VAR],[
new_val=""
removed=0
for i in $$1; do
if test "x$i" != "x$2"; then
new_val="$new_val $i"
else
removed=1
fi
done
if test $removed = "1"; then
echo " removed \"$2\" from $1"
$1=$new_val
fi
])
AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
AC_CHECK_TYPES(long long)
AC_CHECK_TYPES(long double)
AC_TYPE_SIGNAL
AC_ARG_ENABLE(doc, [ --enable-doc Build the documentation])
AC_ARG_ENABLE(tests, [ --enable-tests Build the test programs])
AC_ARG_ENABLE(mmx, [ --enable-mmx Enable MMX support])
AC_ARG_ENABLE(sse, [ --enable-sse Enable SSE support])
AC_ARG_ENABLE(sse2, [ --enable-sse2 Enable SSE2 support])
AC_ARG_ENABLE(sse3, [ --enable-sse3 Enable SSE3 support])
AC_ARG_ENABLE(ssse3, [ --enable-ssse3 Enable SSSE3 support])
AC_ARG_ENABLE(sse4_1, [ --enable-sse4-1 Enable SSE4.1 support])
AC_ARG_ENABLE(sse4_2, [ --enable-sse4-2 Enable SSE4.2 support])
AC_ARG_ENABLE(avx, [ --enable-avx Enable AVX support])
AC_ARG_ENABLE(avx2, [ --enable-avx2 Enable AVX2 support])
AC_ARG_ENABLE(neon, [ --enable-neon Enable NEON support])
AC_ARG_ENABLE(fixed_point, [ --enable-fixed-point Enable fixed point support])
AC_ARG_ENABLE(v32bis, [ --enable-v32bis Enable V.32bis support])
AC_ARG_ENABLE(v34, [ --enable-v34 Enable V.34 support])
# The following is for MSVC, where we may be using a local copy of libtiff, built alongside spandsp
AC_ARG_ENABLE(builtin_tiff,
[AC_HELP_STRING([--enable-builtin-tiff],[build with builtin libtiff])],[enable_builtin_tiff="$enableval"],[enable_builtin_tiff="no"])
AC_FUNC_ERROR_AT_LINE
AC_FUNC_VPRINTF
AC_FUNC_MEMCMP
AC_FUNC_MEMMOVE
AC_FUNC_SELECT_ARGTYPES
AX_C99_FUNC_LRINT
AX_C99_FUNC_LRINTF
AX_C99_FUNC_LLRINT
AX_C99_FUNC_LLRINTF
if test "x$ac_cv_c99_lrint" = "xno" ; then
if test "x$ac_cv_c99_lrintf" = "xno" ; then
AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
fi
fi
AX_C99_FLEXIBLE_ARRAY
AX_FUNC_ALIGNED_ALLOC
AC_CHECK_FUNCS([memalign])
AC_CHECK_FUNCS([posix_memalign])
AC_CHECK_FUNCS([memmove])
AC_CHECK_FUNCS([memset])
AC_CHECK_FUNCS([select])
AC_CHECK_FUNCS([strcasecmp])
AC_CHECK_FUNCS([strchr])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([strerror])
AC_CHECK_FUNCS([strstr])
AC_CHECK_FUNCS([strtol])
AC_CHECK_FUNCS([gettimeofday])
AC_CHECK_FUNCS([drand48])
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
# Check for header files.
AC_CHECK_HEADERS([socket.h])
AC_CHECK_HEADERS([inttypes.h], [INSERT_INTTYPES_HEADER="#include <inttypes.h>"])
AC_CHECK_HEADERS([stdint.h], [INSERT_STDINT_HEADER="#include <stdint.h>"])
AC_CHECK_HEADERS([stdatomic.h])
AC_CHECK_HEADERS([stdbool.h], [INSERT_STDBOOL_HEADER="#include <stdbool.h>"], [INSERT_STDBOOL_HEADER="#include <spandsp/stdbool.h>"])
AC_CHECK_HEADERS([stdfix.h])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([strings.h])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([math.h], [INSERT_MATH_HEADER="#include <math.h>"])
AC_CHECK_HEADERS([float.h])
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([sys/select.h])
AC_CHECK_HEADERS([sys/ioctl.h])
AC_CHECK_HEADERS([sys/fcntl.h])
AC_CHECK_HEADERS([sndfile.h])
AC_CHECK_HEADERS([fenv.h])
AC_CHECK_HEADERS([fftw3.h], , [AC_CHECK_HEADERS([fftw.h])])
AC_CHECK_HEADERS([pcap.h])
AC_CHECK_HEADERS([pthread.h])
case "$host" in
*dragonfly*)
;;
*freebsd*)
;;
*netbsd*)
;;
*)
AC_CHECK_HEADERS([tgmath.h], [INSERT_TGMATH_HEADER="#include <tgmath.h>"])
;;
esac
if test "${build}" = "${host}"
then
AC_CHECK_HEADERS([X11/X.h])
fi
# Determine XML2 include path
AC_MSG_CHECKING(for libxml/xmlmemory.h)
# Can we include headers using system include dirs?
AC_TRY_COMPILE([#include <libxml/xmlmemory.h>], [int a = 1;],
XML2_INCLUDE=" ",
XML2_INCLUDE=
)
# Hunt through several possible directories to find the includes for libxml2
if test "x$XML2_INCLUDE" = "x"; then
old_CPPFLAGS="$CPPFLAGS"
for i in $xml2_include_dir /usr/include /usr/local/include /usr/include/libxml2 /usr/local/include/libxml2 ; do
CPPFLAGS="$old_CPPFLAGS -I$i"
AC_TRY_COMPILE([#include <libxml/xmlmemory.h>], [int a = 1;],
XML2_INCLUDE="-I$i",
XML2_INCLUDE=
)
if test "x$XML2_INCLUDE" != "x"; then
break;
fi
done
CPPFLAGS="$old_CPPFLAGS $XML2_INCLUDE"
fi
AC_CHECK_HEADERS([libxml/xmlmemory.h])
AC_CHECK_HEADERS([libxml/parser.h])
AC_CHECK_HEADERS([libxml/xinclude.h])
AC_LANG([C++])
AC_CHECK_HEADERS([FL/Fl.H])
AC_CHECK_HEADERS([FL/Fl_Overlay_Window.H])
AC_CHECK_HEADERS([FL/Fl_Light_Button.H])
AC_CHECK_HEADERS([FL/fl_draw.H])
AC_CHECK_HEADERS([FL/Fl_Cartesian.H])
AC_CHECK_HEADERS([FL/Fl_Audio_Meter.H])
AC_LANG([C])
if test "${build}" = "${host}"
then
case "${host}" in
x86_64-*)
# X86_64 Linux machines may have both 64 bit and 32 bit libraries. We need to choose the right set
AX_CHECK_REAL_FILE([${prefix}/lib64], libdir='${exec_prefix}/lib64')
AX_CHECK_REAL_FILE([/usr/X11R6/lib64], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib64"], AC_CHECK_FILE([/usr/X11R6/lib], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib"]))
# The very oldest AMD 64 bit chips support SSE2, SSE and MMX
enable_sse2="yes"
;;
esac
fi
AC_CHECK_LIB([m], [cos])
# Some platforms still seem to lack the basic single precision trig and power related functions.
AC_SEARCH_LIBS([sinf], [m], AC_DEFINE([HAVE_SINF], [1], [Define to 1 if you have the sinf() function.]))
AC_SEARCH_LIBS([cosf], [m], AC_DEFINE([HAVE_COSF], [1], [Define to 1 if you have the cosf() function.]))
AC_SEARCH_LIBS([tanf], [m], AC_DEFINE([HAVE_TANF], [1], [Define to 1 if you have the tanf() function.]))
AC_SEARCH_LIBS([asinf], [m], AC_DEFINE([HAVE_ASINF], [1], [Define to 1 if you have the asinf() function.]))
AC_SEARCH_LIBS([acosf], [m], AC_DEFINE([HAVE_ACOSF], [1], [Define to 1 if you have the acosf() function.]))
AC_SEARCH_LIBS([atanf], [m], AC_DEFINE([HAVE_ATANF], [1], [Define to 1 if you have the atanf() function.]))
AC_SEARCH_LIBS([atan2f], [m], AC_DEFINE([HAVE_ATAN2F], [1], [Define to 1 if you have the atan2f() function.]))
AC_SEARCH_LIBS([ceilf], [m], AC_DEFINE([HAVE_CEILF], [1], [Define to 1 if you have the ceilf() function.]))
AC_SEARCH_LIBS([floorf], [m], AC_DEFINE([HAVE_FLOORF], [1], [Define to 1 if you have the floorf() function.]))
AC_SEARCH_LIBS([powf], [m], AC_DEFINE([HAVE_POWF], [1], [Define to 1 if you have the powf() function.]))
AC_SEARCH_LIBS([expf], [m], AC_DEFINE([HAVE_EXPF], [1], [Define to 1 if you have the expf() function.]))
AC_SEARCH_LIBS([logf], [m], AC_DEFINE([HAVE_LOGF], [1], [Define to 1 if you have the logf() function.]))
AC_SEARCH_LIBS([log10f], [m], AC_DEFINE([HAVE_LOG10F], [1], [Define to 1 if you have the log10f() function.]))
AC_SEARCH_LIBS([open_memstream], [m], AC_DEFINE([HAVE_OPEN_MEMSTREAM], [1], [Define to 1 if you have the open_memstream() function.]))
if test -n "$enable_tests" ; then
AC_CHECK_PROG([HAVE_SOX], [sox], yes)
if test "x$HAVE_SOX" != "xyes" ; then
AC_MSG_ERROR("Cannot make tests without sox installed")
fi
AC_CHECK_PROG([HAVE_PBMTOG3], [pbmtog3], yes)
if test "x$HAVE_PBMTOG3" != "xyes" ; then
AC_MSG_ERROR("Cannot make tests without pbmtog3 installed (does your system require a netpbm-progs package?)")
fi
AC_CHECK_PROG([HAVE_FAX2TIFF], [fax2tiff], yes)
if test "x$HAVE_FAX2TIFF" != "xyes" ; then
AC_MSG_ERROR("Cannot make tests without fax2tiff installed (does your system require a libtiff-tools package?)")
fi
AC_LANG([C])
# Checks for libraries.
AC_CHECK_LIB([sndfile], [sf_open], SIMLIBS="$SIMLIBS -lsndfile", AC_MSG_ERROR("Cannot make tests without libsndfile (does your system require a libsndfile-devel package?)"))
AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], SIMLIBS="$SIMLIBS -lfftw3", [AC_CHECK_LIB([fftw], [fftw_create_plan], SIMLIBS="$SIMLIBS -lfftw", AC_MSG_ERROR("Cannot make tests without FFTW 2 or 3 (does your system require an fftw?-devel package?)"))])
AC_CHECK_LIB([xml2], [xmlParseFile], TESTLIBS="$TESTLIBS -lxml2", AC_MSG_ERROR("Cannot make tests without libxml2 (does your system require a libxml2-devel package?)"))
AC_CHECK_LIB([pcap], [pcap_open_offline], TESTLIBS="$TESTLIBS -lpcap", [AC_CHECK_LIB([wpcap], [pcap_open_offline], TESTLIBS="$TESTLIBS -lwpcap", AC_MSG_ERROR("Cannot make tests without libpcap (does your system require an libpcap-devel package?)"))])
AC_CHECK_LIB([pthread], [pthread_attr_init], TESTLIBS="$TESTLIBS -lpthread")
AC_CHECK_LIB([dl], [dlopen], TESTLIBS="$TESTLIBS -ldl")
AC_CHECK_LIB([Xft], [XftFontOpen], TESTLIBS="$TESTLIBS -lXft",, $TESTLIBS)
AC_CHECK_LIB([Xext], [XextCreateExtension], TESTLIBS="$TESTLIBS -lXext",, $TESTLIBS)
AC_CHECK_LIB([X11], [XOpenDisplay], TESTLIBS="$TESTLIBS -lX11",, $TESTLIBS)
AC_LANG([C++])
AC_CHECK_LIB([fltk], [main], TESTLIBS="$TESTLIBS -lfltk -lsupc++",, $TESTLIBS)
AC_CHECK_LIB([fltk_cartesian], [main], TESTLIBS="-lfltk_cartesian $TESTLIBS",, $TESTLIBS)
AC_CHECK_LIB([fltk_audio_meter], [main], TESTLIBS="-lfltk_audio_meter $TESTLIBS",, $TESTLIBS)
AC_LANG([C])
fi
AX_CHECK_EXPORT_CAPABILITY([$host],
[AC_DEFINE([SPANDSP_USE_EXPORT_CAPABILITY], [1], [Use the library symbol export capability of the compiler])
SPANDSP_USE_EXPORT_CAPABILITY="#define SPANDSP_USE_EXPORT_CAPABILITY 1"],
[SPANDSP_USE_EXPORT_CAPABILITY="#undef SPANDSP_USE_EXPORT_CAPABILITY"])
saved_CFLAGS="$CFLAGS"
AC_CACHE_CHECK([whether compiler supports -Wunused-but-set-variable], [ac_cv_gcc_unused_but_set_variable], [
# We need to add -Werror here or clang doesn't fail (it just warns), even though it doesn't understand the
# -Wunused-but-set-variable tag
CFLAGS="$CFLAGS -Werror -Wunused-but-set-variable"
AC_TRY_COMPILE([],[return 0;],[ac_cv_gcc_unused_but_set_variable=yes],[ac_cv_gcc_unused_but_set_variable=no])
])
AC_MSG_RESULT($ac_cv_gcc_unused_but_set_variable)
CFLAGS="$saved_CFLAGS"
case "${ax_cv_c_compiler_vendor}" in
gnu)
COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
if test x"$ac_cv_gcc_unused_but_set_variable" = xyes ; then
COMP_VENDOR_CFLAGS="-Wunused-but-set-variable $COMP_VENDOR_CFLAGS"
fi
AX_CHECK_ARM_NEON([$host],
[AC_DEFINE([SPANDSP_USE_ARM_NEON], [1], [Use the ARM NEON instruction set])])
if test "$enable_neon" = "yes" ; then
COMP_VENDOR_CFLAGS="-mfpu=neon $COMP_VENDOR_CFLAGS"
fi
if test "$enable_avx2" = "yes" ; then
COMP_VENDOR_CFLAGS="-mavx2 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_avx" = "yes" ; then
COMP_VENDOR_CFLAGS="-mavx $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse4_2" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse4.2 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse4_1" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse4.1 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_ssse3" = "yes" ; then
COMP_VENDOR_CFLAGS="-mssse3 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse3" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse3 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse2" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse2 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse $COMP_VENDOR_CFLAGS"
fi
if test "$enable_mmx" = "yes" ; then
COMP_VENDOR_CFLAGS="-mmmx $COMP_VENDOR_CFLAGS"
fi
case $host_os in
cygwin*)
COMP_VENDOR_LDFLAGS="-no-undefined"
;;
mingw*)
COMP_VENDOR_LDFLAGS="-no-undefined -lws2_32"
;;
*)
COMP_VENDOR_LDFLAGS=
;;
esac
;;
sun)
COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -errwarn=%all -xvpara $COMP_VENDOR_CFLAGS"
if test "$enable_sse3" = "yes" ; then
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse2" = "yes" ; then
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse" = "yes" ; then
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
fi
if test "$enable_mmx" = "yes" ; then
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
fi
COMP_VENDOR_LDFLAGS=
REMOVE_FROM_VAR(CFLAGS, -Xc)
;;
intel)
COMP_VENDOR_CFLAGS="-std=c99 -D_POSIX_C_SOURCE=2 -D_GNU_SOURCE=1 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
if test x"$ac_cv_gcc_unused_but_set_variable" = xyes ; then
COMP_VENDOR_CFLAGS="-Wunused-but-set-variable $COMP_VENDOR_CFLAGS"
fi
if test "$enable_avx2" = "yes" ; then
COMP_VENDOR_CFLAGS="-mavx2 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_avx" = "yes" ; then
COMP_VENDOR_CFLAGS="-mavx $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse4_2" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse4.2 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse4_1" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse4.1 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_ssse3" = "yes" ; then
COMP_VENDOR_CFLAGS="-mssse3 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse3" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse3 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse2" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse2 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse $COMP_VENDOR_CFLAGS"
fi
if test "$enable_mmx" = "yes" ; then
COMP_VENDOR_CFLAGS="-mmmx $COMP_VENDOR_CFLAGS"
fi
COMP_VENDOR_LDFLAGS=
;;
clang*)
COMP_VENDOR_CFLAGS="-D_XOPEN_SOURCE=700 -std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
if test x"$ac_cv_gcc_unused_but_set_variable" = xyes ; then
COMP_VENDOR_CFLAGS="-Wunused-but-set-variable $COMP_VENDOR_CFLAGS"
fi
COMP_VENDOR_LDFLAGS=
;;
*)
COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes $COMP_VENDOR_CFLAGS"
if test x"$ac_cv_gcc_unused_but_set_variable" = xyes ; then
COMP_VENDOR_CFLAGS="-Wunused-but-set-variable $COMP_VENDOR_CFLAGS"
fi
COMP_VENDOR_LDFLAGS=
;;
esac
COMP_VENDOR_CFLAGS="-DNDEBUG $COMP_VENDOR_CFLAGS"
if test "$enable_fixed_point" = "yes" ; then
AC_DEFINE([SPANDSP_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
SPANDSP_USE_FIXED_POINT="#define SPANDSP_USE_FIXED_POINT 1"
else
AX_FIXED_POINT_MACHINE([$host],
[AC_DEFINE([SPANDSP_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
SPANDSP_USE_FIXED_POINT="#define SPANDSP_USE_FIXED_POINT 1"],
[SPANDSP_USE_FIXED_POINT="#undef SPANDSP_USE_FIXED_POINT"])
fi
AX_MISALIGNED_ACCESS_FAILS([$host],
[AC_DEFINE([SPANDSP_MISALIGNED_ACCESS_FAILS], [1], [Do not expect a misaligned memory access to work correctly])
SPANDSP_MISALIGNED_ACCESS_FAILS="#define SPANDSP_MISALIGNED_ACCESS_FAILS 1"],
[SPANDSP_MISALIGNED_ACCESS_FAILS="#undef SPANDSP_MISALIGNED_ACCESS_FAILS"])
case "${host}" in
armv7[bl] | armv7-*)
if test "$enable_neon" = "yes" ; then
AC_DEFINE([SPANDSP_USE_ARM_NEON], [1], [Use the NEON instruction set (ARMV7 only).])
fi
;;
x86_64-* | i386-* | i686-*)
if test "$enable_avx2" = "yes" ; then
AC_DEFINE([SPANDSP_USE_AVX2], [1], [Use the AVX2 instruction set (i386 and x86_64 only).])
enable_avx="yes"
fi
if test "$enable_avx" = "yes" ; then
AC_DEFINE([SPANDSP_USE_AVX], [1], [Use the AVX instruction set (i386 and x86_64 only).])
enable_sse4_2="yes"
fi
if test "$enable_sse4_2" = "yes" ; then
AC_DEFINE([SPANDSP_USE_SSE4_2], [1], [Use the SSE4.2 instruction set (i386 and x86_64 only).])
enable_sse4_1="yes"
fi
if test "$enable_sse4_1" = "yes" ; then
AC_DEFINE([SPANDSP_USE_SSE4_1], [1], [Use the SSE4.1 instruction set (i386 and x86_64 only).])
enable_ssse3="yes"
fi
if test "$enable_ssse3" = "yes" ; then
AC_DEFINE([SPANDSP_USE_SSSE3], [1], [Use the SSSE3 instruction set (i386 and x86_64 only).])
enable_sse3="yes"
fi
if test "$enable_sse3" = "yes" ; then
AC_DEFINE([SPANDSP_USE_SSE3], [1], [Use the SSE3 instruction set (i386 and x86_64 only).])
enable_sse2="yes"
fi
if test "$enable_sse2" = "yes" ; then
AC_DEFINE([SPANDSP_USE_SSE2], [1], [Use the SSE2 instruction set (i386 and x86_64 only).])
enable_sse="yes"
fi
if test "$enable_sse" = "yes" ; then
AC_DEFINE([SPANDSP_USE_SSE], [1], [Use the SSE instruction set (i386 and x86_64 only).])
enable_mmx="yes"
fi
if test "$enable_mmx" = "yes" ; then
AC_DEFINE([SPANDSP_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).])
fi
;;
esac
case "$host" in
*bsd*)
CFLAGS="$CFLAGS -I/usr/local/include"
LDFLAGS="$LDFLAGS -L/usr/local/lib"
;;
esac
if test "$enable_builtin_tiff" = "yes" ; then
abs_tiffdir="`cd ../tiff-4.0.2/ && pwd`"
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -I$abs_tiffdir/libtiff"
AC_CHECK_HEADERS([tiffio.h])
AC_CHECK_HEADERS([tif_dir.h], [], [], [#include <tiffio.h>
])
CFLAGS="$save_CFLAGS"
COMP_VENDOR_CFLAGS="-I$abs_tiffdir/libtiff $COMP_VENDOR_CFLAGS"
COMP_VENDOR_LDFLAGS="-L$abs_tiffdir/libtiff $COMP_VENDOR_LDFLAGS"
TIFF_LIBS="$abs_tiffdir/libtiff/libtiff.la"
AC_DEFINE([HAVE_LIBTIFF], [1], [Define to 1 if you have the `tiff' library (-ltiff).])
else
AC_CHECK_HEADERS([tiffio.h])
AC_CHECK_LIB([tiff], [TIFFOpen], , AC_MSG_ERROR("Cannot build without libtiff (does your system require a libtiff-devel package?)"), -lm)
fi
AC_CHECK_LIB([tiff], [TIFFCreateCustomDirectory], [
if test "$ac_cv_header_tif_dir_h" = "yes" ; then
AC_DEFINE([SPANDSP_SUPPORT_TIFF_FX], [1], [Support TIFF/FX in TIFF file handling])
SPANDSP_SUPPORT_TIFF_FX="#define SPANDSP_SUPPORT_TIFF_FX 1"
else
SPANDSP_SUPPORT_TIFF_FX="#undef SPANDSP_SUPPORT_TIFF_FX"
fi
], [SPANDSP_SUPPORT_TIFF_FX="#undef SPANDSP_SUPPORT_TIFF_FX"], -lm)
AC_CHECK_HEADERS([jpeglib.h])
AC_CHECK_LIB([jpeg], [jpeg_start_compress], [JPEG_LIBS="-ljpeg"], AC_MSG_ERROR("Cannot build without libtiff (does your system require a libjpeg-devel or libjpeg-turbo-devel package?)"))
LIBS="$LIBS $TIFF_LIBS $JPEG_LIBS"
TESTLIBS="$SIMLIBS $TESTLIBS"
if test "$enable_t43" = "yes" ; then
AC_DEFINE([SPANDSP_SUPPORT_T43], [1], [Support T.43 JBIG gray and colour compression])
SPANDSP_SUPPORT_T43="#define SPANDSP_SUPPORT_T43 1"
else
SPANDSP_SUPPORT_T43="#undef SPANDSP_SUPPORT_T43"
fi
if test "$enable_v32bis" = "yes" ; then
AC_DEFINE([SPANDSP_SUPPORT_V32BIS], [1], [Support the V.32bis modem])
SPANDSP_SUPPORT_V32BIS="#define SPANDSP_SUPPORT_V32BIS 1"
else
SPANDSP_SUPPORT_V32BIS="#undef SPANDSP_SUPPORT_V32BIS"
fi
if test "$enable_v34" = "yes" ; then
AC_DEFINE([SPANDSP_SUPPORT_V34], [1], [Support the V.34 FAX modem])
SPANDSP_SUPPORT_V34="#define SPANDSP_SUPPORT_V34 1"
else
SPANDSP_SUPPORT_V34="#undef SPANDSP_SUPPORT_V34"
fi
AM_CONDITIONAL([COND_DOC], [test "$enable_doc" = yes])
AM_CONDITIONAL([COND_TESTS], [test "$enable_tests" = yes])
AM_CONDITIONAL([COND_MMX], [test "$enable_mmx" = yes])
AM_CONDITIONAL([COND_SSE], [test "$enable_sse" = yes])
AM_CONDITIONAL([COND_SSE2], [test "$enable_sse2" = yes])
AM_CONDITIONAL([COND_SSE3], [test "$enable_sse3" = yes])
AM_CONDITIONAL([COND_SSSE3], [test "$enable_ssse3" = yes])
AM_CONDITIONAL([COND_SSE4_1], [test "$enable_sse4_1" = yes])
AM_CONDITIONAL([COND_SSE4_2], [test "$enable_sse4_2" = yes])
AM_CONDITIONAL([COND_AVX], [test "$enable_avx" = yes])
AM_CONDITIONAL([COND_AVX2], [test "$enable_avx2" = yes])
AM_CONDITIONAL([COND_NEON], [test "$enable_neon" = yes])
AM_CONDITIONAL([COND_V32BIS], [test yes = xyes])
AM_CONDITIONAL([COND_V34], [test yes = xyes])
AC_SUBST(SPANDSP_LT_CURRENT)
AC_SUBST(SPANDSP_LT_REVISION)
AC_SUBST(SPANDSP_LT_AGE)
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CPPFLAGS_FOR_BUILD)
AC_SUBST(COMP_VENDOR_CFLAGS)
AC_SUBST(COMP_VENDOR_LDFLAGS)
AC_SUBST(SIMLIBS)
AC_SUBST(TESTLIBS)
AC_SUBST(SPANDSP_USE_FIXED_POINT)
AC_SUBST(SPANDSP_MISALIGNED_ACCESS_FAILS)
AC_SUBST(SPANDSP_USE_EXPORT_CAPABILITY)
AC_SUBST(SPANDSP_SUPPORT_T43)
AC_SUBST(SPANDSP_SUPPORT_V32BIS)
AC_SUBST(SPANDSP_SUPPORT_V34)
AC_SUBST(SPANDSP_SUPPORT_TIFF_FX)
AC_SUBST(INSERT_INTTYPES_HEADER)
AC_SUBST(INSERT_STDINT_HEADER)
AC_SUBST(INSERT_TGMATH_HEADER)
AC_SUBST(INSERT_MATH_HEADER)
AC_SUBST(INSERT_STDBOOL_HEADER)
AC_CONFIG_FILES([Makefile
doc/Makefile
doc/doxygen
src/Makefile
src/spandsp.h
spandsp-sim/Makefile
test-data/Makefile
test-data/etsi/Makefile
test-data/etsi/fax/Makefile
test-data/itu/Makefile
test-data/itu/fax/Makefile
test-data/itu/tiff-fx/Makefile
test-data/local/Makefile
tests/Makefile
spandsp.pc
spandsp.spec])
AC_OUTPUT
# @end 1

View File

@ -1,4 +0,0 @@
#! /bin/sh
srcpath=$(dirname $0 2>/dev/null ) || srcpath="."
$srcpath/configure "$@" --disable-shared --with-pic

View File

@ -1,119 +0,0 @@
spandsp (0.0.6~pre7-1) unstable; urgency=low
[ Steve Underwood ]
* New upstream release.
* Fixed upstream file name for get-orig-source.
* Updates to 64bit archs support
* Removal of obsoleted files
-- Steve Underwood <steveu@coppice.org> Sat, 14 Mar 2009 09:23:36 +0100
spandsp (0.0.5~pre2-1) unstable; urgency=low
[ Massimo Cetra ]
* New upstream release.
* Fixed upstream file name for get-orig-source.
* Updates to 64bit archs support
* Removal of obsoleted files
-- Massimo Cetra <devel@navynet.it> Mon, 5 May 2008 09:23:36 +0100
spandsp (0.0.4~pre3-1) unstable; urgency=low
[ Santiago Ruano Rincón ]
* Added Conflicts: libspandsp2
* Fixed URL in debian/rules
[ Tzafrir Cohen ]
* New upstream release.
* Fixed upstream file name for get-orig-source.
* standards version updated to 3.7.2 .
-- Tzafrir Cohen <tzafrir.cohen@xorcom.com> Mon, 18 Jun 2007 09:53:06 +0300
spandsp (0.0.4~pre1-1) experimental; urgency=low
* New upstream release.
-- Santiago Ruano Rincón <santiago@debian.org> Fri, 11 May 2007 15:24:41 -0500
spandsp (0.0.3pre27-2) experimental; urgency=low
* Conflict with libspandsp1 due to /usr/share/spandsp/global-tones.xml
-- Kilian Krause <kilian@debian.org> Thu, 4 Jan 2007 00:29:10 +0100
spandsp (0.0.3pre27-1) experimental; urgency=low
* New upstream release.
* Bump library name due to API incompatibility with 0.0.2 versions.
-- Kilian Krause <kilian@debian.org> Wed, 3 Jan 2007 21:31:17 +0100
spandsp (0.0.3pre26-1) experimental; urgency=low
* New upstream release
- New version of spandsp available (Closes: #339293)
- Remove src/spandsp/mmx.h is not GPL and has no license attached (Closes:
#357813)
* Lintian: outdated-autotools-helper-file - Build-Depends: autotools-dev
* Add debian/watch
-- Mark Purcell <msp@debian.org> Sat, 9 Dec 2006 14:00:57 +0000
spandsp (0.0.2pre26-1) unstable; urgency=low
* New upstream release.
* Added get-orig-source target.
* Removed unneeded and buggy nommx.dpatch (Closes: #376249, #377374)
-- Tzafrir Cohen <tzafrir.cohen@xorcom.com> Tue, 1 Aug 2006 06:27:47 +0100
spandsp (0.0.2pre25-1) unstable; urgency=low
* New upstream version.
* debian/copyright: Source's URL in copyright file updated to the new author' site.
* Added -doc package, with the API documentation.
* Fixed package name to follow new upstream's version.
-- Kilian Krause <kilian@debian.org> Sat, 18 Feb 2006 22:10:21 +0100
spandsp (0.0.2pre17-1) unstable; urgency=low
* New upstream version.
-- Kilian Krause <kk@verfaction.de> Mon, 9 May 2005 21:56:53 +0200
spandsp (0.0.2pre10-3) unstable; urgency=low
* debian/control: fixed overrides. again. (Back to the old optional)
-- Kilian Krause <kk@verfaction.de> Mon, 21 Mar 2005 10:39:30 +0100
spandsp (0.0.2pre10-2) unstable; urgency=low
* debian/control: fixed overrides.
* debian/patches/mmx.dpatch: Added compilation on non-i386 and non-amd64.
-- Kilian Krause <kk@verfaction.de> Sun, 20 Mar 2005 23:32:48 +0100
spandsp (0.0.2pre10-1) unstable; urgency=low
* New upstream release.
* Debian VoIP Team takes this package from Simon. Thanks!
* debian/rules: fixed how config.[sub,guess] files are linked from
autotools-dev and cleaned.
-- Kilian Krause <kk@verfaction.de> Sat, 22 Jan 2005 13:44:28 +0100
spandsp (0.0.2-2) unstable; urgency=low
* Corrected build dependencies.
-- Simon Richter <sjr@debian.org> Mon, 3 Jan 2005 13:33:33 +0100
spandsp (0.0.2-1) unstable; urgency=low
* Initial Release (Closes: #262032).
-- Simon Richter <sjr@debian.org> Sun, 2 Jan 2005 15:22:58 +0100

View File

@ -1 +0,0 @@
4

View File

@ -1,42 +0,0 @@
Source: spandsp
Section: libs
Priority: optional
Maintainer: Debian VoIP Team <pkg-voip-maintainers@lists.alioth.debian.org>
Uploaders: Jose Carlos Garcia Sogo <jsogo@debian.org>, Kilian Krause <kilian@debian.org>, Santiago Garcia Mantinan <manty@debian.org>, Mark Purcell <msp@debian.org>, Tzafrir Cohen <tzafrir.cohen@xorcom.com>, Santiago Ruano Rincón <santiago@debian.org>
Build-Depends: debhelper (>= 4.0.0), libtiff4-dev, libjpeg62-dev, dpatch, doxygen, autotools-dev, xsltproc
Standards-Version: 3.7.2
XS-Vcs-Svn: svn://svn.debian.org/pkg-voip/
XS-Vcs-Browser: http://svn.debian.org/wsvn/pkg-voip/
Package: libspandsp6
Architecture: any
Depends: ${shlibs:Depends}
Conflicts: libspandsp0, libspandsp1, libspandsp2
Description: Telephony signal processing library
This is a low-level signal processing library that modulate and demodulate
signals commonly used in telephony, such as the "noise" generated by a
fax modem or DTMF touchpad.
.
This package contains the shared library.
Package: libspandsp-dev
Section: libdevel
Architecture: any
Depends: libspandsp6 (= ${Source-Version}), libtiff4-dev, libjpeg62-dev
Description: Telephony signal processing library
This is a low-level signal processing library that modulate and demodulate
signals commonly used in telephony, such as the "noise" generated by a
fax modem or DTMF touchpad.
.
This package contains the static library and development headers.
.
Homepage: http://www.soft-switch.org/
Package: libspandsp-doc
Section: doc
Architecture: all
Description: Documentation for the spandsp signal processing library
This package contains the online API in HTML for the libspandsp, a low
level signal processing library that modulate and demodulate siignals
commonly used in telephony, such as the "noise" generated by a fax
modem or DTMF touchpad.

View File

@ -1,25 +0,0 @@
This package was debianized by Simon Richter <sjr@debian.org> on
Sun, 2 Jan 2005 15:22:58 +0100.
It was downloaded from http://soft-switch.org/downloads/spandsp/
Copyright: Steve Underwood <steveu@coppice.org>
License:
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 dated June, 1991.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this package; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.

View File

@ -1,4 +0,0 @@
debian/tmp/usr/include
debian/tmp/usr/lib/libspandsp.so
debian/tmp/usr/lib/libspandsp.la
debian/tmp/usr/lib/libspandsp.a

View File

@ -1 +0,0 @@
doc/api/html usr/share/doc/libspandsp-doc/api/

View File

@ -1,2 +0,0 @@
debian/tmp/usr/lib*/libspandsp.so.2.*
debian/tmp/usr/lib*/libspandsp.so.2

View File

@ -1,106 +0,0 @@
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEBVERSION:=$(shell head -n 1 debian/changelog \
| sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
ORIGTARVER:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//')# -e 's/.dfsg$$//' -e 's/~//')
UPVERSION:=$(shell echo $(ORIGTARVER) | tr -d '~')
FILENAME := spandsp_$(ORIGTARVER).orig.tar.gz
FULLNAME := spandsp-$(UPVERSION)
URL := http://soft-switch.org/downloads/spandsp/spandsp-$(UPVERSION).tgz
CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
include /usr/share/dpatch/dpatch.make
autotools: patch-stamp
ln -s /usr/share/misc/config.sub config.sub
ln -s /usr/share/misc/config.guess config.guess
touch autotools
config.status: autotools configure
dh_testdir
CFLAGS="$(CFLAGS)" ./configure \
--host=$(DEB_HOST_GNU_TYPE) \
--build=$(DEB_BUILD_GNU_TYPE) \
--prefix=/usr \
--mandir=\$${prefix}/share/man \
--infodir=\$${prefix}/share/info \
--enable-doc
build: build-stamp
build-stamp: config.status
dh_testdir
$(MAKE)
touch build-stamp
clean: clean-patched unpatch
clean-patched:
dh_testdir
dh_testroot
rm -f build-stamp autotools
-$(MAKE) distclean
-$(RM) -f config.sub
-$(RM) -f config.guess
dh_clean
install: build-stamp
dh_testdir
dh_testroot
dh_clean -k
$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
binary-indep: build-stamp install
dh_testdir -i
dh_testroot -i
dh_installchangelogs -i ChangeLog
dh_installdocs -i DueDiligence
dh_install -i
dh_compress -i
dh_fixperms -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
binary-arch: build-stamp install
dh_testdir -a
dh_testroot -a
dh_installchangelogs -a ChangeLog
dh_installdocs -a DueDiligence
dh_install -a
dh_strip -a
dh_compress -a
dh_fixperms -a
dh_makeshlibs -a
dh_installdeb -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a
get-orig-source:
-@@dh_testdir
@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
@@echo Downloading $(FILENAME) from $(URL) ...
@@wget -N -nv -T10 -t3 -O ../tarballs/$(FILENAME) $(URL)
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install patch unpatch

View File

@ -1,7 +0,0 @@
# See uscan(1) for format
# Compulsory line, this is a version 3 file
version=3
# <Webpage URL> <string match>
http://soft-switch.org/downloads/spandsp/ spandsp-(.*)\.tgz debian svn-upgrade

View File

@ -1,38 +0,0 @@
##
## SpanDSP - a series of DSP components for telephony
##
## Makefile.am - Process this file with automake to produce Makefile.in
##
## 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.
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = css.css \
doxygen.in \
t38-gateway.dia \
t38-terminal.dia \
t38_manual.xml \
wrapper.xsl \
t38_manual/css.css
all: doxydocs t38_manual/index.html
doxydocs:
doxygen doxygen
t38_manual/index.html: t38_manual.xml
cd t38_manual ; xsltproc ../wrapper.xsl ../t38_manual.xml
clean:
cd t38_manual ; rm *.html ; cd ../api ; rm -rf html

View File

@ -1,564 +0,0 @@
body {
background-image: url("../images/weave.jpg");
font-family: Verdana, Arial, Helvetica, Sans-serif;
color: black;
margin-right: 20px;
margin-left: 20px;
}
h1 {
text-align: center;
}
h2 {
font-family: Verdana, Arial, Helvetica, Sans-serif;
border-color: #c00000;
color : black;
margin-top: 0.8em;
border-style: solid;
border-width: 0px 0px 3px 0.5em;
line-height : 130%;
}
h3 {
font-family: Verdana, Arial, Helvetica, Sans-serif;
border-color: #f02020;
color : black;
border-width: 0px 0px 2px 0.5em;
border-style: solid;
margin-right: 20%;
line-height : 130%;
}
caption {
font-weight: bold
}
a.qindex {}
a.qindexRef {}
a.el {
text-decoration: none;
font-weight: bold
}
a.elRef {
font-weight: bold
}
a.code {
text-decoration: none;
font-weight: normal;
color: #4444ee
}
a.codeRef {
font-weight: normal;
color: #4444ee
}
a:hover {
text-decoration: none;
background-color: #f2f2ff
}
dl.el {
margin-left: -1cm
}
div.fragment {
width: 100%;
border: none;
background-color: #eeeeee
}
div.ah {
background-color: black;
font-weight: bold;
color: #ffffff;
margin-bottom: 3px;
margin-top: 3px
}
td {
font-family: Verdana, Arial, Helvetica, Sans-serif;
font-weight: bold;
}
.navheader {
font-family: Verdana, Arial, Helvetica, Sans-serif;
background-color: #B2B2ff;
font-weight: bold;
}
.navfooter {
font-family: Verdana, Arial, Helvetica, Sans-serif;
background-color: #B2B2ff;
font-weight: bold;
}
table.menu {
background-color: #000066;
font-weight: bold;
text-align: center;
width: 100%;
}
tr.menu {
background-color: #ccffff;
font-weight: bold;
text-align: center;
}
td.menu {
background-color: #f2e0d0;
font-weight: bold;
text-align: center;
}
td.md {
background-color: #f2f2ff;
font-weight: bold;
}
td.mdname1 {
background-color: #f2f2ff;
font-weight: bold;
color: #602020;
}
td.mdname {
background-color: #f2f2ff;
font-weight: bold;
color: #602020;
width: 600px;
}
div.groupHeader {
margin-left: 16px;
margin-top: 12px;
margin-bottom: 6px;
font-weight: bold
}
div.groupText {
margin-left: 16px;
font-style: italic;
font-size: smaller
}
td.indexkey {
font-family: Verdana, Arial, Helvetica, Sans-serif;
background-color: #eeeeff;
font-weight: bold;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px
}
td.indexvalue {
font-family: Verdana, Arial, Helvetica, Sans-serif;
background-color: #eeeeff;
font-style: italic;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px
}
span.keyword {
color: #008000
}
span.keywordtype {
color: #604020
}
span.keywordflow {
color: #e08000
}
span.comment {
color: #800000
}
span.preprocessor {
color: #806020
}
span.stringliteral {
color: #002080
}
span.charliteral {
color: #008080
}
em {
color: #990000;
background-color: transparent;
}
h1,h2,h3,h4,h5,h6,p,center,td,th,ul,dl,div {
font-family: Geneva, Arial, Helvetica, sans-serif;
}
body,td {
font-size: 90%;
}
h1 {
text-align: center;
font-size: 160%;
}
h2 {
font-size: 120%;
}
h3 {
font-size: 100%;
}
caption {
font-weight: bold
}
div.qindex {
width: 100%;
background-color: #eeeeff;
border: 1px solid #b0b0b0;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 140%;
}
div.nav {
width: 100%;
background-color: #eeeeff;
border: 1px solid #b0b0b0;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 140%;
}
div.navtab {
background-color: #eeeeff;
border: 1px solid #b0b0b0;
text-align: center;
margin: 2px;
margin-right: 15px;
padding: 2px;
}
td.navtab {
font-size: 70%;
}
a.qindex {
text-decoration: none;
font-weight: bold;
color: #1a419d;
}
a.qindex:visited {
text-decoration: none;
font-weight: bold;
color: #1a419d
}
a.qindex:hover {
text-decoration: none;
background-color: #ddddff;
}
a.qindexHL {
text-decoration: none;
font-weight: bold;
background-color: #6666cc;
color: #ffffff;
border: 1px double #9295C2;
}
a.qindexHL:hover {
text-decoration: none;
background-color: #6666cc;
color: #ffffff;
}
a.qindexHL:visited {
text-decoration: none;
background-color: #6666cc;
color: #ffffff
}
a.el {
text-decoration: none;
font-weight: bold
}
a.elRef {
font-weight: bold
}
a.code:link {
text-decoration: none;
font-weight: normal;
color: #0000FF
}
a.code:visited {
text-decoration: none;
font-weight: normal;
color: #0000FF
}
a.codeRef:link {
font-weight: normal;
color: #0000FF
}
a.codeRef:visited {
font-weight: normal;
color: #0000FF
}
a:hover {
text-decoration: none;
background-color: #f2f2ff
}
dl.el {
margin-left: -1cm
}
.fragment {
font-family: Fixed, monospace;
font-size: 95%;
}
pre.fragment {
border: 1px solid #CCCCCC;
background-color: #f5f5f5;
margin-top: 4px;
margin-bottom: 4px;
margin-left: 2px;
margin-right: 8px;
padding-left: 6px;
padding-right: 6px;
padding-top: 4px;
padding-bottom: 4px;
}
div.ah {
background-color: black;
font-weight: bold;
color: #ffffff;
margin-bottom: 3px;
margin-top: 3px
}
td.md {
background-color: #F4F4FB;
font-weight: bold;
}
td.mdPrefix {
background-color: #F4F4FB;
color: #606060;
font-size: 80%;
}
td.mdname1 {
background-color: #F4F4FB;
font-weight: bold;
color: #602020;
}
td.mdname {
background-color: #F4F4FB;
font-weight: bold;
color: #602020;
width: 600px;
}
div.groupHeader {
margin-left: 16px;
margin-top: 12px;
margin-bottom: 6px;
font-weight: bold;
}
div.groupText {
margin-left: 16px;
font-style: italic;
font-size: 90%
}
td.indexkey {
background-color: #eeeeff;
font-weight: bold;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px;
border: 1px solid #CCCCCC;
}
td.indexvalue {
background-color: #eeeeff;
font-style: italic;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px;
border: 1px solid #CCCCCC;
}
tr.memlist {
background-color: #f0f0f0;
}
p.formulaDsp {
text-align: center;
}
img.formulaDsp {
}
img.formulaInl {
vertical-align: middle;
}
span.keyword {
color: #008000
}
span.keywordtype {
color: #604020
}
span.keywordflow {
color: #e08000
}
span.comment {
color: #800000
}
span.preprocessor {
color: #806020
}
span.stringliteral {
color: #002080
}
span.charliteral {
color: #008080
}
.mdTable {
border: 1px solid #868686;
background-color: #F4F4FB;
}
.mdRow {
padding: 8px 10px;
}
.mdescLeft {
padding: 0px 8px 4px 8px;
font-size: 80%;
font-style: italic;
background-color: #FAFAFA;
border-top: 1px none #E0E0E0;
border-right: 1px none #E0E0E0;
border-bottom: 1px none #E0E0E0;
border-left: 1px none #E0E0E0;
margin: 0px;
}
.mdescRight {
padding: 0px 8px 4px 8px;
font-size: 80%;
font-style: italic;
background-color: #FAFAFA;
border-top: 1px none #E0E0E0;
border-right: 1px none #E0E0E0;
border-bottom: 1px none #E0E0E0;
border-left: 1px none #E0E0E0;
margin: 0px;
}
.memItemLeft {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memItemRight {
padding: 1px 8px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplItemLeft {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplItemRight {
padding: 1px 8px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplParams {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
color: #606060;
background-color: #FAFAFA;
font-size: 80%;
}
.search {
color: #003399;
font-weight: bold;
}
form.search {
margin-bottom: 0px;
margin-top: 0px;
}
input.search {
font-size: 75%;
color: #000080;
font-weight: normal;
background-color: #eeeeff;
}
td.tiny {
font-size: 75%;
}
a {
color: #252e78;
}
a:visited {
color: #3d2185;
}
.dirtab {
padding: 4px;
border-collapse: collapse;
border: 1px solid #b0b0b0;
}
th.dirtab {
background: #eeeeff;
font-weight: bold;
}
hr {
height: 1px;
border: none;
border-top: 1px solid black;
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -1,290 +0,0 @@
<?xml version="1.0" encoding="iso8859-1"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
<book>
<bookinfo>
<date>2007-11-14</date>
<title>T.38 protocol (FoIP) support</title>
<subtitle>User manual</subtitle>
<releaseinfo>documentation in progress</releaseinfo>
<authorgroup>
<author>
<firstname>Steve</firstname>
<surname>Underwood</surname>
</author>
</authorgroup>
<address>
<email>steveu@coppice.org</email>
</address>
<copyright>
<year>2007</year>
<holder>Steve Underwood</holder>
</copyright>
<legalnotice>
<para>
This document can be freely redistributed according to the
terms of the GNU General Public License.
</para>
</legalnotice>
</bookinfo>
<toc></toc>
<chapter id="what-is-t38">
<title>The T.38 real-time FAX over IP (FoIP) protocol</title>
<para>There are two ITU recommendations which address sending FAXes over IP networks. T.37 specifies a method of encapsulating FAX images in e-mails, and transporting them to the recipient (an e-mail box, or another FAX machine) in a store-and-forward manner. T.38 specifies a protocol for transmitting a FAX across an IP network in real time. This document discusses the implementation of the T.38, real time, FAX over IP (FoIP) protocol.</para>
<para>FAXing between two PSTN FAX machines provides the illusion of real-time communication, with confirmed delivery. This is, of course, no more than an illusion. The sender has no idea what is receiving the FAX. It might be a FAX mailbox, where the FAX might only be retrieved much later, or might never be retrieved at all. It might be a FAX machine which is out of paper, and is storing the FAX in memory. If nobody adds paper before the FAX machine is switched off, the FAX might never be printed. With increasing amounts of FAX spam, many people don't ever bother to collect FAXes from the FAX machine in their office. Still, with all these reasons why the real-time confirmed delivery nature of FAXing is an illusion, large numbers of people still insist on using direct FAXing.</para>
<para>The FAX protocols - in particular T.30 - were designed for the PSTN. The PSTN is very different from a packet network like the Internet. It offers very strict timing; latency is rock steady throughout a call; and latency is seldom very high. The lack of these features in packet networks tends to spoil the quality of voice over IP, compared to voice over the PSTN. However, it can totally destroy modem data, like that used for FAX. Jitter and packet loss can cause modem reception to fail, and excessive delays can cause timers designed for a low latency environment to expire. T.38 tries to mitigate these factors, and can greatly improve the reliability of FAXing across the internet. It can also send FAXes using less bandwidth than using VoIP protocols. There are limits to what can be achieved on a congested network, though, and T.38 can never offer the reliability of a store and forward protocol, like T.37. Sadly, the average office worker's love affair with real-time FAX ensures a bright future for the T.38 protocol, even though the T.37 protocol makes far more sense.</para>
<para>The T.38 protocol primarily operates between:
<itemizedlist>
<listitem><para>Internet-aware FAX terminals, which connect directly to an IP network.</para></listitem>
<listitem><para>FAX gateways, which allow traditional PSTN FAX terminals to communicate via the Internet.</para></listitem>
<listitem><para>A combination of these.</para></listitem>
</itemizedlist>
T.38 is the only standardised protocol which exists for real-time FoIP. Reliably transporting a FAX between PSTN FAX terminals, through an IP network, requires use of the T.38 protocol at FAX gateways. VoIP connections are not robust for modem use, including FAX modem use. Most use low bit rate codecs, which cannot convey the modem signals accurately. Even when high bit rate codecs, such as G.711, are used, VoIP connections suffer dropouts and timing adjustments, which modems cannot tolerate. In a LAN environment the dropout rate may be very low, but the timing adjustments which occur in VoIP connections still make modem operation unreliable. T.38 FAX gateways deal with the delays, timing jitter, and packet loss experienced in packet networks, and isolate the PSTN FAX terminals from these as far as possible. In addition, by sending FAXes as image data, rather than digitised audio, the required bandwidth of the IP network might be reduced. However, the redundant transmission needed to make T.38 work acceptably over an unreliable network tends to offset much of the potential bandwidth gain.</para>
<para>The original T.38 specification provides for operation up to 14,400bps, using a V.17 modem. The latest version of the T.38 specification adds features for FAXing at up to 33,600bps, using a V.34 modem. However, it appears most current T.38 implementations only support operation up to 14,400bps.</para>
</chapter>
<chapter id="the-basics-of-a-t38-entity">
<title>The basics of a T.38 entity</title>
<para>The T.38 protocol may be used to build an Internet-aware FAX terminal, for direct connection to the Internet. It may also be used to build gateways. A T.38 FAX gateway might be a gateway between the PSTN and the Internet. It might just be an a ATA box acting as a gateway between a directly connected traditional FAX machine and the Internet. The T.38 protocol merely defines what passes between two T.38 entities. Creating a robust entity, able to tolerate the widest possible variation in network delays, jitter and packet loss, requires considerably more than just implementing what is contained in the T.38 spec. Also, the protocol definition is somewhat loose, resulting is considerable variability in the way the protocol is implemented. Considerable flexibility is required in a T.38 entity's design, to tolerate these variations.</para>
<para>T.38 currently works over one of the following transports:
<itemizedlist>
<listitem><para>TCP, with TPKT message framing - the use of TPKT was originally specified in a vague way, and implementations without TPKT framing apparently exist.</para></listitem>
<listitem><para>UDPTL - A UDP based protocol used nowhere else. This is the most common transport for T.38.</para></listitem>
<listitem><para>RTP - Added quite late to the T.38 specification, and still not widely supported.</para></listitem>
</itemizedlist>
TCP is the ideal way to communicate between two entities on an IP network, which do not have real-time constraints. The entities can talk as fast as they and the medium between them permit, with full error control. Internet-aware FAX devices would, therefore, usually use TCP as the transport for T.38. Gateways have only limited control of the timing of the FAX data passing through them. They have to operate in real-time, at a rate outside their control. Gateways, therefore, usually use UDPTL. The RTP option was only added to the T.38 specification in 2004, and is not yet widely supported. Over time it may become the preferred replacement for UDPTL, since most entities handle more than just FAX, and need to implement RTP anyway.</para>
<para>A TCP stream is fully corrected by the TCP protocol itself. However, in the UDPTL or RTP modes of operation, T.38 is subject to possible packet loss. A high level of missing data would defeat the protocol, so some measure of FEC (forward error correction) must be used. The UDPTL specification defines two optional forms of FEC. Both consist of adding information from previous packets to new packets. In one form this repeated data is send as a direct copy of the original. In the other it is sent as parity information, which requires encoding and decoding. The specifications for RTP include definitions of suitable FEC and redundancy protocols (RFC2198 and RFC2733). The T.38 specification says these should be used for T.38 over RTP.</para>
<para>Interestingly, even the latest revision of the T.38 specification does not provide properly for security in FAX transmission. SRTP is a standard way to achieve secure multi-media communication, and can be applied to T.38 over RTP without any specific wording on the subject in the T.38 specification. UDPTL might be seen as obsolete in the long term, and not worthy of enhancements to encrypt the data. However, no secure option for T.38 over TCP is defined. TPKT could be sent over TLS/TCP. TLS also has message framing features which would allow IFP packets to be sent directly over a TLS protected connection. However, there is no specified way to do this.</para>
<para>Although redundant information in future packets is an important part of a solid T.38 implementation, it is not a complete solution to problem of lost packets. Sometimes the next packet occurs after a considerable delay (e.g. when allowing time for a fast modem to train). If a "start training" message is only received through the redundant information in a following packet, it usually arrives too late to be useful (at least for a gateway). Most T.38 implementations now follow a practice of sending several exact copies of key packets - generally the ones which start or end the stages of the T.30 protocol. Typically up to 4 identical copies of these packets are sent down the wire. The may be sent in a burst, as fast as possible, or they may be spaced in time by 10ms or 20ms. IP network congestion, and the resulting packet loss, can be very bursty. If all copies are sent together, they might all be lost. Even a small amount of spreading in time may significantly increase the likelihood of at least one copy reaching its destination. The price is some delay in delivery of the message, which might be problematic. Multiple copies of these packets add little to the overall volume of data transmitted, as only a small percentage of packets fall in this "key packet" category. Some T.38 implementations follow a less effective practice of sending multiple key packets, which have separate sequence numbers and are separately bundled with redundant information for transmission. They may also be spaced in time. Although this seems a less effective strategy, a T.38 entity must expect to receive packets streams of this kind, and tolerate them.</para>
<para>Between the high priority key packets, and the low priority packets for the image data (the loss of which might just cause a streak on an image, or be corrected by ECM FAXing), lies the V.21 HDLC control messages. Some T.38 implementations dynamically adjust the amount of redundant information in packets, so these control messages are repeated through several packets, but the large image data packets are repeated less, or not at all. Used with care, this dynamic redundancy strategy can nicely balance data volume and reliability.</para>
<para>A T.38 terminal has a lot more flexibility in how it can deal with problem data than a T.38 gateway. The terminal has no tight timing constraints governing how it behaves with regard to received data. It can wait a considerable period for delayed packets to arrive. The gateway is a man-in-the-middle, and must live with the timing constraints that imposes. This means a T.38 gateway has a rather more difficult design than a terminal.</para>
</chapter>
<chapter id="the-core-elements-of-a-t38-implementation">
<title>The core elements of a T.38 implementation</title>
<para>There are many differences between the behaviour of a T.38 terminal and a T.38 gateway. However, some functions are common to both types of T.38 entity, particular in the IP network interface.</para>
<sect1>
<title>The T.38 Internet Fascimile Protocol (IFP) packetiser</title>
<para>The T.38 specification defines an ASN.1 schema for the messages which pass between T.38 entities. These messages are called IFP (Internet Fascimile Protocol) messages. Their format is independent of the transport used to carry them. However, there are currently two slightly different versions of the ASN.1 schema. This is due to a typo in the original version of the T.38 specification. The protocol negotiation which occurs just before T.38 communication resolves which version will be used. Although the typo was corrected several years ago, it is still very more common to find implementations which only support the original buggy version.</para>
</sect1>
<sect1>
<title>The UDPTL, RTP, TPKT packetiser</title>
<para>A second level packetiser bundles the IFP packets for transmission. This functions in different ways, depending on the type of transport in use. For the unreliable transports (UDPTL and RTP) the packetiser adds forward error correction (FEC) information to the packets. This can greatly inprove the reliability of the T.38 protocol, at the expense of higher bandwidth. The amount of error correction information added to the packets is implementation dependant.</para>
<para>For UDPTL, two forms of FEC are defined. One simply repeats older T.38 packets as FEC information in the current UDPTL packet. The other generates parity packets over a series of T.38 packets, and includes that parity information in the current UDPTL packet. The type of FEC to be used is negotiated just before T.38 communication begins.</para>
<para>The RTP specifications (RFC3550, RFC3551, RFC2198, RFC2733) define common redundancy and FEC formats, to be used for any payload. Where T.38 packets are carried by RTP, the standard RTP FEC mechanisms are used.</para>
<para>TPKT (RFC1006, RFC2126) encapsulation works over a TCP transport. TCP provides full error correction, though retries may slow it considerably. TPKT encapsulation merely provides the ability to delineate the start and end of the IFP packets in the structureless TCP stream.</para>
</sect1>
</chapter>
<chapter id="the-elements-of-a-t38-terminal">
<title>The elements of a T.38 terminal</title>
<graphic fileref="t38-terminal.png"/>
</chapter>
<chapter id="the-elements-of-a-t38-gateway">
<title>The elements of a T.38 gateway</title>
<graphic fileref="t38-gateway.png"/>
<sect1>
<title>The HDLC decoder</title>
<para>If the HDLC decoder in a T.38 gateway worked in whole frames, it would introduce unacceptable latency. Instead, the HDLC decoder must work progressively through the HDLC frames, outputing its results octet by octet. The T.38 message stream does not contain HDLC preamble, though it usually contains an indication that preamble is in progress. It does not contain the CRC octets, but simply an indication of whether the CRC is good or bad. The HDLC decoder provides an indication when preamble is being received, and checks the CRC octets at the end of frames to provide the good or bad indication. The decoder makes the frames available, octet by octet, to the T.38 engine for status tracking and possible modification. Tracking and modification imposes a few octets delay, but the goal is to keep this to the minimum possible. Whether the frames are modified or unmodified, good or bad they are always passed on, to maintain the appropriate timing flow for the T.30 protocol.</para>
<para>An interesting aspect of the timing flow of V.21 HDLC messages on the T.38 path relates to the size of the CRC. The usual practice for sending these frames is to send one octet in each message, with the messages spaced by the duration of one octet. They will normally be sent with the minimum possible delay. The CRC at the end of each frame is two octets long, and only an indication of good or bad is sent in the T.38 messages. It takes two octet times to know if the CRC is OK or not, typically causing the flow of T.38 messages to stutter by the duration of an octet. Since flow control within a frame is not possible when frames are replayed by a remote T.38 gateway, that gateway must allow for this inevitable stutter as it prepares to begin playout of the frame.</para>
</sect1>
<sect1>
<title>T.30 message analysis and manipulation</title>
<para>The T.30 message analyser in a T.38 gateway performs the following functions:
<itemizedlist>
<listitem><para>It passes NSS, NSF and NSC frames, but modifies their contents. A receiving FAX machine must be prevented from acting upon these messages in a manufacturer specific manner. The T.38 protocol is incapable of handling such manufacturer specific things. However, simply dropping these packets would upset the timing of the T.30 protocol. Instead, most T.38 implementations modify the country and manufacturer codes nesr the start of these messages, so the messages will be ignored by any receiver. They are typically set to 0x00, 0x55, 0xAA or 0xFF. Some implementations set them to the country and manufacturer code of the T.38 implementor. As long as they are set to something the receiver will not recognise, problems are avoided. To avoid removing useful information, the original country and manufacturer code bytes might be reinserted in a different part of the modified NSF message, provided space permits.</para></listitem>
<listitem><para>It tracks the contents of the DCS messages. During flow control of non-ECM data, the minimum row length must be preserved, so the current minimum must be found from the DCS messages. Similarly, the current encoding must be known to apply non-ECM flow control correctly. ECM data must be flow controlled in a completely different way than non-ECM data, so ECM mode information must be found from the DCS messages.</para></listitem>
<listitem><para>It may optionally modify the minimum row length in the DIS messages. Because flow control will be applied to non-ECM data, it can make sense to tell the sending FAX machine it has no need to impose a minimum row length, and let the emitting T.38 entity impose the minimum as part of its flow control operation.</para></listitem>
<listitem><para>It passes on the stripped and modified HDLC frames, with the minimum possible delay. This implies that is must analyse and modify the messages octet by octet.</para></listitem>
</itemizedlist>
</para>
</sect1>
<sect1>
<title>The HDLC rate adapting encoder</title>
<para>The HDLC data rate adapting encoder accepts a T.30 message stream as input. The V.21 HDLC messages generally arriving byte by byte, in separate T.38 messages. ECM HDLC messages usually arrive in larger chunks, but they are still generally fragmented. The rate adapter dynamically buffers the T.30 data, generates preamble, and adjusts its length if the incoming message data is falling behind. It may insert additional flag octets between frames, as a flow control mechanism. However, the HDLC protocol is synchronous, so the adapter cannot perform any flow control within a frame. It must, therefore, buffer enough octets of a frame to provide reasonable jitter tolerance, before it emits the first octet of that frame. If the arriving messages fall too far behind mid-frame, there will be corruption of the outgoing stream. In the case of ECM image data frames, the frames are fast enough, that buffering whole frames is quite proactical within the T.30 timing constraints. This ensures mid-frame underflow can never occur.</para>
</sect1>
<sect1>
<title>TCF (training confirmation) and non-ECM image data rate adaption</title>
<para>Non-ECM image data rate adaption deals with exchanging TCF data, and non-ECM image data using T.4 1-D or 2-D compression. Non-ECM image data is typically padded with zero bits at the end of each pixel row. This is used to avoid rows arriving at the receiving FAX machine faster than the mechanical paper handling can process them. It is also used by sending FAX machines for flow control, when their paper handling falls behind. The minimum duration of a row is negotiated between the FAX machines, before image transfer commences.</para>
<para>TCF data is a continuous stream of zero bits. It may, optionally, be preceeded by a continuous block of one bits. So, when transferring TCF data between the T.38 entities, flow control is simply a matter of repeating the last received bit when the late arrival of TCF data packets causes underflow at an emitting gateway.</para>
<para>T.38 entities may negotiate to generate and check TCF data locally, and not exchange it. Generally, this is only used when TCP/TPKT is used as the transport for the T.38 messages. A TCF checker and a TCF generator are needed by a T.38 gateway supporting this option.</para>
<para>Some T.38 entities are capable of negotiating the removal of end of row padding bits in the data passing between the T.38 entities. This may reduce the amount of data significantly, for some types of image. If negotiated, most or all surplus zero bits are stripped from the image bit stream, at the sending T.38 entity. If a T.38 gateway is receiving such stripped data, it may need to reimpose a minimum row time, by inserting zeros, as part of its non-ECM rate adaption process. By checking the contents of the DCS messages, it can determine what this minimum should be.</para>
<para>Only two types of image compression are used for non-ECM transmission - T.4 1-D and 2-D. The end of line (EOL) marker for both these is 11 zero bits, followed by a one bit. In 2-D mode, an additional one or zero bit follows, which defines the mode of the next row. It turns out that the maximum number of valid consecutive zeros which could preceed the 11 zeros of an EOL is 3. In a valid image there are no longer runs of zeros than at an EOL, and the maximum there is 14. Therefore, if the padding stripper reduces all runs of zeros longer than 14 to just 14, it will strip most of the padding with very simple logic. Simple logic is a good thing in this case. It not only avoids the need to fully analyse the image data, it also minimises problems when there are bit errors in the image data stream.</para>
<para>For image data sent without error correction (T.4 1-D or 2-D) there may be underflow at the outgoing gateway, if image data packets arrive too late. To deal with slow mechanical paper handling in FAX machines, the T.30 specification includes an end of pixel row padding scheme for non-error corrected image data. The receiving machine may request a minimum row duration. The sending machine is required to impose that minimum, but can arbitrarily make it much longer to meet its own paper handling needs, sending padding bits as appropriate. This mechanism provides a robust basis for flow control in a T.38 gateway. If the outgoing gateway only starts sending a pixel row when it has the entire row in its buffer, it can safely idle, sending padding bits, at any row end it needs to. Only the 6 EOL markers, which terminate an image, must be protected from this kind of flow control. Those markers are defined as being consecutive, with no zero bit padding separating them.</para>
<para>When ECM is used (usually with T.6 image data) the image is packetised in HDLC frames. In this case rate adaption is handled in a similar manner to the V.21 HDLC packets.</para>
</sect1>
</chapter>
<chapter id="testing-an-implementation-of-t38">
<title>Testing an implementation of T.38</title>
<para>The T.38 specification does not define any specific compliance tests which an implementation must pass. It is not supplied with any test vectors. Commetrex is a supplier of T.38 implementations, who have taken it upon themselves to define a set of tests, and create a lab for T.38 interoperability testing. This seems the closest thing to an industry standard for T.38 testing which exists at this time, and is much to their credit.</para>
<para>Commetrex have defined 16 tests which an implementation T.38 undergoes in their lab. These are described on the Commetrex web site as:
<table frame="all">
<title>Commetrex T.38 tests</title>
<tgroup cols="3" align="center" colsep="1" rowsep="1">
<colspec colname="Test #" />
<colspec colname="Direction" />
<colspec colname="Transport" />
<colspec colname="Image file" />
<colspec colname="Error correction" />
<colspec colname="Data rate mgt" />
<colspec colname="Image encoding" />
<colspec colname="Polling" />
<thead>
<row>
<entry align="centre">Test #</entry>
<entry align="centre">Direction</entry>
<entry align="centre">Transport</entry>
<entry align="centre">Image file</entry>
<entry align="centre">Error correction</entry>
<entry align="centre">Data rate mgt</entry>
<entry align="centre">Image encoding</entry>
<entry align="centre">Polling</entry>
</row>
</thead>
<tbody>
<row>
<entry>1</entry><entry>originate</entry><entry>UDP</entry><entry>ccitt2p.tif</entry><entry>redundancy 0</entry><entry>method 2</entry><entry>MR</entry><entry>no</entry>
</row>
<row>
<entry>2</entry><entry>originate</entry><entry>UDP</entry><entry>100page.tif</entry><entry>redundancy 0</entry><entry>method 2</entry><entry>MR</entry><entry>no</entry>
</row>
<row>
<entry>3</entry><entry>originate</entry><entry>TCP</entry><entry>ccitt2p.tif</entry><entry>redundancy 0</entry><entry>method 1</entry><entry>MR</entry><entry>no</entry>
</row>
<row>
<entry>4</entry><entry>originate</entry><entry>UDP</entry><entry>ccitt2p.tif</entry><entry>redundancy 3</entry><entry>method 2</entry><entry>MR</entry><entry>no</entry>
</row>
<row>
<entry>5</entry><entry>originate</entry><entry>TCP</entry><entry>ccitt2p.tif</entry><entry>FEC 2 from 3 span</entry><entry>method 2</entry><entry>MR</entry><entry>no</entry>
</row>
<row>
<entry>6</entry><entry>originate</entry><entry>UDP</entry><entry>dither1d.tif</entry><entry>redundancy 3</entry><entry>method 2</entry><entry>MR</entry><entry>no</entry>
</row>
<row>
<entry>7</entry><entry>originate</entry><entry>UDP</entry><entry>ccitt2p.tif</entry><entry>redundancy 3</entry><entry>method 2</entry><entry>ECM</entry><entry>no</entry>
</row>
<row>
<entry>8</entry><entry>originate &amp; poll to rx</entry><entry>UDP</entry><entry>ccitt2p.tif</entry><entry>redundancy 3</entry><entry>method 2</entry><entry>MR</entry><entry>polled rx</entry>
</row>
<row>
<entry>9</entry><entry>answer</entry><entry>UDP</entry><entry>ccitt2p.tif</entry><entry>redundancy 0</entry><entry>method 2</entry><entry>MR</entry><entry>no</entry>
</row>
<row>
<entry>10</entry><entry>answer</entry><entry>UDP</entry><entry>100page.tif</entry><entry>redundancy 0</entry><entry>method 2</entry><entry>MR</entry><entry>no</entry>
</row>
<row>
<entry>11</entry><entry>answer</entry><entry>TCP</entry><entry>ccitt2p.tif</entry><entry>redundancy 0</entry><entry>method 1</entry><entry>MR</entry><entry>no</entry>
</row>
<row>
<entry>12</entry><entry>answer</entry><entry>UDP</entry><entry>ccitt2p.tif</entry><entry>redundancy 3</entry><entry>method 2</entry><entry>MR</entry><entry>no</entry>
</row>
<row>
<entry>13</entry><entry>answer</entry><entry>TCP</entry><entry>ccitt2p.tif</entry><entry>FEC 2 from 3 span</entry><entry>method 2</entry><entry>MR</entry><entry>no</entry>
</row>
<row>
<entry>14</entry><entry>answer</entry><entry>UDP</entry><entry>dither1d.tif</entry><entry>redundancy 3</entry><entry>method 2</entry><entry>MR</entry><entry>no</entry>
</row>
<row>
<entry>15</entry><entry>answer</entry><entry>UDP</entry><entry>ccitt2p.tif</entry><entry>redundancy 3</entry><entry>method 2</entry><entry>ECM</entry><entry>no</entry>
</row>
<row>
<entry>16</entry><entry>answer &amp; polled to tx</entry><entry>UDP</entry><entry>ccitt2p.tif</entry><entry>redundancy 3</entry><entry>method 2</entry><entry>MR</entry><entry>polled tx</entry>
</row>
</tbody>
</tgroup>
</table>
The file dither1d.tif is a whole page of dense checkerboard pattern, which does not compress, and produces a kind of torture test page. It is about 2M bytes. 100page.tif is exactly what it says - a file with 100 pages of FAX images. The content of the pages does not seem to be specified by Commetrex. The ITU T.30 test images, repeated sufficiently, seems a good basis for this test. ccitt2p.tif appears to be page 2 of the ITU test images. The tests are heavily biased towards non-ECM operation with MR coding. No other coding appears to be used, and only 2 tests use error corrected (ECM) FAXing.
</para>
<para>Some of the Commetrex tests seem strange. Why is TCP transmission tested with FEC or redundancy? These things are only needed to overcome to lack of reliability in a UDP path.</para>
</chapter>
<chapter id="living-with-real-world-t38-entities">
<title>Living with real world T.38 entities.</title>
<para> The T.38 specification leaves a number of grey areas, and many things can be implemented in several ways. It might, therefore, be expected that interoperability will not always run smoothly. Whilst some design decisions are reasonable subjects for discussion, it is quite common to find T.38 implementations doing things which are simply wrong.</para>
<sect1>
<title>Non-ECM data ending immediately after the six EOLs denoting the end of a page causes corruption</title>
<para>From the T.38 specification, a T.38 entity sending non-ECM image data should be able to end the image data, with <emphasis>t4-non-ecm-sig-end</emphasis>, at the last bit of the six consecutive EOLs which denote the end of a page. However, this offers poor compatibility with some implementations of T.38. They will drop their carrier signal prematurely, and the last few rows of the image will be corrupted at the receiver. This can happen regardless of whether the <emphasis>t4-non-ecm-sig-end</emphasis> is followed by a <emphasis>no-signal</emphasis> message, and regardless of the timing of that <emphasis>no-signal</emphasis> message. Padding with zero bytes for 40ms or more after the six EOLs seems to prevent this, and results in an image which exactly matches the one at the source.</para>
</sect1>
<sect1>
<title>Expect mixups between non-ECM and ECM image modes.</title>
<para>The TCF data should always be sent as non-ECM image data, whether the images which follow it are sent as non-ECM or ECM data. However, some broken implementations of T.38 (e.g. Mediatrix) may send an <emphasis>hdlc-sig-end</emphasis> message to terminate the TCF data. To be as tolerant as possible, it is probably wise to accept <emphasis>hdlc-sig-end</emphasis> or <emphasis>t4-non-ecm-sig-end</emphasis>, regardless of which kind of data it is really terminating.</para>
</sect1>
<sect1>
<title>Expect some very poor timing decisions in various designs.</title>
<para>The preamble for V.21 HDLC data is specified as being 1s+-15%. This should mean 850ms of preamble is within spec, and many modern FAX machines only send that much. A number of T.38 implementations choke on this. They require at least 1s between the <emphasis>v21-preamble</emphasis> message and the first HDLC data, for reliable operation. This is very poor design. Even if there is 1s between these events at the source, jitter on the network can make them arrive less than 1s apart. It appears the best a tolerant implementation can really do is impose a 1s minimum between sending these T.38 messages, and accept that things might still go wrong when there is some jitter.</para>
<para>There is similar intolerance with the timing of the start of training messages for the fast image data modems. Most implementations do not impose a minimum which is above that permitted by the T.30 specification. Some do, however, make no allowance for network jitter reducing the interval at the receiver. You should expect the far end to be using TEP, when sizing the required delay between the start of training, and the first data. Also, for ECM data, make sure the delay allows for the specified minimum 200ms of preamble.</para>
</sect1>
<sect1>
<title>Which kinds of error correction to use.</title>
<para>T.38 defines two kinds of error correction for UDPTL streams. One inserts redundant copies of older IFP packets in each UDPTL packet. The other uses a more complex parity FEC scheme, based on XOR'ed data inserted in each UDPTL packet. Although each UDPTL packet identifies the type of error correction it contains, the original T.38 spec. did not offer any form of negotiation about the type to be used. The SIP and MGCP SDP for T.38 now includes preferred error correction type information, so some measure of negotiation is possible before the flow of UDPTL packets begins.</para>
<para>It appears all T.38 implementations are happy to receive packets with redundant secondary content. However, it seems not all implementations will actually recover anything when there are missing UDPTL packets. It appears not all T.38 implementations are happy to receive packets with parity FEC data. Unless the SDP data from the far end explicitly says they support the parity FEC scheme, it is better to send only redundant information. A good implementation should be prepared to accept either kind of data, even intermixed, regardless of anything in the SDP negotiation. In the real world, whatever you ask for in your SDP data, you will probably receive secondary IFP packet redundancy from the far end. It is the only thing most implementations support, and with real world packet loss it may perform just as well as the more complex parity FEC scheme.</para>
<para>When the first few UDPTL packets are sent, there will be no historical information to send as redundant secondary IFP packets, or parity FEC data. When using the redundant secondary packet scheme this is handled transparently. Each UDPTL packet says the number of redundant secondary IFP packets it contains. This can simply be set to zero for the first UDPTL packet, one for the second, up to the amount of redundancy which has been configured. All implementations seem to work in this way. When parity FEC is being used, the startup arrangement is less clear. While some implementations simply insert zeros for the non-existant packets before the start, others send a few packets with redundant secondary IFP packets, until they are able to insert the required amount of FEC data. Dealing with intermixed types of error correction makes a receiving implementation of UDPTL messier and slower, but is necessary for compatibility.</para>
</sect1>
<sect1>
<title>What really ends the data?</title>
<para>It should be correct to send some image data, and end with the image data signal end message. However, some T.38 implementations misbehave when this is all that is sent. Immediately following the signal end message with a <emphasis>no-signal</emphasis> indicator message seems to greatly improve compatibility with some T.38 implementations.</para>
<para>T.38 defines <emphasis>hdlc-fcs-OK</emphasis>, <emphasis>hdlc-fcs-OK-sig-end</emphasis>, <emphasis>hdlc-sig-end</emphasis>, and <emphasis>no-signal</emphasis> messages. Always end periods of HDLC transmission with either a <emphasis>hdlc-fcs-OK</emphasis>, <emphasis>hdlc-sig-end</emphasis>, <emphasis>no-signal</emphasis> sequence or a <emphasis>hdlc-fcs-OK-sig-end</emphasis>, <emphasis>no-signal</emphasis> sequence. Do not send <emphasis>hdlc-sig-end</emphasis> after <emphasis>hdlc-fcs-OK-sig-end</emphasis>. A number of T.38 implementations choke on this sequence, even though it looks fairly harmless.</para>
</sect1>
<sect1>
<title>Normal use versus testing</title>
<para>The design of some T.38 implementations precludes some reasonable tests from succeeding, due to design features which may have been implemented for sane reasons. This means each test failure needs to be investigated in detail, to see if it represents something genuinely bad in an implementation of T.38. For example, the 2M byte torture test page in the Commetrex test suite will not successfully pass through some T.38 implementations, because of a timeout they impose. For example, some ATAs based on Audiocodes silicon have been seen to stop any continuous period of modem transmission after about 90s. This appears to be a backstop timeout, to prevent troublesome implementations jamming the gateway. Legitimate pages just don't take that long, and the timeout is reasonable. However, the 2M byte test page takes up to 20 minutes to transmit, and will always fail on these boxes.</para>
</sect1>
</chapter>
</book>

View File

@ -1,564 +0,0 @@
body {
background-image: url("../images/weave.jpg");
font-family: Verdana, Arial, Helvetica, Sans-serif;
color: black;
margin-right: 20px;
margin-left: 20px;
}
h1 {
text-align: center;
}
h2 {
font-family: Verdana, Arial, Helvetica, Sans-serif;
border-color: #c00000;
color : black;
margin-top: 0.8em;
border-style: solid;
border-width: 0px 0px 3px 0.5em;
line-height : 130%;
}
h3 {
font-family: Verdana, Arial, Helvetica, Sans-serif;
border-color: #f02020;
color : black;
border-width: 0px 0px 2px 0.5em;
border-style: solid;
margin-right: 20%;
line-height : 130%;
}
caption {
font-weight: bold
}
a.qindex {}
a.qindexRef {}
a.el {
text-decoration: none;
font-weight: bold
}
a.elRef {
font-weight: bold
}
a.code {
text-decoration: none;
font-weight: normal;
color: #4444ee
}
a.codeRef {
font-weight: normal;
color: #4444ee
}
a:hover {
text-decoration: none;
background-color: #f2f2ff
}
dl.el {
margin-left: -1cm
}
div.fragment {
width: 100%;
border: none;
background-color: #eeeeee
}
div.ah {
background-color: black;
font-weight: bold;
color: #ffffff;
margin-bottom: 3px;
margin-top: 3px
}
td {
font-family: Verdana, Arial, Helvetica, Sans-serif;
font-weight: bold;
}
.navheader {
font-family: Verdana, Arial, Helvetica, Sans-serif;
background-color: #B2B2ff;
font-weight: bold;
}
.navfooter {
font-family: Verdana, Arial, Helvetica, Sans-serif;
background-color: #B2B2ff;
font-weight: bold;
}
table.menu {
background-color: #000066;
font-weight: bold;
text-align: center;
width: 100%;
}
tr.menu {
background-color: #ccffff;
font-weight: bold;
text-align: center;
}
td.menu {
background-color: #f2e0d0;
font-weight: bold;
text-align: center;
}
td.md {
background-color: #f2f2ff;
font-weight: bold;
}
td.mdname1 {
background-color: #f2f2ff;
font-weight: bold;
color: #602020;
}
td.mdname {
background-color: #f2f2ff;
font-weight: bold;
color: #602020;
width: 600px;
}
div.groupHeader {
margin-left: 16px;
margin-top: 12px;
margin-bottom: 6px;
font-weight: bold
}
div.groupText {
margin-left: 16px;
font-style: italic;
font-size: smaller
}
td.indexkey {
font-family: Verdana, Arial, Helvetica, Sans-serif;
background-color: #eeeeff;
font-weight: bold;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px
}
td.indexvalue {
font-family: Verdana, Arial, Helvetica, Sans-serif;
background-color: #eeeeff;
font-style: italic;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px
}
span.keyword {
color: #008000
}
span.keywordtype {
color: #604020
}
span.keywordflow {
color: #e08000
}
span.comment {
color: #800000
}
span.preprocessor {
color: #806020
}
span.stringliteral {
color: #002080
}
span.charliteral {
color: #008080
}
em {
color: #990000;
background-color: transparent;
}
h1,h2,h3,h4,h5,h6,p,center,td,th,ul,dl,div {
font-family: Geneva, Arial, Helvetica, sans-serif;
}
body,td {
font-size: 90%;
}
h1 {
text-align: center;
font-size: 160%;
}
h2 {
font-size: 120%;
}
h3 {
font-size: 100%;
}
caption {
font-weight: bold
}
div.qindex {
width: 100%;
background-color: #eeeeff;
border: 1px solid #b0b0b0;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 140%;
}
div.nav {
width: 100%;
background-color: #eeeeff;
border: 1px solid #b0b0b0;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 140%;
}
div.navtab {
background-color: #eeeeff;
border: 1px solid #b0b0b0;
text-align: center;
margin: 2px;
margin-right: 15px;
padding: 2px;
}
td.navtab {
font-size: 70%;
}
a.qindex {
text-decoration: none;
font-weight: bold;
color: #1a419d;
}
a.qindex:visited {
text-decoration: none;
font-weight: bold;
color: #1a419d
}
a.qindex:hover {
text-decoration: none;
background-color: #ddddff;
}
a.qindexHL {
text-decoration: none;
font-weight: bold;
background-color: #6666cc;
color: #ffffff;
border: 1px double #9295C2;
}
a.qindexHL:hover {
text-decoration: none;
background-color: #6666cc;
color: #ffffff;
}
a.qindexHL:visited {
text-decoration: none;
background-color: #6666cc;
color: #ffffff
}
a.el {
text-decoration: none;
font-weight: bold
}
a.elRef {
font-weight: bold
}
a.code:link {
text-decoration: none;
font-weight: normal;
color: #0000FF
}
a.code:visited {
text-decoration: none;
font-weight: normal;
color: #0000FF
}
a.codeRef:link {
font-weight: normal;
color: #0000FF
}
a.codeRef:visited {
font-weight: normal;
color: #0000FF
}
a:hover {
text-decoration: none;
background-color: #f2f2ff
}
dl.el {
margin-left: -1cm
}
.fragment {
font-family: Fixed, monospace;
font-size: 95%;
}
pre.fragment {
border: 1px solid #CCCCCC;
background-color: #f5f5f5;
margin-top: 4px;
margin-bottom: 4px;
margin-left: 2px;
margin-right: 8px;
padding-left: 6px;
padding-right: 6px;
padding-top: 4px;
padding-bottom: 4px;
}
div.ah {
background-color: black;
font-weight: bold;
color: #ffffff;
margin-bottom: 3px;
margin-top: 3px
}
td.md {
background-color: #F4F4FB;
font-weight: bold;
}
td.mdPrefix {
background-color: #F4F4FB;
color: #606060;
font-size: 80%;
}
td.mdname1 {
background-color: #F4F4FB;
font-weight: bold;
color: #602020;
}
td.mdname {
background-color: #F4F4FB;
font-weight: bold;
color: #602020;
width: 600px;
}
div.groupHeader {
margin-left: 16px;
margin-top: 12px;
margin-bottom: 6px;
font-weight: bold;
}
div.groupText {
margin-left: 16px;
font-style: italic;
font-size: 90%
}
td.indexkey {
background-color: #eeeeff;
font-weight: bold;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px;
border: 1px solid #CCCCCC;
}
td.indexvalue {
background-color: #eeeeff;
font-style: italic;
padding-right : 10px;
padding-top : 2px;
padding-left : 10px;
padding-bottom : 2px;
margin-left : 0px;
margin-right : 0px;
margin-top : 2px;
margin-bottom : 2px;
border: 1px solid #CCCCCC;
}
tr.memlist {
background-color: #f0f0f0;
}
p.formulaDsp {
text-align: center;
}
img.formulaDsp {
}
img.formulaInl {
vertical-align: middle;
}
span.keyword {
color: #008000
}
span.keywordtype {
color: #604020
}
span.keywordflow {
color: #e08000
}
span.comment {
color: #800000
}
span.preprocessor {
color: #806020
}
span.stringliteral {
color: #002080
}
span.charliteral {
color: #008080
}
.mdTable {
border: 1px solid #868686;
background-color: #F4F4FB;
}
.mdRow {
padding: 8px 10px;
}
.mdescLeft {
padding: 0px 8px 4px 8px;
font-size: 80%;
font-style: italic;
background-color: #FAFAFA;
border-top: 1px none #E0E0E0;
border-right: 1px none #E0E0E0;
border-bottom: 1px none #E0E0E0;
border-left: 1px none #E0E0E0;
margin: 0px;
}
.mdescRight {
padding: 0px 8px 4px 8px;
font-size: 80%;
font-style: italic;
background-color: #FAFAFA;
border-top: 1px none #E0E0E0;
border-right: 1px none #E0E0E0;
border-bottom: 1px none #E0E0E0;
border-left: 1px none #E0E0E0;
margin: 0px;
}
.memItemLeft {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memItemRight {
padding: 1px 8px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplItemLeft {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplItemRight {
padding: 1px 8px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
background-color: #FAFAFA;
font-size: 80%;
}
.memTemplParams {
padding: 1px 0px 0px 8px;
margin: 4px;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-color: #E0E0E0;
border-right-color: #E0E0E0;
border-bottom-color: #E0E0E0;
border-left-color: #E0E0E0;
border-top-style: solid;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
color: #606060;
background-color: #FAFAFA;
font-size: 80%;
}
.search {
color: #003399;
font-weight: bold;
}
form.search {
margin-bottom: 0px;
margin-top: 0px;
}
input.search {
font-size: 75%;
color: #000080;
font-weight: normal;
background-color: #eeeeff;
}
td.tiny {
font-size: 75%;
}
a {
color: #252e78;
}
a:visited {
color: #3d2185;
}
.dirtab {
padding: 4px;
border-collapse: collapse;
border: 1px solid #b0b0b0;
}
th.dirtab {
background: #eeeeff;
font-weight: bold;
}
hr {
height: 1px;
border: none;
border-top: 1px solid black;
}

View File

@ -1,5 +0,0 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version='1.0'>
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>
<xsl:param name="html.stylesheet">css.css</xsl:param>
</xsl:stylesheet>

View File

@ -1,27 +0,0 @@
AC_DEFUN([AC_FUNC_MEMMOVE],
[AC_CHECK_FUNCS(memmove)
AC_MSG_CHECKING(for working memmove)
AC_CACHE_VAL(ac_cv_have_working_memmove,
[AC_TRY_RUN(
[#include <stdio.h>
int main(void)
{
char buf[10];
strcpy (buf, "01234567");
memmove (buf, buf + 2, 3);
if (strcmp (buf, "23434567"))
exit (1);
strcpy (buf, "01234567");
memmove (buf + 2, buf, 3);
if (strcmp (buf, "01012567"))
exit (1);
exit (0);
}], ac_cv_have_working_memmove=yes, ac_cv_have_working_memmove=no, ac_cv_have_working_memmove=cross)])
AC_MSG_RESULT([$ac_cv_have_working_memmove])
if test x$ac_cv_have_working_memmove != "xyes"; then
AC_LIBOBJ(memmove)
AC_MSG_WARN([Replacing missing/broken memmove.])
AC_DEFINE(PREFER_PORTABLE_MEMMOVE, 1, "enable replacement memmove if system memmove is broken or missing")
fi])

View File

@ -1,181 +0,0 @@
# @synopsis AX_C99_FLEXIBLE_ARRAY
#
# Does the compiler support the 1999 ISO C Standard "struct hack".
# @version 1.1 Mar 15 2004
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
#
# Permission to use, copy, modify, distribute, and sell this file for any
# purpose is hereby granted without fee, provided that the above copyright
# and this permission notice appear in all copies. No representations are
# made about the suitability of this software for any purpose. It is
# provided "as is" without express or implied warranty.
AC_DEFUN([AX_C99_FLEXIBLE_ARRAY],
[AC_CACHE_CHECK(if have C99 struct flexible array support,
ac_cv_c99_flexible_array,
# Initialize to unknown
ac_cv_c99_flexible_array=no
AC_TRY_LINK([[
#include <stdlib.h>
typedef struct {
int k;
char buffer [] ;
} MY_STRUCT ;
]],
[ MY_STRUCT *p = calloc (1, sizeof (MY_STRUCT) + 42); ],
ac_cv_c99_flexible_array=yes,
ac_cv_c99_flexible_array=no
))]
) # AX_C99_FLEXIBLE_ARRAY
# @synopsis AX_C99_FUNC_LRINT
#
# Check whether C99's lrint function is available.
# @version 1.3 Feb 12 2002
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
#
# Permission to use, copy, modify, distribute, and sell this file for any
# purpose is hereby granted without fee, provided that the above copyright
# and this permission notice appear in all copies. No representations are
# made about the suitability of this software for any purpose. It is
# provided "as is" without express or implied warranty.
#
AC_DEFUN([AX_C99_FUNC_LRINT],
[AC_CACHE_CHECK(for lrint,
ac_cv_c99_lrint,
[
lrint_save_LIBS=$LIBS
LIBS="-lm"
AC_TRY_LINK([
#define _ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1
#define __USE_ISOC99 1
#define __USE_ISOC9X 1
#include <math.h>
], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no)
LIBS=$lrint_save_LIBS
])
if test "$ac_cv_c99_lrint" = yes; then
AC_DEFINE(HAVE_LRINT, 1,
[Define if you have C99's lrint function.])
fi
])# AX_C99_FUNC_LRINT
# @synopsis AX_C99_FUNC_LRINTF
#
# Check whether C99's lrintf function is available.
# @version 1.3 Feb 12 2002
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
#
# Permission to use, copy, modify, distribute, and sell this file for any
# purpose is hereby granted without fee, provided that the above copyright
# and this permission notice appear in all copies. No representations are
# made about the suitability of this software for any purpose. It is
# provided "as is" without express or implied warranty.
#
AC_DEFUN([AX_C99_FUNC_LRINTF],
[AC_CACHE_CHECK(for lrintf,
ac_cv_c99_lrintf,
[
lrintf_save_LIBS=$LIBS
LIBS="-lm"
AC_TRY_LINK([
#define _ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1
#define __USE_ISOC99 1
#define __USE_ISOC9X 1
#include <math.h>
], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no)
LIBS=$lrintf_save_LIBS
])
if test "$ac_cv_c99_lrintf" = yes; then
AC_DEFINE(HAVE_LRINTF, 1,
[Define if you have C99's lrintf function.])
fi
])# AX_C99_FUNC_LRINTF
# @synopsis AX_C99_FUNC_LLRINT
#
# Check whether C99's llrint function is available.
# @version 1.1 Sep 30 2002
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
#
# Permission to use, copy, modify, distribute, and sell this file for any
# purpose is hereby granted without fee, provided that the above copyright
# and this permission notice appear in all copies. No representations are
# made about the suitability of this software for any purpose. It is
# provided "as is" without express or implied warranty.
#
AC_DEFUN([AX_C99_FUNC_LLRINT],
[AC_CACHE_CHECK(for llrint,
ac_cv_c99_llrint,
[
llrint_save_LIBS=$LIBS
LIBS="-lm"
AC_TRY_LINK([
#define ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1
#define __USE_ISOC99 1
#define __USE_ISOC9X 1
#include <math.h>
], long long int x ; x = llrint(3.14159) ;, ac_cv_c99_llrint=yes, ac_cv_c99_llrint=no)
LIBS=$llrint_save_LIBS
])
if test "$ac_cv_c99_llrint" = yes; then
AC_DEFINE(HAVE_LLRINT, 1,
[Define if you have C99's llrint function.])
fi
])# AX_C99_FUNC_LLRINT
# @synopsis AX_C99_FUNC_LLRINTF
#
# Check whether C99's llrintf function is available.
# @version 1.1 Sep 30 2002
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
#
# Permission to use, copy, modify, distribute, and sell this file for any
# purpose is hereby granted without fee, provided that the above copyright
# and this permission notice appear in all copies. No representations are
# made about the suitability of this software for any purpose. It is
# provided "as is" without express or implied warranty.
#
AC_DEFUN([AX_C99_FUNC_LLRINTF],
[AC_CACHE_CHECK(for llrintf,
ac_cv_c99_llrintf,
[
llrintf_save_LIBS=$LIBS
LIBS="-lm"
AC_TRY_LINK([
#define _ISOC9X_SOURCE 1
#define _ISOC99_SOURCE 1
#define __USE_ISOC99 1
#define __USE_ISOC9X 1
#include <math.h>
], long long int x ; x = llrintf(3.14159) ;, ac_cv_c99_llrintf=yes, ac_cv_c99_llrintf=no)
LIBS=$llrintf_save_LIBS
])
if test "$ac_cv_c99_llrintf" = yes; then
AC_DEFINE(HAVE_LLRINTF, 1,
[Define if you have C99's llrintf function.])
fi
])# AX_C99_FUNC_LLRINTF

View File

@ -1,59 +0,0 @@
# @synopsis AX_CHECK_ARM_NEON
#
# Does the machine support the ARM NEON instruction set?
# @version 1.01 Feb 11 2013
# @author Steve Underwood
#
# Permission to use, copy, modify, distribute, and sell this file for any
# purpose is hereby granted without fee, provided that the above copyright
# and this permission notice appear in all copies. No representations are
# made about the suitability of this software for any purpose. It is
# provided "as is" without express or implied warranty.
AC_DEFUN([AX_CHECK_ARM_NEON],
[AC_CACHE_CHECK([if $1 supports the ARM NEON instructions set],
ac_cv_symbol_arm_neon,
[# Initialize to unknown
ac_cv_symbol_arm_neon="no"
case "${ax_cv_c_compiler_vendor}" in
gnu)
save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} -mfpu=neon -mfloat-abi=hard"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[
#include <inttypes.h>
#include <arm_neon.h>
int32x4_t testfunc(int16_t *a, int16_t *b)
{
return vmull_s16(vld1_s16(a), vld1_s16(b));
}
],
[
volatile int32x4_t z;
int16_t x[[8]];
int16_t y[[8]];
z = testfunc(x, y);
]
)],
[AC_MSG_RESULT([yes])
COMP_VENDOR_CFLAGS="-mfpu=neon $COMP_VENDOR_CFLAGS"
COMP_VENDOR_CXXFLAGS="-mfpu=neon $COMP_VENDOR_CXXFLAGS"
ac_cv_symbol_arm_neon="yes"],
[AC_MSG_RESULT([no])],
dnl Assume "no" if cross-compiling
[AC_MSG_RESULT([no])]
)
CFLAGS="${save_CFLAGS}"
;;
esac])
AS_IF([test AS_VAR_GET(ac_cv_symbol_arm_neon) = yes], [$2], [$3])[]dnl
]) # AX_CHECK_ARM_NEON

View File

@ -1,61 +0,0 @@
# @synopsis AX_CHECK_EXPORT_CAPABILITY
#
# Does the compiler support the exporting of library symbols?
# @version 1.0 Jan 31 2009
# @author Steve Underwood
#
# Permission to use, copy, modify, distribute, and sell this file for any
# purpose is hereby granted without fee, provided that the above copyright
# and this permission notice appear in all copies. No representations are
# made about the suitability of this software for any purpose. It is
# provided "as is" without express or implied warranty.
AC_DEFUN([AX_CHECK_EXPORT_CAPABILITY],
[AC_CACHE_CHECK([if $1 supports library symbol export],
ac_cv_symbol_export_capability,
[# Initialize to unknown
ac_cv_symbol_export_capability="no"
case "${ax_cv_c_compiler_vendor}" in
gnu)
save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} -fvisibility=hidden"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[int foo __attribute__ ((visibility("default")));],
[;]
)],
[AC_MSG_RESULT([yes])
COMP_VENDOR_CFLAGS="-fvisibility=hidden -DHAVE_VISIBILITY=1 $COMP_VENDOR_CFLAGS"
COMP_VENDOR_CXXFLAGS="-fvisibility=hidden -DHAVE_VISIBILITY=1 $COMP_VENDOR_CXXFLAGS"
ac_cv_symbol_export_capability="yes"],
[AC_MSG_RESULT([no])]
)
CFLAGS="${save_CFLAGS}"
;;
sun)
save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} -xldscope=hidden"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[int foo __attribute__ ((visibility("default")));],
[;]
)],
[AC_MSG_RESULT([yes])
COMP_VENDOR_CFLAGS="-xldscope=hidden -DHAVE_VISIBILITY=1 $COMP_VENDOR_CFLAGS"
COMP_VENDOR_CXXFLAGS="-xldscope=hidden -DHAVE_VISIBILITY=1 $COMP_VENDOR_CXXFLAGS"
ac_cv_symbol_export_capability="yes"],
[AC_MSG_RESULT([no])]
)
CFLAGS="${save_CFLAGS}"
;;
esac])
AS_IF([test AS_VAR_GET(ac_cv_symbol_export_capability) = yes], [$2], [$3])[]dnl
]) # AX_CHECK_EXPORT_CAPABILITY

View File

@ -1,27 +0,0 @@
# AX_CHECK_REAL_FILE(FILE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# ------------------------------------------------------------------
#
# Check for the existence of FILE, and make sure it is a real file or
# directory, and not a symbolic link.
#
AC_DEFUN([AX_CHECK_REAL_FILE],
[AC_DIAGNOSE([cross],
[cannot check for file existence when cross compiling])dnl
AS_VAR_PUSHDEF([ac_RealFile], [ac_cv_real_file_$1])dnl
AC_CACHE_CHECK([for $1], ac_RealFile,
[test "$cross_compiling" = yes &&
AC_MSG_ERROR([cannot check for file existence when cross compiling])
if test -r "$1"
then
if test -h "$1"
then
AS_VAR_SET(ac_RealFile, no)
else
AS_VAR_SET(ac_RealFile, yes)
fi
else
AS_VAR_SET(ac_RealFile, no)
fi])
AS_IF([test AS_VAR_GET(ac_RealFile) = yes], [$2], [$3])[]dnl
AS_VAR_POPDEF([ac_RealFile])dnl
])# AX_CHECK_REAL_FILE

View File

@ -1,65 +0,0 @@
# ===========================================================================
# http://autoconf-archive.cryp.to/ax_compiler_vendor.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_COMPILER_VENDOR
#
# DESCRIPTION
#
# Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun,
# hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft,
# watcom, etc. The vendor is returned in the cache variable
# $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++.
#
# LAST MODIFICATION
#
# 2008-04-12
#
# COPYLEFT
#
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
# Copyright (c) 2008 Matteo Frigo
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 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 General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Macro Archive. When you make and
# distribute a modified version of the Autoconf Macro, you may extend this
# special exception to the GPL to apply to your modified version as well.
AC_DEFUN([AX_COMPILER_VENDOR],
[
AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
[ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
# note: don't check for gcc first since some other compilers define __GNUC__
for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ clang:__clang__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
#if !($vencpp)
thisisanerror;
#endif
])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break])
done
])
])

View File

@ -1,35 +0,0 @@
# AX_FIXED_POINT_MACHINE(MACHINE, [ACTION-IF-FIXED-POINT], [ACTION-IF-NOT-FIXED-POINT])
# -------------------------------------------------------------------------------------
#
# Check if a specified machine type is a fixed point only machine. That is, if it lacks
# fast floating point support.
#
# This is a simple lookup amongst machines known to the current autotools. So far we deal
# with the embedded ARM, Blackfin, MIPS, TI DSP and XScale processors as things which lack
# fast hardware floating point.
#
# Other candidates would be the small embedded Power PCs.
#
AC_DEFUN([AX_FIXED_POINT_MACHINE],
[AS_VAR_PUSHDEF([ac_FixedPoint], [ac_cv_fixed_point_machine_$1])dnl
AC_CACHE_CHECK([if $1 is fixed point only], ac_FixedPoint,
[case $1 in
arc \
| arm | arm[bl]e | arme[bl] | armv[2345] | armv[345][bl] \
| arm-* | arm[bl]e-* | arme[bl]-* | armv[345]-* \
| bfin | bfin-* \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| tic54x | c54x* | tic55x | c55x* | tic6x | c6x* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| xscale | xscalee[bl] \
| xscale-* | xscalee[bl]-* )
AS_VAR_SET(ac_FixedPoint, yes)
;;
*)
AS_VAR_SET(ac_FixedPoint, no)
;;
esac])
AS_IF([test AS_VAR_GET(ac_FixedPoint) = yes], [$2], [$3])[]dnl
AS_VAR_POPDEF([ac_FixedPoint])dnl
])# AX_FIXED_POINT_MACHINE

View File

@ -1,25 +0,0 @@
# AX_FUNC_ALIGNED_ALLOC
# ---------------------
#
# Check for the function aligned_alloc()
#
AC_DEFUN([AX_FUNC_ALIGNED_ALLOC],[
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror"
AC_CACHE_CHECK([checking for aligned_alloc],
[ax_cv_func_aligned_alloc],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([
#define _ISOC11_SOURCE
#include <stdlib.h>
],
[
aligned_alloc(0,0);
])],
[ax_cv_func_aligned_alloc=yes],
[ax_cv_func_aligned_alloc=no])])
if test "x${ax_cv_func_aligned_alloc}" = "xyes" ; then
AC_DEFINE([HAVE_ALIGNED_ALLOC], [1], [Define to 1 if you have the aligned_alloc() function.])
fi
CFLAGS="$saved_CFLAGS"
])# AX_ALIGNED_ALLOC

View File

@ -1,33 +0,0 @@
# AX_MISALIGNED_ACCESS_FAILS(MACHINE, [ACTION-IF-MISALIGNED-FAILS], [ACTION-IF-MISALIGNED-OK])
# -------------------------------------------------------------------------------------
#
# Check if a specified machine type cannot handle misaligned data. That is, multi-byte data
# types which are not properly aligned in memory fail. Many machines are happy to work with
# misaligned data, but slowing down a bit. Other machines just won't tolerate such data.
#
# This is a simple lookup amongst machines known to the current autotools. So far we only deal
# with the ARM and sparc.
# A lookup is used, as many of the devices which cannot handled misaligned access are embedded
# processors, for which the code normally be cross-compiled.
#
AC_DEFUN([AX_MISALIGNED_ACCESS_FAILS],
[AS_VAR_PUSHDEF([ac_MisalignedAccessFails], [ac_cv_misaligned_access_fails_$1])dnl
AC_CACHE_CHECK([if $1 fails on misaligned memory access], ac_MisalignedAccessFails,
[case $1 in
arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] \
| bfin \
| sparc \
| xscale | xscalee[bl] \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| bfin-* \
| sparc-* \
| xscale-* | xscalee[bl]-* )
AS_VAR_SET(ac_MisalignedAccessFails, yes)
;;
*)
AS_VAR_SET(ac_MisalignedAccessFails, no)
;;
esac])
AS_IF([test AS_VAR_GET(ac_MisalignedAccessFails) = yes], [$2], [$3])[]dnl
AS_VAR_POPDEF([ac_MisalignedAccessFails])dnl
])# MISALIGNED_ACCESS_FAILS

View File

@ -1,126 +0,0 @@
##
## SpanDSP - a series of DSP components for telephony
##
## Makefile.am - Process this file with automake to produce Makefile.in
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License version 2, as
## published by the Free Software Foundation.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
LIBS += -L$(top_builddir)/src -lspandsp $(SIMLIBS)
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = libspandsp_sim.dsp \
libspandsp_sim.2005.vcproj \
libspandsp_sim.2008.vcproj \
msvc/make_line_models.2008.vcproj \
msvc/msvcproj.head \
msvc/msvcproj.foot \
msvc/vc8proj.head \
msvc/vc8proj.foot \
msvc/vc9proj.head \
msvc/vc9proj.foot
AM_CPPFLAGS = -I$(top_builddir) -I$(top_builddir)/src -DDATADIR="\"$(pkgdatadir)\""
noinst_PROGRAMS = make_line_models
lib_LTLIBRARIES = libspandsp-sim.la
libspandsp_sim_la_SOURCES = g1050.c \
line_model.c \
rfc2198_sim.c \
test_utils.c
nodist_libspandsp_sim_la_SOURCES = line_models.c
libspandsp_sim_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS)
nobase_include_HEADERS = spandsp/g1050.h \
spandsp/line_model.h \
spandsp/line_models.h \
spandsp/rfc2198_sim.h \
spandsp/test_utils.h \
spandsp-sim.h
make_line_models_SOURCES = make_line_models.c
make_line_models_LDADD = -L$(top_builddir)/src -lspandsp
# We need to run make_line_models, so it generates the line_models.h file
# used by several of the test programs.
line_models.lo: make_line_models$(EXEEXT) line_models.c
line_models.$(OBJEXT): make_line_models$(EXEEXT) line_models.c
line_models.c: make_line_models$(EXEEXT)
./make_line_models$(EXEEXT)
DSP = libspandsp_sim.dsp
VCPROJ8 = libspandsp_sim.2005.vcproj
VCPROJ9 = libspandsp_sim.2008.vcproj
WIN32SOURCES = $(libspandsp_sim_la_SOURCES)
WIN32HEADERS = $(nobase_include_HEADERS)
DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP)
VCPROJOUT8 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ8)
VCPROJOUT9 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ9)
$(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am
echo "creating $(DSP)"
@(cp $(srcdir)/msvc/msvcproj.head $(DSP); \
echo "# Begin Group \"Source Files\"" $(DSPOUT); \
for file in $(WIN32SOURCES); do \
echo "# Begin Source File" $(DSPOUT); \
echo "" $(DSPOUT); \
echo "SOURCE=.\\"$$file $(DSPOUT); \
echo "# End Source File" $(DSPOUT); \
done; \
echo "# End Group" $(DSPOUT); \
echo "# Begin Group \"Header Files\"" $(DSPOUT); \
for file in $(WIN32HEADERS); do \
echo "# Begin Source File" $(DSPOUT); \
echo "" $(DSPOUT); \
echo "SOURCE=.\\"$$file $(DSPOUT); \
echo "# End Source File" $(DSPOUT); \
done; \
echo "# End Group" $(DSPOUT); \
cat $(srcdir)/msvc/msvcproj.foot $(DSPOUT) )
$(VCPROJ8): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am
echo "creating $(VCPROJ8)"
@(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ8); \
for file in $(WIN32SOURCES); do \
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT8); \
done; \
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT8); \
for file in $(WIN32HEADERS); do \
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT8); \
done; \
cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT8) )
$(VCPROJ9): msvc/vc9proj.head msvc/vc9proj.foot Makefile.am
echo "creating $(VCPROJ9)"
@(cp $(srcdir)/msvc/vc9proj.head $(VCPROJ9); \
for file in $(WIN32SOURCES); do \
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT9); \
done; \
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT9); \
for file in $(WIN32HEADERS); do \
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT9); \
done; \
cat $(srcdir)/msvc/vc9proj.foot $(VCPROJOUT9) )

File diff suppressed because it is too large Load Diff

View File

@ -1,110 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="libspandsp_sim"
ProjectGUID="{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
RootNamespace="libspandsp_sim"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)Debug"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-4.0.2\libtiff"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="4"
DebugInformationFormat="4"
CompileAs="1"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="./Debug\spandsp_sim.lib"
TargetMachine="1"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)Release"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
WholeProgramOptimization="1"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-4.0.2\libtiff"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="4"
DebugInformationFormat="3"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="./Release\spandsp_sim.lib"
TargetMachine="1"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File RelativePath="g1050.c"></File>
<File RelativePath="line_model.c"></File>
<File RelativePath="rfc2198_sim.c"></File>
<File RelativePath="test_utils.c"></File>
</Filter><Filter Name="Header Files">
<File RelativePath="spandsp/g1050.h"></File>
<File RelativePath="spandsp/line_model.h"></File>
<File RelativePath="spandsp/line_models.h"></File>
<File RelativePath="spandsp/rfc2198_sim.h"></File>
<File RelativePath="spandsp/test_utils.h"></File>
<File RelativePath="spandsp-sim.h"></File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,270 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="libspandsp_sim"
ProjectGUID="{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}"
RootNamespace="libspandsp_sim"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)Debug"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-4.0.2\libtiff"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="4"
DebugInformationFormat="4"
CompileAs="1"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="./Debug\spandsp_sim.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)Release"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-4.0.2\libtiff"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="4"
DebugInformationFormat="3"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="./Release\spandsp_sim.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-4.0.2\libtiff"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="4"
DebugInformationFormat="3"
CompileAs="1"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(TargetDir)spandsp_sim.lib"
TargetMachine="17"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
WholeProgramOptimization="1"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-4.0.2\libtiff"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="4"
DebugInformationFormat="3"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(TargetDir)spandsp_sim.lib"
TargetMachine="17"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File RelativePath="g1050.c"></File>
<File RelativePath="line_model.c"></File>
<File RelativePath="rfc2198_sim.c"></File>
<File RelativePath="test_utils.c"></File>
</Filter><Filter Name="Header Files">
<File RelativePath="spandsp/g1050.h"></File>
<File RelativePath="spandsp/line_model.h"></File>
<File RelativePath="spandsp/line_models.h"></File>
<File RelativePath="spandsp/rfc2198_sim.h"></File>
<File RelativePath="spandsp/test_utils.h"></File>
<File RelativePath="spandsp-sim.h"></File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,143 +0,0 @@
# Microsoft Developer Studio Project File - Name="spandsp" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=spandsp - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "spandsp.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "spandsp.mak" CFG="spandsp - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "spandsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "spandsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "spandsp - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libspandsp.dll"
!ELSEIF "$(CFG)" == "spandsp - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c
# SUBTRACT CPP /WX /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libspandsp.dll" /pdbtype:sept
# SUBTRACT LINK32 /nodefaultlib
!ENDIF
# Begin Target
# Name "spandsp - Win32 Release"
# Name "spandsp - Win32 Debug"
# Begin Group "Source Files"
# Begin Source File
SOURCE=.\g1050.c
# End Source File
# Begin Source File
SOURCE=.\line_model.c
# End Source File
# Begin Source File
SOURCE=.\rfc2198_sim.c
# End Source File
# Begin Source File
SOURCE=.\test_utils.c
# End Source File
# End Group
# Begin Group "Header Files"
# Begin Source File
SOURCE=.\spandsp/g1050.h
# End Source File
# Begin Source File
SOURCE=.\spandsp/line_model.h
# End Source File
# Begin Source File
SOURCE=.\spandsp/line_models.h
# End Source File
# Begin Source File
SOURCE=.\spandsp/rfc2198_sim.h
# End Source File
# Begin Source File
SOURCE=.\spandsp/test_utils.h
# End Source File
# Begin Source File
SOURCE=.\spandsp-sim.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@ -1,576 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* line_model.c - Model a telephone line.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2004 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <string.h>
#include <time.h>
#include <stdio.h>
#include <fcntl.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#define GEN_CONST
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
#include "spandsp.h"
#include "spandsp-sim.h"
#include "spandsp/g168models.h"
#if !defined(NULL)
#define NULL (void *) 0
#endif
static const float null_line_model[] =
{
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0
};
SPAN_DECLARE_DATA const float *line_models[] =
{
null_line_model, /* 0 */
proakis_line_model,
ad_1_edd_1_model,
ad_1_edd_2_model,
ad_1_edd_3_model,
ad_5_edd_1_model, /* 5 */
ad_5_edd_2_model,
ad_5_edd_3_model,
ad_6_edd_1_model,
ad_6_edd_2_model,
ad_6_edd_3_model, /* 10 */
ad_7_edd_1_model,
ad_7_edd_2_model,
ad_7_edd_3_model,
ad_8_edd_1_model,
ad_8_edd_2_model, /* 15 */
ad_8_edd_3_model,
ad_9_edd_1_model,
ad_9_edd_2_model,
ad_9_edd_3_model
};
static float calc_near_line_filter(one_way_line_model_state_t *s, float v)
{
float sum;
int j;
int p;
/* Add the sample in the filter buffer */
p = s->near_buf_ptr;
s->near_buf[p] = v;
if (++p == s->near_filter_len)
p = 0;
s->near_buf_ptr = p;
/* Apply the filter */
sum = 0.0f;
for (j = 0; j < s->near_filter_len; j++)
{
sum += s->near_filter[j]*s->near_buf[p];
if (++p >= s->near_filter_len)
p = 0;
}
/* Add noise */
sum += awgn(&s->near_noise);
return sum;
}
/*- End of function --------------------------------------------------------*/
static float calc_far_line_filter(one_way_line_model_state_t *s, float v)
{
float sum;
int j;
int p;
/* Add the sample in the filter buffer */
p = s->far_buf_ptr;
s->far_buf[p] = v;
if (++p == s->far_filter_len)
p = 0;
s->far_buf_ptr = p;
/* Apply the filter */
sum = 0.0f;
for (j = 0; j < s->far_filter_len; j++)
{
sum += s->far_filter[j]*s->far_buf[p];
if (++p >= s->far_filter_len)
p = 0;
}
/* Add noise */
sum += awgn(&s->far_noise);
return sum;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) one_way_line_model(one_way_line_model_state_t *s,
int16_t output[],
const int16_t input[],
int samples)
{
int i;
float in;
float out;
float out1;
int16_t amp[1];
/* The path being modelled is:
terminal
| < hybrid
|
| < noise and filtering
|
| < hybrid
CO
|
| < A-law distortion + bulk delay
|
CO
| < hybrid
|
| < noise and filtering
|
| < hybrid
terminal
*/
for (i = 0; i < samples; i++)
{
in = input[i];
/* Near end analogue section */
/* Line model filters & noise */
out = calc_near_line_filter(s, in);
/* Long distance digital section */
amp[0] = out;
codec_munge(s->munge, amp, 1);
out = amp[0];
/* Introduce the bulk delay of the long distance link. */
out1 = s->bulk_delay_buf[s->bulk_delay_ptr];
s->bulk_delay_buf[s->bulk_delay_ptr] = out;
out = out1;
if (++s->bulk_delay_ptr >= s->bulk_delay)
s->bulk_delay_ptr = 0;
/* Far end analogue section */
/* Line model filters & noise */
out = calc_far_line_filter(s, out);
if (s->mains_interference)
{
tone_gen(&s->mains_tone, amp, 1);
out += amp[0];
}
output[i] = out + s->dc_offset;
}
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) one_way_line_model_set_dc(one_way_line_model_state_t *s, float dc)
{
s->dc_offset = dc;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) one_way_line_model_set_mains_pickup(one_way_line_model_state_t *s, int f, float level)
{
tone_gen_descriptor_t mains_tone_desc;
if (f)
{
tone_gen_descriptor_init(&mains_tone_desc, f, (int) (level - 10.0f), f*3, (int) level, 1, 0, 0, 0, true);
tone_gen_init(&s->mains_tone, &mains_tone_desc);
}
s->mains_interference = f;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) both_ways_line_model(both_ways_line_model_state_t *s,
int16_t output1[],
const int16_t input1[],
int16_t output2[],
const int16_t input2[],
int samples)
{
int i;
float in1;
float in2;
float out1;
float out2;
float tmp1;
float tmp2;
int16_t amp[1];
/* The path being modelled is:
terminal
| < hybrid echo
|
| < noise and filtering
|
| < hybrid echo
CO
|
| < A-law distortion + bulk delay
|
CO
| < hybrid echo
|
| < noise and filtering
|
| < hybrid echo
terminal
*/
for (i = 0; i < samples; i++)
{
in1 = input1[i];
in2 = input2[i];
/* Near end analogue sections */
/* Echo from each terminal's CO hybrid */
tmp1 = in1 + s->fout2*s->line1.near_co_hybrid_echo;
tmp2 = in2 + s->fout1*s->line2.near_co_hybrid_echo;
/* Line model filters & noise */
s->fout1 = calc_near_line_filter(&s->line1, tmp1);
s->fout2 = calc_near_line_filter(&s->line2, tmp2);
/* Long distance digital section */
/* Introduce distortion due to A-law or u-law munging. */
amp[0] = s->fout1;
codec_munge(s->line1.munge, amp, 1);
s->fout1 = amp[0];
amp[0] = s->fout2;
codec_munge(s->line2.munge, amp, 1);
s->fout2 = amp[0];
/* Introduce the bulk delay of the long distance digital link. */
out1 = s->line1.bulk_delay_buf[s->line1.bulk_delay_ptr];
s->line1.bulk_delay_buf[s->line1.bulk_delay_ptr] = s->fout1;
s->fout1 = out1;
if (++s->line1.bulk_delay_ptr >= s->line1.bulk_delay)
s->line1.bulk_delay_ptr = 0;
out2 = s->line2.bulk_delay_buf[s->line2.bulk_delay_ptr];
s->line2.bulk_delay_buf[s->line2.bulk_delay_ptr] = s->fout2;
s->fout2 = out2;
if (++s->line2.bulk_delay_ptr >= s->line2.bulk_delay)
s->line2.bulk_delay_ptr = 0;
/* Far end analogue sections */
/* Echo from each terminal's own hybrid */
out1 += in2*s->line1.far_cpe_hybrid_echo;
out2 += in1*s->line2.far_cpe_hybrid_echo;
/* Line model filters & noise */
out1 = calc_far_line_filter(&s->line1, out1);
out2 = calc_far_line_filter(&s->line2, out2);
output1[i] = fsaturate(out1 + s->line1.dc_offset);
output2[i] = fsaturate(out2 + s->line2.dc_offset);
}
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) both_ways_line_model_set_dc(both_ways_line_model_state_t *s, float dc1, float dc2)
{
s->line1.dc_offset = dc1;
s->line2.dc_offset = dc2;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) both_ways_line_model_set_mains_pickup(both_ways_line_model_state_t *s, int f, float level1, float level2)
{
tone_gen_descriptor_t mains_tone_desc;
if (f)
{
tone_gen_descriptor_init(&mains_tone_desc, f, (int) (level1 - 10.0f), f*3, (int) level1, 1, 0, 0, 0, true);
tone_gen_init(&s->line1.mains_tone, &mains_tone_desc);
tone_gen_descriptor_init(&mains_tone_desc, f, (int) (level2 - 10.0f), f*3, (int) level2, 1, 0, 0, 0, true);
tone_gen_init(&s->line2.mains_tone, &mains_tone_desc);
}
s->line1.mains_interference = f;
s->line2.mains_interference = f;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(one_way_line_model_state_t *) one_way_line_model_init(int model, float noise, int codec, int rbs_pattern)
{
one_way_line_model_state_t *s;
if ((s = (one_way_line_model_state_t *) malloc(sizeof(*s))) == NULL)
return NULL;
memset(s, 0, sizeof(*s));
s->bulk_delay = 8;
s->bulk_delay_ptr = 0;
s->munge = codec_munge_init(codec, rbs_pattern);
s->near_filter = line_models[model];
s->near_filter_len = 129;
s->far_filter = line_models[model];
s->far_filter_len = 129;
/* Put half the noise in each analogue section */
awgn_init_dbm0(&s->near_noise, 1234567, noise - 3.02f);
awgn_init_dbm0(&s->far_noise, 1234567, noise - 3.02f);
s->dc_offset = 0.0f;
s->mains_interference = 0;
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) one_way_line_model_free(one_way_line_model_state_t *s)
{
codec_munge_free(s->munge);
free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(both_ways_line_model_state_t *) both_ways_line_model_init(int model1,
float noise1,
float echo_level_cpe1,
float echo_level_co1,
int model2,
float noise2,
float echo_level_cpe2,
float echo_level_co2,
int codec,
int rbs_pattern)
{
both_ways_line_model_state_t *s;
if ((s = (both_ways_line_model_state_t *) malloc(sizeof(*s))) == NULL)
return NULL;
memset(s, 0, sizeof(*s));
s->line1.munge = codec_munge_init(codec, rbs_pattern);
s->line2.munge = codec_munge_init(codec, rbs_pattern);
s->line1.bulk_delay = 8;
s->line2.bulk_delay = 8;
s->line1.bulk_delay_ptr = 0;
s->line2.bulk_delay_ptr = 0;
s->line1.near_filter = line_models[model1];
s->line1.near_filter_len = 129;
s->line2.near_filter = line_models[model2];
s->line2.near_filter_len = 129;
s->line1.far_filter = line_models[model1];
s->line1.far_filter_len = 129;
s->line2.far_filter = line_models[model2];
s->line2.far_filter_len = 129;
/* Put half the noise in each analogue section */
awgn_init_dbm0(&s->line1.near_noise, 1234567, noise1 - 3.02f);
awgn_init_dbm0(&s->line2.near_noise, 7654321, noise2 - 3.02f);
awgn_init_dbm0(&s->line1.far_noise, 1234567, noise1 - 3.02f);
awgn_init_dbm0(&s->line2.far_noise, 7654321, noise2 - 3.02f);
s->line1.dc_offset = 0.0f;
s->line2.dc_offset = 0.0f;
s->line1.mains_interference = 0;
s->line2.mains_interference = 0;
/* Echos */
s->line1.near_co_hybrid_echo = pow(10, echo_level_co1/20.0f);
s->line2.near_co_hybrid_echo = pow(10, echo_level_co2/20.0f);
s->line1.near_cpe_hybrid_echo = pow(10, echo_level_cpe1/20.0f);
s->line2.near_cpe_hybrid_echo = pow(10, echo_level_cpe2/20.0f);
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) both_ways_line_model_free(both_ways_line_model_state_t *s)
{
codec_munge_free(s->line1.munge);
codec_munge_free(s->line2.munge);
free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

File diff suppressed because it is too large Load Diff

View File

@ -1,121 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="make_line_models"
ProjectGUID="{329A6FA0-0FCC-4435-A950-E670AEFA9838}"
RootNamespace="make_line_models"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="All|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..\..\src;..\..\src\msvc;..\..\src\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="&quot;$(TargetPath)&quot;&#x0D;&#x0A;"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\src\msvc\getopt.c"
>
</File>
<File
RelativePath="..\make_line_models.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,7 +0,0 @@
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@ -1,92 +0,0 @@
# Microsoft Developer Studio Project File - Name="spandsp" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=spandsp - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "spandsp.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "spandsp.mak" CFG="spandsp - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "spandsp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "spandsp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "spandsp - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "." /I "..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /D "_WINDLL" /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libspandsp.dll"
!ELSEIF "$(CFG)" == "spandsp - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D HAVE_TGMATH_H /FR /FD /GZ /c
# SUBTRACT CPP /WX /YX
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libspandsp.dll" /pdbtype:sept
# SUBTRACT LINK32 /nodefaultlib
!ENDIF
# Begin Target
# Name "spandsp - Win32 Release"
# Name "spandsp - Win32 Debug"

View File

@ -1,5 +0,0 @@
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,94 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="libspandsp_sim"
ProjectGUID="{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
RootNamespace="libspandsp_sim"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)Debug"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-4.0.2\libtiff"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="4"
DebugInformationFormat="4"
CompileAs="1"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="./Debug\spandsp_sim.lib"
TargetMachine="1"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)Release"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
WholeProgramOptimization="1"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-4.0.2\libtiff"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="4"
DebugInformationFormat="3"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="./Release\spandsp_sim.lib"
TargetMachine="1"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>

View File

@ -1,5 +0,0 @@
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,254 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="libspandsp_sim"
ProjectGUID="{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}"
RootNamespace="libspandsp_sim"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)Debug"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-4.0.2\libtiff"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="4"
DebugInformationFormat="4"
CompileAs="1"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="./Debug\spandsp_sim.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)Release"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-4.0.2\libtiff"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="4"
DebugInformationFormat="3"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="./Release\spandsp_sim.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-4.0.2\libtiff"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="4"
DebugInformationFormat="3"
CompileAs="1"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(TargetDir)spandsp_sim.lib"
TargetMachine="17"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
WholeProgramOptimization="1"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\src\spandsp;..\src;..\src\msvc;..\..\tiff-4.0.2\libtiff"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBSPANDSP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="4"
DebugInformationFormat="3"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary="$(TargetDir)spandsp_sim.lib"
TargetMachine="17"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>

View File

@ -1,187 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* rfc2198_sim.c - Simulate the behaviour of RFC2198 (or UDPTL) redundancy.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2007 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <string.h>
#include <time.h>
#include <stdio.h>
#include <fcntl.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#define GEN_CONST
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp.h"
#include "spandsp/g1050.h"
#include "spandsp/rfc2198_sim.h"
#define PACKET_LOSS_TIME -1
SPAN_DECLARE(rfc2198_sim_state_t *) rfc2198_sim_init(int model,
int speed_pattern,
int packet_size,
int packet_rate,
int redundancy_depth)
{
rfc2198_sim_state_t *s;
if ((s = (rfc2198_sim_state_t *) malloc(sizeof(*s))) == NULL)
return NULL;
memset(s, 0, sizeof(*s));
s->g1050 = g1050_init(model, speed_pattern, packet_size, packet_rate);
s->redundancy_depth = redundancy_depth;
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) rfc2198_sim_free(rfc2198_sim_state_t *s)
{
g1050_free(s->g1050);
free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) rfc2198_sim_put(rfc2198_sim_state_t *s,
const uint8_t buf[],
int len,
int seq_no,
double departure_time)
{
uint8_t buf2[8192];
uint8_t *p;
uint16_t *q;
int slot;
int i;
/* Save the packet in the history buffer */
memcpy(s->tx_pkt[s->next_pkt], buf, len);
s->tx_pkt_len[s->next_pkt] = len;
s->tx_pkt_seq_no[s->next_pkt] = seq_no;
/* Construct the redundant packet */
p = buf2;
slot = s->next_pkt;
q = (uint16_t *) p;
*q = s->redundancy_depth;
p += sizeof(uint16_t);
for (i = 0; i < s->redundancy_depth; i++)
{
q = (uint16_t *) p;
*q = s->tx_pkt_len[slot];
p += sizeof(uint16_t);
memcpy(p, s->tx_pkt[slot], s->tx_pkt_len[slot]);
p += s->tx_pkt_len[slot];
slot = (slot - 1) & 0x1F;
}
s->next_pkt = (s->next_pkt + 1) & 0x1F;
return g1050_put(s->g1050, buf2, p - buf2, seq_no, departure_time);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) rfc2198_sim_get(rfc2198_sim_state_t *s,
uint8_t buf[],
int max_len,
double current_time,
int *seq_no,
double *departure_time,
double *arrival_time)
{
int len;
int lenx;
int seq_nox;
int i;
#if defined(_MSC_VER)
uint8_t *bufx = (uint8_t *) _alloca(s->redundancy_depth*1024);
#else
uint8_t bufx[s->redundancy_depth*1024];
#endif
uint8_t *p;
uint16_t *q;
int redundancy_depth;
if (s->rx_queued_pkts)
{
/* We have some stuff from the last g1050_get() still to deliver */
s->rx_queued_pkts--;
memcpy(buf, s->rx_pkt[s->rx_queued_pkts], s->rx_pkt_len[s->rx_queued_pkts]);
*seq_no = s->rx_pkt_seq_no[s->rx_queued_pkts];
return s->rx_pkt_len[s->rx_queued_pkts];
}
len = g1050_get(s->g1050, bufx, s->redundancy_depth*1024, current_time, &seq_nox, departure_time, arrival_time);
if (len > 0)
{
p = bufx;
q = (uint16_t *) p;
redundancy_depth = *q;
p += sizeof(uint16_t);
i = 0;
if (seq_nox > s->next_seq_no)
{
/* Some stuff is missing. Try to fill it in. */
s->rx_queued_pkts = seq_nox - s->next_seq_no;
if (s->rx_queued_pkts >= redundancy_depth)
s->rx_queued_pkts = redundancy_depth - 1;
for (i = 0; i < s->rx_queued_pkts; i++)
{
q = (uint16_t *) p;
s->rx_pkt_len[i] = *q;
p += sizeof(uint16_t);
memcpy(s->rx_pkt[i], p, s->rx_pkt_len[i]);
s->rx_pkt_seq_no[i] = seq_nox - i;
p += s->rx_pkt_len[i];
}
}
*seq_no = seq_nox - i;
q = (uint16_t *) p;
lenx = *q;
p += sizeof(uint16_t);
memcpy(buf, p, lenx);
s->next_seq_no = seq_nox + 1;
}
else
{
lenx = len;
}
return lenx;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

View File

@ -1,43 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* spandsp-sim.h - The head guy amongst the simulator headers
*
* Written by Steve Underwood <spandsp/steveu@coppice.org>
*
* Copyright (C) 2007 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
#if !defined(_SPANDSP_SIM_H_)
#define _SPANDSP_SIM_H_
#include <inttypes.h>
#include <limits.h>
#include <time.h>
#include <tiffio.h>
#include <spandsp/g1050.h>
#include <spandsp/rfc2198_sim.h>
#include <spandsp/test_utils.h>
#include <spandsp/line_model.h>
#include <spandsp/line_models.h>
#endif
/*- End of file ------------------------------------------------------------*/

View File

@ -1,300 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* g1050.h - IP network modeling, as per G.1050/TIA-921.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2007 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.
*/
/*! \file */
/*! \page g1050_ip_network_model_page G.1050/TIA-921 IP network path model
\section g1050_ip_network_model_page_sec_1 What does it do?
The ITU G.1050 specification defines a model of an IP network, appropriate
for the testing of how streaming media woud behave across the internet. The
model is based on a path having 5 segments:
- a local LAN (wired or wireless)
- an access link to the internet
- an internet of arbitrary complexity
- an access link from the internet
- a distant LAN (wired or wireless)
The impairments typical of these segments at various service levels are modelled.
8 standard service level behaviours are defined, covering lightly loaded to heavily
congested levels. 168 standard sets of link speeds are defined, covering typical
wired and wireless LAN, broadband access link, and backbone characteristics.
The G.1050 model is suitable for testing the behaviour of RTP, UDPTL and other streaming
protocols for packet loss and jitter behaviour.
*/
#if !defined(_G1050_H_)
#define _G1050_H_
/* This is the time slice at which delays, packet loss, etc. are calculated. */
#define G1050_TICKS_PER_SEC 1000
/* Search back 200 ms to preserve order of legitimately out of sequence packets. */
#define SEARCHBACK_PERIOD 200
#define G1050_LOW_LOSS 0
#define G1050_HIGH_LOSS 1
#define G1050_LAN_LINK 1
#define G1050_ACCESS_LINK 2
/*! Segment constants, as defined in G.1050. */
typedef struct
{
/*! Probability of changing from low to high and high to low loss states */
double prob_loss_rate_change[2];
/*! Probability of an impulse in the low and high loss states */
double prob_impulse[2][2];
/*! Impulse height, based on MTU and bit rate */
double impulse_height;
/*! Impulse decay coefficient for the single pole IIR filter. */
double impulse_coeff;
/*! Probability of packet loss due to occupancy. */
double prob_packet_loss;
/*! Probability of packet loss due to a multiple access collision. */
double prob_packet_collision_loss;
} g1050_segment_constants_t;
/*! End-to-end constants, as defined in G.1050. */
typedef struct
{
g1050_segment_constants_t segment[4];
} g1050_constants_t;
/*! The model definition for a LAN or access link segment */
typedef struct
{
/*! Percentage occupancy of the media */
double percentage_occupancy;
/*! MTU of the media */
int mtu;
/*! Maximum jitter in the segment. */
double max_jitter;
} g1050_segment_model_t;
/*! The model definition for the core network (backbone) segment */
typedef struct
{
/*! Basic delay of the backbone for regional paths */
double base_regional_delay;
/*! Basic delay of the backbone for intercontinental paths */
double base_intercontinental_delay;
/*! Percentage packet loss of the backbone */
/*! Percentage packet loss of the backbone. */
double percentage_packet_loss;
/*! Maximum jitter in the backbone. */
double max_jitter;
/*! Interval between the backbone route flapping between two paths, in seconds. */
double route_flap_interval;
/*! The difference in backbone delay between the two routes we flap between, in seconds. */
double route_flap_delay;
/*! The interval between link failures. */
double link_failure_interval;
/*! The duration of link failures. */
double link_failure_duration;
/*! Probability of packet loss in the backbone. */
double prob_packet_loss;
/*! Probability of a packet going out of sequence in the backbone. */
double prob_oos;
} g1050_core_model_t;
/*! The model definition for a complete end-to-end path */
typedef struct
{
/*! The likelyhood of occurance probabilities for the A, B and C scenarios defined in G.1050 */
int loo[3];
g1050_segment_model_t sidea_lan;
g1050_segment_model_t sidea_access_link;
g1050_core_model_t core;
g1050_segment_model_t sideb_access_link;
g1050_segment_model_t sideb_lan;
} g1050_model_t;
/*! The speed model for a complete end-to-end path */
typedef struct
{
int sidea_lan_bit_rate;
int sidea_lan_multiple_access;
int sidea_access_link_bit_rate_ab;
int sidea_access_link_bit_rate_ba;
int sidea_access_link_qos_enabled;
int sideb_lan_bit_rate;
int sideb_lan_multiple_access;
int sideb_access_link_bit_rate_ab;
int sideb_access_link_bit_rate_ba;
int sideb_access_link_qos_enabled;
double loo;
} g1050_channel_speeds_t;
/*! The model state for a LAN or access link segment */
typedef struct
{
/*! The type of link, G1050_LAN_LINK or G_1050_ACCESS_LINK */
int link_type;
/*! 1 if in the high loss state, or 0 if in the low loss state. */
int high_loss;
/*! The probability of a loss rate change, for both loss rate states. */
double prob_loss_rate_change[2];
/*! The probability of a impulse occuring, for both loss rate states. */
double prob_impulse[2];
/*! The maximum permitted height of impulses. */
double impulse_height;
/*! The impulse decay coefficient. */
double impulse_coeff;
/*! The basic serial delay due to the link. */
double serial_delay;
/*! Peak jitter in the segment. */
double max_jitter;
/*! The probability of packet loss. */
double prob_packet_loss;
/*! The probability of packet loss due to collision. */
double prob_packet_collision_loss;
/*! The maximum addition delay due to congestion. */
double congestion_delay;
/*! TRUE if QoS is enabled on the link. */
int qos_enabled;
/*! TRUE if the link is a multiple access type (e.g. an ethernet hub). */
int multiple_access;
/*! The latest packet arrival time seen on the link. */
double last_arrival_time;
/*! 3 seconds of predicted delays for the link */
double delays[3*G1050_TICKS_PER_SEC];
/*! A count of packets lost on the link. */
uint32_t lost_packets;
/*! An extra debug count of packets lost on the link. */
uint32_t lost_packets_2;
} g1050_segment_state_t;
/*! The model state for the core network (backbone) segment */
typedef struct
{
/* Router model. */
int32_t route_flap_counter;
int32_t route_flap_interval;
double route_flap_delta;
/* Link failure model. */
int32_t link_failure_counter;
int32_t link_recovery_counter;
int32_t link_failure_interval_ticks;
int32_t link_failure_duration_ticks;
/*! Basic backbone delay */
double base_delay;
/*! Peak jitter in the backbone delay */
double max_jitter;
/*! Probability of packet loss in the backbone, in percent */
double prob_packet_loss;
/*! Probability of a packet going out of sequence in the backbone. */
double prob_oos;
/*! The latest packet arrival time seen on the link. */
double last_arrival_time;
double delay_delta;
/*! 3 seconds of predicted delays for the link */
double delays[3*G1050_TICKS_PER_SEC];
/*! A count of packets lost on the link. */
uint32_t lost_packets;
/*! An extra debug count of packets lost on the link. */
uint32_t lost_packets_2;
} g1050_core_state_t;
/*! The definition of an element in the packet queue */
typedef struct g1050_queue_element_s
{
struct g1050_queue_element_s *next;
struct g1050_queue_element_s *prev;
int seq_no;
double departure_time;
double arrival_time;
int len;
uint8_t pkt[];
} g1050_queue_element_t;
/*! The model definition for a complete end-to-end path */
typedef struct
{
int packet_rate;
int packet_size;
float base_time;
g1050_segment_state_t segment[4];
g1050_core_state_t core;
double arrival_times_1[3*G1050_TICKS_PER_SEC];
double arrival_times_2[3*G1050_TICKS_PER_SEC];
g1050_queue_element_t *first;
g1050_queue_element_t *last;
} g1050_state_t;
extern g1050_constants_t g1050_constants[1];
extern g1050_channel_speeds_t g1050_speed_patterns[168];
extern g1050_model_t g1050_standard_models[9];
#ifdef __cplusplus
extern "C"
{
#endif
SPAN_DECLARE(g1050_state_t *) g1050_init(int model,
int speed_pattern,
int packet_size,
int packet_rate);
SPAN_DECLARE(int) g1050_free(g1050_state_t *s);
SPAN_DECLARE(void) g1050_dump_parms(int model, int speed_pattern);
SPAN_DECLARE(int) g1050_put(g1050_state_t *s,
const uint8_t buf[],
int len,
int seq_no,
double departure_time);
SPAN_DECLARE(int) g1050_get(g1050_state_t *s,
uint8_t buf[],
int max_len,
double current_time,
int *seq_no,
double *departure_time,
double *arrival_time);
SPAN_DECLARE(void) g1050_queue_dump(g1050_state_t *s);
#ifdef __cplusplus
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/

View File

@ -1,177 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* line_model.h - Model a telephone line.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2004 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.
*/
/*! \file */
/*! \page line_model_page Telephone line model
\section line_model_page_sec_1 What does it do?
The telephone line modelling module provides simple modelling of one way and two
way telephone lines.
The path being modelled is:
- terminal
- | < hybrid echo (2-way models)
- |
- | < noise and filtering
- |
- | < hybrid echo (2-way models)
- CO
- |
- | < A-law distortion + bulk delay
- |
- CO
- | < hybrid echo (2-way models)
- |
- | < noise and filtering
- |
- | < hybrid echo (2-way models)
- terminal
*/
#if !defined(_SPANDSP_LINE_MODEL_H_)
#define _SPANDSP_LINE_MODEL_H_
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
#include <spandsp.h>
#define LINE_FILTER_SIZE 129
/*!
One way line model descriptor. This holds the complete state of
a line model with transmission in only one direction.
*/
typedef struct
{
codec_munge_state_t *munge;
/*! The coefficients for the near end analogue section simulation filter */
const float *near_filter;
/*! The number of coefficients for the near end analogue section simulation filter */
int near_filter_len;
/*! Last transmitted samples (ring buffer, used by the line filter) */
float near_buf[LINE_FILTER_SIZE];
/*! Pointer of the last transmitted sample in buf */
int near_buf_ptr;
/*! The noise source for local analogue section of the line */
awgn_state_t near_noise;
/*! The bulk delay of the path, in samples */
int bulk_delay;
/*! A pointer to the current write position in the bulk delay store. */
int bulk_delay_ptr;
/*! The data store for simulating the bulk delay */
int16_t bulk_delay_buf[8000];
/*! The coefficients for the far end analogue section simulation filter */
const float *far_filter;
/*! The number of coefficients for the far end analogue section simulation filter */
int far_filter_len;
/*! Last transmitted samples (ring buffer, used by the line filter) */
float far_buf[LINE_FILTER_SIZE];
/*! Pointer of the last transmitted sample in buf */
int far_buf_ptr;
/*! The noise source for distant analogue section of the line */
awgn_state_t far_noise;
/*! The scaling factor for the local CPE hybrid echo */
float near_cpe_hybrid_echo;
/*! The scaling factor for the local CO hybrid echo */
float near_co_hybrid_echo;
/*! The scaling factor for the far CPE hybrid echo */
float far_cpe_hybrid_echo;
/*! The scaling factor for the far CO hybrid echo */
float far_co_hybrid_echo;
/*! DC offset impairment */
float dc_offset;
/*! Mains pickup impairment */
int mains_interference;
tone_gen_state_t mains_tone;
} one_way_line_model_state_t;
/*!
Two way line model descriptor. This holds the complete state of
a line model with transmission in both directions.
*/
typedef struct
{
one_way_line_model_state_t line1;
one_way_line_model_state_t line2;
float fout1;
float fout2;
} both_ways_line_model_state_t;
#ifdef __cplusplus
extern "C"
{
#endif
SPAN_DECLARE_DATA extern const float *line_models[];
SPAN_DECLARE(void) both_ways_line_model(both_ways_line_model_state_t *s,
int16_t output1[],
const int16_t input1[],
int16_t output2[],
const int16_t input2[],
int samples);
SPAN_DECLARE(void) both_ways_line_model_set_dc(both_ways_line_model_state_t *s, float dc1, float dc2);
SPAN_DECLARE(void) both_ways_line_model_set_mains_pickup(both_ways_line_model_state_t *s, int f, float level1, float level2);
SPAN_DECLARE(both_ways_line_model_state_t *) both_ways_line_model_init(int model1,
float noise1,
float echo_level_cpe1,
float echo_level_co1,
int model2,
float noise2,
float echo_level_cpe2,
float echo_level_co2,
int codec,
int rbs_pattern);
SPAN_DECLARE(int) both_ways_line_model_free(both_ways_line_model_state_t *s);
SPAN_DECLARE(void) one_way_line_model(one_way_line_model_state_t *s,
int16_t output[],
const int16_t input[],
int samples);
SPAN_DECLARE(void) one_way_line_model_set_dc(one_way_line_model_state_t *s, float dc);
SPAN_DECLARE(void) one_way_line_model_set_mains_pickup(one_way_line_model_state_t *s, int f, float level);
SPAN_DECLARE(one_way_line_model_state_t *) one_way_line_model_init(int model, float noise, int codec, int rbs_pattern);
SPAN_DECLARE(int) one_way_line_model_free(one_way_line_model_state_t *s);
#ifdef __cplusplus
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/

View File

@ -1,61 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* line_model.h - Model a telephone line.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2004 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.
*/
/*! \file */
#if !defined(_SPANDSP_LINE_MODELS_H_)
#define _SPANDSP_LINE_MODELS_H_
extern float proakis_line_model[];
extern float ad_1_edd_1_model[];
extern float ad_1_edd_2_model[];
extern float ad_1_edd_3_model[];
extern float ad_5_edd_1_model[];
extern float ad_5_edd_2_model[];
extern float ad_5_edd_3_model[];
extern float ad_6_edd_1_model[];
extern float ad_6_edd_2_model[];
extern float ad_6_edd_3_model[];
extern float ad_7_edd_1_model[];
extern float ad_7_edd_2_model[];
extern float ad_7_edd_3_model[];
extern float ad_8_edd_1_model[];
extern float ad_8_edd_2_model[];
extern float ad_8_edd_3_model[];
extern float ad_9_edd_1_model[];
extern float ad_9_edd_2_model[];
extern float ad_9_edd_3_model[];
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/

View File

@ -1,97 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* rfc2198_sim.h - Simulate the behaviour of RFC2198 (or UDPTL) redundancy.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2007 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.
*/
/*! \file */
/*! \page rfc2198_model_page RFC2198 simulation
\section rfc2198_model_page_sec_1 What does it do?
*/
#if !defined(_RFC2198_SIM_H_)
#define _RFC2198_SIM_H_
/*! The definition of an element in the packet queue */
typedef struct rfc2198_sim_queue_element_s
{
struct rfc2198_sim_queue_element_s *next;
struct rfc2198_sim_queue_element_s *prev;
int seq_no;
double departure_time;
double arrival_time;
int len;
uint8_t pkt[];
} rfc2198_sim_queue_element_t;
/*! The model definition for a complete end-to-end path */
typedef struct
{
int redundancy_depth;
int next_seq_no;
g1050_state_t *g1050;
rfc2198_sim_queue_element_t *first;
rfc2198_sim_queue_element_t *last;
uint8_t tx_pkt[32][1024];
int tx_pkt_len[32];
int tx_pkt_seq_no[32];
int next_pkt;
uint8_t rx_pkt[32][1024];
int rx_pkt_len[32];
int rx_pkt_seq_no[32];
int rx_queued_pkts;
} rfc2198_sim_state_t;
#ifdef __cplusplus
extern "C"
{
#endif
SPAN_DECLARE(rfc2198_sim_state_t *) rfc2198_sim_init(int model,
int speed_pattern,
int packet_size,
int packet_rate,
int redundancy_depth);
SPAN_DECLARE(int) rfc2198_sim_free(rfc2198_sim_state_t *s);
SPAN_DECLARE(int) rfc2198_sim_put(rfc2198_sim_state_t *s,
const uint8_t buf[],
int len,
int seq_no,
double departure_time);
SPAN_DECLARE(int) rfc2198_sim_get(rfc2198_sim_state_t *s,
uint8_t buf[],
int max_len,
double current_time,
int *seq_no,
double *departure_time,
double *arrival_time);
#ifdef __cplusplus
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/

View File

@ -1,79 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* test_utils.h - Utility routines for module tests.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2006 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.
*/
/*! \file */
#if !defined(_TEST_UTILS_H_)
#define _TEST_UTILS_H_
#include <sndfile.h>
enum
{
MUNGE_CODEC_NONE = 0,
MUNGE_CODEC_ALAW,
MUNGE_CODEC_ULAW,
MUNGE_CODEC_G726_40K,
MUNGE_CODEC_G726_32K,
MUNGE_CODEC_G726_24K,
MUNGE_CODEC_G726_16K,
};
typedef struct codec_munge_state_s codec_munge_state_t;
typedef struct complexify_state_s complexify_state_t;
#ifdef __cplusplus
extern "C" {
#endif
SPAN_DECLARE(complexify_state_t *) complexify_init(void);
SPAN_DECLARE(int) complexify_free(complexify_state_t *s);
SPAN_DECLARE(complexf_t) complexify(complexify_state_t *s, int16_t amp);
SPAN_DECLARE(void) fft(complex_t data[], int len);
SPAN_DECLARE(void) ifft(complex_t data[], int len);
SPAN_DECLARE(codec_munge_state_t *) codec_munge_init(int codec, int info);
SPAN_DECLARE(int) codec_munge_free(codec_munge_state_t *s);
SPAN_DECLARE(void) codec_munge(codec_munge_state_t *s, int16_t amp[], int len);
SPAN_DECLARE(SNDFILE *) sf_open_telephony_read(const char *name, int channels);
SPAN_DECLARE(SNDFILE *) sf_open_telephony_write(const char *name, int channels);
SPAN_DECLARE(int) sf_close_telephony(SNDFILE *handle);
#ifdef __cplusplus
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/

View File

@ -1,475 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* test_utils.c - Utility routines for module tests.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2006 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
#include <stdio.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <time.h>
#include <fcntl.h>
#include <sndfile.h>
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
#include "spandsp.h"
#include "spandsp-sim.h"
#define MAX_FFT_LEN 8192
struct codec_munge_state_s
{
int munging_codec;
g726_state_t g726_enc_state;
g726_state_t g726_dec_state;
int rbs_pattern;
int sequence;
};
struct complexify_state_s
{
float history[128];
int ptr;
};
static complex_t circle[MAX_FFT_LEN/2];
static int circle_init = false;
static complex_t icircle[MAX_FFT_LEN/2];
static int icircle_init = false;
#define SF_MAX_HANDLE 32
static int sf_close_at_exit_registered = false;
static SNDFILE *sf_close_at_exit_list[SF_MAX_HANDLE] =
{
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
SPAN_DECLARE(complexify_state_t *) complexify_init(void)
{
complexify_state_t *s;
int i;
if ((s = (complexify_state_t *) malloc(sizeof(*s))))
{
s->ptr = 0;
for (i = 0; i < 128; i++)
s->history[i] = 0.0f;
}
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) complexify_free(complexify_state_t *s)
{
free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(complexf_t) complexify(complexify_state_t *s, int16_t amp)
{
#define HILBERT_GAIN 1.569546344
static const float hilbert_coeffs[] =
{
+0.0012698413f, +0.0013489483f,
+0.0015105196f, +0.0017620440f,
+0.0021112899f, +0.0025663788f,
+0.0031358856f, +0.0038289705f,
+0.0046555545f, +0.0056265487f,
+0.0067541562f, +0.0080522707f,
+0.0095370033f, +0.0112273888f,
+0.0131463382f, +0.0153219442f,
+0.0177892941f, +0.0205930381f,
+0.0237910974f, +0.0274601544f,
+0.0317040029f, +0.0366666667f,
+0.0425537942f, +0.0496691462f,
+0.0584802574f, +0.0697446887f,
+0.0847739823f, +0.1060495199f,
+0.1388940865f, +0.1971551103f,
+0.3316207267f, +0.9994281838f
};
float famp;
int i;
int j;
int k;
complexf_t res;
s->history[s->ptr] = amp;
i = s->ptr - 63;
if (i < 0)
i += 128;
res.re = s->history[i];
famp = 0.0f;
j = s->ptr - 126;
if (j < 0)
j += 128;
for (i = 0, k = s->ptr; i < 32; i++)
{
famp += (s->history[k] - s->history[j])*hilbert_coeffs[i];
j += 2;
if (j >= 128)
j -= 128;
k -= 2;
if (k < 0)
k += 128;
}
res.im = famp/HILBERT_GAIN;
if (++s->ptr >= 128)
s->ptr = 0;
return res;
}
/*- End of function --------------------------------------------------------*/
static __inline__ complex_t expj(double theta)
{
return complex_set(cos(theta), sin(theta));
}
/*- End of function --------------------------------------------------------*/
static void fftx(complex_t data[], complex_t temp[], int n)
{
int i;
int h;
int p;
int t;
int i2;
complex_t wkt;
if (n > 1)
{
h = n/2;
for (i = 0; i < h; i++)
{
i2 = i*2;
temp[i] = data[i2]; /* Even */
temp[h + i] = data[i2 + 1]; /* Odd */
}
fftx(&temp[0], &data[0], h);
fftx(&temp[h], &data[h], h);
p = 0;
t = MAX_FFT_LEN/n;
for (i = 0; i < h; i++)
{
wkt = complex_mul(&circle[p], &temp[h + i]);
data[i] = complex_add(&temp[i], &wkt);
data[h + i] = complex_sub(&temp[i], &wkt);
p += t;
}
}
}
/*- End of function --------------------------------------------------------*/
static void ifftx(complex_t data[], complex_t temp[], int n)
{
int i;
int h;
int p;
int t;
int i2;
complex_t wkt;
if (n > 1)
{
h = n/2;
for (i = 0; i < h; i++)
{
i2 = i*2;
temp[i] = data[i2]; /* Even */
temp[h + i] = data[i2 + 1]; /* Odd */
}
fftx(&temp[0], &data[0], h);
fftx(&temp[h], &data[h], h);
p = 0;
t = MAX_FFT_LEN/n;
for (i = 0; i < h; i++)
{
wkt = complex_mul(&icircle[p], &temp[h + i]);
data[i] = complex_add(&temp[i], &wkt);
data[h + i] = complex_sub(&temp[i], &wkt);
p += t;
}
}
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) fft(complex_t data[], int len)
{
int i;
double x;
complex_t temp[MAX_FFT_LEN];
/* A very slow and clunky FFT, that's just fine for tests. */
if (!circle_init)
{
for (i = 0; i < MAX_FFT_LEN/2; i++)
{
x = -(2.0*3.1415926535*i)/(double) MAX_FFT_LEN;
circle[i] = expj(x);
}
circle_init = true;
}
fftx(data, temp, len);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) ifft(complex_t data[], int len)
{
int i;
double x;
complex_t temp[MAX_FFT_LEN];
/* A very slow and clunky FFT, that's just fine for tests. */
if (!icircle_init)
{
for (i = 0; i < MAX_FFT_LEN/2; i++)
{
x = (2.0*3.1415926535*i)/(double) MAX_FFT_LEN;
icircle[i] = expj(x);
}
icircle_init = true;
}
ifftx(data, temp, len);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(codec_munge_state_t *) codec_munge_init(int codec, int info)
{
codec_munge_state_t *s;
if ((s = (codec_munge_state_t *) malloc(sizeof(*s))))
{
switch (codec)
{
case MUNGE_CODEC_G726_40K:
g726_init(&s->g726_enc_state, 40000, G726_ENCODING_LINEAR, G726_PACKING_NONE);
g726_init(&s->g726_dec_state, 40000, G726_ENCODING_LINEAR, G726_PACKING_NONE);
s->munging_codec = MUNGE_CODEC_G726_32K;
break;
case MUNGE_CODEC_G726_32K:
g726_init(&s->g726_enc_state, 32000, G726_ENCODING_LINEAR, G726_PACKING_NONE);
g726_init(&s->g726_dec_state, 32000, G726_ENCODING_LINEAR, G726_PACKING_NONE);
s->munging_codec = MUNGE_CODEC_G726_32K;
break;
case MUNGE_CODEC_G726_24K:
g726_init(&s->g726_enc_state, 24000, G726_ENCODING_LINEAR, G726_PACKING_NONE);
g726_init(&s->g726_dec_state, 24000, G726_ENCODING_LINEAR, G726_PACKING_NONE);
s->munging_codec = MUNGE_CODEC_G726_32K;
break;
case MUNGE_CODEC_G726_16K:
g726_init(&s->g726_enc_state, 16000, G726_ENCODING_LINEAR, G726_PACKING_NONE);
g726_init(&s->g726_dec_state, 16000, G726_ENCODING_LINEAR, G726_PACKING_NONE);
s->munging_codec = MUNGE_CODEC_G726_32K;
break;
default:
s->munging_codec = codec;
break;
}
s->sequence = 0;
s->rbs_pattern = info;
}
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) codec_munge_free(codec_munge_state_t *s)
{
free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) codec_munge(codec_munge_state_t *s, int16_t amp[], int len)
{
uint8_t law;
uint8_t adpcmdata[160];
int i;
int adpcm;
int x;
switch (s->munging_codec)
{
case MUNGE_CODEC_NONE:
/* Do nothing */
break;
case MUNGE_CODEC_ALAW:
for (i = 0; i < len; i++)
{
law = linear_to_alaw(amp[i]);
amp[i] = alaw_to_linear(law);
}
break;
case MUNGE_CODEC_ULAW:
for (i = 0; i < len; i++)
{
law = linear_to_ulaw(amp[i]);
if (s->rbs_pattern & (1 << s->sequence))
{
/* Strip the bottom bit at the RBS rate */
law &= 0xFE;
}
amp[i] = ulaw_to_linear(law);
}
break;
case MUNGE_CODEC_G726_32K:
/* This could actually be any of the G.726 rates */
for (i = 0; i < len; i += x)
{
x = (len - i >= 160) ? 160 : (len - i);
adpcm = g726_encode(&s->g726_enc_state, adpcmdata, amp + i, x);
g726_decode(&s->g726_dec_state, amp + i, adpcmdata, adpcm);
}
break;
}
}
/*- End of function --------------------------------------------------------*/
static void sf_close_at_exit(void)
{
int i;
for (i = 0; i < SF_MAX_HANDLE; i++)
{
if (sf_close_at_exit_list[i])
{
sf_close(sf_close_at_exit_list[i]);
sf_close_at_exit_list[i] = NULL;
}
}
}
/*- End of function --------------------------------------------------------*/
static int sf_record_handle(SNDFILE *handle)
{
int i;
for (i = 0; i < SF_MAX_HANDLE; i++)
{
if (sf_close_at_exit_list[i] == NULL)
break;
}
if (i >= SF_MAX_HANDLE)
return -1;
sf_close_at_exit_list[i] = handle;
if (!sf_close_at_exit_registered)
{
atexit(sf_close_at_exit);
sf_close_at_exit_registered = true;
}
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(SNDFILE *) sf_open_telephony_read(const char *name, int channels)
{
SNDFILE *handle;
SF_INFO info;
memset(&info, 0, sizeof(info));
if ((handle = sf_open(name, SFM_READ, &info)) == NULL)
{
fprintf(stderr, " Cannot open audio file '%s' for reading\n", name);
exit(2);
}
if (info.samplerate != SAMPLE_RATE)
{
printf(" Unexpected sample rate in audio file '%s'\n", name);
exit(2);
}
if (info.channels != channels)
{
printf(" Unexpected number of channels in audio file '%s'\n", name);
exit(2);
}
sf_record_handle(handle);
return handle;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(SNDFILE *) sf_open_telephony_write(const char *name, int channels)
{
SNDFILE *handle;
SF_INFO info;
memset(&info, 0, sizeof(info));
info.frames = 0;
info.samplerate = SAMPLE_RATE;
info.channels = channels;
info.format = SF_FORMAT_WAV | SF_FORMAT_PCM_16;
info.sections = 1;
info.seekable = 1;
if ((handle = sf_open(name, SFM_WRITE, &info)) == NULL)
{
fprintf(stderr, " Cannot open audio file '%s' for writing\n", name);
exit(2);
}
sf_record_handle(handle);
return handle;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) sf_close_telephony(SNDFILE *handle)
{
int res;
int i;
if ((res = sf_close(handle)) == 0)
{
for (i = 0; i < SF_MAX_HANDLE; i++)
{
if (sf_close_at_exit_list[i] == handle)
{
sf_close_at_exit_list[i] = NULL;
break;
}
}
}
return res;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

View File

@ -1,12 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: spandsp
Description: A DSP library for telephony.
Requires:
Version: @VERSION@
Libs: -L${libdir} -lspandsp
Libs.private: -ltiff -lm
Cflags: -I${includedir}

View File

@ -1,106 +0,0 @@
%global pre 21
Summary: A DSP library for telephony.
Name: spandsp
Version: 1.99.0
Release: 1
License: LGPLv2 and GPLv2
Group: System Environment/Libraries
URL: http://www.soft-switch.org/spandsp
Source: http://www.soft-switch.org/downloads/spandsp/spandsp-1.99.0.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libtiff-devel%{?_isa}
BuildRequires: libjpeg-turbo-devel%{?_isa}
BuildRequires: libxml2-devel%{?_isa}
BuildRequires: libsndfile-devel%{?_isa}
BuildRequires: doxygen
BuildRequires: libxslt
BuildRequires: docbook-style-xsl
%description
SpanDSP is a library of DSP functions for telephony, in the 8000
sample per second world of E1s, T1s, and higher order PCM channels. It
contains low level functions, such as basic filters. It also contains
higher level functions, such as cadenced supervisory tone detection,
and a complete software FAX machine. The software has been designed to
avoid intellectual property issues, using mature techniques where all
relevant patents have expired. See the file DueDiligence for important
information about these intellectual property issues.
%package devel
Summary: SpanDSP development files
Group: Development/Libraries
Requires: spandsp%{?_isa} = %{version}-%{release}
Requires: libtiff-devel%{?_isa}
Requires: libjpeg-turbo-devel%{?_isa}
%description devel
SpanDSP development files.
%package apidoc
Summary: SpanDSP API documentation
Group: Development/Libraries
%description apidoc
SpanDSP API documentation.
%prep
%setup -q
%build
%configure --enable-doc --disable-static --disable-rpath
make
find doc/api -type f | xargs touch -r configure
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
rm %{buildroot}%{_libdir}/libspandsp.la
mkdir -p %{buildroot}%{_datadir}/spandsp
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc DueDiligence ChangeLog AUTHORS COPYING NEWS README
%{_libdir}/libspandsp.so.*
%{_datadir}/spandsp
%files devel
%defattr(-,root,root,-)
%{_includedir}/spandsp.h
%{_includedir}/spandsp
%{_libdir}/libspandsp.so
%{_libdir}/pkgconfig/spandsp.pc
%files apidoc
%defattr(-,root,root,-)
%doc doc/api/html/*
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog
* Mon Oct 03 2011 Steve Underwood <steveu@coppice.org> 0.0.6-1
- Converge with what Fedora do
* Wed Sep 24 2008 Tzafrir Cohen <tzafrir.cohen@xorcom.com> 0.0.5-1
- Preparing for 0.0.5pre4 release
- License: LGPL
* Mon Jun 23 2008 Steve Underwood <steveu@coppice.org> 0.0.5-1
- Cleared out the dependency on libxml2
* Sun Dec 31 2006 Steve Underwood <steveu@coppice.org> 0.0.3-1
- Preparing for 0.0.3 release
* Sat Oct 16 2004 Steve Underwood <steveu@coppice.org> 0.0.2-1
- Preparing for 0.0.2 release
* Thu Apr 15 2004 Steve Underwood <steveu@coppice.org> 0.0.1-1
- Initial version

View File

@ -1,106 +0,0 @@
%global pre 21
Summary: A DSP library for telephony.
Name: @PACKAGE@
Version: @VERSION@
Release: 1
License: LGPLv2 and GPLv2
Group: System Environment/Libraries
URL: http://www.soft-switch.org/spandsp
Source: http://www.soft-switch.org/downloads/spandsp/@PACKAGE@-@VERSION@.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libtiff-devel%{?_isa}
BuildRequires: libjpeg-turbo-devel%{?_isa}
BuildRequires: libxml2-devel%{?_isa}
BuildRequires: libsndfile-devel%{?_isa}
BuildRequires: doxygen
BuildRequires: libxslt
BuildRequires: docbook-style-xsl
%description
SpanDSP is a library of DSP functions for telephony, in the 8000
sample per second world of E1s, T1s, and higher order PCM channels. It
contains low level functions, such as basic filters. It also contains
higher level functions, such as cadenced supervisory tone detection,
and a complete software FAX machine. The software has been designed to
avoid intellectual property issues, using mature techniques where all
relevant patents have expired. See the file DueDiligence for important
information about these intellectual property issues.
%package devel
Summary: SpanDSP development files
Group: Development/Libraries
Requires: spandsp%{?_isa} = %{version}-%{release}
Requires: libtiff-devel%{?_isa}
Requires: libjpeg-turbo-devel%{?_isa}
%description devel
SpanDSP development files.
%package apidoc
Summary: SpanDSP API documentation
Group: Development/Libraries
%description apidoc
SpanDSP API documentation.
%prep
%setup -q
%build
%configure --enable-doc --disable-static --disable-rpath
make
find doc/api -type f | xargs touch -r configure
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
rm %{buildroot}%{_libdir}/libspandsp.la
mkdir -p %{buildroot}%{_datadir}/spandsp
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc DueDiligence ChangeLog AUTHORS COPYING NEWS README
%{_libdir}/libspandsp.so.*
%{_datadir}/spandsp
%files devel
%defattr(-,root,root,-)
%{_includedir}/spandsp.h
%{_includedir}/spandsp
%{_libdir}/libspandsp.so
%{_libdir}/pkgconfig/spandsp.pc
%files apidoc
%defattr(-,root,root,-)
%doc doc/api/html/*
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog
* Mon Oct 03 2011 Steve Underwood <steveu@coppice.org> 0.0.6-1
- Converge with what Fedora do
* Wed Sep 24 2008 Tzafrir Cohen <tzafrir.cohen@xorcom.com> 0.0.5-1
- Preparing for 0.0.5pre4 release
- License: LGPL
* Mon Jun 23 2008 Steve Underwood <steveu@coppice.org> 0.0.5-1
- Cleared out the dependency on libxml2
* Sun Dec 31 2006 Steve Underwood <steveu@coppice.org> 0.0.3-1
- Preparing for 0.0.3 release
* Sat Oct 16 2004 Steve Underwood <steveu@coppice.org> 0.0.2-1
- Preparing for 0.0.2 release
* Thu Apr 15 2004 Steve Underwood <steveu@coppice.org> 0.0.1-1
- Initial version

View File

@ -1,58 +0,0 @@
<!-- FAX test scripts -->
<!ELEMENT fax-tests (config|messages|test-group)* >
<!ELEMENT config (path)* >
<!ELEMENT path (EMPTY)* >
<!ATTLIST path
type CDATA #REQUIRED
value CDATA #REQUIRED
>
<!ELEMENT messages (message)* >
<!ELEMENT message (EMPTY)* >
<!ATTLIST message
type CDATA #REQUIRED
value CDATA #REQUIRED
>
<!ELEMENT test-group (test)* >
<!ATTLIST test-group
name CDATA #IMPLIED
>
<!ELEMENT test (repeat|step)* >
<!ATTLIST test
name CDATA #IMPLIED
>
<!ELEMENT repeat (step)* >
<!ATTLIST repeat
min CDATA #IMPLIED
max CDATA #IMPLIED
>
<!ELEMENT step (check|EMPTY)* >
<!ATTLIST step
dir CDATA #IMPLIED
type CDATA #IMPLIED
modem CDATA #IMPLIED
tag CDATA #IMPLIED
value CDATA #IMPLIED
timein CDATA #IMPLIED
timeout CDATA #IMPLIED
crc_error CDATA #IMPLIED
pattern CDATA #IMPLIED
bad_rows CDATA #IMPLIED
min_bits CDATA #IMPLIED
frame_size CDATA #IMPLIED
compression CDATA #IMPLIED
block CDATA #IMPLIED
xxx CDATA #IMPLIED
>
<!ELEMENT check (EMPTY)* >
<!ATTLIST check
name CDATA #IMPLIED
desc CDATA #IMPLIED
cond CDATA #IMPLIED
>

View File

@ -1,707 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE fax-tests SYSTEM "./fax-tests.dtd">
<fax-tests>
<config>
<path type="IMAGE" value="../test-data/etsi/fax"/>
</config>
<messages>
<!-- TCF = 2700 bytes at 14400, 2250 at 12000, 1800 at 9600, 1350 at 7200, 900 at 4800 or 450 at 2400 -->
<!-- Bad TCF == 10101010.... -->
<!-- slow HDLC preamble == 37 flag bytes -->
<!-- slow HDLC inter-frame flag sequence == 1 flag byte -->
<!-- slow HDLC end flag sequence == 5 flag bytes -->
<!-- synchronisation sequence == 250ms of zeros. = 450 bytes at 14400, 375 at 12000, 300 at 9600, 225 at 7200, 150 at 4800 or 75 at 2400 -->
<!-- fast HDLC inter-frame flag sequence == 1 flag byte -->
<!-- fast HDLC end flag sequence == 10 flag bytes -->
<!-- STAIRSTEP image is 1728x1728 pixels. Its is about 15k, so an average of 68.2 bits per row. To
cook it as a 31k page requires a min_bits of 141. To cook it as a 63k page requires a min_bits of
286. To cook it as a 64k page requires a min_bits of 291 -->
</messages>
<test-group name="Supplementary">
<test name="PPS-MPS-lost-PPS">
<!-- Tester calls DUT and sends one 31k byte STAIRSTEP page and one 15k byte STAIRSTEP page. -->
<step type="CALL"/>
<!--<step dir="T" type="CNG"/>-->
<step dir="R" type="CED"/>
<step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 50 1F 30"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="TCF" modem="V.27ter/4800" value="900"/>
<step dir="R" type="HDLC" modem="V.21" tag="CFR" value="FF C8 21"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
<step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" min_bits="141"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-NULL" value="FF C8 7D 00 00 00 08"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
<step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 00 80 08"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
<!-- Repeat the last chunk, as though we missed the MCF -->
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
<step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 00 80 08"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
<step dir="T" type="PP" value="etsi_300_242_a4_white.tif"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 80 00 08"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DCN" value="FF C8 5F"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="T" type="CLEAR"/>
<step dir="R" type="CLEAR" timein="0" timeout="100"/>
<step type="STATUS" value="RX_DCNDATA"/>
</test>
<test name="V17-12000-V29-9600">
<!-- Tester calls, trying to provoke a crash seen in some versions of spandsp, when
an initial renegotiation to lower speed occurs for an ECM FAX -->
<step type="CALL"/>
<!--<step dir="T" type="CNG"/>-->
<step dir="R" type="CED"/>
<step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 54 1F 20"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="TCF" modem="V.17/12000" value="2250"/>
<step dir="R" type="HDLC" modem="V.21" tag="CFR" value="FF C8 21"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 60 1F 20"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="TCF" modem="V.29/9600" value="1800"/>
<step dir="R" type="HDLC" modem="V.21" tag="CFR" value="FF C8 21"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.29/9600"/>
<step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" frame_size="64" min_bits="141"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-NULL" value="FF C8 7D 00 00 00 08"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.29/9600"/>
<step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" frame_size="64"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 00 80 08"/>
<step dir="T" type="POSTAMBLE"/>
<repeat min="0">
<step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
<step dir="T" type="POSTAMBLE"/>
</repeat>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.29/9600"/>
<step dir="T" type="PP" value="etsi_300_242_a4_white.tif" frame_size="64"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 80 00 10"/>
<step dir="T" type="POSTAMBLE"/>
<repeat min="0">
<step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
<step dir="T" type="POSTAMBLE"/>
</repeat>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DCN" value="FF C8 5F"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="T" type="CLEAR"/>
<step dir="R" type="CLEAR" timein="0" timeout="100"/>
<step type="STATUS" value="OK"/>
</test>
<test name="Phase-D-collision">
<!-- DUT calls tester and sends 1 IMPRESS and 1 WHITE page. The MCF after the first
page is delayed enough to cause a collision with a retry of the MPS from the DUT. -->
<step type="ANSWER" value="etsi_300_242_a4_impress_white.tif"/>
<step dir="T" type="SET" tag="IDENT" value="+0123456789"/>
<step dir="R" type="CNG"/>
<step dir="T" type="CED"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DIS" value="FF C8 01 00 50 00"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="TSI+" value="FF C0 C2 9C 1C EC 6C AC 2C CC 4C 8C 0C D4 04 04 04 04 04 04 04 04 04 ..."/>
<step dir="R" type="HDLC" tag="DCS+" value="FF C8 C1 ..."/>
<step dir="R" type="TCF" modem="V.27ter/4800" timeout="60000"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="CFR" value="FF C8 21"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="MSG" modem="V.27ter/4800" timeout="180000"/>
<step dir="R" type="HDLC" modem="V.21" tag="MPS+" value="FF C8 F2"/>
<step type="WAIT" value="3500"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="MCF" value="FF C8 31"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="MSG" modem="V.27ter/4800" timeout="60000"/>
<step dir="R" type="HDLC" modem="V.21" tag="EOP+" value="FF C8 F4"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="MCF" value="FF C8 31"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="DCN+" value="FF C8 DF"/>
<step dir="R" type="CLEAR" timein="800" timeout="1200"/>
<step type="STATUS" value="OK"/>
</test>
<test name="Modem-change-at-CTC">
<!-- Similar test to TSB85/OREN03, but there is a modem change at the CTC -->
<!-- Tester calls DUT and sends one 15k byte STAIRSTEP page. -->
<step type="CALL"/>
<!--<step dir="T" type="CNG"/>-->
<step dir="R" type="CED"/>
<step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 60 1F 20"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="TCF" modem="V.29/9600" value="1800"/>
<step dir="R" type="HDLC" modem="V.21" tag="CFR" value="FF C8 21"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.29/9600"/>
<step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" frame_size="64" crc_error="0"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/>
<step dir="T" type="POSTAMBLE"/>
<repeat min="0">
<step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
<step dir="T" type="POSTAMBLE"/>
</repeat>
<step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.29/9600"/>
<step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" frame_size="64" crc_error="0"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/>
<step dir="T" type="POSTAMBLE"/>
<repeat min="0">
<step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
<step dir="T" type="POSTAMBLE"/>
</repeat>
<step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.29/9600"/>
<step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" frame_size="64" crc_error="0"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/>
<step dir="T" type="POSTAMBLE"/>
<repeat min="0">
<step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
<step dir="T" type="POSTAMBLE"/>
</repeat>
<step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.29/9600"/>
<step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" frame_size="64" crc_error="0"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 10"/>
<step dir="T" type="POSTAMBLE"/>
<repeat min="0">
<step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
<step dir="T" type="POSTAMBLE"/>
</repeat>
<step dir="R" type="HDLC" modem="V.21" tag="PPR" value="FF C8 3D 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 FF FF FF FF FF"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="CTC + V.27ter/4800" value="FF C8 48 00 10"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="CTR" value="FF C8 23"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
<step dir="T" type="PP" value="etsi_300_242_a4_stairstep.tif" frame_size="64"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 6B"/>
<step dir="T" type="POSTAMBLE"/>
<repeat min="0">
<step dir="R" type="HDLC" modem="V.21" tag="RNR" value="FF C8 37"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="RR" value="FF C8 76"/>
<step dir="T" type="POSTAMBLE"/>
</repeat>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DCN" value="FF C8 5F"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="T" type="CLEAR"/>
<step dir="R" type="CLEAR" timein="0" timeout="100"/>
<step type="STATUS" value="OK"/>
</test>
<test name="ECM-DCN-clipped">
<!-- Tester calls DUT and send a WHITE page. The find DCN is missing. -->
<step type="CALL"/>
<!--<step dir="T" type="CNG"/>-->
<step dir="R" type="CED"/>
<step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 50 1F 30"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="TCF" modem="V.27ter/4800" value="900"/>
<step dir="R" type="HDLC" modem="V.21" tag="CFR" value="FF C8 21"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.27ter/4800"/>
<step dir="T" type="PP" value="etsi_300_242_a4_white.tif" min_bits="141"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-EOP" value="FF C8 7D 74 00 00 08"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<repeat min="2" max="2">
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
</repeat>
<step dir="T" type="CLEAR"/>
<step dir="R" type="CLEAR" timein="0" timeout="100"/>
<step type="STATUS" value="OK"/>
</test>
<test name="Non-ECM-DCN-clipped">
<!-- Tester calls DUT and send a WHITE page. The find DCN is missing. -->
<step type="CALL"/>
<step dir="T" type="SET" tag="IDENT" value="+0123456789"/>
<!--<step dir="T" type="CNG"/>-->
<step dir="R" type="CED"/>
<step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 50 00"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="TCF" modem="V.27ter/4800" value="900"/>
<step dir="R" type="HDLC" modem="V.21" tag="CFR" value="FF C8 21"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="MSG" modem="V.27ter/4800" value="etsi_300_242_a4_white.tif"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="EOP" value="FF C8 74"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<repeat min="2" max="2">
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
</repeat>
<step dir="T" type="CLEAR"/>
<step dir="R" type="CLEAR" timein="0" timeout="100"/>
<step type="STATUS" value="OK"/>
</test>
<test name="Tx-EOP-echo">
<!-- DUT calls tester and sends 1 IMPRESS and 1 WHITE page. -->
<step type="ANSWER" value="etsi_300_242_a4_impress_white.tif"/>
<step dir="T" type="SET" tag="IDENT" value="+0123456789"/>
<step dir="R" type="CNG"/>
<step dir="T" type="CED"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DIS" value="FF C8 01 00 50 00"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="TSI+" value="FF C0 C2 9C 1C EC 6C AC 2C CC 4C 8C 0C D4 04 04 04 04 04 04 04 04 04 ..."/>
<step dir="R" type="HDLC" tag="DCS+" value="FF C8 C1 ..."/>
<step dir="R" type="TCF" modem="V.27ter/4800" timeout="60000"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="CFR" value="FF C8 21"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="MSG" modem="V.27ter/4800" timeout="180000"/>
<step dir="R" type="HDLC" modem="V.21" tag="MPS+" value="FF C8 F2"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="MCF" value="FF C8 31"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="MSG" modem="V.27ter/4800" timeout="60000"/>
<step dir="R" type="HDLC" modem="V.21" tag="EOP+" value="FF C8 F4"/>
<!-- Erroneous echo of EOP -->
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21" />
<step dir="T" type="HDLC" tag="EOP" value="FF C8 F4"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="MCF" value="FF C8 31"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="DCN+" value="FF C8 DF"/>
<step dir="R" type="CLEAR" timein="800" timeout="1200"/>
<step type="STATUS" value="OK"/>
</test>
<test name="Tx-PPS-echo">
<!-- DUT calls tester and sends 1 IMPRESS and 1 WHITE page. -->
<step type="ANSWER" value="etsi_300_242_a4_impress_white.tif"/>
<step dir="R" type="CNG"/>
<step dir="T" type="CED"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DIS" value="FF C8 01 00 50 1F 20"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="DCS+" value="FF C8 C1 ..."/>
<step dir="R" type="TCF" modem="V.27ter/4800" timeout="10000"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="CFR" value="FF C8 21"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="PP" modem="V.27ter/4800" frame_size="64" timeout="180000"/>
<step dir="R" type="HDLC" modem="V.21" tag="PPS-NULL+" value="FF C8 FD 00 ..."/>
<!-- Erroneous echo of PPS-NULL -->
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-NULL" value="FF C8 7D 00 00 00 FF"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="MCF" value="FF C8 31"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="PP" modem="V.27ter/4800" frame_size="64" timeout="180000"/>
<step dir="R" type="HDLC" modem="V.21" tag="PPS-MPS+" value="FF C8 FD F2 ..."/>
<!-- Erroneous echo of PPS-MPS -->
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="PPS-MPS" value="FF C8 7D 72 00 80 3B"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="MCF" value="FF C8 31"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="PP" modem="V.27ter/4800" frame_size="64" timeout="60000"/>
<step dir="R" type="HDLC" modem="V.21" tag="PPS-EOP+" value="FF C8 FD F4 ..."/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="MCF" value="FF C8 31"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="DCN+" value="FF C8 DF"/>
<step dir="R" type="CLEAR" timein="800" timeout="1200"/>
<step type="STATUS" value="OK"/>
</test>
<test name="Invalid-signalling-rate">
<step type="CALL"/>
<!--<step dir="T" type="CNG"/>-->
<step dir="R" type="CED"/>
<!-- Invalid signalling rate in DCS -->
<step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DCS" value="FF C8 C1 00 49 1f 00"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="DCN" value="FF C8 5F"/>
<step dir="R" type="SILENCE"/>
<step dir="R" type="CLEAR" timein="800" timeout="1200"/>
<step type="STATUS" value="OK"/>
</test>
<test name="No-caller-response">
<step type="CALL"/>
<step dir="T" type="SET" tag="IDENT" value="+0123456789"/>
<!--<step dir="T" type="CNG"/>-->
<step dir="R" type="CED"/>
<!-- -->
<step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>
<step dir="R" type="SILENCE"/>
<repeat min="5" max="5">
<step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..."/>
<step dir="R" type="SILENCE"/>
</repeat>
<step dir="R" type="HDLC" modem="V.21" tag="DCN" value="FF C8 5F"/>
<step dir="R" type="SILENCE"/>
<step dir="R" type="CLEAR" timein="800" timeout="1200"/>
<step type="STATUS" value="T1_EXPIRED"/>
</test>
<test name="No-answerer-response">
<step type="ANSWER" value="etsi_300_242_a4_impress_white.tif"/>
<step dir="T" type="SET" tag="IDENT" value="+0123456789"/>
<step dir="R" type="CNG"/>
<step type="WAIT" value="75"/>
<step dir="R" type="CLEAR" timein="55000" timeout="65000"/>
<step type="STATUS" value="T0_EXPIRED"/>
</test>
<test name="T1-after-EOM">
<!-- After an EOM exchange the far end no longer responds. -->
<step type="CALL" value="etsi_300_242_a4_white.tif"/>
<step dir="R" type="CED"/>
<step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DCS" value="FF C8 41 00 50 00"/>
<step dir="T" type="POSTAMBLE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="TCF" modem="V.27ter/4800" value="900"/>
<step dir="R" type="HDLC" modem="V.21" tag="CFR" value="FF C8 21"/>
<step dir="R" type="SILENCE"/>
<step type="WAIT" value="75"/>
<step dir="T" type="MSG" modem="V.27ter/4800" value="etsi_300_242_a4_white.tif"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="EOM" value="FF C8 71"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="MCF" value="FF C8 31"/>
<step dir="R" type="SILENCE"/>
<step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>
<step dir="R" type="SILENCE"/>
<repeat min="5" max="5">
<step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..."/>
<step dir="R" type="SILENCE"/>
</repeat>
<step dir="R" type="HDLC" modem="V.21" tag="DCN" value="FF C8 5F"/>
<step dir="R" type="SILENCE"/>
<step dir="R" type="CLEAR" timein="800" timeout="1200"/>
<step type="STATUS" value="T1_EXPIRED"/>
</test>
<test name="T1-after-EOMx">
<!-- After an EOM exchange the far end no longer responds. -->
<step type="ANSWER" value="etsi_300_242_a4_white.tif"/>
<step dir="R" type="CNG"/>
<step dir="T" type="CED"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="DIS" value="FF C8 01 00 50 00"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="R" type="HDLC" modem="V.21" tag="DCS+" value="FF C8 C1 00 ..."/>
<step dir="R" type="TCF" modem="V.27ter/4800" timeout="10000"/>
<step type="WAIT" value="75"/>
<step dir="T" type="PREAMBLE" modem="V.21"/>
<step dir="T" type="HDLC" tag="CFR" value="FF C8 21"/>
<step dir="T" type="POSTAMBLE"/>
<step dir="T" type="SET" tag="TXFILE" value="etsi_300_242_a4_white.tif"/>
<step dir="R" type="MSG" modem="V.27ter/4800" timeout="60000"/>
<step dir="R" type="HDLC" modem="V.21" tag="EOM" value="FF C8 F1"/>
<step type="WAIT" value="75"/>
<step dir="R" type="CLEAR" timein="55000" timeout="65000"/>
<step type="STATUS" value="T0_EXPIRED"/>
</test>
</test-group>
</fax-tests>

File diff suppressed because it is too large Load Diff

View File

@ -1,225 +0,0 @@
<!-- Global PSTN supervisory tones -->
<!ELEMENT global-tones (tone-set)* >
<!ELEMENT tone-set (dial-tone
|ringing-tone
|busy-tone
|congestion-tone
|number-unobtainable-tone
|special-information-tone
|call-waiting-tone
|waiting-tone
|pay-tone
|payphone-recognition-tone
|warning-tone
|test-number-tone
|end-of-three-party-service-tone
|service-activated-tone
|record-tone
|facilities-tone
|offering-tone
|route-tone
|confirmation-tone
|intrusion-tone
|intercept-tone
|reorder-tone
|holding-tone
|search-tone
|acceptance-tone
|executive-override-tone
|function-acknowledge-tone
|queue-tone
|valid-tone-radio-paging
|notify-tone
|preemption-tone
|comfort-tone
|connection-tone
|refusal-tone
|line-lockout-tone
|permanent-signal-tone
|identification-tone
|positive-indication-tone
|negative-indication-tone)* >
<!ATTLIST tone-set
country CDATA #REQUIRED
uncode CDATA #REQUIRED
>
<!-- Dialing tones -->
<!ELEMENT dial-tone (step)* >
<!ATTLIST dial-tone
domain CDATA #IMPLIED
type CDATA #IMPLIED
>
<!-- Post-dialing tones -->
<!ELEMENT ringing-tone (step)* >
<!ATTLIST ringing-tone
domain CDATA #IMPLIED
type CDATA #IMPLIED
>
<!-- Dial result tones -->
<!ELEMENT busy-tone (step)* >
<!ATTLIST busy-tone
domain CDATA #IMPLIED
>
<!ELEMENT congestion-tone (step)* >
<!ATTLIST congestion-tone
domain CDATA #IMPLIED
>
<!ELEMENT number-unobtainable-tone (step)* >
<!ATTLIST number-unobtainable-tone
domain CDATA #IMPLIED
>
<!ELEMENT special-information-tone (step)* >
<!ATTLIST special-information-tone
domain CDATA #IMPLIED
>
<!ELEMENT call-waiting-tone (step)* >
<!ATTLIST call-waiting-tone
domain CDATA #IMPLIED
type CDATA #IMPLIED
>
<!-- Payment related tones -->
<!ELEMENT pay-tone (step)* >
<!ATTLIST pay-tone
domain CDATA #IMPLIED
>
<!ELEMENT payphone-recognition-tone (step)* >
<!ATTLIST payphone-recognition-tone
domain CDATA #IMPLIED
>
<!ELEMENT warning-tone (step)* >
<!ATTLIST warning-tone
type CDATA #IMPLIED
domain CDATA #IMPLIED
>
<!ELEMENT reorder-tone (step)* >
<!ATTLIST reorder-tone
domain CDATA #IMPLIED
>
<!ELEMENT waiting-tone (step)* >
<!ATTLIST waiting-tone
domain CDATA #IMPLIED
>
<!ELEMENT test-number-tone (step)* >
<!ATTLIST test-number-tone
domain CDATA #IMPLIED
>
<!ELEMENT end-of-three-party-service-tone (step)* >
<!ATTLIST end-of-three-party-service-tone
domain CDATA #IMPLIED
>
<!ELEMENT service-activated-tone (step)* >
<!ATTLIST service-activated-tone
domain CDATA #IMPLIED
>
<!ELEMENT record-tone (step)* >
<!ATTLIST record-tone
domain CDATA #IMPLIED
>
<!ELEMENT facilities-tone (step)* >
<!ATTLIST facilities-tone
domain CDATA #IMPLIED
>
<!ELEMENT offering-tone (step)* >
<!ATTLIST offering-tone
domain CDATA #IMPLIED
>
<!ELEMENT route-tone (step)* >
<!ATTLIST route-tone
domain CDATA #IMPLIED
>
<!ELEMENT confirmation-tone (step)* >
<!ATTLIST confirmation-tone
domain CDATA #IMPLIED
>
<!ELEMENT intrusion-tone (step)* >
<!ATTLIST intrusion-tone
domain CDATA #IMPLIED
>
<!ELEMENT intercept-tone (step)* >
<!ATTLIST intercept-tone
domain CDATA #IMPLIED
>
<!ELEMENT holding-tone (step)* >
<!ATTLIST holding-tone
domain CDATA #IMPLIED
>
<!ELEMENT search-tone (step)* >
<!ATTLIST search-tone
domain CDATA #IMPLIED
>
<!ELEMENT acceptance-tone (step)* >
<!ATTLIST acceptance-tone
domain CDATA #IMPLIED
>
<!ELEMENT executive-override-tone (step)* >
<!ATTLIST executive-override-tone
domain CDATA #IMPLIED
>
<!ELEMENT function-acknowledge-tone (step)* >
<!ATTLIST function-acknowledge-tone
domain CDATA #IMPLIED
>
<!ELEMENT queue-tone (step)* >
<!ATTLIST queue-tone
domain CDATA #IMPLIED
>
<!ELEMENT valid-tone-radio-paging (step)* >
<!ATTLIST valid-tone-radio-paging
domain CDATA #IMPLIED
>
<!ELEMENT notify-tone (step)* >
<!ATTLIST notify-tone
domain CDATA #IMPLIED
>
<!ELEMENT preemption-tone (step)* >
<!ATTLIST preemption-tone
domain CDATA #IMPLIED
>
<!ELEMENT comfort-tone (step)* >
<!ATTLIST comfort-tone
domain CDATA #IMPLIED
>
<!ELEMENT connection-tone (step)* >
<!ATTLIST connection-tone
domain CDATA #IMPLIED
>
<!ELEMENT refusal-tone (step)* >
<!ATTLIST refusal-tone
domain CDATA #IMPLIED
>
<!ELEMENT line-lockout-tone (step)* >
<!ATTLIST line-lockout-tone
domain CDATA #IMPLIED
>
<!ELEMENT permanent-signal-tone (step)* >
<!ATTLIST permanent-signal-tone
domain CDATA #IMPLIED
>
<!ELEMENT identification-tone (step)* >
<!ATTLIST identification-tone
domain CDATA #IMPLIED
>
<!ELEMENT positive-indication-tone (step)* >
<!ATTLIST positive-indication-tone
domain CDATA #IMPLIED
>
<!ELEMENT negative-indication-tone (step)* >
<!ATTLIST negative-indication-tone
domain CDATA #IMPLIED
>
<!ELEMENT step (step|EMPTY)* >
<!ATTLIST step
cycles CDATA #IMPLIED
freq CDATA #IMPLIED
level CDATA #IMPLIED
length CDATA #IMPLIED
recorded-announcement CDATA #IMPLIED
recognition-length CDATA #IMPLIED
>

File diff suppressed because it is too large Load Diff

View File

@ -1,582 +0,0 @@
##
## SpanDSP - a series of DSP components for telephony
##
## Makefile.am - Process this file with automake to produce Makefile.in
##
## 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.
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
DISTCLEANFILES = $(srcdir)/at_interpreter_dictionary.h \
$(srcdir)/cielab_luts.h \
$(srcdir)/math_fixed_tables.h \
$(srcdir)/v17_v32bis_rx_rrc.h \
$(srcdir)/v17_v32bis_tx_rrc.h \
$(srcdir)/v22bis_rx_1200_rrc.h \
$(srcdir)/v22bis_rx_2400_rrc.h \
$(srcdir)/v22bis_tx_rrc.h \
$(srcdir)/v27ter_rx_2400_rrc.h \
$(srcdir)/v27ter_rx_4800_rrc.h \
$(srcdir)/v27ter_tx_2400_rrc.h \
$(srcdir)/v27ter_tx_4800_rrc.h \
$(srcdir)/v29rx_rrc.h \
$(srcdir)/v29tx_rrc.h
CLEANFILES = ${DISTCLEANFILES}
MOSTLYCLEANFILES = ${DISTCLEANFILES}
MAINTAINERCLEANFILES = ${DISTCLEANFILES}
EXTRA_DIST = floating_fudge.h \
libspandsp.2005.sln \
libspandsp.2008.sln \
libspandsp.2005.vcproj \
libspandsp.2008.vcproj \
libspandsp.2010.vcproj \
libspandsp.2012.vcxproj \
libtiff.2005.vcproj \
libtiff.2008.vcproj \
filter_tools.c \
make_at_dictionary.c \
make_cielab_luts.c \
make_math_fixed_tables.c \
make_modem_filter.c \
make_t43_gray_code_tables.c \
msvc/config.h \
msvc/Download_TIFF.2005.vcproj \
msvc/Download_TIFF.2008.vcproj \
msvc/getopt.c \
msvc/gettimeofday.c \
msvc/inttypes.h \
msvc/make_at_dictionary.2005.vcproj \
msvc/make_at_dictionary.2008.vcproj \
msvc/make_modem_filter.2005.vcproj \
msvc/make_modem_filter.2008.vcproj \
msvc/msvcproj.head \
msvc/msvcproj.foot \
msvc/spandsp.h \
msvc/tgmath.h \
msvc/tiff/cleancount \
msvc/unistd.h \
msvc/util.vbs \
msvc/vc8proj.foot \
msvc/vc8proj.head \
msvc/vc9proj.foot \
msvc/vc9proj.head \
msvc/vc10proj.foot \
msvc/vc10proj.head \
msvc/vc12proj.foot \
msvc/vc12proj.head \
msvc/sys/time.h \
spandsp/private/README \
spandsp/version.h.in
AM_CPPFLAGS = -I$(top_builddir)
lib_LTLIBRARIES = libspandsp.la
if COND_V32BIS
V32BIS_SOURCES = v32bis.c
endif
if COND_V34
V34_SOURCES = v34rx.c \
v34tx.c \
v34_logging.c
endif
libspandsp_la_SOURCES = ademco_contactid.c \
adsi.c \
alloc.c \
async.c \
at_interpreter.c \
awgn.c \
bell_r2_mf.c \
bert.c \
bit_operations.c \
bitstream.c \
complex_filters.c \
complex_vector_float.c \
complex_vector_int.c \
crc.c \
data_modems.c \
dds_float.c \
dds_int.c \
dtmf.c \
echo.c \
fax.c \
fax_modems.c \
fsk.c \
g711.c \
g722.c \
g726.c \
gsm0610_decode.c \
gsm0610_encode.c \
gsm0610_long_term.c \
gsm0610_lpc.c \
gsm0610_preprocess.c \
gsm0610_rpe.c \
gsm0610_short_term.c \
hdlc.c \
ima_adpcm.c \
image_translate.c \
logging.c \
lpc10_analyse.c \
lpc10_decode.c \
lpc10_encode.c \
lpc10_placev.c \
lpc10_voicing.c \
math_fixed.c \
modem_echo.c \
modem_connect_tones.c \
noise.c \
oki_adpcm.c \
playout.c \
plc.c \
power_meter.c \
queue.c \
schedule.c \
sig_tone.c \
silence_gen.c \
super_tone_rx.c \
super_tone_tx.c \
swept_tone.c \
t30.c \
t30_api.c \
t30_logging.c \
t31.c \
t35.c \
t38_core.c \
t38_gateway.c \
t38_non_ecm_buffer.c \
t38_terminal.c \
t4_t6_decode.c \
t4_t6_encode.c \
t4_rx.c \
t4_tx.c \
t42.c \
t43.c \
t81_t82_arith_coding.c \
t85_decode.c \
t85_encode.c \
testcpuid.c \
time_scale.c \
timezone.c \
tone_detect.c \
tone_generate.c \
v17rx.c \
v17tx.c \
v18.c \
v22bis_rx.c \
v22bis_tx.c \
v27ter_rx.c \
v27ter_tx.c \
v29rx.c \
v29tx.c \
v42.c \
v42bis.c \
v8.c \
vector_float.c \
vector_int.c \
$(V32BIS_SOURCES) \
$(V34_SOURCES)
libspandsp_la_LDFLAGS = -version-info @SPANDSP_LT_CURRENT@:@SPANDSP_LT_REVISION@:@SPANDSP_LT_AGE@ $(COMP_VENDOR_LDFLAGS)
nobase_include_HEADERS = spandsp/ademco_contactid.h \
spandsp/adsi.h \
spandsp/alloc.h \
spandsp/async.h \
spandsp/arctan2.h \
spandsp/at_interpreter.h \
spandsp/awgn.h \
spandsp/bell_r2_mf.h \
spandsp/bert.h \
spandsp/biquad.h \
spandsp/bit_operations.h \
spandsp/bitstream.h \
spandsp/crc.h \
spandsp/complex.h \
spandsp/complex_filters.h \
spandsp/complex_vector_float.h \
spandsp/complex_vector_int.h \
spandsp/data_modems.h \
spandsp/dc_restore.h \
spandsp/dds.h \
spandsp/dtmf.h \
spandsp/echo.h \
spandsp/fast_convert.h \
spandsp/fax.h \
spandsp/fax_modems.h \
spandsp/fir.h \
spandsp/fsk.h \
spandsp/g168models.h \
spandsp/g711.h \
spandsp/g722.h \
spandsp/g726.h \
spandsp/gsm0610.h \
spandsp/hdlc.h \
spandsp/ima_adpcm.h \
spandsp/image_translate.h \
spandsp/logging.h \
spandsp/lpc10.h \
spandsp/math_fixed.h \
spandsp/modem_echo.h \
spandsp/modem_connect_tones.h \
spandsp/noise.h \
spandsp/oki_adpcm.h \
spandsp/playout.h \
spandsp/plc.h \
spandsp/power_meter.h \
spandsp/queue.h \
spandsp/saturated.h \
spandsp/schedule.h \
spandsp/stdbool.h \
spandsp/sig_tone.h \
spandsp/silence_gen.h \
spandsp/super_tone_rx.h \
spandsp/super_tone_tx.h \
spandsp/swept_tone.h \
spandsp/t30.h \
spandsp/t30_api.h \
spandsp/t30_fcf.h \
spandsp/t30_logging.h \
spandsp/t31.h \
spandsp/t35.h \
spandsp/t38_core.h \
spandsp/t38_gateway.h \
spandsp/t38_non_ecm_buffer.h \
spandsp/t38_terminal.h \
spandsp/t4_rx.h \
spandsp/t4_tx.h \
spandsp/t4_t6_decode.h \
spandsp/t4_t6_encode.h \
spandsp/t42.h \
spandsp/t43.h \
spandsp/t81_t82_arith_coding.h \
spandsp/t85.h \
spandsp/telephony.h \
spandsp/time_scale.h \
spandsp/timezone.h \
spandsp/timing.h \
spandsp/tone_detect.h \
spandsp/tone_generate.h \
spandsp/v17rx.h \
spandsp/v17tx.h \
spandsp/v18.h \
spandsp/v22bis.h \
spandsp/v27ter_rx.h \
spandsp/v27ter_tx.h \
spandsp/v29rx.h \
spandsp/v29tx.h \
spandsp/v42.h \
spandsp/v42bis.h \
spandsp/v8.h \
spandsp/vector_float.h \
spandsp/vector_int.h \
spandsp/version.h \
spandsp/private/ademco_contactid.h \
spandsp/private/adsi.h \
spandsp/private/async.h \
spandsp/private/at_interpreter.h \
spandsp/private/awgn.h \
spandsp/private/bell_r2_mf.h \
spandsp/private/bert.h \
spandsp/private/bitstream.h \
spandsp/private/data_modems.h \
spandsp/private/dtmf.h \
spandsp/private/echo.h \
spandsp/private/fax.h \
spandsp/private/fax_modems.h \
spandsp/private/fsk.h \
spandsp/private/g711.h \
spandsp/private/g722.h \
spandsp/private/g726.h \
spandsp/private/gsm0610.h \
spandsp/private/hdlc.h \
spandsp/private/ima_adpcm.h \
spandsp/private/image_translate.h \
spandsp/private/logging.h \
spandsp/private/lpc10.h \
spandsp/private/modem_connect_tones.h \
spandsp/private/modem_echo.h \
spandsp/private/noise.h \
spandsp/private/oki_adpcm.h \
spandsp/private/playout.h \
spandsp/private/plc.h \
spandsp/private/power_meter.h \
spandsp/private/queue.h \
spandsp/private/schedule.h \
spandsp/private/sig_tone.h \
spandsp/private/silence_gen.h \
spandsp/private/super_tone_rx.h \
spandsp/private/super_tone_tx.h \
spandsp/private/swept_tone.h \
spandsp/private/t30.h \
spandsp/private/t30_dis_dtc_dcs_bits.h \
spandsp/private/t31.h \
spandsp/private/t38_core.h \
spandsp/private/t38_gateway.h \
spandsp/private/t38_non_ecm_buffer.h \
spandsp/private/t38_terminal.h \
spandsp/private/t4_rx.h \
spandsp/private/t4_tx.h \
spandsp/private/t4_t6_decode.h \
spandsp/private/t4_t6_encode.h \
spandsp/private/t42.h \
spandsp/private/t43.h \
spandsp/private/t81_t82_arith_coding.h \
spandsp/private/t85.h \
spandsp/private/time_scale.h \
spandsp/private/timezone.h \
spandsp/private/tone_detect.h \
spandsp/private/tone_generate.h \
spandsp/private/v17rx.h \
spandsp/private/v17tx.h \
spandsp/private/v18.h \
spandsp/private/v22bis.h \
spandsp/private/v27ter_rx.h \
spandsp/private/v27ter_tx.h \
spandsp/private/v29rx.h \
spandsp/private/v29tx.h \
spandsp/private/v42.h \
spandsp/private/v42bis.h \
spandsp/private/v8.h \
spandsp/expose.h
nodist_include_HEADERS = spandsp.h
noinst_HEADERS = cielab_luts.h \
faxfont.h \
filter_tools.h \
gsm0610_local.h \
lpc10_encdecs.h \
mmx_sse_decs.h \
t30_local.h \
t4_t6_decode_states.h \
t42_t43_local.h \
v17_v32bis_rx_constellation_maps.h \
v17_v32bis_tx_constellation_maps.h \
v29tx_constellation_maps.h
make_at_dictionary$(EXEEXT): $(top_srcdir)/src/make_at_dictionary.c
$(CC_FOR_BUILD) -o make_at_dictionary$(EXEEXT) $(top_srcdir)/src/make_at_dictionary.c -DHAVE_CONFIG_H -I$(top_builddir)/src
make_cielab_luts$(EXEEXT): $(top_srcdir)/src/make_cielab_luts.c
$(CC_FOR_BUILD) -o make_cielab_luts$(EXEEXT) $(top_srcdir)/src/make_cielab_luts.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm
make_math_fixed_tables$(EXEEXT): $(top_srcdir)/src/make_math_fixed_tables.c
$(CC_FOR_BUILD) -o make_math_fixed_tables$(EXEEXT) $(top_srcdir)/src/make_math_fixed_tables.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm
make_modem_filter$(EXEEXT): $(top_srcdir)/src/make_modem_filter.c $(top_srcdir)/src/filter_tools.c
$(CC_FOR_BUILD) -o make_modem_filter$(EXEEXT) $(top_srcdir)/src/make_modem_filter.c $(top_srcdir)/src/filter_tools.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm
make_t43_gray_code_tables$(EXEEXT): $(top_srcdir)/src/make_t43_gray_code_tables.c
$(CC_FOR_BUILD) -o make_t43_gray_code_tables$(EXEEXT) $(top_srcdir)/src/make_t43_gray_code_tables.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm
# We need to run make_at_dictionary, so it generates the
# at_interpreter_dictionary.h file
at_interpreter.$(OBJEXT): at_interpreter_dictionary.h
at_interpreter.lo: at_interpreter_dictionary.h
at_interpreter_dictionary.h: make_at_dictionary$(EXEEXT)
./make_at_dictionary$(EXEEXT) >at_interpreter_dictionary.h
math_fixed.$(OBJEXT): math_fixed_tables.h
math_fixed.lo: math_fixed_tables.h
math_fixed_tables.h: make_math_fixed_tables$(EXEEXT)
./make_math_fixed_tables$(EXEEXT) >math_fixed_tables.h
t4_rx.$(OBJEXT): spandsp/version.h
t4_rx.lo: spandsp/version.h
t42.$(OBJEXT): cielab_luts.h
t42.lo: cielab_luts.h
cielab_luts.h: make_cielab_luts$(EXEEXT)
./make_cielab_luts$(EXEEXT) >cielab_luts.h
t43.lo: t43_gray_code_tables.h
t43_gray_code_tables.h: make_t43_gray_code_tables$(EXEEXT)
./make_t43_gray_code_tables$(EXEEXT) >t43_gray_code_tables.h
V17_V32BIS_RX_INCL = v17_v32bis_rx_rrc.h
v17rx.$(OBJEXT): ${V17_V32BIS_RX_INCL}
v17rx.lo: ${V17_V32BIS_RX_INCL}
v17_v32bis_rx_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.17 -r >v17_v32bis_rx_rrc.h
V17_V32BIS_TX_INCL = v17_v32bis_tx_rrc.h
v17tx.$(OBJEXT): ${V17_V32BIS_TX_INCL}
v17tx.lo: ${V17_V32BIS_TX_INCL}
v17_v32bis_tx_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.17 -t >v17_v32bis_tx_rrc.h
V22BIS_RX_INCL = v22bis_rx_1200_rrc.h \
v22bis_rx_2400_rrc.h
v22bis_rx.$(OBJEXT): ${V22BIS_RX_INCL}
v22bis_rx.lo: ${V22BIS_RX_INCL}
v22bis_rx_1200_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.22bis1200 -r >v22bis_rx_1200_rrc.h
v22bis_rx_2400_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.22bis2400 -r >v22bis_rx_2400_rrc.h
V22BIS_TX_INCL = v22bis_tx_rrc.h
v22bis_tx.$(OBJEXT): ${V22BIS_TX_INCL}
v22bis_tx.lo: ${V22BIS_TX_INCL}
v22bis_tx_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.22bis -t >v22bis_tx_rrc.h
V27_RX_INCL = v27ter_rx_2400_rrc.h \
v27ter_rx_4800_rrc.h
v27ter_rx.$(OBJEXT): ${V27_RX_INCL}
v27ter_rx.lo: ${V27_RX_INCL}
v27ter_rx_2400_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.27ter2400 -r >v27ter_rx_2400_rrc.h
v27ter_rx_4800_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.27ter4800 -r >v27ter_rx_4800_rrc.h
V27TER_TX_INCL = v27ter_tx_2400_rrc.h \
v27ter_tx_4800_rrc.h
v27ter_tx_.$(OBJEXT): ${V27TER_TX_INCL}
v27ter_tx.lo: ${V27TER_TX_INCL}
v27ter_tx_2400_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.27ter2400 -t >v27ter_tx_2400_rrc.h
v27ter_tx_4800_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.27ter4800 -t >v27ter_tx_4800_rrc.h
V29_RX_INCL = v29rx_rrc.h
v29rx.$(OBJEXT): ${V29_RX_INCL}
v29rx.lo: ${V29_RX_INCL}
v29rx_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.29 -r >v29rx_rrc.h
V29_TX_INCL = v29tx_rrc.h
v29tx.$(OBJEXT): ${V29_TX_INCL}
v29tx.lo: ${V29_TX_INCL}
v29tx_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.29 -t >v29tx_rrc.h
VCPROJ8 = libspandsp.2005.vcproj
VCPROJ9 = libspandsp.2008.vcproj
VCPROJ10 = libspandsp.2010.vcproj
VCPROJ12 = libspandsp.2012.vcxproj
WIN32SOURCES = $(libspandsp_la_SOURCES) .\\msvc\\gettimeofday.c
WIN32HEADERS = $(nobase_include_HEADERS) spandsp.h
VCPROJOUT8 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ8)
VCPROJOUT9 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ9)
VCPROJOUT10 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ10)
VCPROJOUT12 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ12)
$(VCPROJ8): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am
echo "creating $(VCPROJ8)"
@(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ8); \
for file in $(WIN32SOURCES); do \
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT8); \
done; \
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT8); \
for file in $(WIN32HEADERS); do \
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT8); \
done; \
cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT8) )
$(VCPROJ9): msvc/vc9proj.head msvc/vc9proj.foot Makefile.am
echo "creating $(VCPROJ9)"
@(cp $(srcdir)/msvc/vc9proj.head $(VCPROJ9); \
for file in $(WIN32SOURCES); do \
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT9); \
done; \
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT9); \
for file in $(WIN32HEADERS); do \
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT9); \
done; \
cat $(srcdir)/msvc/vc9proj.foot $(VCPROJOUT9) )
$(VCPROJ10): msvc/vc10proj.head msvc/vc10proj.foot Makefile.am
echo "creating $(VCPROJ10)"
@(cp $(srcdir)/msvc/vc10proj.head $(VCPROJ10); \
for file in $(WIN32SOURCES); do \
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT10); \
done; \
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT10); \
for file in $(WIN32HEADERS); do \
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT10); \
done; \
cat $(srcdir)/msvc/vc10proj.foot $(VCPROJOUT10) )
$(VCPROJ12): msvc/vc12proj.head msvc/vc12proj.foot Makefile.am
echo "creating $(VCPROJ12)"
@(cp $(srcdir)/msvc/vc12proj.head $(VCPROJ12); \
for file in $(WIN32SOURCES); do \
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT12); \
done; \
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT12); \
for file in $(WIN32HEADERS); do \
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT12); \
done; \
cat $(srcdir)/msvc/vc12proj.foot $(VCPROJOUT12) )
$(srcdir)/msvc/spandsp.h: spandsp.h.in
echo "creating $(srcdir)/msvc/spandsp.h"
@sed -e "s/#define _SPANDSP_H_/#define _SPANDSP_H_\n\n#define __inline__ __inline\n#pragma warning(disable:4200)/" \
-e "s/\@SPANDSP_USE_FIXED_POINT\@/#undef SPANDSP_USE_FIXED_POINT/" \
-e "s/\@SPANDSP_MISALIGNED_ACCESS_FAILS\@/#undef SPANDSP_MISALIGNED_ACCESS_FAILS/" \
-e "s/\@SPANDSP_USE_EXPORT_CAPABILITY\@/#define SPANDSP_USE_EXPORT_CAPABILITY 1/" \
-e "s/\@INSERT_INTTYPES_HEADER\@/#include <msvc\/inttypes.h>/" \
-e "s/\@INSERT_MATH_HEADER\@/#include <math.h>/" $(srcdir)/spandsp.h.in > $(srcdir)/msvc/spandsp.h
dist-hook: spandsp/version.h
spandsp/version.h:
mkdir -p $(@D)
NOWDATE=`date --utc +"%Y%m%d"` ; \
NOWTIME=`date --utc +"%H%M%S"` ; \
sed 's/$$SPANDSP_RELEASE_DATE/'$$NOWDATE'/;s/$$SPANDSP_RELEASE_TIME/'$$NOWTIME'/' \
<$(srcdir)/spandsp/version.h.in >$@

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,175 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* alloc.c - memory allocation handling.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2013 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.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <limits.h>
#include <stdio.h>
#include <stdarg.h>
#include <fcntl.h>
#if !defined(__USE_ISOC11)
#define __USE_ISOC11
#endif
#if defined(__ISO_C_VISIBLE) && __ISO_C_VISIBLE < 2011
#undef __ISO_C_VISIBLE
#define __ISO_C_VISIBLE 2011
#endif
#include <stdlib.h>
#if defined(HAVE_MALLOC_H) && !defined(__OpenBSD__) && !defined(__DragonFly__)
#include <malloc.h>
#endif
#include <inttypes.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <sys/time.h>
#include <time.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4232) /* address of dllimport is not static, identity not guaranteed */
#endif
#if defined(HAVE_ALIGNED_ALLOC)
static span_aligned_alloc_t __span_aligned_alloc = aligned_alloc;
static span_aligned_free_t __span_aligned_free = free;
#elif defined(HAVE_MEMALIGN)
static span_aligned_alloc_t __span_aligned_alloc = memalign;
static span_aligned_free_t __span_aligned_free = free;
#elif defined(__MSVC__)
static void *fake_aligned_alloc(size_t alignment, size_t size);
static span_aligned_alloc_t __span_aligned_alloc = fake_aligned_alloc;
static span_aligned_free_t __span_aligned_free = _aligned_free;
#else
static void *fake_aligned_alloc(size_t alignment, size_t size);
static span_aligned_alloc_t __span_aligned_alloc = fake_aligned_alloc;
static span_aligned_free_t __span_aligned_free = free;
#endif
static span_alloc_t __span_alloc = malloc;
static span_realloc_t __span_realloc = realloc;
static span_free_t __span_free = free;
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#if defined(HAVE_ALIGNED_ALLOC)
#elif defined(HAVE_MEMALIGN)
#elif defined(__MSVC__)
static void *fake_aligned_alloc(size_t alignment, size_t size)
{
/* Make Microsoft's _aligned_malloc() look like the C11 aligned_alloc */
return _aligned_malloc(size, alignment);
}
/*- End of function --------------------------------------------------------*/
#elif defined(HAVE_POSIX_MEMALIGN)
static void *fake_aligned_alloc(size_t alignment, size_t size)
{
void *ptr;
/* Make posix_memalign() look like the C11 aligned_alloc */
posix_memalign(&ptr, alignment, size);
return ptr;
}
/*- End of function --------------------------------------------------------*/
#else
static void *fake_aligned_alloc(size_t alignment, size_t size)
{
return malloc(size);
}
/*- End of function --------------------------------------------------------*/
#endif
SPAN_DECLARE(void *) span_alloc(size_t size)
{
return __span_alloc(size);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void *) span_realloc(void *ptr, size_t size)
{
return __span_realloc(ptr, size);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) span_free(void *ptr)
{
__span_free(ptr);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void *) span_aligned_alloc(size_t alignment, size_t size)
{
return __span_aligned_alloc(alignment, size);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) span_aligned_free(void *ptr)
{
__span_aligned_free(ptr);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) span_mem_allocators(span_alloc_t custom_alloc,
span_realloc_t custom_realloc,
span_free_t custom_free,
span_aligned_alloc_t custom_aligned_alloc,
span_aligned_free_t custom_aligned_free)
{
__span_alloc = (custom_alloc) ? custom_alloc : malloc;
__span_realloc = (custom_realloc) ? custom_realloc : realloc;
__span_free = (custom_free) ? custom_free : free;
__span_aligned_alloc = (custom_aligned_alloc)
?
custom_aligned_alloc
:
#if defined(HAVE_ALIGNED_ALLOC)
aligned_alloc;
#elif defined(HAVE_MEMALIGN)
memalign;
#else
fake_aligned_alloc;
#endif
__span_aligned_free = (custom_aligned_free)
?
custom_aligned_free
:
#if defined(__MSVC__)
_aligned_free;
#else
free;
#endif
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

View File

@ -1,318 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* async.c - Asynchronous serial bit stream encoding and decoding
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2003 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.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bit_operations.h"
#include "spandsp/async.h"
#include "spandsp/private/async.h"
SPAN_DECLARE(const char *) signal_status_to_str(int status)
{
switch (status)
{
case SIG_STATUS_CARRIER_DOWN:
return "Carrier down";
case SIG_STATUS_CARRIER_UP:
return "Carrier up";
case SIG_STATUS_TRAINING_IN_PROGRESS:
return "Training in progress";
case SIG_STATUS_TRAINING_SUCCEEDED:
return "Training succeeded";
case SIG_STATUS_TRAINING_FAILED:
return "Training failed";
case SIG_STATUS_FRAMING_OK:
return "Framing OK";
case SIG_STATUS_END_OF_DATA:
return "End of data";
case SIG_STATUS_ABORT:
return "Abort";
case SIG_STATUS_BREAK:
return "Break";
case SIG_STATUS_SHUTDOWN_COMPLETE:
return "Shutdown complete";
case SIG_STATUS_OCTET_REPORT:
return "Octet report";
case SIG_STATUS_POOR_SIGNAL_QUALITY:
return "Poor signal quality";
case SIG_STATUS_MODEM_RETRAIN_OCCURRED:
return "Modem retrain occurred";
case SIG_STATUS_LINK_CONNECTED:
return "Link connected";
case SIG_STATUS_LINK_DISCONNECTED:
return "Link disconnected";
case SIG_STATUS_LINK_ERROR:
return "Link error";
case SIG_STATUS_LINK_IDLE:
return "Link idle";
}
/*endswitch*/
return "???";
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) async_rx_put_bit(void *user_data, int bit)
{
async_rx_state_t *s;
s = (async_rx_state_t *) user_data;
if (bit < 0)
{
/* Special conditions */
switch (bit)
{
case SIG_STATUS_CARRIER_UP:
case SIG_STATUS_CARRIER_DOWN:
case SIG_STATUS_TRAINING_IN_PROGRESS:
case SIG_STATUS_TRAINING_SUCCEEDED:
case SIG_STATUS_TRAINING_FAILED:
case SIG_STATUS_END_OF_DATA:
s->put_byte(s->user_data, bit);
s->bitpos = 0;
s->byte_in_progress = 0;
break;
default:
//printf("Eh!\n");
break;
}
return;
}
if (s->bitpos == 0)
{
/* Search for the start bit */
s->bitpos += (bit ^ 1);
s->parity_bit = 0;
s->byte_in_progress = 0;
}
else if (s->bitpos <= s->data_bits)
{
s->byte_in_progress = (s->byte_in_progress >> 1) | (bit << 7);
s->parity_bit ^= bit;
s->bitpos++;
}
else if (s->parity && s->bitpos == s->data_bits + 1)
{
if (s->parity == ASYNC_PARITY_ODD)
s->parity_bit ^= 1;
if (s->parity_bit != bit)
s->parity_errors++;
s->bitpos++;
}
else
{
/* Stop bit */
if (bit == 1)
{
/* Align the received value */
if (s->data_bits < 8)
s->byte_in_progress = (s->byte_in_progress & 0xFF) >> (8 - s->data_bits);
s->put_byte(s->user_data, s->byte_in_progress);
s->bitpos = 0;
}
else if (s->use_v14)
{
/* This is actually the start bit for the next character, and
the stop bit has been dropped from the stream. This is the
rate adaption specified in V.14 */
/* Align the received value */
if (s->data_bits < 8)
s->byte_in_progress = (s->byte_in_progress & 0xFF) >> (8 - s->data_bits);
s->put_byte(s->user_data, s->byte_in_progress);
s->bitpos = 1;
s->parity_bit = 0;
s->byte_in_progress = 0;
}
else
{
s->framing_errors++;
s->bitpos = 0;
}
}
}
/*- 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,
bool use_v14,
put_byte_func_t put_byte,
void *user_data)
{
if (s == NULL)
{
if ((s = (async_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->data_bits = data_bits;
s->parity = parity;
s->stop_bits = stop_bits;
s->use_v14 = use_v14;
s->put_byte = put_byte;
s->user_data = user_data;
s->byte_in_progress = 0;
s->bitpos = 0;
s->parity_bit = 0;
s->parity_errors = 0;
s->framing_errors = 0;
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) async_rx_release(async_rx_state_t *s)
{
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) async_rx_free(async_rx_state_t *s)
{
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) async_tx_get_bit(void *user_data)
{
async_tx_state_t *s;
int bit;
int parity_bit;
s = (async_tx_state_t *) user_data;
if (s->bitpos == 0)
{
if (s->presend_bits > 0)
{
s->presend_bits--;
return 1;
}
if ((s->byte_in_progress = s->get_byte(s->user_data)) < 0)
{
if (s->byte_in_progress != SIG_STATUS_LINK_IDLE)
return s->byte_in_progress;
/* Idle for a bit time. If the get byte call configured a presend
time we might idle for longer. */
return 1;
}
s->byte_in_progress &= (0xFFFF >> (16 - s->data_bits));
if (s->parity != ASYNC_PARITY_NONE)
{
parity_bit = parity8(s->byte_in_progress);
if (s->parity == ASYNC_PARITY_ODD)
parity_bit ^= 1;
s->byte_in_progress |= (parity_bit << s->data_bits);
s->byte_in_progress |= (0xFFFF << (s->data_bits + 1));
}
else
{
s->byte_in_progress |= (0xFFFF << s->data_bits);
}
/* Start bit */
bit = 0;
s->bitpos++;
}
else
{
bit = s->byte_in_progress & 1;
s->byte_in_progress >>= 1;
if (++s->bitpos > s->total_bits)
s->bitpos = 0;
}
return bit;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) async_tx_presend_bits(async_tx_state_t *s, int bits)
{
s->presend_bits = bits;
}
/*- 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,
bool use_v14,
get_byte_func_t get_byte,
void *user_data)
{
if (s == NULL)
{
if ((s = (async_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
/* We have a use_v14 parameter for completeness, but right now V.14 only
applies to the receive side. We are unlikely to have an application where
flow control does not exist, so V.14 stuffing is not needed. */
s->data_bits = data_bits;
s->parity = parity;
s->total_bits = data_bits + stop_bits;
if (parity != ASYNC_PARITY_NONE)
s->total_bits++;
s->get_byte = get_byte;
s->user_data = user_data;
s->byte_in_progress = 0;
s->bitpos = 0;
s->presend_bits = 0;
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) async_tx_release(async_tx_state_t *s)
{
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) async_tx_free(async_tx_state_t *s)
{
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

File diff suppressed because it is too large Load Diff

View File

@ -1,192 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* awgn.c - An additive Gaussian white noise generator
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2001 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.
*/
/*! \file */
/* This code is based on some demonstration code in a research
paper somewhere. I can't track down where I got the original from,
so that due recognition can be given. The original had no explicit
copyright notice, and I hope nobody objects to its use here.
Having a reasonable Gaussian noise generator is pretty important for
telephony testing (in fact, pretty much any DSP testing), and this
one seems to have served me OK. Since the generation of Gaussian
noise is only for test purposes, and not a core system component,
I don't intend to worry excessively about copyright issues, unless
someone worries me.
The non-core nature of this code also explains why it is unlikely
to ever be optimised. */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <stdlib.h>
#include <inttypes.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/awgn.h"
#include "spandsp/private/awgn.h"
/* Random number generator constants */
#define M1 259200
#define IA1 7141
#define IC1 54773
#define RM1 (1.0/(double) M1)
#define M2 134456
#define IA2 8121
#define IC2 28411
#define RM2 (1.0/(double) M2)
#define M3 243000
#define IA3 4561
#define IC3 51349
static void ran_init(awgn_state_t *s, int idum)
{
int j;
if (idum < 0)
idum = -idum;
s->ix1 = (IC1 + (int32_t) idum)%M1;
s->ix1 = (IA1*s->ix1 + IC1)%M1;
s->ix2 = s->ix1%M2;
s->ix1 = (IA1*s->ix1 + IC1)%M1;
s->ix3 = s->ix1%M3;
for (j = 0; j < 97; j++)
{
s->ix1 = (IA1*s->ix1 + IC1)%M1;
s->ix2 = (IA2*s->ix2 + IC2)%M2;
s->r[j] = (s->ix1 + s->ix2*RM2)*RM1;
}
}
/*- End of function --------------------------------------------------------*/
static double ran(awgn_state_t *s)
{
double temp;
int j;
/* This produces evenly spread random numbers between 0.0 and 1.0 */
s->ix1 = (IA1*s->ix1 + IC1)%M1;
s->ix2 = (IA2*s->ix2 + IC2)%M2;
s->ix3 = (IA3*s->ix3 + IC3)%M3;
j = (97*s->ix3)/M3;
if (j > 96 || j < 0)
{
/* Error */
temp = -1.0;
}
else
{
temp = s->r[j];
s->r[j] = (s->ix1 + s->ix2*RM2)*RM1;
}
return temp;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(awgn_state_t *) awgn_init_dbov(awgn_state_t *s, int idum, float level)
{
if (s == NULL)
{
if ((s = (awgn_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
ran_init(s, idum);
s->rms = pow(10.0, level/20.0)*32768.0;
s->amp2 = 0.0;
s->odd = true;
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(awgn_state_t *) awgn_init_dbm0(awgn_state_t *s, int idum, float level)
{
return awgn_init_dbov(s, idum, level - DBM0_MAX_POWER);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) awgn_release(awgn_state_t *s)
{
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) awgn_free(awgn_state_t *s)
{
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int16_t) awgn(awgn_state_t *s)
{
double r;
double v1;
double v2;
double amp;
/* The polar method of generating a Gaussian distribution */
if ((s->odd = !s->odd))
{
amp = s->amp2;
}
else
{
do
{
v1 = 2.0*ran(s) - 1.0;
v2 = 2.0*ran(s) - 1.0;
r = v1*v1 + v2*v2;
}
while (r >= 1.0);
r = sqrt(-2.0*log(r)/r);
s->amp2 = v1*r;
amp = v2*r;
}
amp *= s->rms;
return fsaturate(amp);
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

View File

@ -1,867 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* bell_r2_mf.c - Bell MF and MFC/R2 tone generation and detection.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2001 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.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>
#include <time.h>
#include <fcntl.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/fast_convert.h"
#include "spandsp/queue.h"
#include "spandsp/complex.h"
#include "spandsp/dds.h"
#include "spandsp/tone_detect.h"
#include "spandsp/tone_generate.h"
#include "spandsp/super_tone_rx.h"
#include "spandsp/dtmf.h"
#include "spandsp/bell_r2_mf.h"
#include "spandsp/private/logging.h"
#include "spandsp/private/queue.h"
#include "spandsp/private/tone_generate.h"
#include "spandsp/private/bell_r2_mf.h"
#if !defined(M_PI)
/* C99 systems may not define M_PI */
#define M_PI 3.14159265358979323846264338327
#endif
/*!
MF tone descriptor.
*/
typedef struct
{
int f1; /* First freq */
int f2; /* Second freq */
int8_t level1; /* Level of the first freq (dB) */
int8_t level2; /* Level of the second freq (dB) */
uint8_t on_time; /* Tone on time (ms) */
uint8_t off_time; /* Minimum post tone silence (ms) */
} mf_digit_tones_t;
int bell_mf_gen_inited = false;
tone_gen_descriptor_t bell_mf_digit_tones[15];
int r2_mf_gen_inited = false;
tone_gen_descriptor_t r2_mf_fwd_digit_tones[15];
tone_gen_descriptor_t r2_mf_back_digit_tones[15];
#if 0
tone_gen_descriptor_t socotel_mf_digit_tones[18];
#endif
/* Bell R1 tone generation specs.
* Power: -7dBm +- 1dB
* Frequency: within +-1.5%
* Mismatch between the start time of a pair of tones: <=6ms.
* Mismatch between the end time of a pair of tones: <=6ms.
* Tone duration: 68+-7ms, except KP which is 100+-7ms.
* Inter-tone gap: 68+-7ms.
*/
static const mf_digit_tones_t bell_mf_tones[] =
{
{ 700, 900, -7, -7, 68, 68},
{ 700, 1100, -7, -7, 68, 68},
{ 900, 1100, -7, -7, 68, 68},
{ 700, 1300, -7, -7, 68, 68},
{ 900, 1300, -7, -7, 68, 68},
{1100, 1300, -7, -7, 68, 68},
{ 700, 1500, -7, -7, 68, 68},
{ 900, 1500, -7, -7, 68, 68},
{1100, 1500, -7, -7, 68, 68},
{1300, 1500, -7, -7, 68, 68},
{ 700, 1700, -7, -7, 68, 68}, /* ST''' - use 'C' */
{ 900, 1700, -7, -7, 68, 68}, /* ST' - use 'A' */
{1100, 1700, -7, -7, 100, 68}, /* KP - use '*' */
{1300, 1700, -7, -7, 68, 68}, /* ST'' - use 'B' */
{1500, 1700, -7, -7, 68, 68}, /* ST - use '#' */
{0, 0, 0, 0, 0, 0}
};
/* The order of the digits here must match the list above */
static const char bell_mf_tone_codes[] = "1234567890CA*B#";
/* R2 tone generation specs.
* Power: -11.5dBm +- 1dB
* Frequency: within +-4Hz
* Mismatch between the start time of a pair of tones: <=1ms.
* Mismatch between the end time of a pair of tones: <=1ms.
*/
static const mf_digit_tones_t r2_mf_fwd_tones[] =
{
{1380, 1500, -11, -11, 1, 0},
{1380, 1620, -11, -11, 1, 0},
{1500, 1620, -11, -11, 1, 0},
{1380, 1740, -11, -11, 1, 0},
{1500, 1740, -11, -11, 1, 0},
{1620, 1740, -11, -11, 1, 0},
{1380, 1860, -11, -11, 1, 0},
{1500, 1860, -11, -11, 1, 0},
{1620, 1860, -11, -11, 1, 0},
{1740, 1860, -11, -11, 1, 0},
{1380, 1980, -11, -11, 1, 0},
{1500, 1980, -11, -11, 1, 0},
{1620, 1980, -11, -11, 1, 0},
{1740, 1980, -11, -11, 1, 0},
{1860, 1980, -11, -11, 1, 0},
{0, 0, 0, 0, 0, 0}
};
static const mf_digit_tones_t r2_mf_back_tones[] =
{
{1140, 1020, -11, -11, 1, 0},
{1140, 900, -11, -11, 1, 0},
{1020, 900, -11, -11, 1, 0},
{1140, 780, -11, -11, 1, 0},
{1020, 780, -11, -11, 1, 0},
{ 900, 780, -11, -11, 1, 0},
{1140, 660, -11, -11, 1, 0},
{1020, 660, -11, -11, 1, 0},
{ 900, 660, -11, -11, 1, 0},
{ 780, 660, -11, -11, 1, 0},
{1140, 540, -11, -11, 1, 0},
{1020, 540, -11, -11, 1, 0},
{ 900, 540, -11, -11, 1, 0},
{ 780, 540, -11, -11, 1, 0},
{ 660, 540, -11, -11, 1, 0},
{0, 0, 0, 0, 0, 0}
};
/* The order of the digits here must match the lists above */
static const char r2_mf_tone_codes[] = "1234567890BCDEF";
#if 0
static const mf_digit_tones_t socotel_tones[] =
{
{ 700, 900, -11, -11, 1, 0},
{ 700, 1100, -11, -11, 1, 0},
{ 900, 1100, -11, -11, 1, 0},
{ 700, 1300, -11, -11, 1, 0},
{ 900, 1300, -11, -11, 1, 0},
{1100, 1300, -11, -11, 1, 0},
{ 700, 1500, -11, -11, 1, 0},
{ 900, 1500, -11, -11, 1, 0},
{1100, 1500, -11, -11, 1, 0},
{1300, 1500, -11, -11, 1, 0},
{1500, 1700, -11, -11, 1, 0},
{ 700, 1700, -11, -11, 1, 0},
{ 900, 1700, -11, -11, 1, 0},
{1300, 1700, -11, -11, 1, 0},
{1100, 1700, -11, -11, 1, 0},
{1700, 0, -11, -11, 1, 0}, /* Use 'F' */
{1900, 0, -11, -11, 1, 0}, /* Use 'G' */
{0, 0, 0, 0, 0, 0}
};
/* The order of the digits here must match the list above */
static char socotel_mf_tone_codes[] = "1234567890ABCDEFG";
#endif
#if defined(SPANDSP_USE_FIXED_POINT)
#define BELL_MF_THRESHOLD 204089 /* -30.5dBm0 */
#define BELL_MF_TWIST 3.981f /* 6dB */
#define BELL_MF_RELATIVE_PEAK 12.589f /* 11dB */
#define BELL_MF_SAMPLES_PER_BLOCK 120
#define R2_MF_THRESHOLD 62974 /* -36.5dBm0 */
#define R2_MF_TWIST 5.012f /* 7dB */
#define R2_MF_RELATIVE_PEAK 12.589f /* 11dB */
#define R2_MF_SAMPLES_PER_BLOCK 133
#else
#define BELL_MF_THRESHOLD 3343803100.0f /* -30.5dBm0 [((120.0*32768.0/1.4142)*10^((-30.5 - DBM0_MAX_SINE_POWER)/20.0))^2 => 3343803100.0] */
#define BELL_MF_TWIST 3.981f /* 6dB [10^(6/10) => 3.981] */
#define BELL_MF_RELATIVE_PEAK 12.589f /* 11dB */
#define BELL_MF_SAMPLES_PER_BLOCK 120
#define R2_MF_THRESHOLD 1031766650.0f /* -36.5dBm0 [((133.0*32768.0/1.4142)*10^((-36.5 - DBM0_MAX_SINE_POWER)/20.0))^2 => 1031766650.0] */
#define R2_MF_TWIST 5.012f /* 7dB */
#define R2_MF_RELATIVE_PEAK 12.589f /* 11dB */
#define R2_MF_SAMPLES_PER_BLOCK 133
#endif
static goertzel_descriptor_t bell_mf_detect_desc[6];
static goertzel_descriptor_t mf_fwd_detect_desc[6];
static goertzel_descriptor_t mf_back_detect_desc[6];
static const int bell_mf_frequencies[] =
{
700, 900, 1100, 1300, 1500, 1700
};
/* Use the follow characters for the Bell MF special signals:
KP - use '*'
ST - use '#'
ST' - use 'A'
ST'' - use 'B'
ST''' - use 'C' */
static const char bell_mf_positions[] = "1247C-358A--69*---0B----#";
static const int r2_mf_fwd_frequencies[] =
{
1380, 1500, 1620, 1740, 1860, 1980
};
static const int r2_mf_back_frequencies[] =
{
1140, 1020, 900, 780, 660, 540
};
/* Use codes '1' to 'F' for the R2 signals 1 to 15, except for signal 'A'.
Use '0' for this, so the codes match the digits 0-9. */
static const char r2_mf_positions[] = "1247B-358C--69D---0E----F";
static void bell_mf_gen_init(void)
{
int i;
const mf_digit_tones_t *tones;
if (bell_mf_gen_inited)
return;
i = 0;
tones = bell_mf_tones;
while (tones->on_time)
{
/* Note: The duration of KP is longer than the other signals. */
tone_gen_descriptor_init(&bell_mf_digit_tones[i++],
tones->f1,
tones->level1,
tones->f2,
tones->level2,
tones->on_time,
tones->off_time,
0,
0,
false);
tones++;
}
bell_mf_gen_inited = true;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) bell_mf_tx(bell_mf_tx_state_t *s, int16_t amp[], int max_samples)
{
int len;
const char *cp;
int digit;
len = 0;
if (s->tones.current_section >= 0)
{
/* Deal with the fragment left over from last time */
len = tone_gen(&s->tones, amp, max_samples);
}
while (len < max_samples && (digit = queue_read_byte(&s->queue.queue)) >= 0)
{
/* Step to the next digit */
if ((cp = strchr(bell_mf_tone_codes, digit)) == NULL)
continue;
tone_gen_init(&s->tones, &bell_mf_digit_tones[cp - bell_mf_tone_codes]);
len += tone_gen(&s->tones, amp + len, max_samples - len);
}
return len;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) bell_mf_tx_put(bell_mf_tx_state_t *s, const char *digits, int len)
{
size_t space;
/* This returns the number of characters that would not fit in the buffer.
The buffer will only be loaded if the whole string of digits will fit,
in which case zero is returned. */
if (len < 0)
{
if ((len = strlen(digits)) == 0)
return 0;
}
if ((space = queue_free_space(&s->queue.queue)) < (size_t) len)
return len - (int) space;
if (queue_write(&s->queue.queue, (const uint8_t *) digits, len) >= 0)
return 0;
return -1;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(bell_mf_tx_state_t *) bell_mf_tx_init(bell_mf_tx_state_t *s)
{
if (s == NULL)
{
if ((s = (bell_mf_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
if (!bell_mf_gen_inited)
bell_mf_gen_init();
tone_gen_init(&s->tones, &bell_mf_digit_tones[0]);
s->current_sample = 0;
queue_init(&s->queue.queue, MAX_BELL_MF_DIGITS, QUEUE_READ_ATOMIC | QUEUE_WRITE_ATOMIC);
s->tones.current_section = -1;
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) bell_mf_tx_release(bell_mf_tx_state_t *s)
{
queue_release(&s->queue.queue);
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) bell_mf_tx_free(bell_mf_tx_state_t *s)
{
queue_release(&s->queue.queue);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) r2_mf_tx(r2_mf_tx_state_t *s, int16_t amp[], int samples)
{
int len;
if (s->digit == 0)
{
len = samples;
memset(amp, 0, len*sizeof(int16_t));
}
else
{
len = tone_gen(&s->tone, amp, samples);
}
return len;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) r2_mf_tx_put(r2_mf_tx_state_t *s, char digit)
{
char *cp;
if (digit && (cp = strchr(r2_mf_tone_codes, digit)))
{
if (s->fwd)
tone_gen_init(&s->tone, &r2_mf_fwd_digit_tones[cp - r2_mf_tone_codes]);
else
tone_gen_init(&s->tone, &r2_mf_back_digit_tones[cp - r2_mf_tone_codes]);
s->digit = digit;
}
else
{
s->digit = 0;
}
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, bool fwd)
{
int i;
const mf_digit_tones_t *tones;
if (s == NULL)
{
if ((s = (r2_mf_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
if (!r2_mf_gen_inited)
{
i = 0;
tones = r2_mf_fwd_tones;
while (tones->on_time)
{
tone_gen_descriptor_init(&r2_mf_fwd_digit_tones[i++],
tones->f1,
tones->level1,
tones->f2,
tones->level2,
tones->on_time,
tones->off_time,
0,
0,
(tones->off_time == 0));
tones++;
}
i = 0;
tones = r2_mf_back_tones;
while (tones->on_time)
{
tone_gen_descriptor_init(&r2_mf_back_digit_tones[i++],
tones->f1,
tones->level1,
tones->f2,
tones->level2,
tones->on_time,
tones->off_time,
0,
0,
(tones->off_time == 0));
tones++;
}
r2_mf_gen_inited = true;
}
s->fwd = fwd;
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) r2_mf_tx_release(r2_mf_tx_state_t *s)
{
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) r2_mf_tx_free(r2_mf_tx_state_t *s)
{
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) bell_mf_rx(bell_mf_rx_state_t *s, const int16_t amp[], int samples)
{
#if defined(SPANDSP_USE_FIXED_POINT)
int32_t energy[6];
int16_t xamp;
#else
float energy[6];
float xamp;
#endif
int i;
int j;
int sample;
int best;
int second_best;
int limit;
uint8_t hit;
for (sample = 0; sample < samples; sample = limit)
{
if ((samples - sample) >= (BELL_MF_SAMPLES_PER_BLOCK - s->current_sample))
limit = sample + (BELL_MF_SAMPLES_PER_BLOCK - s->current_sample);
else
limit = samples;
for (j = sample; j < limit; j++)
{
xamp = goertzel_preadjust_amp(amp[j]);
goertzel_samplex(&s->out[0], xamp);
goertzel_samplex(&s->out[1], xamp);
goertzel_samplex(&s->out[2], xamp);
goertzel_samplex(&s->out[3], xamp);
goertzel_samplex(&s->out[4], xamp);
goertzel_samplex(&s->out[5], xamp);
}
s->current_sample += (limit - sample);
if (s->current_sample < BELL_MF_SAMPLES_PER_BLOCK)
continue;
/* We are at the end of an MF detection block */
/* Find the two highest energies. The spec says to look for
two tones and two tones only. Taking this literally -ie
only two tones pass the minimum threshold - doesn't work
well. The sinc function mess, due to rectangular windowing
ensure that! Find the two highest energies and ensure they
are considerably stronger than any of the others. */
energy[0] = goertzel_result(&s->out[0]);
energy[1] = goertzel_result(&s->out[1]);
if (energy[0] > energy[1])
{
best = 0;
second_best = 1;
}
else
{
best = 1;
second_best = 0;
}
for (i = 2; i < 6; i++)
{
energy[i] = goertzel_result(&s->out[i]);
if (energy[i] >= energy[best])
{
second_best = best;
best = i;
}
else if (energy[i] >= energy[second_best])
{
second_best = i;
}
}
/* Basic signal level and twist tests */
hit = 0;
if (energy[best] >= BELL_MF_THRESHOLD
&&
energy[second_best] >= BELL_MF_THRESHOLD
&&
energy[best] < energy[second_best]*BELL_MF_TWIST
&&
energy[best]*BELL_MF_TWIST > energy[second_best])
{
/* Relative peak test */
hit = 'X';
for (i = 0; i < 6; i++)
{
if (i != best && i != second_best)
{
if (energy[i]*BELL_MF_RELATIVE_PEAK >= energy[second_best])
{
/* The best two are not clearly the best */
hit = 0;
break;
}
}
}
}
if (hit)
{
/* Get the values into ascending order */
if (second_best < best)
{
i = best;
best = second_best;
second_best = i;
}
best = best*5 + second_best - 1;
hit = bell_mf_positions[best];
/* Look for two successive similar results */
/* The logic in the next test is:
For KP we need 4 successive identical clean detects, with
two blocks of something different preceeding it. For anything
else we need two successive identical clean detects, with
two blocks of something different preceeding it. */
if (hit == s->hits[4]
&&
hit == s->hits[3]
&&
((hit != '*' && hit != s->hits[2] && hit != s->hits[1])
||
(hit == '*' && hit == s->hits[2] && hit != s->hits[1] && hit != s->hits[0])))
{
if (s->current_digits < MAX_BELL_MF_DIGITS)
{
s->digits[s->current_digits++] = (char) hit;
s->digits[s->current_digits] = '\0';
if (s->digits_callback)
{
s->digits_callback(s->digits_callback_data, s->digits, s->current_digits);
s->current_digits = 0;
}
}
else
{
s->lost_digits++;
}
}
}
s->hits[0] = s->hits[1];
s->hits[1] = s->hits[2];
s->hits[2] = s->hits[3];
s->hits[3] = s->hits[4];
s->hits[4] = hit;
s->current_sample = 0;
}
if (s->current_digits && s->digits_callback)
{
s->digits_callback(s->digits_callback_data, s->digits, s->current_digits);
s->digits[0] = '\0';
s->current_digits = 0;
}
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(size_t) bell_mf_rx_get(bell_mf_rx_state_t *s, char *buf, int max)
{
if (max > s->current_digits)
max = s->current_digits;
if (max > 0)
{
memcpy(buf, s->digits, max);
memmove(s->digits, s->digits + max, s->current_digits - max);
s->current_digits -= max;
}
buf[max] = '\0';
return 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)
{
int i;
static int initialised = false;
if (s == NULL)
{
if ((s = (bell_mf_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
if (!initialised)
{
for (i = 0; i < 6; i++)
make_goertzel_descriptor(&bell_mf_detect_desc[i], (float) bell_mf_frequencies[i], BELL_MF_SAMPLES_PER_BLOCK);
initialised = true;
}
s->digits_callback = callback;
s->digits_callback_data = user_data;
s->hits[0] =
s->hits[1] =
s->hits[2] =
s->hits[3] =
s->hits[4] = 0;
for (i = 0; i < 6; i++)
goertzel_init(&s->out[i], &bell_mf_detect_desc[i]);
s->current_sample = 0;
s->lost_digits = 0;
s->current_digits = 0;
s->digits[0] = '\0';
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) bell_mf_rx_release(bell_mf_rx_state_t *s)
{
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) bell_mf_rx_free(bell_mf_rx_state_t *s)
{
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples)
{
#if defined(SPANDSP_USE_FIXED_POINT)
int32_t energy[6];
int16_t xamp;
#else
float energy[6];
float xamp;
#endif
int i;
int j;
int sample;
int best;
int second_best;
int hit;
int hit_digit;
int limit;
for (sample = 0; sample < samples; sample = limit)
{
if ((samples - sample) >= (R2_MF_SAMPLES_PER_BLOCK - s->current_sample))
limit = sample + (R2_MF_SAMPLES_PER_BLOCK - s->current_sample);
else
limit = samples;
for (j = sample; j < limit; j++)
{
xamp = goertzel_preadjust_amp(amp[j]);
goertzel_samplex(&s->out[0], xamp);
goertzel_samplex(&s->out[1], xamp);
goertzel_samplex(&s->out[2], xamp);
goertzel_samplex(&s->out[3], xamp);
goertzel_samplex(&s->out[4], xamp);
goertzel_samplex(&s->out[5], xamp);
}
s->current_sample += (limit - sample);
if (s->current_sample < R2_MF_SAMPLES_PER_BLOCK)
continue;
/* We are at the end of an MF detection block */
/* Find the two highest energies */
energy[0] = goertzel_result(&s->out[0]);
energy[1] = goertzel_result(&s->out[1]);
if (energy[0] > energy[1])
{
best = 0;
second_best = 1;
}
else
{
best = 1;
second_best = 0;
}
for (i = 2; i < 6; i++)
{
energy[i] = goertzel_result(&s->out[i]);
if (energy[i] >= energy[best])
{
second_best = best;
best = i;
}
else if (energy[i] >= energy[second_best])
{
second_best = i;
}
}
/* Basic signal level and twist tests */
hit = false;
if (energy[best] >= R2_MF_THRESHOLD
&&
energy[second_best] >= R2_MF_THRESHOLD
&&
energy[best] < energy[second_best]*R2_MF_TWIST
&&
energy[best]*R2_MF_TWIST > energy[second_best])
{
/* Relative peak test */
hit = true;
for (i = 0; i < 6; i++)
{
if (i != best && i != second_best)
{
if (energy[i]*R2_MF_RELATIVE_PEAK >= energy[second_best])
{
/* The best two are not clearly the best */
hit = false;
break;
}
}
}
}
if (hit)
{
/* Get the values into ascending order */
if (second_best < best)
{
i = best;
best = second_best;
second_best = i;
}
best = best*5 + second_best - 1;
hit_digit = r2_mf_positions[best];
}
else
{
hit_digit = 0;
}
if (s->current_digit != hit_digit && s->callback)
{
i = (hit_digit) ? -10 : -99;
s->callback(s->callback_data, hit_digit, i, 0);
}
s->current_digit = hit_digit;
s->current_sample = 0;
}
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s)
{
return s->current_digit;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s,
bool fwd,
tone_report_func_t callback,
void *user_data)
{
int i;
static int initialised = false;
if (s == NULL)
{
if ((s = (r2_mf_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
s->fwd = fwd;
if (!initialised)
{
for (i = 0; i < 6; i++)
{
make_goertzel_descriptor(&mf_fwd_detect_desc[i], (float) r2_mf_fwd_frequencies[i], R2_MF_SAMPLES_PER_BLOCK);
make_goertzel_descriptor(&mf_back_detect_desc[i], (float) r2_mf_back_frequencies[i], R2_MF_SAMPLES_PER_BLOCK);
}
initialised = true;
}
if (fwd)
{
for (i = 0; i < 6; i++)
goertzel_init(&s->out[i], &mf_fwd_detect_desc[i]);
}
else
{
for (i = 0; i < 6; i++)
goertzel_init(&s->out[i], &mf_back_detect_desc[i]);
}
s->callback = callback;
s->callback_data = user_data;
s->current_digit = 0;
s->current_sample = 0;
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) r2_mf_rx_release(r2_mf_rx_state_t *s)
{
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) r2_mf_rx_free(r2_mf_rx_state_t *s)
{
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

View File

@ -1,516 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* bert.c - Bit error rate tests.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2004 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.
*/
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/async.h"
#include "spandsp/bert.h"
#include "spandsp/private/logging.h"
#include "spandsp/private/bert.h"
#define MEASUREMENT_STEP 100
static const char *qbf = "VoyeZ Le BricK GeanT QuE J'ExaminE PreS Du WharF 123 456 7890 + - * : = $ % ( )"
"ThE QuicK BrowN FoX JumpS OveR ThE LazY DoG 123 456 7890 + - * : = $ % ( )";
SPAN_DECLARE(const char *) bert_event_to_str(int event)
{
switch (event)
{
case BERT_REPORT_SYNCED:
return "synced";
case BERT_REPORT_UNSYNCED:
return "unsync'ed";
case BERT_REPORT_REGULAR:
return "regular";
case BERT_REPORT_GT_10_2:
return "error rate > 1 in 10^2";
case BERT_REPORT_LT_10_2:
return "error rate < 1 in 10^2";
case BERT_REPORT_LT_10_3:
return "error rate < 1 in 10^3";
case BERT_REPORT_LT_10_4:
return "error rate < 1 in 10^4";
case BERT_REPORT_LT_10_5:
return "error rate < 1 in 10^5";
case BERT_REPORT_LT_10_6:
return "error rate < 1 in 10^6";
case BERT_REPORT_LT_10_7:
return "error rate < 1 in 10^7";
}
return "???";
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) bert_get_bit(bert_state_t *s)
{
int bit;
if (s->limit && s->tx.bits >= s->limit)
return SIG_STATUS_END_OF_DATA;
bit = 0;
switch (s->pattern_class)
{
case 0:
bit = s->tx.reg & 1;
s->tx.reg = (s->tx.reg >> 1) | ((s->tx.reg & 1) << s->shift2);
break;
case 1:
bit = s->tx.reg & 1;
s->tx.reg = (s->tx.reg >> 1) | (((s->tx.reg ^ (s->tx.reg >> s->shift)) & 1) << s->shift2);
if (s->max_zeros)
{
/* This generator suppresses runs >s->max_zeros */
if (bit)
{
if (++s->tx.zeros > s->max_zeros)
{
s->tx.zeros = 0;
bit ^= 1;
}
}
else
{
s->tx.zeros = 0;
}
}
bit ^= s->invert;
break;
case 2:
if (s->tx.step_bit == 0)
{
s->tx.step_bit = 7;
s->tx.reg = qbf[s->tx.step++];
if (s->tx.reg == 0)
{
s->tx.reg = 'V';
s->tx.step = 1;
}
}
bit = s->tx.reg & 1;
s->tx.reg >>= 1;
s->tx.step_bit--;
break;
}
s->tx.bits++;
return bit;
}
/*- End of function --------------------------------------------------------*/
static void assess_error_rate(bert_state_t *s)
{
int i;
int j;
int sum;
bool test;
/* We assess the error rate in decadic steps. For each decade we assess the error over 10 times
the number of bits, to smooth the result. This means we assess the 1 in 100 rate based on 1000 bits
(i.e. we look for >=10 errors in 1000 bits). We make an assessment every 100 bits, using a sliding
window over the last 1000 bits. We assess the 1 in 1000 rate over 10000 bits in a similar way, and
so on for the lower error rates. */
test = true;
for (i = 2; i <= 7; i++)
{
if (++s->decade_ptr[i] < 10)
break;
/* This decade has reached 10 snapshots, so we need to touch the next decade */
s->decade_ptr[i] = 0;
/* Sum the last 10 snapshots from this decade, to see if we overflow into the next decade */
for (sum = 0, j = 0; j < 10; j++)
sum += s->decade_bad[i][j];
if (test && sum > 10)
{
/* We overflow into the next decade */
test = false;
if (s->error_rate != i && s->reporter)
s->reporter(s->user_data, BERT_REPORT_GT_10_2 + i - 2, &s->results);
s->error_rate = i;
}
s->decade_bad[i][0] = 0;
if (i < 7)
s->decade_bad[i + 1][s->decade_ptr[i + 1]] = sum;
}
if (i > 7)
{
if (s->decade_ptr[i] >= 10)
s->decade_ptr[i] = 0;
if (test)
{
if (s->error_rate != i && s->reporter)
s->reporter(s->user_data, BERT_REPORT_GT_10_2 + i - 2, &s->results);
s->error_rate = i;
}
}
else
{
s->decade_bad[i][s->decade_ptr[i]] = 0;
}
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) bert_put_bit(bert_state_t *s, int bit)
{
if (bit < 0)
{
/* Special conditions */
printf("Status is %s (%d)\n", signal_status_to_str(bit), bit);
return;
}
bit = (bit & 1) ^ s->invert;
s->rx.bits++;
switch (s->pattern_class)
{
case 0:
if (s->rx.resync)
{
s->rx.reg = (s->rx.reg >> 1) | (bit << s->shift2);
s->rx.ref_reg = (s->rx.ref_reg >> 1) | ((s->rx.ref_reg & 1) << s->shift2);
if (s->rx.reg == s->rx.ref_reg)
{
if (++s->rx.resync > s->resync_time)
{
s->rx.resync = 0;
if (s->reporter)
s->reporter(s->user_data, BERT_REPORT_SYNCED, &s->results);
}
}
else
{
s->rx.resync = 2;
s->rx.ref_reg = s->rx.master_reg;
}
}
else
{
s->results.total_bits++;
if ((bit ^ s->rx.ref_reg) & 1)
s->results.bad_bits++;
s->rx.ref_reg = (s->rx.ref_reg >> 1) | ((s->rx.ref_reg & 1) << s->shift2);
}
break;
case 1:
if (s->rx.resync)
{
/* If we get a reasonable period for which we correctly predict the
next bit, we must be in sync. */
/* Don't worry about max. zeros tests when resyncing.
It might just extend the resync time a little. Trying
to include the test might affect robustness. */
if (bit == (int) ((s->rx.reg >> s->shift) & 1))
{
if (++s->rx.resync > s->resync_time)
{
s->rx.resync = 0;
if (s->reporter)
s->reporter(s->user_data, BERT_REPORT_SYNCED, &s->results);
}
}
else
{
s->rx.resync = 2;
s->rx.reg ^= s->mask;
}
}
else
{
s->results.total_bits++;
if (s->max_zeros)
{
/* This generator suppresses runs >s->max_zeros */
if ((s->rx.reg & s->mask))
{
if (++s->rx.zeros > s->max_zeros)
{
s->rx.zeros = 0;
bit ^= 1;
}
}
else
{
s->rx.zeros = 0;
}
}
if (bit != (int) ((s->rx.reg >> s->shift) & 1))
{
s->results.bad_bits++;
s->rx.resync_bad_bits++;
s->decade_bad[2][s->decade_ptr[2]]++;
}
if (--s->rx.measurement_step <= 0)
{
/* Every hundred bits we need to do the error rate measurement */
s->rx.measurement_step = MEASUREMENT_STEP;
assess_error_rate(s);
}
if (--s->rx.resync_cnt <= 0)
{
/* Check if there were enough bad bits during this period to
justify a resync. */
if (s->rx.resync_bad_bits >= (s->rx.resync_len*s->rx.resync_percent)/100)
{
s->rx.resync = 1;
s->results.resyncs++;
if (s->reporter)
s->reporter(s->user_data, BERT_REPORT_UNSYNCED, &s->results);
}
s->rx.resync_cnt = s->rx.resync_len;
s->rx.resync_bad_bits = 0;
}
}
s->rx.reg = (s->rx.reg >> 1) | (((s->rx.reg ^ (s->rx.reg >> s->shift)) & 1) << s->shift2);
break;
case 2:
s->rx.reg = (s->rx.reg >> 1) | (bit << 6);
/* TODO: There is no mechanism for synching yet. This only works if things start in sync. */
if (++s->rx.step_bit == 7)
{
s->rx.step_bit = 0;
if ((int) s->rx.reg != qbf[s->rx.step])
{
/* We need to work out the number of actual bad bits here. We need to look at the
error rate, and see it a resync is needed. etc. */
s->results.bad_bits++;
}
if (qbf[++s->rx.step] == '\0')
s->rx.step = 0;
}
s->results.total_bits++;
break;
}
if (s->report_frequency > 0)
{
if (--s->rx.report_countdown <= 0)
{
if (s->reporter)
s->reporter(s->user_data, BERT_REPORT_REGULAR, &s->results);
s->rx.report_countdown = s->report_frequency;
}
}
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) bert_result(bert_state_t *s, bert_results_t *results)
{
results->total_bits = s->results.total_bits;
results->bad_bits = s->results.bad_bits;
results->resyncs = s->results.resyncs;
return sizeof(*results);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) bert_set_report(bert_state_t *s, int freq, bert_report_func_t reporter, void *user_data)
{
s->report_frequency = freq;
s->reporter = reporter;
s->user_data = user_data;
s->rx.report_countdown = s->report_frequency;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(bert_state_t *) bert_init(bert_state_t *s, int limit, int pattern, int resync_len, int resync_percent)
{
int i;
int j;
if (s == NULL)
{
if ((s = (bert_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
s->pattern = pattern;
s->limit = limit;
s->reporter = NULL;
s->user_data = NULL;
s->report_frequency = 0;
s->resync_time = 72;
s->invert = 0;
switch (s->pattern)
{
case BERT_PATTERN_ZEROS:
s->tx.reg = 0;
s->shift2 = 31;
s->pattern_class = 0;
break;
case BERT_PATTERN_ONES:
s->tx.reg = ~((uint32_t) 0);
s->shift2 = 31;
s->pattern_class = 0;
break;
case BERT_PATTERN_7_TO_1:
s->tx.reg = 0xFEFEFEFE;
s->shift2 = 31;
s->pattern_class = 0;
break;
case BERT_PATTERN_3_TO_1:
s->tx.reg = 0xEEEEEEEE;
s->shift2 = 31;
s->pattern_class = 0;
break;
case BERT_PATTERN_1_TO_1:
s->tx.reg = 0xAAAAAAAA;
s->shift2 = 31;
s->pattern_class = 0;
break;
case BERT_PATTERN_1_TO_3:
s->tx.reg = 0x11111111;
s->shift2 = 31;
s->pattern_class = 0;
break;
case BERT_PATTERN_1_TO_7:
s->tx.reg = 0x01010101;
s->shift2 = 31;
s->pattern_class = 0;
break;
case BERT_PATTERN_QBF:
s->tx.reg = 0;
s->pattern_class = 2;
break;
case BERT_PATTERN_ITU_O151_23:
s->pattern_class = 1;
s->tx.reg = 0x7FFFFF;
s->mask = 0x20;
s->shift = 5;
s->shift2 = 22;
s->invert = 1;
s->resync_time = 56;
s->max_zeros = 0;
break;
case BERT_PATTERN_ITU_O151_20:
s->pattern_class = 1;
s->tx.reg = 0xFFFFF;
s->mask = 0x8;
s->shift = 3;
s->shift2 = 19;
s->invert = 1;
s->resync_time = 50;
s->max_zeros = 14;
break;
case BERT_PATTERN_ITU_O151_15:
s->pattern_class = 1;
s->tx.reg = 0x7FFF;
s->mask = 0x2;
s->shift = 1;
s->shift2 = 14;
s->invert = 1;
s->resync_time = 40;
s->max_zeros = 0;
break;
case BERT_PATTERN_ITU_O152_11:
s->pattern_class = 1;
s->tx.reg = 0x7FF;
s->mask = 0x4;
s->shift = 2;
s->shift2 = 10;
s->invert = 0;
s->resync_time = 32;
s->max_zeros = 0;
break;
case BERT_PATTERN_ITU_O153_9:
s->pattern_class = 1;
s->tx.reg = 0x1FF;
s->mask = 0x10;
s->shift = 4;
s->shift2 = 8;
s->invert = 0;
s->resync_time = 28;
s->max_zeros = 0;
break;
}
s->tx.bits = 0;
s->tx.step = 0;
s->tx.step_bit = 0;
s->tx.zeros = 0;
s->rx.reg = s->tx.reg;
s->rx.ref_reg = s->rx.reg;
s->rx.master_reg = s->rx.ref_reg;
s->rx.bits = 0;
s->rx.step = 0;
s->rx.step_bit = 0;
s->rx.resync = 1;
s->rx.resync_cnt = resync_len;
s->rx.resync_bad_bits = 0;
s->rx.resync_len = resync_len;
s->rx.resync_percent = resync_percent;
s->results.total_bits = 0;
s->results.bad_bits = 0;
s->results.resyncs = 0;
s->rx.report_countdown = 0;
for (i = 0; i < 8; i++)
{
for (j = 0; j < 10; j++)
s->decade_bad[i][j] = 0;
s->decade_ptr[i] = 0;
}
s->error_rate = 8;
s->rx.measurement_step = MEASUREMENT_STEP;
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
span_log_set_protocol(&s->logging, "BERT");
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) bert_release(bert_state_t *s)
{
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) bert_free(bert_state_t *s)
{
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

View File

@ -1,179 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* bit_operations.c - Various bit level operations, such as bit reversal
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2006 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.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <inttypes.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <assert.h>
#include <memory.h>
#include "spandsp/telephony.h"
#include "spandsp/bit_operations.h"
SPAN_DECLARE(uint16_t) bit_reverse16(uint16_t x)
{
x = (x >> 8) | (x << 8);
x = ((x & 0xF0F0) >> 4) | ((x & 0x0F0F) << 4);
x = ((x & 0xCCCC) >> 2) | ((x & 0x3333) << 2);
return ((x & 0xAAAA) >> 1) | ((x & 0x5555) << 1);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(uint32_t) bit_reverse32(uint32_t x)
{
x = (x >> 16) | (x << 16);
x = ((x & 0xFF00FF00) >> 8) | ((x & 0x00FF00FF) << 8);
x = ((x & 0xF0F0F0F0) >> 4) | ((x & 0x0F0F0F0F) << 4);
x = ((x & 0xCCCCCCCC) >> 2) | ((x & 0x33333333) << 2);
return ((x & 0xAAAAAAAA) >> 1) | ((x & 0x55555555) << 1);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(uint32_t) bit_reverse_4bytes(uint32_t x)
{
x = ((x & 0xF0F0F0F0) >> 4) | ((x & 0x0F0F0F0F) << 4);
x = ((x & 0xCCCCCCCC) >> 2) | ((x & 0x33333333) << 2);
return ((x & 0xAAAAAAAA) >> 1) | ((x & 0x55555555) << 1);
}
/*- End of function --------------------------------------------------------*/
#if defined(__x86_64__)
SPAN_DECLARE(uint64_t) bit_reverse_8bytes(uint64_t x)
{
x = ((x & 0xF0F0F0F0F0F0F0F0LLU) >> 4) | ((x & 0x0F0F0F0F0F0F0F0FLLU) << 4);
x = ((x & 0xCCCCCCCCCCCCCCCCLLU) >> 2) | ((x & 0x3333333333333333LLU) << 2);
return ((x & 0xAAAAAAAAAAAAAAAALLU) >> 1) | ((x & 0x5555555555555555LLU) << 1);
}
/*- End of function --------------------------------------------------------*/
#endif
SPAN_DECLARE(void) bit_reverse(uint8_t to[], const uint8_t from[], int len)
{
#if defined(SPANDSP_MISALIGNED_ACCESS_FAILS)
int i;
#else
const uint8_t *y1;
uint8_t *z1;
const uint32_t *y4;
uint32_t *z4;
uint32_t x4;
#if defined(__x86_64__)
const uint64_t *y8;
uint64_t *z8;
uint64_t x8;
#endif
#endif
#if defined(SPANDSP_MISALIGNED_ACCESS_FAILS)
/* This code works byte by byte, so it works on machines where misalignment
is either desperately slow (its a bit slow on practically any machine, but
some machines make it desparately slow) or fails. */
for (i = 0; i < len; i++)
to[i] = bit_reverse8(from[i]);
#else
/* This code is this is based on the woolly assumption that the start of the buffers
is memory aligned. If it isn't, the routine will be less efficient on some machines,
but might not work at all on others. */
#if defined(__x86_64__)
y8 = (const uint64_t *) from;
z8 = (uint64_t *) to;
while (len >= sizeof(uint64_t))
{
x8 = *y8++;
x8 = ((x8 & 0xF0F0F0F0F0F0F0F0LLU) >> 4) | ((x8 & 0x0F0F0F0F0F0F0F0FLLU) << 4);
x8 = ((x8 & 0xCCCCCCCCCCCCCCCCLLU) >> 2) | ((x8 & 0x3333333333333333LLU) << 2);
*z8++ = ((x8 & 0xAAAAAAAAAAAAAAAALLU) >> 1) | ((x8 & 0x5555555555555555LLU) << 1);
len -= sizeof(uint64_t);
}
y4 = (const uint32_t *) y8;
z4 = (uint32_t *) z8;
#else
y4 = (const uint32_t *) from;
z4 = (uint32_t *) to;
#endif
while (len >= sizeof(uint32_t))
{
x4 = *y4++;
x4 = ((x4 & 0xF0F0F0F0) >> 4) | ((x4 & 0x0F0F0F0F) << 4);
x4 = ((x4 & 0xCCCCCCCC) >> 2) | ((x4 & 0x33333333) << 2);
*z4++ = ((x4 & 0xAAAAAAAA) >> 1) | ((x4 & 0x55555555) << 1);
len -= sizeof(uint32_t);
}
y1 = (const uint8_t *) y4;
z1 = (uint8_t *) z4;
while (len-- > 0)
*z1++ = bit_reverse8(*y1++);
#endif
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) one_bits32(uint32_t x)
{
x = x - ((x >> 1) & 0x55555555);
/* We now have 16 2-bit counts */
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
/* We now have 8 4-bit counts */
x = (x + (x >> 4)) & 0x0F0F0F0F;
/* We now have 4 8-bit counts */
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || defined(__powerpc__)
/* If multiply is fast */
return (x*0x01010101) >> 24;
#else
/* If multiply is slow */
x += (x >> 8);
x += (x >> 16);
return (x & 0x0000003F);
#endif
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(uint32_t) make_mask32(uint32_t x)
{
x |= (x >> 1);
x |= (x >> 2);
x |= (x >> 4);
x |= (x >> 8);
x |= (x >> 16);
return x;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(uint16_t) make_mask16(uint16_t x)
{
x |= (x >> 1);
x |= (x >> 2);
x |= (x >> 4);
x |= (x >> 8);
return x;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

View File

@ -1,164 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* bitstream.c - Bitstream composition and decomposition routines.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2006 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.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bitstream.h"
#include "spandsp/private/bitstream.h"
SPAN_DECLARE(void) bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits)
{
value &= ((1 << bits) - 1);
if (s->lsb_first)
{
if (s->residue + bits <= 32)
{
s->bitstream |= (value << s->residue);
s->residue += bits;
}
while (s->residue >= 8)
{
s->residue -= 8;
*(*c)++ = (uint8_t) (s->bitstream & 0xFF);
s->bitstream >>= 8;
}
}
else
{
if (s->residue + bits <= 32)
{
s->bitstream = (s->bitstream << bits) | value;
s->residue += bits;
}
while (s->residue >= 8)
{
s->residue -= 8;
*(*c)++ = (uint8_t) ((s->bitstream >> s->residue) & 0xFF);
}
}
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) bitstream_emit(bitstream_state_t *s, uint8_t **c)
{
uint32_t bitstream;
if (s->residue > 0)
{
bitstream = s->bitstream & ((1 << s->residue) - 1);
if (s->lsb_first)
*(*c) = (uint8_t) bitstream;
else
*(*c) = (uint8_t) (bitstream << (8 - s->residue));
}
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c)
{
if (s->residue > 0)
{
bitstream_emit(s, c);
(*c)++;
s->residue = 0;
}
s->bitstream = 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(uint32_t) bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits)
{
uint32_t x;
if (s->lsb_first)
{
while (s->residue < bits)
{
s->bitstream |= (((uint32_t) *(*c)++) << s->residue);
s->residue += 8;
}
s->residue -= bits;
x = s->bitstream & ((1 << bits) - 1);
s->bitstream >>= bits;
}
else
{
while (s->residue < bits)
{
s->bitstream = (s->bitstream << 8) | ((uint32_t) *(*c)++);
s->residue += 8;
}
s->residue -= bits;
x = (s->bitstream >> s->residue) & ((1 << bits) - 1);
}
return x;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int lsb_first)
{
if (s == NULL)
{
if ((s = (bitstream_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->bitstream = 0;
s->residue = 0;
s->lsb_first = lsb_first;
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) bitstream_release(bitstream_state_t *s)
{
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) bitstream_free(bitstream_state_t *s)
{
if (s)
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

View File

@ -1,111 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* complex_filters.c
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2003 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.
*/
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/complex.h"
#include "spandsp/complex_filters.h"
SPAN_DECLARE(filter_t *) filter_create(fspec_t *fs)
{
int i;
filter_t *fi;
if ((fi = (filter_t *) span_alloc(sizeof(*fi) + sizeof(float)*(fs->np + 1))))
{
fi->fs = fs;
fi->sum = 0.0;
/* Moving average filters only */
fi->ptr = 0;
for (i = 0; i <= fi->fs->np; i++)
fi->v[i] = 0.0;
}
return fi;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) filter_delete(filter_t *fi)
{
if (fi)
span_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)
{
cfilter_t *cfi;
if ((cfi = (cfilter_t *) span_alloc(sizeof(*cfi))))
{
if ((cfi->ref = filter_create(fs)) == NULL)
{
span_free(cfi);
return NULL;
}
if ((cfi->imf = filter_create(fs)) == NULL)
{
span_free(cfi->ref);
span_free(cfi);
return NULL;
}
}
return cfi;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) cfilter_delete(cfilter_t *cfi)
{
if (cfi)
{
filter_delete(cfi->ref);
filter_delete(cfi->imf);
}
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(complexf_t) cfilter_step(cfilter_t *cfi, const complexf_t *z)
{
complexf_t cc;
cc.re = filter_step(cfi->ref, z->re);
cc.im = filter_step(cfi->imf, z->im);
return cc;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

View File

@ -1,211 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* complex_vector_float.c - Floating complex vector arithmetic routines.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2006 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.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include <assert.h>
#include "floating_fudge.h"
#include "mmx_sse_decs.h"
#include "spandsp/telephony.h"
#include "spandsp/logging.h"
#include "spandsp/complex.h"
#include "spandsp/vector_float.h"
#include "spandsp/complex_vector_float.h"
#if defined(__GNUC__) && defined(SPANDSP_USE_SSE3)
SPAN_DECLARE(void) cvec_mulf(complexf_t z[], const complexf_t x[], const complexf_t y[], int n)
{
int i;
__m128 n0;
__m128 n1;
__m128 n2;
__m128 n3;
if ((i = n & ~1))
{
i <<= 1;
for (i -= 4; i >= 0; i -= 4)
{
n3 = _mm_loadu_ps((float *) x + i);
n0 = _mm_moveldup_ps(n3);
n1 = _mm_loadu_ps((float *) y + i);
n0 = _mm_mul_ps(n0, n1);
n1 = _mm_shuffle_ps(n1, n1, 0xB1);
n2 = _mm_movehdup_ps(n3);
n2 = _mm_mul_ps(n2, n1);
n0 = _mm_addsub_ps(n0, n2);
_mm_storeu_ps((float *) z + i, n0);
}
}
/* Now deal with the last element, which doesn't fill an SSE2 register */
switch (n & 1)
{
case 1:
z[n - 1].re = x[n - 1].re*y[n - 1].re - x[n - 1].im*y[n - 1].im;
z[n - 1].im = x[n - 1].re*y[n - 1].im + x[n - 1].im*y[n - 1].re;
}
}
#else
SPAN_DECLARE(void) cvec_mulf(complexf_t z[], const complexf_t x[], const complexf_t y[], int n)
{
int i;
for (i = 0; i < n; i++)
{
z[i].re = x[i].re*y[i].re - x[i].im*y[i].im;
z[i].im = x[i].re*y[i].im + x[i].im*y[i].re;
}
}
#endif
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) cvec_mul(complex_t z[], const complex_t x[], const complex_t y[], int n)
{
int i;
for (i = 0; i < n; i++)
{
z[i].re = x[i].re*y[i].re - x[i].im*y[i].im;
z[i].im = x[i].re*y[i].im + x[i].im*y[i].re;
}
}
/*- End of function --------------------------------------------------------*/
#if defined(HAVE_LONG_DOUBLE)
SPAN_DECLARE(void) cvec_mull(complexl_t z[], const complexl_t x[], const complexl_t y[], int n)
{
int i;
for (i = 0; i < n; i++)
{
z[i].re = x[i].re*y[i].re - x[i].im*y[i].im;
z[i].im = x[i].re*y[i].im + x[i].im*y[i].re;
}
}
/*- End of function --------------------------------------------------------*/
#endif
SPAN_DECLARE(complexf_t) cvec_dot_prodf(const complexf_t x[], const complexf_t y[], int n)
{
int i;
complexf_t z;
z = complex_setf(0.0f, 0.0f);
for (i = 0; i < n; i++)
{
z.re += (x[i].re*y[i].re - x[i].im*y[i].im);
z.im += (x[i].re*y[i].im + x[i].im*y[i].re);
}
return z;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(complex_t) cvec_dot_prod(const complex_t x[], const complex_t y[], int n)
{
int i;
complex_t z;
z = complex_set(0.0, 0.0);
for (i = 0; i < n; i++)
{
z.re += (x[i].re*y[i].re - x[i].im*y[i].im);
z.im += (x[i].re*y[i].im + x[i].im*y[i].re);
}
return z;
}
/*- End of function --------------------------------------------------------*/
#if defined(HAVE_LONG_DOUBLE)
SPAN_DECLARE(complexl_t) cvec_dot_prodl(const complexl_t x[], const complexl_t y[], int n)
{
int i;
complexl_t z;
z = complex_setl(0.0L, 0.0L);
for (i = 0; i < n; i++)
{
z.re += (x[i].re*y[i].re - x[i].im*y[i].im);
z.im += (x[i].re*y[i].im + x[i].im*y[i].re);
}
return z;
}
/*- End of function --------------------------------------------------------*/
#endif
SPAN_DECLARE(complexf_t) cvec_circular_dot_prodf(const complexf_t x[], const complexf_t y[], int n, int pos)
{
complexf_t z;
complexf_t z1;
z = cvec_dot_prodf(&x[pos], &y[0], n - pos);
z1 = cvec_dot_prodf(&x[0], &y[n - pos], pos);
z = complex_addf(&z, &z1);
return z;
}
/*- End of function --------------------------------------------------------*/
#define LMS_LEAK_RATE 0.9999f
SPAN_DECLARE(void) cvec_lmsf(const complexf_t x[], complexf_t y[], int n, const complexf_t *error)
{
int i;
for (i = 0; i < n; i++)
{
/* Leak a little to tame uncontrolled wandering */
y[i].re = y[i].re*LMS_LEAK_RATE + (x[i].im*error->im + x[i].re*error->re);
y[i].im = y[i].im*LMS_LEAK_RATE + (x[i].re*error->im - x[i].im*error->re);
}
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) cvec_circular_lmsf(const complexf_t x[], complexf_t y[], int n, int pos, const complexf_t *error)
{
cvec_lmsf(&x[pos], &y[0], n - pos, error);
cvec_lmsf(&x[0], &y[n - pos], pos, error);
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

View File

@ -1,118 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* complex_vector_int.c - Integer complex vector arithmetic routines.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2006 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.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include <assert.h>
#include "floating_fudge.h"
#include "mmx_sse_decs.h"
#include "spandsp/telephony.h"
#include "spandsp/logging.h"
#include "spandsp/complex.h"
#include "spandsp/vector_int.h"
#include "spandsp/complex_vector_int.h"
SPAN_DECLARE(complexi32_t) cvec_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n)
{
int i;
complexi32_t z;
z = complex_seti32(0, 0);
for (i = 0; i < n; i++)
{
z.re += ((int32_t) x[i].re*(int32_t) y[i].re - (int32_t) x[i].im*(int32_t) y[i].im);
z.im += ((int32_t) x[i].re*(int32_t) y[i].im + (int32_t) x[i].im*(int32_t) y[i].re);
}
return z;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(complexi32_t) cvec_dot_prodi32(const complexi32_t x[], const complexi32_t y[], int n)
{
int i;
complexi32_t z;
z = complex_seti32(0, 0);
for (i = 0; i < n; i++)
{
z.re += (x[i].re*y[i].re - x[i].im*y[i].im);
z.im += (x[i].re*y[i].im + x[i].im*y[i].re);
}
return z;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(complexi32_t) cvec_circular_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n, int pos)
{
complexi32_t z;
complexi32_t z1;
z = cvec_dot_prodi16(&x[pos], &y[0], n - pos);
z1 = cvec_dot_prodi16(&x[0], &y[n - pos], pos);
z = complex_addi32(&z, &z1);
return z;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) cvec_lmsi16(const complexi16_t x[], complexi16_t y[], int n, const complexi16_t *error)
{
int i;
for (i = 0; i < n; i++)
{
y[i].re += (int16_t) (((int32_t) x[i].im*(int32_t) error->im + (int32_t) x[i].re*(int32_t) error->re) >> 12);
y[i].im += (int16_t) (((int32_t) x[i].re*(int32_t) error->im - (int32_t) x[i].im*(int32_t) error->re) >> 12);
}
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) cvec_circular_lmsi16(const complexi16_t x[], complexi16_t y[], int n, int pos, const complexi16_t *error)
{
cvec_lmsi16(&x[pos], &y[0], n - pos, error);
cvec_lmsi16(&x[0], &y[n - pos], pos, error);
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

View File

@ -1,212 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* crc.c
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2003 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.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "spandsp/telephony.h"
#include "spandsp/crc.h"
#include "spandsp/bit_operations.h"
static const uint32_t crc_itu32_table[] =
{
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
};
SPAN_DECLARE(uint32_t) crc_itu32_calc(const uint8_t *buf, int len, uint32_t crc)
{
int i;
for (i = 0; i < len; i++)
crc = ((crc >> 8) & 0x00FFFFFF) ^ crc_itu32_table[(crc ^ buf[i]) & 0xFF];
return crc;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) crc_itu32_append(uint8_t *buf, int len)
{
uint32_t crc;
int new_len;
int i;
crc = 0xFFFFFFFF;
new_len = len + 4;
for (i = 0; i < len; i++)
crc = ((crc >> 8) & 0x00FFFFFF) ^ crc_itu32_table[(crc ^ buf[i]) & 0xFF];
crc ^= 0xFFFFFFFF;
buf[i++] = (uint8_t) crc;
buf[i++] = (uint8_t) (crc >> 8);
buf[i++] = (uint8_t) (crc >> 16);
buf[i++] = (uint8_t) (crc >> 24);
return new_len;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(bool) crc_itu32_check(const uint8_t *buf, int len)
{
uint32_t crc;
int i;
crc = 0xFFFFFFFF;
for (i = 0; i < len; i++)
crc = ((crc >> 8) & 0x00FFFFFF) ^ crc_itu32_table[(crc ^ buf[i]) & 0xFF];
return (crc == 0xDEBB20E3);
}
/*- End of function --------------------------------------------------------*/
static const uint16_t crc_itu16_table[] =
{
0x0000, 0x1189, 0x2312, 0x329B, 0x4624, 0x57AD, 0x6536, 0x74BF,
0x8C48, 0x9DC1, 0xAF5A, 0xBED3, 0xCA6C, 0xDBE5, 0xE97E, 0xF8F7,
0x1081, 0x0108, 0x3393, 0x221A, 0x56A5, 0x472C, 0x75B7, 0x643E,
0x9CC9, 0x8D40, 0xBFDB, 0xAE52, 0xDAED, 0xCB64, 0xF9FF, 0xE876,
0x2102, 0x308B, 0x0210, 0x1399, 0x6726, 0x76AF, 0x4434, 0x55BD,
0xAD4A, 0xBCC3, 0x8E58, 0x9FD1, 0xEB6E, 0xFAE7, 0xC87C, 0xD9F5,
0x3183, 0x200A, 0x1291, 0x0318, 0x77A7, 0x662E, 0x54B5, 0x453C,
0xBDCB, 0xAC42, 0x9ED9, 0x8F50, 0xFBEF, 0xEA66, 0xD8FD, 0xC974,
0x4204, 0x538D, 0x6116, 0x709F, 0x0420, 0x15A9, 0x2732, 0x36BB,
0xCE4C, 0xDFC5, 0xED5E, 0xFCD7, 0x8868, 0x99E1, 0xAB7A, 0xBAF3,
0x5285, 0x430C, 0x7197, 0x601E, 0x14A1, 0x0528, 0x37B3, 0x263A,
0xDECD, 0xCF44, 0xFDDF, 0xEC56, 0x98E9, 0x8960, 0xBBFB, 0xAA72,
0x6306, 0x728F, 0x4014, 0x519D, 0x2522, 0x34AB, 0x0630, 0x17B9,
0xEF4E, 0xFEC7, 0xCC5C, 0xDDD5, 0xA96A, 0xB8E3, 0x8A78, 0x9BF1,
0x7387, 0x620E, 0x5095, 0x411C, 0x35A3, 0x242A, 0x16B1, 0x0738,
0xFFCF, 0xEE46, 0xDCDD, 0xCD54, 0xB9EB, 0xA862, 0x9AF9, 0x8B70,
0x8408, 0x9581, 0xA71A, 0xB693, 0xC22C, 0xD3A5, 0xE13E, 0xF0B7,
0x0840, 0x19C9, 0x2B52, 0x3ADB, 0x4E64, 0x5FED, 0x6D76, 0x7CFF,
0x9489, 0x8500, 0xB79B, 0xA612, 0xD2AD, 0xC324, 0xF1BF, 0xE036,
0x18C1, 0x0948, 0x3BD3, 0x2A5A, 0x5EE5, 0x4F6C, 0x7DF7, 0x6C7E,
0xA50A, 0xB483, 0x8618, 0x9791, 0xE32E, 0xF2A7, 0xC03C, 0xD1B5,
0x2942, 0x38CB, 0x0A50, 0x1BD9, 0x6F66, 0x7EEF, 0x4C74, 0x5DFD,
0xB58B, 0xA402, 0x9699, 0x8710, 0xF3AF, 0xE226, 0xD0BD, 0xC134,
0x39C3, 0x284A, 0x1AD1, 0x0B58, 0x7FE7, 0x6E6E, 0x5CF5, 0x4D7C,
0xC60C, 0xD785, 0xE51E, 0xF497, 0x8028, 0x91A1, 0xA33A, 0xB2B3,
0x4A44, 0x5BCD, 0x6956, 0x78DF, 0x0C60, 0x1DE9, 0x2F72, 0x3EFB,
0xD68D, 0xC704, 0xF59F, 0xE416, 0x90A9, 0x8120, 0xB3BB, 0xA232,
0x5AC5, 0x4B4C, 0x79D7, 0x685E, 0x1CE1, 0x0D68, 0x3FF3, 0x2E7A,
0xE70E, 0xF687, 0xC41C, 0xD595, 0xA12A, 0xB0A3, 0x8238, 0x93B1,
0x6B46, 0x7ACF, 0x4854, 0x59DD, 0x2D62, 0x3CEB, 0x0E70, 0x1FF9,
0xF78F, 0xE606, 0xD49D, 0xC514, 0xB1AB, 0xA022, 0x92B9, 0x8330,
0x7BC7, 0x6A4E, 0x58D5, 0x495C, 0x3DE3, 0x2C6A, 0x1EF1, 0x0F78
};
SPAN_DECLARE(uint16_t) crc_itu16_calc(const uint8_t *buf, int len, uint16_t crc)
{
int i;
for (i = 0; i < len; i++)
crc = (crc >> 8) ^ crc_itu16_table[(crc ^ buf[i]) & 0xFF];
return crc;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(uint16_t) crc_itu16_bits(uint8_t buf, int len, uint16_t crc)
{
int i;
for (i = 0; i < len; i++)
{
if (((buf ^ crc) & 1))
crc = (crc >> 1) ^ 0x8408;
else
crc = crc >> 1;
buf >>= 1;
}
return crc;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) crc_itu16_append(uint8_t *buf, int len)
{
uint16_t crc;
int new_len;
int i;
crc = 0xFFFF;
new_len = len + 2;
for (i = 0; i < len; i++)
crc = (crc >> 8) ^ crc_itu16_table[(crc ^ buf[i]) & 0xFF];
crc ^= 0xFFFF;
buf[i++] = (uint8_t) crc;
buf[i++] = (uint8_t) (crc >> 8);
return new_len;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(bool) crc_itu16_check(const uint8_t *buf, int len)
{
uint16_t crc;
int i;
crc = 0xFFFF;
for (i = 0; i < len; i++)
crc = (crc >> 8) ^ crc_itu16_table[(crc ^ buf[i]) & 0xFF];
return (crc & 0xFFFF) == 0xF0B8;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

View File

@ -1,713 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* data_modems.c - the analogue modem set for data processing
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2003, 2005, 2006, 2008, 2011, 2013 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.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <assert.h>
#include <fcntl.h>
#include <time.h>
#if defined(LOG_FAX_AUDIO)
#include <unistd.h>
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/dc_restore.h"
#include "spandsp/queue.h"
#include "spandsp/power_meter.h"
#include "spandsp/complex.h"
#include "spandsp/tone_detect.h"
#include "spandsp/tone_generate.h"
#include "spandsp/async.h"
#include "spandsp/at_interpreter.h"
#include "spandsp/silence_gen.h"
#include "spandsp/fsk.h"
#include "spandsp/v29rx.h"
#include "spandsp/v22bis.h"
#if defined(SPANDSP_SUPPORT_V32BIS)
#include "spandsp/v17tx.h"
#include "spandsp/v17rx.h"
#include "spandsp/modem_echo.h"
#include "spandsp/v32bis.h"
#endif
#if defined(SPANDSP_SUPPORT_V34)
#include "spandsp/bitstream.h"
#include "spandsp/v34.h"
#endif
#include "spandsp/super_tone_rx.h"
#include "spandsp/modem_connect_tones.h"
#include "spandsp/hdlc.h"
#include "spandsp/v42.h"
#include "spandsp/v42bis.h"
#include "spandsp/v8.h"
#include "spandsp/data_modems.h"
#include "spandsp/private/logging.h"
#include "spandsp/private/at_interpreter.h"
#include "spandsp/private/silence_gen.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#include "spandsp/private/v22bis.h"
#if defined(SPANDSP_SUPPORT_V32BIS)
#include "spandsp/private/v17tx.h"
#include "spandsp/private/v17rx.h"
#include "spandsp/private/modem_echo.h"
#include "spandsp/private/v32bis.h"
#endif
#if defined(SPANDSP_SUPPORT_V34)
#include "spandsp/private/bitstream.h"
#include "spandsp/private/v34.h"
#endif
#include "spandsp/private/modem_connect_tones.h"
#include "spandsp/private/hdlc.h"
#include "spandsp/private/v42.h"
#include "spandsp/private/v42bis.h"
#include "spandsp/private/v8.h"
#include "spandsp/private/async.h"
#include "spandsp/private/data_modems.h"
SPAN_DECLARE(const char *) data_modems_modulation_to_str(int modulation_scheme)
{
switch (modulation_scheme)
{
case DATA_MODEM_NONE:
return "None";
case DATA_MODEM_FLUSH:
return "Flush";
case DATA_MODEM_SILENCE:
return "Silence";
case DATA_MODEM_CED_TONE:
return "CED";
case DATA_MODEM_CNG_TONE:
return "CNG";
case DATA_MODEM_V8:
return "V.8";
case DATA_MODEM_BELL103:
return "B103 duplex";
case DATA_MODEM_BELL202:
return "B202 duplex";
case DATA_MODEM_V21:
return "V.21 duplex";
case DATA_MODEM_V23:
return "V.23 duplex";
case DATA_MODEM_V22BIS:
return "V.22/V.22bis duplex";
case DATA_MODEM_V32BIS:
return "V.32/V.32bis duplex";
case DATA_MODEM_V34:
return "V.34 duplex";
}
/*endswitch*/
return "???";
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(logging_state_t *) data_modems_get_logging_state(data_modems_state_t *s)
{
return &s->logging;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) data_modems_call_event(data_modems_state_t *s, int event)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Call event %s (%d) received\n", at_call_state_to_str(event), event);
at_call_event(&s->at_state, event);
}
/*- End of function --------------------------------------------------------*/
static int async_get_byte(void *user_data)
{
data_modems_state_t *s;
uint8_t msg[1];
s = (data_modems_state_t *) user_data;
s->get_msg(s->user_data, msg, 1);
return msg[0];
}
/*- End of function --------------------------------------------------------*/
static void async_put_byte(void *user_data, int byte)
{
data_modems_state_t *s;
uint8_t msg[1];
s = (data_modems_state_t *) user_data;
msg[0] = byte;
if (byte < 0)
s->put_msg(s->user_data, msg, byte);
/*endif*/
s->put_msg(s->user_data, msg, 1);
}
/*- End of function --------------------------------------------------------*/
static void tone_callback(void *user_data, int tone, int level, int delay)
{
printf("%s declared (%ddBm0)\n", modem_connect_tone_to_str(tone), level);
}
/*- End of function --------------------------------------------------------*/
static void log_supported_modulations(data_modems_state_t *s, int modulation_schemes)
{
const char *comma;
int i;
comma = "";
span_log(&s->logging, SPAN_LOG_FLOW, " ");
for (i = 0; i < 32; i++)
{
if ((modulation_schemes & (1 << i)))
{
span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s%s", comma, v8_modulation_to_str(modulation_schemes & (1 << i)));
comma = ", ";
}
/*endif*/
}
/*endfor*/
span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, " supported\n");
}
/*- End of function --------------------------------------------------------*/
static void v8_handler(void *user_data, v8_parms_t *result)
{
data_modems_state_t *s;
s = (data_modems_state_t *) user_data;
switch (result->status)
{
case V8_STATUS_IN_PROGRESS:
span_log(&s->logging, SPAN_LOG_FLOW, "V.8 negotiation in progress\n");
return;
case V8_STATUS_V8_OFFERED:
span_log(&s->logging, SPAN_LOG_FLOW, "V.8 offered by the other party\n");
break;
case V8_STATUS_V8_CALL:
span_log(&s->logging, SPAN_LOG_FLOW, "V.8 call negotiation successful\n");
break;
case V8_STATUS_NON_V8_CALL:
span_log(&s->logging, SPAN_LOG_FLOW, "Non-V.8 call negotiation successful\n");
break;
case V8_STATUS_FAILED:
span_log(&s->logging, SPAN_LOG_FLOW, "V.8 call negotiation failed\n");
return;
default:
span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected V.8 status %d\n", result->status);
break;
}
/*endswitch*/
span_log(&s->logging, SPAN_LOG_FLOW, " Modem connect tone '%s' (%d)\n", modem_connect_tone_to_str(result->modem_connect_tone), result->modem_connect_tone);
span_log(&s->logging, SPAN_LOG_FLOW, " Call function '%s' (%d)\n", v8_call_function_to_str(result->call_function), result->call_function);
span_log(&s->logging, SPAN_LOG_FLOW, " Far end modulations 0x%X\n", result->modulations);
log_supported_modulations(s, result->modulations);
span_log(&s->logging, SPAN_LOG_FLOW, " Protocol '%s' (%d)\n", v8_protocol_to_str(result->protocol), result->protocol);
span_log(&s->logging, SPAN_LOG_FLOW, " PSTN access '%s' (%d)\n", v8_pstn_access_to_str(result->pstn_access), result->pstn_access);
span_log(&s->logging, SPAN_LOG_FLOW, " PCM modem availability '%s' (%d)\n", v8_pcm_modem_availability_to_str(result->pcm_modem_availability), result->pcm_modem_availability);
if (result->t66 >= 0)
span_log(&s->logging, SPAN_LOG_FLOW, " T.66 '%s' (%d)\n", v8_t66_to_str(result->t66), result->t66);
/*endif*/
if (result->nsf >= 0)
span_log(&s->logging, SPAN_LOG_FLOW, " NSF %d\n", result->nsf);
/*endif*/
switch (result->status)
{
case V8_STATUS_V8_OFFERED:
/* V.8 mode has been offered. */
span_log(&s->logging, SPAN_LOG_FLOW, " Offered\n");
/* We now need to edit the offered list of usable modem modulations to reflect
the set of modulations both ends share */
//result->call_function = V8_CALL_T30_TX;
result->modulations &= (V8_MOD_V21
| V8_MOD_V22
| V8_MOD_V23HDX
| V8_MOD_V23
#if defined(SPANDSP_SUPPORT_V32BIS)
| V8_MOD_V32
#endif
#if defined(SPANDSP_SUPPORT_V34)
| V8_MOD_V34
#endif
| 0);
span_log(&s->logging, SPAN_LOG_FLOW, " Mutual modulations 0x%X\n", result->modulations);
log_supported_modulations(s, result->modulations);
break;
case V8_STATUS_V8_CALL:
span_log(&s->logging, SPAN_LOG_FLOW, " Call\n");
if (result->call_function == V8_CALL_V_SERIES)
{
/* Negotiations OK */
if (result->protocol == V8_PROTOCOL_LAPM_V42)
{
}
/*endif*/
#if defined(SPANDSP_SUPPORT_V34)
if ((result->modulations & V8_MOD_V34))
{
s->queued_baud_rate = 2400;
s->queued_bit_rate = 28800;
s->queued_modem = DATA_MODEM_V34;
}
else
#endif
#if defined(SPANDSP_SUPPORT_V32BIS)
if ((result->modulations & V8_MOD_V32))
{
s->queued_baud_rate = 2400;
s->queued_bit_rate = 14400;
s->queued_modem = DATA_MODEM_V32BIS;
}
else
#endif
if ((result->modulations & V8_MOD_V22))
{
s->queued_baud_rate = 600;
s->queued_bit_rate = 2400;
s->queued_modem = DATA_MODEM_V22BIS;
}
else if ((result->modulations & V8_MOD_V21))
{
s->queued_baud_rate = 300;
s->queued_bit_rate = 300;
s->queued_modem = DATA_MODEM_V21;
}
else
{
s->queued_modem = DATA_MODEM_NONE;
}
/*endif*/
span_log(&s->logging, SPAN_LOG_FLOW, " Negotiated modulation '%s' %d\n", data_modems_modulation_to_str(s->queued_modem), s->queued_modem);
}
/*endif*/
break;
case V8_STATUS_NON_V8_CALL:
span_log(&s->logging, SPAN_LOG_FLOW, " Non-V.8 call\n");
s->queued_modem = DATA_MODEM_V22BIS;
break;
default:
span_log(&s->logging, SPAN_LOG_FLOW, " Huh? %d\n", result->status);
break;
}
/*endswitch*/
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) data_modems_set_async_mode(data_modems_state_t *s,
int data_bits,
int parity_bit,
int stop_bits)
{
async_tx_init(&s->async_tx,
data_bits,
parity_bit,
stop_bits,
s->use_v14,
&async_get_byte,
s);
async_rx_init(&s->async_rx,
data_bits,
parity_bit,
stop_bits,
s->use_v14,
&async_put_byte,
s);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) data_modems_set_modem_type(data_modems_state_t *s, int which, int baud_rate, int bit_rate)
{
const fsk_spec_t *fsk_rx_spec;
const fsk_spec_t *fsk_tx_spec;
v8_parms_t v8_parms;
logging_state_t *logging;
int level;
switch (which)
{
case DATA_MODEM_SILENCE:
s->rx_handler = (span_rx_handler_t) &span_dummy_rx;
s->rx_fillin_handler = (span_rx_fillin_handler_t) &span_dummy_rx_fillin;
s->rx_user_data = NULL;
s->tx_handler = (span_tx_handler_t) &silence_gen;
s->tx_user_data = &s->modems.silence_gen;
silence_gen_init(&s->modems.silence_gen, 0);
break;
case DATA_MODEM_CNG_TONE:
s->rx_handler = (span_rx_handler_t) &modem_connect_tones_rx;
s->rx_fillin_handler = (span_rx_fillin_handler_t) &span_dummy_rx_fillin;
s->rx_user_data = &s->modems.tones.rx;
s->tx_handler = (span_tx_handler_t) &modem_connect_tones_tx;
s->tx_user_data = &s->modems.tones.tx;
modem_connect_tones_rx_init(&s->modems.tones.rx,
MODEM_CONNECT_TONES_FAX_CNG,
tone_callback,
s);
modem_connect_tones_tx_init(&s->modems.tones.tx, MODEM_CONNECT_TONES_FAX_CNG);
break;
case DATA_MODEM_V8:
s->rx_handler = (span_rx_handler_t) &v8_rx;
s->rx_fillin_handler = (span_rx_fillin_handler_t) &span_dummy_rx_fillin;
s->rx_user_data = &s->modems.v8;
s->tx_handler = (span_tx_handler_t) &v8_tx;
s->tx_user_data = &s->modems.v8;
if (s->calling_party)
v8_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE;
else
v8_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR;
/*endif*/
v8_parms.send_ci = false;
v8_parms.v92 = -1;
v8_parms.call_function = V8_CALL_V_SERIES;
#if 0
v8_parms.modulations = V8_MOD_V17
| V8_MOD_V21
| V8_MOD_V22
| V8_MOD_V23HDX
| V8_MOD_V23
| V8_MOD_V27TER
| V8_MOD_V29
#if defined(SPANDSP_SUPPORT_V34)
| V8_MOD_V34HDX
#endif
| 0;
v8_parms.protocol = V8_PROTOCOL_LAPM_V42;
#elif 1
v8_parms.modulations = V8_MOD_V21
| V8_MOD_V22
| V8_MOD_V23HDX
| V8_MOD_V23
#if defined(SPANDSP_SUPPORT_V32BIS)
| V8_MOD_V32
#endif
#if defined(SPANDSP_SUPPORT_V34)
| V8_MOD_V34
#endif
| 0;
v8_parms.protocol = V8_PROTOCOL_LAPM_V42;
#endif
v8_parms.pcm_modem_availability = 0;
v8_parms.pstn_access = 0;
v8_parms.nsf = -1;
v8_parms.t66 = -1;
v8_init(&s->modems.v8, s->calling_party, &v8_parms, v8_handler, (void *) s);
logging = v8_get_logging_state(&s->modems.v8);
level = span_log_get_level(&s->logging);
span_log_set_level(logging, level);
span_log_set_tag(logging, "V.8");
break;
case DATA_MODEM_BELL103:
s->rx_handler = (span_rx_handler_t) &fsk_rx;
s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin;
s->rx_user_data = &s->modems.fsk.rx;
s->tx_handler = (span_tx_handler_t) &fsk_tx;
s->tx_user_data = &s->modems.fsk.tx;
if (s->calling_party)
{
fsk_rx_spec = &preset_fsk_specs[FSK_BELL103CH2];
fsk_tx_spec = &preset_fsk_specs[FSK_BELL103CH1];
}
else
{
fsk_rx_spec = &preset_fsk_specs[FSK_BELL103CH1];
fsk_tx_spec = &preset_fsk_specs[FSK_BELL103CH2];
}
/*endif*/
fsk_rx_init(&s->modems.fsk.rx, fsk_rx_spec, FSK_FRAME_MODE_SYNC, s->put_bit, s->put_user_data);
fsk_tx_init(&s->modems.fsk.tx, fsk_tx_spec, s->get_bit, s->get_user_data);
break;
case DATA_MODEM_V21:
s->rx_handler = (span_rx_handler_t) &fsk_rx;
s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin;
s->rx_user_data = &s->modems.fsk.rx;
s->tx_handler = (span_tx_handler_t) &fsk_tx;
s->tx_user_data = &s->modems.fsk.tx;
if (s->calling_party)
{
fsk_rx_spec = &preset_fsk_specs[FSK_V21CH2];
fsk_tx_spec = &preset_fsk_specs[FSK_V21CH1];
}
else
{
fsk_rx_spec = &preset_fsk_specs[FSK_V21CH1];
fsk_tx_spec = &preset_fsk_specs[FSK_V21CH2];
}
/*endif*/
fsk_rx_init(&s->modems.fsk.rx, fsk_rx_spec, FSK_FRAME_MODE_SYNC, s->put_bit, s->put_user_data);
fsk_tx_init(&s->modems.fsk.tx, fsk_tx_spec, s->get_bit, s->get_user_data);
break;
case DATA_MODEM_BELL202:
s->rx_handler = (span_rx_handler_t) &fsk_rx;
s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin;
s->rx_user_data = &s->modems.fsk.rx;
s->tx_handler = (span_tx_handler_t) &fsk_tx;
s->tx_user_data = &s->modems.fsk.tx;
fsk_rx_spec = &preset_fsk_specs[FSK_BELL202];
fsk_tx_spec = &preset_fsk_specs[FSK_BELL202];
fsk_rx_init(&s->modems.fsk.rx, fsk_rx_spec, FSK_FRAME_MODE_SYNC, s->put_bit, s->put_user_data);
fsk_tx_init(&s->modems.fsk.tx, fsk_tx_spec, s->get_bit, s->get_user_data);
break;
case DATA_MODEM_V23:
s->rx_handler = (span_rx_handler_t) &fsk_rx;
s->rx_fillin_handler = (span_rx_fillin_handler_t) &fsk_rx_fillin;
s->rx_user_data = &s->modems.fsk.rx;
s->tx_handler = (span_tx_handler_t) &fsk_tx;
s->tx_user_data = &s->modems.fsk.tx;
if (s->calling_party)
{
fsk_rx_spec = &preset_fsk_specs[FSK_V23CH2];
fsk_tx_spec = &preset_fsk_specs[FSK_V23CH1];
}
else
{
fsk_rx_spec = &preset_fsk_specs[FSK_V23CH1];
fsk_tx_spec = &preset_fsk_specs[FSK_V23CH2];
}
/*endif*/
fsk_rx_init(&s->modems.fsk.rx, fsk_rx_spec, FSK_FRAME_MODE_SYNC, s->put_bit, s->put_user_data);
fsk_tx_init(&s->modems.fsk.tx, fsk_tx_spec, s->get_bit, s->get_user_data);
break;
case DATA_MODEM_V22BIS:
s->rx_handler = (span_rx_handler_t) &v22bis_rx;
s->rx_fillin_handler = (span_rx_fillin_handler_t) &v22bis_rx_fillin;
s->rx_user_data = &s->modems.v22bis;
s->tx_handler = (span_tx_handler_t) &v22bis_tx;
s->tx_user_data = &s->modems.v22bis;
v22bis_init(&s->modems.v22bis, bit_rate, 0, s->calling_party, s->get_bit, s->get_user_data, s->put_bit, s->put_user_data);
logging = v22bis_get_logging_state(&s->modems.v22bis);
level = span_log_get_level(&s->logging);
span_log_set_level(logging, level);
span_log_set_tag(logging, "V.22bis");
break;
#if defined(SPANDSP_SUPPORT_V32BIS)
case DATA_MODEM_V32BIS:
s->rx_handler = (span_rx_handler_t) &v32bis_rx;
s->rx_fillin_handler = (span_rx_fillin_handler_t) &v32bis_rx_fillin;
s->rx_user_data = &s->modems.v32bis;
s->tx_handler = (span_tx_handler_t) &v32bis_tx;
s->tx_user_data = &s->modems.v32bis;
v32bis_init(&s->modems.v32bis, bit_rate, s->calling_party, s->get_bit, s->get_user_data, s->put_bit, s->put_user_data);
logging = v32bis_get_logging_state(&s->modems.v32bis);
level = span_log_get_level(&s->logging);
span_log_set_level(logging, level);
span_log_set_tag(logging, "V.32bis");
break;
#endif
#if defined(SPANDSP_SUPPORT_V34)
case DATA_MODEM_V34:
s->rx_handler = (span_rx_handler_t) &v34_rx;
s->rx_fillin_handler = (span_rx_fillin_handler_t) &v34_rx_fillin;
s->rx_user_data = &s->modems.v34;
s->tx_handler = (span_tx_handler_t) &v34_tx;
s->tx_user_data = &s->modems.v34;
v34_init(&s->modems.v34, baud_rate, bit_rate, s->calling_party, true, s->get_bit, s->get_user_data, s->put_bit, s->put_user_data);
logging = v34_get_logging_state(&s->modems.v34);
level = span_log_get_level(&s->logging);
span_log_set_level(logging, level);
span_log_set_tag(logging, "V.34");
break;
#endif
}
/*endswitch*/
s->current_modem = which;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) data_modems_rx(data_modems_state_t *s, const int16_t amp[], int len)
{
int res;
if (s->rx_handler == NULL)
return len;
/*endif*/
res = s->rx_handler(s->rx_user_data, amp, len);
if (s->current_modem != s->queued_modem)
data_modems_set_modem_type(s, s->queued_modem, s->queued_baud_rate, s->queued_bit_rate);
/*endif*/
return res;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) data_modems_rx_fillin(data_modems_state_t *s, int len)
{
if (s->rx_fillin_handler == NULL)
return len;
/*endif*/
return s->rx_fillin_handler(s->rx_user_data, len);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) data_modems_tx(data_modems_state_t *s, int16_t amp[], int max_len)
{
int len;
for (len = 0; len < max_len; )
{
if (s->tx_handler == NULL)
break;
/*endif*/
len += s->tx_handler(s->tx_user_data, &amp[len], max_len - len);
}
/*endfor*/
return len;
}
/*- End of function --------------------------------------------------------*/
static int data_modems_control_handler(void *user_data, int op, const char *num)
{
data_modems_state_t *s;
s = (data_modems_state_t *) user_data;
switch (op)
{
case AT_MODEM_CONTROL_CALL:
s->call_samples = 0;
break;
case AT_MODEM_CONTROL_ANSWER:
s->call_samples = 0;
break;
case AT_MODEM_CONTROL_ONHOOK:
if (s->at_state.rx_signal_present)
{
s->at_state.rx_data_bytes = 0;
}
/*endif*/
break;
case AT_MODEM_CONTROL_RESTART:
return 0;
case AT_MODEM_CONTROL_DTE_TIMEOUT:
return 0;
}
/*endswitch*/
return s->modem_control_handler(s, s->modem_control_user_data, op, num);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) data_modems_set_at_tx_handler(data_modems_state_t *s,
at_tx_handler_t at_tx_handler,
void *at_tx_user_data)
{
at_set_at_tx_handler(&s->at_state, at_tx_handler, at_tx_user_data);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) data_modems_restart(data_modems_state_t *s)
{
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(data_modems_state_t *) data_modems_init(data_modems_state_t *s,
bool calling_party,
at_tx_handler_t at_tx_handler,
void *at_tx_user_data,
data_modems_control_handler_t modem_control_handler,
void *modem_control_user_data,
put_msg_func_t put_msg,
get_msg_func_t get_msg,
void *user_data)
{
if (at_tx_handler == NULL || modem_control_handler == NULL)
return NULL;
/*endif*/
if (s == NULL)
{
if ((s = (data_modems_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
/*endif*/
}
/*endif*/
memset(s, 0, sizeof(*s));
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
span_log_set_protocol(&s->logging, "Modem");
dc_restore_init(&s->dc_restore);
s->modem_control_handler = modem_control_handler;
s->modem_control_user_data = modem_control_user_data;
s->put_msg = put_msg;
s->get_msg = get_msg;
s->user_data = user_data;
v42bis_init(&s->v42bis, 3, 512, 6, NULL, s, 512, put_msg, s, 512);
v42_init(&s->v42, true, true, NULL, (put_msg_func_t) v42bis_decompress, &s->v42bis);
data_modems_set_async_mode(s, 8, 1, 1);
at_init(&s->at_state, at_tx_handler, at_tx_user_data, data_modems_control_handler, s);
s->get_bit = async_tx_get_bit;
s->get_user_data = &s->async_tx;
s->put_bit = async_rx_put_bit;
s->put_user_data = &s->async_rx;
s->calling_party = calling_party;
data_modems_set_modem_type(s, DATA_MODEM_V8, 0, 0);
s->queued_modem = s->current_modem;
s->rx_signal_present = false;
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) data_modems_release(data_modems_state_t *s)
{
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) data_modems_free(data_modems_state_t *s)
{
if (s)
span_free(s);
/*endif*/
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

File diff suppressed because it is too large Load Diff

View File

@ -1,468 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* dds.c
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2003 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.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <inttypes.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/complex.h"
#include "spandsp/dds.h"
/* In a A-law or u-law channel, a fairly coarse step sine table is adequate to keep the spectral
mess due to the DDS at a similar level to the spectral mess due to the A-law or u-law
compression. */
#define SLENK 8
#define DDS_STEPS (1 << SLENK)
#define DDS_SHIFT (32 - 2 - SLENK)
/* This is a simple set of direct digital synthesis (DDS) functions to generate sine
waves. This version uses a 256 entry sin/cos table to cover one quadrant. */
static const int16_t sine_table[DDS_STEPS + 1] =
{
0,
201,
402,
603,
804,
1005,
1206,
1407,
1608,
1809,
2009,
2210,
2410,
2611,
2811,
3012,
3212,
3412,
3612,
3811,
4011,
4210,
4410,
4609,
4808,
5007,
5205,
5404,
5602,
5800,
5998,
6195,
6393,
6590,
6786,
6983,
7179,
7375,
7571,
7767,
7962,
8157,
8351,
8545,
8739,
8933,
9126,
9319,
9512,
9704,
9896,
10087,
10278,
10469,
10659,
10849,
11039,
11228,
11417,
11605,
11793,
11980,
12167,
12353,
12539,
12725,
12910,
13094,
13279,
13462,
13645,
13828,
14010,
14191,
14372,
14553,
14732,
14912,
15090,
15269,
15446,
15623,
15800,
15976,
16151,
16325,
16499,
16673,
16846,
17018,
17189,
17360,
17530,
17700,
17869,
18037,
18204,
18371,
18537,
18703,
18868,
19032,
19195,
19357,
19519,
19680,
19841,
20000,
20159,
20317,
20475,
20631,
20787,
20942,
21096,
21250,
21403,
21554,
21705,
21856,
22005,
22154,
22301,
22448,
22594,
22739,
22884,
23027,
23170,
23311,
23452,
23592,
23731,
23870,
24007,
24143,
24279,
24413,
24547,
24680,
24811,
24942,
25072,
25201,
25329,
25456,
25582,
25708,
25832,
25955,
26077,
26198,
26319,
26438,
26556,
26674,
26790,
26905,
27019,
27133,
27245,
27356,
27466,
27575,
27683,
27790,
27896,
28001,
28105,
28208,
28310,
28411,
28510,
28609,
28706,
28803,
28898,
28992,
29085,
29177,
29268,
29358,
29447,
29534,
29621,
29706,
29791,
29874,
29956,
30037,
30117,
30195,
30273,
30349,
30424,
30498,
30571,
30643,
30714,
30783,
30852,
30919,
30985,
31050,
31113,
31176,
31237,
31297,
31356,
31414,
31470,
31526,
31580,
31633,
31685,
31736,
31785,
31833,
31880,
31926,
31971,
32014,
32057,
32098,
32137,
32176,
32213,
32250,
32285,
32318,
32351,
32382,
32412,
32441,
32469,
32495,
32521,
32545,
32567,
32589,
32609,
32628,
32646,
32663,
32678,
32692,
32705,
32717,
32728,
32737,
32745,
32752,
32757,
32761,
32765,
32766,
32767
};
SPAN_DECLARE(int32_t) dds_phase_rate(float frequency)
{
return (int32_t) (frequency*65536.0f*65536.0f/SAMPLE_RATE);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(float) dds_frequency(int32_t phase_rate)
{
return (float) phase_rate*(float) SAMPLE_RATE/(65536.0f*65536.0f);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int16_t) dds_scaling_dbm0(float level)
{
return (int16_t) (powf(10.0f, (level - DBM0_MAX_SINE_POWER)/20.0f)*32767.0f);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int16_t) dds_scaling_dbov(float level)
{
return (int16_t) (powf(10.0f, (level - DBOV_MAX_SINE_POWER)/20.0f)*32767.0f);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int16_t) dds_lookup(uint32_t phase)
{
uint32_t step;
int16_t amp;
phase >>= DDS_SHIFT;
step = phase & (DDS_STEPS - 1);
if ((phase & DDS_STEPS))
step = DDS_STEPS - step;
amp = sine_table[step];
if ((phase & (2*DDS_STEPS)))
amp = -amp;
return amp;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int16_t) dds_offset(uint32_t phase_acc, int32_t phase_offset)
{
return dds_lookup(phase_acc + phase_offset);
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) dds_advance(uint32_t *phase_acc, int32_t phase_rate)
{
*phase_acc += phase_rate;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int16_t) dds(uint32_t *phase_acc, int32_t phase_rate)
{
int16_t amp;
amp = dds_lookup(*phase_acc);
*phase_acc += phase_rate;
return amp;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int16_t) dds_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
{
int16_t amp;
amp = (int16_t) (((int32_t) dds_lookup(*phase_acc + phase)*scale) >> 15);
*phase_acc += phase_rate;
return amp;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(complexi_t) dds_lookup_complexi(uint32_t phase)
{
return complex_seti(dds_lookup(phase + (1 << 30)), dds_lookup(phase));
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(complexi_t) dds_complexi(uint32_t *phase_acc, int32_t phase_rate)
{
complexi_t amp;
amp = complex_seti(dds_lookup(*phase_acc + (1 << 30)), dds_lookup(*phase_acc));
*phase_acc += phase_rate;
return amp;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(complexi_t) dds_complexi_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
{
complexi_t amp;
amp = complex_seti(((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*scale) >> 15,
((int32_t) dds_lookup(*phase_acc + phase)*scale) >> 15);
*phase_acc += phase_rate;
return amp;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(complexi16_t) dds_lookup_complexi16(uint32_t phase)
{
return complex_seti16(dds_lookup(phase + (1 << 30)), dds_lookup(phase));
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(complexi16_t) dds_complexi16(uint32_t *phase_acc, int32_t phase_rate)
{
complexi16_t amp;
amp = complex_seti16(dds_lookup(*phase_acc + (1 << 30)), dds_lookup(*phase_acc));
*phase_acc += phase_rate;
return amp;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(complexi16_t) dds_complexi16_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
{
complexi16_t amp;
amp = complex_seti16((int16_t) (((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*scale) >> 15),
(int16_t) (((int32_t) dds_lookup(*phase_acc + phase)*scale) >> 15));
*phase_acc += phase_rate;
return amp;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(complexi32_t) dds_lookup_complexi32(uint32_t phase)
{
return complex_seti32(dds_lookup(phase + (1 << 30)), dds_lookup(phase));
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(complexi32_t) dds_complexi32(uint32_t *phase_acc, int32_t phase_rate)
{
complexi32_t amp;
amp = complex_seti32(dds_lookup(*phase_acc + (1 << 30)), dds_lookup(*phase_acc));
*phase_acc += phase_rate;
return amp;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(complexi32_t) dds_complexi32_mod(uint32_t *phase_acc, int32_t phase_rate, int16_t scale, int32_t phase)
{
complexi32_t amp;
amp = complex_seti32(((int32_t) dds_lookup(*phase_acc + phase + (1 << 30))*scale) >> 15,
((int32_t) dds_lookup(*phase_acc + phase)*scale) >> 15);
*phase_acc += phase_rate;
return amp;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

View File

@ -1,612 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* dtmf.c - DTMF generation and detection.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2001-2003, 2005, 2006 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.
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <stdlib.h>
#include <inttypes.h>
#include <memory.h>
#include <string.h>
#include <limits.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/fast_convert.h"
#include "spandsp/queue.h"
#include "spandsp/complex.h"
#include "spandsp/dds.h"
#include "spandsp/tone_detect.h"
#include "spandsp/tone_generate.h"
#include "spandsp/super_tone_rx.h"
#include "spandsp/dtmf.h"
#include "spandsp/private/logging.h"
#include "spandsp/private/queue.h"
#include "spandsp/private/tone_generate.h"
#include "spandsp/private/dtmf.h"
#define DEFAULT_DTMF_TX_LEVEL -10
#define DEFAULT_DTMF_TX_ON_TIME 50
#define DEFAULT_DTMF_TX_OFF_TIME 55
#if defined(SPANDSP_USE_FIXED_POINT)
/* The fixed point version scales the 16 bit signal down by 7 bits, so the Goertzels will fit in a 32 bit word */
#define FP_SCALE(x) ((int16_t) (x/128.0 + ((x >= 0.0) ? 0.5 : -0.5)))
#define DTMF_THRESHOLD 10438 /* -42dBm0 [((DTMF_SAMPLES_PER_BLOCK*32768.0/1.4142)*10^((-42 - DBM0_MAX_SINE_POWER)/20.0)/128.0)^2]*/
#define DTMF_NORMAL_TWIST 6.309f /* 8dB [10.0^(8.0/10.0)] */
#define DTMF_REVERSE_TWIST 2.512f /* 4dB [10.0^(4.0/10.0)] */
#define DTMF_RELATIVE_PEAK_ROW 6.309f /* 8dB [10.0^(8.0/10.0)] */
#define DTMF_RELATIVE_PEAK_COL 6.309f /* 8dB [10.0^(8.0/10.0)] */
#define DTMF_TO_TOTAL_ENERGY 83.868f /* -0.85dB [DTMF_SAMPLES_PER_BLOCK*10^(-0.85/10.0)] */
#define DTMF_POWER_OFFSET 68.251f /* 10*log(((32768.0/128.0)^2)*DTMF_SAMPLES_PER_BLOCK) */
#define DTMF_SAMPLES_PER_BLOCK 102
#else
#define FP_SCALE(x) (x)
#define DTMF_THRESHOLD 171032462.0f /* -42dBm0 [((DTMF_SAMPLES_PER_BLOCK*32768.0/1.4142)*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2] */
#define DTMF_NORMAL_TWIST 6.309f /* 8dB [10.0^(8.0/10.0)] */
#define DTMF_REVERSE_TWIST 2.512f /* 4dB [10.0^(4.0/10.0)] */
#define DTMF_RELATIVE_PEAK_ROW 6.309f /* 8dB [10.0^(8.0/10.0)] */
#define DTMF_RELATIVE_PEAK_COL 6.309f /* 8dB [10.0^(8.0/10.0)] */
#define DTMF_TO_TOTAL_ENERGY 83.868f /* -0.85dB [DTMF_SAMPLES_PER_BLOCK*10^(-0.85/10.0)] */
#define DTMF_POWER_OFFSET 110.395f /* 10*log((32768.0^2)*DTMF_SAMPLES_PER_BLOCK) */
#define DTMF_SAMPLES_PER_BLOCK 102
#endif
static const float dtmf_row[] =
{
697.0f, 770.0f, 852.0f, 941.0f
};
static const float dtmf_col[] =
{
1209.0f, 1336.0f, 1477.0f, 1633.0f
};
static const char dtmf_positions[] = "123A" "456B" "789C" "*0#D";
static bool dtmf_rx_inited = false;
static goertzel_descriptor_t dtmf_detect_row[4];
static goertzel_descriptor_t dtmf_detect_col[4];
static bool dtmf_tx_inited = false;
static tone_gen_descriptor_t dtmf_digit_tones[16];
SPAN_DECLARE(int) dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples)
{
#if defined(SPANDSP_USE_FIXED_POINT)
int32_t row_energy[4];
int32_t col_energy[4];
int16_t xamp;
float famp;
#else
float row_energy[4];
float col_energy[4];
float xamp;
float famp;
#endif
float v1;
int i;
int j;
int sample;
int best_row;
int best_col;
int limit;
uint8_t hit;
for (sample = 0; sample < samples; sample = limit)
{
/* The block length is optimised to meet the DTMF specs. */
if ((samples - sample) >= (DTMF_SAMPLES_PER_BLOCK - s->current_sample))
limit = sample + (DTMF_SAMPLES_PER_BLOCK - s->current_sample);
else
limit = samples;
/* The following unrolled loop takes only 35% (rough estimate) of the
time of a rolled loop on the machine on which it was developed */
for (j = sample; j < limit; j++)
{
xamp = amp[j];
if (s->filter_dialtone)
{
famp = xamp;
/* Sharp notches applied at 350Hz and 440Hz - the two common dialtone frequencies.
These are rather high Q, to achieve the required narrowness, without using lots of
sections. */
v1 = 0.98356f*famp + 1.8954426f*s->z350[0] - 0.9691396f*s->z350[1];
famp = v1 - 1.9251480f*s->z350[0] + s->z350[1];
s->z350[1] = s->z350[0];
s->z350[0] = v1;
v1 = 0.98456f*famp + 1.8529543f*s->z440[0] - 0.9691396f*s->z440[1];
famp = v1 - 1.8819938f*s->z440[0] + s->z440[1];
s->z440[1] = s->z440[0];
s->z440[0] = v1;
xamp = famp;
}
xamp = goertzel_preadjust_amp(xamp);
#if defined(SPANDSP_USE_FIXED_POINT)
s->energy += ((int32_t) xamp*xamp);
#else
s->energy += xamp*xamp;
#endif
goertzel_samplex(&s->row_out[0], xamp);
goertzel_samplex(&s->col_out[0], xamp);
goertzel_samplex(&s->row_out[1], xamp);
goertzel_samplex(&s->col_out[1], xamp);
goertzel_samplex(&s->row_out[2], xamp);
goertzel_samplex(&s->col_out[2], xamp);
goertzel_samplex(&s->row_out[3], xamp);
goertzel_samplex(&s->col_out[3], xamp);
}
if (s->duration < INT_MAX - (limit - sample))
s->duration += (limit - sample);
s->current_sample += (limit - sample);
if (s->current_sample < DTMF_SAMPLES_PER_BLOCK)
continue;
/* We are at the end of a DTMF detection block */
/* Find the peak row and the peak column */
row_energy[0] = goertzel_result(&s->row_out[0]);
best_row = 0;
col_energy[0] = goertzel_result(&s->col_out[0]);
best_col = 0;
for (i = 1; i < 4; i++)
{
row_energy[i] = goertzel_result(&s->row_out[i]);
if (row_energy[i] > row_energy[best_row])
best_row = i;
col_energy[i] = goertzel_result(&s->col_out[i]);
if (col_energy[i] > col_energy[best_col])
best_col = i;
}
hit = 0;
/* Basic signal level test and the twist test */
if (row_energy[best_row] >= s->threshold
&&
col_energy[best_col] >= s->threshold)
{
if (col_energy[best_col] < row_energy[best_row]*s->reverse_twist
&&
col_energy[best_col]*s->normal_twist > row_energy[best_row])
{
/* Relative peak test ... */
for (i = 0; i < 4; i++)
{
if ((i != best_col && col_energy[i]*DTMF_RELATIVE_PEAK_COL > col_energy[best_col])
||
(i != best_row && row_energy[i]*DTMF_RELATIVE_PEAK_ROW > row_energy[best_row]))
{
break;
}
}
/* ... and fraction of total energy test */
if (i >= 4
&&
(row_energy[best_row] + col_energy[best_col]) > DTMF_TO_TOTAL_ENERGY*s->energy)
{
/* Got a hit */
hit = dtmf_positions[(best_row << 2) + best_col];
}
}
if (span_log_test(&s->logging, SPAN_LOG_FLOW))
{
/* Log information about the quality of the signal, to aid analysis of detection problems */
/* Logging at this point filters the total no-hoper frames out of the log, and leaves
anything which might feasibly be a DTMF digit. The log will then contain a list of the
total, row and coloumn power levels for detailed analysis of detection problems. */
span_log(&s->logging,
SPAN_LOG_FLOW,
"Potentially '%c' - total %.2fdB, row %.2fdB, col %.2fdB, duration %d - %s\n",
dtmf_positions[(best_row << 2) + best_col],
log10f(s->energy)*10.0f - DTMF_POWER_OFFSET + DBM0_MAX_POWER,
log10f(row_energy[best_row]/DTMF_TO_TOTAL_ENERGY)*10.0f - DTMF_POWER_OFFSET + DBM0_MAX_POWER,
log10f(col_energy[best_col]/DTMF_TO_TOTAL_ENERGY)*10.0f - DTMF_POWER_OFFSET + DBM0_MAX_POWER,
s->duration,
(hit) ? "hit" : "miss");
}
}
/* The logic in the next test should ensure the following for different successive hit patterns:
-----ABB = start of digit B.
----B-BB = start of digit B
----A-BB = start of digit B
BBBBBABB = still in digit B.
BBBBBB-- = end of digit B
BBBBBBC- = end of digit B
BBBBACBB = B ends, then B starts again.
BBBBBBCC = B ends, then C starts.
BBBBBCDD = B ends, then D starts.
This can work with:
- Back to back differing digits. Back-to-back digits should
not happen. The spec. says there should be a gap between digits.
However, many real phones do not impose a gap, and rolling across
the keypad can produce little or no gap.
- It tolerates nasty phones that give a very wobbly start to a digit.
- VoIP can give sample slips. The phase jumps that produces will cause
the block it is in to give no detection. This logic will ride over a
single missed block, and not falsely declare a second digit. If the
hiccup happens in the wrong place on a minimum length digit, however
we would still fail to detect that digit. Could anything be done to
deal with that? Packet loss is clearly a no-go zone.
Note this is only relevant to VoIP using A-law, u-law or similar.
Low bit rate codecs scramble DTMF too much for it to be recognised,
and often slip in units larger than a sample. */
if (hit != s->in_digit && s->last_hit != s->in_digit)
{
/* We have two successive indications that something has changed. */
/* To declare digit on, the hits must agree. Otherwise we declare tone off. */
hit = (hit && hit == s->last_hit) ? hit : 0;
if (s->realtime_callback)
{
/* Avoid reporting multiple no digit conditions on flaky hits */
if (s->in_digit || hit)
{
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, s->duration);
s->duration = 0;
}
}
else
{
if (hit)
{
if (s->current_digits < MAX_DTMF_DIGITS)
{
s->digits[s->current_digits++] = (char) hit;
s->digits[s->current_digits] = '\0';
if (s->digits_callback)
{
s->digits_callback(s->digits_callback_data, s->digits, s->current_digits);
s->current_digits = 0;
}
}
else
{
s->lost_digits++;
}
}
}
s->in_digit = hit;
}
s->last_hit = hit;
s->energy = FP_SCALE(0.0f);
s->current_sample = 0;
}
if (s->current_digits && s->digits_callback)
{
s->digits_callback(s->digits_callback_data, s->digits, s->current_digits);
s->digits[0] = '\0';
s->current_digits = 0;
}
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) dtmf_rx_fillin(dtmf_rx_state_t *s, int samples)
{
int i;
/* Restart any Goertzel and energy gathering operation we might be in the middle of. */
for (i = 0; i < 4; i++)
{
goertzel_reset(&s->row_out[i]);
goertzel_reset(&s->col_out[i]);
}
s->energy = FP_SCALE(0.0f);
s->current_sample = 0;
/* Don't update the hit detection. Pretend it never happened. */
/* TODO: Surely we can be cleverer than this. */
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) dtmf_rx_status(dtmf_rx_state_t *s)
{
if (s->in_digit)
return s->in_digit;
if (s->last_hit)
return 'x';
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(size_t) dtmf_rx_get(dtmf_rx_state_t *s, char *buf, int max)
{
if (max > s->current_digits)
max = s->current_digits;
if (max > 0)
{
memcpy(buf, s->digits, max);
memmove(s->digits, s->digits + max, s->current_digits - max);
s->current_digits -= max;
}
buf[max] = '\0';
return 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)
{
s->realtime_callback = callback;
s->realtime_callback_data = user_data;
s->duration = 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) dtmf_rx_parms(dtmf_rx_state_t *s,
int filter_dialtone,
float twist,
float reverse_twist,
float threshold)
{
float x;
if (filter_dialtone >= 0)
{
s->z350[0] = 0.0f;
s->z350[1] = 0.0f;
s->z440[0] = 0.0f;
s->z440[1] = 0.0f;
s->filter_dialtone = filter_dialtone;
}
if (twist >= 0)
s->normal_twist = powf(10.0f, twist/10.0f);
if (reverse_twist >= 0)
s->reverse_twist = powf(10.0f, reverse_twist/10.0f);
if (threshold > -99)
{
#if defined(SPANDSP_USE_FIXED_POINT)
x = (DTMF_SAMPLES_PER_BLOCK*32768.0f/(128.0f*1.4142f))*powf(10.0f, (threshold - DBM0_MAX_SINE_POWER)/20.0f);
#else
x = (DTMF_SAMPLES_PER_BLOCK*32768.0f/1.4142f)*powf(10.0f, (threshold - DBM0_MAX_SINE_POWER)/20.0f);
#endif
s->threshold = x*x;
}
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(logging_state_t *) dtmf_rx_get_logging_state(dtmf_rx_state_t *s)
{
return &s->logging;
}
/*- 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)
{
int i;
if (s == NULL)
{
if ((s = (dtmf_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
span_log_set_protocol(&s->logging, "DTMF");
s->digits_callback = callback;
s->digits_callback_data = user_data;
s->realtime_callback = NULL;
s->realtime_callback_data = NULL;
s->filter_dialtone = false;
s->normal_twist = DTMF_NORMAL_TWIST;
s->reverse_twist = DTMF_REVERSE_TWIST;
s->threshold = DTMF_THRESHOLD;
s->in_digit = 0;
s->last_hit = 0;
if (!dtmf_rx_inited)
{
for (i = 0; i < 4; i++)
{
make_goertzel_descriptor(&dtmf_detect_row[i], dtmf_row[i], DTMF_SAMPLES_PER_BLOCK);
make_goertzel_descriptor(&dtmf_detect_col[i], dtmf_col[i], DTMF_SAMPLES_PER_BLOCK);
}
dtmf_rx_inited = true;
}
for (i = 0; i < 4; i++)
{
goertzel_init(&s->row_out[i], &dtmf_detect_row[i]);
goertzel_init(&s->col_out[i], &dtmf_detect_col[i]);
}
s->energy = FP_SCALE(0.0f);
s->current_sample = 0;
s->lost_digits = 0;
s->current_digits = 0;
s->digits[0] = '\0';
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) dtmf_rx_release(dtmf_rx_state_t *s)
{
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) dtmf_rx_free(dtmf_rx_state_t *s)
{
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
static void dtmf_tx_initialise(void)
{
int row;
int col;
if (dtmf_tx_inited)
return;
for (row = 0; row < 4; row++)
{
for (col = 0; col < 4; col++)
{
tone_gen_descriptor_init(&dtmf_digit_tones[row*4 + col],
(int) dtmf_row[row],
DEFAULT_DTMF_TX_LEVEL,
(int) dtmf_col[col],
DEFAULT_DTMF_TX_LEVEL,
DEFAULT_DTMF_TX_ON_TIME,
DEFAULT_DTMF_TX_OFF_TIME,
0,
0,
false);
}
}
dtmf_tx_inited = true;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) dtmf_tx(dtmf_tx_state_t *s, int16_t amp[], int max_samples)
{
int len;
const char *cp;
int digit;
len = 0;
if (s->tones.current_section >= 0)
{
/* Deal with the fragment left over from last time */
len = tone_gen(&s->tones, amp, max_samples);
}
while (len < max_samples)
{
/* Step to the next digit */
if ((digit = queue_read_byte(&s->queue.queue)) < 0)
{
/* See if we can get some more digits */
if (s->callback == NULL)
break;
s->callback(s->callback_data);
if ((digit = queue_read_byte(&s->queue.queue)) < 0)
break;
}
if (digit == 0)
continue;
if ((cp = strchr(dtmf_positions, digit)) == NULL)
continue;
tone_gen_init(&s->tones, &dtmf_digit_tones[cp - dtmf_positions]);
s->tones.tone[0].gain = s->low_level;
s->tones.tone[1].gain = s->high_level;
s->tones.duration[0] = s->on_time;
s->tones.duration[1] = s->off_time;
len += tone_gen(&s->tones, amp + len, max_samples - len);
}
return len;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) dtmf_tx_put(dtmf_tx_state_t *s, const char *digits, int len)
{
size_t space;
/* This returns the number of characters that would not fit in the buffer.
The buffer will only be loaded if the whole string of digits will fit,
in which case zero is returned. */
if (len < 0)
{
if ((len = strlen(digits)) == 0)
return 0;
}
if ((space = queue_free_space(&s->queue.queue)) < (size_t) len)
return len - (int) space;
if (queue_write(&s->queue.queue, (const uint8_t *) digits, len) >= 0)
return 0;
return -1;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) dtmf_tx_set_level(dtmf_tx_state_t *s, int level, int twist)
{
s->low_level = dds_scaling_dbm0f((float) level);
s->high_level = dds_scaling_dbm0f((float) (level + twist));
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) dtmf_tx_set_timing(dtmf_tx_state_t *s, int on_time, int off_time)
{
s->on_time = ((on_time >= 0) ? on_time : DEFAULT_DTMF_TX_ON_TIME)*SAMPLE_RATE/1000;
s->off_time = ((off_time >= 0) ? off_time : DEFAULT_DTMF_TX_OFF_TIME)*SAMPLE_RATE/1000;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(dtmf_tx_state_t *) dtmf_tx_init(dtmf_tx_state_t *s,
digits_tx_callback_t callback,
void *user_data)
{
if (s == NULL)
{
if ((s = (dtmf_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
if (!dtmf_tx_inited)
dtmf_tx_initialise();
s->callback = callback;
s->callback_data = user_data;
tone_gen_init(&s->tones, &dtmf_digit_tones[0]);
dtmf_tx_set_level(s, DEFAULT_DTMF_TX_LEVEL, 0);
dtmf_tx_set_timing(s, -1, -1);
queue_init(&s->queue.queue, MAX_DTMF_DIGITS, QUEUE_READ_ATOMIC | QUEUE_WRITE_ATOMIC);
s->tones.current_section = -1;
return s;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) dtmf_tx_release(dtmf_tx_state_t *s)
{
queue_release(&s->queue.queue);
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) dtmf_tx_free(dtmf_tx_state_t *s)
{
dtmf_tx_release(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/

Some files were not shown because too many files have changed in this diff Show More