sync spandsp

This commit is contained in:
Anthony Minessale
2013-12-05 22:58:12 +05:00
parent 156cb36820
commit d429d7fff1
311 changed files with 19380 additions and 8449 deletions
+1 -1
View File
@@ -1 +1 @@
Tue Dec 6 17:55:59 CST 2011
Thu Dec 5 22:57:57 CDT 2013
+256 -141
View File
@@ -1,121 +1,80 @@
Building and installing spandsp
===============================
A number of distributions include spandsp, but they usually use older versions
of the library, which lack a lot of the features of the current version. Before
installing spandsp, make sure there are no older versions already on your
machine. Make sure libtiff is installed on your machine. Versions 3.5.7,
3.6.0, 3.7.1 and 3.8.2 seem to work OK. There have been several bugs related
to FAX document handling in some versions of libtiff. Also, some people have
had trouble using spandsp because they had more than one version of libtiff
on their machine. Take care with this. If you are using an RPM based system,
such as RedHat or Fedora, you will need the libtiff and libtiff-devel RPMs
installed to be able to build spandsp.
You can use the usual:
./configure
make
make install
process to build the spandsp library. Note that if you use configure in this
way, the software will be installed in /usr/local. In this case make sure your
/etc/ld.so.conf file has an entry for /usr/local/lib. If you wish the software
to be installed in /usr, you should build it with the commands.
./configure --prefix=/usr
make
make install
Building the programming documentation
======================================
If you wish to build the programming documentation for spandsp, configure
spandsp with:
./configure --enable-doc
You need doxygen installed on your machine.
Building the test suite
=======================
Most sections of the spandsp library have an accompanying test program in the
test directory. If you wish to build these test programs, configure spandsp
with:
./configure --enable-tests
To build these tests you will need libaudiofile installed on your machine. To
build the modem tests, with the GUI monitoring feature you will need Fltk 1.1.4
or later, an audio meter module and a cartesian plotting module. Fltk may be
obtained from http://www.fltk.org. The audio meter module may be obtained from
http://www.soft-switch.org/downloads/Fl_Audio_Meter.tgz . The cartesian plotting
module may be obtained from http://134.226.68.29/fltk. However, there is no
suitable makefile supplied with that. You can find a version at
http://www.soft-switch.org/downloads/Fl_Cartesian.tgz which will build as a
Linux library. The actual code in both these versions is identical.
You need to have Fltk 1.1.4 or later installed before building the plotting
library.
Applications
============
Applications support for spandsp is built into packages such as Callweaver,
FreeSwitch and iaxmodem. Code to add spandsp based FAX support to Asterisk may
be found at http://sourceforge.net/projects/agx-ast-addons.
Installation Instructions
*************************
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation
==================
These are generic installation instructions.
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' is used to create `configure' by a program
called `autoconf'. You only need `configure.ac' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
`./configure' to configure the package for your system.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
documentation.
documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
user, and only the `make install' phase executed with root
privileges.
5. You can remove the program binaries and object files from the
5. Optionally, type `make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
regular user, particularly if the prior `make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
@@ -124,62 +83,119 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came
with the distribution.
7. Often, you can also type `make uninstall' to remove the installed
files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide `make
distcheck', which can by used by developers to test that all other
targets like `make install' and `make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
source code in the directory that `configure' is in and in `..'. This
is known as a "VPATH" build.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
On MacOS X 10.5 and later systems, you can create libraries and
executables that work on multiple system types--known as "fat" or
"universal" binaries--by specifying multiple `-arch' options to the
compiler but only a single `-arch' option to the preprocessor. Like
this:
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
CPP="gcc -E" CXXCPP="g++ -E"
This is not guaranteed to produce working output in all cases, you
may have to build one architecture at a time and combine the results
using the `lipo' tool if you have problems.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
you can set and what kinds of files go in them. In general, the
default for these options is expressed in terms of `${prefix}', so that
specifying just `--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to `configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
`make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, `make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
`${prefix}'. Any directories that were specified during `configure',
but not in terms of `${prefix}', must each be overridden at install
time for the entire installation to be relocated. The approach of
makefile variable overrides for each directory variable is required by
the GNU Coding Standards, and ideally causes no recompilation.
However, some platforms have known limitations with the semantics of
shared libraries that end up requiring recompilation when using this
method, particularly noticeable in packages that use GNU Libtool.
The second method involves providing the `DESTDIR' variable. For
example, `make install DESTDIR=/alternate/directory' will prepend
`/alternate/directory' before all installation names. The approach of
`DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of `${prefix}'
at `configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
@@ -192,25 +208,80 @@ find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of `make' will be. For these packages, running `./configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with `make V=1'; while running `./configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with `make V=0'.
Particular systems
==================
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
CC is not installed, it is recommended to use the following options in
order to use an ANSI C compiler:
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
HP-UX `make' updates targets which have the same time stamps as
their prerequisites, which makes it generally unusable when shipped
generated files such as `configure' are involved. Use GNU `make'
instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
to try
./configure CC="cc"
and if that doesn't work, try
./configure CC="cc -nodtk"
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
in your `PATH', put it _after_ `/usr/bin'.
On Haiku, software installed for all users goes in `/boot/common',
not `/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
where SYSTEM can have one of these forms:
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
@@ -223,19 +294,56 @@ default values for variables like `CC', `cache_file', and `prefix'.
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf limitation. Until the limitation is lifted, you can use
this workaround:
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`-h'
Print a summary of all of the options to `configure', and exit.
`--help=short'
`--help=recursive'
Print a summary of the options unique to this package's
`configure', and exit. The `short' variant lists options used
only in the top level, while the `recursive' variant lists options
also present in any nested packages.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
@@ -248,8 +356,15 @@ operates.
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--prefix=DIR'
Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
`configure' also accepts some other, not widely useful, options.
`--no-create'
`-n'
Run the configure checks, but stop before creating any output
files.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
+2 -1
View File
@@ -47,7 +47,8 @@ EXTRA_DIST = autogen.sh \
unpack_g726_data.sh \
unpack_gsm0610_data.sh \
unpack_v56ter_data.sh \
wrapper.xsl
wrapper.xsl \
yum-prepare.sh
if COND_DOC
MAYBE_DOC=doc
+1 -1
View File
@@ -1,4 +1,4 @@
spandsp 0.0.5 - A DSP library for telephony
spandsp 0.0.6 - A DSP library for telephony
-------------------------------------------
SpanDSP is a library of DSP functions for telephony, in the 8000 sample per
+69 -29
View File
@@ -19,7 +19,7 @@
# @start 1
AC_PREREQ([2.59])
AC_INIT([spandsp], [0.0.7])
AC_INIT([spandsp], [1.99.0])
SPANDSP_LT_CURRENT=3
SPANDSP_LT_REVISION=0
@@ -125,6 +125,9 @@ 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(t43, [ --enable-t43 Enable T.43 support])
AC_ARG_ENABLE(v32bis, [ --enable-v32bis Enable V.32bis support])
AC_ARG_ENABLE(v34, [ --enable-v34 Enable V.34 support])
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])
@@ -135,8 +138,10 @@ AC_ARG_ENABLE(sse4_2, [ --enable-sse4-2 Enable SSE4.2 support])
AC_ARG_ENABLE(sse4a, [ --enable-sse4a Enable SSE4A support])
AC_ARG_ENABLE(sse5, [ --enable-sse5 Enable SSE5 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])
# 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"])
@@ -162,6 +167,9 @@ fi
AX_C99_FLEXIBLE_ARRAY
AC_CHECK_FUNCS([aligned_alloc])
AC_CHECK_FUNCS([memalign])
AC_CHECK_FUNCS([posix_memalign])
AC_CHECK_FUNCS([memmove])
AC_CHECK_FUNCS([memset])
AC_CHECK_FUNCS([select])
@@ -182,6 +190,9 @@ AC_HEADER_TIME
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])
@@ -257,13 +268,6 @@ then
esac
fi
#AC_DEFINE([SPANDSP_SUPPORT_T42], [1], [Support T.42 JPEG compression])
SPANDSP_SUPPORT_T42="#undef SPANDSP_SUPPORT_T42"
#AC_DEFINE([SPANDSP_SUPPORT_T43], [1], [Support T.43 JBIG gray and colour compression])
SPANDSP_SUPPORT_T43="#undef SPANDSP_SUPPORT_T43"
#AC_DEFINE([SPANDSP_SUPPORT_V34], [1], [Support the V.34 FAX modem])
SPANDSP_SUPPORT_V34="#undef SPANDSP_SUPPORT_V34"
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.]))
@@ -320,9 +324,11 @@ AX_CHECK_EXPORT_CAPABILITY([$host],
saved_CFLAGS="$CFLAGS"
AC_CACHE_CHECK([whether compiler supports -Wunused-but-set-variable], [ac_cv_gcc_unused_but_set_variable], [
CFLAGS="$CFLAGS -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])
])
# 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"
@@ -337,6 +343,9 @@ gnu)
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
@@ -401,6 +410,9 @@ intel)
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
@@ -462,6 +474,10 @@ armv7[bl] | armv7-*)
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_sse5="yes"
@@ -504,20 +520,6 @@ x86_64-* | i386-* | i686-*)
;;
esac
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_SSE4A], [test "$enable_sse4a" = yes])
AM_CONDITIONAL([COND_SSE5], [test "$enable_sse5" = yes])
AM_CONDITIONAL([COND_AVX], [test "$enable_avx" = yes])
AM_CONDITIONAL([COND_NEON], [test "$enable_neon" = yes])
if test "$enable_builtin_tiff" = "yes" ; then
abs_tiffdir="`cd $srcdir/../tiff-4.0.2/ && pwd`"
save_CFLAGS=$CFLAGS
@@ -532,9 +534,7 @@ if test "$enable_builtin_tiff" = "yes" ; then
AC_DEFINE([HAVE_LIBTIFF], [1], [Define to 1 if you have the `tiff' library (-ltiff).])
else
AC_CHECK_HEADERS([tiffio.h])
AC_CHECK_HEADERS([tif_dir.h], [], [], [#include <tiffio.h>
])
AC_CHECK_LIB([tiff], [TIFFOpen], [TIFF_LIBS="-ltiff"], AC_MSG_ERROR("Cannot build without libtiff (does your system require a libtiff-devel package?)"), -lm)
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], [
@@ -553,6 +553,45 @@ 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_SSE4A], [test "$enable_sse4a" = yes])
AM_CONDITIONAL([COND_SSE5], [test "$enable_sse5" = 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)
@@ -565,14 +604,15 @@ 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_T42)
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
+13 -11
View File
@@ -23,19 +23,21 @@ gnu)
CFLAGS="${CFLAGS} -mfpu=neon"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[#include <arm_neon.h>
int32x4_t testfunc(int16_t *a, int16_t *b)
{
return vmull_s16(vld1_s16(a), vld1_s16(b));
}
int main(int argc, char *argv[])
{
[
#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));
}
],
[
int32x4_t z;
int16_t x[8];
int16_t y[8];
int16_t x[[8]];
int16_t y[[8]];
z = testfunc(x, y);
}],
[;]
]
)],
[AC_MSG_RESULT([yes])
+1 -1
View File
@@ -34,7 +34,7 @@ EXTRA_DIST = libspandsp_sim.dsp \
msvc/vc9proj.head \
msvc/vc9proj.foot
INCLUDES = -I$(top_builddir) -I$(top_builddir)/src -DDATADIR="\"$(pkgdatadir)\""
AM_CPPFLAGS = -I$(top_builddir) -I$(top_builddir)/src -DDATADIR="\"$(pkgdatadir)\""
noinst_PROGRAMS = make_line_models
+2 -2
View File
@@ -2,12 +2,12 @@
Summary: A DSP library for telephony.
Name: spandsp
Version: 0.0.7
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-0.0.7.tar.gz
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}
+92
View File
@@ -87,6 +87,98 @@
<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"/>
</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"/>
<possible-step>
<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"/>
</possible-step>
<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"/>
<possible-step>
<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"/>
</possible-step>
<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"/>
File diff suppressed because it is too large Load Diff
+59 -29
View File
@@ -1,21 +1,64 @@
<!-- Global PSTN supervisory tones -->
<!ELEMENT global-tones (tone-set)* >
<!ELEMENT tone-set (dial-tone|ringback-tone|busy-tone|congestion-tone|number-unobtainable-tone|special-information-tone|call-waiting-tone|waiting-tone|payphone-recognition-tone|test-number-tone|end-of-three-party-service-tone|service-activated-tone|record-tone|facilities-tone|offering-tone|positive-indication-tone|negative-indication-tone|route-tone|pay-tone|confirmation-tone|intrusion-tone|intercept-tone|warning-tone|holding-tone|search-tone|acceptance-tone|executive-override-tone|function-acknowledge-tone|queue-tone|valid-tone-radio-paging|notify-tone|re-order-tone|preemption-tone|comfort-tone|connection-tone|refusal-tone|line-lockout-tone|permanent-signal-tone|identification-tone|reorder-tone|recall-dial-tone|special-ringback-tone|busy-verification-tone)* >
<!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
>
<!ELEMENT ringback-tone (step)* >
<!ATTLIST ringback-tone
<!-- 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
@@ -32,11 +75,14 @@
<!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
@@ -45,6 +91,7 @@
<!ATTLIST payphone-recognition-tone
domain CDATA #IMPLIED
>
<!ELEMENT warning-tone (step)* >
<!ATTLIST warning-tone
type CDATA #IMPLIED
@@ -54,19 +101,6 @@
<!ATTLIST reorder-tone
domain CDATA #IMPLIED
>
<!ELEMENT recall-dial-tone (step)* >
<!ATTLIST recall-dial-tone
domain CDATA #IMPLIED
>
<!ELEMENT special-ringback-tone (step)* >
<!ATTLIST special-ringback-tone
domain CDATA #IMPLIED
>
<!ELEMENT busy-verification-tone (step)* >
<!ATTLIST busy-verification-tone
domain CDATA #IMPLIED
>
<!ELEMENT waiting-tone (step)* >
<!ATTLIST waiting-tone
domain CDATA #IMPLIED
@@ -95,14 +129,6 @@
<!ATTLIST offering-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 route-tone (step)* >
<!ATTLIST route-tone
domain CDATA #IMPLIED
@@ -151,10 +177,6 @@
<!ATTLIST notify-tone
domain CDATA #IMPLIED
>
<!ELEMENT re-order-tone (step)* >
<!ATTLIST re-order-tone
domain CDATA #IMPLIED
>
<!ELEMENT preemption-tone (step)* >
<!ATTLIST preemption-tone
domain CDATA #IMPLIED
@@ -183,6 +205,14 @@
<!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
+3 -3
View File
@@ -423,7 +423,7 @@
<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" pattern="7"/> <!-- 01010 for 50 bits, and then zero for the test of the TCF -->
<step dir="T" type="TCF" modem="V.27ter/4800" value="900" pattern="7"/> <!-- 01010 for 50 bits, and then zero for the rest of the TCF -->
<step dir="R" type="HDLC" modem="V.21" tag="CFR" value="FF C8 21"/>
<step dir="R" type="SILENCE"/>
@@ -2534,7 +2534,7 @@
<!-- UNKNOWN_BCS_3 -->
<step dir="T" type="PREAMBLE" modem="V.21" value="37"/>
<step dir="T" type="HDLC" tag="GARBAGE" value="A2 02 B5 C9 7E 67"/>
<step dir="R" type="HDLC" modem="V.21" tag="DIS" value="FF C8 01 ..." timeout="60000"/>
<step dir="R" type="SILENCE"/>
@@ -6123,7 +6123,7 @@
<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"/>
+73 -48
View File
@@ -22,39 +22,29 @@ AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
DISTCLEANFILES = $(srcdir)/at_interpreter_dictionary.h \
$(srcdir)/cielab_luts.h \
$(srcdir)/math_fixed_tables.h \
$(srcdir)/v17_v32bis_rx_fixed_rrc.h \
$(srcdir)/v17_v32bis_rx_floating_rrc.h \
$(srcdir)/v17_v32bis_tx_fixed_rrc.h \
$(srcdir)/v17_v32bis_tx_floating_rrc.h \
$(srcdir)/v22bis_rx_1200_fixed_rrc.h \
$(srcdir)/v22bis_rx_2400_fixed_rrc.h \
$(srcdir)/v22bis_rx_1200_floating_rrc.h \
$(srcdir)/v22bis_rx_2400_floating_rrc.h \
$(srcdir)/v22bis_tx_fixed_rrc.h \
$(srcdir)/v22bis_tx_floating_rrc.h \
$(srcdir)/v27ter_rx_2400_fixed_rrc.h \
$(srcdir)/v27ter_rx_4800_fixed_rrc.h \
$(srcdir)/v27ter_rx_2400_floating_rrc.h \
$(srcdir)/v27ter_rx_4800_floating_rrc.h \
$(srcdir)/v27ter_tx_2400_fixed_rrc.h \
$(srcdir)/v27ter_tx_4800_fixed_rrc.h \
$(srcdir)/v27ter_tx_2400_floating_rrc.h \
$(srcdir)/v27ter_tx_4800_floating_rrc.h \
$(srcdir)/v29rx_fixed_rrc.h \
$(srcdir)/v29rx_floating_rrc.h \
$(srcdir)/v29tx_fixed_rrc.h \
$(srcdir)/v29tx_floating_rrc.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.dsp \
libspandsp.2005.sln \
libspandsp.2008.sln \
libspandsp.2005.vcproj \
libspandsp.2008.vcproj \
libspandsp.2010.vcproj \
libspandsp.2012.vcproj \
libtiff.2005.vcproj \
libtiff.2008.vcproj \
filter_tools.c \
@@ -62,6 +52,7 @@ EXTRA_DIST = floating_fudge.h \
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 \
@@ -87,12 +78,23 @@ EXTRA_DIST = floating_fudge.h \
spandsp/private/README \
spandsp/version.h.in
INCLUDES = -I$(top_builddir)
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 \
@@ -159,6 +161,7 @@ libspandsp_la_SOURCES = ademco_contactid.c \
t4_rx.c \
t4_tx.c \
t42.c \
t43.c \
t81_t82_arith_coding.c \
t85_decode.c \
t85_encode.c \
@@ -180,12 +183,15 @@ libspandsp_la_SOURCES = ademco_contactid.c \
v42bis.c \
v8.c \
vector_float.c \
vector_int.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 \
@@ -230,6 +236,7 @@ nobase_include_HEADERS = spandsp/ademco_contactid.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 \
@@ -250,6 +257,7 @@ nobase_include_HEADERS = spandsp/ademco_contactid.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 \
@@ -298,6 +306,9 @@ nobase_include_HEADERS = spandsp/ademco_contactid.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 \
@@ -317,6 +328,7 @@ nobase_include_HEADERS = spandsp/ademco_contactid.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 \
@@ -363,6 +375,9 @@ make_math_fixed_tables$(EXEEXT): $(top_srcdir)/src/make_math_fixed_tables.c
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
@@ -391,6 +406,11 @@ 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}
@@ -475,37 +495,18 @@ v29tx.lo: ${V29_TX_INCL}
v29tx_rrc.h: make_modem_filter$(EXEEXT)
./make_modem_filter$(EXEEXT) -m V.29 -t >v29tx_rrc.h
DSP = libspandsp.dsp
VCPROJ8 = libspandsp.2005.vcproj
VCPROJ9 = libspandsp.2008.vcproj
VCPROJ10 = libspandsp.2010.vcproj
VCPROJ12 = libspandsp.2012.vcproj
WIN32SOURCES = $(libspandsp_la_SOURCES) .\\msvc\\gettimeofday.c
WIN32HEADERS = $(nobase_include_HEADERS) spandsp.h
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) )
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)"
@@ -531,6 +532,30 @@ $(VCPROJ9): msvc/vc9proj.head msvc/vc9proj.foot Makefile.am
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)/" \
+29 -25
View File
@@ -39,6 +39,11 @@
#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 <memory.h>
#include <string.h>
@@ -46,6 +51,7 @@
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
@@ -437,18 +443,17 @@ static const struct ademco_code_s ademco_codes[] =
{-1, "???"}
};
#define GOERTZEL_SAMPLES_PER_BLOCK 55 /* We need to detect over a +-5% range */
#if defined(SPANDSP_USE_FIXED_POINT)
#define GOERTZEL_SAMPLES_PER_BLOCK 55 /* We need to detect over a +-5% range */
#define DETECTION_THRESHOLD 16439 /* -42dBm0 [((GOERTZEL_SAMPLES_PER_BLOCK*GOERTZEL_SAMPLES_PER_BLOCK*32768.0/(1.4142*128.0))*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2] */
#define TONE_TWIST 4 /* 6dB */
#define TONE_TO_TOTAL_ENERGY 64 /* -3dB */
#define DETECTION_THRESHOLD 3035 /* -42dBm0 */
#define TONE_TO_TOTAL_ENERGY 45.2233f /* -0.85dB */
#else
#define GOERTZEL_SAMPLES_PER_BLOCK 55 /* We need to detect over a +-5% range */
#define DETECTION_THRESHOLD 2104205.6f /* -42dBm0 [((GOERTZEL_SAMPLES_PER_BLOCK*GOERTZEL_SAMPLES_PER_BLOCK*32768.0/1.4142)*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2] */
#define TONE_TWIST 3.981f /* 6dB */
#define TONE_TO_TOTAL_ENERGY 1.995f /* 3dB */
#define DETECTION_THRESHOLD 49728296.6f /* -42dBm0 [((GOERTZEL_SAMPLES_PER_BLOCK*32768.0/1.4142)*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2] */
#define TONE_TO_TOTAL_ENERGY 45.2233f /* -0.85dB [GOERTZEL_SAMPLES_PER_BLOCK*10^(-0.85/10.0)] */
#endif
static int tone_rx_init = false;
static goertzel_descriptor_t tone_1400_desc;
static goertzel_descriptor_t tone_2300_desc;
@@ -750,7 +755,7 @@ SPAN_DECLARE(ademco_contactid_receiver_state_t *) ademco_contactid_receiver_init
{
if (s == NULL)
{
if ((s = (ademco_contactid_receiver_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (ademco_contactid_receiver_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -777,7 +782,7 @@ SPAN_DECLARE(int) ademco_contactid_receiver_release(ademco_contactid_receiver_st
SPAN_DECLARE(int) ademco_contactid_receiver_free(ademco_contactid_receiver_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -794,7 +799,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_tx(ademco_contactid_sender_state_t *s,
case 0:
if (!s->clear_to_send)
return 0;
s->clear_to_send = FALSE;
s->clear_to_send = false;
s->step++;
s->remaining_samples = ms_to_samples(250);
/* Fall through */
@@ -811,7 +816,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_tx(ademco_contactid_sender_state_t *s,
samples = dtmf_tx(&s->dtmf, &amp[sample], max_samples - sample);
if (samples == 0)
{
s->clear_to_send = FALSE;
s->clear_to_send = false;
s->step = 0;
return sample;
}
@@ -948,7 +953,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
s->callback(s->callback_user_data, -1, 0, 0);
s->tone_state = 4;
/* Release the transmit side, and it will time the 250ms post tone delay */
s->clear_to_send = TRUE;
s->clear_to_send = true;
s->tries = 0;
if (s->tx_digits_len)
s->timer = ms_to_samples(3000);
@@ -969,7 +974,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
case 5:
if (hit == 0)
{
s->busy = FALSE;
s->busy = false;
if (s->duration < ms_to_samples(400) || s->duration > ms_to_samples(1500))
{
span_log(&s->logging, SPAN_LOG_FLOW, "Bad kissoff duration %d\n", s->duration);
@@ -983,18 +988,18 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
{
s->timer = 0;
if (s->callback)
s->callback(s->callback_user_data, FALSE, 0, 0);
s->callback(s->callback_user_data, false, 0, 0);
}
}
else
{
span_log(&s->logging, SPAN_LOG_FLOW, "Received good kissoff\n");
s->clear_to_send = TRUE;
s->clear_to_send = true;
s->tx_digits_len = 0;
if (s->callback)
s->callback(s->callback_user_data, TRUE, 0, 0);
s->callback(s->callback_user_data, true, 0, 0);
s->tone_state = 4;
s->clear_to_send = TRUE;
s->clear_to_send = true;
s->tries = 0;
if (s->tx_digits_len)
s->timer = ms_to_samples(3000);
@@ -1024,7 +1029,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_rx(ademco_contactid_sender_state_t *s,
{
s->timer = 0;
if (s->callback)
s->callback(s->callback_user_data, FALSE, 0, 0);
s->callback(s->callback_user_data, false, 0, 0);
}
}
}
@@ -1059,7 +1064,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_put(ademco_contactid_sender_state_t *s
return -1;
if ((s->tx_digits_len = encode_msg(s->tx_digits, report)) < 0)
return -1;
s->busy = TRUE;
s->busy = true;
return dtmf_tx_put(&s->dtmf, s->tx_digits, s->tx_digits_len);
}
/*- End of function --------------------------------------------------------*/
@@ -1083,21 +1088,20 @@ SPAN_DECLARE(ademco_contactid_sender_state_t *) ademco_contactid_sender_init(ade
tone_report_func_t callback,
void *user_data)
{
static int initialised = FALSE;
if (s == NULL)
{
if ((s = (ademco_contactid_sender_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (ademco_contactid_sender_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, "Ademco");
if (!initialised)
if (!tone_rx_init)
{
make_goertzel_descriptor(&tone_1400_desc, 1400.0f, GOERTZEL_SAMPLES_PER_BLOCK);
make_goertzel_descriptor(&tone_2300_desc, 2300.0f, GOERTZEL_SAMPLES_PER_BLOCK);
tone_rx_init = true;
}
goertzel_init(&s->tone_1400, &tone_1400_desc);
goertzel_init(&s->tone_2300, &tone_2300_desc);
@@ -1123,7 +1127,7 @@ SPAN_DECLARE(int) ademco_contactid_sender_release(ademco_contactid_sender_state_
SPAN_DECLARE(int) ademco_contactid_sender_free(ademco_contactid_sender_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+19 -12
View File
@@ -40,10 +40,16 @@
#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 "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
@@ -63,6 +69,7 @@
#include "spandsp/private/queue.h"
#include "spandsp/private/tone_generate.h"
#include "spandsp/private/async.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#include "spandsp/private/dtmf.h"
#include "spandsp/private/adsi.h"
@@ -150,7 +157,7 @@ static int adsi_tx_get_bit(void *user_data)
if (s->tx_signal_on)
{
/* The FSK should now be switched off. */
s->tx_signal_on = FALSE;
s->tx_signal_on = false;
s->msg_len = 0;
}
}
@@ -169,7 +176,7 @@ static int adsi_tdd_get_async_byte(void *user_data)
if (s->tx_signal_on)
{
/* The FSK should now be switched off. */
s->tx_signal_on = FALSE;
s->tx_signal_on = false;
s->msg_len = 0;
}
return 0x1F;
@@ -384,13 +391,13 @@ static void start_tx(adsi_tx_state_t *s)
dtmf_tx_init(&s->dtmftx, NULL, NULL);
break;
case ADSI_STANDARD_TDD:
fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_WEITBRECHT], async_tx_get_bit, &s->asynctx);
async_tx_init(&s->asynctx, 5, ASYNC_PARITY_NONE, 2, FALSE, adsi_tdd_get_async_byte, s);
fsk_tx_init(&s->fsktx, &preset_fsk_specs[FSK_WEITBRECHT_4545], async_tx_get_bit, &s->asynctx);
async_tx_init(&s->asynctx, 5, ASYNC_PARITY_NONE, 2, false, adsi_tdd_get_async_byte, s);
/* Schedule an explicit shift at the start of baudot transmission */
s->baudot_shift = 2;
break;
}
s->tx_signal_on = TRUE;
s->tx_signal_on = true;
}
/*- End of function --------------------------------------------------------*/
@@ -426,7 +433,7 @@ SPAN_DECLARE(adsi_rx_state_t *) adsi_rx_init(adsi_rx_state_t *s,
{
if (s == NULL)
{
if ((s = (adsi_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (adsi_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -448,7 +455,7 @@ SPAN_DECLARE(adsi_rx_state_t *) adsi_rx_init(adsi_rx_state_t *s,
case ADSI_STANDARD_TDD:
/* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and
ride over the fraction. */
fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_WEITBRECHT], FSK_FRAME_MODE_5N1_FRAMES, adsi_tdd_put_async_byte, s);
fsk_rx_init(&s->fskrx, &preset_fsk_specs[FSK_WEITBRECHT_4545], FSK_FRAME_MODE_5N1_FRAMES, adsi_tdd_put_async_byte, s);
break;
}
s->standard = standard;
@@ -465,7 +472,7 @@ SPAN_DECLARE(int) adsi_rx_release(adsi_rx_state_t *s)
SPAN_DECLARE(int) adsi_rx_free(adsi_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -488,7 +495,7 @@ SPAN_DECLARE(int) adsi_tx(adsi_tx_state_t *s, int16_t amp[], int max_len)
if (len < max_len)
{
if ((lenx = fsk_tx(&s->fsktx, amp + len, max_len - len)) <= 0)
s->tx_signal_on = FALSE;
s->tx_signal_on = false;
len += lenx;
}
break;
@@ -658,7 +665,7 @@ SPAN_DECLARE(adsi_tx_state_t *) adsi_tx_init(adsi_tx_state_t *s, int standard)
{
if (s == NULL)
{
if ((s = (adsi_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (adsi_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -671,7 +678,7 @@ SPAN_DECLARE(adsi_tx_state_t *) adsi_tx_init(adsi_tx_state_t *s, int standard)
60,
0,
0,
FALSE);
false);
s->standard = standard;
adsi_tx_set_preamble(s, -1, -1, -1, -1);
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
@@ -688,7 +695,7 @@ SPAN_DECLARE(int) adsi_tx_release(adsi_tx_state_t *s)
SPAN_DECLARE(int) adsi_tx_free(adsi_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+171
View File
@@ -0,0 +1,171 @@
/*
* 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
#include <stdlib.h>
#if defined(HAVE_MALLOC_H)
#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;
#ifdef _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 ------------------------------------------------------------*/
+12 -6
View File
@@ -33,8 +33,14 @@
#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"
@@ -168,13 +174,13 @@ SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s,
int data_bits,
int parity,
int stop_bits,
int use_v14,
bool use_v14,
put_byte_func_t put_byte,
void *user_data)
{
if (s == NULL)
{
if ((s = (async_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (async_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->data_bits = data_bits;
@@ -203,7 +209,7 @@ SPAN_DECLARE(int) async_rx_release(async_rx_state_t *s)
SPAN_DECLARE(int) async_rx_free(async_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -268,13 +274,13 @@ SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s,
int data_bits,
int parity,
int stop_bits,
int use_v14,
bool use_v14,
get_byte_func_t get_byte,
void *user_data)
{
if (s == NULL)
{
if ((s = (async_tx_state_t *) malloc(sizeof(*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
@@ -304,7 +310,7 @@ SPAN_DECLARE(int) async_tx_release(async_tx_state_t *s)
SPAN_DECLARE(int) async_tx_free(async_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+71 -62
View File
@@ -43,9 +43,15 @@
#include <memory.h>
#include <string.h>
#include <ctype.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
#include "spandsp/power_meter.h"
@@ -77,20 +83,20 @@ static at_profile_t profiles[3] =
{
{
#if defined(_MSC_VER) || defined(__sunos) || defined(__solaris) || defined(__sun)
/*.echo =*/ TRUE,
/*.verbose =*/ TRUE,
/*.echo =*/ true,
/*.verbose =*/ true,
/*.result_code_format =*/ ASCII_RESULT_CODES,
/*.pulse_dial =*/ FALSE,
/*.double_escape =*/ FALSE,
/*.adaptive_receive =*/ FALSE,
/*.pulse_dial =*/ false,
/*.double_escape =*/ false,
/*.adaptive_receive =*/ false,
/*.s_regs[100] =*/ {0, 0, 0, '\r', '\n', '\b', 1, 60, 5, 0, 0}
#else
.echo = TRUE,
.verbose = TRUE,
.echo = true,
.verbose = true,
.result_code_format = ASCII_RESULT_CODES,
.pulse_dial = FALSE,
.double_escape = FALSE,
.adaptive_receive = FALSE,
.pulse_dial = false,
.double_escape = false,
.adaptive_receive = false,
.s_regs[0] = 0,
.s_regs[3] = '\r',
.s_regs[4] = '\n',
@@ -255,11 +261,11 @@ SPAN_DECLARE(void) at_put_response_code(at_state_t *s, int code)
static int answer_call(at_state_t *s)
{
if (at_modem_control(s, AT_MODEM_CONTROL_ANSWER, NULL) < 0)
return FALSE;
return false;
/* Answering should now be in progress. No AT response should be
issued at this point. */
s->do_hangup = FALSE;
return TRUE;
s->do_hangup = false;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -318,7 +324,7 @@ SPAN_DECLARE(void) at_call_event(at_state_t *s, int event)
at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_NOCNG_TONE_TX);
else
at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_CNG_TONE_TX);
s->dte_is_waiting = TRUE;
s->dte_is_waiting = true;
}
}
break;
@@ -342,13 +348,13 @@ SPAN_DECLARE(void) at_call_event(at_state_t *s, int event)
if (s->ok_is_pending)
{
at_put_response_code(s, AT_RESPONSE_CODE_OK);
s->ok_is_pending = FALSE;
s->ok_is_pending = false;
}
else
{
at_put_response_code(s, AT_RESPONSE_CODE_NO_CARRIER);
}
s->dte_is_waiting = FALSE;
s->dte_is_waiting = false;
at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
}
else if (s->fclass_mode && s->rx_signal_present)
@@ -360,7 +366,7 @@ SPAN_DECLARE(void) at_call_event(at_state_t *s, int event)
}
if (s->at_rx_mode != AT_MODE_OFFHOOK_COMMAND && s->at_rx_mode != AT_MODE_ONHOOK_COMMAND)
at_put_response_code(s, AT_RESPONSE_CODE_NO_CARRIER);
s->rx_signal_present = FALSE;
s->rx_signal_present = false;
at_modem_control(s, AT_MODEM_CONTROL_RNG, (void *) 0);
at_set_at_rx_mode(s, AT_MODE_ONHOOK_COMMAND);
break;
@@ -379,11 +385,11 @@ SPAN_DECLARE(void) at_reset_call_info(at_state_t *s)
for (call_id = s->call_id; call_id; call_id = next)
{
next = call_id->next;
free(call_id);
span_free(call_id);
}
s->call_id = NULL;
s->rings_indicated = 0;
s->call_info_displayed = FALSE;
s->call_info_displayed = false;
}
/*- End of function --------------------------------------------------------*/
@@ -392,8 +398,8 @@ SPAN_DECLARE(void) at_set_call_info(at_state_t *s, char const *id, char const *v
at_call_id_t *new_call_id;
at_call_id_t *call_id;
/* TODO: We should really not merely ignore a failure to malloc */
if ((new_call_id = (at_call_id_t *) malloc(sizeof(*new_call_id))) == NULL)
/* TODO: We should really not merely ignore a failure to allocate */
if ((new_call_id = (at_call_id_t *) span_alloc(sizeof(*new_call_id))) == NULL)
return;
call_id = s->call_id;
/* If these strdups fail its pretty harmless. We just appear to not
@@ -430,7 +436,7 @@ SPAN_DECLARE(void) at_display_call_info(at_state_t *s)
at_put_response(s, buf);
call_id = call_id->next;
}
s->call_info_displayed = TRUE;
s->call_info_displayed = true;
}
/*- End of function --------------------------------------------------------*/
@@ -525,7 +531,7 @@ static int parse_out(at_state_t *s, const char **t, int *target, int max_value,
default:
/* Set value */
if ((val = parse_num(t, max_value)) < 0)
return FALSE;
return false;
if (target)
*target = val;
break;
@@ -538,9 +544,9 @@ static int parse_out(at_state_t *s, const char **t, int *target, int max_value,
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -564,14 +570,14 @@ static int parse_2_out(at_state_t *s, const char **t, int *target1, int max_valu
default:
/* Set value */
if ((val1 = parse_num(t, max_value1)) < 0)
return FALSE;
return false;
if (target1)
*target1 = val1;
if (**t == ',')
{
(*t)++;
if ((val2 = parse_num(t, max_value2)) < 0)
return FALSE;
return false;
if (target2)
*target2 = val2;
}
@@ -586,9 +592,9 @@ static int parse_2_out(at_state_t *s, const char **t, int *target1, int max_valu
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -621,7 +627,7 @@ static int parse_n_out(at_state_t *s,
for (i = 0; i < entries; i++)
{
if ((val = parse_num(t, max_values[i])) < 0)
return FALSE;
return false;
if (targets[i])
*targets[i] = val;
if (**t != ',')
@@ -644,9 +650,9 @@ static int parse_n_out(at_state_t *s,
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -669,7 +675,7 @@ static int parse_hex_out(at_state_t *s, const char **t, int *target, int max_val
default:
/* Set value */
if ((val = parse_hex_num(t, max_value)) < 0)
return FALSE;
return false;
if (target)
*target = val;
break;
@@ -682,9 +688,9 @@ static int parse_hex_out(at_state_t *s, const char **t, int *target, int max_val
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -709,7 +715,7 @@ static int parse_string_list_out(at_state_t *s, const char **t, int *target, int
default:
/* Set value */
if ((val = match_element(t, def)) < 0)
return FALSE;
return false;
if (target)
*target = val;
break;
@@ -728,9 +734,9 @@ static int parse_string_list_out(at_state_t *s, const char **t, int *target, int
at_put_response(s, buf);
break;
default:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -752,7 +758,7 @@ static int parse_string_out(at_state_t *s, const char **t, char **target, const
default:
/* Set value */
if (*target)
free(*target);
span_free(*target);
/* If this strdup fails, it should be harmless */
*target = strdup(*t);
break;
@@ -763,11 +769,11 @@ static int parse_string_out(at_state_t *s, const char **t, char **target, const
at_put_response(s, (*target) ? *target : "");
break;
default:
return FALSE;
return false;
}
while (*t)
t++;
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -862,18 +868,18 @@ static int process_class1_cmd(at_state_t *s, const char **t)
val = -1;
if (!parse_out(s, t, &val, 255, NULL, allowed))
return TRUE;
return true;
if (val < 0)
{
/* It was just a query */
return TRUE;
return true;
}
/* All class 1 FAX commands are supposed to give an ERROR response, if the phone
is on-hook. */
if (s->at_rx_mode == AT_MODE_ONHOOK_COMMAND)
return FALSE;
return false;
result = TRUE;
result = true;
if (s->class1_handler)
result = s->class1_handler(s, s->class1_user_data, direction, operation, val);
switch (result)
@@ -881,11 +887,11 @@ static int process_class1_cmd(at_state_t *s, const char **t)
case 0:
/* Inhibit an immediate response. (These commands should not be part of a multi-command entry.) */
*t = (const char *) -1;
return TRUE;
return true;
case -1:
return FALSE;
return false;
}
return TRUE;
return true;
}
/*- End of function --------------------------------------------------------*/
@@ -915,11 +921,11 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
/* V.250 6.3.1 - Dial (abortable) */
at_reset_call_info(s);
s->do_hangup = FALSE;
s->silent_dial = FALSE;
s->command_dial = FALSE;
s->do_hangup = false;
s->silent_dial = false;
s->command_dial = false;
t += 1;
ok = FALSE;
ok = false;
/* There are a numbers of options in a dial command string.
Many are completely irrelevant in this application. */
u = num;
@@ -961,11 +967,11 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
break;
case 'T':
/* V.250 6.3.1.3 Tone dial */
s->p.pulse_dial = FALSE;
s->p.pulse_dial = false;
break;
case 'P':
/* V.250 6.3.1.4 Pulse dial */
s->p.pulse_dial = TRUE;
s->p.pulse_dial = true;
break;
case '!':
/* V.250 6.3.1.5 Hook flash, register recall */
@@ -977,7 +983,7 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
break;
case '@':
/* V.250 6.3.1.7 Wait for quiet answer */
s->silent_dial = TRUE;
s->silent_dial = true;
break;
case 'S':
/* V.250 6.3.1.8 Invoke stored string */
@@ -998,7 +1004,7 @@ static const char *at_cmd_D(at_state_t *s, const char *t)
break;
case ';':
/* V.250 6.3.1 - Dial string terminator - make voice call and remain in command mode */
s->command_dial = TRUE;
s->command_dial = true;
break;
case '>':
/* GSM07.07 6.2 - Direct dialling from phone book supplementary service subscription
@@ -1054,7 +1060,7 @@ static const char *at_cmd_H(at_state_t *s, const char *t)
{
/* Push out the last of the audio (probably by sending a short silence). */
at_modem_control(s, AT_MODEM_CONTROL_RESTART, (void *) FAX_MODEM_FLUSH);
s->do_hangup = TRUE;
s->do_hangup = true;
at_set_at_rx_mode(s, AT_MODE_CONNECTED);
return (const char *) -1;
}
@@ -1137,7 +1143,7 @@ static const char *at_cmd_P(at_state_t *s, const char *t)
{
/* V.250 6.3.3 - Select pulse dialling (command) */
t += 1;
s->p.pulse_dial = TRUE;
s->p.pulse_dial = true;
return t;
}
/*- End of function --------------------------------------------------------*/
@@ -1231,7 +1237,7 @@ static const char *at_cmd_T(at_state_t *s, const char *t)
{
/* V.250 6.3.2 - Select tone dialling (command) */
t += 1;
s->p.pulse_dial = FALSE;
s->p.pulse_dial = false;
return t;
}
/*- End of function --------------------------------------------------------*/
@@ -5527,6 +5533,9 @@ SPAN_DECLARE(void) at_interpreter(at_state_t *s, const char *cmd, int len)
{
if ((entry = command_search(t, &matched)) <= 0)
break;
/* The following test shouldn't be needed, but let's keep it here for completeness. */
if (entry > sizeof(at_commands)/sizeof(at_commands[0]))
break;
if ((t = at_commands[entry - 1](s, t)) == NULL)
break;
if (t == (const char *) -1)
@@ -5587,7 +5596,7 @@ SPAN_DECLARE(at_state_t *) at_init(at_state_t *s,
{
if (s == NULL)
{
if ((s = (at_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (at_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, '\0', sizeof(*s));
@@ -5612,7 +5621,7 @@ SPAN_DECLARE(int) at_release(at_state_t *s)
{
at_reset_call_info(s);
if (s->local_id)
free(s->local_id);
span_free(s->local_id);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -5622,7 +5631,7 @@ SPAN_DECLARE(int) at_free(at_state_t *s)
int ret;
ret = at_release(s);
free(s);
span_free(s);
return ret;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -55,6 +55,7 @@
#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"
@@ -100,7 +101,7 @@ SPAN_DECLARE(awgn_state_t *) awgn_init_dbov(awgn_state_t *s, int idum, float lev
if (s == NULL)
{
if ((s = (awgn_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (awgn_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
if (idum < 0)
@@ -140,7 +141,7 @@ SPAN_DECLARE(int) awgn_release(awgn_state_t *s)
SPAN_DECLARE(int) awgn_free(awgn_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+28 -22
View File
@@ -40,9 +40,15 @@
#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"
@@ -77,10 +83,10 @@ typedef struct
uint8_t off_time; /* Minimum post tone silence (ms) */
} mf_digit_tones_t;
int bell_mf_gen_inited = FALSE;
int bell_mf_gen_inited = false;
tone_gen_descriptor_t bell_mf_digit_tones[15];
int r2_mf_gen_inited = FALSE;
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];
@@ -270,10 +276,10 @@ static void bell_mf_gen_init(void)
tones->off_time,
0,
0,
FALSE);
false);
tones++;
}
bell_mf_gen_inited = TRUE;
bell_mf_gen_inited = true;
}
/*- End of function --------------------------------------------------------*/
@@ -325,7 +331,7 @@ 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 *) malloc(sizeof(*s))) == NULL)
if ((s = (bell_mf_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -348,7 +354,7 @@ SPAN_DECLARE(int) bell_mf_tx_release(bell_mf_tx_state_t *s)
SPAN_DECLARE(int) bell_mf_tx_free(bell_mf_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -390,14 +396,14 @@ SPAN_DECLARE(int) r2_mf_tx_put(r2_mf_tx_state_t *s, char digit)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd)
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 *) malloc(sizeof(*s))) == NULL)
if ((s = (r2_mf_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -436,7 +442,7 @@ SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd)
(tones->off_time == 0));
tones++;
}
r2_mf_gen_inited = TRUE;
r2_mf_gen_inited = true;
}
s->fwd = fwd;
return s;
@@ -451,7 +457,7 @@ SPAN_DECLARE(int) r2_mf_tx_release(r2_mf_tx_state_t *s)
SPAN_DECLARE(int) r2_mf_tx_free(r2_mf_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -629,11 +635,11 @@ SPAN_DECLARE(bell_mf_rx_state_t *) bell_mf_rx_init(bell_mf_rx_state_t *s,
void *user_data)
{
int i;
static int initialised = FALSE;
static int initialised = false;
if (s == NULL)
{
if ((s = (bell_mf_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (bell_mf_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -642,7 +648,7 @@ SPAN_DECLARE(bell_mf_rx_state_t *) bell_mf_rx_init(bell_mf_rx_state_t *s,
{
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;
initialised = true;
}
s->digits_callback = callback;
s->digits_callback_data = user_data;
@@ -671,7 +677,7 @@ SPAN_DECLARE(int) bell_mf_rx_release(bell_mf_rx_state_t *s)
SPAN_DECLARE(int) bell_mf_rx_free(bell_mf_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -745,7 +751,7 @@ SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples
}
}
/* Basic signal level and twist tests */
hit = FALSE;
hit = false;
if (energy[best] >= R2_MF_THRESHOLD
&&
energy[second_best] >= R2_MF_THRESHOLD
@@ -755,7 +761,7 @@ SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples
energy[best]*R2_MF_TWIST > energy[second_best])
{
/* Relative peak test */
hit = TRUE;
hit = true;
for (i = 0; i < 6; i++)
{
if (i != best && i != second_best)
@@ -763,7 +769,7 @@ SPAN_DECLARE(int) r2_mf_rx(r2_mf_rx_state_t *s, const int16_t amp[], int samples
if (energy[i]*R2_MF_RELATIVE_PEAK >= energy[second_best])
{
/* The best two are not clearly the best */
hit = FALSE;
hit = false;
break;
}
}
@@ -804,16 +810,16 @@ SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s)
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s,
int fwd,
bool fwd,
tone_report_func_t callback,
void *user_data)
{
int i;
static int initialised = FALSE;
static int initialised = false;
if (s == NULL)
{
if ((s = (r2_mf_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (r2_mf_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -827,7 +833,7 @@ SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s,
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;
initialised = true;
}
if (fwd)
{
@@ -855,7 +861,7 @@ SPAN_DECLARE(int) r2_mf_rx_release(r2_mf_rx_state_t *s)
SPAN_DECLARE(int) r2_mf_rx_free(r2_mf_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+11 -5
View File
@@ -33,8 +33,14 @@
#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"
@@ -136,14 +142,14 @@ static void assess_error_rate(bert_state_t *s)
int i;
int j;
int sum;
int test;
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;
test = false;
for (i = 2; i <= 7; i++)
{
if (++s->decade_ptr[i] < 10)
@@ -156,7 +162,7 @@ static void assess_error_rate(bert_state_t *s)
if (test && sum > 10)
{
/* We overflow into the next decade */
test = FALSE;
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;
@@ -350,7 +356,7 @@ SPAN_DECLARE(bert_state_t *) bert_init(bert_state_t *s, int limit, int pattern,
if (s == NULL)
{
if ((s = (bert_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (bert_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -503,7 +509,7 @@ SPAN_DECLARE(int) bert_release(bert_state_t *s)
SPAN_DECLARE(int) bert_free(bert_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+8 -2
View File
@@ -33,8 +33,14 @@
#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"
@@ -132,7 +138,7 @@ SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int lsb_f
{
if (s == NULL)
{
if ((s = (bitstream_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (bitstream_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->bitstream = 0;
@@ -151,7 +157,7 @@ SPAN_DECLARE(int) bitstream_release(bitstream_state_t *s)
SPAN_DECLARE(int) bitstream_free(bitstream_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+7 -6
View File
@@ -32,6 +32,7 @@
#include <inttypes.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/complex.h"
#include "spandsp/complex_filters.h"
@@ -40,7 +41,7 @@ SPAN_DECLARE(filter_t *) filter_create(fspec_t *fs)
int i;
filter_t *fi;
if ((fi = (filter_t *) malloc(sizeof(*fi) + sizeof(float)*(fs->np + 1))))
if ((fi = (filter_t *) span_alloc(sizeof(*fi) + sizeof(float)*(fs->np + 1))))
{
fi->fs = fs;
fi->sum = 0.0;
@@ -56,7 +57,7 @@ SPAN_DECLARE(filter_t *) filter_create(fspec_t *fs)
SPAN_DECLARE(void) filter_delete(filter_t *fi)
{
if (fi)
free(fi);
span_free(fi);
}
/*- End of function --------------------------------------------------------*/
@@ -70,17 +71,17 @@ SPAN_DECLARE(cfilter_t *) cfilter_create(fspec_t *fs)
{
cfilter_t *cfi;
if ((cfi = (cfilter_t *) malloc(sizeof(*cfi))))
if ((cfi = (cfilter_t *) span_alloc(sizeof(*cfi))))
{
if ((cfi->ref = filter_create(fs)) == NULL)
{
free(cfi);
span_free(cfi);
return NULL;
}
if ((cfi->imf = filter_create(fs)) == NULL)
{
free(cfi->ref);
free(cfi);
span_free(cfi->ref);
span_free(cfi);
return NULL;
}
}
+5
View File
@@ -39,6 +39,11 @@
#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"
+5
View File
@@ -39,6 +39,11 @@
#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"
+7 -2
View File
@@ -32,6 +32,11 @@
#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"
@@ -102,7 +107,7 @@ SPAN_DECLARE(int) crc_itu32_append(uint8_t *buf, int len)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) crc_itu32_check(const uint8_t *buf, int len)
SPAN_DECLARE(bool) crc_itu32_check(const uint8_t *buf, int len)
{
uint32_t crc;
int i;
@@ -193,7 +198,7 @@ SPAN_DECLARE(int) crc_itu16_append(uint8_t *buf, int len)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) crc_itu16_check(const uint8_t *buf, int len)
SPAN_DECLARE(bool) crc_itu16_check(const uint8_t *buf, int len)
{
uint16_t crc;
int i;
+46 -45
View File
@@ -31,18 +31,24 @@
#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 <memory.h>
#include <string.h>
#include <limits.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/fast_convert.h"
#include "spandsp/queue.h"
@@ -62,24 +68,27 @@
#define DEFAULT_DTMF_TX_ON_TIME 50
#define DEFAULT_DTMF_TX_OFF_TIME 55
#define DTMF_SAMPLES_PER_BLOCK 102
#if defined(SPANDSP_USE_FIXED_POINT)
#define DTMF_THRESHOLD 10438 /* -42dBm0 */
#define DTMF_NORMAL_TWIST 6.309f /* 8dB */
#define DTMF_REVERSE_TWIST 2.512f /* 4dB */
#define DTMF_RELATIVE_PEAK_ROW 6.309f /* 8dB */
#define DTMF_RELATIVE_PEAK_COL 6.309f /* 8dB */
#define DTMF_TO_TOTAL_ENERGY 83.868f /* -0.85dB */
#define DTMF_POWER_OFFSET 68.251f /* 10*log(256.0*256.0*DTMF_SAMPLES_PER_BLOCK) */
#define DTMF_SAMPLES_PER_BLOCK 102
#else
#define DTMF_THRESHOLD 171032462.0f /* -42dBm0 [((DTMF_SAMPLES_PER_BLOCK*32768.0/1.4142)*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2 => 171032462.0] */
#define DTMF_NORMAL_TWIST 6.309f /* 8dB [10^(8/10) => 6.309] */
#define DTMF_REVERSE_TWIST 2.512f /* 4dB */
#define DTMF_RELATIVE_PEAK_ROW 6.309f /* 8dB */
#define DTMF_RELATIVE_PEAK_COL 6.309f /* 8dB */
/* 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 110.395f /* 10*log(32768.0*32768.0*DTMF_SAMPLES_PER_BLOCK) */
#define DTMF_SAMPLES_PER_BLOCK 102
#define DTMF_POWER_OFFSET 68.251f /* 10*log(((32768.0/128.0)^2)*DTMF_SAMPLES_PER_BLOCK) */
#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) */
#endif
static const float dtmf_row[] =
@@ -93,10 +102,11 @@ static const float dtmf_col[] =
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 int dtmf_tx_inited = FALSE;
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)
@@ -296,11 +306,7 @@ SPAN_DECLARE(int) dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples)
s->in_digit = hit;
}
s->last_hit = hit;
#if defined(SPANDSP_USE_FIXED_POINT)
s->energy = 0;
#else
s->energy = 0.0f;
#endif
s->energy = FP_SCALE(0.0f);
s->current_sample = 0;
}
if (s->current_digits && s->digits_callback)
@@ -323,11 +329,7 @@ SPAN_DECLARE(int) dtmf_rx_fillin(dtmf_rx_state_t *s, int samples)
goertzel_reset(&s->row_out[i]);
goertzel_reset(&s->col_out[i]);
}
#if defined(SPANDSP_USE_FIXED_POINT)
s->energy = 0;
#else
s->energy = 0.0f;
#endif
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. */
@@ -392,7 +394,11 @@ SPAN_DECLARE(void) dtmf_rx_parms(dtmf_rx_state_t *s,
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;
}
}
@@ -409,11 +415,10 @@ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s,
void *user_data)
{
int i;
static int initialised = FALSE;
if (s == NULL)
{
if ((s = (dtmf_rx_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (dtmf_rx_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -423,7 +428,7 @@ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s,
s->digits_callback_data = user_data;
s->realtime_callback = NULL;
s->realtime_callback_data = NULL;
s->filter_dialtone = FALSE;
s->filter_dialtone = false;
s->normal_twist = DTMF_NORMAL_TWIST;
s->reverse_twist = DTMF_REVERSE_TWIST;
s->threshold = DTMF_THRESHOLD;
@@ -431,25 +436,21 @@ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s,
s->in_digit = 0;
s->last_hit = 0;
if (!initialised)
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);
}
initialised = TRUE;
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]);
}
#if defined(SPANDSP_USE_FIXED_POINT)
s->energy = 0;
#else
s->energy = 0.0f;
#endif
s->energy = FP_SCALE(0.0f);
s->current_sample = 0;
s->lost_digits = 0;
s->current_digits = 0;
@@ -466,7 +467,7 @@ SPAN_DECLARE(int) dtmf_rx_release(dtmf_rx_state_t *s)
SPAN_DECLARE(int) dtmf_rx_free(dtmf_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -491,10 +492,10 @@ static void dtmf_tx_initialise(void)
DEFAULT_DTMF_TX_OFF_TIME,
0,
0,
FALSE);
false);
}
}
dtmf_tx_inited = TRUE;
dtmf_tx_inited = true;
}
/*- End of function --------------------------------------------------------*/
@@ -578,7 +579,7 @@ SPAN_DECLARE(dtmf_tx_state_t *) dtmf_tx_init(dtmf_tx_state_t *s,
{
if (s == NULL)
{
if ((s = (dtmf_tx_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (dtmf_tx_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -603,7 +604,7 @@ SPAN_DECLARE(int) dtmf_tx_release(dtmf_tx_state_t *s)
SPAN_DECLARE(int) dtmf_tx_free(dtmf_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+23 -23
View File
@@ -88,11 +88,17 @@
#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 <string.h>
#include <stdio.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/saturated.h"
@@ -105,12 +111,6 @@
#if !defined(NULL)
#define NULL (void *) 0
#endif
#if !defined(FALSE)
#define FALSE 0
#endif
#if !defined(TRUE)
#define TRUE (!FALSE)
#endif
#define NONUPDATE_DWELL_TIME 600 /* 600 samples, or 75ms */
@@ -244,26 +244,26 @@ SPAN_DECLARE(echo_can_state_t *) echo_can_init(int len, int adaption_mode)
int i;
int j;
if ((ec = (echo_can_state_t *) malloc(sizeof(*ec))) == NULL)
if ((ec = (echo_can_state_t *) span_alloc(sizeof(*ec))) == NULL)
return NULL;
memset(ec, 0, sizeof(*ec));
ec->taps = len;
ec->curr_pos = ec->taps - 1;
ec->tap_mask = ec->taps - 1;
if ((ec->fir_taps32 = (int32_t *) malloc(ec->taps*sizeof(int32_t))) == NULL)
if ((ec->fir_taps32 = (int32_t *) span_alloc(ec->taps*sizeof(int32_t))) == NULL)
{
free(ec);
span_free(ec);
return NULL;
}
memset(ec->fir_taps32, 0, ec->taps*sizeof(int32_t));
for (i = 0; i < 4; i++)
{
if ((ec->fir_taps16[i] = (int16_t *) malloc(ec->taps*sizeof(int16_t))) == NULL)
if ((ec->fir_taps16[i] = (int16_t *) span_alloc(ec->taps*sizeof(int16_t))) == NULL)
{
for (j = 0; j < i; j++)
free(ec->fir_taps16[j]);
free(ec->fir_taps32);
free(ec);
span_free(ec->fir_taps16[j]);
span_free(ec->fir_taps32);
span_free(ec);
return NULL;
}
memset(ec->fir_taps16[i], 0, ec->taps*sizeof(int16_t));
@@ -274,7 +274,7 @@ SPAN_DECLARE(echo_can_state_t *) echo_can_init(int len, int adaption_mode)
ec->rx_power_threshold = 10000000;
ec->geigel_max = 0;
ec->geigel_lag = 0;
ec->dtd_onset = FALSE;
ec->dtd_onset = false;
ec->tap_set = 0;
ec->tap_rotate_counter = 1600;
ec->cng_level = 1000;
@@ -294,10 +294,10 @@ SPAN_DECLARE(int) echo_can_free(echo_can_state_t *ec)
int i;
fir16_free(&ec->fir_state);
free(ec->fir_taps32);
span_free(ec->fir_taps32);
for (i = 0; i < 4; i++)
free(ec->fir_taps16[i]);
free(ec);
span_free(ec->fir_taps16[i]);
span_free(ec);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -337,7 +337,7 @@ SPAN_DECLARE(void) echo_can_flush(echo_can_state_t *ec)
ec->geigel_max = 0;
ec->geigel_lag = 0;
ec->dtd_onset = FALSE;
ec->dtd_onset = false;
ec->tap_set = 0;
ec->tap_rotate_counter = 1600;
@@ -485,7 +485,7 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
ec->narrowband_score = 0;
}
}
ec->dtd_onset = FALSE;
ec->dtd_onset = false;
if (--ec->tap_rotate_counter <= 0)
{
printf("Rotate to %d at %d\n", ec->tap_set, sample_no);
@@ -532,7 +532,7 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
for (i = 0; i < ec->taps; i++)
ec->fir_taps32[i] = ec->fir_taps16[(ec->tap_set + 1)%3][i] << 15;
ec->tap_rotate_counter = 1600;
ec->dtd_onset = TRUE;
ec->dtd_onset = true;
}
ec->nonupdate_dwell = NONUPDATE_DWELL_TIME;
}
@@ -575,7 +575,7 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
if (!ec->cng)
{
ec->cng_level = ec->clean_rx_power;
ec->cng = TRUE;
ec->cng = true;
}
if ((ec->adaption_mode & ECHO_CAN_USE_CNG))
{
@@ -594,12 +594,12 @@ printf("Revert to %d at %d\n", (ec->tap_set + 1)%3, sample_no);
}
else
{
ec->cng = FALSE;
ec->cng = false;
}
}
else
{
ec->cng = FALSE;
ec->cng = false;
}
printf("Narrowband score %4d %5d at %d\n", ec->narrowband_score, score, sample_no);
+43 -63
View File
@@ -40,6 +40,11 @@
#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>
@@ -50,6 +55,7 @@
#include <tiffio.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/queue.h"
#include "spandsp/dc_restore.h"
@@ -71,6 +77,10 @@
#include "spandsp/v27ter_rx.h"
#include "spandsp/v17tx.h"
#include "spandsp/v17rx.h"
#if defined(SPANDSP_SUPPORT_V34)
#include "spandsp/bitstream.h"
#include "spandsp/v34.h"
#endif
#include "spandsp/timezone.h"
#include "spandsp/t4_rx.h"
#include "spandsp/t4_tx.h"
@@ -78,9 +88,7 @@
#include "spandsp/t81_t82_arith_coding.h"
#include "spandsp/t85.h"
#include "spandsp/t42.h"
#if defined(SPANDSP_SUPPORT_T43)
#include "spandsp/t43.h"
#endif
#include "spandsp/t4_t6_decode.h"
#include "spandsp/t4_t6_encode.h"
@@ -95,9 +103,14 @@
#include "spandsp/private/logging.h"
#include "spandsp/private/silence_gen.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#include "spandsp/private/modem_connect_tones.h"
#include "spandsp/private/v8.h"
#if defined(SPANDSP_SUPPORT_V34)
#include "spandsp/private/bitstream.h"
#include "spandsp/private/v34.h"
#endif
#include "spandsp/private/v17tx.h"
#include "spandsp/private/v17rx.h"
#include "spandsp/private/v27ter_tx.h"
@@ -110,9 +123,7 @@
#include "spandsp/private/t81_t82_arith_coding.h"
#include "spandsp/private/t85.h"
#include "spandsp/private/t42.h"
#if defined(SPANDSP_SUPPORT_T43)
#include "spandsp/private/t43.h"
#endif
#include "spandsp/private/t4_t6_decode.h"
#include "spandsp/private/t4_t6_encode.h"
#include "spandsp/private/image_translate.h"
@@ -160,7 +171,8 @@ SPAN_DECLARE_NONSTD(int) fax_rx(fax_state_t *s, int16_t *amp, int len)
#endif
for (i = 0; i < len; i++)
amp[i] = dc_restore(&s->modems.dc_restore, amp[i]);
s->modems.rx_handler(s->modems.rx_user_data, amp, len);
if (s->modems.rx_handler)
s->modems.rx_handler(s->modems.rx_user_data, amp, len);
t30_timer_update(&s->t30, len);
return 0;
}
@@ -194,26 +206,6 @@ SPAN_DECLARE_NONSTD(int) fax_rx_fillin(fax_state_t *s, int len)
}
/*- End of function --------------------------------------------------------*/
static int set_next_tx_type(fax_state_t *s)
{
fax_modems_state_t *t;
t = &s->modems;
if (t->next_tx_handler)
{
fax_modems_set_tx_handler(t, t->next_tx_handler, t->next_tx_user_data);
t->next_tx_handler = NULL;
return 0;
}
/* If there is nothing else to change to, so use zero length silence */
silence_gen_alter(&t->silence_gen, 0);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
t->transmit = FALSE;
return -1;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE_NONSTD(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len)
{
int len;
@@ -223,41 +215,30 @@ SPAN_DECLARE_NONSTD(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len)
required_len = max_len;
#endif
len = 0;
if (s->modems.transmit)
while (s->modems.transmit && (len += s->modems.tx_handler(s->modems.tx_user_data, &amp[len], max_len - len)) < max_len)
{
while ((len += s->modems.tx_handler(s->modems.tx_user_data, amp + len, max_len - len)) < max_len)
{
/* Allow for a change of tx handler within a block */
if (set_next_tx_type(s) && s->modems.current_tx_type != T30_MODEM_NONE && s->modems.current_tx_type != T30_MODEM_DONE)
t30_front_end_status(&s->t30, T30_FRONT_END_SEND_STEP_COMPLETE);
if (!s->modems.transmit)
{
if (s->modems.transmit_on_idle)
{
/* Pad to the requested length with silence */
memset(amp + len, 0, (max_len - len)*sizeof(int16_t));
len = max_len;
}
break;
}
}
/* Allow for a change of tx handler within a block */
if (fax_modems_set_next_tx_type(&s->modems) && s->modems.current_tx_type != T30_MODEM_NONE && s->modems.current_tx_type != T30_MODEM_DONE)
t30_front_end_status(&s->t30, T30_FRONT_END_SEND_STEP_COMPLETE);
/*endif*/
}
else
/*endwhile*/
if (s->modems.transmit_on_idle)
{
if (s->modems.transmit_on_idle)
{
/* Pad to the requested length with silence */
memset(amp, 0, max_len*sizeof(int16_t));
len = max_len;
}
/* Pad to the requested length with silence */
memset(&amp[len], 0, (max_len - len)*sizeof(int16_t));
len = max_len;
}
/*endif*/
#if defined(LOG_FAX_AUDIO)
if (s->modems.audio_tx_log >= 0)
{
if (len < required_len)
memset(amp + len, 0, (required_len - len)*sizeof(int16_t));
memset(&amp[len], 0, (required_len - len)*sizeof(int16_t));
/*endif*/
write(s->modems.audio_tx_log, amp, required_len*sizeof(int16_t));
}
/*endif*/
#endif
return len;
}
@@ -275,14 +256,12 @@ static void fax_set_rx_type(void *user_data, int type, int bit_rate, int short_t
return;
t->current_rx_type = type;
t->rx_bit_rate = bit_rate;
if (use_hdlc)
hdlc_rx_init(&t->hdlc_rx, FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, t30_hdlc_accept, &s->t30);
hdlc_rx_init(&t->hdlc_rx, false, true, HDLC_FRAMING_OK_THRESHOLD, fax_modems_hdlc_accept, t);
switch (type)
{
case T30_MODEM_V21:
fax_modems_start_slow_modem(t, FAX_MODEM_V21_RX);
fax_modems_set_rx_handler(t, (span_rx_handler_t) &fsk_rx, &t->v21_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &t->v21_rx);
break;
case T30_MODEM_V17:
fax_modems_start_fast_modem(t, FAX_MODEM_V17_RX, bit_rate, short_train, use_hdlc);
@@ -313,20 +292,21 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
span_log(&s->logging, SPAN_LOG_FLOW, "Set tx type %d\n", type);
if (t->current_tx_type == type)
return;
switch (type)
{
case T30_MODEM_PAUSE:
silence_gen_alter(&t->silence_gen, ms_to_samples(short_train));
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_CED:
case T30_MODEM_CNG:
tone = (type == T30_MODEM_CED) ? FAX_MODEM_CED_TONE_TX : FAX_MODEM_CNG_TONE_TX;
fax_modems_start_slow_modem(t, tone);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_V21:
fax_modems_start_slow_modem(t, FAX_MODEM_V21_TX);
@@ -339,7 +319,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &fsk_tx, &t->v21_tx);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_V17:
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
@@ -348,7 +328,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
fax_modems_start_fast_modem(t, FAX_MODEM_V17_TX, bit_rate, short_train, use_hdlc);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v17_tx, &t->fast_modems.v17_tx);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_V27TER:
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
@@ -357,7 +337,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
fax_modems_start_fast_modem(t, FAX_MODEM_V27TER_TX, bit_rate, short_train, use_hdlc);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v27ter_tx, &t->fast_modems.v27ter_tx);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_V29:
silence_gen_alter(&t->silence_gen, ms_to_samples(75));
@@ -366,7 +346,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
fax_modems_start_fast_modem(t, FAX_MODEM_V29_TX, bit_rate, short_train, use_hdlc);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) &v29_tx, &t->fast_modems.v29_tx);
t->transmit = TRUE;
t->transmit = true;
break;
case T30_MODEM_DONE:
span_log(&s->logging, SPAN_LOG_FLOW, "FAX exchange complete\n");
@@ -375,7 +355,7 @@ static void fax_set_tx_type(void *user_data, int type, int bit_rate, int short_t
silence_gen_alter(&t->silence_gen, 0);
fax_modems_set_tx_handler(t, (span_tx_handler_t) &silence_gen, &t->silence_gen);
fax_modems_set_next_tx_handler(t, (span_tx_handler_t) NULL, NULL);
t->transmit = FALSE;
t->transmit = false;
break;
}
t->tx_bit_rate = bit_rate;
@@ -470,14 +450,14 @@ SPAN_DECLARE(fax_state_t *) fax_init(fax_state_t *s, int calling_party)
if (s == NULL)
{
if ((s = (fax_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (fax_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, "FAX");
fax_modems_init(&s->modems,
FALSE,
false,
t30_hdlc_accept,
hdlc_underflow_handler,
t30_non_ecm_put_bit,
@@ -525,7 +505,7 @@ SPAN_DECLARE(int) fax_release(fax_state_t *s)
SPAN_DECLARE(int) fax_free(fax_state_t *s)
{
t30_release(&s->t30);
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+127 -18
View File
@@ -5,7 +5,7 @@
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2003, 2005, 2006, 2008 Steve Underwood
* Copyright (C) 2003, 2005, 2006, 2008, 2013 Steve Underwood
*
* All rights reserved.
*
@@ -39,6 +39,11 @@
#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>
@@ -48,8 +53,10 @@
#endif
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/bitstream.h"
#include "spandsp/dc_restore.h"
#include "spandsp/queue.h"
#include "spandsp/power_meter.h"
@@ -67,13 +74,21 @@
#include "spandsp/v27ter_rx.h"
#include "spandsp/v17tx.h"
#include "spandsp/v17rx.h"
#if defined(SPANDSP_SUPPORT_V34)
#include "spandsp/v34.h"
#endif
#include "spandsp/super_tone_rx.h"
#include "spandsp/modem_connect_tones.h"
#include "spandsp/fax_modems.h"
#include "spandsp/private/logging.h"
#include "spandsp/private/bitstream.h"
#include "spandsp/private/silence_gen.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#if defined(SPANDSP_SUPPORT_V34)
#include "spandsp/private/v34.h"
#endif
#include "spandsp/private/v17tx.h"
#include "spandsp/private/v17rx.h"
#include "spandsp/private/v27ter_tx.h"
@@ -86,13 +101,64 @@
#define HDLC_FRAMING_OK_THRESHOLD 5
static void fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok)
SPAN_DECLARE(const char *) fax_modem_to_str(int modem)
{
switch (modem)
{
case FAX_MODEM_NONE:
return "None";
case FAX_MODEM_FLUSH:
return "Flush";
case FAX_MODEM_SILENCE_TX:
return "Silence Tx";
case FAX_MODEM_SILENCE_RX:
return "Silence Rx";
case FAX_MODEM_CED_TONE_TX:
return "CED Tx";
case FAX_MODEM_CNG_TONE_TX:
return "CNG Tx";
case FAX_MODEM_NOCNG_TONE_TX:
return "No CNG Tx";
case FAX_MODEM_CED_TONE_RX:
return "CED Rx";
case FAX_MODEM_CNG_TONE_RX:
return "CNG Rx";
case FAX_MODEM_V21_TX:
return "V.21 Tx";
case FAX_MODEM_V17_TX:
return "V.17 Tx";
case FAX_MODEM_V27TER_TX:
return "V.27ter Tx";
case FAX_MODEM_V29_TX:
return "V.29 Tx";
case FAX_MODEM_V21_RX:
return "V.21 Rx";
case FAX_MODEM_V17_RX:
return "V.17 Rx";
case FAX_MODEM_V27TER_RX:
return "V.27ter Rx";
case FAX_MODEM_V29_RX:
return "V.29 Rx";
#if defined(SPANDSP_SUPPORT_V34)
case FAX_MODEM_V34_TX:
return "V.34 HDX Tx";
case FAX_MODEM_V34_RX:
return "V.34 HDX Rx";
#endif
}
/*endswitch*/
return "???";
}
/*- End of function --------------------------------------------------------*/
//static void fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok)
SPAN_DECLARE(void) fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok)
{
fax_modems_state_t *s;
s = (fax_modems_state_t *) user_data;
if (ok)
s->rx_frame_received = TRUE;
if (len >= 0 && ok)
s->rx_frame_received = true;
if (s->hdlc_accept)
s->hdlc_accept(s->hdlc_accept_user_data, msg, len, ok);
}
@@ -263,7 +329,7 @@ SPAN_DECLARE(void) fax_modems_start_slow_modem(fax_modems_state_t *s, int which)
fsk_rx_init(&s->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, &s->hdlc_rx);
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fsk_rx, &s->v21_rx, (span_rx_fillin_handler_t) &fsk_rx_fillin, &s->v21_rx);
fsk_rx_signal_cutoff(&s->v21_rx, -39.09f);
s->rx_frame_received = FALSE;
//hdlc_rx_init(&s->hdlc_rx, false, true, HDLC_FRAMING_OK_THRESHOLD, fax_modems_hdlc_accept, s);
break;
case FAX_MODEM_CED_TONE_RX:
modem_connect_tones_rx_init(&s->connect_rx, MODEM_CONNECT_TONES_FAX_CED, s->tone_callback, s->tone_callback_user_data);
@@ -289,6 +355,8 @@ SPAN_DECLARE(void) fax_modems_start_slow_modem(fax_modems_state_t *s, int which)
fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL);
break;
}
/*endswitch*/
s->rx_frame_received = false;
}
/*- End of function --------------------------------------------------------*/
@@ -306,6 +374,7 @@ SPAN_DECLARE(void) fax_modems_start_fast_modem(fax_modems_state_t *s, int which,
get_bit_user_data = (void *) &s->hdlc_tx;
put_bit = (put_bit_func_t) hdlc_rx_put_bit;
put_bit_user_data = (void *) &s->hdlc_rx;
//hdlc_rx_init(&s->hdlc_rx, false, true, HDLC_FRAMING_OK_THRESHOLD, fax_modems_hdlc_accept, s);
}
else
{
@@ -321,10 +390,8 @@ SPAN_DECLARE(void) fax_modems_start_fast_modem(fax_modems_state_t *s, int which,
if (s->fast_modem != which)
{
s->current_rx_type = which;
s->short_train = FALSE;
s->short_train = false;
s->fast_modem = which;
if (hdlc_mode)
s->rx_frame_received = FALSE;
switch (s->fast_modem)
{
case FAX_MODEM_V27TER_RX:
@@ -358,6 +425,18 @@ SPAN_DECLARE(void) fax_modems_start_fast_modem(fax_modems_state_t *s, int which,
fax_modems_set_tx_handler(s, (span_tx_handler_t) &v17_tx, &s->fast_modems.v17_tx);
fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL);
break;
#if defined(SPANDSP_SUPPORT_V34)
case FAX_MODEM_V34_RX:
v34_init(&s->fast_modems.v34, 2400, s->bit_rate, true, false, NULL, NULL, put_bit, put_bit_user_data);
//fax_modems_set_tx_handler(s, (span_tx_handler_t) &v34_rx, &s->fast_modems.v34_rx);
fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL);
break;
case FAX_MODEM_V34_TX:
v34_init(&s->fast_modems.v34, 2400, s->bit_rate, true, false, get_bit, get_bit_user_data, NULL, NULL);
//fax_modems_set_tx_handler(s, (span_tx_handler_t) &v34_tx, &s->fast_modems.v34_tx);
fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL);
break;
#endif
}
/*endswitch*/
}
@@ -367,13 +446,13 @@ SPAN_DECLARE(void) fax_modems_start_fast_modem(fax_modems_state_t *s, int which,
switch (s->fast_modem)
{
case FAX_MODEM_V27TER_RX:
v27ter_rx_restart(&s->fast_modems.v27ter_rx, s->bit_rate, FALSE);
v27ter_rx_restart(&s->fast_modems.v27ter_rx, s->bit_rate, false);
v27ter_rx_set_put_bit(&s->fast_modems.v27ter_rx, put_bit, put_bit_user_data);
v27ter_rx_set_modem_status_handler(&s->fast_modems.v27ter_rx, v27ter_rx_status_handler, s);
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fax_modems_v27ter_v21_rx, s, (span_rx_fillin_handler_t) &fax_modems_v27ter_v21_rx_fillin, s);
break;
case FAX_MODEM_V29_RX:
v29_rx_restart(&s->fast_modems.v29_rx, s->bit_rate, FALSE);
v29_rx_restart(&s->fast_modems.v29_rx, s->bit_rate, false);
v29_rx_set_put_bit(&s->fast_modems.v29_rx, put_bit, put_bit_user_data);
v29_rx_set_modem_status_handler(&s->fast_modems.v29_rx, v29_rx_status_handler, s);
fax_modems_set_rx_handler(s, (span_rx_handler_t) &fax_modems_v29_v21_rx, s, (span_rx_fillin_handler_t) &fax_modems_v29_v21_rx_fillin, s);
@@ -402,10 +481,23 @@ SPAN_DECLARE(void) fax_modems_start_fast_modem(fax_modems_state_t *s, int which,
fax_modems_set_tx_handler(s, (span_tx_handler_t) &v17_tx, &s->fast_modems.v17_tx);
fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL);
break;
#if defined(SPANDSP_SUPPORT_V34)
case FAX_MODEM_V34_RX:
v34_restart(&s->fast_modems.v34, 2400, s->bit_rate, false);
//fax_modems_set_tx_handler(s, (span_tx_handler_t) &v34_rx, &s->fast_modems.v34_rx);
fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL);
break;
case FAX_MODEM_V34_TX:
v34_restart(&s->fast_modems.v34, 2400, s->bit_rate, false);
//fax_modems_set_tx_handler(s, (span_tx_handler_t) &v34_tx, &s->fast_modems.v34_tx);
fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL);
break;
#endif
}
/*endswitch*/
}
/*endif*/
s->rx_frame_received = false;
}
/*- End of function --------------------------------------------------------*/
@@ -474,6 +566,23 @@ SPAN_DECLARE(void) fax_modems_set_next_tx_handler(fax_modems_state_t *s, span_tx
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) fax_modems_set_next_tx_type(fax_modems_state_t *s)
{
if (s->next_tx_handler)
{
fax_modems_set_tx_handler(s, s->next_tx_handler, s->next_tx_user_data);
fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL);
return 0;
}
/* There is nothing else to change to, so use zero length silence */
silence_gen_alter(&s->silence_gen, 0);
fax_modems_set_tx_handler(s, (span_tx_handler_t) &silence_gen, &s->silence_gen);
fax_modems_set_next_tx_handler(s, (span_tx_handler_t) NULL, NULL);
s->transmit = false;
return -1;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) fax_modems_set_tep_mode(fax_modems_state_t *s, int use_tep)
{
s->use_tep = use_tep;
@@ -503,7 +612,7 @@ SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s,
{
if (s == NULL)
{
if ((s = (fax_modems_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (fax_modems_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
/*endif*/
@@ -511,6 +620,9 @@ SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s,
s->use_tep = use_tep;
modem_connect_tones_tx_init(&s->connect_tx, MODEM_CONNECT_TONES_FAX_CNG);
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
span_log_set_protocol(&s->logging, "FAX modems");
s->tone_callback = tone_callback;
s->tone_callback_user_data = user_data;
if (tone_callback)
@@ -521,9 +633,6 @@ SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s,
s->tone_callback_user_data);
}
/*endif*/
span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
span_log_set_protocol(&s->logging, "FAX modems");
dc_restore_init(&s->dc_restore);
s->get_bit = non_ecm_get_bit;
@@ -534,15 +643,15 @@ SPAN_DECLARE(fax_modems_state_t *) fax_modems_init(fax_modems_state_t *s,
s->hdlc_accept = hdlc_accept;
s->hdlc_accept_user_data = user_data;
hdlc_rx_init(&s->hdlc_rx, FALSE, FALSE, HDLC_FRAMING_OK_THRESHOLD, fax_modems_hdlc_accept, s);
hdlc_tx_init(&s->hdlc_tx, FALSE, 2, FALSE, hdlc_tx_underflow, user_data);
hdlc_rx_init(&s->hdlc_rx, false, false, HDLC_FRAMING_OK_THRESHOLD, fax_modems_hdlc_accept, s);
hdlc_tx_init(&s->hdlc_tx, false, 2, false, hdlc_tx_underflow, user_data);
fax_modems_start_slow_modem(s, FAX_MODEM_V21_RX);
fsk_tx_init(&s->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &s->hdlc_tx);
silence_gen_init(&s->silence_gen, 0);
s->rx_signal_present = FALSE;
s->rx_signal_present = false;
s->rx_handler = (span_rx_handler_t) &span_dummy_rx;
s->rx_fillin_handler = (span_rx_fillin_handler_t) &span_dummy_rx;
s->rx_user_data = NULL;
@@ -562,7 +671,7 @@ SPAN_DECLARE(int) fax_modems_release(fax_modems_state_t *s)
SPAN_DECLARE(int) fax_modems_free(fax_modems_state_t *s)
{
if (s)
free(s);
span_free(s);
/*endif*/
return 0;
}
+9 -11
View File
@@ -32,29 +32,27 @@
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.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 <string.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#include "spandsp/telephony.h"
#include "spandsp/complex.h"
#include "filter_tools.h"
#if !defined(FALSE)
#define FALSE 0
#endif
#if !defined(TRUE)
#define TRUE (!FALSE)
#endif
#define MAXPZ 8192
#define SEQ_LEN 8192
#define MAX_FFT_LEN SEQ_LEN
+22 -6
View File
@@ -38,16 +38,23 @@
#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 "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/complex.h"
#include "spandsp/dds.h"
#include "spandsp/power_meter.h"
#include "spandsp/async.h"
#include "spandsp/fsk.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
const fsk_spec_t preset_fsk_specs[] =
@@ -69,6 +76,7 @@ const fsk_spec_t preset_fsk_specs[] =
300*100
},
{
/* This is mode 2 of the V.23 spec. Mode 1 (the 600baud mode) is not defined here */
"V23 ch 1",
1700 + 400,
1700 - 400,
@@ -124,6 +132,14 @@ const fsk_spec_t preset_fsk_specs[] =
-30,
50*100
},
{
"Weitbrecht 47.6", /* Used for V.18 probing */
1600 + 200,
1600 - 200,
-14,
-30,
4760
},
{
"V21 (110bps) ch 1",
1080 + 100,
@@ -145,7 +161,7 @@ SPAN_DECLARE(int) fsk_tx_restart(fsk_tx_state_t *s, const fsk_spec_t *spec)
s->baud_frac = 0;
s->current_phase_rate = s->phase_rates[1];
s->shutdown = FALSE;
s->shutdown = false;
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -157,7 +173,7 @@ SPAN_DECLARE(fsk_tx_state_t *) fsk_tx_init(fsk_tx_state_t *s,
{
if (s == NULL)
{
if ((s = (fsk_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (fsk_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -177,7 +193,7 @@ SPAN_DECLARE(int) fsk_tx_release(fsk_tx_state_t *s)
SPAN_DECLARE(int) fsk_tx_free(fsk_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -204,7 +220,7 @@ SPAN_DECLARE_NONSTD(int) fsk_tx(fsk_tx_state_t *s, int16_t amp[], int len)
s->status_handler(s->status_user_data, SIG_STATUS_END_OF_DATA);
if (s->status_handler)
s->status_handler(s->status_user_data, SIG_STATUS_SHUTDOWN_COMPLETE);
s->shutdown = TRUE;
s->shutdown = true;
break;
}
s->current_phase_rate = s->phase_rates[bit & 1];
@@ -319,7 +335,7 @@ SPAN_DECLARE(fsk_rx_state_t *) fsk_rx_init(fsk_rx_state_t *s,
{
if (s == NULL)
{
if ((s = (fsk_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (fsk_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -339,7 +355,7 @@ SPAN_DECLARE(int) fsk_rx_release(fsk_rx_state_t *s)
SPAN_DECLARE(int) fsk_rx_free(fsk_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -35,6 +35,7 @@
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bit_operations.h"
#include "spandsp/g711.h"
#include "spandsp/private/g711.h"
@@ -171,7 +172,7 @@ SPAN_DECLARE(g711_state_t *) g711_init(g711_state_t *s, int mode)
{
if (s == NULL)
{
if ((s = (g711_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (g711_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->mode = mode;
@@ -187,7 +188,7 @@ SPAN_DECLARE(int) g711_release(g711_state_t *s)
SPAN_DECLARE(int) g711_free(g711_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+16 -16
View File
@@ -21,12 +21,6 @@
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Based in part on a single channel G.722 codec which is:
*
* Copyright (c) CMU 1993
* Computer Science, Speech Group
* Chengxiang Lu and Alex Hauptmann
*/
/*! \file */
@@ -44,9 +38,15 @@
#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/vector_int.h"
@@ -257,7 +257,7 @@ SPAN_DECLARE(g722_decode_state_t *) g722_decode_init(g722_decode_state_t *s, int
{
if (s == NULL)
{
if ((s = (g722_decode_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (g722_decode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -268,11 +268,11 @@ SPAN_DECLARE(g722_decode_state_t *) g722_decode_init(g722_decode_state_t *s, int
else
s->bits_per_sample = 8;
if ((options & G722_SAMPLE_RATE_8000))
s->eight_k = TRUE;
s->eight_k = true;
if ((options & G722_PACKED) && s->bits_per_sample != 8)
s->packed = TRUE;
s->packed = true;
else
s->packed = FALSE;
s->packed = false;
s->band[0].det = 32;
s->band[1].det = 8;
return s;
@@ -287,7 +287,7 @@ SPAN_DECLARE(int) g722_decode_release(g722_decode_state_t *s)
SPAN_DECLARE(int) g722_decode_free(g722_decode_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -438,7 +438,7 @@ SPAN_DECLARE(g722_encode_state_t *) g722_encode_init(g722_encode_state_t *s, int
{
if (s == NULL)
{
if ((s = (g722_encode_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (g722_encode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -449,11 +449,11 @@ SPAN_DECLARE(g722_encode_state_t *) g722_encode_init(g722_encode_state_t *s, int
else
s->bits_per_sample = 8;
if ((options & G722_SAMPLE_RATE_8000))
s->eight_k = TRUE;
s->eight_k = true;
if ((options & G722_PACKED) && s->bits_per_sample != 8)
s->packed = TRUE;
s->packed = true;
else
s->packed = FALSE;
s->packed = false;
s->band[0].det = 32;
s->band[1].det = 8;
return s;
@@ -468,7 +468,7 @@ SPAN_DECLARE(int) g722_encode_release(g722_encode_state_t *s)
SPAN_DECLARE(int) g722_encode_free(g722_encode_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+16 -10
View File
@@ -64,9 +64,15 @@
#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/bitstream.h"
#include "spandsp/bit_operations.h"
#include "spandsp/g711.h"
@@ -393,7 +399,7 @@ static void update(g726_state_t *s,
int16_t thr;
int16_t pk0;
int i;
int tr;
bool tr;
a2p = 0;
/* Needed in updating predictor poles */
@@ -408,11 +414,11 @@ static void update(g726_state_t *s,
thr = (ylint > 9) ? (31 << 10) : ((32 + ylfrac) << ylint);
dqthr = (thr + (thr >> 1)) >> 1; /* dqthr = 0.75 * thr */
if (!s->td) /* signal supposed voice */
tr = FALSE;
tr = false;
else if (mag <= dqthr) /* supposed data, but small mag */
tr = FALSE; /* treated as voice */
tr = false; /* treated as voice */
else /* signal is data (modem) */
tr = TRUE;
tr = true;
/*
* Quantizer scale factor adaptation.
@@ -563,11 +569,11 @@ static void update(g726_state_t *s,
/* TONE */
if (tr) /* this sample has been treated as data */
s->td = FALSE; /* next one will be treated as voice */
s->td = false; /* next one will be treated as voice */
else if (a2p < -11776) /* small sample-to-sample correlation */
s->td = TRUE; /* signal may be data */
s->td = true; /* signal may be data */
else /* signal is voice */
s->td = FALSE;
s->td = false;
/* Adaptation speed control. */
/* FILTA */
@@ -1002,7 +1008,7 @@ SPAN_DECLARE(g726_state_t *) g726_init(g726_state_t *s, int bit_rate, int ext_co
return NULL;
if (s == NULL)
{
if ((s = (g726_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (g726_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->yl = 34816;
@@ -1024,7 +1030,7 @@ SPAN_DECLARE(g726_state_t *) g726_init(g726_state_t *s, int bit_rate, int ext_co
s->b[i] = 0;
s->dq[i] = 32;
}
s->td = FALSE;
s->td = false;
switch (bit_rate)
{
case 16000:
@@ -1062,7 +1068,7 @@ SPAN_DECLARE(int) g726_release(g726_state_t *s)
SPAN_DECLARE(int) g726_free(g726_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -45,6 +45,7 @@
#include <memory.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/bitstream.h"
#include "spandsp/saturated.h"
@@ -115,7 +116,7 @@ SPAN_DECLARE(gsm0610_state_t *) gsm0610_init(gsm0610_state_t *s, int packing)
{
if (s == NULL)
{
if ((s = (gsm0610_state_t *) malloc(sizeof (*s))) == NULL)
if ((s = (gsm0610_state_t *) span_alloc(sizeof (*s))) == NULL)
return NULL;
/*endif*/
}
@@ -136,7 +137,7 @@ SPAN_DECLARE(int) gsm0610_release(gsm0610_state_t *s)
SPAN_DECLARE(int) gsm0610_free(gsm0610_state_t *s)
{
if (s)
free(s);
span_free(s);
/*endif*/
return 0;
}
+29 -23
View File
@@ -33,8 +33,14 @@
#include <inttypes.h>
#include <string.h>
#include <stdio.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/async.h"
#include "spandsp/crc.h"
#include "spandsp/bit_operations.h"
@@ -46,7 +52,7 @@ static void report_status_change(hdlc_rx_state_t *s, int status)
if (s->status_handler)
s->status_handler(s->status_user_data, status);
else if (s->frame_handler)
s->frame_handler(s->frame_user_data, NULL, status, TRUE);
s->frame_handler(s->frame_user_data, NULL, status, true);
}
/*- End of function --------------------------------------------------------*/
@@ -62,7 +68,7 @@ static void rx_special_condition(hdlc_rx_state_t *s, int status)
s->len = 0;
s->num_bits = 0;
s->flags_seen = 0;
s->framing_ok_announced = FALSE;
s->framing_ok_announced = false;
/* Fall through */
case SIG_STATUS_TRAINING_IN_PROGRESS:
case SIG_STATUS_TRAINING_FAILED:
@@ -94,7 +100,7 @@ static __inline__ void octet_set_and_count(hdlc_rx_state_t *s)
}
else
{
s->octet_counting_mode = TRUE;
s->octet_counting_mode = true;
s->octet_count = s->octet_count_report_interval;
}
}
@@ -139,7 +145,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
{
/* Hit HDLC flag */
/* A flag clears octet counting */
s->octet_counting_mode = FALSE;
s->octet_counting_mode = false;
if (s->flags_seen >= s->framing_ok_threshold)
{
/* We may have a frame, or we may have back to back flags */
@@ -155,7 +161,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
s->rx_bytes += s->len - s->crc_bytes;
s->len -= s->crc_bytes;
if (s->frame_handler)
s->frame_handler(s->frame_user_data, s->buffer, s->len, TRUE);
s->frame_handler(s->frame_user_data, s->buffer, s->len, true);
}
else
{
@@ -164,7 +170,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
{
s->len -= s->crc_bytes;
if (s->frame_handler)
s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE);
s->frame_handler(s->frame_user_data, s->buffer, s->len, false);
}
}
}
@@ -180,7 +186,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
else
s->len = 0;
if (s->frame_handler)
s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE);
s->frame_handler(s->frame_user_data, s->buffer, s->len, false);
}
s->rx_length_errors++;
}
@@ -205,7 +211,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
if (++s->flags_seen >= s->framing_ok_threshold && !s->framing_ok_announced)
{
report_status_change(s, SIG_STATUS_FRAMING_OK);
s->framing_ok_announced = TRUE;
s->framing_ok_announced = true;
}
}
}
@@ -306,15 +312,15 @@ SPAN_DECLARE(void) hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s,
int crc32,
int report_bad_frames,
bool crc32,
bool report_bad_frames,
int framing_ok_threshold,
hdlc_frame_handler_t handler,
void *user_data)
{
if (s == NULL)
{
if ((s = (hdlc_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (hdlc_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -350,7 +356,7 @@ SPAN_DECLARE(int) hdlc_rx_release(hdlc_rx_state_t *s)
SPAN_DECLARE(int) hdlc_rx_free(hdlc_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -371,7 +377,7 @@ SPAN_DECLARE(int) hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t
{
if (len <= 0)
{
s->tx_end = TRUE;
s->tx_end = true;
return 0;
}
if (s->len + len > s->max_frame_len)
@@ -397,7 +403,7 @@ SPAN_DECLARE(int) hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t
s->len += len;
else
s->len = len;
s->tx_end = FALSE;
s->tx_end = false;
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -412,8 +418,8 @@ SPAN_DECLARE(int) hdlc_tx_flags(hdlc_tx_state_t *s, int len)
s->flag_octets += -len;
else
s->flag_octets = len;
s->report_flag_underflow = TRUE;
s->tx_end = FALSE;
s->report_flag_underflow = true;
s->tx_end = false;
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -452,7 +458,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
/* We are in a timed flag section (preamble, inter frame gap, etc.) */
if (--s->flag_octets <= 0 && s->report_flag_underflow)
{
s->report_flag_underflow = FALSE;
s->report_flag_underflow = false;
if (s->len == 0)
{
/* The timed flags have finished, there is nothing else queued to go,
@@ -508,7 +514,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
s->crc = 0xFFFFFFFF;
/* Report the underflow now. If there are timed flags still in progress, loading the
next frame right now will be harmless. */
s->report_flag_underflow = FALSE;
s->report_flag_underflow = false;
if (s->underflow_handler)
s->underflow_handler(s->user_data);
/* Make sure we finish off with at least one flag octet, if the underflow report did not result
@@ -539,7 +545,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
/* Untimed idling on flags */
if (s->tx_end)
{
s->tx_end = FALSE;
s->tx_end = false;
return SIG_STATUS_END_OF_DATA;
}
return s->idle_octet;
@@ -584,15 +590,15 @@ SPAN_DECLARE(void) hdlc_tx_set_max_frame_len(hdlc_tx_state_t *s, size_t max_len)
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s,
int crc32,
bool crc32,
int inter_frame_flags,
int progressive,
bool progressive,
hdlc_underflow_handler_t handler,
void *user_data)
{
if (s == NULL)
{
if ((s = (hdlc_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (hdlc_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -624,7 +630,7 @@ SPAN_DECLARE(int) hdlc_tx_release(hdlc_tx_state_t *s)
SPAN_DECLARE(int) hdlc_tx_free(hdlc_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -42,6 +42,7 @@
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/ima_adpcm.h"
@@ -282,7 +283,7 @@ SPAN_DECLARE(ima_adpcm_state_t *) ima_adpcm_init(ima_adpcm_state_t *s,
{
if (s == NULL)
{
if ((s = (ima_adpcm_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (ima_adpcm_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
/*endif*/
@@ -301,7 +302,7 @@ SPAN_DECLARE(int) ima_adpcm_release(ima_adpcm_state_t *s)
SPAN_DECLARE(int) ima_adpcm_free(ima_adpcm_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+120 -98
View File
@@ -47,11 +47,17 @@
#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 <tiffio.h>
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/saturated.h"
@@ -61,9 +67,7 @@
#include "spandsp/t81_t82_arith_coding.h"
#include "spandsp/t85.h"
#include "spandsp/t42.h"
#if defined(SPANDSP_SUPPORT_T43)
#include "spandsp/t43.h"
#endif
#include "spandsp/t4_t6_decode.h"
#include "spandsp/t4_t6_encode.h"
#include "spandsp/image_translate.h"
@@ -72,9 +76,7 @@
#include "spandsp/private/t81_t82_arith_coding.h"
#include "spandsp/private/t85.h"
#include "spandsp/private/t42.h"
#if defined(SPANDSP_SUPPORT_T43)
#include "spandsp/private/t43.h"
#endif
#include "spandsp/private/t4_t6_decode.h"
#include "spandsp/private/t4_t6_encode.h"
#include "spandsp/private/image_translate.h"
@@ -253,6 +255,7 @@ static int get_and_scrunch_row(image_translate_state_t *s, uint8_t buf[])
case T4_IMAGE_TYPE_COLOUR_12BIT:
image_gray16_to_colour16_row((uint16_t *) buf, (uint16_t *) buf, s->input_width);
break;
case T4_IMAGE_TYPE_COLOUR_BILEVEL:
case T4_IMAGE_TYPE_COLOUR_8BIT:
image_gray16_to_colour8_row(buf, (uint16_t *) buf, s->input_width);
break;
@@ -267,6 +270,7 @@ static int get_and_scrunch_row(image_translate_state_t *s, uint8_t buf[])
case T4_IMAGE_TYPE_COLOUR_12BIT:
image_gray8_to_colour16_row((uint16_t *) buf, buf, s->input_width);
break;
case T4_IMAGE_TYPE_COLOUR_BILEVEL:
case T4_IMAGE_TYPE_COLOUR_8BIT:
image_gray8_to_colour8_row(buf, buf, s->input_width);
break;
@@ -282,11 +286,13 @@ static int get_and_scrunch_row(image_translate_state_t *s, uint8_t buf[])
case T4_IMAGE_TYPE_GRAY_8BIT:
image_colour16_to_gray8_row(buf, (uint16_t *) buf, s->input_width);
break;
case T4_IMAGE_TYPE_COLOUR_BILEVEL:
case T4_IMAGE_TYPE_COLOUR_8BIT:
image_colour16_to_colour8_row(buf, (uint16_t *) buf, s->input_width);
break;
}
break;
case T4_IMAGE_TYPE_COLOUR_BILEVEL:
case T4_IMAGE_TYPE_COLOUR_8BIT:
switch (s->output_format)
{
@@ -327,6 +333,7 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[])
double int_part;
double frac_row;
double frac_col;
double width_scaling;
#endif
uint8_t *row8[2];
uint16_t *row16[2];
@@ -342,17 +349,13 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[])
input_width = s->input_width - 1;
input_length = s->input_length - 1;
skip = s->raw_output_row*input_length/output_length;
skip = s->raw_output_row*input_length/output_length + 1;
if (skip >= s->raw_input_row)
{
skip++;
while (skip >= s->raw_input_row)
{
if (s->raw_input_row >= s->input_length)
{
s->raw_output_row = -1;
break;
}
row_len = get_and_scrunch_row(s, s->raw_pixel_row[0]);
if (row_len != s->output_width)
{
@@ -370,10 +373,12 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[])
frac_row = ((s->raw_output_row*256*input_length)/output_length) & 0xFF;
#else
frac_row = modf((double) s->raw_output_row*input_length/output_length, &int_part);
width_scaling = (double) input_width/output_width;
#endif
switch (s->output_format)
{
case T4_IMAGE_TYPE_COLOUR_BILEVEL:
case T4_IMAGE_TYPE_COLOUR_8BIT:
row8[0] = s->raw_pixel_row[0];
row8[1] = s->raw_pixel_row[1];
@@ -391,7 +396,7 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[])
buf[3*i + j] = saturateu8(c1 + (((c2 - c1)*frac_row) >> 8));
}
#else
frac_col = modf((double) i*input_width/output_width, &int_part);
frac_col = modf(width_scaling*i, &int_part);
x = 3*int_part;
for (j = 0; j < 3; j++)
{
@@ -420,7 +425,7 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[])
buf16[3*i + j] = saturateu16(c1 + (((c2 - c1)*frac_row) >> 8));
}
#else
frac_col = modf((double) i*input_width/output_width, &int_part);
frac_col = modf(width_scaling*i, &int_part);
x = 3*int_part;
for (j = 0; j < 3; j++)
{
@@ -445,7 +450,7 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[])
c2 = row8[1][x] + (((row8[1][x + 1] - row8[1][x])*frac_col) >> 8);
buf[i] = saturateu8(c1 + (((c2 - c1)*frac_row) >> 8));
#else
frac_col = modf((double) i*input_width/output_width, &int_part);
frac_col = modf(width_scaling*i, &int_part);
x = int_part;
c1 = row8[0][x] + (row8[0][x + 1] - row8[0][x])*frac_col;
c2 = row8[1][x] + (row8[1][x + 1] - row8[1][x])*frac_col;
@@ -467,7 +472,7 @@ static int image_resize_row(image_translate_state_t *s, uint8_t buf[])
c2 = row16[1][x] + (((row16[1][x + 1] - row16[1][x])*frac_col) >> 8);
buf[i] = saturateu8(c1 + (((c2 - c1)*frac_row) >> 8));
#else
frac_col = modf((double) i*input_width/output_width, &int_part);
frac_col = modf(width_scaling*i, &int_part);
x = int_part;
c1 = row16[0][x] + (row16[0][x + 1] - row16[0][x])*frac_col;
c2 = row16[1][x] + (row16[1][x + 1] - row16[1][x])*frac_col;
@@ -611,12 +616,14 @@ SPAN_DECLARE(int) image_translate_row(image_translate_state_t *s, uint8_t buf[],
if (s->output_row < 0)
return 0;
if (s->output_format == T4_IMAGE_TYPE_BILEVEL)
switch (s->output_format)
{
case T4_IMAGE_TYPE_BILEVEL:
case T4_IMAGE_TYPE_COLOUR_BILEVEL:
case T4_IMAGE_TYPE_4COLOUR_BILEVEL:
i = floyd_steinberg_dither_row(s, buf);
}
else
{
break;
default:
s->output_row++;
if (s->resize)
{
@@ -631,6 +638,7 @@ SPAN_DECLARE(int) image_translate_row(image_translate_state_t *s, uint8_t buf[],
if (s->output_row < 0)
return 0;
i = s->output_width*s->output_bytes_per_pixel;
break;
}
return i;
}
@@ -648,84 +656,50 @@ SPAN_DECLARE(int) image_translate_get_output_length(image_translate_state_t *s)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_state_t *s,
int input_format,
int input_width,
int input_length,
int output_format,
int output_width,
int output_length,
t4_row_read_handler_t row_read_handler,
void *row_read_user_data)
SPAN_DECLARE(int) image_translate_set_row_read_handler(image_translate_state_t *s, t4_row_read_handler_t row_read_handler, void *row_read_user_data)
{
s->row_read_handler = row_read_handler;
s->row_read_user_data = row_read_user_data;
return 0;
}
/*- End of function --------------------------------------------------------*/
static int image_format_to_bytes_per_pixel(int image_format)
{
switch (image_format)
{
default:
case T4_IMAGE_TYPE_BILEVEL:
case T4_IMAGE_TYPE_GRAY_8BIT:
return 1;
case T4_IMAGE_TYPE_GRAY_12BIT:
return 2;
case T4_IMAGE_TYPE_COLOUR_BILEVEL:
case T4_IMAGE_TYPE_COLOUR_8BIT:
return 3;
case T4_IMAGE_TYPE_4COLOUR_BILEVEL:
case T4_IMAGE_TYPE_4COLOUR_8BIT:
return 4;
case T4_IMAGE_TYPE_COLOUR_12BIT:
return 6;
case T4_IMAGE_TYPE_4COLOUR_12BIT:
return 8;
}
return 1;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) image_translate_restart(image_translate_state_t *s, int input_length)
{
int i;
int raw_row_size;
int row_size;
if (s == NULL)
{
if ((s = (image_translate_state_t *) malloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
s->input_format = input_format;
s->input_width = input_width;
s->input_length = input_length;
s->output_format = output_format;
if ((s->resize = (output_width > 0)))
{
s->output_width = output_width;
if (output_length > 0)
s->output_length = output_length;
else
s->output_length = (s->input_length*s->output_width)/s->input_width;
}
if (s->resize)
s->output_length = (s->input_length*s->output_width)/s->input_width;
else
{
s->output_width = s->input_width;
s->output_length = s->input_length;
}
switch (s->input_format)
{
case T4_IMAGE_TYPE_GRAY_8BIT:
s->input_bytes_per_pixel = 1;
break;
case T4_IMAGE_TYPE_GRAY_12BIT:
s->input_bytes_per_pixel = 2;
break;
case T4_IMAGE_TYPE_COLOUR_8BIT:
s->input_bytes_per_pixel = 3;
break;
case T4_IMAGE_TYPE_COLOUR_12BIT:
s->input_bytes_per_pixel = 6;
break;
default:
s->input_bytes_per_pixel = 1;
break;
}
switch (s->output_format)
{
case T4_IMAGE_TYPE_GRAY_8BIT:
s->output_bytes_per_pixel = 1;
break;
case T4_IMAGE_TYPE_GRAY_12BIT:
s->output_bytes_per_pixel = 2;
break;
case T4_IMAGE_TYPE_COLOUR_8BIT:
s->output_bytes_per_pixel = 3;
break;
case T4_IMAGE_TYPE_COLOUR_12BIT:
s->output_bytes_per_pixel = 6;
break;
default:
s->output_bytes_per_pixel = 1;
break;
}
/* Allocate the two row buffers we need, using the space requirements we now have */
raw_row_size = s->input_width*s->input_bytes_per_pixel;
@@ -736,30 +710,78 @@ SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_sta
{
for (i = 0; i < 2; i++)
{
if ((s->raw_pixel_row[i] = (uint8_t *) malloc(raw_row_size)) == NULL)
return NULL;
if (s->raw_pixel_row[i] == NULL)
{
if ((s->raw_pixel_row[i] = (uint8_t *) span_alloc(raw_row_size)) == NULL)
return -1;
}
memset(s->raw_pixel_row[i], 0, raw_row_size);
}
}
if (s->output_format == T4_IMAGE_TYPE_BILEVEL)
switch (s->output_format)
{
case T4_IMAGE_TYPE_BILEVEL:
case T4_IMAGE_TYPE_COLOUR_BILEVEL:
case T4_IMAGE_TYPE_4COLOUR_BILEVEL:
if (s->resize)
raw_row_size = row_size;
for (i = 0; i < 2; i++)
{
if ((s->pixel_row[i] = (uint8_t *) malloc(raw_row_size)) == NULL)
return NULL;
if (s->pixel_row[i] == NULL)
{
if ((s->pixel_row[i] = (uint8_t *) span_alloc(raw_row_size)) == NULL)
return -1;
}
memset(s->pixel_row[i], 0, raw_row_size);
}
break;
}
s->row_read_handler = row_read_handler;
s->row_read_user_data = row_read_user_data;
s->raw_input_row = 0;
s->raw_output_row = 0;
s->output_row = 0;
return 0;
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_state_t *s,
int output_format,
int output_width,
int output_length,
int input_format,
int input_width,
int input_length,
t4_row_read_handler_t row_read_handler,
void *row_read_user_data)
{
if (s == NULL)
{
if ((s = (image_translate_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
s->row_read_handler = row_read_handler;
s->row_read_user_data = row_read_user_data;
s->input_format = input_format;
s->input_width = input_width;
s->input_length = input_length;
s->input_bytes_per_pixel = image_format_to_bytes_per_pixel(s->input_format);
s->output_format = output_format;
s->output_bytes_per_pixel = image_format_to_bytes_per_pixel(s->output_format);
s->resize = (output_width > 0);
if (s->resize)
s->output_width = output_width;
else
s->output_width = s->input_width;
if (image_translate_restart(s, input_length))
return NULL;
return s;
}
/*- End of function --------------------------------------------------------*/
@@ -772,12 +794,12 @@ SPAN_DECLARE(int) image_translate_release(image_translate_state_t *s)
{
if (s->raw_pixel_row[i])
{
free(s->raw_pixel_row[i]);
span_free(s->raw_pixel_row[i]);
s->raw_pixel_row[i] = NULL;
}
if (s->pixel_row[i])
{
free(s->pixel_row[i]);
span_free(s->pixel_row[i]);
s->pixel_row[i] = NULL;
}
}
@@ -790,7 +812,7 @@ SPAN_DECLARE(int) image_translate_free(image_translate_state_t *s)
int res;
res = image_translate_release(s);
free(s);
span_free(s);
return res;
}
/*- End of function --------------------------------------------------------*/
+8
View File
@@ -157,6 +157,7 @@
<ItemGroup>
<ClCompile Include="ademco_contactid.c" />
<ClCompile Include="adsi.c" />
<ClCompile Include="alloc.c" />
<ClCompile Include="async.c" />
<ClCompile Include="at_interpreter.c" />
<ClCompile Include="awgn.c" />
@@ -210,6 +211,7 @@
<ClCompile Include="super_tone_tx.c" />
<ClCompile Include="swept_tone.c" />
<ClCompile Include="t42.c" />
<ClCompile Include="t43.c" />
<ClCompile Include="t4_rx.c" />
<ClCompile Include="t4_t6_decode.c" />
<ClCompile Include="t4_t6_encode.c" />
@@ -293,6 +295,7 @@
<ClInclude Include="spandsp\private\ademco_contactid.h" />
<ClInclude Include="spandsp\private\image_translate.h" />
<ClInclude Include="spandsp\private\t42.h" />
<ClInclude Include="spandsp\private\t43.h" />
<ClInclude Include="spandsp\private\t81_t82_arith_coding.h" />
<ClInclude Include="spandsp\private\t85.h" />
<ClInclude Include="spandsp\queue.h" />
@@ -304,6 +307,7 @@
<ClInclude Include="spandsp\super_tone_tx.h" />
<ClInclude Include="spandsp\swept_tone.h" />
<ClInclude Include="spandsp\t42.h" />
<ClInclude Include="spandsp\t43.h" />
<ClInclude Include="spandsp\t4_rx.h" />
<ClInclude Include="spandsp\t4_tx.h" />
<ClInclude Include="spandsp\t4_t6_decode.h" />
@@ -437,6 +441,10 @@
<Project>{329a6fa0-0fcc-4435-a950-e670aefa9838}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="msvc\make_t43_gray_code_tables.2010.vcxproj">
<Project>{eddb8ab9-c53e-44c0-a620-0e86c2cbd5d5}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
@@ -283,6 +283,12 @@
<ClCompile Include="math_fixed.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="alloc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="t43.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="spandsp\adsi.h">
@@ -722,6 +728,12 @@
<ClInclude Include="spandsp\private\image_translate.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="spandsp\t43.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="spandsp\private\t43.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="msvc\spandsp.h" />
+318
View File
@@ -0,0 +1,318 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_at_dictionary", "msvc\make_at_dictionary.2012.vcxproj", "{DEE932AB-5911-4700-9EEB-8C7090A0A330}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_modem_filter", "msvc\make_modem_filter.2012.vcxproj", "{329A6FA0-0FCC-4435-A950-E670AEFA9838}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_t43_gray_code_tables", "msvc\make_t43_gray_code_tables.2012.vcxproj", "{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_cielab_luts", "msvc\make_cielab_luts.2012.vcxproj", "{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_math_fixed_tables", "msvc\make_math_fixed_tables.2012.vcxproj", "{2386B892-35F5-46CF-A0F0-10394D2FBF9B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp", "libspandsp.2012.vcxproj", "{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}"
ProjectSection(ProjectDependencies) = postProject
{329A6FA0-0FCC-4435-A950-E670AEFA9838} = {329A6FA0-0FCC-4435-A950-E670AEFA9838}
{DEE932AB-5911-4700-9EEB-8C7090A0A330} = {DEE932AB-5911-4700-9EEB-8C7090A0A330}
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014} = {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_line_models", "..\spandsp-sim\msvc\make_line_models.2012.vcxproj", "{F290BADE-82DE-4037-B49D-D563E43169DA}"
ProjectSection(ProjectDependencies) = postProject
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspandsp_sim", "..\spandsp-sim\libspandsp_sim.2012.vcxproj", "{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}"
ProjectSection(ProjectDependencies) = postProject
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "download libjpeg", "msvc\download_libjpeg.2012.vcxproj", "{652AD5F7-8488-489F-AAD0-7FBE064703B6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "download libtiff", "msvc\download_libtiff.2012.vcxproj", "{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg", "msvc\libjpeg.2012.vcxproj", "{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}"
ProjectSection(ProjectDependencies) = postProject
{652AD5F7-8488-489F-AAD0-7FBE064703B6} = {652AD5F7-8488-489F-AAD0-7FBE064703B6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "msvc\libtiff.2012.vcxproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}"
ProjectSection(ProjectDependencies) = postProject
{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1} = {019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}
{652AD5F7-8488-489F-AAD0-7FBE064703B6} = {652AD5F7-8488-489F-AAD0-7FBE064703B6}
{2B8A45C9-FEB4-4734-AB37-8DB9DB899917} = {2B8A45C9-FEB4-4734-AB37-8DB9DB899917}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "t38_core_tests", "..\tests\msvc\t38_core_tests.2012.vcxproj", "{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "t38_non_ecm_buffer_tests", "..\tests\msvc\t38_non_ecm_buffer_tests.2012.vcxproj", "{80A3D9D9-3846-4DA5-8676-F940D725EA62}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vector_int_tests", "..\tests\msvc\vector_int_tests.2012.vcxproj", "{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vector_float_tests", "..\tests\msvc\vector_float_tests.2012.vcxproj", "{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "complex_tests", "..\tests\msvc\complex_tests.2012.vcxproj", "{A349379F-0FEA-49C8-9535-05F39663337B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "complex_vector_float_tests", "..\tests\msvc\complex_vector_float_tests.2012.vcxproj", "{2B0D705C-1CF2-401C-BFBC-A43FB806908C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "complex_vector_int_tests", "..\tests\msvc\complex_vector_int_tests.2012.vcxproj", "{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "queue_tests", "..\tests\msvc\queue_tests.2012.vcxproj", "{D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dtmf_tx_tests", "..\tests\msvc\dtmf_tx_tests.2012.vcxproj", "{1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dtmf_rx_tests", "..\tests\msvc\dtmf_rx_tests.2012.vcxproj", "{24E7EF80-7854-4A21-80FB-31C4E71109DE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "v29_tests", "..\tests\msvc\v29_tests.2012.vcxproj", "{323BD962-4581-4561-8105-8C166A9FA933}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "v80_tests", "..\tests\msvc\v80_tests.2012.vcxproj", "{10263F04-37DD-4E4A-AE4F-0641B018B714}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "v22bis_tests", "..\tests\msvc\v22bis_tests.2012.vcxproj", "{DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "v8_tests", "..\tests\msvc\v8_tests.2012.vcxproj", "{0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C84E437E-9D4C-46C8-9724-DF301C849E61}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Win32 = All|Win32
All|x64 = All|x64
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32
{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32
{DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x64.ActiveCfg = All|Win32
{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.ActiveCfg = All|Win32
{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.Build.0 = All|Win32
{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64.ActiveCfg = All|Win32
{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.ActiveCfg = All|Win32
{DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64.ActiveCfg = All|Win32
{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.ActiveCfg = All|Win32
{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.Build.0 = All|Win32
{329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x64.ActiveCfg = All|Win32
{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.ActiveCfg = All|Win32
{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.Build.0 = All|Win32
{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64.ActiveCfg = All|Win32
{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.ActiveCfg = All|Win32
{329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64.ActiveCfg = All|Win32
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.ActiveCfg = Release|x64
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.ActiveCfg = Release|x64
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.Build.0 = Release|x64
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.ActiveCfg = Debug|Win32
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.Build.0 = Debug|Win32
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.ActiveCfg = Debug|x64
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.Build.0 = Debug|x64
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.ActiveCfg = Release|Win32
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.ActiveCfg = Release|x64
{1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.Build.0 = Release|x64
{F290BADE-82DE-4037-B49D-D563E43169DA}.All|Win32.ActiveCfg = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.All|Win32.Build.0 = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.All|x64.ActiveCfg = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|Win32.ActiveCfg = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|Win32.Build.0 = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.Debug|x64.ActiveCfg = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.Release|Win32.ActiveCfg = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.Release|Win32.Build.0 = All|Win32
{F290BADE-82DE-4037-B49D-D563E43169DA}.Release|x64.ActiveCfg = All|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|Win32.ActiveCfg = Release|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|Win32.Build.0 = Release|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.All|x64.ActiveCfg = Release|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|Win32.ActiveCfg = Debug|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|Win32.Build.0 = Debug|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Debug|x64.ActiveCfg = Debug|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|Win32.ActiveCfg = Release|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|Win32.Build.0 = Release|Win32
{502F1E51-F0A0-4607-AB7F-05BAB530AAE1}.Release|x64.ActiveCfg = Release|Win32
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|x64
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.ActiveCfg = Release|x64
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.Build.0 = Release|x64
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.ActiveCfg = Debug|Win32
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.Build.0 = Debug|Win32
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.ActiveCfg = Debug|x64
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.Build.0 = Debug|x64
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.ActiveCfg = Release|Win32
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.Build.0 = Release|Win32
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.ActiveCfg = Release|x64
{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.Build.0 = Release|x64
{652AD5F7-8488-489F-AAD0-7FBE064703B6}.All|Win32.ActiveCfg = All|Win32
{652AD5F7-8488-489F-AAD0-7FBE064703B6}.All|Win32.Build.0 = All|Win32
{652AD5F7-8488-489F-AAD0-7FBE064703B6}.All|x64.ActiveCfg = All|Win32
{652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|Win32.ActiveCfg = All|Win32
{652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|Win32.Build.0 = All|Win32
{652AD5F7-8488-489F-AAD0-7FBE064703B6}.Debug|x64.ActiveCfg = All|Win32
{652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|Win32.ActiveCfg = All|Win32
{652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|Win32.Build.0 = All|Win32
{652AD5F7-8488-489F-AAD0-7FBE064703B6}.Release|x64.ActiveCfg = All|Win32
{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.ActiveCfg = All|Win32
{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|Win32.Build.0 = All|Win32
{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.All|x64.ActiveCfg = All|Win32
{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.ActiveCfg = All|Win32
{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|Win32.Build.0 = All|Win32
{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Debug|x64.ActiveCfg = All|Win32
{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.ActiveCfg = All|Win32
{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|Win32.Build.0 = All|Win32
{2B8A45C9-FEB4-4734-AB37-8DB9DB899917}.Release|x64.ActiveCfg = All|Win32
{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.All|Win32.ActiveCfg = Release|Win32
{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.All|Win32.Build.0 = Release|Win32
{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.All|x64.ActiveCfg = Release|Win32
{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Debug|Win32.ActiveCfg = Debug|Win32
{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Debug|Win32.Build.0 = Debug|Win32
{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Debug|x64.ActiveCfg = Debug|Win32
{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Release|Win32.ActiveCfg = Release|Win32
{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Release|Win32.Build.0 = Release|Win32
{A34A9D0E-A7E2-4A04-B044-7BB2FE709EF3}.Release|x64.ActiveCfg = Release|Win32
{80A3D9D9-3846-4DA5-8676-F940D725EA62}.All|Win32.ActiveCfg = Release|Win32
{80A3D9D9-3846-4DA5-8676-F940D725EA62}.All|Win32.Build.0 = Release|Win32
{80A3D9D9-3846-4DA5-8676-F940D725EA62}.All|x64.ActiveCfg = Release|Win32
{80A3D9D9-3846-4DA5-8676-F940D725EA62}.Debug|Win32.ActiveCfg = Debug|Win32
{80A3D9D9-3846-4DA5-8676-F940D725EA62}.Debug|Win32.Build.0 = Debug|Win32
{80A3D9D9-3846-4DA5-8676-F940D725EA62}.Debug|x64.ActiveCfg = Debug|Win32
{80A3D9D9-3846-4DA5-8676-F940D725EA62}.Release|Win32.ActiveCfg = Release|Win32
{80A3D9D9-3846-4DA5-8676-F940D725EA62}.Release|Win32.Build.0 = Release|Win32
{80A3D9D9-3846-4DA5-8676-F940D725EA62}.Release|x64.ActiveCfg = Release|Win32
{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.All|Win32.ActiveCfg = Release|Win32
{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.All|Win32.Build.0 = Release|Win32
{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.All|x64.ActiveCfg = Release|Win32
{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Debug|Win32.ActiveCfg = Debug|Win32
{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Debug|Win32.Build.0 = Debug|Win32
{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Debug|x64.ActiveCfg = Debug|Win32
{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Release|Win32.ActiveCfg = Release|Win32
{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Release|Win32.Build.0 = Release|Win32
{80A60464-29E8-4EE8-BAFA-8708B7C08CC3}.Release|x64.ActiveCfg = Release|Win32
{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.All|Win32.ActiveCfg = Release|Win32
{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.All|Win32.Build.0 = Release|Win32
{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.All|x64.ActiveCfg = Release|Win32
{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Debug|Win32.ActiveCfg = Debug|Win32
{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Debug|Win32.Build.0 = Debug|Win32
{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Debug|x64.ActiveCfg = Debug|Win32
{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Release|Win32.ActiveCfg = Release|Win32
{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Release|Win32.Build.0 = Release|Win32
{EA745FF7-9E4B-4C13-BA19-2EE8165A6245}.Release|x64.ActiveCfg = Release|Win32
{A349379F-0FEA-49C8-9535-05F39663337B}.All|Win32.ActiveCfg = Release|Win32
{A349379F-0FEA-49C8-9535-05F39663337B}.All|Win32.Build.0 = Release|Win32
{A349379F-0FEA-49C8-9535-05F39663337B}.All|x64.ActiveCfg = Release|Win32
{A349379F-0FEA-49C8-9535-05F39663337B}.Debug|Win32.ActiveCfg = Debug|Win32
{A349379F-0FEA-49C8-9535-05F39663337B}.Debug|Win32.Build.0 = Debug|Win32
{A349379F-0FEA-49C8-9535-05F39663337B}.Debug|x64.ActiveCfg = Debug|Win32
{A349379F-0FEA-49C8-9535-05F39663337B}.Release|Win32.ActiveCfg = Release|Win32
{A349379F-0FEA-49C8-9535-05F39663337B}.Release|Win32.Build.0 = Release|Win32
{A349379F-0FEA-49C8-9535-05F39663337B}.Release|x64.ActiveCfg = Release|Win32
{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.All|Win32.ActiveCfg = Release|Win32
{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.All|Win32.Build.0 = Release|Win32
{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.All|x64.ActiveCfg = Release|Win32
{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Debug|Win32.ActiveCfg = Debug|Win32
{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Debug|Win32.Build.0 = Debug|Win32
{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Debug|x64.ActiveCfg = Debug|Win32
{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Release|Win32.ActiveCfg = Release|Win32
{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Release|Win32.Build.0 = Release|Win32
{2B0D705C-1CF2-401C-BFBC-A43FB806908C}.Release|x64.ActiveCfg = Release|Win32
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.All|Win32.ActiveCfg = Release|Win32
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.All|Win32.Build.0 = Release|Win32
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.All|x64.ActiveCfg = Release|Win32
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Debug|Win32.ActiveCfg = Debug|Win32
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Debug|Win32.Build.0 = Debug|Win32
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Debug|x64.ActiveCfg = Debug|Win32
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|Win32.ActiveCfg = Release|Win32
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|Win32.Build.0 = Release|Win32
{C2E8B4D1-A398-4D57-94F8-B61F20C7D514}.Release|x64.ActiveCfg = Release|Win32
{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.All|Win32.ActiveCfg = All|Win32
{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.All|Win32.Build.0 = All|Win32
{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.All|x64.ActiveCfg = All|Win32
{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Debug|Win32.ActiveCfg = All|Win32
{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Debug|Win32.Build.0 = All|Win32
{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Debug|x64.ActiveCfg = All|Win32
{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Release|Win32.ActiveCfg = All|Win32
{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Release|Win32.Build.0 = All|Win32
{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Release|x64.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|Win32.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.All|x64.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|Win32.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Debug|x64.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.ActiveCfg = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.Build.0 = All|Win32
{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.ActiveCfg = All|Win32
{2386B892-35F5-46CF-A0F0-10394D2FBF9B}.All|Win32.ActiveCfg = All|Win32
{2386B892-35F5-46CF-A0F0-10394D2FBF9B}.All|Win32.Build.0 = All|Win32
{2386B892-35F5-46CF-A0F0-10394D2FBF9B}.All|x64.ActiveCfg = All|Win32
{2386B892-35F5-46CF-A0F0-10394D2FBF9B}.Debug|Win32.ActiveCfg = All|Win32
{2386B892-35F5-46CF-A0F0-10394D2FBF9B}.Debug|Win32.Build.0 = All|Win32
{2386B892-35F5-46CF-A0F0-10394D2FBF9B}.Debug|x64.ActiveCfg = All|Win32
{2386B892-35F5-46CF-A0F0-10394D2FBF9B}.Release|Win32.ActiveCfg = All|Win32
{2386B892-35F5-46CF-A0F0-10394D2FBF9B}.Release|Win32.Build.0 = All|Win32
{2386B892-35F5-46CF-A0F0-10394D2FBF9B}.Release|x64.ActiveCfg = All|Win32
{D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.All|Win32.ActiveCfg = Release|Win32
{D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.All|Win32.Build.0 = Release|Win32
{D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.All|x64.ActiveCfg = Release|Win32
{D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.Debug|Win32.ActiveCfg = Debug|Win32
{D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.Debug|Win32.Build.0 = Debug|Win32
{D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.Debug|x64.ActiveCfg = Debug|Win32
{D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.Release|Win32.ActiveCfg = Release|Win32
{D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.Release|Win32.Build.0 = Release|Win32
{D9C0F575-83E7-4C15-BF71-D7A0D44A26BF}.Release|x64.ActiveCfg = Release|Win32
{1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.All|Win32.ActiveCfg = Release|Win32
{1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.All|Win32.Build.0 = Release|Win32
{1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.All|x64.ActiveCfg = Release|Win32
{1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.Debug|Win32.ActiveCfg = Debug|Win32
{1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.Debug|Win32.Build.0 = Debug|Win32
{1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.Debug|x64.ActiveCfg = Debug|Win32
{1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.Release|Win32.ActiveCfg = Release|Win32
{1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.Release|Win32.Build.0 = Release|Win32
{1577F41D-9A06-45DD-87D4-9ADCC9CCDAD5}.Release|x64.ActiveCfg = Release|Win32
{24E7EF80-7854-4A21-80FB-31C4E71109DE}.All|Win32.ActiveCfg = Release|Win32
{24E7EF80-7854-4A21-80FB-31C4E71109DE}.All|Win32.Build.0 = Release|Win32
{24E7EF80-7854-4A21-80FB-31C4E71109DE}.All|x64.ActiveCfg = Release|Win32
{24E7EF80-7854-4A21-80FB-31C4E71109DE}.Debug|Win32.ActiveCfg = Debug|Win32
{24E7EF80-7854-4A21-80FB-31C4E71109DE}.Debug|Win32.Build.0 = Debug|Win32
{24E7EF80-7854-4A21-80FB-31C4E71109DE}.Debug|x64.ActiveCfg = Debug|Win32
{24E7EF80-7854-4A21-80FB-31C4E71109DE}.Release|Win32.ActiveCfg = Release|Win32
{24E7EF80-7854-4A21-80FB-31C4E71109DE}.Release|Win32.Build.0 = Release|Win32
{24E7EF80-7854-4A21-80FB-31C4E71109DE}.Release|x64.ActiveCfg = Release|Win32
{323BD962-4581-4561-8105-8C166A9FA933}.All|Win32.ActiveCfg = Release|Win32
{323BD962-4581-4561-8105-8C166A9FA933}.All|Win32.Build.0 = Release|Win32
{323BD962-4581-4561-8105-8C166A9FA933}.All|x64.ActiveCfg = Release|Win32
{323BD962-4581-4561-8105-8C166A9FA933}.Debug|Win32.ActiveCfg = Debug|Win32
{323BD962-4581-4561-8105-8C166A9FA933}.Debug|Win32.Build.0 = Debug|Win32
{323BD962-4581-4561-8105-8C166A9FA933}.Debug|x64.ActiveCfg = Debug|Win32
{323BD962-4581-4561-8105-8C166A9FA933}.Release|Win32.ActiveCfg = Release|Win32
{323BD962-4581-4561-8105-8C166A9FA933}.Release|Win32.Build.0 = Release|Win32
{323BD962-4581-4561-8105-8C166A9FA933}.Release|x64.ActiveCfg = Release|Win32
{10263F04-37DD-4E4A-AE4F-0641B018B714}.All|Win32.ActiveCfg = Release|Win32
{10263F04-37DD-4E4A-AE4F-0641B018B714}.All|Win32.Build.0 = Release|Win32
{10263F04-37DD-4E4A-AE4F-0641B018B714}.All|x64.ActiveCfg = Release|Win32
{10263F04-37DD-4E4A-AE4F-0641B018B714}.Debug|Win32.ActiveCfg = Debug|Win32
{10263F04-37DD-4E4A-AE4F-0641B018B714}.Debug|Win32.Build.0 = Debug|Win32
{10263F04-37DD-4E4A-AE4F-0641B018B714}.Debug|x64.ActiveCfg = Debug|Win32
{10263F04-37DD-4E4A-AE4F-0641B018B714}.Release|Win32.ActiveCfg = Release|Win32
{10263F04-37DD-4E4A-AE4F-0641B018B714}.Release|Win32.Build.0 = Release|Win32
{10263F04-37DD-4E4A-AE4F-0641B018B714}.Release|x64.ActiveCfg = Release|Win32
{DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.All|Win32.ActiveCfg = Release|Win32
{DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.All|Win32.Build.0 = Release|Win32
{DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.All|x64.ActiveCfg = Release|Win32
{DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.Debug|Win32.ActiveCfg = Debug|Win32
{DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.Debug|Win32.Build.0 = Debug|Win32
{DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.Debug|x64.ActiveCfg = Debug|Win32
{DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.Release|Win32.ActiveCfg = Release|Win32
{DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.Release|Win32.Build.0 = Release|Win32
{DA4DB99F-E5BA-48BD-BB6B-3595CE24CBAE}.Release|x64.ActiveCfg = Release|Win32
{0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.All|Win32.ActiveCfg = Release|Win32
{0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.All|Win32.Build.0 = Release|Win32
{0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.All|x64.ActiveCfg = Release|Win32
{0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.Debug|Win32.ActiveCfg = Debug|Win32
{0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.Debug|Win32.Build.0 = Debug|Win32
{0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.Debug|x64.ActiveCfg = Debug|Win32
{0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.Release|Win32.ActiveCfg = Release|Win32
{0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.Release|Win32.Build.0 = Release|Win32
{0C69B8C2-0CE1-4CD4-870C-1C13FB3F9B34}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+8
View File
@@ -161,6 +161,7 @@
<ItemGroup>
<ClCompile Include="ademco_contactid.c" />
<ClCompile Include="adsi.c" />
<ClCompile Include="alloc.c" />
<ClCompile Include="async.c" />
<ClCompile Include="at_interpreter.c" />
<ClCompile Include="awgn.c" />
@@ -214,6 +215,7 @@
<ClCompile Include="super_tone_tx.c" />
<ClCompile Include="swept_tone.c" />
<ClCompile Include="t42.c" />
<ClCompile Include="t43.c" />
<ClCompile Include="t4_rx.c" />
<ClCompile Include="t4_t6_decode.c" />
<ClCompile Include="t4_t6_encode.c" />
@@ -297,6 +299,7 @@
<ClInclude Include="spandsp\private\ademco_contactid.h" />
<ClInclude Include="spandsp\private\image_translate.h" />
<ClInclude Include="spandsp\private\t42.h" />
<ClInclude Include="spandsp\private\t43.h" />
<ClInclude Include="spandsp\private\t81_t82_arith_coding.h" />
<ClInclude Include="spandsp\private\t85.h" />
<ClInclude Include="spandsp\queue.h" />
@@ -308,6 +311,7 @@
<ClInclude Include="spandsp\super_tone_tx.h" />
<ClInclude Include="spandsp\swept_tone.h" />
<ClInclude Include="spandsp\t42.h" />
<ClInclude Include="spandsp\t43.h" />
<ClInclude Include="spandsp\t4_rx.h" />
<ClInclude Include="spandsp\t4_tx.h" />
<ClInclude Include="spandsp\t4_t6_decode.h" />
@@ -441,6 +445,10 @@
<Project>{329a6fa0-0fcc-4435-a950-e670aefa9838}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="msvc\make_t43_gray_code_tables.2012.vcxproj">
<Project>{eddb8ab9-c53e-44c0-a620-0e86c2cbd5d5}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
@@ -283,6 +283,12 @@
<ClCompile Include="math_fixed.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="alloc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="t43.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="spandsp\adsi.h">
@@ -690,8 +696,12 @@
<ClInclude Include="spandsp.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="spandsp\t4_t6_decode.h" />
<ClInclude Include="spandsp\t4_t6_encode.h" />
<ClInclude Include="spandsp\t4_t6_decode.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="spandsp\t4_t6_encode.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="spandsp\ademco_contactid.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -722,6 +732,12 @@
<ClInclude Include="spandsp\private\image_translate.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="spandsp\t43.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="spandsp\private\t43.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="msvc\spandsp.h" />
+11 -5
View File
@@ -40,8 +40,14 @@
#include <signal.h>
#include <sys/time.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/private/logging.h"
@@ -73,11 +79,11 @@ static void default_message_handler(void *user_data, int level, const char *text
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) span_log_test(logging_state_t *s, int level)
SPAN_DECLARE(bool) span_log_test(logging_state_t *s, int level)
{
if (s && (s->level & SPAN_LOG_SEVERITY_MASK) >= (level & SPAN_LOG_SEVERITY_MASK))
return TRUE;
return FALSE;
return true;
return false;
}
/*- End of function --------------------------------------------------------*/
@@ -229,7 +235,7 @@ SPAN_DECLARE(logging_state_t *) span_log_init(logging_state_t *s, int level, con
{
if (s == NULL)
{
if ((s = (logging_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (logging_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->span_message = __span_message;
@@ -252,7 +258,7 @@ SPAN_DECLARE(int) span_log_release(logging_state_t *s)
SPAN_DECLARE(int) span_log_free(logging_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+7 -2
View File
@@ -41,6 +41,11 @@
#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"
@@ -349,7 +354,7 @@ static void onset(lpc10_encode_state_t *s,
osbuf[*osptr - 1] = i - 9;
(*osptr)++;
}
s->hyst = TRUE;
s->hyst = true;
}
s->lasti = i;
/* After one onset detection, at least OSHYST sample times must go */
@@ -357,7 +362,7 @@ static void onset(lpc10_encode_state_t *s,
}
else if (s->hyst && i - s->lasti >= 10)
{
s->hyst = FALSE;
s->hyst = false;
}
}
}
+14 -8
View File
@@ -34,16 +34,22 @@
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <memory.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 <memory.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/lpc10.h"
#include "spandsp/private/lpc10.h"
@@ -279,7 +285,7 @@ static int pitsyn(lpc10_decode_state_t *s,
ipiti[i] = *pitch;
rmsi[i] = *rms;
}
s->first_pitsyn = FALSE;
s->first_pitsyn = false;
}
else
{
@@ -406,7 +412,7 @@ static int pitsyn(lpc10_decode_state_t *s,
/* NOUT | -- -- -- -- ?? ?? */
/* IVOICE | -- -- -- -- 0 0 */
/* UVPIT is always 0.0 on the first pass through the DO WHILE (TRUE)
/* UVPIT is always 0.0 on the first pass through the DO WHILE (true)
loop below. */
/* The only possible non-0 value of SLOPE (in column 111) is
@@ -857,7 +863,7 @@ static void decode(lpc10_decode_state_t *s,
/* Skip decoding on first frame because present data not yet available */
if (s->first)
{
s->first = FALSE;
s->first = false;
/* Assign PITCH a "default" value on the first call, since */
/* otherwise it would be left uninitialized. The two lines */
/* below were copied from above, since it seemed like a */
@@ -1016,7 +1022,7 @@ SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *s,
if (s == NULL)
{
if ((s = (lpc10_decode_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (lpc10_decode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
@@ -1024,7 +1030,7 @@ SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *s,
/* State used by function decode */
s->iptold = 60;
s->first = TRUE;
s->first = true;
s->ivp2h = 0;
s->iovoic = 0;
s->iavgp = 60;
@@ -1044,7 +1050,7 @@ SPAN_DECLARE(lpc10_decode_state_t *) lpc10_decode_init(lpc10_decode_state_t *s,
/* State used by function pitsyn */
s->rmso = 1.0f;
s->first_pitsyn = TRUE;
s->first_pitsyn = true;
/* State used by function bsynz */
s->ipo = 0;
@@ -1084,7 +1090,7 @@ SPAN_DECLARE(int) lpc10_decode_release(lpc10_decode_state_t *s)
SPAN_DECLARE(int) lpc10_decode_free(lpc10_decode_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+9 -3
View File
@@ -41,9 +41,15 @@
#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/lpc10.h"
#include "spandsp/private/lpc10.h"
@@ -269,7 +275,7 @@ SPAN_DECLARE(lpc10_encode_state_t *) lpc10_encode_init(lpc10_encode_state_t *s,
if (s == NULL)
{
if ((s = (lpc10_encode_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (lpc10_encode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
@@ -321,7 +327,7 @@ SPAN_DECLARE(lpc10_encode_state_t *) lpc10_encode_init(lpc10_encode_state_t *s,
s->l2sum1 = 0.0f;
s->l2ptr1 = 1;
s->l2ptr2 = 9;
s->hyst = FALSE;
s->hyst = false;
/* State used by function lpc10_voicing */
s->dither = 20.0f;
@@ -367,7 +373,7 @@ SPAN_DECLARE(int) lpc10_encode_release(lpc10_encode_state_t *s)
SPAN_DECLARE(int) lpc10_encode_free(lpc10_encode_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+11 -6
View File
@@ -41,6 +41,11 @@
#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"
@@ -67,7 +72,7 @@ void lpc10_placea(int32_t *ipitch,
int32_t k;
int32_t l;
int32_t hrange;
int ephase;
bool ephase;
int32_t lrange;
lrange = (af - 2)*lframe + 1;
@@ -148,14 +153,14 @@ void lpc10_placea(int32_t *ipitch,
awin[af - 1][1] += *ipitch;
}
/* Make energy window be phase-synchronous. */
ephase = TRUE;
ephase = true;
}
else
{
/* Case 3 */
awin[af - 1][0] = vwin[af - 1][0];
awin[af - 1][1] = vwin[af - 1][1];
ephase = FALSE;
ephase = false;
}
/* RMS is computed over an integer number of pitch periods in the analysis
window. When it is not placed phase-synchronously, it is placed as close
@@ -193,7 +198,7 @@ void lpc10_placev(int32_t *osbuf,
{
int32_t i1;
int32_t i2;
int crit;
bool crit;
int32_t q;
int32_t osptr1;
int32_t hrange;
@@ -286,12 +291,12 @@ void lpc10_placev(int32_t *osbuf,
q++;
/* Check for case 2 (placement before onset): */
/* Check for critical region exception: */
crit = FALSE;
crit = false;
for (i = q + 1; i < osptr1; i++)
{
if (osbuf[i - 1] - osbuf[q - 1] >= minwin)
{
crit = TRUE;
crit = true;
break;
}
}
+5
View File
@@ -41,6 +41,11 @@
#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"
-4
View File
@@ -24,10 +24,6 @@
* 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>
+1 -10
View File
@@ -25,22 +25,13 @@
/*! \file */
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <memory.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
typedef struct
{
@@ -81,7 +72,7 @@ int main(int argc, char *argv[])
r = floorf(r*256.0f);
srgb = (r < 0) ? 0 : (r <= 255) ? r : 255;
srgb = (uint8_t) ((r < 0) ? 0 : (r <= 255) ? r : 255);
printf((i < 4095) ? " %d,\n" : " %d\n", srgb);
}
+7 -9
View File
@@ -24,10 +24,6 @@
* 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>
@@ -46,7 +42,7 @@ int main(int argc, char *argv[])
for (i = 0; i < 129; i++)
{
val = 32768.0*128.0/(128 + i) + 0.5;
ival = val;
ival = (int) val;
if (i < 128)
printf(" %6d,\n", ival);
else
@@ -58,7 +54,7 @@ int main(int argc, char *argv[])
printf("{\n");
for (i = 64; i <= 256; i++)
{
ival = sqrt(i/256.0)*65536.0 + 0.5;
ival = (int) (sqrt(i/256.0)*65536.0 + 0.5);
if (ival > 65535)
ival = 65535;
if (i < 256)
@@ -72,7 +68,7 @@ int main(int argc, char *argv[])
printf("{\n");
for (i = 128; i <= 256; i++)
{
ival = log10(i/256.0)*32768.0 - 0.5;
ival = (int) (log10(i/256.0)*32768.0 - 0.5);
if (i <= 255)
printf(" %6d,\n", ival);
else
@@ -85,7 +81,7 @@ int main(int argc, char *argv[])
for (i = 0; i <= 256; i++)
{
val = sin(i*3.1415926535/512.0)*32768.0;
ival = val + 0.5;
ival = (int) (val + 0.5);
if (ival > 32767)
ival = 32767;
if (i <= 255)
@@ -100,7 +96,7 @@ int main(int argc, char *argv[])
for (i = 0; i <= 256; i++)
{
val = atan(i/256.0)*65536.0/(2.0*3.1415926535);
ival = val + 0.5;
ival = (int) (val + 0.5);
/* Nudge the result away from zero, so things sit consistently on
the correct side of the axes. */
if (ival == 0)
@@ -114,3 +110,5 @@ int main(int argc, char *argv[])
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
+15 -23
View File
@@ -24,39 +24,31 @@
* 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 <unistd.h>
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#include "floating_fudge.h"
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <fcntl.h>
#include <math.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#if defined(__sunos) || defined(__solaris) || defined(__sun)
#include <getopt.h>
#endif
#if defined (_MSC_VER)
#define __inline__ __inline
#endif
#include "spandsp/telephony.h"
#include "spandsp/complex.h"
#include "filter_tools.h"
#if !defined(FALSE)
#define FALSE 0
#endif
#if !defined(TRUE)
#define TRUE (!FALSE)
#endif
//#define SAMPLE_RATE 8000.0
#define MAX_COEFFS_PER_FILTER 128
#define MAX_COEFF_SETS 384
@@ -84,7 +76,7 @@ static void make_tx_filter(int coeff_sets,
alpha = baud_rate/(2.0*(double) (coeff_sets*baud_rate));
beta = excess_bandwidth;
compute_raised_cosine_filter(coeffs, total_coeffs, TRUE, FALSE, alpha, beta);
compute_raised_cosine_filter(coeffs, total_coeffs, true, false, alpha, beta);
/* Find the DC gain of the filter, and adjust the filter to unity gain. */
floating_gain = 0.0;
@@ -180,7 +172,7 @@ static void make_rx_filter(int coeff_sets,
beta = excess_bandwidth;
carrier *= 2.0*3.1415926535/SAMPLE_RATE;
compute_raised_cosine_filter(coeffs, total_coeffs, TRUE, FALSE, alpha, beta);
compute_raised_cosine_filter(coeffs, total_coeffs, true, false, alpha, beta);
/* Find the DC gain of the filter, and adjust the filter to unity gain. */
floating_gain = 0.0;
@@ -284,7 +276,7 @@ int main(int argc, char **argv)
const char *tx_tag;
const char *modem;
transmit_modem = FALSE;
transmit_modem = false;
modem = "";
while ((opt = getopt(argc, argv, "m:rt")) != -1)
{
@@ -294,10 +286,10 @@ int main(int argc, char **argv)
modem = optarg;
break;
case 'r':
transmit_modem = FALSE;
transmit_modem = false;
break;
case 't':
transmit_modem = TRUE;
transmit_modem = true;
break;
default:
usage();
@@ -0,0 +1,101 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* make_t43_gray_code_tables.c - Generate the Gray code tables for T.43 image
* compression.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2012 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.
*/
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <memory.h>
#include <math.h>
int main(int argc, char *argv[])
{
int i;
int j;
int gray;
int new_gray;
int restore;
printf("static const int16_t gray_code[4096] =\n{\n");
for (i = 0; i < 4096; i++)
{
gray = i & 0x800;
restore = i;
for (j = 10; j >= 0; j--)
{
if (((i >> (j + 1)) & 1) ^ ((i >> j) & 1))
gray |= (1 << j);
}
printf(" 0x%04x, /* 0x%04x */\n", gray, restore);
/* Now reverse the process and check we get back where we start */
restore = gray & 0x800;
for (j = 10; j >= 0; j--)
{
if (((restore >> (j + 1)) & 1) ^ ((gray >> j) & 1))
restore |= (1 << j);
}
if (i != restore)
{
printf("Ah\n");
exit(2);
}
}
printf("};\n\n");
printf("static const int16_t anti_gray_code[4096] =\n{\n");
for (i = 0; i < 4096; i++)
{
gray = i;
restore = gray & 0x800;
for (j = 10; j >= 0; j--)
{
if (((restore >> (j + 1)) & 1) ^ ((gray >> j) & 1))
restore |= (1 << j);
}
printf(" 0x%04x, /* 0x%04x */\n", restore, gray);
/* Now reverse the process and check we get back where we start */
new_gray = restore & 0x800;
for (j = 10; j >= 0; j--)
{
if (((restore >> (j + 1)) & 1) ^ ((restore >> j) & 1))
new_gray |= (1 << j);
}
if (gray != new_gray)
{
printf("Ah\n");
exit(2);
}
}
printf("};\n");
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
+22 -15
View File
@@ -53,10 +53,16 @@
#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 <stdio.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/logging.h"
#include "spandsp/complex.h"
@@ -69,6 +75,7 @@
#include "spandsp/fsk.h"
#include "spandsp/modem_connect_tones.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/fsk.h"
#include "spandsp/private/modem_connect_tones.h"
@@ -255,12 +262,12 @@ SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem
{
int alloced;
alloced = FALSE;
alloced = false;
if (s == NULL)
{
if ((s = (modem_connect_tones_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (modem_connect_tones_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
alloced = TRUE;
alloced = true;
}
s->tone_type = tone_type;
switch (s->tone_type)
@@ -341,7 +348,7 @@ SPAN_DECLARE(modem_connect_tones_tx_state_t *) modem_connect_tones_tx_init(modem
break;
default:
if (alloced)
free(s);
span_free(s);
return NULL;
}
return s;
@@ -356,7 +363,7 @@ SPAN_DECLARE(int) modem_connect_tones_tx_release(modem_connect_tones_tx_state_t
SPAN_DECLARE(int) modem_connect_tones_tx_free(modem_connect_tones_tx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -398,7 +405,7 @@ static void v21_put_bit(void *user_data, int bit)
s->raw_bit_stream = 0;
s->num_bits = 0;
s->flags_seen = 0;
s->framing_ok_announced = FALSE;
s->framing_ok_announced = false;
break;
}
return;
@@ -429,7 +436,7 @@ static void v21_put_bit(void *user_data, int bit)
if (++s->flags_seen >= HDLC_FRAMING_OK_THRESHOLD && !s->framing_ok_announced)
{
report_tone_state(s, MODEM_CONNECT_TONES_FAX_PREAMBLE, lfastrintf(fsk_rx_signal_power(&(s->v21rx))));
s->framing_ok_announced = TRUE;
s->framing_ok_announced = true;
}
}
}
@@ -441,7 +448,7 @@ static void v21_put_bit(void *user_data, int bit)
{
if (s->num_bits == 8)
{
s->framing_ok_announced = FALSE;
s->framing_ok_announced = false;
s->flags_seen = 0;
}
}
@@ -547,7 +554,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
report_tone_state(s, MODEM_CONNECT_TONES_NONE, -99);
s->tone_cycle_duration = 0;
s->good_cycles = 0;
s->tone_on = FALSE;
s->tone_on = false;
continue;
}
/* There is adequate energy in the channel. Is it mostly at 2100Hz? */
@@ -589,7 +596,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
s->tone_cycle_duration = ms_to_samples(450 + 100);
}
}
s->tone_on = TRUE;
s->tone_on = true;
}
else if (s->notch_level*5 > s->channel_level)
{
@@ -608,7 +615,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx(modem_connect_tones_rx_state_t *
s->good_cycles = 0;
}
}
s->tone_on = FALSE;
s->tone_on = false;
}
}
break;
@@ -716,7 +723,7 @@ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem
{
if (s == NULL)
{
if ((s = (modem_connect_tones_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (modem_connect_tones_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
@@ -742,7 +749,7 @@ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem
s->tone_cycle_duration = 0;
s->good_cycles = 0;
s->hit = MODEM_CONNECT_TONES_NONE;
s->tone_on = FALSE;
s->tone_on = false;
s->tone_callback = tone_callback;
s->callback_data = user_data;
s->znotch_1 = 0.0f;
@@ -751,7 +758,7 @@ SPAN_DECLARE(modem_connect_tones_rx_state_t *) modem_connect_tones_rx_init(modem
s->z15hz_2 = 0.0f;
s->num_bits = 0;
s->flags_seen = 0;
s->framing_ok_announced = FALSE;
s->framing_ok_announced = false;
s->raw_bit_stream = 0;
return s;
}
@@ -765,7 +772,7 @@ SPAN_DECLARE(int) modem_connect_tones_rx_release(modem_connect_tones_rx_state_t
SPAN_DECLARE(int) modem_connect_tones_rx_free(modem_connect_tones_rx_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+13 -12
View File
@@ -47,6 +47,7 @@
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/bit_operations.h"
#include "spandsp/dc_restore.h"
#include "spandsp/modem_echo.h"
@@ -56,9 +57,9 @@
SPAN_DECLARE(void) modem_echo_can_free(modem_echo_can_state_t *ec)
{
fir16_free(&ec->fir_state);
free(ec->fir_taps32);
free(ec->fir_taps16);
free(ec);
span_free(ec->fir_taps32);
span_free(ec->fir_taps16);
span_free(ec);
}
/*- End of function --------------------------------------------------------*/
@@ -66,29 +67,29 @@ SPAN_DECLARE(modem_echo_can_state_t *) modem_echo_can_init(int len)
{
modem_echo_can_state_t *ec;
if ((ec = (modem_echo_can_state_t *) malloc(sizeof(*ec))) == NULL)
if ((ec = (modem_echo_can_state_t *) span_alloc(sizeof(*ec))) == NULL)
return NULL;
memset(ec, 0, sizeof(*ec));
ec->taps = len;
ec->curr_pos = ec->taps - 1;
if ((ec->fir_taps32 = (int32_t *) malloc(ec->taps*sizeof(int32_t))) == NULL)
if ((ec->fir_taps32 = (int32_t *) span_alloc(ec->taps*sizeof(int32_t))) == NULL)
{
free(ec);
span_free(ec);
return NULL;
}
memset(ec->fir_taps32, 0, ec->taps*sizeof(int32_t));
if ((ec->fir_taps16 = (int16_t *) malloc(ec->taps*sizeof(int16_t))) == NULL)
if ((ec->fir_taps16 = (int16_t *) span_alloc(ec->taps*sizeof(int16_t))) == NULL)
{
free(ec->fir_taps32);
free(ec);
span_free(ec->fir_taps32);
span_free(ec);
return NULL;
}
memset(ec->fir_taps16, 0, ec->taps*sizeof(int16_t));
if (fir16_create(&ec->fir_state, ec->fir_taps16, ec->taps) == NULL)
{
free(ec->fir_taps16);
free(ec->fir_taps32);
free(ec);
span_free(ec->fir_taps16);
span_free(ec->fir_taps32);
span_free(ec);
return NULL;
}
return ec;
+2
View File
@@ -74,7 +74,9 @@
#define _MMX_H_
#if !((defined(WIN32) || defined(_WIN32)) && (_MSC_VER >= 1800))
#define cbrtf(value) pow((float)value, (float).333)
#endif
#include <malloc.h> // To get alloca
+176 -176
View File
@@ -1,177 +1,177 @@
/*****************************************************************************
*
* MODULE NAME : GETOPT.C
*
* COPYRIGHTS:
* This module contains code made available by IBM
* Corporation on an AS IS basis. Any one receiving the
* module is considered to be licensed under IBM copyrights
* to use the IBM-provided source code in any way he or she
* deems fit, including copying it, compiling it, modifying
* it, and redistributing it, with or without
* modifications. No license under any IBM patents or
* patent applications is to be implied from this copyright
* license.
*
* A user of the module should understand that IBM cannot
* provide technical support for the module and will not be
* responsible for any consequences of use of the program.
*
* Any notices, including this one, are not to be removed
* from the module without the prior written consent of
* IBM.
*
* AUTHOR: Original author:
* G. R. Blair (BOBBLAIR at AUSVM1)
* Internet: bobblair@bobblair.austin.ibm.com
*
* Extensively revised by:
* John Q. Walker II, Ph.D. (JOHHQ at RALVM6)
* Internet: johnq@ralvm6.vnet.ibm.com
*
*****************************************************************************/
/******************************************************************************
* getopt()
*
* The getopt() function is a command line parser. It returns the next
* option character in argv that matches an option character in opstring.
*
* The argv argument points to an array of argc+1 elements containing argc
* pointers to character strings followed by a null pointer.
*
* The opstring argument points to a string of option characters; if an
* option character is followed by a colon, the option is expected to have
* an argument that may or may not be separated from it by white space.
* The external variable optarg is set to point to the start of the option
* argument on return from getopt().
*
* The getopt() function places in optind the argv index of the next argument
* to be processed. The system initializes the external variable optind to
* 1 before the first call to getopt().
*
* When all options have been processed (that is, up to the first nonoption
* argument), getopt() returns EOF. The special option "--" may be used to
* delimit the end of the options; EOF will be returned, and "--" will be
* skipped.
*
* The getopt() function returns a question mark (?) when it encounters an
* option character not included in opstring. This error message can be
* disabled by setting opterr to zero. Otherwise, it returns the option
* character that was detected.
*
* If the special option "--" is detected, or all options have been
* processed, EOF is returned.
*
* Options are marked by either a minus sign (-) or a slash (/).
*
* No errors are defined.
*****************************************************************************/
#include <stdio.h> /* for EOF */
#include <string.h> /* for strchr() */
/* static (global) variables that are specified as exported by getopt() */
char *optarg = NULL; /* pointer to the start of the option argument */
int optind = 1; /* number of the next argv[] to be evaluated */
int opterr = 1; /* non-zero if a question mark should be returned
when a non-valid option character is detected */
/* handle possible future character set concerns by putting this in a macro */
#define _next_char(string) (char)(*(string+1))
int getopt(int argc, char *argv[], char *opstring)
{
static char *pIndexPosition = NULL; /* place inside current argv string */
char *pArgString = NULL; /* where to start from next */
char *pOptString; /* the string in our program */
if (pIndexPosition != NULL) {
/* we last left off inside an argv string */
if (*(++pIndexPosition)) {
/* there is more to come in the most recent argv */
pArgString = pIndexPosition;
}
}
if (pArgString == NULL) {
/* we didn't leave off in the middle of an argv string */
if (optind >= argc) {
/* more command-line arguments than the argument count */
pIndexPosition = NULL; /* not in the middle of anything */
return EOF; /* used up all command-line arguments */
}
/*---------------------------------------------------------------------
* If the next argv[] is not an option, there can be no more options.
*-------------------------------------------------------------------*/
pArgString = argv[optind++]; /* set this to the next argument ptr */
if (('/' != *pArgString) && /* doesn't start with a slash or a dash? */
('-' != *pArgString)) {
--optind; /* point to current arg once we're done */
optarg = NULL; /* no argument follows the option */
pIndexPosition = NULL; /* not in the middle of anything */
return EOF; /* used up all the command-line flags */
}
/* check for special end-of-flags markers */
if ((strcmp(pArgString, "-") == 0) ||
(strcmp(pArgString, "--") == 0)) {
optarg = NULL; /* no argument follows the option */
pIndexPosition = NULL; /* not in the middle of anything */
return EOF; /* encountered the special flag */
}
pArgString++; /* look past the / or - */
}
if (':' == *pArgString) { /* is it a colon? */
/*---------------------------------------------------------------------
* Rare case: if opterr is non-zero, return a question mark;
* otherwise, just return the colon we're on.
*-------------------------------------------------------------------*/
return (opterr ? (int)'?' : (int)':');
}
else if ((pOptString = strchr(opstring, *pArgString)) == 0) {
/*---------------------------------------------------------------------
* The letter on the command-line wasn't any good.
*-------------------------------------------------------------------*/
optarg = NULL; /* no argument follows the option */
pIndexPosition = NULL; /* not in the middle of anything */
return (opterr ? (int)'?' : (int)*pArgString);
}
else {
/*---------------------------------------------------------------------
* The letter on the command-line matches one we expect to see
*-------------------------------------------------------------------*/
if (':' == _next_char(pOptString)) { /* is the next letter a colon? */
/* It is a colon. Look for an argument string. */
if ('\0' != _next_char(pArgString)) { /* argument in this argv? */
optarg = &pArgString[1]; /* Yes, it is */
}
else {
/*-------------------------------------------------------------
* The argument string must be in the next argv.
* But, what if there is none (bad input from the user)?
* In that case, return the letter, and optarg as NULL.
*-----------------------------------------------------------*/
if (optind < argc)
optarg = argv[optind++];
else {
optarg = NULL;
return (opterr ? (int)'?' : (int)*pArgString);
}
}
pIndexPosition = NULL; /* not in the middle of anything */
}
else {
/* it's not a colon, so just return the letter */
optarg = NULL; /* no argument follows the option */
pIndexPosition = pArgString; /* point to the letter we're on */
}
return (int)*pArgString; /* return the letter that matched */
}
/*****************************************************************************
*
* MODULE NAME : GETOPT.C
*
* COPYRIGHTS:
* This module contains code made available by IBM
* Corporation on an AS IS basis. Any one receiving the
* module is considered to be licensed under IBM copyrights
* to use the IBM-provided source code in any way he or she
* deems fit, including copying it, compiling it, modifying
* it, and redistributing it, with or without
* modifications. No license under any IBM patents or
* patent applications is to be implied from this copyright
* license.
*
* A user of the module should understand that IBM cannot
* provide technical support for the module and will not be
* responsible for any consequences of use of the program.
*
* Any notices, including this one, are not to be removed
* from the module without the prior written consent of
* IBM.
*
* AUTHOR: Original author:
* G. R. Blair (BOBBLAIR at AUSVM1)
* Internet: bobblair@bobblair.austin.ibm.com
*
* Extensively revised by:
* John Q. Walker II, Ph.D. (JOHHQ at RALVM6)
* Internet: johnq@ralvm6.vnet.ibm.com
*
*****************************************************************************/
/******************************************************************************
* getopt()
*
* The getopt() function is a command line parser. It returns the next
* option character in argv that matches an option character in opstring.
*
* The argv argument points to an array of argc+1 elements containing argc
* pointers to character strings followed by a null pointer.
*
* The opstring argument points to a string of option characters; if an
* option character is followed by a colon, the option is expected to have
* an argument that may or may not be separated from it by white space.
* The external variable optarg is set to point to the start of the option
* argument on return from getopt().
*
* The getopt() function places in optind the argv index of the next argument
* to be processed. The system initializes the external variable optind to
* 1 before the first call to getopt().
*
* When all options have been processed (that is, up to the first nonoption
* argument), getopt() returns EOF. The special option "--" may be used to
* delimit the end of the options; EOF will be returned, and "--" will be
* skipped.
*
* The getopt() function returns a question mark (?) when it encounters an
* option character not included in opstring. This error message can be
* disabled by setting opterr to zero. Otherwise, it returns the option
* character that was detected.
*
* If the special option "--" is detected, or all options have been
* processed, EOF is returned.
*
* Options are marked by either a minus sign (-) or a slash (/).
*
* No errors are defined.
*****************************************************************************/
#include <stdio.h> /* for EOF */
#include <string.h> /* for strchr() */
/* static (global) variables that are specified as exported by getopt() */
char *optarg = NULL; /* pointer to the start of the option argument */
int optind = 1; /* number of the next argv[] to be evaluated */
int opterr = 1; /* non-zero if a question mark should be returned
when a non-valid option character is detected */
/* handle possible future character set concerns by putting this in a macro */
#define _next_char(string) (char)(*(string+1))
int getopt(int argc, char *argv[], char *opstring)
{
static char *pIndexPosition = NULL; /* place inside current argv string */
char *pArgString = NULL; /* where to start from next */
char *pOptString; /* the string in our program */
if (pIndexPosition != NULL) {
/* we last left off inside an argv string */
if (*(++pIndexPosition)) {
/* there is more to come in the most recent argv */
pArgString = pIndexPosition;
}
}
if (pArgString == NULL) {
/* we didn't leave off in the middle of an argv string */
if (optind >= argc) {
/* more command-line arguments than the argument count */
pIndexPosition = NULL; /* not in the middle of anything */
return EOF; /* used up all command-line arguments */
}
/*---------------------------------------------------------------------
* If the next argv[] is not an option, there can be no more options.
*-------------------------------------------------------------------*/
pArgString = argv[optind++]; /* set this to the next argument ptr */
if (('/' != *pArgString) && /* doesn't start with a slash or a dash? */
('-' != *pArgString)) {
--optind; /* point to current arg once we're done */
optarg = NULL; /* no argument follows the option */
pIndexPosition = NULL; /* not in the middle of anything */
return EOF; /* used up all the command-line flags */
}
/* check for special end-of-flags markers */
if ((strcmp(pArgString, "-") == 0) ||
(strcmp(pArgString, "--") == 0)) {
optarg = NULL; /* no argument follows the option */
pIndexPosition = NULL; /* not in the middle of anything */
return EOF; /* encountered the special flag */
}
pArgString++; /* look past the / or - */
}
if (':' == *pArgString) { /* is it a colon? */
/*---------------------------------------------------------------------
* Rare case: if opterr is non-zero, return a question mark;
* otherwise, just return the colon we're on.
*-------------------------------------------------------------------*/
return (opterr ? (int)'?' : (int)':');
}
else if ((pOptString = strchr(opstring, *pArgString)) == 0) {
/*---------------------------------------------------------------------
* The letter on the command-line wasn't any good.
*-------------------------------------------------------------------*/
optarg = NULL; /* no argument follows the option */
pIndexPosition = NULL; /* not in the middle of anything */
return (opterr ? (int)'?' : (int)*pArgString);
}
else {
/*---------------------------------------------------------------------
* The letter on the command-line matches one we expect to see
*-------------------------------------------------------------------*/
if (':' == _next_char(pOptString)) { /* is the next letter a colon? */
/* It is a colon. Look for an argument string. */
if ('\0' != _next_char(pArgString)) { /* argument in this argv? */
optarg = &pArgString[1]; /* Yes, it is */
}
else {
/*-------------------------------------------------------------
* The argument string must be in the next argv.
* But, what if there is none (bad input from the user)?
* In that case, return the letter, and optarg as NULL.
*-----------------------------------------------------------*/
if (optind < argc)
optarg = argv[optind++];
else {
optarg = NULL;
return (opterr ? (int)'?' : (int)*pArgString);
}
}
pIndexPosition = NULL; /* not in the middle of anything */
}
else {
/* it's not a colon, so just return the letter */
optarg = NULL; /* no argument follows the option */
pIndexPosition = pArgString; /* point to the letter we're on */
}
return (int)*pArgString; /* return the letter that matched */
}
}
+28 -6
View File
@@ -4,11 +4,33 @@
#include "windows.h"
const unsigned long long int DELTA_EPOCH_IN_MICROSECS = 11644473600000000;
void gettimeofday(struct timeval *tv, void *tz)
{
long int l = GetTickCount();
tv->tv_sec = l / 1000;
tv->tv_usec = (l % 1000) * 1000;
return;
}
FILETIME ft;
unsigned long long int highResolutionTime;
TIME_ZONE_INFORMATION tz_winapi;
int result_tz;
long long int timezone_time_bias_in_minutes;
ZeroMemory(&ft, sizeof(ft));
ZeroMemory(&tz_winapi, sizeof(tz_winapi));
GetSystemTimeAsFileTime(&ft);
result_tz = GetTimeZoneInformation(&tz_winapi);
timezone_time_bias_in_minutes = tz_winapi.Bias + ((result_tz == TIME_ZONE_ID_DAYLIGHT) ? tz_winapi.DaylightBias : 0);
highResolutionTime = ft.dwHighDateTime;
highResolutionTime <<= 32;
highResolutionTime |= ft.dwLowDateTime;
/* Converting file time to unix epoch */
/* Convert to microseconds */
highResolutionTime /= 10;
/* Add timezone bias conververt from minutes to microsecond */
highResolutionTime -= timezone_time_bias_in_minutes*60*1000000;
highResolutionTime -= DELTA_EPOCH_IN_MICROSECS;
tv->tv_sec = (long int) (highResolutionTime/1000000);
tv->tv_usec = (highResolutionTime%1000000);
}
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="All|Win32">
<Configuration>All</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>make_t43_gray_code_tables</ProjectName>
<ProjectGuid>{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}</ProjectGuid>
<RootNamespace>make_t43_gray_code_tables</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='All|Win32'">$(PlatformName)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='All|Win32'">$(PlatformName)\make_t43_gray_code_tables\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='All|Win32'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'">
<BuildLog>
<Path>$(IntDir)BuildLog $(ProjectName).htm</Path>
</BuildLog>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;.\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>"$(TargetPath)" &gt;"$(ProjectDir)..\t43_gray_code_tables.h"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\make_t43_gray_code_tables.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\make_t43_gray_code_tables.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="All|Win32">
<Configuration>All</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>make_t43_gray_code_tables</ProjectName>
<ProjectGuid>{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}</ProjectGuid>
<RootNamespace>make_t43_gray_code_tables</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='All|Win32'">$(PlatformName)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='All|Win32'">$(PlatformName)\make_t43_gray_code_tables\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='All|Win32'">false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='All|Win32'">
<BuildLog>
<Path>$(IntDir)BuildLog $(ProjectName).htm</Path>
</BuildLog>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;.\spandsp;.\msvc;..\..\tiff-4.0.2\libtiff;.\generated;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>"$(TargetPath)" &gt;"$(ProjectDir)..\t43_gray_code_tables.h"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\make_t43_gray_code_tables.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\make_t43_gray_code_tables.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
+5 -3
View File
@@ -36,9 +36,10 @@
#define SPANDSP_USE_EXPORT_CAPABILITY 1
#undef SPANDSP_SUPPORT_T42
#undef SPANDSP_SUPPORT_T43
#undef SPANDSP_SUPPORT_V32BIS
#undef SPANDSP_SUPPORT_V34
#undef SPANDSP_SUPPORT_TIFF_FX
#include <stdlib.h>
#include <msvc/inttypes.h>
@@ -48,6 +49,9 @@
#include <math.h>
#include <tiffio.h>
#if !defined(__cplusplus)
#include <spandsp/stdbool.h>
#endif
#include <spandsp/telephony.h>
#include <spandsp/fast_convert.h>
#include <spandsp/logging.h>
@@ -114,9 +118,7 @@
#include <spandsp/t81_t82_arith_coding.h>
#include <spandsp/t85.h>
#include <spandsp/t42.h>
#if defined(SPANDSP_SUPPORT_T43)
#include <spandsp/t43.h>
#endif
#include <spandsp/t30.h>
#include <spandsp/t30_api.h>
#include <spandsp/t30_fcf.h>
+3 -2
View File
@@ -43,6 +43,7 @@
#include "floating_fudge.h"
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/noise.h"
@@ -84,7 +85,7 @@ SPAN_DECLARE(noise_state_t *) noise_init_dbov(noise_state_t *s, int seed, float
if (s == NULL)
{
if ((s = (noise_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (noise_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -121,7 +122,7 @@ SPAN_DECLARE(int) noise_release(noise_state_t *s)
SPAN_DECLARE(int) noise_free(noise_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+3 -2
View File
@@ -39,6 +39,7 @@
#include <string.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/oki_adpcm.h"
#include "spandsp/private/oki_adpcm.h"
@@ -246,7 +247,7 @@ SPAN_DECLARE(oki_adpcm_state_t *) oki_adpcm_init(oki_adpcm_state_t *s, int bit_r
return NULL;
if (s == NULL)
{
if ((s = (oki_adpcm_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (oki_adpcm_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -264,7 +265,7 @@ SPAN_DECLARE(int) oki_adpcm_release(oki_adpcm_state_t *s)
SPAN_DECLARE(int) oki_adpcm_free(oki_adpcm_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+17 -9
View File
@@ -39,10 +39,18 @@
#include <stdlib.h>
#include <string.h>
#include <limits.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/playout.h"
#include "spandsp/private/playout.h"
static playout_frame_t *queue_get(playout_state_t *s, timestamp_t sender_stamp)
{
playout_frame_t *frame;
@@ -120,7 +128,7 @@ SPAN_DECLARE(int) playout_get(playout_state_t *s, playout_frame_t *frameout, tim
if (!s->not_first)
{
/* Prime things the first time through */
s->not_first = TRUE;
s->not_first = true;
s->latest_expected = frame->receiver_stamp + s->min_length;
}
/* Leaky integrate the rate of occurance of frames received just in time and late */
@@ -236,7 +244,7 @@ SPAN_DECLARE(int) playout_put(playout_state_t *s, void *data, int type, timestam
}
else
{
if ((frame = (playout_frame_t *) malloc(sizeof(*frame))) == NULL)
if ((frame = (playout_frame_t *) span_alloc(sizeof(*frame))) == NULL)
return PLAYOUT_ERROR;
}
@@ -296,7 +304,7 @@ SPAN_DECLARE(int) playout_put(playout_state_t *s, void *data, int type, timestam
{
s->last_speech_sender_stamp = sender_stamp - sender_len - s->min_length;
s->last_speech_sender_len = sender_len;
s->start = FALSE;
s->start = false;
}
return PLAYOUT_OK;
@@ -312,7 +320,7 @@ SPAN_DECLARE(void) playout_restart(playout_state_t *s, int min_length, int max_l
for (frame = s->free_frames; frame; frame = next)
{
next = frame->later;
free(frame);
span_free(frame);
}
memset(s, 0, sizeof(*s));
@@ -320,7 +328,7 @@ SPAN_DECLARE(void) playout_restart(playout_state_t *s, int min_length, int max_l
s->min_length = min_length;
s->max_length = (max_length > min_length) ? max_length : min_length;
s->dropable_threshold = 1*0x10000000/100;
s->start = TRUE;
s->start = true;
s->since_last_step = 0x7FFFFFFF;
/* Start with the minimum buffer length allowed, and work from there */
s->actual_buffer_length =
@@ -332,7 +340,7 @@ SPAN_DECLARE(playout_state_t *) playout_init(int min_length, int max_length)
{
playout_state_t *s;
if ((s = (playout_state_t *) malloc(sizeof(playout_state_t))) == NULL)
if ((s = (playout_state_t *) span_alloc(sizeof(playout_state_t))) == NULL)
return NULL;
memset(s, 0, sizeof(*s));
playout_restart(s, min_length, max_length);
@@ -350,13 +358,13 @@ SPAN_DECLARE(int) playout_release(playout_state_t *s)
for (frame = s->first_frame; frame; frame = next)
{
next = frame->later;
free(frame);
span_free(frame);
}
/* Free all the frames on the free list */
for (frame = s->free_frames; frame; frame = next)
{
next = frame->later;
free(frame);
span_free(frame);
}
return 0;
}
@@ -368,7 +376,7 @@ SPAN_DECLARE(int) playout_free(playout_state_t *s)
{
playout_release(s);
/* Finally, free ourselves! */
free(s);
span_free(s);
}
return 0;
}
+5 -2
View File
@@ -43,10 +43,13 @@
#include <limits.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/plc.h"
#include "spandsp/private/plc.h"
/* We do a straight line fade to zero volume in 50ms when we are filling in for missing data. */
#define ATTENUATION_INCREMENT 0.0025f /* Attenuation per sample */
@@ -234,7 +237,7 @@ SPAN_DECLARE(plc_state_t *) plc_init(plc_state_t *s)
{
if (s == NULL)
{
if ((s = (plc_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (plc_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -251,7 +254,7 @@ SPAN_DECLARE(int) plc_release(plc_state_t *s)
SPAN_DECLARE(int) plc_free(plc_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+14 -6
View File
@@ -41,17 +41,25 @@
#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 "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/power_meter.h"
#include "spandsp/private/power_meter.h"
SPAN_DECLARE(power_meter_t *) power_meter_init(power_meter_t *s, int shift)
{
if (s == NULL)
{
if ((s = (power_meter_t *) malloc(sizeof(*s))) == NULL)
if ((s = (power_meter_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
s->shift = shift;
@@ -69,7 +77,7 @@ SPAN_DECLARE(int) power_meter_release(power_meter_t *s)
SPAN_DECLARE(int) power_meter_free(power_meter_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -147,14 +155,14 @@ SPAN_DECLARE(int32_t) power_surge_detector(power_surge_detector_state_t *s, int1
{
if (pow_short <= s->surge*(pow_medium >> 10))
return 0;
s->signal_present = TRUE;
s->signal_present = true;
s->medium_term.reading = s->short_term.reading;
}
else
{
if (pow_short < s->sag*(pow_medium >> 10))
{
s->signal_present = FALSE;
s->signal_present = false;
s->medium_term.reading = s->short_term.reading;
return 0;
}
@@ -181,7 +189,7 @@ SPAN_DECLARE(power_surge_detector_state_t *) power_surge_detector_init(power_sur
if (s == NULL)
{
if ((s = (power_surge_detector_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (power_surge_detector_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -205,7 +213,7 @@ SPAN_DECLARE(int) power_surge_detector_release(power_surge_detector_state_t *s)
SPAN_DECLARE(int) power_surge_detector_free(power_surge_detector_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+12 -3
View File
@@ -35,15 +35,24 @@
#include <ctype.h>
#include <stdlib.h>
#include <inttypes.h>
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#if defined(HAVE_STDATOMIC_H)
#include <stdatomic.h>
#endif
#include <sys/types.h>
#define SPANDSP_FULLY_DEFINE_QUEUE_STATE_T
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/queue.h"
#include "spandsp/private/queue.h"
SPAN_DECLARE(int) queue_empty(queue_state_t *s)
SPAN_DECLARE(bool) queue_empty(queue_state_t *s)
{
return (s->iptr == s->optr);
}
@@ -395,7 +404,7 @@ SPAN_DECLARE(queue_state_t *) queue_init(queue_state_t *s, int len, int flags)
{
if (s == NULL)
{
if ((s = (queue_state_t *) malloc(sizeof(*s) + len + 1)) == NULL)
if ((s = (queue_state_t *) span_alloc(sizeof(*s) + len + 1)) == NULL)
return NULL;
}
s->iptr =
@@ -414,7 +423,7 @@ SPAN_DECLARE(int) queue_release(queue_state_t *s)
SPAN_DECLARE(int) queue_free(queue_state_t *s)
{
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+9 -3
View File
@@ -31,8 +31,14 @@
#include <inttypes.h>
#include <stdlib.h>
#include <memory.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/schedule.h"
@@ -53,7 +59,7 @@ SPAN_DECLARE(int) span_schedule_event(span_sched_state_t *s, int us, span_sched_
if (i >= s->allocated)
{
s->allocated += 5;
s->sched = (span_sched_t *) realloc(s->sched, sizeof(span_sched_t)*s->allocated);
s->sched = (span_sched_t *) span_realloc(s->sched, sizeof(span_sched_t)*s->allocated);
}
/*endif*/
if (i >= s->max_to_date)
@@ -141,7 +147,7 @@ SPAN_DECLARE(int) span_schedule_release(span_sched_state_t *s)
{
if (s->sched)
{
free(s->sched);
span_free(s->sched);
s->sched = NULL;
}
return 0;
@@ -152,7 +158,7 @@ SPAN_DECLARE(int) span_schedule_free(span_sched_state_t *s)
{
span_schedule_release(s);
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+17 -10
View File
@@ -38,12 +38,18 @@
#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 <memory.h>
#include <string.h>
#include <limits.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/fast_convert.h"
#include "spandsp/saturated.h"
#include "spandsp/vector_int.h"
@@ -53,6 +59,7 @@
#include "spandsp/super_tone_rx.h"
#include "spandsp/sig_tone.h"
#include "spandsp/private/power_meter.h"
#include "spandsp/private/sig_tone.h"
/*! PI */
@@ -225,7 +232,7 @@ SPAN_DECLARE(int) sig_tone_tx(sig_tone_tx_state_t *s, int16_t amp[], int len)
int k;
int n;
int16_t tone;
int need_update;
bool need_update;
int high_low;
for (i = 0; i < len; i += n)
@@ -235,19 +242,19 @@ SPAN_DECLARE(int) sig_tone_tx(sig_tone_tx_state_t *s, int16_t amp[], int len)
if (s->current_tx_timeout <= len - i)
{
n = s->current_tx_timeout;
need_update = TRUE;
need_update = true;
}
else
{
n = len - i;
need_update = FALSE;
need_update = false;
}
s->current_tx_timeout -= n;
}
else
{
n = len - i;
need_update = FALSE;
need_update = false;
}
if (!(s->current_tx_tone & SIG_TONE_TX_PASSTHROUGH))
vec_zeroi16(&amp[i], n);
@@ -325,7 +332,7 @@ SPAN_DECLARE(sig_tone_tx_state_t *) sig_tone_tx_init(sig_tone_tx_state_t *s, int
if (s == NULL)
{
if ((s = (sig_tone_tx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (sig_tone_tx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -357,7 +364,7 @@ SPAN_DECLARE(int) sig_tone_tx_release(sig_tone_tx_state_t *s)
SPAN_DECLARE(int) sig_tone_tx_free(sig_tone_tx_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -448,13 +455,13 @@ SPAN_DECLARE(int) sig_tone_rx(sig_tone_rx_state_t *s, int16_t amp[], int len)
if ((s->signalling_state & (SIG_TONE_1_PRESENT | SIG_TONE_2_PRESENT)))
{
if (s->flat_mode_timeout && --s->flat_mode_timeout == 0)
s->flat_mode = TRUE;
s->flat_mode = true;
/*endif*/
}
else
{
s->flat_mode_timeout = s->desc->sharp_flat_timeout;
s->flat_mode = FALSE;
s->flat_mode = false;
}
/*endif*/
@@ -641,7 +648,7 @@ SPAN_DECLARE(sig_tone_rx_state_t *) sig_tone_rx_init(sig_tone_rx_state_t *s, int
if (s == NULL)
{
if ((s = (sig_tone_rx_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (sig_tone_rx_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -685,7 +692,7 @@ SPAN_DECLARE(int) sig_tone_rx_release(sig_tone_rx_state_t *s)
SPAN_DECLARE(int) sig_tone_rx_free(sig_tone_rx_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+8 -2
View File
@@ -40,11 +40,17 @@
#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 <limits.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/async.h"
#include "spandsp/silence_gen.h"
@@ -119,7 +125,7 @@ SPAN_DECLARE(silence_gen_state_t *) silence_gen_init(silence_gen_state_t *s, int
{
if (s == NULL)
{
if ((s = (silence_gen_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (silence_gen_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -137,7 +143,7 @@ SPAN_DECLARE(int) silence_gen_release(silence_gen_state_t *s)
SPAN_DECLARE(int) silence_gen_free(silence_gen_state_t *s)
{
if (s)
free(s);
span_free(s);
return 0;
}
/*- End of function --------------------------------------------------------*/
+12 -6
View File
@@ -33,8 +33,8 @@
@SPANDSP_USE_EXPORT_CAPABILITY@
@SPANDSP_SUPPORT_T42@
@SPANDSP_SUPPORT_T43@
@SPANDSP_SUPPORT_V32BIS@
@SPANDSP_SUPPORT_V34@
@SPANDSP_SUPPORT_TIFF_FX@
@@ -44,9 +44,11 @@
#include <limits.h>
#include <time.h>
@INSERT_MATH_HEADER@
@INSERT_STDBOOL_HEADER@
#include <tiffio.h>
#include <spandsp/telephony.h>
#include <spandsp/alloc.h>
#include <spandsp/fast_convert.h>
#include <spandsp/logging.h>
#include <spandsp/complex.h>
@@ -90,17 +92,21 @@
#include <spandsp/modem_connect_tones.h>
#include <spandsp/silence_gen.h>
#include <spandsp/v8.h>
#include <spandsp/v42.h>
#include <spandsp/v42bis.h>
#include <spandsp/v29rx.h>
#include <spandsp/v29tx.h>
#include <spandsp/v17rx.h>
#include <spandsp/v17tx.h>
/*#include <spandsp/v32bis.h>*/
#include <spandsp/v22bis.h>
#include <spandsp/v27ter_rx.h>
#include <spandsp/v27ter_tx.h>
/*#include <spandsp/v34.h>*/
#if defined(SPANDSP_SUPPORT_V32BIS)
#include <spandsp/v32bis.h>
#endif
#if defined(SPANDSP_SUPPORT_V34)
#include <spandsp/v34.h>
#endif
#include <spandsp/v42.h>
#include <spandsp/v42bis.h>
#include <spandsp/v18.h>
#include <spandsp/timezone.h>
#include <spandsp/t4_rx.h>
@@ -111,7 +117,7 @@
#include <spandsp/t81_t82_arith_coding.h>
#include <spandsp/t85.h>
#include <spandsp/t42.h>
/*#include <spandsp/t43.h>*/
#include <spandsp/t43.h>
#include <spandsp/t30.h>
#include <spandsp/t30_api.h>
#include <spandsp/t30_fcf.h>
+77
View File
@@ -0,0 +1,77 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* alloc.h - 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(_SPANDSP_ALLOC_H_)
#define _SPANDSP_ALLOC_H_
/* Notes:
- Most platforms don't have an aligned realloc function, so we don't try to
support an aligned realloc on any platform.
- Some platforms use a special free function for memory which was allocated
by alligned allocation functions. We use a separate aligned_free function
on all platforms, for compatibility, even though it may simply reduce to
free().
*/
typedef void *(*span_aligned_alloc_t)(size_t alignment, size_t size);
typedef void (*span_aligned_free_t)(void *ptr);
typedef void *(*span_alloc_t)(size_t size);
typedef void *(*span_realloc_t)(void *ptr, size_t size);
typedef void (*span_free_t)(void *ptr);
#if defined(__cplusplus)
extern "C"
{
#endif
/* Allocate size bytes allocated to ALIGNMENT bytes. */
SPAN_DECLARE(void *) span_aligned_alloc(size_t alignment, size_t size);
/* Free a block allocated by span_aligned_alloc, or span_aligned_realloc. */
SPAN_DECLARE(void) span_aligned_free(void *ptr);
/* Allocate size bytes of memory. */
SPAN_DECLARE(void *) span_alloc(size_t size);
/* Re-allocate the previously allocated block in ptr, making the new block size bytes long. */
SPAN_DECLARE(void *) span_realloc(void *ptr, size_t size);
/* Free a block allocated by span_alloc or span_realloc. */
SPAN_DECLARE(void) span_free(void *ptr);
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);
#if defined(__cplusplus)
}
#endif
#endif
/*- End of file ------------------------------------------------------------*/
+4 -4
View File
@@ -164,7 +164,7 @@ SPAN_DECLARE_NONSTD(void) async_rx_put_bit(void *user_data, int bit);
\param data_bits The number of data bits.
\param parity_bits The type of parity.
\param stop_bits The number of stop bits.
\param use_v14 TRUE if V.14 rate adaption processing should be used.
\param use_v14 True if V.14 rate adaption processing should be used.
\param put_byte The callback routine used to put the received data.
\param user_data An opaque pointer.
\return A pointer to the initialised context, or NULL if there was a problem. */
@@ -172,7 +172,7 @@ SPAN_DECLARE(async_rx_state_t *) async_rx_init(async_rx_state_t *s,
int data_bits,
int parity_bits,
int stop_bits,
int use_v14,
bool use_v14,
put_byte_func_t put_byte,
void *user_data);
@@ -198,7 +198,7 @@ SPAN_DECLARE_NONSTD(int) async_tx_get_bit(void *user_data);
\param data_bits The number of data bit.
\param parity_bits The type of parity.
\param stop_bits The number of stop bits.
\param use_v14 TRUE if V.14 rate adaption processing should be used.
\param use_v14 True if V.14 rate adaption processing should be used.
\param get_byte The callback routine used to get the data to be transmitted.
\param user_data An opaque pointer.
\return A pointer to the initialised context, or NULL if there was a problem. */
@@ -206,7 +206,7 @@ SPAN_DECLARE(async_tx_state_t *) async_tx_init(async_tx_state_t *s,
int data_bits,
int parity_bits,
int stop_bits,
int use_v14,
bool use_v14,
get_byte_func_t get_byte,
void *user_data);
+7 -7
View File
@@ -115,14 +115,14 @@ enum
*/
typedef struct
{
/*! TRUE if character echo is enabled */
int echo;
/*! TRUE if verbose reporting is enabled */
int verbose;
/*! TRUE if result codes are verbose */
/*! True if character echo is enabled */
bool echo;
/*! True if verbose reporting is enabled */
bool verbose;
/*! Result code format code - numeic or verbose */
int result_code_format;
/*! TRUE if pulse dialling is the default */
int pulse_dial;
/*! True if pulse dialling is the default */
bool pulse_dial;
/*! ??? */
int double_escape;
/*! ??? */
+4 -4
View File
@@ -175,10 +175,10 @@ SPAN_DECLARE(int) r2_mf_tx_put(r2_mf_tx_state_t *s, char digit);
/*! \brief Initialise an R2 MF tone generator context.
\param s The R2 MF generator context.
\param fwd TRUE if the context is for forward signals. FALSE if the
\param fwd True if the context is for forward signals. False if the
context is for backward signals.
\return A pointer to the MFC/R2 generator context.*/
SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, int fwd);
SPAN_DECLARE(r2_mf_tx_state_t *) r2_mf_tx_init(r2_mf_tx_state_t *s, bool fwd);
/*! \brief Release an R2 MF tone generator context.
\param s The R2 MF tone generator context.
@@ -242,7 +242,7 @@ SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s);
/*! \brief Initialise an R2 MF receiver context.
\param s The R2 MF receiver context.
\param fwd TRUE if the context is for forward signals. FALSE if the
\param fwd True if the context is for forward signals. False if the
context is for backward signals.
\param callback An optional callback routine, used to report received digits. If
no callback routine is set, digits may be collected, using the r2_mf_rx_get()
@@ -251,7 +251,7 @@ SPAN_DECLARE(int) r2_mf_rx_get(r2_mf_rx_state_t *s);
and supplied in callbacks.
\return A pointer to the R2 MF receiver context. */
SPAN_DECLARE(r2_mf_rx_state_t *) r2_mf_rx_init(r2_mf_rx_state_t *s,
int fwd,
bool fwd,
tone_report_func_t callback,
void *user_data);
+2 -2
View File
@@ -42,7 +42,7 @@ extern "C"
/*! \brief Find the bit position of the highest set bit in a word
\param bits The word to be searched
\return The bit number of the highest set bit, or -1 if the word is zero. */
static __inline__ int top_bit(unsigned int bits)
static __inline__ int top_bit(uint32_t bits)
{
#if defined(SPANDSP_USE_86_ASM)
int res;
@@ -141,7 +141,7 @@ static __inline__ int top_bit(unsigned int bits)
/*! \brief Find the bit position of the lowest set bit in a word
\param bits The word to be searched
\return The bit number of the lowest set bit, or -1 if the word is zero. */
static __inline__ int bottom_bit(unsigned int bits)
static __inline__ int bottom_bit(uint32_t bits)
{
int res;
+1 -1
View File
@@ -71,7 +71,7 @@ SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c);
/*! \brief Initialise a bitstream context.
\param s A pointer to the bitstream context.
\param lsb_first TRUE if the bit stream is LSB first, else its MSB first.
\param lsb_first True if the bit stream is LSB first, else its MSB first.
\return A pointer to the bitstream context. */
SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int direction);
+4 -4
View File
@@ -60,9 +60,9 @@ SPAN_DECLARE(int) crc_itu32_append(uint8_t *buf, int len);
/*! \brief Check the ITU/CCITT CRC-32 value in a frame.
\param buf The buffer containing the frame.
\param len The length of the frame.
\return TRUE if the CRC is OK, else FALSE.
\return True if the CRC is OK, else false.
*/
SPAN_DECLARE(int) crc_itu32_check(const uint8_t *buf, int len);
SPAN_DECLARE(bool) crc_itu32_check(const uint8_t *buf, int len);
/*! \brief Calculate the ITU/CCITT CRC-16 value in buffer by whole bytes.
\param buf The buffer containing the data.
@@ -93,9 +93,9 @@ SPAN_DECLARE(int) crc_itu16_append(uint8_t *buf, int len);
/*! \brief Check the ITU/CCITT CRC-16 value in a frame.
\param buf The buffer containing the frame.
\param len The length of the frame.
\return TRUE if the CRC is OK, else FALSE.
\return True if the CRC is OK, else false.
*/
SPAN_DECLARE(int) crc_itu16_check(const uint8_t *buf, int len);
SPAN_DECLARE(bool) crc_itu16_check(const uint8_t *buf, int len);
#if defined(__cplusplus)
}
+1 -1
View File
@@ -156,7 +156,7 @@ SPAN_DECLARE(void) dtmf_rx_set_realtime_callback(dtmf_rx_state_t *s,
/*! \brief Adjust a DTMF receiver context.
\param s The DTMF receiver context.
\param filter_dialtone TRUE to enable filtering of dialtone, FALSE
\param filter_dialtone True to enable filtering of dialtone, false
to disable, < 0 to leave unchanged.
\param twist Acceptable twist, in dB. < 0.0 to leave unchanged.
\param reverse_twist Acceptable reverse twist, in dB. < 0.0 to leave unchanged.
+13 -3
View File
@@ -31,6 +31,8 @@
#if !defined(_SPANDSP_EXPOSE_H_)
#define _SPANDSP_EXPOSE_H_
#include <jpeglib.h>
#include <spandsp/private/logging.h>
#include <spandsp/private/schedule.h>
#include <spandsp/private/bitstream.h>
@@ -38,6 +40,7 @@
#include <spandsp/private/awgn.h>
#include <spandsp/private/noise.h>
#include <spandsp/private/bert.h>
#include <spandsp/private/power_meter.h>
#include <spandsp/private/tone_generate.h>
#include <spandsp/private/bell_r2_mf.h>
#include <spandsp/private/sig_tone.h>
@@ -47,6 +50,8 @@
#include <spandsp/private/g726.h>
#include <spandsp/private/lpc10.h>
#include <spandsp/private/gsm0610.h>
#include <spandsp/private/plc.h>
#include <spandsp/private/playout.h>
#include <spandsp/private/oki_adpcm.h>
#include <spandsp/private/ima_adpcm.h>
#include <spandsp/private/hdlc.h>
@@ -68,11 +73,16 @@
#include <spandsp/private/v27ter_tx.h>
#include <spandsp/private/v29rx.h>
#include <spandsp/private/v29tx.h>
/*#include <spandsp/private/v32bis.h>*/
/*#include <spandsp/private/v34.h>*/
#if defined(SPANDSP_SUPPORT_V32BIS)
#include <spandsp/private/v32bis.h>
#endif
#if defined(SPANDSP_SUPPORT_V34)
#include <spandsp/private/v34.h>
#endif
#include <spandsp/private/v42.h>
#include <spandsp/private/v42bis.h>
#include <spandsp/private/at_interpreter.h>
//#include <spandsp/private/data_modems.h>
#include <spandsp/private/fax_modems.h>
#include <spandsp/private/timezone.h>
#include <spandsp/private/image_translate.h>
@@ -81,7 +91,7 @@
#include <spandsp/private/t81_t82_arith_coding.h>
#include <spandsp/private/t85.h>
#include <spandsp/private/t42.h>
/*#include <spandsp/private/t43.h>*/
#include <spandsp/private/t43.h>
#include <spandsp/private/t4_rx.h>
#include <spandsp/private/t4_tx.h>
#include <spandsp/private/t30.h>
+4
View File
@@ -247,6 +247,7 @@ extern "C"
* Therefore implement inline versions of these functions here.
*/
#if (_MSC_VER < 1800)
__inline long int lrint(double x)
{
long int i;
@@ -288,6 +289,7 @@ extern "C"
frndint
}
}
#endif
__inline long int lfastrint(double x)
{
@@ -317,6 +319,7 @@ extern "C"
/* x86_64 machines will do best with a simple assignment. */
#include <intrin.h>
#if (_MSC_VER < 1800)
__inline long int lrint(double x)
{
return (long int)_mm_cvtsd_si64x( _mm_loadu_pd ((const double*)&x) );
@@ -326,6 +329,7 @@ extern "C"
{
return _mm_cvt_ss2si( _mm_load_ss((const float*)&x) );
}
#endif
__inline long int lfastrint(double x)
{
+6 -6
View File
@@ -75,16 +75,16 @@ SPAN_DECLARE_NONSTD(int) fax_tx(fax_state_t *s, int16_t *amp, int max_len);
/*! Select whether silent audio will be sent when FAX transmit is idle.
\brief Select whether silent audio will be sent when FAX transmit is idle.
\param s The FAX context.
\param transmit_on_idle TRUE if silent audio should be output when the FAX transmitter is
idle. FALSE to transmit zero length audio when the FAX transmitter is idle. The default
behaviour is FALSE.
\param transmit_on_idle True if silent audio should be output when the FAX transmitter is
idle. False to transmit zero length audio when the FAX transmitter is idle. The default
behaviour is false.
*/
SPAN_DECLARE(void) fax_set_transmit_on_idle(fax_state_t *s, int transmit_on_idle);
/*! Select whether talker echo protection tone will be sent for the image modems.
\brief Select whether TEP will be sent for the image modems.
\param s The FAX context.
\param use_tep TRUE if TEP should be sent.
\param use_tep True if TEP should be sent.
*/
SPAN_DECLARE(void) fax_set_tep_mode(fax_state_t *s, int use_tep);
@@ -105,7 +105,7 @@ SPAN_DECLARE(logging_state_t *) fax_get_logging_state(fax_state_t *s);
/*! Restart a FAX context.
\brief Restart a FAX context.
\param s The FAX context.
\param calling_party TRUE if the context is for a calling party. FALSE if the
\param calling_party True if the context is for a calling party. False if the
context is for an answering party.
\return 0 for OK, else -1. */
SPAN_DECLARE(int) fax_restart(fax_state_t *s, int calling_party);
@@ -113,7 +113,7 @@ SPAN_DECLARE(int) fax_restart(fax_state_t *s, int calling_party);
/*! Initialise a FAX context.
\brief Initialise a FAX context.
\param s The FAX context.
\param calling_party TRUE if the context is for a calling party. FALSE if the
\param calling_party True if the context is for a calling party. False if the
context is for an answering party.
\return A pointer to the FAX context, or NULL if there was a problem.
*/
+10
View File
@@ -59,6 +59,14 @@ extern "C"
{
#endif
SPAN_DECLARE(void) fax_modems_hdlc_accept(void *user_data, const uint8_t *msg, int len, int ok);
/*! Convert a FAX modem type to a short text description.
\brief Convert a FAX modem type to a short text description.
\param modem The modem code.
\return A pointer to the description. */
SPAN_DECLARE(const char *) fax_modem_to_str(int modem);
/* N.B. the following are currently a work in progress */
SPAN_DECLARE_NONSTD(int) fax_modems_v17_v21_rx(void *user_data, const int16_t amp[], int len);
SPAN_DECLARE_NONSTD(int) fax_modems_v27ter_v21_rx(void *user_data, const int16_t amp[], int len);
@@ -93,6 +101,8 @@ SPAN_DECLARE(void) fax_modems_set_tx_handler(fax_modems_state_t *s, span_tx_hand
SPAN_DECLARE(void) fax_modems_set_next_tx_handler(fax_modems_state_t *s, span_tx_handler_t handler, void *user_data);
SPAN_DECLARE(int) fax_modems_set_next_tx_type(fax_modems_state_t *s);
SPAN_DECLARE(int) fax_modems_restart(fax_modems_state_t *s);
/*! Get a pointer to the logging context associated with a FAX modems context.
+4 -3
View File
@@ -109,9 +109,10 @@ enum
FSK_BELL103CH1,
FSK_BELL103CH2,
FSK_BELL202,
FSK_WEITBRECHT, /* 45.45 baud version, used for TDD (Telecom Device for the Deaf) */
FSK_WEITBRECHT50, /* 50 baud version, used for TDD (Telecom Device for the Deaf) */
FSK_V21CH1_110 /* 110 bps version of V.21 channel 1, as used by V.18 */
FSK_WEITBRECHT_4545, /* 45.45 baud version, used for TDD (Telecom Device for the Deaf) */
FSK_WEITBRECHT_50, /* 50 baud version, used for TDD (Telecom Device for the Deaf) */
FSK_WEITBRECHT_476, /* 47.6 baud version, used for V.18 probing */
FSK_V21CH1_110 /* 110 bps version of V.21 channel 1, as used by V.18 */
};
enum
-7
View File
@@ -21,15 +21,8 @@
* 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.
*
* Based on a single channel G.722 codec which is:
*
***** Copyright (c) CMU 1993 *****
* Computer Science, Speech Group
* Chengxiang Lu and Alex Hauptmann
*/
/*! \file */
#if !defined(_SPANDSP_G722_H_)
+8 -8
View File
@@ -83,8 +83,8 @@ extern "C"
/*! \brief Initialise an HDLC receiver context.
\param s A pointer to an HDLC receiver context.
\param crc32 TRUE to use ITU CRC32. FALSE to use ITU CRC16.
\param report_bad_frames TRUE to request the reporting of bad frames.
\param crc32 True to use ITU CRC32. False to use ITU CRC16.
\param report_bad_frames True to request the reporting of bad frames.
\param framing_ok_threshold The number of back-to-back flags needed to
start the framing OK condition. This may be used where a series of
flag octets is used as a preamble, such as in the T.30 protocol.
@@ -93,8 +93,8 @@ extern "C"
\return A pointer to the HDLC receiver context.
*/
SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s,
int crc32,
int report_bad_frames,
bool crc32,
bool report_bad_frames,
int framing_ok_threshold,
hdlc_frame_handler_t handler,
void *user_data);
@@ -169,17 +169,17 @@ SPAN_DECLARE_NONSTD(void) hdlc_rx_put(hdlc_rx_state_t *s, const uint8_t buf[], i
/*! \brief Initialise an HDLC transmitter context.
\param s A pointer to an HDLC transmitter context.
\param crc32 TRUE to use ITU CRC32. FALSE to use ITU CRC16.
\param crc32 True to use ITU CRC32. False to use ITU CRC16.
\param inter_frame_flags The minimum flag octets to insert between frames (usually one).
\param progressive TRUE if frame creation works in progressive mode.
\param progressive True if frame creation works in progressive mode.
\param handler The callback function called when the HDLC transmitter underflows.
\param user_data An opaque parameter for the callback routine.
\return A pointer to the HDLC transmitter context.
*/
SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s,
int crc32,
bool crc32,
int inter_frame_flags,
int progressive,
bool progressive,
hdlc_underflow_handler_t handler,
void *user_data);
+18 -8
View File
@@ -66,29 +66,39 @@ SPAN_DECLARE(int) image_translate_get_output_width(image_translate_state_t *s);
\return The length of the output image, in pixel. */
SPAN_DECLARE(int) image_translate_get_output_length(image_translate_state_t *s);
/*! \brief Set the row read callback routine for an image translation context.
\param s The image translation context.
\param row_read_handler A callback routine used to pull rows of pixels from the source image
into the translation process.
\param row_read_user_data An opaque pointer passed to read_row_handler
\return 0 for success, else -1. */
SPAN_DECLARE(int) image_translate_set_row_read_handler(image_translate_state_t *s, t4_row_read_handler_t row_read_handler, void *row_read_user_data);
SPAN_DECLARE(int) image_translate_restart(image_translate_state_t *s, int input_length);
/*! \brief Initialise an image translation context for rescaling and squashing a gray scale
or colour image to a bi-level FAX type image.
\param s The image translation context.
\param input_format x
\param input_width The width of the source image, in pixels.
\param input_length The length of the source image, in pixels.
\param output_format x
\param output_format The type of output image
\param output_width The width of the output image, in pixels. If this is set <= 0 the image
will not be resized.
\param output_length The length of the output image, in pixels. If this is set to <= 0 the
output length will be derived automatically from the width, to maintain the geometry
of the original image.
\param input_format The type of source image
\param input_width The width of the source image, in pixels.
\param input_length The length of the source image, in pixels.
\param row_read_handler A callback routine used to pull rows of pixels from the source image
into the translation process.
\param row_read_user_data An opaque point passed to read_row_handler
\param row_read_user_data An opaque pointer passed to read_row_handler
\return A pointer to the context, or NULL if there was a problem. */
SPAN_DECLARE(image_translate_state_t *) image_translate_init(image_translate_state_t *s,
int input_format,
int input_width,
int input_length,
int output_format,
int output_width,
int output_length,
int input_format,
int input_width,
int input_length,
t4_row_read_handler_t row_read_handler,
void *row_read_user_data);
+2 -2
View File
@@ -80,9 +80,9 @@ extern "C"
\brief Test if logging of a specified severity level is enabled.
\param s The logging context.
\param level The severity level to be tested.
\return TRUE if logging is enable, else FALSE.
\return True if logging is enable.
*/
SPAN_DECLARE(int) span_log_test(logging_state_t *s, int level);
SPAN_DECLARE(bool) span_log_test(logging_state_t *s, int level);
/*! Generate a log entry.
\brief Generate a log entry.
@@ -153,7 +153,7 @@ SPAN_DECLARE_NONSTD(int) modem_connect_tones_rx_fillin(modem_connect_tones_rx_st
/*! \brief Test if a modem_connect tone has been detected.
\param s The context.
\return TRUE if tone is detected, else FALSE.
\return The code for the detected tone.
*/
SPAN_DECLARE(int) modem_connect_tones_rx_get(modem_connect_tones_rx_state_t *s);
+2 -69
View File
@@ -56,80 +56,13 @@ enum
typedef int timestamp_t;
typedef struct playout_frame_s
{
/*! The actual frame data */
void *data;
/*! The type of frame */
int type;
/*! The timestamp assigned by the sending end */
timestamp_t sender_stamp;
/*! The timespan covered by the data in this frame */
timestamp_t sender_len;
/*! The timestamp assigned by the receiving end */
timestamp_t receiver_stamp;
/*! Pointer to the next earlier frame */
struct playout_frame_s *earlier;
/*! Pointer to the next later frame */
struct playout_frame_s *later;
} playout_frame_t;
typedef struct playout_frame_s playout_frame_t;
/*!
Playout (jitter buffer) descriptor. This defines the working state
for a single instance of playout buffering.
*/
typedef struct
{
/*! TRUE if the buffer is dynamically sized */
int dynamic;
/*! The minimum length (dynamic) or fixed length (static) of the buffer */
int min_length;
/*! The maximum length (dynamic) or fixed length (static) of the buffer */
int max_length;
/*! The target filter threshold for adjusting dynamic buffering. */
int dropable_threshold;
int start;
/*! The queued frame list */
playout_frame_t *first_frame;
playout_frame_t *last_frame;
/*! The free frame pool */
playout_frame_t *free_frames;
/*! The total frames input to the buffer, to date. */
int frames_in;
/*! The total frames output from the buffer, to date. */
int frames_out;
/*! The number of frames received out of sequence. */
int frames_oos;
/*! The number of frames which were discarded, due to late arrival. */
int frames_late;
/*! The number of frames which were never received. */
int frames_missing;
/*! The number of frames trimmed from the stream, due to buffer shrinkage. */
int frames_trimmed;
timestamp_t latest_expected;
/*! The present jitter adjustment */
timestamp_t current;
/*! The sender_stamp of the last speech frame */
timestamp_t last_speech_sender_stamp;
/*! The duration of the last speech frame */
timestamp_t last_speech_sender_len;
int not_first;
/*! The time since the target buffer length was last changed. */
timestamp_t since_last_step;
/*! Filter state for tracking the packets arriving just in time */
int32_t state_just_in_time;
/*! Filter state for tracking the packets arriving late */
int32_t state_late;
/*! The current target length of the buffer */
int target_buffer_length;
/*! The current actual length of the buffer, which may lag behind the target value */
int actual_buffer_length;
} playout_state_t;
typedef struct playout_state_s playout_state_t;
#if defined(__cplusplus)
extern "C"
+1 -15
View File
@@ -109,21 +109,7 @@ That's it!
/*!
The generic packet loss concealer context.
*/
typedef struct
{
/*! Consecutive erased samples */
int missing_samples;
/*! Current offset into pitch period */
int pitch_offset;
/*! Pitch estimate */
int pitch;
/*! Buffer for a cycle of speech */
float pitchbuf[PLC_PITCH_MIN];
/*! History buffer */
int16_t history[PLC_HISTORY_LEN];
/*! Current pointer into the history buffer */
int buf_ptr;
} plc_state_t;
typedef struct plc_state_s plc_state_t;
#if defined(__cplusplus)
+4 -19
View File
@@ -23,8 +23,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if !defined(_POWER_METER_H_)
#define _POWER_METER_H_
#if !defined(_SPANDSP_POWER_METER_H_)
#define _SPANDSP_POWER_METER_H_
/*! \page power_meter_page Power metering
@@ -45,24 +45,9 @@ values +/-8031, and this square wave represents 0dBov. This translates into 6.1
Power meter descriptor. This defines the working state for a
single instance of a power measurement device.
*/
typedef struct
{
/*! The shift factor, which controls the damping of the power meter. */
int shift;
typedef struct power_meter_s power_meter_t;
/*! The current power reading. */
int32_t reading;
} power_meter_t;
typedef struct
{
power_meter_t short_term;
power_meter_t medium_term;
int signal_present;
int32_t surge;
int32_t sag;
int32_t min;
} power_surge_detector_state_t;
typedef struct power_surge_detector_state_s power_surge_detector_state_t;
#if defined(__cplusplus)
extern "C"
+2 -2
View File
@@ -69,8 +69,8 @@ struct async_rx_state_s
int parity;
/*! \brief The number of stop bits per character. */
int stop_bits;
/*! \brief TRUE if V.14 rate adaption processing should be performed. */
int use_v14;
/*! \brief True if V.14 rate adaption processing should be performed. */
bool use_v14;
/*! \brief A pointer to the callback routine used to handle received characters. */
put_byte_func_t put_byte;
/*! \brief An opaque pointer passed when calling put_byte. */
@@ -106,10 +106,10 @@ struct at_state_s
int command_dial;
int ok_is_pending;
int dte_is_waiting;
/*! \brief TRUE if a carrier is presnt. Otherwise FALSE. */
int rx_signal_present;
/*! \brief TRUE if a modem has trained, Otherwise FALSE. */
int rx_trained;
/*! \brief True if a carrier is presnt. Otherwise false. */
bool rx_signal_present;
/*! \brief True if a modem has trained, Otherwise false. */
bool rx_trained;
int transmit;
char line[256];
@@ -73,8 +73,8 @@ struct r2_mf_tx_state_s
{
/*! The tone generator. */
tone_gen_state_t tone;
/*! TRUE if generating forward tones, otherwise generating reverse tones. */
int fwd;
/*! True if generating forward tones, otherwise generating reverse tones. */
bool fwd;
/*! The current digit being generated. */
int digit;
};
@@ -88,8 +88,8 @@ struct r2_mf_rx_state_s
tone_report_func_t callback;
/*! An opaque pointer passed to the callback function. */
void *callback_data;
/*! TRUE is we are detecting forward tones. FALSE if we are detecting backward tones */
int fwd;
/*! Tue is we are detecting forward tones. False if we are detecting backward tones */
bool fwd;
/*! Tone detector working states */
goertzel_state_t out[6];
/*! The current sample number within a processing block. */
+2 -2
View File
@@ -33,8 +33,8 @@ struct bitstream_state_s
uint32_t bitstream;
/*! The residual bits in bitstream. */
int residue;
/*! TRUE if the stream is LSB first, else MSB first */
int lsb_first;
/*! True if the stream is LSB first, else MSB first */
bool lsb_first;
};

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