FS-10504: [Build-System] Move iLBC from tree to download on windows.

This commit is contained in:
Andrey Volk 2017-07-17 19:24:26 +03:00
parent 13f2f2a056
commit e1a4f42371
115 changed files with 309 additions and 12819 deletions

1
.gitignore vendored
View File

@ -250,3 +250,4 @@ libs/PaxHeaders.1693/
libs/lua-*/
libs/g722_1-*/
libs/ilbc-*/

View File

@ -393,7 +393,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libs\win32\spee
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeexdsp", "libs\win32\speex\libspeexdsp.2015.vcxproj", "{03207781-0D1C-4DB3-A71D-45C608F28DBD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libilbc", "libs\ilbc\libilbc.2015.vcxproj", "{9A5DDF08-C88C-4A35-B7F6-D605228446BD}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libilbc", "libs\win32\ilbc\libilbc.2015.vcxproj", "{9A5DDF08-C88C-4A35-B7F6-D605228446BD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_opal", "src\mod\endpoints\mod_opal\mod_opal.2015.vcxproj", "{05C9FB27-480E-4D53-B3B7-6338E2526666}"
EndProject
@ -655,6 +655,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download lua", "libs\win32\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download g722_1", "libs\win32\Download g722_1.2015.vcxproj", "{36603FE1-253F-4C2C-AAB6-12927A626135}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download iLBC", "libs\win32\Download iLBC.2015.vcxproj", "{53AADA60-DF12-46FF-BF94-566BBF849336}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Win32 = All|Win32
@ -2949,6 +2951,18 @@ Global
{36603FE1-253F-4C2C-AAB6-12927A626135}.Release|Win32.Build.0 = Release|Win32
{36603FE1-253F-4C2C-AAB6-12927A626135}.Release|x64.ActiveCfg = Release|Win32
{36603FE1-253F-4C2C-AAB6-12927A626135}.Release|x64.Build.0 = Release|Win32
{53AADA60-DF12-46FF-BF94-566BBF849336}.All|Win32.ActiveCfg = Release|Win32
{53AADA60-DF12-46FF-BF94-566BBF849336}.All|Win32.Build.0 = Release|Win32
{53AADA60-DF12-46FF-BF94-566BBF849336}.All|x64.ActiveCfg = Release|Win32
{53AADA60-DF12-46FF-BF94-566BBF849336}.All|x64.Build.0 = Release|Win32
{53AADA60-DF12-46FF-BF94-566BBF849336}.Debug|Win32.ActiveCfg = Debug|Win32
{53AADA60-DF12-46FF-BF94-566BBF849336}.Debug|Win32.Build.0 = Debug|Win32
{53AADA60-DF12-46FF-BF94-566BBF849336}.Debug|x64.ActiveCfg = Debug|Win32
{53AADA60-DF12-46FF-BF94-566BBF849336}.Debug|x64.Build.0 = Debug|Win32
{53AADA60-DF12-46FF-BF94-566BBF849336}.Release|Win32.ActiveCfg = Release|Win32
{53AADA60-DF12-46FF-BF94-566BBF849336}.Release|Win32.Build.0 = Release|Win32
{53AADA60-DF12-46FF-BF94-566BBF849336}.Release|x64.ActiveCfg = Release|Win32
{53AADA60-DF12-46FF-BF94-566BBF849336}.Release|x64.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -3183,5 +3197,6 @@ Global
{4F990563-6DFB-45C3-B083-1938C6D7FFA4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{45CD36EE-0AF3-4387-8790-4F11E928299D} = {C120A020-773F-4EA3-923F-B67AF28B750D}
{36603FE1-253F-4C2C-AAB6-12927A626135} = {C120A020-773F-4EA3-923F-B67AF28B750D}
{53AADA60-DF12-46FF-BF94-566BBF849336} = {C120A020-773F-4EA3-923F-B67AF28B750D}
EndGlobalSection
EndGlobal

View File

@ -1 +0,0 @@
Tue Feb 17 10:22:09 CST 2009

View File

@ -1,2 +0,0 @@
Adapted by Steve Underwood <steveu@coppice.org> from the source code
supplied in RFC3???.

View File

@ -1,3 +0,0 @@
The license conditions for the original iLBC codec may be found in the file
gips_iLBClicense.pdf
No additional license conditions are claimed over this implementation.

View File

@ -1,3 +0,0 @@
08.02.14 - 0.0.1 - Steve Underwood <steveu@coppice.org>
- The first version.

View File

@ -1,182 +0,0 @@
Basic Installation
==================
These are generic installation instructions.
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').
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.
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 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.
Running `configure' takes awhile. 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.
4. Type `make install' to install the programs and any data files and
documentation.
5. 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
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
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
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
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
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 `..'.
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.
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'.
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.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' 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.
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
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
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.
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:
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.
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.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`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.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
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.
`configure' also accepts some other, not widely useful, options.

View File

@ -1,90 +0,0 @@
##
## iLBC - a library for the iLBC codec
##
## Makefile.am -- Process this file with automake to produce Makefile.in
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the Lesser GNU General Public License version 2.1, as
## published by the Free Software Foundation.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Id: Makefile.am,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
noinst_SCRIPTS = ilbc.spec
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = ilbc.spec \
wrapper.xsl \
gips_iLBClicense.pdf \
libilbc.vcproj \
doc/libilbc-doxygen \
src/ilbc/version.h.in \
src/libilbc.dsp \
src/libilbc.sln \
src/msvc/gettimeofday.c \
src/msvc/inttypes.h \
src/msvc/tgmath.h \
src/msvc/unistd.h \
src/msvc/sys/time.h \
src/msvc/ilbc.def \
src/msvc/msvcproj.head \
src/msvc/msvcproj.foot \
src/msvc/vc8proj.head \
src/msvc/vc8proj.foot \
debian/changelog \
debian/compat \
debian/control \
debian/copyright \
debian/libilbc.install \
debian/libilbc-dev.install \
debian/libilbc-doc.install \
debian/rules \
debian/watch
if COND_DOC
MAYBE_DOC=doc
endif
if COND_TESTS
MAYBE_TESTS=tests
endif
SUBDIRS = src $(MAYBE_DOC) $(MAYBE_TESTS)
DIST_SUBDIRS = src doc tests localtests
faq: faq.xml
cd faq ; xsltproc ../wrapper.xsl ../faq.xml
rpm: rpm-build
rpm-build:
$(MAKE) -$(MAKEFLAGS) bump.rpm.release
$(MAKE) -$(MAKEFLAGS) dist
rm -rf rpm/BUILD/*
rm -f rpm/RPMS/*/*
rm -f rpm/SOURCES/*
rm -f rpm/SPECS/*
rm -f rpm/SRPMS/*
rpm -ta --sign @PACKAGE@-@VERSION@.tar.gz
bump.rpm.release: ilbc.spec
VERSION="x"; \
test -f $(srcdir)/rpm.release && . $(srcdir)/rpm.release; \
NEXT_RELEASE=0; \
test "$$VERSION" = "@VERSION@" && NEXT_RELEASE="$$RELEASE"; \
RELEASE=`expr $$NEXT_RELEASE + 1`; \
echo "VERSION=@VERSION@" >$(srcdir)/rpm.release; \
echo "RELEASE=$$RELEASE" >>$(srcdir)/rpm.release; \
sed 's/^Release: .*/Release: '$$RELEASE'/' \
<ilbc.spec >ilbc.spec.new; \
mv ilbc.spec.new ilbc.spec

View File

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

View File

@ -1,4 +0,0 @@
VoIPcodecs 0.0.1 - A set of commonly used, unencumbered, codecs for VoIP
------------------------------------------------------------------------
Steve Underwood <steveu@coppice.org>

View File

@ -1,289 +0,0 @@
#
# iLBC - a library for the iLBC codec
#
# configure.ac -- Process this file with autoconf to produce configure
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU 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.
#
# $Id: configure.ac,v 1.1.1.1 2008/02/15 12:15:54 steveu Exp $
# @start 1
AC_INIT([ilbc], [0.0.1])
CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
AC_DEFUN([AX_COMPILER_VENDOR],
[
AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
[ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
# note: don't check for GCC first, since some other compilers define __GNUC__
for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
#if !($vencpp)
thisisanerror;
#endif
])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break])
done
])
])
ILBC_LT_CURRENT=0
ILBC_LT_REVISION=2
ILBC_LT_AGE=0
AC_SUBST(ILBC_LT_CURRENT)
AC_SUBST(ILBC_LT_REVISION)
AC_SUBST(ILBC_LT_AGE)
AC_CONFIG_SRCDIR([src/iLBC_encode.c])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_HEADERS([src/config.h:config-h.in])
AM_INIT_AUTOMAKE
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
AC_PROG_CC
AC_PROG_CXX
AC_PROG_GCC_TRADITIONAL
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_LANG([C])
AX_COMPILER_VENDOR
if test "${build}" != "${host}"
then
# If we are doing a Canadian Cross, in which the host and build systems
# are not the same, we set reasonable default values for the tools.
CC=${CC-${host_alias}-gcc}
CFLAGS=${CFLAGS-"-g -O2"}
CXX=${CXX-${host_alias}-c++}
CXXFLAGS=${CXXFLAGS-"-g -O2"}
CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
else
# Set reasonable default values for some tools even if not Canadian.
# Of course, these are different reasonable default values, originally
# specified directly in the Makefile.
# We don't export, so that autoconf can do its job.
# Note that all these settings are above the fragment inclusion point
# in Makefile.in, so can still be overridden by fragments.
# This is all going to change when we autoconfiscate...
CC_FOR_BUILD="\$(CC)"
AC_PROG_CC
# We must set the default linker to the linker used by gcc for the correct
# operation of libtool. If LD is not defined and we are using gcc, try to
# set the LD default to the ld used by gcc.
if test -z "$LD"
then
if test "$GCC" = yes
then
case $build in
*-*-mingw*)
gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
*)
gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
esac
case $gcc_prog_ld in
# Accept absolute paths.
[[\\/]* | [A-Za-z]:[\\/]*)]
LD="$gcc_prog_ld" ;;
esac
fi
fi
CXX=${CXX-"c++"}
CFLAGS=${CFLAGS-"-g -O2"}
CXXFLAGS=${CXXFLAGS-"-g -O2"}
fi
AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
AC_CHECK_TYPES(long long)
AC_CHECK_TYPES(long double)
AC_TYPE_SIGNAL
AC_ARG_ENABLE(doc, [ --enable-doc Build the documentation])
AC_ARG_ENABLE(tests, [ --enable-tests Build the test programs])
AC_ARG_ENABLE(mmx, [ --enable-mmx Enable MMX support])
AC_ARG_ENABLE(sse, [ --enable-sse Enable SSE support])
AC_ARG_ENABLE(fixed_point, [ --enable-fixed-point Enable fixed point support])
AC_FUNC_ERROR_AT_LINE
AC_FUNC_VPRINTF
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([memmove])
AC_CHECK_FUNCS([memset])
AC_CHECK_FUNCS([select])
AC_CHECK_FUNCS([strcasecmp])
AC_CHECK_FUNCS([strchr])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([strerror])
AC_CHECK_FUNCS([strstr])
AC_CHECK_FUNCS([strtol])
AC_CHECK_FUNCS([gettimeofday])
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
# Check for header files.
AC_CHECK_HEADERS([socket.h])
AC_CHECK_HEADERS([inttypes.h], [INSERT_INTTYPES_HEADER="#include <inttypes.h>"])
AC_CHECK_HEADERS([stdint.h], [INSERT_STDINT_HEADER="#include <stdint.h>"])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([strings.h])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([tgmath.h], [INSERT_TGMATH_HEADER="#include <tgmath.h>"])
AC_CHECK_HEADERS([math.h], [INSERT_MATH_HEADER="#include <math.h>"])
AC_CHECK_HEADERS([float.h])
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([sys/select.h])
AC_CHECK_HEADERS([sys/ioctl.h])
AC_CHECK_HEADERS([sys/fcntl.h])
AC_CHECK_HEADERS([audiofile.h])
if test "${build}" = "${host}"
then
AC_CHECK_HEADERS([X11/X.h])
fi
AC_LANG([C++])
if test "${build}" = "${host}"
then
case "${host}" in
x86_64-*)
AC_CHECK_FILE([${prefix}/lib64], libdir='$(exec_prefix)/lib64')
;;
esac
fi
AC_LANG([C])
if test "${build}" = "${host}"
then
case "${host}" in
x86_64-*)
# X86_64 Linux machines may have both 64 bit and 32 bit libraries. We need to choose the right set
AC_CHECK_FILE([/usr/X11R6/lib64], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib64"], AC_CHECK_FILE([/usr/X11R6/lib], [TESTLIBS="$TESTLIBS -L/usr/X11R6/lib"]))
;;
esac
fi
# Checks for libraries.
AC_CHECK_LIB([m], [cos])
AC_CHECK_LIB([m], [pow])
AC_CHECK_LIB([m], [sqrt])
if test -n "$enable_tests" ; then
AC_LANG([C++])
AC_LANG([C])
AC_CHECK_LIB([audiofile], [afOpenFile], TESTLIBS="$TESTLIBS -laudiofile", AC_MSG_ERROR("Can't make tests without libaudiofile (does your system require a libaudiofile-devel package?)"))
AC_CHECK_LIB([fftw3], [fftw_plan_dft_1d], TESTLIBS="$TESTLIBS -lfftw3")
AC_CHECK_LIB([fftw], [fftw_create_plan], TESTLIBS="$TESTLIBS -lfftw")
fi
AC_ARG_ENABLE([enable_64], [AS_HELP_STRING([--enable-64], [Enable 64bit compilation])], [enable_64="$enableval"], [enable_64="no"])
case "${ax_cv_c_compiler_vendor}" in
gnu)
COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
if test "$enable_sse" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse $COMP_VENDOR_CFLAGS"
fi
if test "$enable_mmx" = "yes" ; then
COMP_VENDOR_CFLAGS="-mmmx $COMP_VENDOR_CFLAGS"
fi
;;
sun)
COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -D__FUNCTION__=__func__ -xvpara"
if test "$enable_64" = "yes" ; then
COMP_VENDOR_CFLAGS="-m64 $COMP_VENDOR_CFLAGS"
fi
;;
*)
COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
;;
esac
COMP_VENDOR_CFLAGS="-DNDEBUG $COMP_VENDOR_CFLAGS"
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])
if test "$enable_fixed_point" = "yes" ; then
AC_DEFINE([ILBC_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
ILBC_USE_FIXED_POINT="#define ILBC_USE_FIXED_POINT 1"
else
#
# So far we deal with the embedded ARM, Blackfin, MIPS, TI DSP and XScale processors as
# things which lack fast hardware floating point.
#
# Other candidates would be the small embedded Power PCs.
#
case $basic_machine in
arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] \
| bfin \
| mips | mipsbe | mipseb | mipsel | mipsle \
| tic54x | c54x* | tic55x | c55x* | tic6x | c6x* \
| xscale | xscalee[bl] \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| bfin-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| xscale-* | xscalee[bl]-* )
AC_DEFINE([ILBC_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
ILBC_USE_FIXED_POINT="#define ILBC_USE_FIXED_POINT 1"
;;
*)
ILBC_USE_FIXED_POINT="#undef ILBC_USE_FIXED_POINT"
;;
esac
fi
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(COMP_VENDOR_CFLAGS)
AC_SUBST(TESTLIBS)
AC_SUBST(ILBC_USE_FIXED_POINT)
AC_SUBST(INSERT_INTTYPES_HEADER)
AC_SUBST(INSERT_STDINT_HEADER)
AC_SUBST(INSERT_TGMATH_HEADER)
AC_SUBST(INSERT_MATH_HEADER)
AC_CONFIG_FILES([Makefile
doc/Makefile
localtests/Makefile
src/Makefile
src/ilbc.h
tests/Makefile
ilbc.spec])
AC_OUTPUT
# @end 1

View File

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

View File

@ -1,6 +0,0 @@
ilbc (0.0.1) unstable; urgency=low
[ Steve Underwood ]
* Begun
-- Steve Underwood <steveu@coppice.org> Thu, 15 Feb 2008 09:53:06 +0300

View File

@ -1 +0,0 @@
4

View File

@ -1,35 +0,0 @@
Source: ilbc
Section: libs
Priority: optional
Maintainer: Debian VoIP Team <pkg-voip-maintainers@lists.alioth.debian.org>
Uploaders: Jose Carlos Garcia Sogo <jsogo@debian.org>, Kilian Krause <kilian@debian.org>, Santiago Garcia Mantinan <manty@debian.org>, Mark Purcell <msp@debian.org>, Tzafrir Cohen <tzafrir.cohen@xorcom.com>, Santiago Ruano Rincón <santiago@debian.org>
Build-Depends: debhelper (>= 4.0.0), dpatch, doxygen, autotools-dev
Standards-Version: 3.7.2
XS-Vcs-Svn: svn://svn.debian.org/pkg-voip/
XS-Vcs-Browser: http://svn.debian.org/wsvn/pkg-voip/
Package: libilbc
Architecture: any
Depends: ${shlibs:Depends}
Conflicts: libilbc0, libilbc1, libilbc2
Description: Telephony signal processing library
This package contains the iLBC low bit rate speech codec.
.
This package contains the shared library.
Package: libilbc-dev
Section: libdevel
Architecture: any
Depends: libilbc3 (= ${Source-Version})
Description: Telephony signal processing library
This package contains the iLBC low bit rate speech codec.
.
This package contains the static library and development headers.
.
Homepage: http://www.soft-switch.org/
Package: libilbc-doc
Section: doc
Architecture: all
Description: Documentation for the ilbc signal processing library
This package contains the iLBC low bit rate speech codec.

View File

@ -1,10 +0,0 @@
This package was debianized by Steve Underwood <steveu@coppice.org> on
Thu, 15 Feb 2008 15:22:58 +0100.
It was downloaded from http://soft-switch.org/downloads/voipcodecs/
Copyright: The Internet Society and Steve Underwood <steveu@coppice.org>
License:
Global IP Sound iLBC Public License, v2.0

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,29 +0,0 @@
##
## iLBC - a library for the iLBC codec
##
## Makefile.am -- Process this file with automake to produce Makefile.in
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License version 2, as
## published by the Free Software Foundation.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Id: Makefile.am,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = css.css \
wrapper.xsl
all: doxydocs
doxydocs:
doxygen libilbc-doxygen

View File

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

File diff suppressed because it is too large Load Diff

View File

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

Binary file not shown.

View File

@ -1,65 +0,0 @@
Summary: iLBC is a library for the iLBC low bit rate speech codec.
Name: ilbc
Version: 0.0.1
Release: 1
License: Global IP Sound iLBC Public License, v2.0
Group: System Environment/Libraries
URL: http://www.soft-switch.org/voipcodecs
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Source: http://www.soft-switch.org/downloads/voipcodecs/ilbc-0.0.1.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Docdir: %{_prefix}/doc
BuildRequires: audiofile-devel
BuildRequires: doxygen
%description
iLBC is a library for the iLBC low bit rate speech codec.
%package devel
Summary: iLBC development files
Group: Development/Libraries
Requires: ilbc = %{version}
PreReq: /sbin/install-info
%description devel
iLBC development files.
%prep
%setup -q
%build
%configure --enable-doc --disable-static --disable-rpath
make
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
rm %{buildroot}%{_libdir}/libilbc.la
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc ChangeLog AUTHORS COPYING NEWS README
%{_libdir}/libilbc.so.*
%{_datadir}/ilbc
%files devel
%defattr(-,root,root,-)
%doc doc/api
%{_includedir}/ilbc.h
%{_includedir}/ilbc
%{_libdir}/libilbc.so
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog
* Thu Feb 7 2008 Steve Underwood <steveu@coppice.org> 0.0.1
- First pass

View File

@ -1,65 +0,0 @@
Summary: iLBC is a library for the iLBC low bit rate speech codec.
Name: @PACKAGE@
Version: @VERSION@
Release: 1
License: Global IP Sound iLBC Public License, v2.0
Group: System Environment/Libraries
URL: http://www.soft-switch.org/voipcodecs
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Source: http://www.soft-switch.org/downloads/voipcodecs/@PACKAGE@-@VERSION@.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Docdir: %{_prefix}/doc
BuildRequires: audiofile-devel
BuildRequires: doxygen
%description
iLBC is a library for the iLBC low bit rate speech codec.
%package devel
Summary: iLBC development files
Group: Development/Libraries
Requires: ilbc = %{version}
PreReq: /sbin/install-info
%description devel
iLBC development files.
%prep
%setup -q
%build
%configure --enable-doc --disable-static --disable-rpath
make
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
rm %{buildroot}%{_libdir}/libilbc.la
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc ChangeLog AUTHORS COPYING NEWS README
%{_libdir}/libilbc.so.*
%{_datadir}/ilbc
%files devel
%defattr(-,root,root,-)
%doc doc/api
%{_includedir}/ilbc.h
%{_includedir}/ilbc
%{_libdir}/libilbc.so
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog
* Thu Feb 7 2008 Steve Underwood <steveu@coppice.org> 0.0.1
- First pass

View File

@ -1,489 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="libilbc"
ProjectGUID="{9A5DDF08-C88C-4A35-B7F6-D605228446BD}"
RootNamespace="libilbc"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="src; src\ilbc; src\msvc"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBilbc_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="src; src\ilbc; src\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBilbc_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="src; src\ilbc; src\msvc"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBilbc_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="src; src\ilbc; src\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBilbc_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\src\anaFilter.c"
>
</File>
<File
RelativePath=".\src\constants.c"
>
</File>
<File
RelativePath=".\src\createCB.c"
>
</File>
<File
RelativePath=".\src\doCPLC.c"
>
</File>
<File
RelativePath=".\src\enhancer.c"
>
</File>
<File
RelativePath=".\src\filter.c"
>
</File>
<File
RelativePath=".\src\FrameClassify.c"
>
</File>
<File
RelativePath=".\src\gainquant.c"
>
</File>
<File
RelativePath=".\src\getCBvec.c"
>
</File>
<File
RelativePath=".\src\helpfun.c"
>
</File>
<File
RelativePath=".\src\hpInput.c"
>
</File>
<File
RelativePath=".\src\hpOutput.c"
>
</File>
<File
RelativePath=".\src\iCBConstruct.c"
>
</File>
<File
RelativePath=".\src\iCBSearch.c"
>
</File>
<File
RelativePath=".\src\iLBC_decode.c"
>
</File>
<File
RelativePath=".\src\iLBC_encode.c"
>
</File>
<File
RelativePath=".\src\LPCdecode.c"
>
</File>
<File
RelativePath=".\src\LPCencode.c"
>
</File>
<File
RelativePath=".\src\lsf.c"
>
</File>
<File
RelativePath=".\src\packing.c"
>
</File>
<File
RelativePath=".\src\StateConstructW.c"
>
</File>
<File
RelativePath=".\src\StateSearchW.c"
>
</File>
<File
RelativePath=".\src\syntFilter.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\src\anaFilter.h"
>
</File>
<File
RelativePath=".\src\constants.h"
>
</File>
<File
RelativePath=".\src\createCB.h"
>
</File>
<File
RelativePath=".\src\doCPLC.h"
>
</File>
<File
RelativePath=".\src\enhancer.h"
>
</File>
<File
RelativePath=".\src\filter.h"
>
</File>
<File
RelativePath=".\src\FrameClassify.h"
>
</File>
<File
RelativePath=".\src\gainquant.h"
>
</File>
<File
RelativePath=".\src\getCBvec.h"
>
</File>
<File
RelativePath=".\src\helpfun.h"
>
</File>
<File
RelativePath=".\src\hpInput.h"
>
</File>
<File
RelativePath=".\src\hpOutput.h"
>
</File>
<File
RelativePath=".\src\iCBConstruct.h"
>
</File>
<File
RelativePath=".\src\iCBSearch.h"
>
</File>
<File
RelativePath=".\src\ilbc\ilbc.h"
>
</File>
<File
RelativePath=".\src\iLBC_define.h"
>
</File>
<File
RelativePath=".\src\LPCdecode.h"
>
</File>
<File
RelativePath=".\src\LPCencode.h"
>
</File>
<File
RelativePath=".\src\lsf.h"
>
</File>
<File
RelativePath=".\src\packing.h"
>
</File>
<File
RelativePath=".\src\StateConstructW.h"
>
</File>
<File
RelativePath=".\src\StateSearchW.h"
>
</File>
<File
RelativePath=".\src\syntFilter.h"
>
</File>
<File
RelativePath=".\src\ilbc\version.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,162 +0,0 @@
<?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>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\anaFilter.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\constants.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\createCB.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\doCPLC.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\enhancer.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\filter.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\FrameClassify.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\gainquant.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\getCBvec.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\helpfun.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\hpInput.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\hpOutput.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\iCBConstruct.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\iCBSearch.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\iLBC_decode.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\iLBC_encode.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\LPCdecode.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\LPCencode.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\lsf.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\packing.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\StateConstructW.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\StateSearchW.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\syntFilter.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\anaFilter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\constants.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\createCB.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\doCPLC.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\enhancer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\filter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\FrameClassify.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\gainquant.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\getCBvec.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\helpfun.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\hpInput.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\hpOutput.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\iCBConstruct.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\iCBSearch.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ilbc\ilbc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\iLBC_define.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\LPCdecode.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\LPCencode.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\lsf.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\packing.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\StateConstructW.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\StateSearchW.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\syntFilter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\ilbc\version.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -1,357 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="libilbc"
ProjectGUID="{7C43DBD8-6893-4CD2-B7C0-D2E51F8B1FD3}"
RootNamespace="libilbc"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="src; src\ilbc; src\msvc"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBilbc_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="src; src\ilbc; src\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBilbc_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
DisableSpecificWarnings="4127"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\src\anaFilter.c"
>
</File>
<File
RelativePath=".\src\constants.c"
>
</File>
<File
RelativePath=".\src\createCB.c"
>
</File>
<File
RelativePath=".\src\doCPLC.c"
>
</File>
<File
RelativePath=".\src\enhancer.c"
>
</File>
<File
RelativePath=".\src\filter.c"
>
</File>
<File
RelativePath=".\src\FrameClassify.c"
>
</File>
<File
RelativePath=".\src\gainquant.c"
>
</File>
<File
RelativePath=".\src\getCBvec.c"
>
</File>
<File
RelativePath=".\src\helpfun.c"
>
</File>
<File
RelativePath=".\src\hpInput.c"
>
</File>
<File
RelativePath=".\src\hpOutput.c"
>
</File>
<File
RelativePath=".\src\iCBConstruct.c"
>
</File>
<File
RelativePath=".\src\iCBSearch.c"
>
</File>
<File
RelativePath=".\src\iLBC_decode.c"
>
</File>
<File
RelativePath=".\src\iLBC_encode.c"
>
</File>
<File
RelativePath=".\src\LPCdecode.c"
>
</File>
<File
RelativePath=".\src\LPCencode.c"
>
</File>
<File
RelativePath=".\src\lsf.c"
>
</File>
<File
RelativePath=".\src\packing.c"
>
</File>
<File
RelativePath=".\src\StateConstructW.c"
>
</File>
<File
RelativePath=".\src\StateSearchW.c"
>
</File>
<File
RelativePath=".\src\syntFilter.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\src\anaFilter.h"
>
</File>
<File
RelativePath=".\src\constants.h"
>
</File>
<File
RelativePath=".\src\createCB.h"
>
</File>
<File
RelativePath=".\src\doCPLC.h"
>
</File>
<File
RelativePath=".\src\enhancer.h"
>
</File>
<File
RelativePath=".\src\filter.h"
>
</File>
<File
RelativePath=".\src\FrameClassify.h"
>
</File>
<File
RelativePath=".\src\gainquant.h"
>
</File>
<File
RelativePath=".\src\getCBvec.h"
>
</File>
<File
RelativePath=".\src\helpfun.h"
>
</File>
<File
RelativePath=".\src\hpInput.h"
>
</File>
<File
RelativePath=".\src\hpOutput.h"
>
</File>
<File
RelativePath=".\src\iCBConstruct.h"
>
</File>
<File
RelativePath=".\src\iCBSearch.h"
>
</File>
<File
RelativePath=".\src\ilbc\ilbc.h"
>
</File>
<File
RelativePath=".\src\iLBC_define.h"
>
</File>
<File
RelativePath=".\src\LPCdecode.h"
>
</File>
<File
RelativePath=".\src\LPCencode.h"
>
</File>
<File
RelativePath=".\src\lsf.h"
>
</File>
<File
RelativePath=".\src\packing.h"
>
</File>
<File
RelativePath=".\src\StateConstructW.h"
>
</File>
<File
RelativePath=".\src\StateSearchW.h"
>
</File>
<File
RelativePath=".\src\syntFilter.h"
>
</File>
<File
RelativePath=".\src\ilbc\version.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,39 +0,0 @@
##
## VoIPcodecs - a series of DSP components for telephony
##
## Makefile.am -- Process this file with automake to produce Makefile.in
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License version 2, as
## published by the Free Software Foundation.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Id: Makefile.am,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
SUBDIRS =
DIST_SUBDIRS =
EXTRA_DIST = clean.chn \
iLBC.INP \
iLBC_20ms.BIT \
iLBC_20ms_clean.OUT \
iLBC_20ms_tlm05.OUT \
iLBC_30ms.BIT \
iLBC_30ms_clean.OUT \
iLBC_30ms_tlm05.OUT \
iLBC_test.txt \
short_nb_voice.wav \
tlm05.chn
all:
clean:

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,10 +0,0 @@
#Test iLBC executable for 20 and 30 ms frames on a clean channel
./iLBC_test 20 iLBC.INP iLBC_20ms.BIT iLBC_20ms_clean.OUT clean.chn
./iLBC_test 30 iLBC.INP iLBC_30ms.BIT iLBC_30ms_clean.OUT clean.chn
#Test iLBC executable for 20 and 30 ms frames on a channel with ~5% packet losses
./iLBC_test 20 iLBC.INP tmp.BIT iLBC_20ms_tlm05.OUT tlm05.chn
./iLBC_test 30 iLBC.INP tmp.BIT iLBC_30ms_tlm05.OUT tlm05.chn

Binary file not shown.

View File

@ -1,131 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* FrameClassify.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: FrameClassify.c,v 1.2 2008/03/06 12:27:37 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <string.h>
#include "ilbc.h"
#include "FrameClassify.h"
/*---------------------------------------------------------------*
* Classification of subframes to localize start state
*--------------------------------------------------------------*/
int FrameClassify( /* index to the max-energy sub-frame */
ilbc_encode_state_t *iLBCenc_inst, /* (i/o) the encoder state structure */
float *residual) /* (i) lpc residual signal */
{
float max_ssqEn;
float fssqEn[ILBC_NUM_SUB_MAX];
float bssqEn[ILBC_NUM_SUB_MAX];
float *pp;
int n;
int l;
int max_ssqEn_n;
static const float ssqEn_win[ILBC_NUM_SUB_MAX - 1] =
{
0.8f, 0.9f,
1.0f, 0.9f, 0.8f
};
static const float sampEn_win[5]=
{
1.0f/6.0f,
2.0f/6.0f, 3.0f/6.0f,
4.0f/6.0f, 5.0f/6.0f
};
/* init the front and back energies to zero */
memset(fssqEn, 0, ILBC_NUM_SUB_MAX*sizeof(float));
memset(bssqEn, 0, ILBC_NUM_SUB_MAX*sizeof(float));
/* Calculate front of first sequence */
n = 0;
pp = residual;
for (l = 0; l < 5; l++)
{
fssqEn[n] += sampEn_win[l]*(*pp)*(*pp);
pp++;
}
for (l = 5; l < SUBL; l++)
{
fssqEn[n] += (*pp)*(*pp);
pp++;
}
/* Calculate front and back of all middle sequences */
for (n = 1; n < iLBCenc_inst->nsub - 1; n++)
{
pp = residual + n*SUBL;
for (l = 0; l < 5; l++)
{
fssqEn[n] += sampEn_win[l]*(*pp)*(*pp);
bssqEn[n] += (*pp)*(*pp);
pp++;
}
for (l = 5; l < SUBL - 5; l++)
{
fssqEn[n] += (*pp)*(*pp);
bssqEn[n] += (*pp)*(*pp);
pp++;
}
for (l = SUBL - 5; l < SUBL; l++)
{
fssqEn[n] += (*pp)*(*pp);
bssqEn[n] += sampEn_win[SUBL - l - 1]*(*pp)*(*pp);
pp++;
}
}
/* Calculate back of last sequence */
n = iLBCenc_inst->nsub - 1;
pp = residual + n*SUBL;
for (l = 0; l < SUBL - 5; l++)
{
bssqEn[n] += (*pp)*(*pp);
pp++;
}
for (l = SUBL - 5; l < SUBL; l++)
{
bssqEn[n] += sampEn_win[SUBL - l - 1]*(*pp)*(*pp);
pp++;
}
/* find the index to the weighted 80 sample with
most energy */
l = (iLBCenc_inst->mode == 20) ? 1 : 0;
max_ssqEn = (fssqEn[0] + bssqEn[1])*ssqEn_win[l];
max_ssqEn_n = 1;
for (n = 2; n < iLBCenc_inst->nsub; n++)
{
l++;
if ((fssqEn[n - 1] + bssqEn[n])*ssqEn_win[l] > max_ssqEn)
{
max_ssqEn = (fssqEn[n - 1] + bssqEn[n])*ssqEn_win[l];
max_ssqEn_n = n;
}
}
return max_ssqEn_n;
}

View File

@ -1,27 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* FrameClassify.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: FrameClassify.h,v 1.2 2008/03/06 12:27:37 steveu Exp $
*/
#ifndef __iLBC_FRAMECLASSIFY_H
#define __iLBC_FRAMECLASSIFY_H
int FrameClassify( /* index to the max-energy sub-frame */
ilbc_encode_state_t *iLBCenc_inst, /* (i/o) the encoder state structure */
float *residual); /* (i) lpc residual signal */
#endif

View File

@ -1,149 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* LPCdecode.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: LPCdecode.c,v 1.2 2008/03/06 12:27:37 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <math.h>
#include <string.h>
#include "ilbc.h"
#include "helpfun.h"
#include "lsf.h"
#include "constants.h"
#include "LPCdecode.h"
/*---------------------------------------------------------------*
* interpolation of lsf coefficients for the decoder
*--------------------------------------------------------------*/
void LSFinterpolate2a_dec(float *a, /* (o) lpc coefficients for a sub-frame */
float *lsf1, /* (i) first lsf coefficient vector */
float *lsf2, /* (i) second lsf coefficient vector */
float coef, /* (i) interpolation weight */
int length) /* (i) length of lsf vectors */
{
float lsftmp[ILBC_LPC_FILTERORDER];
interpolate(lsftmp, lsf1, lsf2, coef, length);
lsf2a(a, lsftmp);
}
/*---------------------------------------------------------------*
* obtain dequantized lsf coefficients from quantization index
*--------------------------------------------------------------*/
void SimplelsfDEQ(float *lsfdeq, /* (o) dequantized lsf coefficients */
int *index, /* (i) quantization index */
int lpc_n) /* (i) number of LPCs */
{
int i;
int j;
int pos;
int cb_pos;
/* decode first LSF */
pos = 0;
cb_pos = 0;
for (i = 0; i < LSF_NSPLIT; i++)
{
for (j = 0; j < dim_lsfCbTbl[i]; j++)
lsfdeq[pos + j] = lsfCbTbl[cb_pos + (int32_t) (index[i])*dim_lsfCbTbl[i] + j];
pos += dim_lsfCbTbl[i];
cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i];
}
if (lpc_n>1)
{
/* decode last LSF */
pos = 0;
cb_pos = 0;
for (i = 0; i < LSF_NSPLIT; i++)
{
for (j = 0; j < dim_lsfCbTbl[i]; j++)
{
lsfdeq[ILBC_LPC_FILTERORDER + pos + j] =
lsfCbTbl[cb_pos + (int32_t) (index[LSF_NSPLIT + i])*dim_lsfCbTbl[i] + j];
}
pos += dim_lsfCbTbl[i];
cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i];
}
}
}
/*----------------------------------------------------------------*
* obtain synthesis and weighting filters form lsf coefficients
*---------------------------------------------------------------*/
void DecoderInterpolateLSF(float *syntdenum, /* (o) synthesis filter coefficients */
float *weightdenum, /* (o) weighting denumerator coefficients */
float *lsfdeq, /* (i) dequantized lsf coefficients */
int length, /* (i) length of lsf coefficient vector */
ilbc_decode_state_t *iLBCdec_inst) /* (i) the decoder state structure */
{
int i;
int pos;
int lp_length;
float lp[ILBC_LPC_FILTERORDER + 1];
float *lsfdeq2;
lsfdeq2 = lsfdeq + length;
lp_length = length + 1;
if (iLBCdec_inst->mode == 30)
{
/* sub-frame 1: Interpolation between old and first */
LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold, lsfdeq,
lsf_weightTbl_30ms[0], length);
memcpy(syntdenum,lp,lp_length*sizeof(float));
bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
/* sub-frames 2 to 6: interpolation between first and last LSF */
pos = lp_length;
for (i = 1; i < 6; i++)
{
LSFinterpolate2a_dec(lp, lsfdeq, lsfdeq2, lsf_weightTbl_30ms[i], length);
memcpy(syntdenum + pos,lp,lp_length*sizeof(float));
bwexpand(weightdenum + pos, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
pos += lp_length;
}
}
else
{
pos = 0;
for (i = 0; i < iLBCdec_inst->nsub; i++)
{
LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold, lsfdeq, lsf_weightTbl_20ms[i], length);
memcpy(syntdenum + pos, lp, lp_length*sizeof(float));
bwexpand(weightdenum + pos, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
pos += lp_length;
}
}
/* update memory */
if (iLBCdec_inst->mode == 30)
memcpy(iLBCdec_inst->lsfdeqold, lsfdeq2, length*sizeof(float));
else
memcpy(iLBCdec_inst->lsfdeqold, lsfdeq, length*sizeof(float));
}

View File

@ -1,39 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* LPCdecode.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: LPCdecode.h,v 1.2 2008/03/06 12:27:37 steveu Exp $
*/
#ifndef __iLBC_LPCDECODE_H
#define __iLBC_LPCDECODE_H
void LSFinterpolate2a_dec(float *a, /* (o) lpc coefficients for a sub-frame */
float *lsf1, /* (i) first lsf coefficient vector */
float *lsf2, /* (i) second lsf coefficient vector */
float coef, /* (i) interpolation weight */
int length); /* (i) length of lsf vectors */
void SimplelsfDEQ(float *lsfdeq, /* (o) dequantized lsf coefficients */
int *index, /* (i) quantization index */
int lpc_n); /* (i) number of LPCs */
void DecoderInterpolateLSF(float *syntdenum, /* (o) synthesis filter coefficients */
float *weightdenum, /* (o) weighting denumerator coefficients */
float *lsfdeq, /* (i) dequantized lsf coefficients */
int length, /* (i) length of lsf coefficient vector */
ilbc_decode_state_t *iLBCdec_inst); /* (i) the decoder state structure */
#endif

View File

@ -1,229 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* LPCencode.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: LPCencode.c,v 1.2 2008/03/06 12:27:37 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <string.h>
#include "ilbc.h"
#include "helpfun.h"
#include "lsf.h"
#include "constants.h"
#include "LPCencode.h"
/*----------------------------------------------------------------*
* lpc analysis (subroutine to LPCencode)
*---------------------------------------------------------------*/
static void SimpleAnalysis(float *lsf, /* (o) lsf coefficients */
float *data, /* (i) new data vector */
ilbc_encode_state_t *iLBCenc_inst) /* (i/o) the encoder state structure */
{
int k;
int is;
float temp[ILBC_BLOCK_LEN_MAX];
float lp[ILBC_LPC_FILTERORDER + 1];
float lp2[ILBC_LPC_FILTERORDER + 1];
float r[ILBC_LPC_FILTERORDER + 1];
is = LPC_LOOKBACK + ILBC_BLOCK_LEN_MAX - iLBCenc_inst->blockl;
memcpy(iLBCenc_inst->lpc_buffer + is, data, iLBCenc_inst->blockl*sizeof(float));
/* No lookahead, last window is asymmetric */
for (k = 0; k < iLBCenc_inst->lpc_n; k++)
{
is = LPC_LOOKBACK;
if (k < (iLBCenc_inst->lpc_n - 1))
window(temp, lpc_winTbl, iLBCenc_inst->lpc_buffer, ILBC_BLOCK_LEN_MAX);
else
window(temp, lpc_asymwinTbl, iLBCenc_inst->lpc_buffer + is, ILBC_BLOCK_LEN_MAX);
autocorr(r, temp, ILBC_BLOCK_LEN_MAX, ILBC_LPC_FILTERORDER);
window(r, r, lpc_lagwinTbl, ILBC_LPC_FILTERORDER + 1);
levdurb(lp, temp, r, ILBC_LPC_FILTERORDER);
bwexpand(lp2, lp, LPC_CHIRP_SYNTDENUM, ILBC_LPC_FILTERORDER + 1);
a2lsf(lsf + k*ILBC_LPC_FILTERORDER, lp2);
}
is = LPC_LOOKBACK + ILBC_BLOCK_LEN_MAX - iLBCenc_inst->blockl;
memmove(iLBCenc_inst->lpc_buffer,
iLBCenc_inst->lpc_buffer + LPC_LOOKBACK + ILBC_BLOCK_LEN_MAX - is,
is*sizeof(float));
}
/*----------------------------------------------------------------*
* lsf interpolator and conversion from lsf to a coefficients
* (subroutine to SimpleInterpolateLSF)
*---------------------------------------------------------------*/
static void LSFinterpolate2a_enc(float *a, /* (o) lpc coefficients */
float *lsf1, /* (i) first set of lsf coefficients */
float *lsf2, /* (i) second set of lsf coefficients */
float coef, /* (i) weighting coefficient to use between lsf1 and lsf2 */
long length) /* (i) length of coefficient vectors */
{
float lsftmp[ILBC_LPC_FILTERORDER];
interpolate(lsftmp, lsf1, lsf2, coef, length);
lsf2a(a, lsftmp);
}
/*----------------------------------------------------------------*
* lsf interpolator (subrutine to LPCencode)
*---------------------------------------------------------------*/
static void SimpleInterpolateLSF(float *syntdenum, /* (o) the synthesis filter denominator
resulting from the quantized
interpolated lsf */
float *weightdenum, /* (o) the weighting filter denominator
resulting from the unquantized
interpolated lsf */
float *lsf, /* (i) the unquantized lsf coefficients */
float *lsfdeq, /* (i) the dequantized lsf coefficients */
float *lsfold, /* (i) the unquantized lsf coefficients of
the previous signal frame */
float *lsfdeqold, /* (i) the dequantized lsf coefficients of
the previous signal frame */
int length, /* (i) should equate ILBC_LPC_FILTERORDER */
ilbc_encode_state_t *iLBCenc_inst) /* (i/o) the encoder state structure */
{
int i;
int pos;
int lp_length;
float lp[ILBC_LPC_FILTERORDER + 1];
float *lsf2;
float *lsfdeq2;
lsf2 = lsf + length;
lsfdeq2 = lsfdeq + length;
lp_length = length + 1;
if (iLBCenc_inst->mode == 30)
{
/* sub-frame 1: Interpolation between old and first
set of lsf coefficients */
LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq, lsf_weightTbl_30ms[0], length);
memcpy(syntdenum,lp,lp_length*sizeof(float));
LSFinterpolate2a_enc(lp, lsfold, lsf, lsf_weightTbl_30ms[0], length);
bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
/* sub-frame 2 to 6: Interpolation between first
and second set of lsf coefficients */
pos = lp_length;
for (i = 1; i < iLBCenc_inst->nsub; i++)
{
LSFinterpolate2a_enc(lp, lsfdeq, lsfdeq2, lsf_weightTbl_30ms[i], length);
memcpy(syntdenum + pos,lp,lp_length*sizeof(float));
LSFinterpolate2a_enc(lp, lsf, lsf2, lsf_weightTbl_30ms[i], length);
bwexpand(weightdenum + pos, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
pos += lp_length;
}
}
else
{
pos = 0;
for (i = 0; i < iLBCenc_inst->nsub; i++)
{
LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq, lsf_weightTbl_20ms[i], length);
memcpy(syntdenum + pos, lp, lp_length*sizeof(float));
LSFinterpolate2a_enc(lp, lsfold, lsf, lsf_weightTbl_20ms[i], length);
bwexpand(weightdenum + pos, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
pos += lp_length;
}
}
/* update memory */
if (iLBCenc_inst->mode == 30)
{
memcpy(lsfold, lsf2, length*sizeof(float));
memcpy(lsfdeqold, lsfdeq2, length*sizeof(float));
}
else
{
memcpy(lsfold, lsf, length*sizeof(float));
memcpy(lsfdeqold, lsfdeq, length*sizeof(float));
}
}
/*----------------------------------------------------------------*
* lsf quantizer (subrutine to LPCencode)
*---------------------------------------------------------------*/
static void SimplelsfQ(float *lsfdeq, /* (o) dequantized lsf coefficients (dimension FILTERORDER) */
int *index, /* (o) quantization index */
float *lsf, /* (i) the lsf coefficient vector to be quantized (dimension FILTERORDER ) */
int lpc_n) /* (i) number of lsf sets to quantize */
{
/* Quantize first LSF with memoryless split VQ */
SplitVQ(lsfdeq, index, lsf, lsfCbTbl, LSF_NSPLIT, dim_lsfCbTbl, size_lsfCbTbl);
if (lpc_n == 2)
{
/* Quantize second LSF with memoryless split VQ */
SplitVQ(lsfdeq + ILBC_LPC_FILTERORDER,
index + LSF_NSPLIT,
lsf + ILBC_LPC_FILTERORDER,
lsfCbTbl,
LSF_NSPLIT,
dim_lsfCbTbl,
size_lsfCbTbl);
}
}
/*----------------------------------------------------------------*
* lpc encoder
*---------------------------------------------------------------*/
void LPCencode(float *syntdenum, /* (i/o) synthesis filter coefficients
before/after encoding */
float *weightdenum, /* (i/o) weighting denumerator
coefficients before/after
encoding */
int *lsf_index, /* (o) lsf quantization index */
float *data, /* (i) lsf coefficients to quantize */
ilbc_encode_state_t *iLBCenc_inst) /* (i/o) the encoder state structure */
{
float lsf[ILBC_LPC_FILTERORDER*LPC_N_MAX];
float lsfdeq[ILBC_LPC_FILTERORDER*LPC_N_MAX];
int change = 0;
SimpleAnalysis(lsf, data, iLBCenc_inst);
SimplelsfQ(lsfdeq, lsf_index, lsf, iLBCenc_inst->lpc_n);
change = LSF_check(lsfdeq, ILBC_LPC_FILTERORDER, iLBCenc_inst->lpc_n);
SimpleInterpolateLSF(syntdenum,
weightdenum,
lsf,
lsfdeq,
iLBCenc_inst->lsfold,
iLBCenc_inst->lsfdeqold,
ILBC_LPC_FILTERORDER,
iLBCenc_inst);
}

View File

@ -1,31 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* LPCencode.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: LPCencode.h,v 1.2 2008/03/06 12:27:37 steveu Exp $
*/
#ifndef __iLBC_LPCENCODE_H
#define __iLBC_LPCENCODE_H
void LPCencode(float *syntdenum, /* (i/o) synthesis filter coefficients
before/after encoding */
float *weightdenum, /* (i/o) weighting denumerator coefficients
before/after encoding */
int *lsf_index, /* (o) lsf quantization index */
float *data, /* (i) lsf coefficients to quantize */
ilbc_encode_state_t *iLBCenc_inst); /* (i/o) the encoder state structure */
#endif

View File

@ -1,138 +0,0 @@
##
## iLBC - a library for the iLBC codec
##
## Makefile.am -- Process this file with automake to produce Makefile.in
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the Lesser GNU General Public License version 2.1, as
## published by the Free Software Foundation.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Id: Makefile.am,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAGS = -I$(top_builddir)
lib_LTLIBRARIES = libilbc.la
libilbc_la_SOURCES = anaFilter.c \
constants.c \
createCB.c \
doCPLC.c \
enhancer.c \
filter.c \
FrameClassify.c \
gainquant.c \
getCBvec.c \
helpfun.c \
hpInput.c \
hpOutput.c \
iCBConstruct.c \
iCBSearch.c \
iLBC_decode.c \
iLBC_encode.c \
LPCdecode.c \
LPCencode.c \
lsf.c \
packing.c \
StateConstructW.c \
StateSearchW.c \
syntFilter.c
libilbc_la_LDFLAGS = -version-info @ILBC_LT_CURRENT@:@ILBC_LT_REVISION@:@ILBC_LT_AGE@
nobase_include_HEADERS = ilbc/ilbc.h \
ilbc/version.h
nodist_include_HEADERS = ilbc.h
noinst_HEADERS = anaFilter.h \
constants.h \
createCB.h \
doCPLC.h \
enhancer.h \
filter.h \
FrameClassify.h \
gainquant.h \
getCBvec.h \
helpfun.h \
hpInput.h \
hpOutput.h \
iCBConstruct.h \
iCBSearch.h \
iLBC_define.h \
LPCdecode.h \
LPCencode.h \
lsf.h \
packing.h \
StateConstructW.h \
StateSearchW.h \
syntFilter.h
# We need to run at_dictionary_gen, so it generates the
# at_interpreter_dictionary.h file
DSP = libilbc.dsp
VCPROJ = libilbc.vcproj
WIN32SOURCES = $(libilbc_la_SOURCES) msvc/gettimeofday.c
WIN32HEADERS = $(nobase_include_HEADERS) ilbc.h
DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP)
VCPROJOUT = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ)
$(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) )
$(VCPROJ): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am
echo "creating $(VCPROJ)"
@(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ); \
for file in $(WIN32SOURCES); do \
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \
done; \
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT); \
for file in $(WIN32HEADERS); do \
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \
done; \
cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT) )
ilbc/version.h:
NOWDATE=`date --utc +"%Y%m%d"` ; \
NOWTIME=`date --utc +"%H%M%S"` ; \
sed 's/$$ilbc_RELEASE_DATE/'$$NOWDATE'/;s/$$ilbc_RELEASE_TIME/'$$NOWTIME'/' \
<ilbc/version.h.in >ilbc/version.h
dist-hook:
NOWDATE=`date --utc +"%Y%m%d"` ; \
NOWTIME=`date --utc +"%H%M%S"` ; \
sed 's/$$ilbc_RELEASE_DATE/'$$NOWDATE'/;s/$$ilbc_RELEASE_TIME/'$$NOWTIME'/' \
<ilbc/version.h.in >ilbc/version.h

View File

@ -1,82 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* StateConstruct.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: StateConstructW.c,v 1.2 2008/03/06 12:27:37 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <math.h>
#include <string.h>
#include "ilbc.h"
#include "constants.h"
#include "filter.h"
#include "StateConstructW.h"
/*----------------------------------------------------------------*
* decoding of the start state
*---------------------------------------------------------------*/
void StateConstructW(int idxForMax, /* (i) 6-bit index for the quantization of
max amplitude */
int *idxVec, /* (i) vector of quantization indexes */
float *syntDenum, /* (i) synthesis filter denumerator */
float *out, /* (o) the decoded state vector */
int len) /* (i) length of a state vector */
{
float maxVal;
float tmpbuf[ILBC_LPC_FILTERORDER + 2*STATE_LEN];
float *tmp;
float numerator[ILBC_LPC_FILTERORDER + 1];
float foutbuf[ILBC_LPC_FILTERORDER + 2*STATE_LEN];
float *fout;
int k;
int tmpi;
/* decoding of the maximum value */
maxVal = state_frgqTbl[idxForMax];
maxVal = powf(10.0f, maxVal)/4.5f;
/* initialization of buffers and coefficients */
memset(tmpbuf, 0, ILBC_LPC_FILTERORDER*sizeof(float));
memset(foutbuf, 0, ILBC_LPC_FILTERORDER*sizeof(float));
for (k = 0; k < ILBC_LPC_FILTERORDER; k++)
numerator[k] = syntDenum[ILBC_LPC_FILTERORDER - k];
numerator[ILBC_LPC_FILTERORDER] = syntDenum[0];
tmp = &tmpbuf[ILBC_LPC_FILTERORDER];
fout = &foutbuf[ILBC_LPC_FILTERORDER];
/* decoding of the sample values */
for (k = 0; k < len; k++)
{
tmpi = len - 1 - k;
/* maxVal = 1/scal */
tmp[k] = maxVal*state_sq3Tbl[idxVec[tmpi]];
}
/* circular convolution with all-pass filter */
memset(tmp + len, 0, len*sizeof(float));
ZeroPoleFilter(tmp, numerator, syntDenum, 2*len, ILBC_LPC_FILTERORDER, fout);
for (k = 0; k < len; k++)
out[k] = fout[len - 1 - k] + fout[2*len - 1 - k];
}

View File

@ -1,30 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* StateConstructW.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: StateConstructW.h,v 1.2 2008/03/06 12:27:37 steveu Exp $
*/
#ifndef __iLBC_STATECONSTRUCTW_H
#define __iLBC_STATECONSTRUCTW_H
void StateConstructW(int idxForMax, /* (i) 6-bit index for the quantization of
max amplitude */
int *idxVec, /* (i) vector of quantization indexes */
float *syntDenum, /* (i) synthesis filter denumerator */
float *out, /* (o) the decoded state vector */
int len); /* (i) length of a state vector */
#endif

View File

@ -1,179 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* StateSearchW.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: StateSearchW.c,v 1.2 2008/03/06 12:27:37 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <math.h>
#include <string.h>
#include "ilbc.h"
#include "constants.h"
#include "filter.h"
#include "helpfun.h"
#include "StateSearchW.h"
/*----------------------------------------------------------------*
* predictive noise shaping encoding of scaled start state
* (subrutine for StateSearchW)
*---------------------------------------------------------------*/
void AbsQuantW(ilbc_encode_state_t *iLBCenc_inst, /* (i) Encoder instance */
float *in, /* (i) vector to encode */
float *syntDenum, /* (i) denominator of synthesis filter */
float *weightDenum, /* (i) denominator of weighting filter */
int *out, /* (o) vector of quantizer indexes */
int len, /* (i) length of vector to encode and
vector of quantizer indexes */
int state_first) /* (i) position of start state in the 80 vec */
{
float *syntOut;
float syntOutBuf[ILBC_LPC_FILTERORDER + STATE_SHORT_LEN_30MS];
float toQ;
float xq;
int n;
int index;
/* initialization of buffer for filtering */
memset(syntOutBuf, 0, ILBC_LPC_FILTERORDER*sizeof(float));
/* initialization of pointer for filtering */
syntOut = &syntOutBuf[ILBC_LPC_FILTERORDER];
/* synthesis and weighting filters on input */
if (state_first)
{
AllPoleFilter(in, weightDenum, SUBL, ILBC_LPC_FILTERORDER);
}
else
{
AllPoleFilter(in, weightDenum,
iLBCenc_inst->state_short_len - SUBL,
ILBC_LPC_FILTERORDER);
}
/* encoding loop */
for (n = 0; n < len; n++)
{
/* time update of filter coefficients */
if ((state_first) && (n == SUBL))
{
syntDenum += (ILBC_LPC_FILTERORDER + 1);
weightDenum += (ILBC_LPC_FILTERORDER + 1);
/* synthesis and weighting filters on input */
AllPoleFilter(&in[n], weightDenum, len - n, ILBC_LPC_FILTERORDER);
}
else if ((state_first == 0)
&&
(n == (iLBCenc_inst->state_short_len - SUBL)))
{
syntDenum += (ILBC_LPC_FILTERORDER + 1);
weightDenum += (ILBC_LPC_FILTERORDER + 1);
/* synthesis and weighting filters on input */
AllPoleFilter(&in[n], weightDenum, len - n, ILBC_LPC_FILTERORDER);
}
/* prediction of synthesized and weighted input */
syntOut[n] = 0.0f;
AllPoleFilter(&syntOut[n], weightDenum, 1, ILBC_LPC_FILTERORDER);
/* quantization */
toQ = in[n] - syntOut[n];
sort_sq(&xq, &index, toQ, state_sq3Tbl, 8);
out[n] = index;
syntOut[n] = state_sq3Tbl[out[n]];
/* update of the prediction filter */
AllPoleFilter(&syntOut[n], weightDenum, 1, ILBC_LPC_FILTERORDER);
}
}
/*----------------------------------------------------------------*
* encoding of start state
*---------------------------------------------------------------*/
void StateSearchW(ilbc_encode_state_t *iLBCenc_inst, /* (i) Encoder instance */
float *residual, /* (i) target residual vector */
float *syntDenum, /* (i) lpc synthesis filter */
float *weightDenum, /* (i) weighting filter denuminator */
int *idxForMax, /* (o) quantizer index for maximum
amplitude */
int *idxVec, /* (o) vector of quantization indexes */
int len, /* (i) length of all vectors */
int state_first) /* (i) position of start state in the 80 vec */
{
float dtmp;
float maxVal;
float tmpbuf[ILBC_LPC_FILTERORDER + 2*STATE_SHORT_LEN_30MS];
float *tmp;
float numerator[ILBC_LPC_FILTERORDER + 1];
float foutbuf[ILBC_LPC_FILTERORDER + 2*STATE_SHORT_LEN_30MS];
float *fout;
int k;
float qmax;
float scal;
/* initialization of buffers and filter coefficients */
memset(tmpbuf, 0, ILBC_LPC_FILTERORDER*sizeof(float));
memset(foutbuf, 0, ILBC_LPC_FILTERORDER*sizeof(float));
for (k = 0; k < ILBC_LPC_FILTERORDER; k++)
numerator[k] = syntDenum[ILBC_LPC_FILTERORDER - k];
numerator[ILBC_LPC_FILTERORDER] = syntDenum[0];
tmp = &tmpbuf[ILBC_LPC_FILTERORDER];
fout = &foutbuf[ILBC_LPC_FILTERORDER];
/* circular convolution with the all-pass filter */
memcpy(tmp, residual, len*sizeof(float));
memset(tmp + len, 0, len*sizeof(float));
ZeroPoleFilter(tmp, numerator, syntDenum, 2*len, ILBC_LPC_FILTERORDER, fout);
for (k = 0; k < len; k++)
fout[k] += fout[k+len];
/* identification of the maximum amplitude value */
maxVal = fout[0];
for (k = 1; k < len; k++)
{
if (fout[k]*fout[k] > maxVal*maxVal)
maxVal = fout[k];
}
maxVal = fabsf(maxVal);
/* encoding of the maximum amplitude value */
if (maxVal < 10.0f)
maxVal = 10.0f;
maxVal = log10f(maxVal);
sort_sq(&dtmp, idxForMax, maxVal, state_frgqTbl, 64);
/* decoding of the maximum amplitude representation value,
and corresponding scaling of start state */
maxVal = state_frgqTbl[*idxForMax];
qmax = powf(10.0f, maxVal);
scal = 4.5f/qmax;
for (k = 0; k < len; k++)
fout[k] *= scal;
/* predictive noise shaping encoding of scaled start state */
AbsQuantW(iLBCenc_inst, fout,syntDenum, weightDenum,idxVec, len, state_first);
}

View File

@ -1,42 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* StateSearchW.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: StateSearchW.h,v 1.2 2008/03/06 12:27:37 steveu Exp $
*/
#ifndef __iLBC_STATESEARCHW_H
#define __iLBC_STATESEARCHW_H
void AbsQuantW(ilbc_encode_state_t *iLBCenc_inst, /* (i) Encoder instance */
float *in, /* (i) vector to encode */
float *syntDenum, /* (i) denominator of synthesis filter */
float *weightDenum, /* (i) denominator of weighting filter */
int *out, /* (o) vector of quantizer indexes */
int len, /* (i) length of vector to encode and
vector of quantizer indexes */
int state_first); /* (i) position of start state in the 80 vec */
void StateSearchW(ilbc_encode_state_t *iLBCenc_inst, /* (i) Encoder instance */
float *residual, /* (i) target residual vector */
float *syntDenum, /* (i) lpc synthesis filter */
float *weightDenum, /* (i) weighting filter denuminator */
int *idxForMax, /* (o) quantizer index for maximum
amplitude */
int *idxVec, /* (o) vector of quantization indexes */
int len, /* (i) length of all vectors */
int state_first); /* (i) position of start state in the 80 vec */
#endif

View File

@ -1,76 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* anaFilter.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: anaFilter.c,v 1.2 2008/03/06 12:27:37 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <string.h>
#include "anaFilter.h"
#include "ilbc.h"
/*----------------------------------------------------------------*
* LP analysis filter.
*---------------------------------------------------------------*/
void anaFilter(float *In, /* (i) Signal to be filtered */
float *a, /* (i) LP parameters */
int len, /* (i) Length of signal */
float *Out, /* (o) Filtered signal */
float *mem) /* (i/o) Filter state */
{
int i;
int j;
float *po;
float *pi;
float *pm;
float *pa;
po = Out;
/* Filter first part using memory from past */
for (i = 0; i < ILBC_LPC_FILTERORDER; i++)
{
pi = &In[i];
pm = &mem[ILBC_LPC_FILTERORDER - 1];
pa = a;
*po = 0.0;
for (j = 0; j <= i; j++)
*po += (*pa++)*(*pi--);
for (j = i + 1; j < ILBC_LPC_FILTERORDER + 1; j++)
*po += (*pa++)*(*pm--);
po++;
}
/* Filter last part where the state is entirely
in the input vector */
for (i = ILBC_LPC_FILTERORDER; i < len; i++)
{
pi = &In[i];
pa = a;
*po = 0.0;
for (j = 0; j < ILBC_LPC_FILTERORDER + 1; j++)
*po += (*pa++)*(*pi--);
po++;
}
/* Update state vector */
memcpy(mem, &In[len - ILBC_LPC_FILTERORDER], ILBC_LPC_FILTERORDER*sizeof(float));
}

View File

@ -1,29 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* anaFilter.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: anaFilter.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
#ifndef __iLBC_ANAFILTER_H
#define __iLBC_ANAFILTER_H
void anaFilter(float *In, /* (i) Signal to be filtered */
float *a, /* (i) LP parameters */
int len, /* (i) Length of signal */
float *Out, /* (o) Filtered signal */
float *mem); /* (i/o) Filter state */
#endif

View File

@ -1,770 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* constant.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: constants.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include "ilbc.h"
#include "constants.h"
/* ULP bit allocation */
/* 20 ms frame */
const ilbc_ulp_inst_t ULP_20msTbl =
{
/* LSF */
{
{6, 0, 0, 0, 0}, {7, 0, 0, 0, 0}, {7, 0, 0, 0, 0},
{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}
},
/* Start state location, gain and samples */
{2, 0, 0, 0, 0},
{1, 0, 0, 0, 0},
{6, 0, 0, 0, 0},
{0, 1, 2, 0, 0},
/* extra CB index and extra CB gain */
{{6, 0, 1, 0, 0}, {0, 0, 7, 0, 0}, {0, 0, 7, 0, 0}},
{{2, 0, 3, 0, 0}, {1, 1, 2, 0, 0}, {0, 0, 3, 0, 0}},
/* CB index and CB gain */
{
{{7, 0, 1, 0, 0}, {0, 0, 7, 0, 0}, {0, 0, 7, 0, 0}},
{{0, 0, 8, 0, 0}, {0, 0, 8, 0, 0}, {0, 0, 8, 0, 0}},
{{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}},
{{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}
},
{
{{1, 2, 2, 0, 0}, {1, 1, 2, 0, 0}, {0, 0, 3, 0, 0}},
{{1, 1, 3, 0, 0}, {0, 2, 2, 0, 0}, {0, 0, 3, 0, 0}},
{{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}},
{{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}}
}
};
/* 30 ms frame */
const ilbc_ulp_inst_t ULP_30msTbl =
{
/* LSF */
{
{6, 0, 0, 0, 0}, {7, 0, 0, 0, 0}, {7, 0, 0, 0, 0},
{6, 0, 0, 0, 0}, {7, 0, 0, 0, 0}, {7, 0, 0, 0, 0}
},
/* Start state location, gain and samples */
{3, 0, 0, 0, 0},
{1, 0, 0, 0, 0},
{6, 0, 0, 0, 0},
{0, 1, 2, 0, 0},
/* extra CB index and extra CB gain */
{{4, 2, 1, 0, 0}, {0, 0, 7, 0, 0}, {0, 0, 7, 0, 0}},
{{1, 1, 3, 0, 0}, {1, 1, 2, 0, 0}, {0, 0, 3, 0, 0}},
/* CB index and CB gain */
{
{{6, 1, 1, 0, 0}, {0, 0, 7, 0, 0}, {0, 0,7, 0, 0}},
{{0, 7, 1, 0, 0}, {0, 0, 8, 0, 0}, {0, 0,8, 0, 0}},
{{0, 7, 1, 0, 0}, {0, 0, 8, 0, 0}, {0, 0,8, 0, 0}},
{{0, 7, 1, 0, 0}, {0, 0, 8, 0, 0}, {0, 0,8, 0, 0}}
},
{
{{1, 2, 2, 0, 0}, {1, 2, 1, 0, 0}, {0, 0, 3, 0, 0}},
{{0, 2, 3, 0, 0}, {0, 2, 2, 0, 0}, {0, 0, 3, 0, 0}},
{{0, 1, 4, 0, 0}, {0, 1, 3, 0, 0}, {0, 0, 3, 0, 0}},
{{0, 1, 4, 0, 0}, {0, 1, 3, 0, 0}, {0, 0, 3, 0, 0}}
}
};
/* HP Filters */
const float hpi_zero_coefsTbl[3] =
{
0.92727436f, -1.8544941f, 0.92727436f
};
const float hpi_pole_coefsTbl[3] =
{
1.0f, -1.9059465f, 0.9114024f
};
const float hpo_zero_coefsTbl[3] =
{
0.93980581f, -1.8795834f, 0.93980581f
};
const float hpo_pole_coefsTbl[3] =
{
1.0f, -1.9330735f, 0.93589199f
};
/* LP Filter */
const float lpFilt_coefsTbl[FILTERORDER_DS] =
{
-0.066650f, 0.125000f, 0.316650f,
0.414063f, 0.316650f,
0.125000f, -0.066650f
};
/* State quantization tables */
const float state_sq3Tbl[8] =
{
-3.719849f, -2.177490f, -1.130005f,
-0.309692f, 0.444214f, 1.329712f,
2.436279f, 3.983887f
};
const float state_frgqTbl[64] =
{
1.000085f, 1.071695f, 1.140395f,
1.206868f, 1.277188f, 1.351503f,
1.429380f, 1.500727f, 1.569049f,
1.639599f, 1.707071f, 1.781531f,
1.840799f, 1.901550f, 1.956695f,
2.006750f, 2.055474f, 2.102787f,
2.142819f, 2.183592f, 2.217962f,
2.257177f, 2.295739f, 2.332967f,
2.369248f, 2.402792f, 2.435080f,
2.468598f, 2.503394f, 2.539284f,
2.572944f, 2.605036f, 2.636331f,
2.668939f, 2.698780f, 2.729101f,
2.759786f, 2.789834f, 2.818679f,
2.848074f, 2.877470f, 2.906899f,
2.936655f, 2.967804f, 3.000115f,
3.033367f, 3.066355f, 3.104231f,
3.141499f, 3.183012f, 3.222952f,
3.265433f, 3.308441f, 3.350823f,
3.395275f, 3.442793f, 3.490801f,
3.542514f, 3.604064f, 3.666050f,
3.740994f, 3.830749f, 3.938770f,
4.101764f
};
/* CB tables */
const int search_rangeTbl[5][CB_NSTAGES] =
{
{58, 58, 58},
{108, 44, 44},
{108, 108, 108},
{108, 108, 108},
{108, 108, 108}
};
const int stMemLTbl = 85;
const int memLfTbl[NASUB_MAX] = {147, 147, 147, 147};
/* expansion filter(s) */
const float cbfiltersTbl[CB_FILTERLEN] =
{
-0.034180f, 0.108887f, -0.184326f,
0.806152f, 0.713379f, -0.144043f,
0.083740f, -0.033691f
};
/* Gain Quantization */
const float gain_sq3Tbl[8] =
{
-1.000000f, -0.659973f, -0.330017f,
0.000000f, 0.250000f, 0.500000f,
0.750000f, 1.00000f
};
const float gain_sq4Tbl[16] =
{
-1.049988f, -0.900024f, -0.750000f,
-0.599976f, -0.450012f, -0.299988f,
-0.150024f, 0.000000f, 0.150024f,
0.299988f, 0.450012f, 0.599976f,
0.750000f, 0.900024f, 1.049988f,
1.200012f
};
const float gain_sq5Tbl[32]=
{
0.037476f, 0.075012f, 0.112488f,
0.150024f, 0.187500f, 0.224976f,
0.262512f, 0.299988f, 0.337524f,
0.375000f, 0.412476f, 0.450012f,
0.487488f, 0.525024f, 0.562500f,
0.599976f, 0.637512f, 0.674988f,
0.712524f, 0.750000f, 0.787476f,
0.825012f, 0.862488f, 0.900024f,
0.937500f, 0.974976f, 1.012512f,
1.049988f, 1.087524f, 1.125000f,
1.162476f, 1.200012f
};
/* Enhancer - Upsamling a factor 4 (ENH_UPS0 = 4) */
const float polyphaserTbl[ENH_UPS0*(2*ENH_FL0+1)] =
{
0.000000f, 0.000000f, 0.000000f,
1.000000f,
0.000000f, 0.000000f, 0.000000f,
0.015625f, -0.076904f, 0.288330f,
0.862061f,
-0.106445f, 0.018799f, -0.015625f,
0.023682f, -0.124268f, 0.601563f,
0.601563f,
-0.124268f, 0.023682f, -0.023682f,
0.018799f, -0.106445f, 0.862061f,
0.288330f,
-0.076904f, 0.015625f, -0.018799f
};
const float enh_plocsTbl[ENH_NBLOCKS_TOT] =
{
40.0f, 120.0f,
200.0f, 280.0f, 360.0f,
440.0f, 520.0f, 600.0f
};
/* LPC analysis and quantization */
const int dim_lsfCbTbl[LSF_NSPLIT] = {3, 3, 4};
const int size_lsfCbTbl[LSF_NSPLIT] = {64, 128, 128};
const float lsfmeanTbl[ILBC_LPC_FILTERORDER] =
{
0.281738f, 0.445801f, 0.663330f,
0.962524f, 1.251831f, 1.533081f,
1.850586f, 2.137817f, 2.481445f,
2.777344f
};
const float lsf_weightTbl_30ms[6] =
{
1.0f/2.0f, 1.0f,
2.0f/3.0f,
1.0f/3.0f, 0.0f, 0.0f
};
const float lsf_weightTbl_20ms[4] =
{
3.0f/4.0f, 2.0f/4.0f,
1.0f/4.0f, 0.0f
};
/* Hanning LPC window */
const float lpc_winTbl[ILBC_BLOCK_LEN_MAX] =
{
0.000183f, 0.000671f, 0.001526f,
0.002716f, 0.004242f, 0.006104f,
0.008301f, 0.010834f, 0.013702f,
0.016907f, 0.020416f, 0.024261f,
0.028442f, 0.032928f, 0.037750f,
0.042877f, 0.048309f, 0.054047f,
0.060089f, 0.066437f, 0.073090f,
0.080017f, 0.087219f, 0.094727f,
0.102509f, 0.110535f, 0.118835f,
0.127411f, 0.136230f, 0.145294f,
0.154602f, 0.164154f, 0.173920f,
0.183899f, 0.194122f, 0.204529f,
0.215149f, 0.225952f, 0.236938f,
0.248108f, 0.259460f, 0.270966f,
0.282654f, 0.294464f, 0.306396f,
0.318481f, 0.330688f, 0.343018f,
0.355438f, 0.367981f, 0.380585f,
0.393280f, 0.406067f, 0.418884f,
0.431763f, 0.444702f, 0.457672f,
0.470673f, 0.483704f, 0.496735f,
0.509766f, 0.522797f, 0.535828f,
0.548798f, 0.561768f, 0.574677f,
0.587524f, 0.600342f, 0.613068f,
0.625732f, 0.638306f, 0.650787f,
0.663147f, 0.675415f, 0.687561f,
0.699585f, 0.711487f, 0.723206f,
0.734802f, 0.746216f, 0.757477f,
0.768585f, 0.779480f, 0.790192f,
0.800720f, 0.811005f, 0.821106f,
0.830994f, 0.840668f, 0.850067f,
0.859253f, 0.868225f, 0.876892f,
0.885345f, 0.893524f, 0.901428f,
0.909058f, 0.916412f, 0.923492f,
0.930267f, 0.936768f, 0.942963f,
0.948853f, 0.954437f, 0.959717f,
0.964691f, 0.969360f, 0.973694f,
0.977692f, 0.981384f, 0.984741f,
0.987762f, 0.990479f, 0.992828f,
0.994873f, 0.996552f, 0.997925f,
0.998932f, 0.999603f, 0.999969f,
0.999969f, 0.999603f, 0.998932f,
0.997925f, 0.996552f, 0.994873f,
0.992828f, 0.990479f, 0.987762f,
0.984741f, 0.981384f, 0.977692f,
0.973694f, 0.969360f, 0.964691f,
0.959717f, 0.954437f, 0.948853f,
0.942963f, 0.936768f, 0.930267f,
0.923492f, 0.916412f, 0.909058f,
0.901428f, 0.893524f, 0.885345f,
0.876892f, 0.868225f, 0.859253f,
0.850067f, 0.840668f, 0.830994f,
0.821106f, 0.811005f, 0.800720f,
0.790192f, 0.779480f, 0.768585f,
0.757477f, 0.746216f, 0.734802f,
0.723206f, 0.711487f, 0.699585f,
0.687561f, 0.675415f, 0.663147f,
0.650787f, 0.638306f, 0.625732f,
0.613068f, 0.600342f, 0.587524f,
0.574677f, 0.561768f, 0.548798f,
0.535828f, 0.522797f, 0.509766f,
0.496735f, 0.483704f, 0.470673f,
0.457672f, 0.444702f, 0.431763f,
0.418884f, 0.406067f, 0.393280f,
0.380585f, 0.367981f, 0.355438f,
0.343018f, 0.330688f, 0.318481f,
0.306396f, 0.294464f, 0.282654f,
0.270966f, 0.259460f, 0.248108f,
0.236938f, 0.225952f, 0.215149f,
0.204529f, 0.194122f, 0.183899f,
0.173920f, 0.164154f, 0.154602f,
0.145294f, 0.136230f, 0.127411f,
0.118835f, 0.110535f, 0.102509f,
0.094727f, 0.087219f, 0.080017f,
0.073090f, 0.066437f, 0.060089f,
0.054047f, 0.048309f, 0.042877f,
0.037750f, 0.032928f, 0.028442f,
0.024261f, 0.020416f, 0.016907f,
0.013702f, 0.010834f, 0.008301f,
0.006104f, 0.004242f, 0.002716f,
0.001526f, 0.000671f, 0.000183f
};
/* Asymmetric LPC window */
const float lpc_asymwinTbl[ILBC_BLOCK_LEN_MAX] =
{
0.000061f, 0.000214f, 0.000458f,
0.000824f, 0.001282f, 0.001831f,
0.002472f, 0.003235f, 0.004120f,
0.005066f, 0.006134f, 0.007294f,
0.008545f, 0.009918f, 0.011383f,
0.012939f, 0.014587f, 0.016357f,
0.018219f, 0.020172f, 0.022217f,
0.024353f, 0.026611f, 0.028961f,
0.031372f, 0.033905f, 0.036530f,
0.039276f, 0.042084f, 0.044983f,
0.047974f, 0.051086f, 0.054260f,
0.057526f, 0.060883f, 0.064331f,
0.067871f, 0.071503f, 0.075226f,
0.079010f, 0.082916f, 0.086884f,
0.090942f, 0.095062f, 0.099304f,
0.103607f, 0.107971f, 0.112427f,
0.116974f, 0.121582f, 0.126282f,
0.131073f, 0.135895f, 0.140839f,
0.145813f, 0.150879f, 0.156006f,
0.161224f, 0.166504f, 0.171844f,
0.177246f, 0.182709f, 0.188263f,
0.193848f, 0.199524f, 0.205231f,
0.211029f, 0.216858f, 0.222778f,
0.228729f, 0.234741f, 0.240814f,
0.246918f, 0.253082f, 0.259308f,
0.265564f, 0.271881f, 0.278259f,
0.284668f, 0.291107f, 0.297607f,
0.304138f, 0.310730f, 0.317322f,
0.323975f, 0.330658f, 0.337372f,
0.344147f, 0.350922f, 0.357727f,
0.364594f, 0.371460f, 0.378357f,
0.385284f, 0.392212f, 0.399170f,
0.406158f, 0.413177f, 0.420197f,
0.427246f, 0.434296f, 0.441376f,
0.448456f, 0.455536f, 0.462646f,
0.469757f, 0.476868f, 0.483978f,
0.491089f, 0.498230f, 0.505341f,
0.512451f, 0.519592f, 0.526703f,
0.533813f, 0.540924f, 0.548004f,
0.555084f, 0.562164f, 0.569244f,
0.576294f, 0.583313f, 0.590332f,
0.597321f, 0.604309f, 0.611267f,
0.618195f, 0.625092f, 0.631989f,
0.638855f, 0.645660f, 0.652466f,
0.659241f, 0.665985f, 0.672668f,
0.679352f, 0.685974f, 0.692566f,
0.699127f, 0.705658f, 0.712128f,
0.718536f, 0.724945f, 0.731262f,
0.737549f, 0.743805f, 0.750000f,
0.756134f, 0.762238f, 0.768280f,
0.774261f, 0.780182f, 0.786072f,
0.791870f, 0.797638f, 0.803314f,
0.808960f, 0.814514f, 0.820038f,
0.825470f, 0.830841f, 0.836151f,
0.841400f, 0.846558f, 0.851654f,
0.856689f, 0.861633f, 0.866516f,
0.871338f, 0.876068f, 0.880737f,
0.885315f, 0.889801f, 0.894226f,
0.898560f, 0.902832f, 0.907013f,
0.911102f, 0.915100f, 0.919037f,
0.922882f, 0.926636f, 0.930328f,
0.933899f, 0.937408f, 0.940796f,
0.944122f, 0.947357f, 0.950470f,
0.953522f, 0.956482f, 0.959351f,
0.962097f, 0.964783f, 0.967377f,
0.969849f, 0.972229f, 0.974518f,
0.976715f, 0.978821f, 0.980835f,
0.982727f, 0.984528f, 0.986237f,
0.987854f, 0.989380f, 0.990784f,
0.992096f, 0.993317f, 0.994415f,
0.995422f, 0.996338f, 0.997162f,
0.997864f, 0.998474f, 0.998962f,
0.999390f, 0.999695f, 0.999878f,
0.999969f, 0.999969f, 0.996918f,
0.987701f, 0.972382f, 0.951050f,
0.923889f, 0.891022f, 0.852631f,
0.809021f, 0.760406f, 0.707092f,
0.649445f, 0.587799f, 0.522491f,
0.453979f, 0.382690f, 0.309021f,
0.233459f, 0.156433f, 0.078461f
};
/* Lag window for LPC */
const float lpc_lagwinTbl[ILBC_LPC_FILTERORDER + 1] =
{
1.000100f, 0.998890f, 0.995569f,
0.990057f, 0.982392f,
0.972623f, 0.960816f, 0.947047f,
0.931405f, 0.913989f, 0.894909f
};
/* LSF quantization*/
const float lsfCbTbl[64 * 3 + 128 * 3 + 128 * 4] =
{
0.155396f, 0.273193f, 0.451172f,
0.390503f, 0.648071f, 1.002075f,
0.440186f, 0.692261f, 0.955688f,
0.343628f, 0.642334f, 1.071533f,
0.318359f, 0.491577f, 0.670532f,
0.193115f, 0.375488f, 0.725708f,
0.364136f, 0.510376f, 0.658691f,
0.297485f, 0.527588f, 0.842529f,
0.227173f, 0.365967f, 0.563110f,
0.244995f, 0.396729f, 0.636475f,
0.169434f, 0.300171f, 0.520264f,
0.312866f, 0.464478f, 0.643188f,
0.248535f, 0.429932f, 0.626099f,
0.236206f, 0.491333f, 0.817139f,
0.334961f, 0.625122f, 0.895752f,
0.343018f, 0.518555f, 0.698608f,
0.372803f, 0.659790f, 0.945435f,
0.176880f, 0.316528f, 0.581421f,
0.416382f, 0.625977f, 0.805176f,
0.303223f, 0.568726f, 0.915039f,
0.203613f, 0.351440f, 0.588135f,
0.221191f, 0.375000f, 0.614746f,
0.199951f, 0.323364f, 0.476074f,
0.300781f, 0.433350f, 0.566895f,
0.226196f, 0.354004f, 0.507568f,
0.300049f, 0.508179f, 0.711670f,
0.312012f, 0.492676f, 0.763428f,
0.329956f, 0.541016f, 0.795776f,
0.373779f, 0.604614f, 0.928833f,
0.210571f, 0.452026f, 0.755249f,
0.271118f, 0.473267f, 0.662476f,
0.285522f, 0.436890f, 0.634399f,
0.246704f, 0.565552f, 0.859009f,
0.270508f, 0.406250f, 0.553589f,
0.361450f, 0.578491f, 0.813843f,
0.342651f, 0.482788f, 0.622437f,
0.340332f, 0.549438f, 0.743164f,
0.200439f, 0.336304f, 0.540894f,
0.407837f, 0.644775f, 0.895142f,
0.294678f, 0.454834f, 0.699097f,
0.193115f, 0.344482f, 0.643188f,
0.275757f, 0.420776f, 0.598755f,
0.380493f, 0.608643f, 0.861084f,
0.222778f, 0.426147f, 0.676514f,
0.407471f, 0.700195f, 1.053101f,
0.218384f, 0.377197f, 0.669922f,
0.313232f, 0.454102f, 0.600952f,
0.347412f, 0.571533f, 0.874146f,
0.238037f, 0.405396f, 0.729492f,
0.223877f, 0.412964f, 0.822021f,
0.395264f, 0.582153f, 0.743896f,
0.247925f, 0.485596f, 0.720581f,
0.229126f, 0.496582f, 0.907715f,
0.260132f, 0.566895f, 1.012695f,
0.337402f, 0.611572f, 0.978149f,
0.267822f, 0.447632f, 0.769287f,
0.250610f, 0.381714f, 0.530029f,
0.430054f, 0.805054f, 1.221924f,
0.382568f, 0.544067f, 0.701660f,
0.383545f, 0.710327f, 1.149170f,
0.271362f, 0.529053f, 0.775513f,
0.246826f, 0.393555f, 0.588623f,
0.266846f, 0.422119f, 0.676758f,
0.311523f, 0.580688f, 0.838623f,
1.331177f, 1.576782f, 1.779541f,
1.160034f, 1.401978f, 1.768188f,
1.161865f, 1.525146f, 1.715332f,
0.759521f, 0.913940f, 1.119873f,
0.947144f, 1.121338f, 1.282471f,
1.015015f, 1.557007f, 1.804932f,
1.172974f, 1.402100f, 1.692627f,
1.087524f, 1.474243f, 1.665405f,
0.899536f, 1.105225f, 1.406250f,
1.148438f, 1.484741f, 1.796265f,
0.785645f, 1.209839f, 1.567749f,
0.867798f, 1.166504f, 1.450684f,
0.922485f, 1.229858f, 1.420898f,
0.791260f, 1.123291f, 1.409546f,
0.788940f, 0.966064f, 1.340332f,
1.051147f, 1.272827f, 1.556641f,
0.866821f, 1.181152f, 1.538818f,
0.906738f, 1.373535f, 1.607910f,
1.244751f, 1.581421f, 1.933838f,
0.913940f, 1.337280f, 1.539673f,
0.680542f, 0.959229f, 1.662720f,
0.887207f, 1.430542f, 1.800781f,
0.912598f, 1.433594f, 1.683960f,
0.860474f, 1.060303f, 1.455322f,
1.005127f, 1.381104f, 1.706909f,
0.800781f, 1.363892f, 1.829102f,
0.781860f, 1.124390f, 1.505981f,
1.003662f, 1.471436f, 1.684692f,
0.981323f, 1.309570f, 1.618042f,
1.228760f, 1.554321f, 1.756470f,
0.734375f, 0.895752f, 1.225586f,
0.841797f, 1.055664f, 1.249268f,
0.920166f, 1.119385f, 1.486206f,
0.894409f, 1.539063f, 1.828979f,
1.283691f, 1.543335f, 1.858276f,
0.676025f, 0.933105f, 1.490845f,
0.821289f, 1.491821f, 1.739868f,
0.923218f, 1.144653f, 1.580566f,
1.057251f, 1.345581f, 1.635864f,
0.888672f, 1.074951f, 1.353149f,
0.942749f, 1.195435f, 1.505493f,
1.492310f, 1.788086f, 2.039673f,
1.070313f, 1.634399f, 1.860962f,
1.253296f, 1.488892f, 1.686035f,
0.647095f, 0.864014f, 1.401855f,
0.866699f, 1.254883f, 1.453369f,
1.063965f, 1.532593f, 1.731323f,
1.167847f, 1.521484f, 1.884033f,
0.956055f, 1.502075f, 1.745605f,
0.928711f, 1.288574f, 1.479614f,
1.088013f, 1.380737f, 1.570801f,
0.905029f, 1.186768f, 1.371948f,
1.057861f, 1.421021f, 1.617432f,
1.108276f, 1.312500f, 1.501465f,
0.979492f, 1.416992f, 1.624268f,
1.276001f, 1.661011f, 2.007935f,
0.993042f, 1.168579f, 1.331665f,
0.778198f, 0.944946f, 1.235962f,
1.223755f, 1.491333f, 1.815674f,
0.852661f, 1.350464f, 1.722290f,
1.134766f, 1.593140f, 1.787354f,
1.051392f, 1.339722f, 1.531006f,
0.803589f, 1.271240f, 1.652100f,
0.755737f, 1.143555f, 1.639404f,
0.700928f, 0.837280f, 1.130371f,
0.942749f, 1.197876f, 1.669800f,
0.993286f, 1.378296f, 1.566528f,
0.801025f, 1.095337f, 1.298950f,
0.739990f, 1.032959f, 1.383667f,
0.845703f, 1.072266f, 1.543823f,
0.915649f, 1.072266f, 1.224487f,
1.021973f, 1.226196f, 1.481323f,
0.999878f, 1.204102f, 1.555908f,
0.722290f, 0.913940f, 1.340210f,
0.673340f, 0.835938f, 1.259521f,
0.832397f, 1.208374f, 1.394165f,
0.962158f, 1.576172f, 1.912842f,
1.166748f, 1.370850f, 1.556763f,
0.946289f, 1.138550f, 1.400391f,
1.035034f, 1.218262f, 1.386475f,
1.393799f, 1.717773f, 2.000244f,
0.972656f, 1.260986f, 1.760620f,
1.028198f, 1.288452f, 1.484619f,
0.773560f, 1.258057f, 1.756714f,
1.080322f, 1.328003f, 1.742676f,
0.823975f, 1.450806f, 1.917725f,
0.859009f, 1.016602f, 1.191895f,
0.843994f, 1.131104f, 1.645020f,
1.189697f, 1.702759f, 1.894409f,
1.346680f, 1.763184f, 2.066040f,
0.980469f, 1.253784f, 1.441650f,
1.338135f, 1.641968f, 1.932739f,
1.223267f, 1.424194f, 1.626465f,
0.765747f, 1.004150f, 1.579102f,
1.042847f, 1.269165f, 1.647461f,
0.968750f, 1.257568f, 1.555786f,
0.826294f, 0.993408f, 1.275146f,
0.742310f, 0.950439f, 1.430542f,
1.054321f, 1.439819f, 1.828003f,
1.072998f, 1.261719f, 1.441895f,
0.859375f, 1.036377f, 1.314819f,
0.895752f, 1.267212f, 1.605591f,
0.805420f, 0.962891f, 1.142334f,
0.795654f, 1.005493f, 1.468506f,
1.105347f, 1.313843f, 1.584839f,
0.792236f, 1.221802f, 1.465698f,
1.170532f, 1.467651f, 1.664063f,
0.838257f, 1.153198f, 1.342163f,
0.968018f, 1.198242f, 1.391235f,
1.250122f, 1.623535f, 1.823608f,
0.711670f, 1.058350f, 1.512085f,
1.204834f, 1.454468f, 1.739136f,
1.137451f, 1.421753f, 1.620117f,
0.820435f, 1.322754f, 1.578247f,
0.798706f, 1.005005f, 1.213867f,
0.980713f, 1.324951f, 1.512939f,
1.112305f, 1.438843f, 1.735596f,
1.135498f, 1.356689f, 1.635742f,
1.101318f, 1.387451f, 1.686523f,
0.849854f, 1.276978f, 1.523438f,
1.377930f, 1.627563f, 1.858154f,
0.884888f, 1.095459f, 1.287476f,
1.289795f, 1.505859f, 1.756592f,
0.817505f, 1.384155f, 1.650513f,
1.446655f, 1.702148f, 1.931885f,
0.835815f, 1.023071f, 1.385376f,
0.916626f, 1.139038f, 1.335327f,
0.980103f, 1.174072f, 1.453735f,
1.705688f, 2.153809f, 2.398315f, 2.743408f,
1.797119f, 2.016846f, 2.445679f, 2.701904f,
1.990356f, 2.219116f, 2.576416f, 2.813477f,
1.849365f, 2.190918f, 2.611572f, 2.835083f,
1.657959f, 1.854370f, 2.159058f, 2.726196f,
1.437744f, 1.897705f, 2.253174f, 2.655396f,
2.028687f, 2.247314f, 2.542358f, 2.875854f,
1.736938f, 1.922119f, 2.185913f, 2.743408f,
1.521606f, 1.870972f, 2.526855f, 2.786987f,
1.841431f, 2.050659f, 2.463623f, 2.857666f,
1.590088f, 2.067261f, 2.427979f, 2.794434f,
1.746826f, 2.057373f, 2.320190f, 2.800781f,
1.734619f, 1.940552f, 2.306030f, 2.826416f,
1.786255f, 2.204468f, 2.457520f, 2.795288f,
1.861084f, 2.170532f, 2.414551f, 2.763672f,
2.001465f, 2.307617f, 2.552734f, 2.811890f,
1.784424f, 2.124146f, 2.381592f, 2.645508f,
1.888794f, 2.135864f, 2.418579f, 2.861206f,
2.301147f, 2.531250f, 2.724976f, 2.913086f,
1.837769f, 2.051270f, 2.261963f, 2.553223f,
2.012939f, 2.221191f, 2.440186f, 2.678101f,
1.429565f, 1.858276f, 2.582275f, 2.845703f,
1.622803f, 1.897705f, 2.367310f, 2.621094f,
1.581543f, 1.960449f, 2.515869f, 2.736450f,
1.419434f, 1.933960f, 2.394653f, 2.746704f,
1.721924f, 2.059570f, 2.421753f, 2.769653f,
1.911011f, 2.220703f, 2.461060f, 2.740723f,
1.581177f, 1.860840f, 2.516968f, 2.874634f,
1.870361f, 2.098755f, 2.432373f, 2.656494f,
2.059692f, 2.279785f, 2.495605f, 2.729370f,
1.815674f, 2.181519f, 2.451538f, 2.680542f,
1.407959f, 1.768311f, 2.343018f, 2.668091f,
2.168701f, 2.394653f, 2.604736f, 2.829346f,
1.636230f, 1.865723f, 2.329102f, 2.824219f,
1.878906f, 2.139526f, 2.376709f, 2.679810f,
1.765381f, 1.971802f, 2.195435f, 2.586914f,
2.164795f, 2.410889f, 2.673706f, 2.903198f,
2.071899f, 2.331055f, 2.645874f, 2.907104f,
2.026001f, 2.311523f, 2.594849f, 2.863892f,
1.948975f, 2.180786f, 2.514893f, 2.797852f,
1.881836f, 2.130859f, 2.478149f, 2.804199f,
2.238159f, 2.452759f, 2.652832f, 2.868286f,
1.897949f, 2.101685f, 2.524292f, 2.880127f,
1.856445f, 2.074585f, 2.541016f, 2.791748f,
1.695557f, 2.199097f, 2.506226f, 2.742676f,
1.612671f, 1.877075f, 2.435425f, 2.732910f,
1.568848f, 1.786499f, 2.194580f, 2.768555f,
1.953369f, 2.164551f, 2.486938f, 2.874023f,
1.388306f, 1.725342f, 2.384521f, 2.771851f,
2.115356f, 2.337769f, 2.592896f, 2.864014f,
1.905762f, 2.111328f, 2.363525f, 2.789307f,
1.882568f, 2.332031f, 2.598267f, 2.827637f,
1.683594f, 2.088745f, 2.361938f, 2.608643f,
1.874023f, 2.182129f, 2.536133f, 2.766968f,
1.861938f, 2.070435f, 2.309692f, 2.700562f,
1.722168f, 2.107422f, 2.477295f, 2.837646f,
1.926880f, 2.184692f, 2.442627f, 2.663818f,
2.123901f, 2.337280f, 2.553101f, 2.777466f,
1.588135f, 1.911499f, 2.212769f, 2.543945f,
2.053955f, 2.370850f, 2.712158f, 2.939941f,
2.210449f, 2.519653f, 2.770386f, 2.958618f,
2.199463f, 2.474731f, 2.718262f, 2.919922f,
1.960083f, 2.175415f, 2.608032f, 2.888794f,
1.953735f, 2.185181f, 2.428223f, 2.809570f,
1.615234f, 2.036499f, 2.576538f, 2.834595f,
1.621094f, 2.028198f, 2.431030f, 2.664673f,
1.824951f, 2.267456f, 2.514526f, 2.747925f,
1.994263f, 2.229126f, 2.475220f, 2.833984f,
1.746338f, 2.011353f, 2.588257f, 2.826904f,
1.562866f, 2.135986f, 2.471680f, 2.687256f,
1.748901f, 2.083496f, 2.460938f, 2.686279f,
1.758057f, 2.131470f, 2.636597f, 2.891602f,
2.071289f, 2.299072f, 2.550781f, 2.814331f,
1.839600f, 2.094360f, 2.496460f, 2.723999f,
1.882202f, 2.088257f, 2.636841f, 2.923096f,
1.957886f, 2.153198f, 2.384399f, 2.615234f,
1.992920f, 2.351196f, 2.654419f, 2.889771f,
2.012817f, 2.262451f, 2.643799f, 2.903076f,
2.025635f, 2.254761f, 2.508423f, 2.784058f,
2.316040f, 2.589355f, 2.794189f, 2.963623f,
1.741211f, 2.279541f, 2.578491f, 2.816284f,
1.845337f, 2.055786f, 2.348511f, 2.822021f,
1.679932f, 1.926514f, 2.499756f, 2.835693f,
1.722534f, 1.946899f, 2.448486f, 2.728760f,
1.829834f, 2.043213f, 2.580444f, 2.867676f,
1.676636f, 2.071655f, 2.322510f, 2.704834f,
1.791504f, 2.113525f, 2.469727f, 2.784058f,
1.977051f, 2.215088f, 2.497437f, 2.726929f,
1.800171f, 2.106689f, 2.357788f, 2.738892f,
1.827759f, 2.170166f, 2.525879f, 2.852417f,
1.918335f, 2.132813f, 2.488403f, 2.728149f,
1.916748f, 2.225098f, 2.542603f, 2.857666f,
1.761230f, 1.976074f, 2.507446f, 2.884521f,
2.053711f, 2.367432f, 2.608032f, 2.837646f,
1.595337f, 2.000977f, 2.307129f, 2.578247f,
1.470581f, 2.031250f, 2.375854f, 2.647583f,
1.801392f, 2.128052f, 2.399780f, 2.822876f,
1.853638f, 2.066650f, 2.429199f, 2.751465f,
1.956299f, 2.163696f, 2.394775f, 2.734253f,
1.963623f, 2.275757f, 2.585327f, 2.865234f,
1.887451f, 2.105469f, 2.331787f, 2.587402f,
2.120117f, 2.443359f, 2.733887f, 2.941406f,
1.506348f, 1.766968f, 2.400513f, 2.851807f,
1.664551f, 1.981079f, 2.375732f, 2.774414f,
1.720703f, 1.978882f, 2.391479f, 2.640991f,
1.483398f, 1.814819f, 2.434448f, 2.722290f,
1.769043f, 2.136597f, 2.563721f, 2.774414f,
1.810791f, 2.049316f, 2.373901f, 2.613647f,
1.788330f, 2.005981f, 2.359131f, 2.723145f,
1.785156f, 1.993164f, 2.399780f, 2.832520f,
1.695313f, 2.022949f, 2.522583f, 2.745117f,
1.584106f, 1.965576f, 2.299927f, 2.715576f,
1.894897f, 2.249878f, 2.655884f, 2.897705f,
1.720581f, 1.995728f, 2.299438f, 2.557007f,
1.619385f, 2.173950f, 2.574219f, 2.787964f,
1.883179f, 2.220459f, 2.474365f, 2.825073f,
1.447632f, 2.045044f, 2.555542f, 2.744873f,
1.502686f, 2.156616f, 2.653320f, 2.846558f,
1.711548f, 1.944092f, 2.282959f, 2.685791f,
1.499756f, 1.867554f, 2.341064f, 2.578857f,
1.916870f, 2.135132f, 2.568237f, 2.826050f,
1.498047f, 1.711182f, 2.223267f, 2.755127f,
1.808716f, 1.997559f, 2.256470f, 2.758545f,
2.088501f, 2.402710f, 2.667358f, 2.890259f,
1.545044f, 1.819214f, 2.324097f, 2.692993f,
1.796021f, 2.012573f, 2.505737f, 2.784912f,
1.786499f, 2.041748f, 2.290405f, 2.650757f,
1.938232f, 2.264404f, 2.529053f, 2.796143f
};

View File

@ -1,76 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* constants.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: constants.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
#ifndef __iLBC_CONSTANTS_H
#define __iLBC_CONSTANTS_H
#include "iLBC_define.h"
#include "ilbc.h"
/* ULP bit allocation */
extern const ilbc_ulp_inst_t ULP_20msTbl;
extern const ilbc_ulp_inst_t ULP_30msTbl;
/* high pass filters */
extern const float hpi_zero_coefsTbl[];
extern const float hpi_pole_coefsTbl[];
extern const float hpo_zero_coefsTbl[];
extern const float hpo_pole_coefsTbl[];
/* low pass filters */
extern const float lpFilt_coefsTbl[];
/* LPC analysis and quantization */
extern const float lpc_winTbl[];
extern const float lpc_asymwinTbl[];
extern const float lpc_lagwinTbl[];
extern const float lsfCbTbl[];
extern const float lsfmeanTbl[];
extern const int dim_lsfCbTbl[];
extern const int size_lsfCbTbl[];
extern const float lsf_weightTbl_30ms[];
extern const float lsf_weightTbl_20ms[];
/* state quantization tables */
extern const float state_sq3Tbl[];
extern const float state_frgqTbl[];
/* gain quantization tables */
extern const float gain_sq3Tbl[];
extern const float gain_sq4Tbl[];
extern const float gain_sq5Tbl[];
/* adaptive codebook definitions */
extern const int search_rangeTbl[5][CB_NSTAGES];
extern const int memLfTbl[];
extern const int stMemLTbl;
extern const float cbfiltersTbl[CB_FILTERLEN];
/* enhancer definitions */
extern const float polyphaserTbl[];
extern const float enh_plocsTbl[];
#endif

View File

@ -1,241 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* createCB.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: createCB.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <math.h>
#include <string.h>
#include "ilbc.h"
#include "constants.h"
#include "createCB.h"
/*----------------------------------------------------------------*
* Construct an additional codebook vector by filtering the
* initial codebook buffer. This vector is then used to expand
* the codebook with an additional section.
*---------------------------------------------------------------*/
void filteredCBvecs(float *cbvectors, /* (o) Codebook vectors for the
higher section */
float *mem, /* (i) Buffer to create codebook
vector from */
int lMem) /* (i) Length of buffer */
{
int j;
int k;
const float *pp;
const float *pp1;
float tempbuff2[CB_MEML + CB_FILTERLEN];
float *pos;
memset(tempbuff2, 0, (CB_HALFFILTERLEN - 1)*sizeof(float));
memcpy(&tempbuff2[CB_HALFFILTERLEN - 1], mem, lMem*sizeof(float));
memset(&tempbuff2[lMem + CB_HALFFILTERLEN - 1], 0, (CB_HALFFILTERLEN + 1)*sizeof(float));
/* Create codebook vector for higher section by filtering */
/* do filtering */
pos = cbvectors;
memset(pos, 0, lMem*sizeof(float));
for (k = 0; k < lMem; k++)
{
pp = &tempbuff2[k];
pp1 = &cbfiltersTbl[CB_FILTERLEN - 1];
for (j = 0; j < CB_FILTERLEN; j++)
(*pos) += (*pp++)*(*pp1--);
pos++;
}
}
/*----------------------------------------------------------------*
* Search the augmented part of the codebook to find the best
* measure.
*----------------------------------------------------------------*/
void searchAugmentedCB(int low, /* (i) Start index for the search */
int high, /* (i) End index for the search */
int stage, /* (i) Current stage */
int startIndex, /* (i) Codebook index for the first
aug vector */
float *target, /* (i) Target vector for encoding */
float *buffer, /* (i) Pointer to the end of the buffer for
augmented codebook construction */
float *max_measure, /* (i/o) Currently maximum measure */
int *best_index, /* (o) Currently the best index */
float *gain, /* (o) Currently the best gain */
float *energy, /* (o) Energy of augmented codebook
vectors */
float *invenergy) /* (o) Inv energy of augmented codebook
vectors */
{
int icount;
int ilow;
int j;
int tmpIndex;
float *pp;
float *ppo;
float *ppi;
float *ppe;
float crossDot;
float alfa;
float weighted;
float measure;
float nrjRecursive;
float ftmp;
/* Compute the energy for the first (low-5)
noninterpolated samples */
nrjRecursive = 0.0f;
pp = buffer - low + 1;
for (j = 0; j < (low - 5); j++)
{
nrjRecursive += ((*pp)*(*pp));
pp++;
}
ppe = buffer - low;
for (icount = low; icount <= high; icount++)
{
/* Index of the codebook vector used for retrieving
energy values */
tmpIndex = startIndex+icount - 20;
ilow = icount - 4;
/* Update the energy recursively to save complexity */
nrjRecursive = nrjRecursive + (*ppe)*(*ppe);
ppe--;
energy[tmpIndex] = nrjRecursive;
/* Compute cross dot product for the first (low - 5) samples */
crossDot = 0.0f;
pp = buffer - icount;
for (j = 0; j < ilow; j++)
crossDot += target[j]*(*pp++);
/* interpolation */
alfa = 0.2f;
ppo = buffer - 4;
ppi = buffer - icount - 4;
for (j = ilow; j < icount; j++)
{
weighted = (1.0f - alfa)*(*ppo) +alfa*(*ppi);
ppo++;
ppi++;
energy[tmpIndex] += weighted*weighted;
crossDot += target[j]*weighted;
alfa += 0.2f;
}
/* Compute energy and cross dot product for the
remaining samples */
pp = buffer - icount;
for (j = icount; j < SUBL; j++)
{
energy[tmpIndex] += (*pp)*(*pp);
crossDot += target[j]*(*pp++);
}
if (energy[tmpIndex] > 0.0f)
{
invenergy[tmpIndex] = 1.0f/(energy[tmpIndex] + EPS);
}
else
{
invenergy[tmpIndex] = 0.0f;
}
if (stage == 0)
{
measure = -10000000.0f;
if (crossDot > 0.0f)
measure = crossDot*crossDot*invenergy[tmpIndex];
}
else
{
measure = crossDot*crossDot*invenergy[tmpIndex];
}
/* check if measure is better */
ftmp = crossDot*invenergy[tmpIndex];
if ((measure > *max_measure) && (fabsf(ftmp) < CB_MAXGAIN))
{
*best_index = tmpIndex;
*max_measure = measure;
*gain = ftmp;
}
}
}
/*----------------------------------------------------------------*
* Recreate a specific codebook vector from the augmented part.
*
*----------------------------------------------------------------*/
void createAugmentedVec(int index, /* (i) Index for the augmented vector
to be created */
float *buffer, /* (i) Pointer to the end of the buffer for
augmented codebook construction */
float *cbVec) /* (o) The construced codebook vector */
{
int ilow;
int j;
float *pp;
float *ppo;
float *ppi;
float alfa;
float alfa1;
float weighted;
ilow = index - 5;
/* copy the first noninterpolated part */
pp = buffer - index;
memcpy(cbVec, pp, sizeof(float)*index);
/* interpolation */
alfa1 = 0.2f;
alfa = 0.0f;
ppo = buffer - 5;
ppi = buffer - index - 5;
for (j = ilow; j < index; j++)
{
weighted = (1.0f - alfa)*(*ppo) + alfa*(*ppi);
ppo++;
ppi++;
cbVec[j] = weighted;
alfa += alfa1;
}
/* copy the second noninterpolated part */
pp = buffer - index;
memcpy(cbVec + index, pp, sizeof(float)*(SUBL - index));
}

View File

@ -1,51 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* createCB.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: createCB.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
#ifndef __iLBC_CREATECB_H
#define __iLBC_CREATECB_H
void filteredCBvecs(float *cbvectors, /* (o) Codebook vector for the
higher section */
float *mem, /* (i) Buffer to create codebook
vectors from */
int lMem); /* (i) Length of buffer */
void searchAugmentedCB(int low, /* (i) Start index for the search */
int high, /* (i) End index for the search */
int stage, /* (i) Current stage */
int startIndex, /* (i) CB index for the first
augmented vector */
float *target, /* (i) Target vector for encoding */
float *buffer, /* (i) Pointer to the end of the
buffer for augmented codebook
construction */
float *max_measure, /* (i/o) Currently maximum measure */
int *best_index, /* (o) Currently the best index */
float *gain, /* (o) Currently the best gain */
float *energy, /* (o) Energy of augmented
codebook vectors */
float *invenergy); /* (o) Inv energy of aug codebook vectors */
void createAugmentedVec(int index, /* (i) Index for the aug vector to be created */
float *buffer, /* (i) Pointer to the end of the
buffer for augmented codebook
construction */
float *cbVec); /* (o) The construced codebook vector */
#endif

View File

@ -1,236 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* doCPLC.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: doCPLC.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <math.h>
#include <string.h>
#include "ilbc.h"
#include "doCPLC.h"
/*----------------------------------------------------------------*
* Compute cross correlation and pitch gain for pitch prediction
* of last subframe at given lag.
*---------------------------------------------------------------*/
static void compCorr(float *cc, /* (o) cross correlation coefficient */
float *gc, /* (o) gain */
float *pm,
float *buffer, /* (i) signal buffer */
int lag, /* (i) pitch lag */
int bLen, /* (i) length of buffer */
int sRange) /* (i) correlation search length */
{
int i;
float ftmp1;
float ftmp2;
float ftmp3;
/* Guard against getting outside buffer */
if ((bLen - sRange - lag) < 0)
sRange = bLen - lag;
ftmp1 = 0.0f;
ftmp2 = 0.0f;
ftmp3 = 0.0f;
for (i = 0; i < sRange; i++)
{
ftmp1 += buffer[bLen - sRange + i]*buffer[bLen - sRange + i - lag];
ftmp2 += buffer[bLen - sRange + i - lag]*buffer[bLen - sRange + i - lag];
ftmp3 += buffer[bLen - sRange + i]*buffer[bLen - sRange + i];
}
if (ftmp2 > 0.0f)
{
*cc = ftmp1*ftmp1/ftmp2;
*gc = fabsf(ftmp1/ftmp2);
*pm = fabsf(ftmp1)/(sqrtf(ftmp2)*sqrtf(ftmp3));
}
else
{
*cc = 0.0f;
*gc = 0.0f;
*pm = 0.0f;
}
}
/*----------------------------------------------------------------*
* Packet loss concealment routine. Conceals a residual signal
* and LP parameters. If no packet loss, update state.
*---------------------------------------------------------------*/
void doThePLC(float *PLCresidual, /* (o) concealed residual */
float *PLClpc, /* (o) concealed LP parameters */
int PLI, /* (i) packet loss indicator
0 - no PL, 1 = PL */
float *decresidual, /* (i) decoded residual */
float *lpc, /* (i) decoded LPC (only used for no PL) */
int inlag, /* (i) pitch lag */
ilbc_decode_state_t *iLBCdec_inst) /* (i/o) decoder instance */
{
int lag = 20l;
int randlag;
float gain;
float maxcc;
float use_gain;
float gain_comp, maxcc_comp, per, max_per = 0;
int i;
int pick;
int use_lag;
float ftmp;
float randvec[ILBC_BLOCK_LEN_MAX];
float pitchfact;
float energy;
/* Packet Loss */
if (PLI == 1)
{
iLBCdec_inst->consPLICount += 1;
if (iLBCdec_inst->prevPLI != 1)
{
/* previous frame not lost, determine pitch pred. gain */
/* Search around the previous lag to find the best pitch period */
lag = inlag - 3;
compCorr(&maxcc,
&gain,
&max_per,
iLBCdec_inst->prevResidual,
lag,
iLBCdec_inst->blockl,
60);
for (i = inlag - 2; i <= inlag + 3; i++)
{
compCorr(&maxcc_comp,
&gain_comp,
&per,
iLBCdec_inst->prevResidual,
i,
iLBCdec_inst->blockl,
60);
if (maxcc_comp>maxcc)
{
maxcc = maxcc_comp;
gain = gain_comp;
lag = i;
max_per = per;
}
}
}
else
{
/* previous frame lost, use recorded lag and periodicity */
lag = iLBCdec_inst->prevLag;
max_per = iLBCdec_inst->per;
}
/* downscaling */
use_gain = 1.0f;
if (iLBCdec_inst->consPLICount*iLBCdec_inst->blockl > 320)
use_gain = 0.9f;
else if (iLBCdec_inst->consPLICount*iLBCdec_inst->blockl > 2*320)
use_gain = 0.7f;
else if (iLBCdec_inst->consPLICount*iLBCdec_inst->blockl > 3*320)
use_gain = 0.5f;
else if (iLBCdec_inst->consPLICount*iLBCdec_inst->blockl > 4*320)
use_gain = 0.0f;
/* mix noise and pitch repeatition */
ftmp = sqrtf(max_per);
if (ftmp > 0.7f)
pitchfact = 1.0f;
else if (ftmp > 0.4f)
pitchfact = (ftmp - 0.4f)/(0.7f - 0.4f);
else
pitchfact = 0.0f;
/* avoid repetition of same pitch cycle */
use_lag = lag;
if (lag < 80)
use_lag = 2*lag;
/* compute concealed residual */
energy = 0.0f;
for (i = 0; i < iLBCdec_inst->blockl; i++)
{
/* noise component */
iLBCdec_inst->seed = (iLBCdec_inst->seed*69069L + 1) & (0x80000000L - 1);
randlag = 50 + ((signed long) iLBCdec_inst->seed)%70;
pick = i - randlag;
if (pick < 0)
randvec[i] = iLBCdec_inst->prevResidual[iLBCdec_inst->blockl + pick];
else
randvec[i] = randvec[pick];
/* pitch repeatition component */
pick = i - use_lag;
if (pick < 0)
PLCresidual[i] = iLBCdec_inst->prevResidual[iLBCdec_inst->blockl + pick];
else
PLCresidual[i] = PLCresidual[pick];
/* mix random and periodicity component */
if (i < 80)
PLCresidual[i] = use_gain*(pitchfact*PLCresidual[i] + (1.0f - pitchfact) * randvec[i]);
else if (i < 160)
PLCresidual[i] = 0.95f*use_gain*(pitchfact*PLCresidual[i] + (1.0f - pitchfact) * randvec[i]);
else
PLCresidual[i] = 0.9f*use_gain*(pitchfact*PLCresidual[i] + (1.0f - pitchfact) * randvec[i]);
energy += PLCresidual[i] * PLCresidual[i];
}
/* less than 30 dB, use only noise */
if (sqrt(energy/(float) iLBCdec_inst->blockl) < 30.0f)
{
gain = 0.0f;
for (i = 0; i < iLBCdec_inst->blockl; i++)
PLCresidual[i] = randvec[i];
}
/* use old LPC */
memcpy(PLClpc, iLBCdec_inst->prevLpc, (ILBC_LPC_FILTERORDER + 1)*sizeof(float));
}
else
{
/* no packet loss, copy input */
memcpy(PLCresidual, decresidual, iLBCdec_inst->blockl*sizeof(float));
memcpy(PLClpc, lpc, (ILBC_LPC_FILTERORDER + 1)*sizeof(float));
iLBCdec_inst->consPLICount = 0;
}
/* update state */
if (PLI)
{
iLBCdec_inst->prevLag = lag;
iLBCdec_inst->per = max_per;
}
iLBCdec_inst->prevPLI = PLI;
memcpy(iLBCdec_inst->prevLpc, PLClpc, (ILBC_LPC_FILTERORDER + 1)*sizeof(float));
memcpy(iLBCdec_inst->prevResidual, PLCresidual, iLBCdec_inst->blockl*sizeof(float));
}

View File

@ -1,31 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* doCPLC.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: doCPLC.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
#ifndef __iLBC_DOCLPC_H
#define __iLBC_DOCLPC_H
void doThePLC(float *PLCresidual, /* (o) concealed residual */
float *PLClpc, /* (o) concealed LP parameters */
int PLI, /* (i) packet loss indicator, 0 - no PL, 1 = PL */
float *decresidual, /* (i) decoded residual */
float *lpc, /* (i) decoded LPC (only used for no PL) */
int inlag, /* (i) pitch lag */
ilbc_decode_state_t *iLBCdec_inst); /* (i/o) decoder instance */
#endif

View File

@ -1,686 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* enhancer.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: enhancer.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <math.h>
#include <string.h>
#include "ilbc.h"
#include "constants.h"
#include "filter.h"
#include "enhancer.h"
/*----------------------------------------------------------------*
* Find index in array such that the array element with said
* index is the element of said array closest to "value"
* according to the squared-error criterion
*---------------------------------------------------------------*/
static void NearestNeighbor(int *index, /* (o) index of array element closest to value */
const float *array, /* (i) data array */
float value, /* (i) value */
int arlength) /* (i) dimension of data array */
{
int i;
float bestcrit;
float crit;
crit = array[0] - value;
bestcrit = crit*crit;
*index = 0;
for (i = 1; i < arlength; i++)
{
crit = array[i] - value;
crit = crit*crit;
if (crit < bestcrit)
{
bestcrit= crit;
*index = i;
}
}
}
/*----------------------------------------------------------------*
* compute cross correlation between sequences
*---------------------------------------------------------------*/
static void mycorr1(float *corr, /* (o) correlation of seq1 and seq2 */
float *seq1, /* (i) first sequence */
int dim1, /* (i) dimension first seq1 */
const float *seq2, /* (i) second sequence */
int dim2) /* (i) dimension seq2 */
{
int i;
int j;
for (i = 0; i <= dim1 - dim2; i++)
{
corr[i] = 0.0f;
for (j = 0; j < dim2; j++)
corr[i] += seq1[i + j]*seq2[j];
}
}
/*----------------------------------------------------------------*
* upsample finite array assuming zeros outside bounds
*---------------------------------------------------------------*/
static void enh_upsample(float *useq1, /* (o) upsampled output sequence */
float *seq1, /* (i) unupsampled sequence */
int dim1, /* (i) dimension seq1 */
int hfl) /* (i) polyphase filter length=2*hfl+1 */
{
float *pu;
float *ps;
int i;
int j;
int k;
int q;
int filterlength;
int hfl2;
const float *polyp[ENH_UPS0]; /* pointers to polyphase columns */
const float *pp;
/* define pointers for filter */
filterlength = 2*hfl + 1;
if (filterlength > dim1)
{
hfl2 = (int) (dim1/2);
for (j = 0; j < ENH_UPS0; j++)
polyp[j] = polyphaserTbl + j*filterlength + hfl - hfl2;
hfl = hfl2;
filterlength = 2*hfl + 1;
}
else
{
for (j = 0; j < ENH_UPS0; j++)
polyp[j] = polyphaserTbl+j*filterlength;
}
/* filtering: filter overhangs left side of sequence */
pu = useq1;
for (i = hfl; i < filterlength; i++)
{
for (j = 0; j < ENH_UPS0; j++)
{
*pu = 0.0f;
pp = polyp[j];
ps = seq1 + i;
for (k = 0; k <= i; k++)
*pu += *ps-- * *pp++;
pu++;
}
}
/* filtering: simple convolution=inner products */
for (i = filterlength; i < dim1; i++)
{
for (j = 0; j < ENH_UPS0; j++)
{
*pu = 0.0f;
pp = polyp[j];
ps = seq1 + i;
for (k = 0; k < filterlength; k++)
*pu += *ps-- * *pp++;
pu++;
}
}
/* filtering: filter overhangs right side of sequence */
for (q = 1; q <= hfl; q++)
{
for (j = 0; j < ENH_UPS0; j++)
{
*pu = 0.0f;
pp = polyp[j] + q;
ps = seq1 + dim1 - 1;
for (k = 0; k < filterlength - q; k++)
*pu += *ps-- * *pp++;
pu++;
}
}
}
/*----------------------------------------------------------------*
* find segment starting near idata+estSegPos that has highest
* correlation with idata+centerStartPos through
* idata+centerStartPos+ENH_BLOCKL-1 segment is found at a
* resolution of ENH_UPSO times the original of the original
* sampling rate
*---------------------------------------------------------------*/
static void refiner(float *seg, /* (o) segment array */
float *updStartPos, /* (o) updated start point */
float *idata, /* (i) original data buffer */
int idatal, /* (i) dimension of idata */
int centerStartPos, /* (i) beginning center segment */
float estSegPos, /* (i) estimated beginning other segment */
float period) /* (i) estimated pitch period */
{
int estSegPosRounded;
int searchSegStartPos;
int searchSegEndPos;
int corrdim;
int tloc;
int tloc2;
int i;
int st;
int en;
int fraction;
float vect[ENH_VECTL];
float corrVec[ENH_CORRDIM];
float maxv;
float corrVecUps[ENH_CORRDIM*ENH_UPS0];
period = period;
/* defining array bounds */
estSegPosRounded = (int)(estSegPos - 0.5f);
searchSegStartPos = estSegPosRounded - ENH_SLOP;
if (searchSegStartPos < 0)
searchSegStartPos = 0;
searchSegEndPos = estSegPosRounded + ENH_SLOP;
if (searchSegEndPos + ENH_BLOCKL >= idatal)
searchSegEndPos = idatal - ENH_BLOCKL - 1;
corrdim = searchSegEndPos - searchSegStartPos + 1;
/* compute upsampled correlation (corr33) and find location of max */
mycorr1(corrVec, idata + searchSegStartPos, corrdim + ENH_BLOCKL - 1, idata + centerStartPos, ENH_BLOCKL);
enh_upsample(corrVecUps, corrVec, corrdim, ENH_FL0);
tloc = 0;
maxv = corrVecUps[0];
for (i = 1; i < ENH_UPS0*corrdim; i++)
{
if (corrVecUps[i]>maxv)
{
tloc = i;
maxv = corrVecUps[i];
}
}
/* make vector can be upsampled without ever running outside bounds */
*updStartPos = (float) searchSegStartPos + (float) tloc/(float) ENH_UPS0 + 1.0f;
tloc2 = (int) (tloc/ENH_UPS0);
if (tloc > tloc2*ENH_UPS0)
tloc2++;
st = searchSegStartPos + tloc2 - ENH_FL0;
if (st < 0)
{
memset(vect, 0, -st*sizeof(float));
memcpy(&vect[-st], idata, (ENH_VECTL + st)*sizeof(float));
}
else
{
en = st + ENH_VECTL;
if (en>idatal)
{
memcpy(vect, &idata[st], (ENH_VECTL - (en - idatal))*sizeof(float));
memset(&vect[ENH_VECTL - (en - idatal)], 0, (en - idatal)*sizeof(float));
}
else
{
memcpy(vect, &idata[st], ENH_VECTL*sizeof(float));
}
}
fraction = tloc2*ENH_UPS0 - tloc;
/* compute the segment (this is actually a convolution) */
mycorr1(seg, vect, ENH_VECTL, polyphaserTbl + (2*ENH_FL0 + 1)*fraction, 2*ENH_FL0 + 1);
}
/*----------------------------------------------------------------*
* find the smoothed output data
*---------------------------------------------------------------*/
static void smath(float *odata, /* (o) smoothed output */
float *sseq, /* (i) said second sequence of waveforms */
int hl, /* (i) 2*hl+1 is sseq dimension */
float alpha0) /* (i) max smoothing energy fraction */
{
int i;
int k;
float w00;
float w10;
float w11;
float A;
float B;
float C;
float *psseq;
float err,errs;
float surround[ILBC_BLOCK_LEN_MAX]; /* shape contributed by other than current */
float wt[2*ENH_HL + 1]; /* waveform weighting to get surround shape */
float denom;
/* create shape of contribution from all waveforms except the
current one */
for (i = 1; i <= 2*hl + 1; i++)
wt[i - 1] = 0.5f*(1.0f - cosf(2.0f*PI*i/(2.0f*hl + 2.0f)));
wt[hl] = 0.0f; /* for clarity, not used */
for (i = 0; i < ENH_BLOCKL; i++)
surround[i] = sseq[i]*wt[0];
for (k = 1; k < hl; k++)
{
psseq = sseq + k*ENH_BLOCKL;
for (i = 0; i < ENH_BLOCKL; i++)
surround[i] += psseq[i]*wt[k];
}
for (k = hl + 1; k <= 2*hl; k++)
{
psseq = sseq + k*ENH_BLOCKL;
for (i = 0; i < ENH_BLOCKL; i++)
surround[i] += psseq[i]*wt[k];
}
/* compute some inner products */
w00 =
w10 =
w11 = 0.0f;
psseq = sseq + hl*ENH_BLOCKL; /* current block */
for (i = 0; i < ENH_BLOCKL; i++)
{
w00 += psseq[i]*psseq[i];
w11 += surround[i]*surround[i];
w10 += surround[i]*psseq[i];
}
if (fabsf(w11) < 1.0f)
w11 = 1.0f;
C = sqrtf(w00/w11);
/* first try enhancement without power-constraint */
errs = 0.0f;
psseq = sseq + hl*ENH_BLOCKL;
for (i = 0; i < ENH_BLOCKL; i++)
{
odata[i] = C*surround[i];
err = psseq[i] - odata[i];
errs += err*err;
}
/* if constraint violated by first try, add constraint */
if (errs > alpha0 * w00)
{
if (w00 < 1)
w00 = 1;
denom = (w11*w00 - w10*w10)/(w00*w00);
if (denom > 0.0001f)
{
/* eliminates numerical problems for if smooth */
A = sqrtf((alpha0 - alpha0*alpha0/4)/denom);
B = -alpha0/2.0f - A*w10/w00;
B = B + 1.0f;
}
else
{
/* essentially no difference between cycles; smoothing not needed */
A = 0.0f;
B = 1.0f;
}
/* create smoothed sequence */
psseq = sseq + hl*ENH_BLOCKL;
for (i = 0; i < ENH_BLOCKL; i++)
odata[i] = A*surround[i] + B*psseq[i];
}
}
/*----------------------------------------------------------------*
* get the pitch-synchronous sample sequence
*---------------------------------------------------------------*/
static void getsseq(float *sseq, /* (o) the pitch-synchronous sequence */
float *idata, /* (i) original data */
int idatal, /* (i) dimension of data */
int centerStartPos, /* (i) where current block starts */
float *period, /* (i) rough-pitch-period array */
const float *plocs, /* (i) where periods of period array are taken */
int periodl, /* (i) dimension period array */
int hl) /* (i) 2*hl+1 is the number of sequences */
{
int i;
int centerEndPos;
int q;
float blockStartPos[2*ENH_HL + 1];
int lagBlock[2*ENH_HL + 1];
float plocs2[ENH_PLOCSL];
float *psseq;
centerEndPos = centerStartPos + ENH_BLOCKL - 1;
/* present */
NearestNeighbor(lagBlock + hl,
plocs,
0.5f*(centerStartPos + centerEndPos),
periodl);
blockStartPos[hl] = (float) centerStartPos;
psseq = sseq + ENH_BLOCKL*hl;
memcpy(psseq, idata + centerStartPos, ENH_BLOCKL*sizeof(float));
/* past */
for (q = hl - 1; q >= 0; q--)
{
blockStartPos[q] = blockStartPos[q + 1] - period[lagBlock[q + 1]];
NearestNeighbor(lagBlock + q,
plocs,
blockStartPos[q] + ENH_BLOCKL_HALF - period[lagBlock[q + 1]],
periodl);
if (blockStartPos[q] - ENH_OVERHANG >= 0)
{
refiner(sseq + q*ENH_BLOCKL,
blockStartPos + q,
idata,
idatal,
centerStartPos,
blockStartPos[q],
period[lagBlock[q + 1]]);
}
else
{
psseq = sseq + q*ENH_BLOCKL;
memset(psseq, 0, ENH_BLOCKL*sizeof(float));
}
}
/* future */
for (i = 0; i < periodl; i++)
plocs2[i] = plocs[i] - period[i];
for (q = hl + 1; q <= 2*hl; q++)
{
NearestNeighbor(lagBlock + q, plocs2, blockStartPos[q - 1] + ENH_BLOCKL_HALF, periodl);
blockStartPos[q] = blockStartPos[q - 1] + period[lagBlock[q]];
if (blockStartPos[q] + ENH_BLOCKL + ENH_OVERHANG < idatal)
{
refiner(sseq + ENH_BLOCKL*q,
blockStartPos + q,
idata,
idatal,
centerStartPos,
blockStartPos[q],
period[lagBlock[q]]);
}
else
{
psseq = sseq + q*ENH_BLOCKL;
memset(psseq, 0, ENH_BLOCKL*sizeof(float));
}
}
}
/*----------------------------------------------------------------*
* perform enhancement on idata+centerStartPos through
* idata+centerStartPos+ENH_BLOCKL-1
*---------------------------------------------------------------*/
static void enhancer(float *odata, /* (o) smoothed block, dimension blockl */
float *idata, /* (i) data buffer used for enhancing */
int idatal, /* (i) dimension idata */
int centerStartPos, /* (i) first sample current block within idata */
float alpha0, /* (i) max correction-energy-fraction (in [0,1]) */
float *period, /* (i) pitch period array */
const float *plocs, /* (i) locations where period array values valid */
int periodl) /* (i) dimension of period and plocs */
{
float sseq[(2*ENH_HL + 1)*ENH_BLOCKL];
/* get said second sequence of segments */
getsseq(sseq, idata, idatal, centerStartPos, period, plocs, periodl, ENH_HL);
/* compute the smoothed output from said second sequence */
smath(odata, sseq, ENH_HL, alpha0);
}
/*----------------------------------------------------------------*
* cross correlation
*---------------------------------------------------------------*/
float xCorrCoef(float *target, /* (i) first array */
float *regressor, /* (i) second array */
int subl) /* (i) dimension arrays */
{
int i;
float ftmp1;
float ftmp2;
ftmp1 = 0.0f;
ftmp2 = 0.0f;
for (i = 0; i < subl; i++)
{
ftmp1 += target[i]*regressor[i];
ftmp2 += regressor[i]*regressor[i];
}
if (ftmp1 > 0.0f)
return (float)(ftmp1*ftmp1/ftmp2);
return 0.0f;
}
/*----------------------------------------------------------------*
* interface for enhancer
*---------------------------------------------------------------*/
int enhancerInterface(float *out, /* (o) enhanced signal */
float *in, /* (i) unenhanced signal */
ilbc_decode_state_t *iLBCdec_inst) /* (i) buffers etc */
{
float *enh_buf;
float *enh_period;
int iblock;
int isample;
int lag = 0;
int ilag;
int i;
int ioffset;
float cc;
float maxcc;
float ftmp1;
float ftmp2;
float *inPtr;
float *enh_bufPtr1;
float *enh_bufPtr2;
float plc_pred[ENH_BLOCKL];
float lpState[6];
float downsampled[(ENH_NBLOCKS*ENH_BLOCKL + 120)/2];
int inLen = ENH_NBLOCKS*ENH_BLOCKL + 120;
int start;
int plc_blockl;
int inlag;
enh_buf = iLBCdec_inst->enh_buf;
enh_period = iLBCdec_inst->enh_period;
memmove(enh_buf,
&enh_buf[iLBCdec_inst->blockl],
(ENH_BUFL - iLBCdec_inst->blockl)*sizeof(float));
memcpy(&enh_buf[ENH_BUFL - iLBCdec_inst->blockl],
in,
iLBCdec_inst->blockl*sizeof(float));
if (iLBCdec_inst->mode == 30)
plc_blockl = ENH_BLOCKL;
else
plc_blockl = 40;
/* when 20 ms frame, move processing one block */
ioffset = 0;
if (iLBCdec_inst->mode == 20)
ioffset = 1;
i = 3 - ioffset;
memmove(enh_period, &enh_period[i], (ENH_NBLOCKS_TOT - i)*sizeof(float));
/* Set state information to the 6 samples right before
the samples to be downsampled. */
memcpy(lpState,
enh_buf + (ENH_NBLOCKS_EXTRA + ioffset)*ENH_BLOCKL - 126,
6*sizeof(float));
/* Down sample a factor 2 to save computations */
DownSample(enh_buf + (ENH_NBLOCKS_EXTRA + ioffset)*ENH_BLOCKL - 120,
lpFilt_coefsTbl,
inLen - ioffset*ENH_BLOCKL,
lpState,
downsampled);
/* Estimate the pitch in the down sampled domain. */
for (iblock = 0; iblock<ENH_NBLOCKS-ioffset; iblock++)
{
lag = 10;
maxcc = xCorrCoef(downsampled + 60 + iblock*ENH_BLOCKL_HALF,
downsampled + 60 + iblock*ENH_BLOCKL_HALF - lag,
ENH_BLOCKL_HALF);
for (ilag = 11; ilag < 60; ilag++)
{
cc = xCorrCoef(downsampled + 60 + iblock*ENH_BLOCKL_HALF,
downsampled + 60 + iblock*ENH_BLOCKL_HALF - ilag,
ENH_BLOCKL_HALF);
if (cc > maxcc)
{
maxcc = cc;
lag = ilag;
}
}
/* Store the estimated lag in the non-downsampled domain */
enh_period[iblock + ENH_NBLOCKS_EXTRA + ioffset] = (float) lag*2.0f;
}
/* PLC was performed on the previous packet */
if (iLBCdec_inst->prev_enh_pl == 1)
{
inlag = (int) enh_period[ENH_NBLOCKS_EXTRA + ioffset];
lag = inlag - 1;
maxcc = xCorrCoef(in, in + lag, plc_blockl);
for (ilag = inlag; ilag <= inlag + 1; ilag++)
{
cc = xCorrCoef(in, in + ilag, plc_blockl);
if (cc > maxcc)
{
maxcc = cc;
lag = ilag;
}
}
enh_period[ENH_NBLOCKS_EXTRA + ioffset - 1] = (float) lag;
/* compute new concealed residual for the old lookahead,
mix the forward PLC with a backward PLC from
the new frame */
inPtr = &in[lag - 1];
enh_bufPtr1 = &plc_pred[plc_blockl - 1];
if (lag > plc_blockl)
start = plc_blockl;
else
start = lag;
for (isample = start; isample > 0; isample--)
*enh_bufPtr1-- = *inPtr--;
enh_bufPtr2=&enh_buf[ENH_BUFL - 1 - iLBCdec_inst->blockl];
for (isample = (plc_blockl - 1 - lag); isample >= 0; isample--)
*enh_bufPtr1-- = *enh_bufPtr2--;
/* limit energy change */
ftmp2 = 0.0f;
ftmp1 = 0.0f;
for (i = 0; i < plc_blockl; i++)
{
ftmp2 += enh_buf[ENH_BUFL - 1 - iLBCdec_inst->blockl - i]*enh_buf[ENH_BUFL - 1 - iLBCdec_inst->blockl - i];
ftmp1 += plc_pred[i]*plc_pred[i];
}
ftmp1 = sqrtf(ftmp1/(float) plc_blockl);
ftmp2 = sqrtf(ftmp2/(float) plc_blockl);
if (ftmp1 > 2.0f*ftmp2 && ftmp1 > 0.0f)
{
for (i = 0; i < plc_blockl - 10; i++)
plc_pred[i] *= 2.0f*ftmp2/ftmp1;
for (i = plc_blockl - 10; i < plc_blockl; i++)
plc_pred[i]*=(float)(i - plc_blockl + 10)*(1.0f - 2.0f*ftmp2/ftmp1)/10.0f + 2.0f*ftmp2/ftmp1;
}
enh_bufPtr1 = &enh_buf[ENH_BUFL - 1 - iLBCdec_inst->blockl];
for (i = 0; i < plc_blockl; i++)
{
ftmp1 = (float) (i + 1)/(float) (plc_blockl + 1);
*enh_bufPtr1 *= ftmp1;
*enh_bufPtr1 += (1.0f - ftmp1)*plc_pred[plc_blockl - 1 - i];
enh_bufPtr1--;
}
}
if (iLBCdec_inst->mode == 20)
{
/* Enhancer with 40 samples delay */
for (iblock = 0; iblock < 2; iblock++)
{
enhancer(out + iblock*ENH_BLOCKL,
enh_buf,
ENH_BUFL,
(5 + iblock)*ENH_BLOCKL + 40,
ENH_ALPHA0,
enh_period,
enh_plocsTbl,
ENH_NBLOCKS_TOT);
}
}
else if (iLBCdec_inst->mode == 30)
{
/* Enhancer with 80 samples delay */
for (iblock = 0; iblock < 3; iblock++)
{
enhancer(out + iblock*ENH_BLOCKL,
enh_buf,
ENH_BUFL,
(4 + iblock)*ENH_BLOCKL,
ENH_ALPHA0,
enh_period,
enh_plocsTbl,
ENH_NBLOCKS_TOT);
}
}
return lag*2;
}

View File

@ -1,31 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* enhancer.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: enhancer.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
#ifndef __ENHANCER_H
#define __ENHANCER_H
float xCorrCoef(float *target, /* (i) first array */
float *regressor, /* (i) second array */
int subl); /* (i) dimension arrays */
int enhancerInterface(float *out, /* (o) the enhanced recidual signal */
float *in, /* (i) the recidual signal to enhance */
ilbc_decode_state_t *iLBCdec_inst); /* (i/o) the decoder state structure */
#endif

View File

@ -1,166 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* filter.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: filter.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include "iLBC_define.h"
#include "filter.h"
/*----------------------------------------------------------------*
* all-pole filter
*---------------------------------------------------------------*/
void AllPoleFilter(float *InOut, /* (i/o) on entrance InOut[-orderCoef] to
InOut[-1] contain the state of the
filter (delayed samples). InOut[0] to
InOut[lengthInOut-1] contain the filter
input, on en exit InOut[-orderCoef] to
InOut[-1] is unchanged and InOut[0] to
InOut[lengthInOut-1] contain filtered
samples */
const float *Coef, /* (i) filter coefficients, Coef[0] is assumed to be 1.0 */
int lengthInOut, /* (i) number of input/output samples */
int orderCoef) /* (i) number of filter coefficients */
{
int n;
int k;
for (n = 0; n < lengthInOut; n++)
{
for (k = 1; k <= orderCoef; k++)
*InOut -= Coef[k]*InOut[-k];
InOut++;
}
}
/*----------------------------------------------------------------*
* all-zero filter
*---------------------------------------------------------------*/
void AllZeroFilter(float *In, /* (i) In[0] to In[lengthInOut-1] contain
filter input samples */
const float *Coef, /* (i) filter coefficients (Coef[0] is assumed to be 1.0) */
int lengthInOut, /* (i) number of input/output samples */
int orderCoef, /* (i) number of filter coefficients */
float *Out) /* (i/o) on entrance Out[-orderCoef] to Out[-1]
contain the filter state, on exit Out[0]
to Out[lengthInOut-1] contain filtered
samples */
{
int n;
int k;
for (n = 0; n < lengthInOut; n++)
{
*Out = Coef[0]*In[0];
for (k = 1; k <= orderCoef; k++)
*Out += Coef[k]*In[-k];
Out++;
In++;
}
}
/*----------------------------------------------------------------*
* pole-zero filter
*---------------------------------------------------------------*/
void ZeroPoleFilter(float *In, /* (i) In[0] to In[lengthInOut-1] contain
filter input samples In[-orderCoef] to
In[-1] contain state of all-zero
section */
const float *ZeroCoef, /* (i) filter coefficients for all-zero
section (ZeroCoef[0] is assumed to
be 1.0) */
const float *PoleCoef, /* (i) filter coefficients for all-pole section
(ZeroCoef[0] is assumed to be 1.0) */
int lengthInOut, /* (i) number of input/output samples */
int orderCoef, /* (i) number of filter coefficients */
float *Out) /* (i/o) on entrance Out[-orderCoef] to Out[-1]
contain state of all-pole section. On
exit Out[0] to Out[lengthInOut-1]
contain filtered samples */
{
AllZeroFilter(In, ZeroCoef, lengthInOut, orderCoef, Out);
AllPoleFilter(Out, PoleCoef, lengthInOut, orderCoef);
}
/*----------------------------------------------------------------*
* downsample (LP filter and decimation)
*---------------------------------------------------------------*/
void DownSample(const float *In, /* (i) input samples */
const float *Coef, /* (i) filter coefficients */
int lengthIn, /* (i) number of input samples */
float *state, /* (i) filter state */
float *Out) /* (o) downsampled output */
{
float o;
float *Out_ptr = Out;
const float *Coef_ptr;
const float *In_ptr;
float *state_ptr;
int i;
int j;
int stop;
/* LP filter and decimate at the same time */
for (i = DELAY_DS; i < lengthIn; i += FACTOR_DS)
{
Coef_ptr = &Coef[0];
In_ptr = &In[i];
state_ptr = &state[FILTERORDER_DS - 2];
o = 0.0f;
stop = (i < FILTERORDER_DS) ? (i + 1) : FILTERORDER_DS;
for (j = 0; j < stop; j++)
o += *Coef_ptr++ * (*In_ptr--);
for (j = i + 1; j < FILTERORDER_DS; j++)
o += *Coef_ptr++ * (*state_ptr--);
*Out_ptr++ = o;
}
/* Get the last part (use zeros as input for the future) */
for (i = (lengthIn + FACTOR_DS); i < (lengthIn + DELAY_DS); i += FACTOR_DS)
{
o = 0.0f;
if (i<lengthIn)
{
Coef_ptr = &Coef[0];
for (j = 0; j < FILTERORDER_DS; j++)
o += *Coef_ptr++ * (*Out_ptr--);
}
else
{
Coef_ptr = &Coef[i - lengthIn];
In_ptr = &In[lengthIn - 1];
for (j = 0; j < FILTERORDER_DS - (i - lengthIn); j++)
o += *Coef_ptr++ * (*In_ptr--);
}
*Out_ptr++ = o;
}
}

View File

@ -1,66 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* filter.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: filter.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
#ifndef __iLBC_FILTER_H
#define __iLBC_FILTER_H
void AllPoleFilter(float *InOut, /* (i/o) on entrance InOut[-orderCoef] to
InOut[-1] contain the state of the
filter (delayed samples). InOut[0] to
InOut[lengthInOut-1] contain the filter
input, on en exit InOut[-orderCoef] to
InOut[-1] is unchanged and InOut[0] to
InOut[lengthInOut-1] contain filtered
samples */
const float *Coef, /* (i) filter coefficients, Coef[0] is assumed to be 1.0 */
int lengthInOut, /* (i) number of input/output samples */
int orderCoef); /* (i) number of filter coefficients */
void AllZeroFilter(float *In, /* (i) In[0] to In[lengthInOut-1] contain
filter input samples */
const float *Coef, /* (i) filter coefficients (Coef[0] is assumed to be 1.0) */
int lengthInOut, /* (i) number of input/output samples */
int orderCoef, /* (i) number of filter coefficients */
float *Out); /* (i/o) on entrance Out[-orderCoef] to Out[-1]
contain the filter state, on exit Out[0]
to Out[lengthInOut-1] contain filtered
samples */
void ZeroPoleFilter(float *In, /* (i) In[0] to In[lengthInOut-1] contain filter
input samples In[-orderCoef] to In[-1]
contain state of all-zero section */
const float *ZeroCoef, /* (i) filter coefficients for all-zero
section (ZeroCoef[0] is assumed to
be 1.0) */
const float *PoleCoef, /* (i) filter coefficients for all-pole section
(ZeroCoef[0] is assumed to be 1.0) */
int lengthInOut, /* (i) number of input/output samples */
int orderCoef, /* (i) number of filter coefficients */
float *Out); /* (i/o) on entrance Out[-orderCoef] to Out[-1]
contain state of all-pole section. On
exit Out[0] to Out[lengthInOut-1]
contain filtered samples */
void DownSample(const float *In, /* (i) input samples */
const float *Coef, /* (i) filter coefficients */
int lengthIn, /* (i) number of input samples */
float *state, /* (i) filter state */
float *Out); /* (o) downsampled output */
#endif

View File

@ -1,111 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* gainquant.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: gainquant.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <math.h>
#include <string.h>
#include "constants.h"
#include "filter.h"
#include "gainquant.h"
/*----------------------------------------------------------------*
* quantizer for the gain in the gain-shape coding of residual
*---------------------------------------------------------------*/
float gainquant( /* (o) quantized gain value */
float in, /* (i) gain value */
float maxIn, /* (i) maximum of gain value */
int cblen, /* (i) number of quantization indices */
int *index) /* (o) quantization index */
{
int i;
int tindex;
float minmeasure;
float measure;
const float *cb;
float scale;
/* ensure a lower bound on the scaling factor */
scale = maxIn;
if (scale < 0.1f)
scale = 0.1f;
/* select the quantization table */
if (cblen == 8)
cb = gain_sq3Tbl;
else if (cblen == 16)
cb = gain_sq4Tbl;
else
cb = gain_sq5Tbl;
/* select the best index in the quantization table */
minmeasure = 10000000.0f;
tindex = 0;
for (i = 0; i < cblen; i++)
{
measure = (in-scale*cb[i])*(in-scale*cb[i]);
if (measure < minmeasure)
{
tindex = i;
minmeasure = measure;
}
}
*index = tindex;
/* return the quantized value */
return scale*cb[tindex];
}
/*----------------------------------------------------------------*
* decoder for quantized gains in the gain-shape coding of
* residual
*---------------------------------------------------------------*/
float gaindequant( /* (o) quantized gain value */
int index, /* (i) quantization index */
float maxIn, /* (i) maximum of unquantized gain */
int cblen) /* (i) number of quantization indices */
{
float scale;
/* obtain correct scale factor */
scale = fabsf(maxIn);
if (scale < 0.1f)
scale = 0.1f;
/* select the quantization table and return the decoded value */
if (cblen == 8)
return scale*gain_sq3Tbl[index];
if (cblen == 16)
return scale*gain_sq4Tbl[index];
if (cblen == 32)
return scale*gain_sq5Tbl[index];
return 0.0;
}

View File

@ -1,34 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* gainquant.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: gainquant.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
#ifndef __iLBC_GAINQUANT_H
#define __iLBC_GAINQUANT_H
float gainquant( /* (o) quantized gain value */
float in, /* (i) gain value */
float maxIn, /* (i) maximum of gain value */
int cblen, /* (i) number of quantization indices */
int *index); /* (o) quantization index */
float gaindequant( /* (o) quantized gain value */
int index, /* (i) quantization index */
float maxIn, /* (i) maximum of unquantized gain */
int cblen); /* (i) number of quantization indices */
#endif

View File

@ -1,169 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* getCBvec.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: getCBvec.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <string.h>
#include "ilbc.h"
#include "constants.h"
#include "getCBvec.h"
/*----------------------------------------------------------------*
* Construct codebook vector for given index.
*---------------------------------------------------------------*/
void getCBvec(float *cbvec, /* (o) Constructed codebook vector */
float *mem, /* (i) Codebook buffer */
int index, /* (i) Codebook index */
int lMem, /* (i) Length of codebook buffer */
int cbveclen) /* (i) Codebook vector length */
{
int j;
int k;
int n;
int memInd;
int sFilt;
float tmpbuf[CB_MEML];
int base_size;
int ilow;
int ihigh;
float alfa;
float alfa1;
/* Determine size of codebook sections */
base_size = lMem - cbveclen + 1;
if (cbveclen == SUBL)
base_size += cbveclen/2;
/* No filter -> First codebook section */
if (index < lMem - cbveclen + 1)
{
/* First non-interpolated vectors */
k = index + cbveclen;
/* Get vector */
memcpy(cbvec, mem + lMem - k, cbveclen*sizeof(float));
}
else if (index < base_size)
{
k = 2*(index - (lMem - cbveclen + 1)) + cbveclen;
ihigh = k/2;
ilow = ihigh - 5;
/* Copy first noninterpolated part */
memcpy(cbvec, mem + lMem - k/2, ilow*sizeof(float));
/* Interpolation */
alfa1 = 0.2f;
alfa = 0.0f;
for (j = ilow; j < ihigh; j++)
{
cbvec[j] = (1.0f - alfa)*mem[lMem - k/2 + j] + alfa*mem[lMem - k + j];
alfa += alfa1;
}
/* Copy second noninterpolated part */
memcpy(cbvec + ihigh, mem + lMem - k + ihigh, (cbveclen - ihigh)*sizeof(float));
}
/* Higher codebook section based on filtering */
else
{
if (index - base_size < lMem - cbveclen + 1)
{
float tempbuff2[CB_MEML + CB_FILTERLEN + 1];
float *pos;
const float *pp;
const float *pp1;
/* Non-interpolated vectors */
memset(tempbuff2, 0, CB_HALFFILTERLEN*sizeof(float));
memcpy(&tempbuff2[CB_HALFFILTERLEN], mem, lMem*sizeof(float));
memset(&tempbuff2[lMem + CB_HALFFILTERLEN], 0, (CB_HALFFILTERLEN + 1)*sizeof(float));
k = index - base_size + cbveclen;
sFilt = lMem - k;
memInd = sFilt + 1 - CB_HALFFILTERLEN;
/* do filtering */
pos = cbvec;
memset(pos, 0, cbveclen*sizeof(float));
for (n = 0; n < cbveclen; n++)
{
pp = &tempbuff2[memInd + n + CB_HALFFILTERLEN];
pp1 = &cbfiltersTbl[CB_FILTERLEN - 1];
for (j = 0; j < CB_FILTERLEN; j++)
(*pos) += (*pp++)*(*pp1--);
pos++;
}
}
else
{
float tempbuff2[CB_MEML + CB_FILTERLEN + 1];
float *pos;
const float *pp;
const float *pp1;
int i;
/* Interpolated vectors */
memset(tempbuff2, 0, CB_HALFFILTERLEN*sizeof(float));
memcpy(&tempbuff2[CB_HALFFILTERLEN], mem, lMem*sizeof(float));
memset(&tempbuff2[lMem + CB_HALFFILTERLEN], 0, (CB_HALFFILTERLEN + 1)*sizeof(float));
k = 2*(index-base_size - (lMem - cbveclen + 1)) + cbveclen;
sFilt = lMem - k;
memInd = sFilt + 1 - CB_HALFFILTERLEN;
/* do filtering */
pos = &tmpbuf[sFilt];
memset(pos, 0, k*sizeof(float));
for (i = 0; i < k; i++)
{
pp = &tempbuff2[memInd + i + CB_HALFFILTERLEN];
pp1 = &cbfiltersTbl[CB_FILTERLEN - 1];
for (j = 0; j < CB_FILTERLEN; j++)
(*pos) += (*pp++)*(*pp1--);
pos++;
}
ihigh = k/2;
ilow = ihigh - 5;
/* Copy first noninterpolated part */
memcpy(cbvec, tmpbuf + lMem - k/2, ilow*sizeof(float));
/* interpolation */
alfa1 = 0.2f;
alfa = 0.0f;
for (j = ilow; j < ihigh; j++)
{
cbvec[j] = (1.0f - alfa)*tmpbuf[lMem - k/2 + j]+alfa*tmpbuf[lMem - k + j];
alfa += alfa1;
}
/* Copy second noninterpolated part */
memcpy(cbvec + ihigh, tmpbuf + lMem - k + ihigh, (cbveclen - ihigh)*sizeof(float));
}
}
}

View File

@ -1,29 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* getCBvec.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: getCBvec.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
#ifndef __iLBC_GETCBVEC_H
#define __iLBC_GETCBVEC_H
void getCBvec(float *cbvec, /* (o) Constructed codebook vector */
float *mem, /* (i) Codebook buffer */
int index, /* (i) Codebook index */
int lMem, /* (i) Length of codebook buffer */
int cbveclen); /* (i) Codebook vector length */
#endif

View File

@ -1,334 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* helpfun.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: helpfun.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <math.h>
#include "ilbc.h"
#include "constants.h"
#include "helpfun.h"
/*----------------------------------------------------------------*
* calculation of auto correlation
*----------------------------------------------------------------*/
void autocorr(float *r, /* (o) autocorrelation vector */
const float *x, /* (i) data vector */
int N, /* (i) length of data vector */
int order) /* largest lag for calculated autocorrelations */
{
int lag;
int n;
float sum;
for (lag = 0; lag <= order; lag++)
{
sum = 0;
for (n = 0; n < N - lag; n++)
sum += x[n]*x[n + lag];
r[lag] = sum;
}
}
/*----------------------------------------------------------------*
* window multiplication
*---------------------------------------------------------------*/
void window(float *z, /* (o) the windowed data */
const float *x, /* (i) the original data vector */
const float *y, /* (i) the window */
int N) /* (i) length of all vectors */
{
int i;
for (i = 0; i < N; i++)
z[i] = x[i]*y[i];
}
/*----------------------------------------------------------------*
* levinson-durbin solution for lpc coefficients
*---------------------------------------------------------------*/
void levdurb(float *a, /* (o) lpc coefficient vector starting with 1.0 */
float *k, /* (o) reflection coefficients */
float *r, /* (i) autocorrelation vector */
int order) /* (i) order of lpc filter */
{
float sum;
float alpha;
int m;
int m_h;
int i;
a[0] = 1.0f;
if (r[0] < EPS)
{
/* if r[0] <= 0, set LPC coeff. to zero */
for (i = 0; i < order; i++)
{
k[i] = 0;
a[i+1] = 0;
}
}
else
{
a[1] = k[0] = -r[1]/r[0];
alpha = r[0] + r[1]*k[0];
for (m = 1; m < order; m++)
{
sum = r[m + 1];
for (i = 0; i < m; i++)
sum += a[i + 1]*r[m - i];
k[m] = -sum/alpha;
alpha += k[m]*sum;
m_h = (m + 1) >> 1;
for (i = 0; i < m_h; i++)
{
sum = a[i + 1] + k[m]*a[m - i];
a[m - i] += k[m]*a[i+1];
a[i + 1] = sum;
}
a[m + 1] = k[m];
}
}
}
/*----------------------------------------------------------------*
* interpolation between vectors
*---------------------------------------------------------------*/
void interpolate(float *out, /* (o) the interpolated vector */
float *in1, /* (i) the first vector for the
interpolation */
float *in2, /* (i) the second vector for the
interpolation */
float coef, /* (i) interpolation weights */
int length) /* (i) length of all vectors */
{
int i;
float invcoef;
invcoef = 1.0f - coef;
for (i = 0; i < length; i++)
out[i] = coef*in1[i] + invcoef*in2[i];
}
/*----------------------------------------------------------------*
* lpc bandwidth expansion
*---------------------------------------------------------------*/
void bwexpand(float *out, /* (o) the bandwidth expanded lpc coefficients */
float *in, /* (i) the lpc coefficients before bandwidth expansion */
float coef, /* (i) the bandwidth expansion factor */
int length) /* (i) the length of lpc coefficient vectors */
{
int i;
float chirp;
chirp = coef;
out[0] = in[0];
for (i = 1; i < length; i++)
{
out[i] = chirp*in[i];
chirp *= coef;
}
}
/*----------------------------------------------------------------*
* vector quantization
*---------------------------------------------------------------*/
void vq(float *Xq, /* (o) the quantized vector */
int *index, /* (o) the quantization index */
const float *CB, /* (i) the vector quantization codebook */
float *X, /* (i) the vector to quantize */
int n_cb, /* (i) the number of vectors in the codebook */
int dim) /* (i) the dimension of all vectors */
{
int i;
int j;
int pos;
int minindex;
float dist;
float tmp;
float mindist;
pos = 0;
mindist = FLOAT_MAX;
minindex = 0;
for (j = 0; j < n_cb; j++)
{
dist = X[0] - CB[pos];
dist *= dist;
for (i = 1; i < dim; i++)
{
tmp = X[i] - CB[pos + i];
dist += tmp*tmp;
}
if (dist < mindist)
{
mindist = dist;
minindex = j;
}
pos += dim;
}
for (i = 0; i < dim; i++)
Xq[i] = CB[minindex*dim + i];
*index = minindex;
}
/*----------------------------------------------------------------*
* split vector quantization
*---------------------------------------------------------------*/
void SplitVQ(float *qX, /* (o) the quantized vector */
int *index, /* (o) a vector of indexes for all vector
codebooks in the split */
float *X, /* (i) the vector to quantize */
const float *CB, /* (i) the quantizer codebook */
int nsplit, /* the number of vector splits */
const int *dim, /* the dimension of X and qX */
const int *cbsize) /* the number of vectors in the codebook */
{
int cb_pos;
int X_pos;
int i;
cb_pos = 0;
X_pos = 0;
for (i = 0; i < nsplit; i++)
{
vq(qX + X_pos, index + i, CB + cb_pos, X + X_pos, cbsize[i], dim[i]);
X_pos += dim[i];
cb_pos += dim[i]*cbsize[i];
}
}
/*----------------------------------------------------------------*
* scalar quantization
*---------------------------------------------------------------*/
void sort_sq(float *xq, /* (o) the quantized value */
int *index, /* (o) the quantization index */
float x, /* (i) the value to quantize */
const float *cb, /* (i) the quantization codebook */
int cb_size) /* (i) the size of the quantization codebook */
{
int i;
if (x <= cb[0])
{
*index = 0;
*xq = cb[0];
}
else
{
i = 0;
while ((x > cb[i]) && i < cb_size - 1)
{
i++;
}
if (x > ((cb[i] + cb[i - 1])/2))
{
*index = i;
*xq = cb[i];
}
else
{
*index = i - 1;
*xq = cb[i - 1];
}
}
}
/*----------------------------------------------------------------*
* check for stability of lsf coefficients
*---------------------------------------------------------------*/
int LSF_check( /* (o) 1 for stable lsf vectors and 0 for nonstable ones */
float *lsf, /* (i) a table of lsf vectors */
int dim, /* (i) the dimension of each lsf vector */
int NoAn) /* (i) the number of lsf vectors in the table */
{
int k;
int n;
int m;
int Nit = 2;
int change = 0;
int pos;
float tmp;
static const float eps = 0.039f; /* 50 Hz */
static const float eps2 = 0.0195f;
static const float maxlsf = 3.14f; /* 4000 Hz */
static const float minlsf = 0.01f; /* 0 Hz */
/* LSF separation check*/
for (n = 0; n < Nit; n++)
{
/* Run through a couple of times */
for (m = 0; m < NoAn; m++)
{
/* Number of analyses per frame */
for (k = 0; k < (dim - 1); k++)
{
pos = m*dim + k;
if ((lsf[pos + 1] - lsf[pos]) < eps)
{
if (lsf[pos + 1] < lsf[pos])
{
tmp = lsf[pos + 1];
lsf[pos + 1] = lsf[pos] + eps2;
lsf[pos] = lsf[pos + 1] - eps2;
}
else
{
lsf[pos] -= eps2;
lsf[pos+1] += eps2;
}
change = 1;
}
if (lsf[pos] < minlsf)
{
lsf[pos] = minlsf;
change = 1;
}
if (lsf[pos] > maxlsf)
{
lsf[pos] = maxlsf;
change = 1;
}
}
}
}
return change;
}

View File

@ -1,80 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* helpfun.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: helpfun.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
#ifndef __iLBC_HELPFUN_H
#define __iLBC_HELPFUN_H
void autocorr(float *r, /* (o) autocorrelation vector */
const float *x, /* (i) data vector */
int N, /* (i) length of data vector */
int order); /* largest lag for calculated
autocorrelations */
void window(float *z, /* (o) the windowed data */
const float *x, /* (i) the original data vector */
const float *y, /* (i) the window */
int N); /* (i) length of all vectors */
void levdurb(float *a, /* (o) lpc coefficient vector starting with 1.0 */
float *k, /* (o) reflection coefficients */
float *r, /* (i) autocorrelation vector */
int order); /* (i) order of lpc filter */
void interpolate(float *out, /* (o) the interpolated vector */
float *in1, /* (i) the first vector for the
interpolation */
float *in2, /* (i) the second vector for the
interpolation */
float coef, /* (i) interpolation weights */
int length); /* (i) length of all vectors */
void bwexpand(float *out, /* (o) the bandwidth expanded lpc coefficients */
float *in, /* (i) the lpc coefficients before bandwidth
expansion */
float coef, /* (i) the bandwidth expansion factor */
int length); /* (i) the length of lpc coefficient vectors */
void vq(float *Xq, /* (o) the quantized vector */
int *index, /* (o) the quantization index */
const float *CB, /* (i) the vector quantization codebook */
float *X, /* (i) the vector to quantize */
int n_cb, /* (i) the number of vectors in the codebook */
int dim); /* (i) the dimension of all vectors */
void SplitVQ(float *qX, /* (o) the quantized vector */
int *index, /* (o) a vector of indexes for all vector
codebooks in the split */
float *X, /* (i) the vector to quantize */
const float *CB, /* (i) the quantizer codebook */
int nsplit, /* the number of vector splits */
const int *dim, /* the dimension of X and qX */
const int *cbsize); /* the number of vectors in the codebook */
void sort_sq(float *xq, /* (o) the quantized value */
int *index, /* (o) the quantization index */
float x, /* (i) the value to quantize */
const float *cb, /* (i) the quantization codebook */
int cb_size); /* (i) the size of the quantization codebook */
int LSF_check( /* (o) 1 for stable lsf vectors and 0 for nonstable ones */
float *lsf, /* (i) a table of lsf vectors */
int dim, /* (i) the dimension of each lsf vector */
int NoAn); /* (i) the number of lsf vectors in the table */
#endif

View File

@ -1,70 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* hpInput.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: hpInput.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include "constants.h"
#include "hpInput.h"
/*----------------------------------------------------------------*
* Input high-pass filter
*---------------------------------------------------------------*/
void hpInput(const float *In, /* (i) vector to filter */
int len, /* (i) length of vector to filter */
float *Out, /* (o) the resulting filtered vector */
float *mem) /* (i/o) the filter state */
{
int i;
const float *pi;
float *po;
/* all-zero section*/
pi = &In[0];
po = &Out[0];
for (i = 0; i < len; i++)
{
*po = hpi_zero_coefsTbl[0]*(*pi);
*po += hpi_zero_coefsTbl[1]*mem[0];
*po += hpi_zero_coefsTbl[2]*mem[1];
mem[1] = mem[0];
mem[0] = *pi;
po++;
pi++;
}
/* all-pole section*/
po = &Out[0];
for (i = 0; i < len; i++)
{
*po -= hpi_pole_coefsTbl[1]*mem[2];
*po -= hpi_pole_coefsTbl[2]*mem[3];
mem[3] = mem[2];
mem[2] = *po;
po++;
}
}

View File

@ -1,28 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* hpInput.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: hpInput.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
#ifndef __iLBC_HPINPUT_H
#define __iLBC_HPINPUT_H
void hpInput(const float *In, /* (i) vector to filter */
int len, /* (i) length of vector to filter */
float *Out, /* (o) the resulting filtered vector */
float *mem); /* (i/o) the filter state */
#endif

View File

@ -1,70 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* hpOutput.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: hpOutput.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include "constants.h"
#include "hpOutput.h"
/*----------------------------------------------------------------*
* Output high-pass filter
*---------------------------------------------------------------*/
void hpOutput(float *In, /* (i) vector to filter */
int len, /* (i) length of vector to filter */
float *Out, /* (o) the resulting filtered vector */
float *mem) /* (i/o) the filter state */
{
int i;
float *pi;
float *po;
/* all-zero section*/
pi = &In[0];
po = &Out[0];
for (i = 0; i < len; i++)
{
*po = hpo_zero_coefsTbl[0]*(*pi);
*po += hpo_zero_coefsTbl[1]*mem[0];
*po += hpo_zero_coefsTbl[2]*mem[1];
mem[1] = mem[0];
mem[0] = *pi;
po++;
pi++;
}
/* all-pole section*/
po = &Out[0];
for (i = 0; i < len; i++)
{
*po -= hpo_pole_coefsTbl[1]*mem[2];
*po -= hpo_pole_coefsTbl[2]*mem[3];
mem[3] = mem[2];
mem[2] = *po;
po++;
}
}

View File

@ -1,28 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* hpOutput.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: hpOutput.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
#ifndef __iLBC_HPOUTPUT_H
#define __iLBC_HPOUTPUT_H
void hpOutput(float *In, /* (i) vector to filter */
int len, /* (i) length of vector to filter */
float *Out, /* (o) the resulting filtered vector */
float *mem); /* (i/o) the filter state */
#endif

View File

@ -1,117 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* iCBConstruct.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: iCBConstruct.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <math.h>
#include "ilbc.h"
#include "gainquant.h"
#include "getCBvec.h"
#include "iCBConstruct.h"
/*----------------------------------------------------------------*
* Convert the codebook indexes to make the search easier
*---------------------------------------------------------------*/
void index_conv_enc(int *index) /* (i/o) Codebook indexes */
{
int k;
for (k = 1; k < CB_NSTAGES; k++)
{
if ((index[k] >= 108) && (index[k] < 172))
{
index[k] -= 64;
}
else if (index[k] >= 236)
{
index[k] -= 128;
}
else
{
/* ERROR */
}
}
}
void index_conv_dec(int *index) /* (i/o) Codebook indexes */
{
int k;
for (k = 1; k < CB_NSTAGES; k++)
{
if ((index[k] >= 44) && (index[k] < 108))
{
index[k] += 64;
}
else if ((index[k] >= 108) && (index[k] < 128))
{
index[k] += 128;
}
else
{
/* ERROR */
}
}
}
/*----------------------------------------------------------------*
* Construct decoded vector from codebook and gains.
*---------------------------------------------------------------*/
void iCBConstruct(float *decvector, /* (o) Decoded vector */
int *index, /* (i) Codebook indices */
int *gain_index, /* (i) Gain quantization indices */
float *mem, /* (i) Buffer for codevector construction */
int lMem, /* (i) Length of buffer */
int veclen, /* (i) Length of vector */
int nStages) /* (i) Number of codebook stages */
{
int j;
int k;
float gain[CB_NSTAGES];
float cbvec[SUBL];
/* Gain de-quantization */
gain[0] = gaindequant(gain_index[0], 1.0, 32);
if (nStages > 1)
gain[1] = gaindequant(gain_index[1], fabsf(gain[0]), 16);
if (nStages > 2)
gain[2] = gaindequant(gain_index[2], fabsf(gain[1]), 8);
/* Codebook vector construction and construction of total vector */
getCBvec(cbvec, mem, index[0], lMem, veclen);
for (j = 0; j < veclen; j++)
decvector[j] = gain[0]*cbvec[j];
if (nStages > 1)
{
for (k = 1; k < nStages; k++)
{
getCBvec(cbvec, mem, index[k], lMem, veclen);
for (j = 0; j < veclen; j++)
decvector[j] += gain[k]*cbvec[j];
}
}
}

View File

@ -1,35 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* iCBConstruct.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: iCBConstruct.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
#ifndef __iLBC_ICBCONSTRUCT_H
#define __iLBC_ICBCONSTRUCT_H
void index_conv_enc(int *index); /* (i/o) Codebook indexes */
void index_conv_dec(int *index); /* (i/o) Codebook indexes */
void iCBConstruct(float *decvector, /* (o) Decoded vector */
int *index, /* (i) Codebook indices */
int *gain_index, /* (i) Gain quantization indices */
float *mem, /* (i) Buffer for codevector construction */
int lMem, /* (i) Length of buffer */
int veclen, /* (i) Length of vector */
int nStages); /* (i) Number of codebook stages */
#endif

View File

@ -1,478 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* iCBSearch.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: iCBSearch.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <math.h>
#include <string.h>
#include "ilbc.h"
#include "gainquant.h"
#include "createCB.h"
#include "filter.h"
#include "constants.h"
#include "iCBSearch.h"
/*----------------------------------------------------------------*
* Search routine for codebook encoding and gain quantization.
*---------------------------------------------------------------*/
void iCBSearch(ilbc_encode_state_t *iLBCenc_inst, /* (i) the encoder state structure */
int *index, /* (o) Codebook indices */
int *gain_index, /* (o) Gain quantization indices */
float *intarget, /* (i) Target vector for encoding */
float *mem, /* (i) Buffer for codebook construction */
int lMem, /* (i) Length of buffer */
int lTarget, /* (i) Length of vector */
int nStages, /* (i) Number of codebook stages */
float *weightDenum, /* (i) weighting filter coefficients */
float *weightState, /* (i) weighting filter state */
int block) /* (i) the sub-block number */
{
int i;
int j;
int icount;
int stage;
int best_index;
int range;
int counter;
float max_measure;
float gain;
float measure;
float crossDot;
float ftmp;
float gains[CB_NSTAGES];
float target[SUBL];
int base_index;
int sInd;
int eInd;
int base_size;
int sIndAug = 0;
int eIndAug = 0;
float buf[CB_MEML + SUBL + 2*ILBC_LPC_FILTERORDER];
float invenergy[CB_EXPAND*128];
float energy[CB_EXPAND*128];
float *pp;
float *ppi = 0;
float *ppo = 0;
float *ppe = 0;
float cbvectors[CB_MEML];
float tene;
float cene;
float cvec[SUBL];
float aug_vec[SUBL];
memset(cvec, 0, SUBL*sizeof(float));
/* Determine size of codebook sections */
base_size = lMem - lTarget + 1;
if (lTarget == SUBL)
base_size = lMem - lTarget + 1 + lTarget/2;
/* setup buffer for weighting */
memcpy(buf, weightState, sizeof(float)*ILBC_LPC_FILTERORDER);
memcpy(buf + ILBC_LPC_FILTERORDER, mem, lMem*sizeof(float));
memcpy(buf + ILBC_LPC_FILTERORDER + lMem, intarget, lTarget*sizeof(float));
/* weighting */
AllPoleFilter(buf + ILBC_LPC_FILTERORDER, weightDenum, lMem + lTarget, ILBC_LPC_FILTERORDER);
/* Construct the codebook and target needed */
memcpy(target, buf + ILBC_LPC_FILTERORDER + lMem, lTarget*sizeof(float));
tene = 0.0f;
for (i = 0; i < lTarget; i++)
tene += target[i]*target[i];
/* Prepare search over one more codebook section. This section
is created by filtering the original buffer with a filter. */
filteredCBvecs(cbvectors, buf + ILBC_LPC_FILTERORDER, lMem);
/* The Main Loop over stages */
for (stage = 0; stage < nStages; stage++)
{
range = search_rangeTbl[block][stage];
/* initialize search measure */
max_measure = -10000000.0f;
gain = 0.0f;
best_index = 0;
/* Compute cross dot product between the target and the CB memory */
crossDot = 0.0f;
pp = buf + ILBC_LPC_FILTERORDER + lMem - lTarget;
for (j = 0; j < lTarget; j++)
{
crossDot += target[j]*(*pp++);
}
if (stage == 0)
{
/* Calculate energy in the first block of 'lTarget' samples. */
ppe = energy;
ppi = buf + ILBC_LPC_FILTERORDER + lMem - lTarget - 1;
ppo = buf + ILBC_LPC_FILTERORDER + lMem - 1;
*ppe = 0.0f;
pp = buf + ILBC_LPC_FILTERORDER + lMem - lTarget;
for (j = 0; j < lTarget; j++, pp++)
*ppe += (*pp)*(*pp);
if (*ppe > 0.0)
{
invenergy[0] = 1.0f/(*ppe + EPS);
}
else
{
invenergy[0] = 0.0f;
}
ppe++;
measure = -10000000.0f;
if (crossDot > 0.0f)
measure = crossDot*crossDot*invenergy[0];
}
else
{
measure = crossDot*crossDot*invenergy[0];
}
/* Check if measure is better */
ftmp = crossDot*invenergy[0];
if ((measure>max_measure) && (fabs(ftmp) < CB_MAXGAIN))
{
best_index = 0;
max_measure = measure;
gain = ftmp;
}
/* loop over the main first codebook section, full search */
for (icount = 1; icount < range; icount++)
{
/* calculate measure */
crossDot = 0.0f;
pp = buf + ILBC_LPC_FILTERORDER + lMem - lTarget - icount;
for (j = 0; j < lTarget; j++)
crossDot += target[j]*(*pp++);
if (stage == 0)
{
*ppe++ = energy[icount-1] + (*ppi)*(*ppi) - (*ppo)*(*ppo);
ppo--;
ppi--;
if (energy[icount] > 0.0f)
{
invenergy[icount] = 1.0f/(energy[icount] + EPS);
}
else
{
invenergy[icount] = 0.0f;
}
measure = -10000000.0f;
if (crossDot > 0.0f)
measure = crossDot*crossDot*invenergy[icount];
}
else
{
measure = crossDot*crossDot*invenergy[icount];
}
/* check if measure is better */
ftmp = crossDot*invenergy[icount];
if ((measure > max_measure) && (fabs(ftmp) < CB_MAXGAIN))
{
best_index = icount;
max_measure = measure;
gain = ftmp;
}
}
/* Loop over augmented part in the first codebook
* section, full search.
* The vectors are interpolated.
*/
if (lTarget == SUBL)
{
/* Search for best possible cb vector and compute the CB-vectors' energy. */
searchAugmentedCB(20, 39, stage, base_size - lTarget/2,
target, buf + ILBC_LPC_FILTERORDER + lMem,
&max_measure, &best_index, &gain, energy,
invenergy);
}
/* set search range for following codebook sections */
base_index = best_index;
/* unrestricted search */
if (CB_RESRANGE == -1)
{
sInd = 0;
eInd = range - 1;
sIndAug = 20;
eIndAug = 39;
}
/* restricted search around best index from first codebook section */
else
{
/* Initialize search indices */
sIndAug = 0;
eIndAug = 0;
sInd = base_index - CB_RESRANGE/2;
eInd = sInd + CB_RESRANGE;
if (lTarget == SUBL)
{
if (sInd < 0)
{
sIndAug = 40 + sInd;
eIndAug = 39;
sInd=0;
}
else if (base_index < (base_size - 20))
{
if (eInd > range)
{
sInd -= (eInd-range);
eInd = range;
}
}
else
{
/* base_index >= (base_size-20) */
if (sInd < (base_size - 20))
{
sIndAug = 20;
sInd = 0;
eInd = 0;
eIndAug = 19 + CB_RESRANGE;
if (eIndAug > 39)
{
eInd = eIndAug - 39;
eIndAug = 39;
}
}
else
{
sIndAug = 20 + sInd - (base_size - 20);
eIndAug = 39;
sInd = 0;
eInd = CB_RESRANGE - (eIndAug - sIndAug + 1);
}
}
}
else
{
/* lTarget = 22 or 23 */
if (sInd < 0)
{
eInd -= sInd;
sInd = 0;
}
if (eInd > range)
{
sInd -= (eInd - range);
eInd = range;
}
}
}
/* search of higher codebook section */
/* index search range */
counter = sInd;
sInd += base_size;
eInd += base_size;
if (stage == 0)
{
ppe = energy+base_size;
*ppe = 0.0f;
pp = cbvectors + lMem - lTarget;
for (j = 0; j < lTarget; j++, pp++)
*ppe += (*pp)*(*pp);
ppi = cbvectors + lMem - 1 - lTarget;
ppo = cbvectors + lMem - 1;
for (j = 0; j < (range - 1); j++)
{
*(ppe+1) = *ppe + (*ppi)*(*ppi) - (*ppo)*(*ppo);
ppo--;
ppi--;
ppe++;
}
}
/* loop over search range */
for (icount = sInd; icount < eInd; icount++)
{
/* calculate measure */
crossDot = 0.0f;
pp = cbvectors + lMem - (counter++) - lTarget;
for (j = 0; j < lTarget; j++)
crossDot += target[j]*(*pp++);
if (energy[icount] > 0.0f)
invenergy[icount] = 1.0f/(energy[icount] + EPS);
else
invenergy[icount] = 0.0f;
if (stage == 0)
{
measure = -10000000.0f;
if (crossDot > 0.0f)
measure = crossDot*crossDot*invenergy[icount];
}
else
{
measure = crossDot*crossDot*invenergy[icount];
}
/* check if measure is better */
ftmp = crossDot*invenergy[icount];
if ((measure > max_measure) && (fabs(ftmp) < CB_MAXGAIN))
{
best_index = icount;
max_measure = measure;
gain = ftmp;
}
}
/* Search the augmented CB inside the limited range. */
if ((lTarget == SUBL) && (sIndAug != 0))
{
searchAugmentedCB(sIndAug, eIndAug, stage,
2*base_size-20, target, cbvectors + lMem,
&max_measure, &best_index, &gain, energy,
invenergy);
}
/* record best index */
index[stage] = best_index;
/* gain quantization */
if (stage == 0)
{
if (gain < 0.0f)
gain = 0.0f;
if (gain > CB_MAXGAIN)
gain = (float) CB_MAXGAIN;
gain = gainquant(gain, 1.0, 32, &gain_index[stage]);
}
else
{
if (stage == 1)
gain = gainquant(gain, fabsf(gains[stage - 1]), 16, &gain_index[stage]);
else
gain = gainquant(gain, fabsf(gains[stage - 1]), 8, &gain_index[stage]);
}
/* Extract the best (according to measure) codebook vector */
if (lTarget == (STATE_LEN - iLBCenc_inst->state_short_len))
{
if (index[stage] < base_size)
pp = buf + ILBC_LPC_FILTERORDER + lMem - lTarget - index[stage];
else
pp = cbvectors + lMem - lTarget - index[stage] + base_size;
}
else
{
if (index[stage] < base_size)
{
if (index[stage] < (base_size - 20))
{
pp = buf + ILBC_LPC_FILTERORDER + lMem - lTarget - index[stage];
}
else
{
createAugmentedVec(index[stage] - base_size + 40,
buf + ILBC_LPC_FILTERORDER + lMem,
aug_vec);
pp = aug_vec;
}
}
else
{
int filterno, position;
filterno = index[stage]/base_size;
position = index[stage] - filterno*base_size;
if (position < (base_size - 20))
{
pp = cbvectors + filterno*lMem - lTarget - index[stage] + filterno*base_size;
}
else
{
createAugmentedVec(index[stage] - (filterno + 1)*base_size + 40,
cbvectors + filterno*lMem,
aug_vec);
pp = aug_vec;
}
}
}
/* Subtract the best codebook vector, according to measure, from the target vector */
for (j = 0; j < lTarget; j++)
{
cvec[j] += gain*(*pp);
target[j] -= gain*(*pp++);
}
/* record quantized gain */
gains[stage] = gain;
}
/* Gain adjustment for energy matching */
cene = 0.0f;
for (i = 0; i < lTarget; i++)
cene += cvec[i]*cvec[i];
j = gain_index[0];
for (i = gain_index[0]; i < 32; i++)
{
ftmp = cene*gain_sq5Tbl[i]*gain_sq5Tbl[i];
if ((ftmp < (tene*gains[0]*gains[0])) && (gain_sq5Tbl[j] < (2.0*gains[0])))
j = i;
}
gain_index[0] = j;
}

View File

@ -1,35 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* iCBSearch.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: iCBSearch.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
#ifndef __iLBC_ICBSEARCH_H
#define __iLBC_ICBSEARCH_H
void iCBSearch(ilbc_encode_state_t *iLBCenc_inst, /* (i) the encoder state structure */
int *index, /* (o) Codebook indices */
int *gain_index, /* (o) Gain quantization indices */
float *intarget, /* (i) Target vector for encoding */
float *mem, /* (i) Buffer for codebook construction */
int lMem, /* (i) Length of buffer */
int lTarget, /* (i) Length of vector */
int nStages, /* (i) Number of codebook stages */
float *weightDenum, /* (i) weighting filter coefficients */
float *weightState, /* (i) weighting filter state */
int block); /* (i) the sub-block number */
#endif

View File

@ -1,646 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* iLBC_decode.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: iLBC_decode.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <math.h>
#include <stdlib.h>
#include "ilbc.h"
#include "StateConstructW.h"
#include "LPCdecode.h"
#include "iCBConstruct.h"
#include "doCPLC.h"
#include "helpfun.h"
#include "constants.h"
#include "packing.h"
#include "string.h"
#include "enhancer.h"
#include "hpOutput.h"
#include "syntFilter.h"
#if (defined(WIN32) || defined(_WIN32)) && (_MSC_VER < 1800)
#if (defined(WIN32) || defined(_WIN32)) && !defined(_WIN64)
__inline long int rint(double dbl)
{
_asm
{
fld dbl
frndint
fstp dbl
}
return (long int) dbl;
}
#elif defined (_WIN64)
#include <intrin.h>
__inline__ long int rint(double x)
{
#ifdef _M_X64
return (long int)_mm_cvtsd_si64x( _mm_loadu_pd ((const double*)&x) );
#else
#warning "Not Supported: Replacing with a simple C cast."
return (long int) (x);
#endif
}
#endif
#endif
/*----------------------------------------------------------------*
* frame residual decoder function (subrutine to iLBC_decode)
*---------------------------------------------------------------*/
static void Decode(ilbc_decode_state_t *iLBCdec_inst, /* (i/o) the decoder state structure */
float *decresidual, /* (o) decoded residual frame */
int start, /* (i) location of start state */
int idxForMax, /* (i) codebook index for the maximum value */
int *idxVec, /* (i) codebook indexes for the samples in the
start state */
float *syntdenum, /* (i) the decoded synthesis filter coefficients */
int *cb_index, /* (i) the indexes for the adaptive codebook */
int *gain_index, /* (i) the indexes for the corresponding gains */
int *extra_cb_index, /* (i) the indexes for the adaptive codebook part
of start state */
int *extra_gain_index, /* (i) the indexes for the corresponding gains */
int state_first) /* (i) 1 if non adaptive part of start state comes
first. 0 if that part comes last */
{
float reverseDecresidual[ILBC_BLOCK_LEN_MAX];
float mem[CB_MEML];
int k;
int meml_gotten;
int Nfor;
int Nback;
int i;
int diff;
int start_pos;
int subcount;
int subframe;
diff = STATE_LEN - iLBCdec_inst->state_short_len;
if (state_first == 1)
start_pos = (start - 1)*SUBL;
else
start_pos = (start - 1)*SUBL + diff;
/* decode scalar part of start state */
StateConstructW(idxForMax,
idxVec,
&syntdenum[(start - 1)*(ILBC_LPC_FILTERORDER + 1)],
&decresidual[start_pos],
iLBCdec_inst->state_short_len);
if (state_first)
{
/* put adaptive part in the end */
/* setup memory */
memset(mem, 0, (CB_MEML - iLBCdec_inst->state_short_len)*sizeof(float));
memcpy(&mem[CB_MEML - iLBCdec_inst->state_short_len],
decresidual + start_pos,
iLBCdec_inst->state_short_len*sizeof(float));
/* construct decoded vector */
iCBConstruct(&decresidual[start_pos+iLBCdec_inst->state_short_len],
extra_cb_index, extra_gain_index, mem+CB_MEML-stMemLTbl,
stMemLTbl,
diff,
CB_NSTAGES);
}
else
{
/* Put adaptive part in the beginning */
/* Create reversed vectors for prediction */
for (k = 0; k < diff; k++)
{
reverseDecresidual[k] =
decresidual[(start + 1)*SUBL - 1 - (k + iLBCdec_inst->state_short_len)];
}
/* Setup memory */
meml_gotten = iLBCdec_inst->state_short_len;
for (k = 0; k < meml_gotten; k++)
mem[CB_MEML - 1 - k] = decresidual[start_pos + k];
memset(mem, 0, (CB_MEML - k)*sizeof(float));
/* Construct decoded vector */
iCBConstruct(reverseDecresidual, extra_cb_index,
extra_gain_index,
mem + CB_MEML - stMemLTbl,
stMemLTbl,
diff,
CB_NSTAGES);
/* Get decoded residual from reversed vector */
for (k = 0; k < diff; k++)
decresidual[start_pos - 1 - k] = reverseDecresidual[k];
}
/* Counter for predicted sub-frames */
subcount = 0;
/* Forward prediction of sub-frames */
Nfor = iLBCdec_inst->nsub-start - 1;
if (Nfor > 0)
{
/* Setup memory */
memset(mem, 0, (CB_MEML - STATE_LEN)*sizeof(float));
memcpy(&mem[CB_MEML - STATE_LEN], decresidual + (start - 1)*SUBL, STATE_LEN*sizeof(float));
/* Loop over sub-frames to encode */
for (subframe = 0; subframe < Nfor; subframe++)
{
/* Construct decoded vector */
iCBConstruct(&decresidual[(start + 1 + subframe)*SUBL],
cb_index+subcount*CB_NSTAGES,
gain_index+subcount*CB_NSTAGES,
mem + CB_MEML - memLfTbl[subcount],
memLfTbl[subcount],
SUBL,
CB_NSTAGES);
/* Update memory */
memmove(mem, &mem[SUBL], (CB_MEML - SUBL)*sizeof(float));
memmove(&mem[CB_MEML - SUBL],
&decresidual[(start + 1 + subframe)*SUBL],
SUBL*sizeof(float));
subcount++;
}
}
/* Backward prediction of sub-frames */
Nback = start - 1;
if (Nback > 0)
{
/* Setup memory */
meml_gotten = SUBL*(iLBCdec_inst->nsub + 1 - start);
if (meml_gotten > CB_MEML)
meml_gotten = CB_MEML;
for (k = 0; k < meml_gotten; k++)
mem[CB_MEML - 1 - k] = decresidual[(start - 1)*SUBL + k];
memset(mem, 0, (CB_MEML - k)*sizeof(float));
/* Loop over subframes to decode */
for (subframe = 0; subframe < Nback; subframe++)
{
/* Construct decoded vector */
iCBConstruct(&reverseDecresidual[subframe*SUBL],
cb_index + subcount*CB_NSTAGES,
gain_index + subcount*CB_NSTAGES,
mem + CB_MEML - memLfTbl[subcount],
memLfTbl[subcount],
SUBL,
CB_NSTAGES);
/* Update memory */
memmove(mem, &mem[SUBL], (CB_MEML - SUBL)*sizeof(float));
memmove(&mem[CB_MEML - SUBL],
&reverseDecresidual[subframe*SUBL],
SUBL*sizeof(float));
subcount++;
}
/* Get decoded residual from reversed vector */
for (i = 0; i < SUBL*Nback; i++)
decresidual[SUBL*Nback - i - 1] = reverseDecresidual[i];
}
}
/*----------------------------------------------------------------*
* main decoder function
*---------------------------------------------------------------*/
static void ilbc_decode_frame(ilbc_decode_state_t *iLBCdec_inst, /* (i/o) the decoder state structure */
float decblock[], /* (o) decoded signal block */
const uint8_t bytes[], /* (i) encoded signal bits */
int mode) /* (i) 0: bad packet, PLC, 1: normal */
{
float data[ILBC_BLOCK_LEN_MAX];
float lsfdeq[ILBC_LPC_FILTERORDER*LPC_N_MAX];
float PLCresidual[ILBC_BLOCK_LEN_MAX];
float PLClpc[ILBC_LPC_FILTERORDER + 1];
float zeros[ILBC_BLOCK_LEN_MAX];
float one[ILBC_LPC_FILTERORDER + 1];
int k;
int i;
int start;
int idxForMax;
int pos;
int lastpart;
int ulp;
int lag;
int ilag;
float cc;
float maxcc;
int idxVec[STATE_LEN];
int gain_index[NASUB_MAX*CB_NSTAGES];
int extra_gain_index[CB_NSTAGES];
int cb_index[CB_NSTAGES*NASUB_MAX];
int extra_cb_index[CB_NSTAGES];
int lsf_i[LSF_NSPLIT*LPC_N_MAX];
int state_first;
int last_bit;
const uint8_t *pbytes;
float weightdenum[(ILBC_LPC_FILTERORDER + 1)*ILBC_NUM_SUB_MAX];
int order_plus_one;
float syntdenum[ILBC_NUM_SUB_MAX*(ILBC_LPC_FILTERORDER + 1)];
float decresidual[ILBC_BLOCK_LEN_MAX];
if (mode > 0)
{
/* The data is good. decode it. */
pbytes = bytes;
pos = 0;
/* Set everything to zero before decoding */
for (k = 0; k < LSF_NSPLIT*LPC_N_MAX; k++)
lsf_i[k] = 0;
start = 0;
state_first = 0;
idxForMax = 0;
for (k = 0; k < iLBCdec_inst->state_short_len; k++)
idxVec[k] = 0;
for (k = 0; k < CB_NSTAGES; k++)
{
extra_cb_index[k] = 0;
extra_gain_index[k] = 0;
}
for (i = 0; i < iLBCdec_inst->nasub; i++)
{
for (k = 0; k < CB_NSTAGES; k++)
{
cb_index[i*CB_NSTAGES + k] = 0;
gain_index[i*CB_NSTAGES + k] = 0;
}
}
/* Loop over ULP classes */
for (ulp = 0; ulp < 3; ulp++)
{
/* LSF */
for (k = 0; k < LSF_NSPLIT*iLBCdec_inst->lpc_n; k++)
{
unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->lsf_bits[k][ulp], &pos);
packcombine(&lsf_i[k], lastpart, iLBCdec_inst->ULP_inst->lsf_bits[k][ulp]);
}
/* Start block info */
unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->start_bits[ulp], &pos);
packcombine(&start, lastpart, iLBCdec_inst->ULP_inst->start_bits[ulp]);
unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->startfirst_bits[ulp], &pos);
packcombine(&state_first, lastpart, iLBCdec_inst->ULP_inst->startfirst_bits[ulp]);
unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->scale_bits[ulp], &pos);
packcombine(&idxForMax, lastpart, iLBCdec_inst->ULP_inst->scale_bits[ulp]);
for (k = 0; k < iLBCdec_inst->state_short_len; k++)
{
unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->state_bits[ulp], &pos);
packcombine(idxVec + k, lastpart, iLBCdec_inst->ULP_inst->state_bits[ulp]);
}
/* 23/22 (20ms/30ms) sample block */
for (k = 0; k < CB_NSTAGES; k++)
{
unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->extra_cb_index[k][ulp], &pos);
packcombine(extra_cb_index + k, lastpart, iLBCdec_inst->ULP_inst->extra_cb_index[k][ulp]);
}
for (k = 0; k < CB_NSTAGES; k++)
{
unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->extra_cb_gain[k][ulp], &pos);
packcombine(extra_gain_index + k, lastpart, iLBCdec_inst->ULP_inst->extra_cb_gain[k][ulp]);
}
/* The two/four (20ms/30ms) 40 sample sub-blocks */
for (i = 0; i < iLBCdec_inst->nasub; i++)
{
for (k = 0; k < CB_NSTAGES; k++)
{
unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->cb_index[i][k][ulp], &pos);
packcombine(cb_index + i*CB_NSTAGES + k, lastpart, iLBCdec_inst->ULP_inst->cb_index[i][k][ulp]);
}
}
for (i = 0; i < iLBCdec_inst->nasub; i++)
{
for (k = 0; k < CB_NSTAGES; k++)
{
unpack(&pbytes, &lastpart, iLBCdec_inst->ULP_inst->cb_gain[i][k][ulp], &pos);
packcombine(gain_index + i*CB_NSTAGES + k, lastpart, iLBCdec_inst->ULP_inst->cb_gain[i][k][ulp]);
}
}
}
/* Extract last bit. If it is 1 this indicates an empty/lost frame */
unpack(&pbytes, &last_bit, 1, &pos);
/* Check for bit errors or empty/lost frames */
if (start < 1)
mode = 0;
if (iLBCdec_inst->mode == 20 && start > 3)
mode = 0;
if (iLBCdec_inst->mode == 30 && start > 5)
mode = 0;
if (last_bit == 1)
mode = 0;
if (mode == 1)
{
/* No bit errors was detected, continue decoding */
/* Adjust index */
index_conv_dec(cb_index);
/* Decode the LSF */
SimplelsfDEQ(lsfdeq, lsf_i, iLBCdec_inst->lpc_n);
LSF_check(lsfdeq, ILBC_LPC_FILTERORDER, iLBCdec_inst->lpc_n);
DecoderInterpolateLSF(syntdenum, weightdenum, lsfdeq, ILBC_LPC_FILTERORDER, iLBCdec_inst);
Decode(iLBCdec_inst,
decresidual,
start,
idxForMax,
idxVec,
syntdenum,
cb_index,
gain_index,
extra_cb_index,
extra_gain_index,
state_first);
/* Preparing the plc for a future loss! */
doThePLC(PLCresidual,
PLClpc,
0,
decresidual,
syntdenum + (ILBC_LPC_FILTERORDER + 1)*(iLBCdec_inst->nsub - 1),
(*iLBCdec_inst).last_lag,
iLBCdec_inst);
memcpy(decresidual, PLCresidual, iLBCdec_inst->blockl*sizeof(float));
}
}
if (mode == 0)
{
/* The data is bad (either a PLC call
* was made or a severe bit error was detected)
*/
/* Apply packet loss concealmeant */
memset(zeros, 0, ILBC_BLOCK_LEN_MAX*sizeof(float));
one[0] = 1;
memset(one + 1, 0, ILBC_LPC_FILTERORDER*sizeof(float));
start = 0;
doThePLC(PLCresidual, PLClpc, 1, zeros, one, (*iLBCdec_inst).last_lag, iLBCdec_inst);
memcpy(decresidual, PLCresidual, iLBCdec_inst->blockl*sizeof(float));
order_plus_one = ILBC_LPC_FILTERORDER + 1;
for (i = 0; i < iLBCdec_inst->nsub; i++)
memcpy(&syntdenum[i*order_plus_one], PLClpc, order_plus_one*sizeof(float));
}
if (iLBCdec_inst->use_enhancer == 1)
{
/* Post filtering */
iLBCdec_inst->last_lag = enhancerInterface(data, decresidual, iLBCdec_inst);
/* Synthesis filtering */
if (iLBCdec_inst->mode == 20)
{
/* Enhancer has 40 samples delay */
i = 0;
syntFilter(data + i*SUBL,
iLBCdec_inst->old_syntdenum + (i + iLBCdec_inst->nsub - 1)*(ILBC_LPC_FILTERORDER + 1),
SUBL,
iLBCdec_inst->syntMem);
for (i = 1; i < iLBCdec_inst->nsub; i++)
{
syntFilter(data + i*SUBL,
syntdenum + (i - 1)*(ILBC_LPC_FILTERORDER + 1),
SUBL,
iLBCdec_inst->syntMem);
}
}
else if (iLBCdec_inst->mode == 30)
{
/* Enhancer has 80 samples delay */
for (i = 0; i < 2; i++)
{
syntFilter(data + i*SUBL,
iLBCdec_inst->old_syntdenum + (i + iLBCdec_inst->nsub - 2)*(ILBC_LPC_FILTERORDER+1),
SUBL,
iLBCdec_inst->syntMem);
}
for (i = 2; i < iLBCdec_inst->nsub; i++)
{
syntFilter(data + i*SUBL,
syntdenum + (i - 2)*(ILBC_LPC_FILTERORDER + 1),
SUBL,
iLBCdec_inst->syntMem);
}
}
}
else
{
/* Find last lag */
lag = 20;
maxcc = xCorrCoef(&decresidual[ILBC_BLOCK_LEN_MAX - ENH_BLOCKL],
&decresidual[ILBC_BLOCK_LEN_MAX - ENH_BLOCKL - lag],
ENH_BLOCKL);
for (ilag = 21; ilag < 120; ilag++)
{
cc = xCorrCoef(&decresidual[ILBC_BLOCK_LEN_MAX - ENH_BLOCKL],
&decresidual[ILBC_BLOCK_LEN_MAX - ENH_BLOCKL - ilag],
ENH_BLOCKL);
if (cc > maxcc)
{
maxcc = cc;
lag = ilag;
}
}
iLBCdec_inst->last_lag = lag;
/* Copy data and run synthesis filter */
memcpy(data, decresidual, iLBCdec_inst->blockl*sizeof(float));
for (i = 0; i < iLBCdec_inst->nsub; i++)
{
syntFilter(data + i*SUBL,
syntdenum + i*(ILBC_LPC_FILTERORDER + 1),
SUBL,
iLBCdec_inst->syntMem);
}
}
/* High pass filtering on output if desired, otherwise copy to out */
hpOutput(data, iLBCdec_inst->blockl, decblock, iLBCdec_inst->hpomem);
/* memcpy(decblock, data, iLBCdec_inst->blockl*sizeof(float));*/
memcpy(iLBCdec_inst->old_syntdenum,
syntdenum,
iLBCdec_inst->nsub*(ILBC_LPC_FILTERORDER + 1)*sizeof(float));
iLBCdec_inst->prev_enh_pl = 0;
if (mode == 0)
{
/* PLC was used */
iLBCdec_inst->prev_enh_pl = 1;
}
}
int ilbc_decode(ilbc_decode_state_t *s, /* (i/o) the decoder state structure */
int16_t amp[], /* (o) decoded signal block */
const uint8_t bytes[], /* (i) encoded signal bits */
int len)
{
int i;
int j;
int k;
float decblock[ILBC_BLOCK_LEN_MAX];
float dtmp;
for (i = 0, j = 0; j < len; i += s->blockl, j += s->no_of_bytes)
{
ilbc_decode_frame(s, decblock, bytes + j, 1);
/* Convert to int16_t */
for (k = 0; k < s->blockl; k++)
{
dtmp = decblock[k];
if (dtmp < MIN_SAMPLE)
dtmp = MIN_SAMPLE;
else if (dtmp > MAX_SAMPLE)
dtmp = MAX_SAMPLE;
amp[i + k] = (int16_t) rint(dtmp);
}
}
return i;
}
int ilbc_fillin(ilbc_decode_state_t *s, /* (i/o) the decoder state structure */
int16_t amp[], /* (o) decoded signal block */
int len)
{
int i;
int j;
int k;
float decblock[ILBC_BLOCK_LEN_MAX];
float dtmp;
for (i = 0, j = 0; j < len; i += s->blockl, j += s->no_of_bytes)
{
ilbc_decode_frame(s, decblock, NULL, 0);
/* Convert to int16_t */
for (k = 0; k < s->blockl; k++)
{
dtmp = decblock[k];
if (dtmp < MIN_SAMPLE)
dtmp = MIN_SAMPLE;
else if (dtmp > MAX_SAMPLE)
dtmp = MAX_SAMPLE;
amp[i + k] = (int16_t) rint(dtmp);
}
}
return i;
}
ilbc_decode_state_t *ilbc_decode_init(ilbc_decode_state_t *iLBCdec_inst, /* (i/o) Decoder instance */
int mode, /* (i) frame size mode */
int use_enhancer) /* (i) 1 to use enhancer
0 to run without enhancer */
{
int i;
iLBCdec_inst->mode = mode;
if (mode == 30)
{
iLBCdec_inst->blockl = ILBC_BLOCK_LEN_30MS;
iLBCdec_inst->nsub = NSUB_30MS;
iLBCdec_inst->nasub = NASUB_30MS;
iLBCdec_inst->lpc_n = LPC_N_30MS;
iLBCdec_inst->no_of_bytes = ILBC_NO_OF_BYTES_30MS;
iLBCdec_inst->state_short_len = STATE_SHORT_LEN_30MS;
/* ULP init */
iLBCdec_inst->ULP_inst = &ULP_30msTbl;
}
else if (mode == 20)
{
iLBCdec_inst->blockl = ILBC_BLOCK_LEN_20MS;
iLBCdec_inst->nsub = NSUB_20MS;
iLBCdec_inst->nasub = NASUB_20MS;
iLBCdec_inst->lpc_n = LPC_N_20MS;
iLBCdec_inst->no_of_bytes = ILBC_NO_OF_BYTES_20MS;
iLBCdec_inst->state_short_len = STATE_SHORT_LEN_20MS;
/* ULP init */
iLBCdec_inst->ULP_inst = &ULP_20msTbl;
}
else
{
return NULL;
}
memset(iLBCdec_inst->syntMem, 0, ILBC_LPC_FILTERORDER*sizeof(float));
memcpy((*iLBCdec_inst).lsfdeqold, lsfmeanTbl, ILBC_LPC_FILTERORDER*sizeof(float));
memset(iLBCdec_inst->old_syntdenum,
0,
((ILBC_LPC_FILTERORDER + 1)*ILBC_NUM_SUB_MAX)*sizeof(float));
for (i = 0; i < ILBC_NUM_SUB_MAX; i++)
iLBCdec_inst->old_syntdenum[i*(ILBC_LPC_FILTERORDER + 1)] = 1.0f;
iLBCdec_inst->last_lag = 20;
iLBCdec_inst->prevLag = 120;
iLBCdec_inst->per = 0.0;
iLBCdec_inst->consPLICount = 0;
iLBCdec_inst->prevPLI = 0;
iLBCdec_inst->prevLpc[0] = 1.0f;
memset(iLBCdec_inst->prevLpc + 1, 0, ILBC_LPC_FILTERORDER*sizeof(float));
memset(iLBCdec_inst->prevResidual, 0, ILBC_BLOCK_LEN_MAX*sizeof(float));
iLBCdec_inst->seed = 777;
memset(iLBCdec_inst->hpomem, 0, 4*sizeof(float));
iLBCdec_inst->use_enhancer = use_enhancer;
memset(iLBCdec_inst->enh_buf, 0, ENH_BUFL*sizeof(float));
for (i = 0; i < ENH_NBLOCKS_TOT; i++)
iLBCdec_inst->enh_period[i] = 40.0f;
iLBCdec_inst->prev_enh_pl = 0;
return iLBCdec_inst;
}

View File

@ -1,107 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* iLBC_define.h - The head guy amongst the headers
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: iLBC_define.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#if !defined(_ILBC_DEFINE_H_)
#define _ILBC_DEFINE_H_
#include <string.h>
#define FS 8000.0f
#define NSUB_20MS 4
#define NSUB_30MS 6
#define NASUB_20MS 2
#define NASUB_30MS 4
#define NASUB_MAX 4
#define SUBL 40
#define STATE_LEN 80
#define STATE_SHORT_LEN_30MS 58
#define STATE_SHORT_LEN_20MS 57
/* LPC settings */
#define ILBC_LPC_FILTERORDER 10
#define LPC_CHIRP_SYNTDENUM 0.9025f
#define LPC_CHIRP_WEIGHTDENUM 0.4222f
#define LPC_LOOKBACK 60
#define LPC_N_20MS 1
#define LPC_N_30MS 2
#define LPC_N_MAX 2
#define LPC_ASYMDIFF 20
#define LPC_BW 60.0f
#define LPC_WN 1.0001f
#define LSF_NSPLIT 3
#define LSF_NUMBER_OF_STEPS 4
#define LPC_HALFORDER (ILBC_LPC_FILTERORDER/2)
/* cb settings */
#define CB_NSTAGES 3
#define CB_EXPAND 2
#define CB_MEML 147
#define CB_FILTERLEN 2*4
#define CB_HALFFILTERLEN 4
#define CB_RESRANGE 34
#define CB_MAXGAIN 1.3f
/* enhancer */
#define ENH_BLOCKL 80 /* block length */
#define ENH_BLOCKL_HALF (ENH_BLOCKL/2)
#define ENH_HL 3 /* 2*ENH_HL+1 is number blocks in said second sequence */
#define ENH_SLOP 2 /* max difference estimated and correct pitch period */
#define ENH_PLOCSL 20 /* pitch-estimates and pitch-locations buffer length */
#define ENH_OVERHANG 2
#define ENH_UPS0 4 /* upsampling rate */
#define ENH_FL0 3 /* 2*FLO+1 is the length of each filter */
#define ENH_VECTL (ENH_BLOCKL + 2*ENH_FL0)
#define ENH_CORRDIM (2*ENH_SLOP + 1)
#define ENH_NBLOCKS (ILBC_BLOCK_LEN_MAX/ENH_BLOCKL)
#define ENH_NBLOCKS_EXTRA 5
#define ENH_NBLOCKS_TOT 8 /* ENH_NBLOCKS + ENH_NBLOCKS_EXTRA */
#define ENH_BUFL (ENH_NBLOCKS_TOT*ENH_BLOCKL)
#define ENH_ALPHA0 0.05f
/* Down sampling */
#define FILTERORDER_DS 7
#define DELAY_DS 3
#define FACTOR_DS 2
/* bit stream defs */
#define STATE_BITS 3
#define BYTE_LEN 8
/* help parameters */
#define FLOAT_MAX 1.0e37f
#define EPS 2.220446049250313e-016f
#define PI 3.14159265358979323846f
#define MIN_SAMPLE -32768
#define MAX_SAMPLE 32767
#define TWO_PI 6.283185307f
#define PI2 0.159154943f
#endif
/*- End of file ------------------------------------------------------------*/

View File

@ -1,520 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* iLBC_encode.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: iLBC_encode.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "ilbc.h"
#include "LPCencode.h"
#include "FrameClassify.h"
#include "StateSearchW.h"
#include "StateConstructW.h"
#include "helpfun.h"
#include "constants.h"
#include "packing.h"
#include "iCBSearch.h"
#include "iCBConstruct.h"
#include "hpInput.h"
#include "anaFilter.h"
#include "syntFilter.h"
/*----------------------------------------------------------------*
* Initiation of encoder instance.
*---------------------------------------------------------------*/
/*----------------------------------------------------------------*
* main encoder function
*---------------------------------------------------------------*/
static int ilbc_encode_frame(ilbc_encode_state_t *iLBCenc_inst, /* (i/o) the general encoder state */
uint8_t bytes[], /* (o) encoded data bits iLBC */
const float block[]) /* (o) speech vector to encode */
{
float data[ILBC_BLOCK_LEN_MAX];
float residual[ILBC_BLOCK_LEN_MAX];
float reverseResidual[ILBC_BLOCK_LEN_MAX];
int start;
int idxForMax;
int idxVec[STATE_LEN];
float reverseDecresidual[ILBC_BLOCK_LEN_MAX];
float mem[CB_MEML];
int n;
int k;
int meml_gotten;
int Nfor;
int Nback;
int i;
int pos;
int gain_index[CB_NSTAGES*NASUB_MAX],
extra_gain_index[CB_NSTAGES];
int cb_index[CB_NSTAGES*NASUB_MAX];
int extra_cb_index[CB_NSTAGES];
int lsf_i[LSF_NSPLIT*LPC_N_MAX];
uint8_t *pbytes;
int diff;
int start_pos;
int state_first;
float en1;
int en2;
int index;
int ulp;
int firstpart;
int subcount;
int subframe;
float weightState[ILBC_LPC_FILTERORDER];
float syntdenum[ILBC_NUM_SUB_MAX*(ILBC_LPC_FILTERORDER + 1)];
float weightdenum[ILBC_NUM_SUB_MAX*(ILBC_LPC_FILTERORDER + 1)];
float decresidual[ILBC_BLOCK_LEN_MAX];
/* High pass filtering of input signal if such is not done
prior to calling this function */
hpInput(block, iLBCenc_inst->blockl, data, (*iLBCenc_inst).hpimem);
/* Otherwise simply copy */
/*memcpy(data, block, iLBCenc_inst->blockl*sizeof(float));*/
/* LPC of hp filtered input data */
LPCencode(syntdenum, weightdenum, lsf_i, data, iLBCenc_inst);
/* Inverse filter to get residual */
for (n = 0; n < iLBCenc_inst->nsub; n++)
anaFilter(&data[n*SUBL], &syntdenum[n*(ILBC_LPC_FILTERORDER + 1)], SUBL, &residual[n*SUBL], iLBCenc_inst->anaMem);
/* Find state location */
start = FrameClassify(iLBCenc_inst, residual);
/* Check if state should be in first or last part of the two subframes */
diff = STATE_LEN - iLBCenc_inst->state_short_len;
en1 = 0;
index = (start - 1)*SUBL;
for (i = 0; i < iLBCenc_inst->state_short_len; i++)
en1 += residual[index + i]*residual[index + i];
en2 = 0;
index = (start - 1)*SUBL+diff;
for (i = 0; i < iLBCenc_inst->state_short_len; i++)
en2 = (int)(en2 + residual[index + i]*residual[index + i]);
if (en1 > en2)
{
state_first = 1;
start_pos = (start - 1)*SUBL;
}
else
{
state_first = 0;
start_pos = (start - 1)*SUBL + diff;
}
/* Scalar quantization of state */
StateSearchW(iLBCenc_inst,
&residual[start_pos],
&syntdenum[(start - 1)*(ILBC_LPC_FILTERORDER + 1)],
&weightdenum[(start - 1)*(ILBC_LPC_FILTERORDER + 1)],
&idxForMax,
idxVec,
iLBCenc_inst->state_short_len,
state_first);
StateConstructW(idxForMax,
idxVec,
&syntdenum[(start - 1)*(ILBC_LPC_FILTERORDER + 1)],
&decresidual[start_pos],
iLBCenc_inst->state_short_len);
/* predictive quantization in state */
if (state_first)
{
/* Put adaptive part in the end */
/* Setup memory */
memset(mem, 0, (CB_MEML - iLBCenc_inst->state_short_len)*sizeof(float));
memcpy(&mem[CB_MEML - iLBCenc_inst->state_short_len], &decresidual[start_pos], iLBCenc_inst->state_short_len*sizeof(float));
memset(weightState, 0, ILBC_LPC_FILTERORDER*sizeof(float));
/* Encode sub-frames */
iCBSearch(iLBCenc_inst,
extra_cb_index,
extra_gain_index,
&residual[start_pos + iLBCenc_inst->state_short_len],
mem + CB_MEML - stMemLTbl,
stMemLTbl,
diff,
CB_NSTAGES,
&weightdenum[start*(ILBC_LPC_FILTERORDER + 1)],
weightState,
0);
/* Construct decoded vector */
iCBConstruct(&decresidual[start_pos + iLBCenc_inst->state_short_len],
extra_cb_index,
extra_gain_index,
&mem[CB_MEML - stMemLTbl],
stMemLTbl,
diff,
CB_NSTAGES);
}
else
{
/* Put adaptive part in the beginning */
/* Create reversed vectors for prediction */
for (k = 0; k < diff; k++)
reverseResidual[k] = residual[(start + 1)*SUBL - 1 - (k + iLBCenc_inst->state_short_len)];
/* Setup memory */
meml_gotten = iLBCenc_inst->state_short_len;
for (k = 0; k < meml_gotten; k++)
mem[CB_MEML - 1 - k] = decresidual[start_pos + k];
memset(mem, 0, (CB_MEML - k)*sizeof(float));
memset(weightState, 0, ILBC_LPC_FILTERORDER*sizeof(float));
/* Encode sub-frames */
iCBSearch(iLBCenc_inst,
extra_cb_index,
extra_gain_index,
reverseResidual,
mem + CB_MEML - stMemLTbl,
stMemLTbl,
diff,
CB_NSTAGES,
&weightdenum[(start - 1)*(ILBC_LPC_FILTERORDER + 1)],
weightState,
0);
/* Construct decoded vector */
iCBConstruct(reverseDecresidual,
extra_cb_index,
extra_gain_index,
&mem[CB_MEML - stMemLTbl],
stMemLTbl,
diff,
CB_NSTAGES);
/* Get decoded residual from reversed vector */
for (k = 0; k < diff; k++)
decresidual[start_pos - 1 - k] = reverseDecresidual[k];
}
/* Counter for predicted sub-frames */
subcount = 0;
/* Forward prediction of sub-frames */
Nfor = iLBCenc_inst->nsub-start - 1;
if (Nfor > 0)
{
/* Setup memory */
memset(mem, 0, (CB_MEML - STATE_LEN)*sizeof(float));
memcpy(&mem[CB_MEML - STATE_LEN], decresidual + (start - 1)*SUBL, STATE_LEN*sizeof(float));
memset(weightState, 0, ILBC_LPC_FILTERORDER*sizeof(float));
/* Loop over sub-frames to encode */
for (subframe = 0; subframe < Nfor; subframe++)
{
/* Encode sub-frame */
iCBSearch(iLBCenc_inst,
&cb_index[subcount*CB_NSTAGES],
&gain_index[subcount*CB_NSTAGES],
&residual[(start + 1 + subframe)*SUBL],
&mem[CB_MEML - memLfTbl[subcount]],
memLfTbl[subcount],
SUBL,
CB_NSTAGES,
&weightdenum[(start + 1 + subframe)*(ILBC_LPC_FILTERORDER + 1)],
weightState,
subcount + 1);
/* Construct decoded vector */
iCBConstruct(&decresidual[(start + 1 + subframe)*SUBL],
&cb_index[subcount*CB_NSTAGES],
&gain_index[subcount*CB_NSTAGES],
&mem[CB_MEML - memLfTbl[subcount]],
memLfTbl[subcount],
SUBL,
CB_NSTAGES);
/* Update memory */
memmove(mem, &mem[SUBL], (CB_MEML-SUBL)*sizeof(float));
memmove(&mem[CB_MEML - SUBL], &decresidual[(start + 1 + subframe)*SUBL], SUBL*sizeof(float));
memset(weightState, 0, ILBC_LPC_FILTERORDER*sizeof(float));
subcount++;
}
}
/* backward prediction of sub-frames */
Nback = start - 1;
if (Nback > 0)
{
/* Create reverse order vectors */
for (n = 0; n < Nback; n++)
{
for (k = 0; k < SUBL; k++)
{
reverseResidual[n*SUBL + k] = residual[(start - 1)*SUBL - 1 - n*SUBL - k];
reverseDecresidual[n*SUBL + k] = decresidual[(start - 1)*SUBL - 1 - n*SUBL - k];
}
}
/* Setup memory */
meml_gotten = SUBL*(iLBCenc_inst->nsub + 1 - start);
if (meml_gotten > CB_MEML)
meml_gotten = CB_MEML;
for (k = 0; k < meml_gotten; k++)
mem[CB_MEML - 1 - k] = decresidual[(start - 1)*SUBL + k];
memset(mem, 0, (CB_MEML - k)*sizeof(float));
memset(weightState, 0, ILBC_LPC_FILTERORDER*sizeof(float));
/* Loop over sub-frames to encode */
for (subframe = 0; subframe < Nback; subframe++)
{
/* Encode sub-frame */
iCBSearch(iLBCenc_inst,
&cb_index[subcount*CB_NSTAGES],
&gain_index[subcount*CB_NSTAGES],
&reverseResidual[subframe*SUBL],
&mem[CB_MEML - memLfTbl[subcount]],
memLfTbl[subcount],
SUBL,
CB_NSTAGES,
&weightdenum[(start - 2 - subframe)*(ILBC_LPC_FILTERORDER + 1)],
weightState,
subcount + 1);
/* Construct decoded vector */
iCBConstruct(&reverseDecresidual[subframe*SUBL],
&cb_index[subcount*CB_NSTAGES],
&gain_index[subcount*CB_NSTAGES],
&mem[CB_MEML - memLfTbl[subcount]],
memLfTbl[subcount],
SUBL,
CB_NSTAGES);
/* Update memory */
memmove(mem, &mem[SUBL], (CB_MEML - SUBL)*sizeof(float));
memmove(&mem[CB_MEML - SUBL],
&reverseDecresidual[subframe*SUBL],
SUBL*sizeof(float));
memset(weightState, 0, ILBC_LPC_FILTERORDER*sizeof(float));
subcount++;
}
/* Get decoded residual from reversed vector */
for (i = 0; i < SUBL*Nback; i++)
decresidual[SUBL*Nback - i - 1] = reverseDecresidual[i];
}
/* Adjust index */
index_conv_enc(cb_index);
/* Pack bytes */
pbytes = bytes;
pos = 0;
/* Loop over the 3 ULP classes */
for (ulp = 0; ulp < 3; ulp++)
{
/* LSF */
for (k = 0; k < LSF_NSPLIT*iLBCenc_inst->lpc_n; k++)
{
packsplit(&lsf_i[k],
&firstpart,
&lsf_i[k],
iLBCenc_inst->ULP_inst->lsf_bits[k][ulp],
iLBCenc_inst->ULP_inst->lsf_bits[k][ulp]
+ iLBCenc_inst->ULP_inst->lsf_bits[k][ulp + 1]
+ iLBCenc_inst->ULP_inst->lsf_bits[k][ulp + 2]);
dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->lsf_bits[k][ulp], &pos);
}
/* Start block info */
packsplit(&start,
&firstpart,
&start,
iLBCenc_inst->ULP_inst->start_bits[ulp],
iLBCenc_inst->ULP_inst->start_bits[ulp]
+ iLBCenc_inst->ULP_inst->start_bits[ulp + 1]
+ iLBCenc_inst->ULP_inst->start_bits[ulp + 2]);
dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->start_bits[ulp], &pos);
packsplit(&state_first,
&firstpart,
&state_first,
iLBCenc_inst->ULP_inst->startfirst_bits[ulp],
iLBCenc_inst->ULP_inst->startfirst_bits[ulp]
+ iLBCenc_inst->ULP_inst->startfirst_bits[ulp + 1]
+ iLBCenc_inst->ULP_inst->startfirst_bits[ulp + 2]);
dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->startfirst_bits[ulp], &pos);
packsplit(&idxForMax,
&firstpart,
&idxForMax,
iLBCenc_inst->ULP_inst->scale_bits[ulp],
iLBCenc_inst->ULP_inst->scale_bits[ulp]
+ iLBCenc_inst->ULP_inst->scale_bits[ulp + 1]
+ iLBCenc_inst->ULP_inst->scale_bits[ulp + 2]);
dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->scale_bits[ulp], &pos);
for (k = 0; k < iLBCenc_inst->state_short_len; k++)
{
packsplit(idxVec + k,
&firstpart,
idxVec + k,
iLBCenc_inst->ULP_inst->state_bits[ulp],
iLBCenc_inst->ULP_inst->state_bits[ulp]
+ iLBCenc_inst->ULP_inst->state_bits[ulp + 1]
+ iLBCenc_inst->ULP_inst->state_bits[ulp + 2]);
dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->state_bits[ulp], &pos);
}
/* 23/22 (20ms/30ms) sample block */
for (k = 0; k < CB_NSTAGES; k++)
{
packsplit(extra_cb_index + k,
&firstpart,
extra_cb_index + k,
iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp],
iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp]
+ iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp + 1]
+ iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp + 2]);
dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->extra_cb_index[k][ulp], &pos);
}
for (k = 0; k < CB_NSTAGES; k++)
{
packsplit(extra_gain_index + k,
&firstpart,
extra_gain_index + k,
iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp],
iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp]
+ iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp + 1]
+ iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp + 2]);
dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->extra_cb_gain[k][ulp], &pos);
}
/* The two/four (20ms/30ms) 40 sample sub-blocks */
for (i = 0; i < iLBCenc_inst->nasub; i++)
{
for (k = 0; k < CB_NSTAGES; k++)
{
packsplit(cb_index + i*CB_NSTAGES+k,
&firstpart,
cb_index + i*CB_NSTAGES + k,
iLBCenc_inst->ULP_inst->cb_index[i][k][ulp],
iLBCenc_inst->ULP_inst->cb_index[i][k][ulp]
+ iLBCenc_inst->ULP_inst->cb_index[i][k][ulp + 1]
+ iLBCenc_inst->ULP_inst->cb_index[i][k][ulp + 2]);
dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->cb_index[i][k][ulp], &pos);
}
}
for (i = 0; i < iLBCenc_inst->nasub; i++)
{
for (k = 0; k < CB_NSTAGES; k++)
{
packsplit(gain_index + i*CB_NSTAGES + k,
&firstpart,
gain_index + i*CB_NSTAGES + k,
iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp],
iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp]
+ iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp + 1]
+ iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp + 2]);
dopack(&pbytes, firstpart, iLBCenc_inst->ULP_inst->cb_gain[i][k][ulp], &pos);
}
}
}
/* Set the last bit to zero (otherwise the decoder will treat it as a lost frame) */
dopack(&pbytes, 0, 1, &pos);
return iLBCenc_inst->no_of_bytes;
}
int ilbc_encode(ilbc_encode_state_t *s, /* (i/o) the general encoder state */
uint8_t bytes[], /* (o) encoded data bits iLBC */
const int16_t amp[], /* (o) speech vector to encode */
int len)
{
int i;
int j;
int k;
float block[ILBC_BLOCK_LEN_MAX];
for (i = 0, j = 0; i < len; i += s->blockl, j += s->no_of_bytes)
{
/* Convert signal to float */
for (k = 0; k < s->blockl; k++)
block[k] = (float) amp[i + k];
ilbc_encode_frame(s, bytes + j, block);
}
return j;
}
ilbc_encode_state_t *ilbc_encode_init(ilbc_encode_state_t *iLBCenc_inst, /* (i/o) Encoder instance */
int mode) /* (i) frame size mode */
{
iLBCenc_inst->mode = mode;
if (mode == 30)
{
iLBCenc_inst->blockl = ILBC_BLOCK_LEN_30MS;
iLBCenc_inst->nsub = NSUB_30MS;
iLBCenc_inst->nasub = NASUB_30MS;
iLBCenc_inst->lpc_n = LPC_N_30MS;
iLBCenc_inst->no_of_bytes = ILBC_NO_OF_BYTES_30MS;
iLBCenc_inst->state_short_len = STATE_SHORT_LEN_30MS;
/* ULP init */
iLBCenc_inst->ULP_inst = &ULP_30msTbl;
}
else if (mode == 20)
{
iLBCenc_inst->blockl = ILBC_BLOCK_LEN_20MS;
iLBCenc_inst->nsub = NSUB_20MS;
iLBCenc_inst->nasub = NASUB_20MS;
iLBCenc_inst->lpc_n = LPC_N_20MS;
iLBCenc_inst->no_of_bytes = ILBC_NO_OF_BYTES_20MS;
iLBCenc_inst->state_short_len = STATE_SHORT_LEN_20MS;
/* ULP init */
iLBCenc_inst->ULP_inst = &ULP_20msTbl;
}
else
{
return NULL;
}
memset((*iLBCenc_inst).anaMem, 0, ILBC_LPC_FILTERORDER*sizeof(float));
memcpy((*iLBCenc_inst).lsfold, lsfmeanTbl, ILBC_LPC_FILTERORDER*sizeof(float));
memcpy((*iLBCenc_inst).lsfdeqold, lsfmeanTbl, ILBC_LPC_FILTERORDER*sizeof(float));
memset((*iLBCenc_inst).lpc_buffer, 0, (LPC_LOOKBACK + ILBC_BLOCK_LEN_MAX)*sizeof(float));
memset((*iLBCenc_inst).hpimem, 0, 4*sizeof(float));
return iLBCenc_inst;
}

View File

@ -1,37 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* ilbc.h - The head guy amongst the headers
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: ilbc.h.in,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#if !defined(_ILBC_H_)
#define _ILBC_H_
@ILBC_USE_FIXED_POINT@
#include <stdlib.h>
@INSERT_INTTYPES_HEADER@
#include <string.h>
#include <limits.h>
#include <time.h>
@INSERT_MATH_HEADER@
#include <ilbc/ilbc.h>
#endif
/*- End of file ------------------------------------------------------------*/

View File

@ -1,159 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* ilbc.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Copyright (C) The Internet Society (2004).
* All Rights Reserved.
*
* 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.
*
* $Id: ilbc.h,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
*/
#if !defined(_ILBC_ILBC_H_)
#define _ILBC_ILBC_H_
#define ILBC_BLOCK_LEN_20MS 160
#define ILBC_BLOCK_LEN_30MS 240
#define ILBC_BLOCK_LEN_MAX 240
#define ILBC_NO_OF_BYTES_20MS 38
#define ILBC_NO_OF_BYTES_30MS 50
#define ILBC_NO_OF_BYTES_MAX 50
#define ILBC_NUM_SUB_MAX 6
#define SUBL 40
#define ENH_BLOCKL 80 /* block length */
#define ENH_NBLOCKS_TOT 8 /* ENH_NBLOCKS + ENH_NBLOCKS_EXTRA */
#define ENH_BUFL (ENH_NBLOCKS_TOT*ENH_BLOCKL)
#define ILBC_LPC_FILTERORDER 10
#define LPC_LOOKBACK 60
#define CB_NSTAGES 3
#define STATE_BITS 3
#define BYTE_LEN 8
#define ILBC_ULP_CLASSES 3
typedef struct
{
int lsf_bits[6][ILBC_ULP_CLASSES + 2];
int start_bits[ILBC_ULP_CLASSES + 2];
int startfirst_bits[ILBC_ULP_CLASSES + 2];
int scale_bits[ILBC_ULP_CLASSES + 2];
int state_bits[ILBC_ULP_CLASSES + 2];
int extra_cb_index[CB_NSTAGES][ILBC_ULP_CLASSES + 2];
int extra_cb_gain[CB_NSTAGES][ILBC_ULP_CLASSES + 2];
int cb_index[ILBC_NUM_SUB_MAX][CB_NSTAGES][ILBC_ULP_CLASSES + 2];
int cb_gain[ILBC_NUM_SUB_MAX][CB_NSTAGES][ILBC_ULP_CLASSES + 2];
} ilbc_ulp_inst_t;
/* Type definition encoder instance */
typedef struct
{
/* flag for frame size mode */
int mode;
/* basic parameters for different frame sizes */
int blockl;
int nsub;
int nasub;
int no_of_bytes;
int lpc_n;
int state_short_len;
const ilbc_ulp_inst_t *ULP_inst;
/* analysis filter state */
float anaMem[ILBC_LPC_FILTERORDER];
/* old lsf parameters for interpolation */
float lsfold[ILBC_LPC_FILTERORDER];
float lsfdeqold[ILBC_LPC_FILTERORDER];
/* signal buffer for LP analysis */
float lpc_buffer[LPC_LOOKBACK + ILBC_BLOCK_LEN_MAX];
/* state of input HP filter */
float hpimem[4];
} ilbc_encode_state_t;
/* Type definition decoder instance */
typedef struct
{
/* Flag for frame size mode */
int mode;
/* Basic parameters for different frame sizes */
int blockl;
int nsub;
int nasub;
int no_of_bytes;
int lpc_n;
int state_short_len;
const ilbc_ulp_inst_t *ULP_inst;
/* Synthesis filter state */
float syntMem[ILBC_LPC_FILTERORDER];
/* Old LSF for interpolation */
float lsfdeqold[ILBC_LPC_FILTERORDER];
/* Pitch lag estimated in enhancer and used in PLC */
int last_lag;
/* PLC state information */
int prevLag, consPLICount, prevPLI, prev_enh_pl;
float prevLpc[ILBC_LPC_FILTERORDER + 1];
float prevResidual[ILBC_NUM_SUB_MAX*SUBL];
float per;
unsigned long seed;
/* Previous synthesis filter parameters */
float old_syntdenum[(ILBC_LPC_FILTERORDER + 1)*ILBC_NUM_SUB_MAX];
/* State of output HP filter */
float hpomem[4];
/* Enhancer state information */
int use_enhancer;
float enh_buf[ENH_BUFL];
float enh_period[ENH_NBLOCKS_TOT];
} ilbc_decode_state_t;
ilbc_encode_state_t *ilbc_encode_init(ilbc_encode_state_t *s, /* (i/o) Encoder instance */
int mode); /* (i) frame size mode */
int ilbc_encode(ilbc_encode_state_t *s, /* (i/o) the general encoder state */
uint8_t bytes[], /* (o) encoded data bits iLBC */
const int16_t amp[], /* (o) speech vector to encode */
int len);
ilbc_decode_state_t *ilbc_decode_init(ilbc_decode_state_t *s, /* (i/o) Decoder instance */
int mode, /* (i) frame size mode */
int use_enhancer); /* (i) 1 to use enhancer
0 to run without enhancer */
int ilbc_decode(ilbc_decode_state_t *s, /* (i/o) the decoder state structure */
int16_t amp[], /* (o) decoded signal block */
const uint8_t bytes[], /* (i) encoded signal bits */
int len);
int ilbc_fillin(ilbc_decode_state_t *s, /* (i/o) the decoder state structure */
int16_t amp[], /* (o) decoded signal block */
int len);
#endif

View File

@ -1,37 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* version.h - A tag file, so the exact installed revision can be assertained.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2007 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the Lesser GNU General Public License version 2.1, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: version.h.in,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
*/
#if !defined(_VOIPCODECS_VERSION_H_)
#define _VOIPCODECS_VERSION_H_
/* The date and time of the version are in UTC form. */
#define VOIPCODECS_RELEASE_DATE $VOIPCODECS_RELEASE_DATE
#define VOIPCODECS_RELEASE_TIME $VOIPCODECS_RELEASE_TIME
#endif
/*- End of file ------------------------------------------------------------*/

View File

@ -1,37 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* version.h - A tag file, so the exact installed revision can be assertained.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2007 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the Lesser GNU General Public License version 2.1, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: version.h.in,v 1.1.1.1 2008/02/15 12:15:55 steveu Exp $
*/
#if !defined(_VOIPCODECS_VERSION_H_)
#define _VOIPCODECS_VERSION_H_
/* The date and time of the version are in UTC form. */
#define VOIPCODECS_RELEASE_DATE $VOIPCODECS_RELEASE_DATE
#define VOIPCODECS_RELEASE_TIME $VOIPCODECS_RELEASE_TIME
#endif
/*- End of file ------------------------------------------------------------*/

View File

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

View File

@ -1,29 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libilbc", "libilbc.vcproj", "{CF70F278-3364-4395-A2E1-23501C9B8AD2}"
ProjectSection(ProjectDependencies) = postProject
{1CED5987-A529-46DC-B30F-870D85FF9C94} = {1CED5987-A529-46DC-B30F-870D85FF9C94}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "at_dictionary_gen", "src\msvc\at_dictionary_gen.vcproj", "{1CED5987-A529-46DC-B30F-870D85FF9C94}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.ActiveCfg = Debug|Win32
{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.Build.0 = Debug|Win32
{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.ActiveCfg = Release|Win32
{CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.Build.0 = Release|Win32
{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.ActiveCfg = Debug|Win32
{1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.Build.0 = Debug|Win32
{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.ActiveCfg = Release|Win32
{1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,269 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* lsf.c - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: lsf.c,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
/*! \file */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <inttypes.h>
#include <string.h>
#include <math.h>
#include "iLBC_define.h"
#include "lsf.h"
/*----------------------------------------------------------------*
* conversion from lpc coefficients to lsf coefficients
*---------------------------------------------------------------*/
void a2lsf(float *freq, /* (o) lsf coefficients */
float *a) /* (i) lpc coefficients */
{
static const float steps[LSF_NUMBER_OF_STEPS] =
{
0.00635f, 0.003175f, 0.0015875f, 0.00079375f
};
float step;
int step_idx;
int lsp_index;
float p[LPC_HALFORDER];
float q[LPC_HALFORDER];
float p_pre[LPC_HALFORDER];
float q_pre[LPC_HALFORDER];
float old_p;
float old_q;
float *old;
float *pq_coef;
float omega;
float old_omega;
int i;
float hlp;
float hlp1;
float hlp2;
float hlp3;
float hlp4;
float hlp5;
for (i = 0; i < LPC_HALFORDER; i++)
{
p[i] = -1.0f*(a[i + 1] + a[ILBC_LPC_FILTERORDER - i]);
q[i] = a[ILBC_LPC_FILTERORDER - i] - a[i + 1];
}
p_pre[0] = -1.0f - p[0];
p_pre[1] = -p_pre[0] - p[1];
p_pre[2] = -p_pre[1] - p[2];
p_pre[3] = -p_pre[2] - p[3];
p_pre[4] = -p_pre[3] - p[4];
p_pre[4] = p_pre[4]/2.0f;
q_pre[0] = 1.0f - q[0];
q_pre[1] = q_pre[0] - q[1];
q_pre[2] = q_pre[1] - q[2];
q_pre[3] = q_pre[2] - q[3];
q_pre[4] = q_pre[3] - q[4];
q_pre[4] = q_pre[4]/2.0f;
omega = 0.0f;
old_omega = 0.0f;
old_p = FLOAT_MAX;
old_q = FLOAT_MAX;
/* Here we loop through lsp_index to find all the ILBC_LPC_FILTERORDER roots for omega. */
for (lsp_index = 0; lsp_index < ILBC_LPC_FILTERORDER; lsp_index++)
{
/* Depending on lsp_index being even or odd, we
alternatively solve the roots for the two LSP equations. */
if ((lsp_index & 0x1) == 0)
{
pq_coef = p_pre;
old = &old_p;
}
else
{
pq_coef = q_pre;
old = &old_q;
}
/* Start with low resolution grid */
for (step_idx = 0, step = steps[step_idx]; step_idx < LSF_NUMBER_OF_STEPS; )
{
/* cos(10piw) + pq(0)cos(8piw) + pq(1)cos(6piw) +
pq(2)cos(4piw) + pq(3)cod(2piw) + pq(4) */
hlp = cosf(omega*TWO_PI);
hlp1 = 2.0f*hlp+pq_coef[0];
hlp2 = 2.0f*hlp*hlp1 - 1.0f + pq_coef[1];
hlp3 = 2.0f*hlp*hlp2 - hlp1 + pq_coef[2];
hlp4 = 2.0f*hlp*hlp3 - hlp2 + pq_coef[3];
hlp5 = hlp*hlp4 - hlp3 + pq_coef[4];
if (((hlp5 * (*old)) <= 0.0f) || (omega >= 0.5f))
{
if (step_idx == (LSF_NUMBER_OF_STEPS - 1))
{
if (fabsf(hlp5) >= fabsf(*old))
freq[lsp_index] = omega - step;
else
freq[lsp_index] = omega;
if ((*old) >= 0.0f)
*old = -1.0f*FLOAT_MAX;
else
*old = FLOAT_MAX;
omega = old_omega;
step_idx = 0;
step_idx = LSF_NUMBER_OF_STEPS;
}
else
{
if (step_idx == 0)
old_omega = omega;
step_idx++;
omega -= steps[step_idx];
/* Go back one grid step */
step = steps[step_idx];
}
}
else
{
/* increment omega until they are of different sign,
and we know there is at least one root between omega
and old_omega */
*old = hlp5;
omega += step;
}
}
}
for (i = 0; i < ILBC_LPC_FILTERORDER; i++)
freq[i] *= TWO_PI;
}
/*----------------------------------------------------------------*
* conversion from lsf coefficients to lpc coefficients
*---------------------------------------------------------------*/
void lsf2a(float *a_coef, /* (o) lpc coefficients */
float *freq) /* (i) lsf coefficients */
{
int i;
int j;
float hlp;
float p[LPC_HALFORDER];
float q[LPC_HALFORDER];
float a[LPC_HALFORDER + 1];
float a1[LPC_HALFORDER];
float a2[LPC_HALFORDER];
float b[LPC_HALFORDER + 1];
float b1[LPC_HALFORDER];
float b2[LPC_HALFORDER];
for (i = 0; i < ILBC_LPC_FILTERORDER; i++)
freq[i] *= PI2;
/* Check input for ill-conditioned cases. This part is not
found in the TIA standard. It involves the following 2 IF
blocks. If "freq" is judged ill-conditioned, then we first
modify freq[0] and freq[LPC_HALFORDER-1] (normally
LPC_HALFORDER = 10 for LPC applications), then we adjust
the other "freq" values slightly */
if ((freq[0] <= 0.0f) || (freq[ILBC_LPC_FILTERORDER - 1] >= 0.5f))
{
if (freq[0] <= 0.0f)
freq[0] = 0.022f;
if (freq[ILBC_LPC_FILTERORDER - 1] >= 0.5f)
freq[ILBC_LPC_FILTERORDER - 1] = 0.499f;
hlp = (freq[ILBC_LPC_FILTERORDER - 1] - freq[0])/(float) (ILBC_LPC_FILTERORDER - 1);
for (i = 1; i < ILBC_LPC_FILTERORDER; i++)
freq[i] = freq[i - 1] + hlp;
}
memset(a1, 0, LPC_HALFORDER*sizeof(float));
memset(a2, 0, LPC_HALFORDER*sizeof(float));
memset(b1, 0, LPC_HALFORDER*sizeof(float));
memset(b2, 0, LPC_HALFORDER*sizeof(float));
memset(a, 0, (LPC_HALFORDER+1)*sizeof(float));
memset(b, 0, (LPC_HALFORDER+1)*sizeof(float));
/* p[i] and q[i] compute cos(2*pi*omega_{2j}) and
cos(2*pi*omega_{2j-1} in eqs. 4.2.2.2-1 and 4.2.2.2-2.
Note that for this code p[i] specifies the coefficients
used in .Q_A(z) while q[i] specifies the coefficients used
in .P_A(z) */
for (i = 0; i < LPC_HALFORDER; i++)
{
p[i] = cosf(TWO_PI*freq[2*i]);
q[i] = cosf(TWO_PI*freq[2*i + 1]);
}
a[0] = 0.25f;
b[0] = 0.25f;
for (i = 0; i < LPC_HALFORDER; i++)
{
a[i + 1] = a[i] - 2*p[i]*a1[i] + a2[i];
b[i + 1] = b[i] - 2*q[i]*b1[i] + b2[i];
a2[i] = a1[i];
a1[i] = a[i];
b2[i] = b1[i];
b1[i] = b[i];
}
for (j = 0; j < ILBC_LPC_FILTERORDER; j++)
{
if (j == 0)
{
a[0] = 0.25f;
b[0] = -0.25f;
}
else
{
a[0] =
b[0] = 0.0f;
}
for (i = 0; i < LPC_HALFORDER; i++)
{
a[i + 1] = a[i] - 2.0f*p[i]*a1[i] + a2[i];
b[i + 1] = b[i] - 2.0f*q[i]*b1[i] + b2[i];
a2[i] = a1[i];
a1[i] = a[i];
b2[i] = b1[i];
b1[i] = b[i];
}
a_coef[j + 1] = 2.0f*(a[LPC_HALFORDER] + b[LPC_HALFORDER]);
}
a_coef[0] = 1.0f;
}

View File

@ -1,29 +0,0 @@
/*
* iLBC - a library for the iLBC codec
*
* lsf.h - The iLBC low bit rate speech codec.
*
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
* iLBC code supplied in RFC3951.
*
* Original code Copyright (C) The Internet Society (2004).
* All changes to produce this version Copyright (C) 2008 by Steve Underwood
* All Rights Reserved.
*
* 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.
*
* $Id: lsf.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
*/
#ifndef __iLBC_LSF_H
#define __iLBC_LSF_H
void a2lsf(float *freq, /* (o) lsf coefficients */
float *a); /* (i) lpc coefficients */
void lsf2a(float *a_coef, /* (o) lpc coefficients */
float *freq); /* (i) lsf coefficients */
#endif

View File

@ -1,14 +0,0 @@
#ifdef _MSC_VER
#pragma warning(disable:4100)
#endif
#include "windows.h"
void gettimeofday(struct timeval *tv, void *tz)
{
long int l = GetTickCount();
tv->tv_sec = l / 1000;
tv->tv_usec = (l % 1000) * 1000;
return;
}

View File

@ -1,304 +0,0 @@
EXPORTS
adsi_rx_init
adsi_rx
adsi_tx_init
adsi_send_alert_tone
adsi_put_message
adsi_next_field
adsi_add_field
async_tx_init
async_rx_init
awgn
bert_init
bert_get_bit
bert_put_bit
bert_set_report
bert_result
filter_create
filter_delete
filter_step
cfilter_create
cfilter_delete
cfilter_step
dds_phase_rate
dds_frequency
dds_scaling_dbm0
dds_scaling_dbov
dds_lookup
dds_offset
dds
dds_mod
dds_complex
dds_complex_mod
dds_phase_ratef
dds_frequencyf
dds_scaling_dbm0f
dds_scaling_dbovf
ddsf
dds_modf
dds_complexf
dds_complex_modf
echo_can_create
echo_can_free
echo_can_flush
echo_can_adaption_mode
echo_can_update
fax_rx
fax_tx
fax_set_flush_handler
fax_init
fax_release
fsk_tx_init
fsk_tx_power
fsk_tx_set_get_bit
fsk_tx
fsk_rx_signal_power
fsk_rx_signal_cutoff
fsk_rx_init
fsk_rx
fsk_rx_set_put_bit
g722_encode_init
g722_encode_release
g722_encode
g722_decode_init
g722_decode_release
g722_decode
g726_init
g726_release
crc_itu32_calc
crc_itu32_append
crc_itu32_check
crc_itu16_calc
crc_itu16_append
crc_itu16_check
hdlc_rx_init
hdlc_rx_get_stats
hdlc_tx_init
hdlc_tx_frame
hdlc_tx_preamble
ima_adpcm_init
ima_adpcm_release
span_log_test
span_log
span_log_buf
span_log_init
span_log_set_protocol
span_set_message_handler
span_set_error_handler
modem_echo_can_create
modem_echo_can_free
modem_echo_can_flush
modem_echo_can_adaption_mode
modem_echo_can_update
noise
oki_adpcm_init
oki_adpcm_release
playout_put
playout_get
playout_get_unconditional
playout_current_length
playout_next_due
playout_new
playout_free
playout_restart
plc_rx
plc_fillin
plc_init
plc_release
power_meter_init
power_meter_damping
power_meter_update
power_meter_dbm0
power_meter_dbov
power_meter_level_dbm0
power_meter_level_dbov
queue_empty
queue_free_space
queue_contents
queue_flush
queue_view
queue_read
queue_write
queue_test_msg
queue_read_msg
queue_write_msg
queue_create
queue_delete
sig_tone_init
sig_tone_rx
sig_tone_tx
super_tone_rx_make_descriptor
super_tone_rx_add_tone
super_tone_rx_add_element
super_tone_rx_init
super_tone_rx_free
super_tone_rx_segment_callback
super_tone_rx
super_tone_tx_make_step
super_tone_tx_free
super_tone_tx_init
super_tone_tx
t30_init
t30_release
t30_restart
t30_create
t30_free
t30_frametype
t30_decode_dis_dtc_dcs
t30_completion_code_to_str
t30_set_header_info
t30_set_local_ident
t30_get_sub_address
t30_get_header_info
t30_get_local_ident
t30_get_far_ident
t30_get_transfer_statistics
t30_set_phase_b_handler
t30_set_phase_d_handler
t30_set_phase_e_handler
t30_set_document_handler
t30_set_rx_file
t30_set_tx_file
t30_local_interrupt_request
t30_send_complete
t30_hdlc_accept
t30_timer_update
t31_call_event
t31_at_rx
t31_rx
t31_tx
t31_init
t31_release
t35_decode
t38_indicator
t38_data_type
t38_field_type
t38_terminal_init
t38_gateway_init
t4_rx_create
t4_rx_init
t4_rx_start_page
t4_rx_end_page
t4_rx_delete
t4_rx_end
t4_rx_set_rx_encoding
t4_rx_set_sub_address
t4_rx_set_far_ident
t4_rx_set_vendor
t4_rx_set_model
t4_tx_create
t4_tx_init
t4_tx_start_page
t4_tx_restart_page
t4_tx_end_page
t4_tx_delete
t4_tx_end
t4_tx_set_tx_encoding
t4_tx_set_min_row_bits
t4_tx_set_local_ident
t4_tx_set_header_info
t4_get_transfer_statistics
t4_encoding_to_str
time_scale_init
time_scale_rate
time_scale
make_goertzel_descriptor
goertzel_init
goertzel_update
goertzel_result
dtmf_rx_init
dtmf_rx_set_realtime_callback
dtmf_rx_parms
dtmf_rx
make_tone_descriptor
make_tone_gen_descriptor
tone_gen_init
tone_gen
dtmf_tx_init
dtmf_tx
v17_rx_init
v17_rx_restart
v17_rx_release
v17_rx_set_put_bit
v17_rx
v17_rx_equalizer_state
v17_rx_carrier_frequency
v17_rx_symbol_timing_correction
v17_rx_signal_power
v17_rx_signal_cutoff
v17_rx_set_qam_report_handler
v17_tx_power
v17_tx_init
v17_tx_restart
v17_tx_release
v17_tx_set_get_bit
v17_tx
v22bis_rx_restart
v22bis_rx
v22bis_rx_equalizer_state
v22bis_rx_carrier_frequency
v22bis_rx_symbol_timing_correction
v22bis_rx_signal_power
v22bis_rx_set_qam_report_handler
v22bis_tx
v22bis_tx_power
v22bis_restart
v22bis_init
v22bis_set_get_bit
v22bis_set_put_bit
v27ter_rx_init
v27ter_rx_restart
v27ter_rx_release
v27ter_rx_set_put_bit
v27ter_rx
v27ter_rx_equalizer_state
v27ter_rx_carrier_frequency
v27ter_rx_symbol_timing_correction
v27ter_rx_signal_power
v27ter_rx_signal_cutoff
v27ter_rx_set_qam_report_handler
v27ter_tx_power
v27ter_tx_init
v27ter_tx_restart
v27ter_tx_release
v27ter_tx_set_get_bit
v27ter_tx
v29_rx_init
v29_rx_restart
v29_rx_release
v29_rx_set_put_bit
v29_rx
v29_rx_equalizer_state
v29_rx_carrier_frequency
v29_rx_symbol_timing_correction
v29_rx_signal_power
v29_rx_signal_cutoff
v29_rx_set_qam_report_handler
v29_tx_power
v29_tx_init
v29_tx_restart
v29_tx_release
v29_tx_set_get_bit
v29_tx
lapm_dump
lapm_receive
lapm_tx
lapm_tx_iframe
v42_set_status_callback
v42_rx_bit
v42_tx_bit
v42_init
v42_restart
v42_release
v42bis_compress
v42bis_compress_flush
v42bis_decompress
v42bis_decompress_flush
v42bis_init
v42bis_release
v8_init
v8_release
v8_tx
v8_rx
v8_log_supported_modulations

View File

@ -1,91 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* inttypes.h - a fudge for MSVC, which lacks this header
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2006 Michael Jerris
*
*
* This file is released in the public domain.
*
*/
#if !defined(_INTTYPES_H_)
#define _INTTYPES_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _MSC_VER
#if (_MSC_VER >= 1400) // VC8+
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#ifndef _CRT_NONSTDC_NO_DEPRECATE
#define _CRT_NONSTDC_NO_DEPRECATE
#endif
#endif // VC8+
#include <windows.h>
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
#define inline __inline
#define __inline__ __inline
#define INT16_MAX 0x7fff
#define INT16_MIN (-INT16_MAX - 1)
#define _MMX_H_
/* disable the following warnings
* C4100: The formal parameter is not referenced in the body of the function. The unreferenced parameter is ignored.
* C4200: Non standard extension C zero sized array
* C4706: assignment within conditional expression
* C4244: conversion from 'type1' to 'type2', possible loss of data
* C4295: array is too small to include a terminating null character
* C4125: decimal digit terminates octal escape sequence
*/
#pragma warning(disable:4100 4200 4706 4295 4125)
#pragma comment(lib, "ws2_32.lib")
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#if _MSC_VER < 1900
#define snprintf _snprintf
#else
#include <math.h>
#endif
#if !defined(INFINITY)
#define INFINITY 0x7fffffff
#endif
#endif
#define PACKAGE "ilbc"
#define VERSION "0.0.1andabit"
#define INT32_MAX (2147483647)
#define INT32_MIN (-2147483647 - 1)
#define PRId8 "d"
#define PRId16 "d"
#define PRId32 "ld"
#define PRId64 "lld"
#define PRIu8 "u"
#define PRIu16 "u"
#define PRIu32 "lu"
#define PRIu64 "llu"
#ifdef __cplusplus
}
#endif
#endif

View File

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

View File

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

View File

@ -1 +0,0 @@
extern void gettimeofday(struct timeval *tv, void *tz);

View File

@ -1,84 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* tgmath.h - a fudge for MSVC, which lacks this header
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2006 Michael Jerris
*
*
* This file is released in the public domain.
*
*/
#if !defined(_TGMATH_H_)
#define _TGMATH_H_
#include <math.h>
#if !defined(M_PI)
/* C99 systems may not define M_PI */
#define M_PI 3.14159265358979323846264338327
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* A kindofa rint() for VC++ (only kindofa, because rint should be type generic,
and this one is purely float to int */
static inline long int lrintf(float a)
{
long int i;
__asm
{
fld a
fistp i
}
return i;
}
static inline long int lrint(double a)
{
long int i;
__asm
{
fld a
fistp i
}
return i;
}
static inline int rintf(float a)
{
int i;
__asm
{
fld a
fistp i
}
return i;
}
static inline int rint(double a)
{
int i;
__asm
{
fld a
fistp i
}
return i;
}
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,31 +0,0 @@
/*
* SpanDSP - a series of DSP components for telephony
*
* inttypes.h - a fudge for MSVC, which lacks this header
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2006 Michael Jerris
*
*
* This file is released in the public domain.
*
*/
#if !defined(_INTTYPES_H_)
#define _INTTYPES_H_
#ifdef __cplusplus
extern "C" {
#endif
#define open _open
#define write _write
extern int gethostname (char *name, size_t len);
#ifdef __cplusplus
}
#endif
#endif

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