switch to use mod_voipcodecs and pull old mod_g722, mod_g726, mod_gsm (mod_g711 should not be used now unless your not using mod_voipcodecs)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7664 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
b552cb3a6c
commit
d5aaa00001
|
@ -3,7 +3,7 @@ echo "bootstrap: checking installation..."
|
|||
|
||||
BASEDIR=`pwd`;
|
||||
LIBDIR=${BASEDIR}/libs;
|
||||
SUBDIRS="codec/g7xx codec/gsm codec/ilbc curl iax iksemel voipcodecs \
|
||||
SUBDIRS="codec/ilbc curl iax iksemel voipcodecs \
|
||||
js js/nsprpub libdingaling libedit libresample libsndfile pcre sofia-sip \
|
||||
speex sqlite srtp xmlrpc-c openzap";
|
||||
|
||||
|
|
|
@ -15,15 +15,12 @@ applications/mod_fsv
|
|||
#applications/mod_rss
|
||||
#asr_tts/mod_cepstral
|
||||
#asr_tts/mod_openmrcp
|
||||
codecs/mod_g711
|
||||
codecs/mod_g722
|
||||
codecs/mod_g726
|
||||
#codecs/mod_g711
|
||||
codecs/mod_g723_1
|
||||
codecs/mod_amr
|
||||
codecs/mod_g729
|
||||
codecs/mod_gsm
|
||||
codecs/mod_h26x
|
||||
#codecs/mod_voipcodecs
|
||||
codecs/mod_voipcodecs
|
||||
codecs/mod_ilbc
|
||||
codecs/mod_l16
|
||||
codecs/mod_speex
|
||||
|
|
|
@ -467,9 +467,7 @@ fi
|
|||
AC_CONFIG_SUBDIRS(libs/pcre)
|
||||
AC_CONFIG_SUBDIRS(libs/apr)
|
||||
AC_CONFIG_SUBDIRS(libs/apr-util)
|
||||
AC_CONFIG_SUBDIRS(libs/codec/g7xx)
|
||||
AC_CONFIG_SUBDIRS(libs/voipcodecs)
|
||||
AC_CONFIG_SUBDIRS(libs/codec/gsm)
|
||||
AC_CONFIG_SUBDIRS(libs/codec/ilbc)
|
||||
AC_CONFIG_SUBDIRS(libs/curl)
|
||||
AC_CONFIG_SUBDIRS(libs/iax)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Fri Mar 16 17:13:27 EDT 2007
|
|
@ -1,236 +0,0 @@
|
|||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
unlimited permission to copy, distribute and modify it.
|
||||
|
||||
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, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. (Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.)
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') 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. Run `./configure --help' for
|
||||
details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
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 support 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' installs the package's commands under
|
||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||
can specify an installation prefix other than `/usr/local' by giving
|
||||
`configure' the option `--prefix=PREFIX'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
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' cannot figure out automatically,
|
||||
but needs to determine by the type of machine the package will run on.
|
||||
Usually, assuming the package is built to be run on the _same_
|
||||
architectures, `configure' can figure that out, but if it prints a
|
||||
message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option `--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
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.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified `gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script). Here is a another example:
|
||||
|
||||
/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
|
||||
configuration-related scripts to be executed by `/bin/bash'.
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-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.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
AUTOMAKE_OPTS = gnu
|
||||
NAME = libg7xx
|
||||
|
||||
AM_CFLAGS = $(new_AM_CFLAGS) -I./src/include
|
||||
AM_CPPFLAGS = $(AM_CFLAGS)
|
||||
AM_LDFLAGS = $(new_AM_LDFLAGS) -lm
|
||||
|
||||
lib_LTLIBRARIES = libg7xx.la
|
||||
libg7xx_la_SOURCES = src/g711.c src/g722_decode.c src/g722_encode.c src/g726.c
|
||||
|
||||
libg7xx_la_CFLAGS = $(AM_CFLAGS)
|
||||
libg7xx_la_LDFLAGS =
|
||||
|
||||
library_includedir = $(prefix)/include/g7xx
|
||||
library_include_HEADERS = src/include/g7xx/g722.h src/include/g7xx/g711.h src/include/g7xx/g726.h
|
||||
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
m4_include([build/config/ax_compiler_vendor.m4])
|
||||
m4_include([build/config/ax_cflags_warn_all_ansi.m4])
|
||||
m4_include([build/config/ax_cc_maxopt.m4])
|
||||
m4_include([build/config/ax_check_compiler_flags.m4])
|
||||
m4_include([build/config/ac_gcc_archflag.m4])
|
||||
m4_include([build/config/ac_gcc_x86_cpuid.m4])
|
|
@ -1,142 +0,0 @@
|
|||
AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl
|
||||
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
||||
AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$2])dnl
|
||||
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
|
||||
VAR,[VAR="no, unknown"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
for ac_arg dnl
|
||||
in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC
|
||||
#
|
||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||
AC_TRY_COMPILE([],[return 0;],
|
||||
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
|
||||
done
|
||||
FLAGS="$ac_save_[]FLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
case ".$VAR" in
|
||||
.ok|.ok,*) m4_ifvaln($3,$3) ;;
|
||||
.|.no|.no,*) m4_ifvaln($4,$4) ;;
|
||||
*) m4_ifvaln($3,$3,[
|
||||
if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
|
||||
then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
|
||||
else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
|
||||
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
|
||||
fi ]) ;;
|
||||
esac
|
||||
AS_VAR_POPDEF([VAR])dnl
|
||||
AS_VAR_POPDEF([FLAGS])dnl
|
||||
])
|
||||
|
||||
|
||||
dnl the only difference - the LANG selection... and the default FLAGS
|
||||
|
||||
AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_OLD], [dnl
|
||||
AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
|
||||
AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl
|
||||
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)],
|
||||
VAR,[VAR="no, unknown"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CXX
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
for ac_arg dnl
|
||||
in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC
|
||||
#
|
||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||
AC_TRY_COMPILE([],[return 0;],
|
||||
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
|
||||
done
|
||||
FLAGS="$ac_save_[]FLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
case ".$VAR" in
|
||||
.ok|.ok,*) m4_ifvaln($3,$3) ;;
|
||||
.|.no|.no,*) m4_ifvaln($4,$4) ;;
|
||||
*) m4_ifvaln($3,$3,[
|
||||
if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
|
||||
then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
|
||||
else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
|
||||
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
|
||||
fi ]) ;;
|
||||
esac
|
||||
AS_VAR_POPDEF([VAR])dnl
|
||||
AS_VAR_POPDEF([FLAGS])dnl
|
||||
])
|
||||
|
||||
dnl -------------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([AX_CFLAGS_GCC_OPTION_NEW], [dnl
|
||||
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
||||
AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$1])dnl
|
||||
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
|
||||
VAR,[VAR="no, unknown"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
for ac_arg dnl
|
||||
in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC
|
||||
#
|
||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||
AC_TRY_COMPILE([],[return 0;],
|
||||
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
|
||||
done
|
||||
FLAGS="$ac_save_[]FLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
case ".$VAR" in
|
||||
.ok|.ok,*) m4_ifvaln($3,$3) ;;
|
||||
.|.no|.no,*) m4_ifvaln($4,$4) ;;
|
||||
*) m4_ifvaln($3,$3,[
|
||||
if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
|
||||
then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
|
||||
else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
|
||||
m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
|
||||
fi ]) ;;
|
||||
esac
|
||||
AS_VAR_POPDEF([VAR])dnl
|
||||
AS_VAR_POPDEF([FLAGS])dnl
|
||||
])
|
||||
|
||||
|
||||
dnl the only difference - the LANG selection... and the default FLAGS
|
||||
|
||||
AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_NEW], [dnl
|
||||
AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
|
||||
AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl
|
||||
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)],
|
||||
VAR,[VAR="no, unknown"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CXX
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
for ac_arg dnl
|
||||
in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC
|
||||
#
|
||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||
AC_TRY_COMPILE([],[return 0;],
|
||||
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
|
||||
done
|
||||
FLAGS="$ac_save_[]FLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
case ".$VAR" in
|
||||
.ok|.ok,*) m4_ifvaln($3,$3) ;;
|
||||
.|.no|.no,*) m4_ifvaln($4,$4) ;;
|
||||
*) m4_ifvaln($3,$3,[
|
||||
if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
|
||||
then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
|
||||
else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
|
||||
m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
|
||||
fi ]) ;;
|
||||
esac
|
||||
AS_VAR_POPDEF([VAR])dnl
|
||||
AS_VAR_POPDEF([FLAGS])dnl
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_CFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
|
||||
[AX_CFLAGS_GCC_OPTION_NEW($@)],[AX_CFLAGS_GCC_OPTION_OLD($@)])])
|
||||
|
||||
AC_DEFUN([AX_CXXFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1,
|
||||
[AX_CXXFLAGS_GCC_OPTION_NEW($@)],[AX_CXXFLAGS_GCC_OPTION_OLD($@)])])
|
||||
|
|
@ -1,140 +0,0 @@
|
|||
AC_DEFUN([AX_CFLAGS_SUN_OPTION_OLD], [dnl
|
||||
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
||||
AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_sun_option_$2])dnl
|
||||
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for sun/cc m4_ifval($2,$2,-option)],
|
||||
VAR,[VAR="no, unknown"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
for ac_arg dnl
|
||||
in "+xstrconst % -xc99=all m4_ifval($2,$2,-option)" dnl Solaris C
|
||||
#
|
||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||
AC_TRY_COMPILE([],[return 0;],
|
||||
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
|
||||
done
|
||||
FLAGS="$ac_save_[]FLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
case ".$VAR" in
|
||||
.ok|.ok,*) m4_ifvaln($3,$3) ;;
|
||||
.|.no|.no,*) m4_ifvaln($4,$4) ;;
|
||||
*) m4_ifvaln($3,$3,[
|
||||
if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
|
||||
then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
|
||||
else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
|
||||
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
|
||||
fi ]) ;;
|
||||
esac
|
||||
AS_VAR_POPDEF([VAR])dnl
|
||||
AS_VAR_POPDEF([FLAGS])dnl
|
||||
])
|
||||
|
||||
dnl the only difference - the LANG selection... and the default FLAGS
|
||||
|
||||
AC_DEFUN([AX_CXXFLAGS_SUN_OPTION_OLD], [dnl
|
||||
AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
|
||||
AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_sun_option_$2])dnl
|
||||
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for sun/cc m4_ifval($2,$2,-option)],
|
||||
VAR,[VAR="no, unknown"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CXX
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
for ac_arg dnl
|
||||
in "+xstrconst % -xc99=all m4_ifval($2,$2,-option)" dnl Solaris C
|
||||
#
|
||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||
AC_TRY_COMPILE([],[return 0;],
|
||||
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
|
||||
done
|
||||
FLAGS="$ac_save_[]FLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
case ".$VAR" in
|
||||
.ok|.ok,*) m4_ifvaln($3,$3) ;;
|
||||
.|.no|.no,*) m4_ifvaln($4,$4) ;;
|
||||
*) m4_ifvaln($3,$3,[
|
||||
if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
|
||||
then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
|
||||
else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
|
||||
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
|
||||
fi ]) ;;
|
||||
esac
|
||||
AS_VAR_POPDEF([VAR])dnl
|
||||
AS_VAR_POPDEF([FLAGS])dnl
|
||||
])
|
||||
|
||||
dnl -----------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([AX_CFLAGS_SUN_OPTION_NEW], [dnl
|
||||
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
||||
AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_sun_option_$1])dnl
|
||||
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for sun/cc m4_ifval($1,$1,-option)],
|
||||
VAR,[VAR="no, unknown"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
for ac_arg dnl
|
||||
in "+xstrconst % -xc99=all m4_ifval($1,$1,-option)" dnl Solaris C
|
||||
#
|
||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||
AC_TRY_COMPILE([],[return 0;],
|
||||
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
|
||||
done
|
||||
FLAGS="$ac_save_[]FLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
case ".$VAR" in
|
||||
.ok|.ok,*) m4_ifvaln($3,$3) ;;
|
||||
.|.no|.no,*) m4_ifvaln($4,$4) ;;
|
||||
*) m4_ifvaln($3,$3,[
|
||||
if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
|
||||
then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
|
||||
else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
|
||||
m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
|
||||
fi ]) ;;
|
||||
esac
|
||||
AS_VAR_POPDEF([VAR])dnl
|
||||
AS_VAR_POPDEF([FLAGS])dnl
|
||||
])
|
||||
|
||||
dnl the only difference - the LANG selection... and the default FLAGS
|
||||
|
||||
AC_DEFUN([AX_CXXFLAGS_SUN_OPTION_NEW], [dnl
|
||||
AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
|
||||
AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_sun_option_$1])dnl
|
||||
AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for sun/cc m4_ifval($1,$1,-option)],
|
||||
VAR,[VAR="no, unknown"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CXX
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
for ac_arg dnl
|
||||
in "+xstrconst % -xc99=all m4_ifval($1,$1,-option)" dnl Solaris C
|
||||
#
|
||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||
AC_TRY_COMPILE([],[return 0;],
|
||||
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
|
||||
done
|
||||
FLAGS="$ac_save_[]FLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
case ".$VAR" in
|
||||
.ok|.ok,*) m4_ifvaln($3,$3) ;;
|
||||
.|.no|.no,*) m4_ifvaln($4,$4) ;;
|
||||
*) m4_ifvaln($3,$3,[
|
||||
if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
|
||||
then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR])
|
||||
else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"])
|
||||
m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"
|
||||
fi ]) ;;
|
||||
esac
|
||||
AS_VAR_POPDEF([VAR])dnl
|
||||
AS_VAR_POPDEF([FLAGS])dnl
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_CFLAGS_SUN_OPTION],[ifelse(m4_regexp([$2],[-]),-1,
|
||||
[AX_CFLAGS_SUN_OPTION_NEW($@)],[AX_CFLAGS_SUN_OPTION_OLD($@)])])
|
||||
|
||||
AC_DEFUN([AX_CXXFLAGS_SUN_OPTION],[ifelse(m4_regexp([$2],[-]),-1,
|
||||
[AX_CXXFLAGS_SUN_OPTION_NEW($@)],[AX_CXXFLAGS_SUN_OPTION_OLD($@)])])
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
AC_DEFUN([AX_GCC_ARCHFLAG],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
|
||||
AC_ARG_WITH(gcc-arch, [AC_HELP_STRING([--with-gcc-arch=<arch>], [use architecture <arch> for gcc -march/-mtune, instead of guessing])],
|
||||
ax_gcc_arch=$withval, ax_gcc_arch=yes)
|
||||
|
||||
AC_MSG_CHECKING([for gcc architecture flag])
|
||||
AC_MSG_RESULT([])
|
||||
AC_CACHE_VAL(ax_cv_gcc_archflag,
|
||||
[
|
||||
ax_cv_gcc_archflag="unknown"
|
||||
|
||||
if test "$GCC" = yes; then
|
||||
|
||||
if test "x$ax_gcc_arch" = xyes; then
|
||||
ax_gcc_arch=""
|
||||
if test "$cross_compiling" = no; then
|
||||
case $host_cpu in
|
||||
i[[3456]]86*|x86_64*) # use cpuid codes, in part from x86info-1.7 by D. Jones
|
||||
AX_GCC_X86_CPUID(0)
|
||||
AX_GCC_X86_CPUID(1)
|
||||
case $ax_cv_gcc_x86_cpuid_0 in
|
||||
*:756e6547:*:*) # Intel
|
||||
case $ax_cv_gcc_x86_cpuid_1 in
|
||||
*5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;;
|
||||
*5??:*:*:*) ax_gcc_arch=pentium ;;
|
||||
*6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
|
||||
*6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
|
||||
*6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
|
||||
*6[[9d]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;;
|
||||
*6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
|
||||
*6??:*:*:*) ax_gcc_arch=pentiumpro ;;
|
||||
*f3[[347]]:*:*:*|*f4[1347]:*:*:*)
|
||||
case $host_cpu in
|
||||
x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;;
|
||||
*) ax_gcc_arch="prescott pentium4 pentiumpro" ;;
|
||||
esac ;;
|
||||
*f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";;
|
||||
esac ;;
|
||||
*:68747541:*:*) # AMD
|
||||
case $ax_cv_gcc_x86_cpuid_1 in
|
||||
*5[[67]]?:*:*:*) ax_gcc_arch=k6 ;;
|
||||
*5[[8d]]?:*:*:*) ax_gcc_arch="k6-2 k6" ;;
|
||||
*5[[9]]?:*:*:*) ax_gcc_arch="k6-3 k6" ;;
|
||||
*60?:*:*:*) ax_gcc_arch=k7 ;;
|
||||
*6[[12]]?:*:*:*) ax_gcc_arch="athlon k7" ;;
|
||||
*6[[34]]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;;
|
||||
*67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;;
|
||||
*6[[68a]]?:*:*:*)
|
||||
AX_GCC_X86_CPUID(0x80000006) # L2 cache size
|
||||
case $ax_cv_gcc_x86_cpuid_0x80000006 in
|
||||
*:*:*[[1-9a-f]]??????:*) # (L2 = ecx >> 16) >= 256
|
||||
ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;;
|
||||
*) ax_gcc_arch="athlon-4 athlon k7" ;;
|
||||
esac ;;
|
||||
*f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;;
|
||||
*f5?:*:*:*) ax_gcc_arch="opteron k8" ;;
|
||||
*f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;;
|
||||
*f??:*:*:*) ax_gcc_arch="k8" ;;
|
||||
esac ;;
|
||||
*:746e6543:*:*) # IDT
|
||||
case $ax_cv_gcc_x86_cpuid_1 in
|
||||
*54?:*:*:*) ax_gcc_arch=winchip-c6 ;;
|
||||
*58?:*:*:*) ax_gcc_arch=winchip2 ;;
|
||||
*6[[78]]?:*:*:*) ax_gcc_arch=c3 ;;
|
||||
*69?:*:*:*) ax_gcc_arch="c3-2 c3" ;;
|
||||
esac ;;
|
||||
esac
|
||||
if test x"$ax_gcc_arch" = x; then # fallback
|
||||
case $host_cpu in
|
||||
i586*) ax_gcc_arch=pentium ;;
|
||||
i686*) ax_gcc_arch=pentiumpro ;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
|
||||
sparc*)
|
||||
AC_PATH_PROG([PRTDIAG], [prtdiag], [prtdiag], [$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/])
|
||||
cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null`
|
||||
cputype=`echo "$cputype" | tr -d ' -' |tr $as_cr_LETTERS $as_cr_letters`
|
||||
case $cputype in
|
||||
*ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;;
|
||||
*ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;;
|
||||
*ultrasparc*) ax_gcc_arch="ultrasparc v9" ;;
|
||||
*supersparc*|*tms390z5[[05]]*) ax_gcc_arch="supersparc v8" ;;
|
||||
*hypersparc*|*rt62[[056]]*) ax_gcc_arch="hypersparc v8" ;;
|
||||
*cypress*) ax_gcc_arch=cypress ;;
|
||||
esac ;;
|
||||
|
||||
alphaev5) ax_gcc_arch=ev5 ;;
|
||||
alphaev56) ax_gcc_arch=ev56 ;;
|
||||
alphapca56) ax_gcc_arch="pca56 ev56" ;;
|
||||
alphapca57) ax_gcc_arch="pca57 pca56 ev56" ;;
|
||||
alphaev6) ax_gcc_arch=ev6 ;;
|
||||
alphaev67) ax_gcc_arch=ev67 ;;
|
||||
alphaev68) ax_gcc_arch="ev68 ev67" ;;
|
||||
alphaev69) ax_gcc_arch="ev69 ev68 ev67" ;;
|
||||
alphaev7) ax_gcc_arch="ev7 ev69 ev68 ev67" ;;
|
||||
alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;;
|
||||
|
||||
powerpc*)
|
||||
cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | sed 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null`
|
||||
cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'`
|
||||
case $cputype in
|
||||
*750*) ax_gcc_arch="750 G3" ;;
|
||||
*740[[0-9]]*) ax_gcc_arch="$cputype 7400 G4" ;;
|
||||
*74[[4-5]][[0-9]]*) ax_gcc_arch="$cputype 7450 G4" ;;
|
||||
*74[[0-9]][[0-9]]*) ax_gcc_arch="$cputype G4" ;;
|
||||
*970*) ax_gcc_arch="970 G5 power4";;
|
||||
*POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";;
|
||||
*POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";;
|
||||
603ev|8240) ax_gcc_arch="$cputype 603e 603";;
|
||||
*) ax_gcc_arch=$cputype ;;
|
||||
esac
|
||||
ax_gcc_arch="$ax_gcc_arch powerpc"
|
||||
;;
|
||||
esac
|
||||
fi # not cross-compiling
|
||||
fi # guess arch
|
||||
|
||||
if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then
|
||||
for arch in $ax_gcc_arch; do
|
||||
if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code
|
||||
flags="-mtune=$arch"
|
||||
# -mcpu=$arch and m$arch generate nonportable code on every arch except
|
||||
# x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr.
|
||||
case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac
|
||||
else
|
||||
flags="-march=$arch -mcpu=$arch -m$arch"
|
||||
fi
|
||||
for flag in $flags; do
|
||||
AX_CHECK_COMPILER_FLAGS($flag, [ax_cv_gcc_archflag=$flag; break])
|
||||
done
|
||||
test "x$ax_cv_gcc_archflag" = xunknown || break
|
||||
done
|
||||
fi
|
||||
|
||||
fi # $GCC=yes
|
||||
])
|
||||
AC_MSG_CHECKING([for gcc architecture flag])
|
||||
AC_MSG_RESULT($ax_cv_gcc_archflag)
|
||||
if test "x$ax_cv_gcc_archflag" = xunknown; then
|
||||
m4_default([$3],:)
|
||||
else
|
||||
m4_default([$2], [CFLAGS="$CFLAGS $ax_cv_gcc_archflag"])
|
||||
fi
|
||||
])
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
AC_DEFUN([AX_GCC_X86_CPUID],
|
||||
[AC_REQUIRE([AC_PROG_CC])
|
||||
AC_LANG_PUSH([C])
|
||||
AC_CACHE_CHECK(for x86 cpuid $1 output, ax_cv_gcc_x86_cpuid_$1,
|
||||
[AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [
|
||||
int op = $1, eax, ebx, ecx, edx;
|
||||
FILE *f;
|
||||
__asm__("cpuid"
|
||||
: "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
|
||||
: "a" (op));
|
||||
f = fopen("conftest_cpuid", "w"); if (!f) return 1;
|
||||
fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx);
|
||||
fclose(f);
|
||||
return 0;
|
||||
])],
|
||||
[ax_cv_gcc_x86_cpuid_$1=`cat conftest_cpuid`; rm -f conftest_cpuid],
|
||||
[ax_cv_gcc_x86_cpuid_$1=unknown; rm -f conftest_cpuid],
|
||||
[ax_cv_gcc_x86_cpuid_$1=unknown])])
|
||||
AC_LANG_POP([C])
|
||||
])
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
AC_DEFUN([AC_PROG_GZIP],[
|
||||
AC_CHECK_PROGS(gzip,[gzip],no)
|
||||
export gzip;
|
||||
if test $gzip = "no" ;
|
||||
then
|
||||
AC_MSG_ERROR([Unable to find the gzip application]);
|
||||
fi
|
||||
AC_SUBST(gzip)
|
||||
])
|
|
@ -1,9 +0,0 @@
|
|||
AC_DEFUN([AC_PROG_WGET],[
|
||||
AC_CHECK_PROGS(wget,[wget],no)
|
||||
export wget;
|
||||
if test $wget = "no" ;
|
||||
then
|
||||
AC_MSG_ERROR([Unable to find the wget application]);
|
||||
fi
|
||||
AC_SUBST(wget)
|
||||
])
|
|
@ -1,120 +0,0 @@
|
|||
AC_DEFUN([AX_CC_MAXOPT],
|
||||
[
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AX_COMPILER_VENDOR])
|
||||
|
||||
AC_ARG_ENABLE(portable-binary, [AC_HELP_STRING([--enable-portable-binary], [disable compiler optimizations that would produce unportable binaries])],
|
||||
acx_maxopt_portable=$withval, acx_maxopt_portable=no)
|
||||
|
||||
# Try to determine "good" native compiler flags if none specified via CFLAGS
|
||||
if test "$ac_test_CFLAGS" != "set"; then
|
||||
CFLAGS=""
|
||||
case $ax_cv_c_compiler_vendor in
|
||||
dec) CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host"
|
||||
if test "x$acx_maxopt_portable" = xno; then
|
||||
CFLAGS="$CFLAGS -arch host"
|
||||
fi;;
|
||||
|
||||
sun) CFLAGS="-native -fast -xO5 -dalign -xc99=all"
|
||||
if test "x$acx_maxopt_portable" = xyes; then
|
||||
CFLAGS="$CFLAGS -xarch=generic"
|
||||
fi;;
|
||||
|
||||
hp) CFLAGS="+Oall +Optrs_ansi +DSnative"
|
||||
if test "x$acx_maxopt_portable" = xyes; then
|
||||
CFLAGS="$CFLAGS +DAportable"
|
||||
fi;;
|
||||
|
||||
ibm) if test "x$acx_maxopt_portable" = xno; then
|
||||
xlc_opt="-qarch=auto -qtune=auto"
|
||||
else
|
||||
xlc_opt="-qtune=auto"
|
||||
fi
|
||||
AX_CHECK_COMPILER_FLAGS($xlc_opt,
|
||||
CFLAGS="-O3 -qansialias -w $xlc_opt",
|
||||
[CFLAGS="-O3 -qansialias -w"
|
||||
echo "******************************************************"
|
||||
echo "* You seem to have the IBM C compiler. It is *"
|
||||
echo "* recommended for best performance that you use: *"
|
||||
echo "* *"
|
||||
echo "* CFLAGS=-O3 -qarch=xxx -qtune=xxx -qansialias -w *"
|
||||
echo "* ^^^ ^^^ *"
|
||||
echo "* where xxx is pwr2, pwr3, 604, or whatever kind of *"
|
||||
echo "* CPU you have. (Set the CFLAGS environment var. *"
|
||||
echo "* and re-run configure.) For more info, man cc. *"
|
||||
echo "******************************************************"])
|
||||
;;
|
||||
|
||||
intel) CFLAGS="-O3 -ansi_alias"
|
||||
if test "x$acx_maxopt_portable" = xno; then
|
||||
icc_archflag=unknown
|
||||
icc_flags=""
|
||||
case $host_cpu in
|
||||
i686*|x86_64*)
|
||||
# icc accepts gcc assembly syntax, so these should work:
|
||||
AX_GCC_X86_CPUID(0)
|
||||
AX_GCC_X86_CPUID(1)
|
||||
case $ax_cv_gcc_x86_cpuid_0 in # see AX_GCC_ARCHFLAG
|
||||
*:756e6547:*:*) # Intel
|
||||
case $ax_cv_gcc_x86_cpuid_1 in
|
||||
*6a?:*[[234]]:*:*|*6[[789b]]?:*:*:*) icc_flags="-xK";;
|
||||
*f3[[347]]:*:*:*|*f4[1347]:*:*:*) icc_flags="-xP -xN -xW -xK";;
|
||||
*f??:*:*:*) icc_flags="-xN -xW -xK";;
|
||||
esac ;;
|
||||
esac ;;
|
||||
esac
|
||||
if test "x$icc_flags" != x; then
|
||||
for flag in $icc_flags; do
|
||||
AX_CHECK_COMPILER_FLAGS($flag, [icc_archflag=$flag; break])
|
||||
done
|
||||
fi
|
||||
AC_MSG_CHECKING([for icc architecture flag])
|
||||
AC_MSG_RESULT($icc_archflag)
|
||||
if test "x$icc_archflag" != xunknown; then
|
||||
CFLAGS="$CFLAGS $icc_archflag"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
gnu)
|
||||
# default optimization flags for gcc on all systems
|
||||
CFLAGS="-O3 -fomit-frame-pointer"
|
||||
|
||||
# -malign-double for x86 systems
|
||||
AX_CHECK_COMPILER_FLAGS(-malign-double, CFLAGS="$CFLAGS -malign-double")
|
||||
|
||||
# -fstrict-aliasing for gcc-2.95+
|
||||
AX_CHECK_COMPILER_FLAGS(-fstrict-aliasing,
|
||||
CFLAGS="$CFLAGS -fstrict-aliasing")
|
||||
|
||||
# note that we enable "unsafe" fp optimization with other compilers, too
|
||||
AX_CHECK_COMPILER_FLAGS(-ffast-math, CFLAGS="$CFLAGS -ffast-math")
|
||||
|
||||
AX_GCC_ARCHFLAG($acx_maxopt_portable)
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$CFLAGS"; then
|
||||
echo ""
|
||||
echo "********************************************************"
|
||||
echo "* WARNING: Don't know the best CFLAGS for this system *"
|
||||
echo "* Use ./configure CFLAGS=... to specify your own flags *"
|
||||
echo "* (otherwise, a default of CFLAGS=-O3 will be used) *"
|
||||
echo "********************************************************"
|
||||
echo ""
|
||||
CFLAGS="-O3"
|
||||
fi
|
||||
|
||||
AX_CHECK_COMPILER_FLAGS($CFLAGS, [], [
|
||||
echo ""
|
||||
echo "********************************************************"
|
||||
echo "* WARNING: The guessed CFLAGS don't seem to work with *"
|
||||
echo "* your compiler. *"
|
||||
echo "* Use ./configure CFLAGS=... to specify your own flags *"
|
||||
echo "********************************************************"
|
||||
echo ""
|
||||
CFLAGS=""
|
||||
])
|
||||
|
||||
fi
|
||||
])
|
|
@ -1,94 +0,0 @@
|
|||
AC_DEFUN([AX_CFLAGS_WARN_ALL_ANSI],[dnl
|
||||
AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
|
||||
AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all_ansi])dnl
|
||||
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ansi warnings],
|
||||
VAR,[VAR="no, unknown"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_C
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
# IRIX C compiler:
|
||||
# -use_readonly_const is the default for IRIX C,
|
||||
# puts them into .rodata, but they are copied later.
|
||||
# need to be "-G0 -rdatashared" for strictmode but
|
||||
# I am not sure what effect that has really. - guidod
|
||||
for ac_arg dnl
|
||||
in "-pedantic % -Wall -std=c99 -pedantic" dnl GCC
|
||||
"-xstrconst % -v -xc99=all" dnl Solaris C
|
||||
"-std1 % -verbose -w0 -warnprotos -std1" dnl Digital Unix
|
||||
" % -qlanglvl=ansi -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
|
||||
" % -ansi -ansiE -fullwarn" dnl IRIX
|
||||
"+ESlit % +w1 -Aa" dnl HP-UX C
|
||||
"-Xc % -pvctl[,]fullmsg -Xc" dnl NEC SX-5 (Super-UX 10)
|
||||
"-h conform % -h msglevel 2 -h conform" dnl Cray C (Unicos)
|
||||
#
|
||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||
AC_TRY_COMPILE([],[return 0;],
|
||||
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
|
||||
done
|
||||
FLAGS="$ac_save_[]FLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
case ".$VAR" in
|
||||
.ok|.ok,*) m4_ifvaln($3,$3) ;;
|
||||
.|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
|
||||
AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
|
||||
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
|
||||
*) m4_ifvaln($3,$3,[
|
||||
if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
|
||||
then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
|
||||
else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
|
||||
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
|
||||
fi ]) ;;
|
||||
esac
|
||||
AS_VAR_POPDEF([VAR])dnl
|
||||
AS_VAR_POPDEF([FLAGS])dnl
|
||||
])
|
||||
|
||||
dnl the only difference - the LANG selection... and the default FLAGS
|
||||
|
||||
AC_DEFUN([AX_CXXFLAGS_WARN_ALL_ANSI],[dnl
|
||||
AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
|
||||
AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all_ansi])dnl
|
||||
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ansi warnings],
|
||||
VAR,[VAR="no, unknown"
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CXX
|
||||
ac_save_[]FLAGS="$[]FLAGS"
|
||||
# IRIX C compiler:
|
||||
# -use_readonly_const is the default for IRIX C,
|
||||
# puts them into .rodata, but they are copied later.
|
||||
# need to be "-G0 -rdatashared" for strictmode but
|
||||
# I am not sure what effect that has really. - guidod
|
||||
for ac_arg dnl
|
||||
in "-pedantic % -Wall -ansi -pedantic" dnl GCC
|
||||
"-xstrconst % -v -Xc" dnl Solaris C
|
||||
"-std1 % -verbose -w0 -warnprotos -std1" dnl Digital Unix
|
||||
" % -qlanglvl=ansi -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
|
||||
" % -ansi -ansiE -fullwarn" dnl IRIX
|
||||
"+ESlit % +w1 -Aa" dnl HP-UX C
|
||||
"-Xc % -pvctl[,]fullmsg -Xc" dnl NEC SX-5 (Super-UX 10)
|
||||
"-h conform % -h msglevel 2 -h conform" dnl Cray C (Unicos)
|
||||
#
|
||||
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||
AC_TRY_COMPILE([],[return 0;],
|
||||
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
|
||||
done
|
||||
FLAGS="$ac_save_[]FLAGS"
|
||||
AC_LANG_RESTORE
|
||||
])
|
||||
case ".$VAR" in
|
||||
.ok|.ok,*) m4_ifvaln($3,$3) ;;
|
||||
.|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
|
||||
AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
|
||||
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
|
||||
*) m4_ifvaln($3,$3,[
|
||||
if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
|
||||
then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
|
||||
else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
|
||||
m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
|
||||
fi ]) ;;
|
||||
esac
|
||||
AS_VAR_POPDEF([VAR])dnl
|
||||
AS_VAR_POPDEF([FLAGS])dnl
|
||||
])
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
AC_DEFUN([AX_CHECK_COMPILER_FLAGS],
|
||||
[AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
|
||||
AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1])
|
||||
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
|
||||
AS_LITERAL_IF([$1],
|
||||
[AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1), [
|
||||
ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$1"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
|
||||
AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes,
|
||||
AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no)
|
||||
_AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])],
|
||||
[ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$1"
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
|
||||
eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes,
|
||||
eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no)
|
||||
_AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])
|
||||
eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)
|
||||
AC_MSG_RESULT($ax_check_compiler_flags)
|
||||
if test "x$ax_check_compiler_flags" = xyes; then
|
||||
m4_default([$2], :)
|
||||
else
|
||||
m4_default([$3], :)
|
||||
fi
|
||||
])dnl AX_CHECK_COMPILER_FLAG
|
|
@ -1,15 +0,0 @@
|
|||
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
|
||||
])
|
||||
])
|
|
@ -1,2 +0,0 @@
|
|||
#! /bin/sh
|
||||
./configure "$@" --disable-shared
|
|
@ -1,140 +0,0 @@
|
|||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT(libg7xx, 0.1, nobody@nobody.com)
|
||||
AC_CONFIG_AUX_DIR(build)
|
||||
AM_INIT_AUTOMAKE(libg7xx,0.1)
|
||||
|
||||
#Set default language
|
||||
AC_LANG_C
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
#Check for compiler vendor
|
||||
AX_COMPILER_VENDOR
|
||||
|
||||
# Optimize
|
||||
AC_ARG_ENABLE(optimization,
|
||||
[AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"])
|
||||
|
||||
if test "${enable_optimizer}" = "yes" ; then
|
||||
AC_DEFINE([OPTIMZER],[],[Enable Optimization.])
|
||||
AX_CC_MAXOPT
|
||||
fi
|
||||
|
||||
# Enable debugging
|
||||
AC_ARG_ENABLE(debug,
|
||||
[AC_HELP_STRING([--enable-debug],[build with debug information])],[enable_debug="$enable_debug"],[enable_debug="yes"])
|
||||
|
||||
if test "${enable_debug}" = "yes"; then
|
||||
AC_DEFINE([DEBUG],[],[Enable extra debugging.])
|
||||
AX_CFLAGS_WARN_ALL_ANSI
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"])
|
||||
|
||||
|
||||
case "$host" in
|
||||
*-solaris2*)
|
||||
if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
|
||||
SOLINK="-Bdynamic -dy -G"
|
||||
new_AM_CFLAGS="-KPIC -DPIC"
|
||||
new_AM_LDFLAGS="-R${prefix}/lib"
|
||||
FUNC_DEF=__func__
|
||||
IN_LINE=""
|
||||
elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
|
||||
SOLINK="-Bdynamic -dy -G"
|
||||
new_AM_CFLAGS="-fPIC"
|
||||
new_AM_LDFLAGS=""
|
||||
IN_LINE=inline
|
||||
fi
|
||||
DYNAMIC_LIB_EXTEN="so"
|
||||
;;
|
||||
*-darwin*)
|
||||
if test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
|
||||
SOLINK="-dynamic -bundle -force-flat-namespace"
|
||||
new_AM_CFLAGS="-DMACOSX"
|
||||
new_AM_LDFLAGS=""
|
||||
fi
|
||||
DYNAMIC_LIB_EXTEN="dylib"
|
||||
IN_LINE=inline
|
||||
;;
|
||||
x86_64-*-linux-gnu)
|
||||
if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
|
||||
SOLINK="-Bdynamic -dy -G"
|
||||
new_AM_CFLAGS="-KPIC -DPIC"
|
||||
new_AM_LDFLAGS="-R${prefix}/lib"
|
||||
FUNC_DEF=__func__
|
||||
elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
|
||||
SOLINK="-shared -Xlinker -x"
|
||||
new_AM_CFLAGS="-fPIC"
|
||||
new_AM_LDFLAGS=""
|
||||
fi
|
||||
DYNAMIC_LIB_EXTEN="so"
|
||||
IN_LINE=inline
|
||||
;;
|
||||
i*6-*-linux-gnu)
|
||||
if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
|
||||
SOLINK="-Bdynamic -dy -G"
|
||||
new_AM_CFLAGS="-KPIC -DPIC"
|
||||
new_AM_LDFLAGS="-R${prefix}/lib"
|
||||
FUNC_DEF=__func__
|
||||
elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then
|
||||
SOLINK="-shared -Xlinker -x"
|
||||
new_AM_CFLAGS="-fpic"
|
||||
new_AM_LDFLAGS=""
|
||||
fi
|
||||
DYNAMIC_LIB_EXTEN="so"
|
||||
IN_LINE=inline
|
||||
;;
|
||||
x86_64-*-freebsd*|amd64-*-freebsd*)
|
||||
SOLINK="-shared -Xlinker -x"
|
||||
new_AM_CFLAGS="-fPIC"
|
||||
new_AM_LDFLAGS=""
|
||||
DYNAMIC_LIB_EXTEN="so"
|
||||
IN_LINE=inline
|
||||
;;
|
||||
i*6-*-freebsd*)
|
||||
SOLINK="-shared -Xlinker -x"
|
||||
new_AM_CFLAGS="-fpic"
|
||||
new_AM_LDFLAGS=""
|
||||
DYNAMIC_LIB_EXTEN="so"
|
||||
IN_LINE=inline
|
||||
;;
|
||||
esac
|
||||
|
||||
# Enable 64 bit build
|
||||
AC_ARG_ENABLE(64,
|
||||
[AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"])
|
||||
|
||||
if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
|
||||
if test "${enable_64}" = "yes"; then
|
||||
new_AM_CFLAGS="$new_AM_CFLAGS -m64"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(new_AM_CFLAGS)
|
||||
AC_SUBST(new_AM_LDFLAGS)
|
||||
AC_SUBST(SOLINK)
|
||||
AC_SUBST(DYNAMIC_LIB_EXTEN)
|
||||
AC_DEFINE_UNQUOTED([__FUNCTION__],[$FUNC_DEF],[define it the right way ;)])
|
||||
AC_DEFINE_UNQUOTED([__inline__],[$IN_LINE],[sunpro is bad at inline])
|
||||
|
||||
# Checks for libraries.
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([inttypes.h memory.h stdlib.h string.h tgmath.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_MALLOC
|
||||
AC_CHECK_FUNCS([memset])
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
|
|
@ -1,195 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="libg7xx"
|
||||
ProjectGUID="{D71E7338-8D9C-4FE4-A15F-D5CC60202C7C}"
|
||||
RootNamespace="libg7xx"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<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/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<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/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<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\g711.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\g722_decode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\g722_encode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\g726.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="./src/include/g7xx/g711.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="./src/include/g7xx/g722.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="./src/include/g7xx/g726.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>
|
|
@ -1,196 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="libg7xx"
|
||||
ProjectGUID="{D71E7338-8D9C-4FE4-A15F-D5CC60202C7C}"
|
||||
RootNamespace="libg7xx"
|
||||
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/include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
WarnAsError="true"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<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/include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<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\g711.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\g722_decode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\g722_encode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\g726.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="./src/include/g7xx/g711.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="./src/include/g7xx/g722.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="./src/include/g7xx/g726.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>
|
|
@ -1,400 +0,0 @@
|
|||
/*
|
||||
* SpanDSP - a series of DSP components for telephony
|
||||
*
|
||||
* g722_decode.c - The ITU G.722 codec, decode part.
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2005 Steve Underwood
|
||||
*
|
||||
* Despite my general liking of the GPL, I place my own contributions
|
||||
* to this code in the public domain for the benefit of all mankind -
|
||||
* even the slimy ones who might try to proprietize my work and use it
|
||||
* to my detriment.
|
||||
*
|
||||
* Based in part on a single channel G.722 codec which is:
|
||||
*
|
||||
* Copyright (c) CMU 1993
|
||||
* Computer Science, Speech Group
|
||||
* Chengxiang Lu and Alex Hauptmann
|
||||
*
|
||||
* $Id: g722_decode.c,v 1.15 2006/07/07 16:37:49 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <memory.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <inttypes.h>
|
||||
#ifdef HAVE_TGMATH_H
|
||||
#include <tgmath.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "g7xx/g722.h"
|
||||
|
||||
#if !defined(FALSE)
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#if !defined(TRUE)
|
||||
#define TRUE (!FALSE)
|
||||
#endif
|
||||
|
||||
static __inline__ int16_t saturate(int32_t amp)
|
||||
{
|
||||
int16_t amp16;
|
||||
|
||||
/* Hopefully this is optimised for the common case - not clipping */
|
||||
amp16 = (int16_t) amp;
|
||||
if (amp == amp16)
|
||||
return amp16;
|
||||
if (amp > INT16_MAX)
|
||||
return INT16_MAX;
|
||||
return INT16_MIN;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static void block4(g722_decode_state_t *s, int band, int d);
|
||||
|
||||
static void block4(g722_decode_state_t *s, int band, int d)
|
||||
{
|
||||
int wd1;
|
||||
int wd2;
|
||||
int wd3;
|
||||
int i;
|
||||
|
||||
/* Block 4, RECONS */
|
||||
s->band[band].d[0] = d;
|
||||
s->band[band].r[0] = saturate(s->band[band].s + d);
|
||||
|
||||
/* Block 4, PARREC */
|
||||
s->band[band].p[0] = saturate(s->band[band].sz + d);
|
||||
|
||||
/* Block 4, UPPOL2 */
|
||||
for (i = 0; i < 3; i++)
|
||||
s->band[band].sg[i] = s->band[band].p[i] >> 15;
|
||||
wd1 = saturate(s->band[band].a[1] << 2);
|
||||
|
||||
wd2 = (s->band[band].sg[0] == s->band[band].sg[1]) ? -wd1 : wd1;
|
||||
if (wd2 > 32767)
|
||||
wd2 = 32767;
|
||||
wd3 = (s->band[band].sg[0] == s->band[band].sg[2]) ? 128 : -128;
|
||||
wd3 += (wd2 >> 7);
|
||||
wd3 += (s->band[band].a[2]*32512) >> 15;
|
||||
if (wd3 > 12288)
|
||||
wd3 = 12288;
|
||||
else if (wd3 < -12288)
|
||||
wd3 = -12288;
|
||||
s->band[band].ap[2] = wd3;
|
||||
|
||||
/* Block 4, UPPOL1 */
|
||||
s->band[band].sg[0] = s->band[band].p[0] >> 15;
|
||||
s->band[band].sg[1] = s->band[band].p[1] >> 15;
|
||||
wd1 = (s->band[band].sg[0] == s->band[band].sg[1]) ? 192 : -192;
|
||||
wd2 = (s->band[band].a[1]*32640) >> 15;
|
||||
|
||||
s->band[band].ap[1] = saturate(wd1 + wd2);
|
||||
wd3 = saturate(15360 - s->band[band].ap[2]);
|
||||
if (s->band[band].ap[1] > wd3)
|
||||
s->band[band].ap[1] = wd3;
|
||||
else if (s->band[band].ap[1] < -wd3)
|
||||
s->band[band].ap[1] = -wd3;
|
||||
|
||||
/* Block 4, UPZERO */
|
||||
wd1 = (d == 0) ? 0 : 128;
|
||||
s->band[band].sg[0] = d >> 15;
|
||||
for (i = 1; i < 7; i++)
|
||||
{
|
||||
s->band[band].sg[i] = s->band[band].d[i] >> 15;
|
||||
wd2 = (s->band[band].sg[i] == s->band[band].sg[0]) ? wd1 : -wd1;
|
||||
wd3 = (s->band[band].b[i]*32640) >> 15;
|
||||
s->band[band].bp[i] = saturate(wd2 + wd3);
|
||||
}
|
||||
|
||||
/* Block 4, DELAYA */
|
||||
for (i = 6; i > 0; i--)
|
||||
{
|
||||
s->band[band].d[i] = s->band[band].d[i - 1];
|
||||
s->band[band].b[i] = s->band[band].bp[i];
|
||||
}
|
||||
|
||||
for (i = 2; i > 0; i--)
|
||||
{
|
||||
s->band[band].r[i] = s->band[band].r[i - 1];
|
||||
s->band[band].p[i] = s->band[band].p[i - 1];
|
||||
s->band[band].a[i] = s->band[band].ap[i];
|
||||
}
|
||||
|
||||
/* Block 4, FILTEP */
|
||||
wd1 = saturate(s->band[band].r[1] + s->band[band].r[1]);
|
||||
wd1 = (s->band[band].a[1]*wd1) >> 15;
|
||||
wd2 = saturate(s->band[band].r[2] + s->band[band].r[2]);
|
||||
wd2 = (s->band[band].a[2]*wd2) >> 15;
|
||||
s->band[band].sp = saturate(wd1 + wd2);
|
||||
|
||||
/* Block 4, FILTEZ */
|
||||
s->band[band].sz = 0;
|
||||
for (i = 6; i > 0; i--)
|
||||
{
|
||||
wd1 = saturate(s->band[band].d[i] + s->band[band].d[i]);
|
||||
s->band[band].sz += (s->band[band].b[i]*wd1) >> 15;
|
||||
}
|
||||
s->band[band].sz = saturate(s->band[band].sz);
|
||||
|
||||
/* Block 4, PREDIC */
|
||||
s->band[band].s = saturate(s->band[band].sp + s->band[band].sz);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
g722_decode_state_t *g722_decode_init(g722_decode_state_t *s, int rate, int options)
|
||||
{
|
||||
if (s == NULL)
|
||||
{
|
||||
if ((s = (g722_decode_state_t *) malloc(sizeof(*s))) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
memset(s, 0, sizeof(*s));
|
||||
if (rate == 48000)
|
||||
s->bits_per_sample = 6;
|
||||
else if (rate == 56000)
|
||||
s->bits_per_sample = 7;
|
||||
else
|
||||
s->bits_per_sample = 8;
|
||||
if ((options & G722_SAMPLE_RATE_8000))
|
||||
s->eight_k = TRUE;
|
||||
if ((options & G722_PACKED) && s->bits_per_sample != 8)
|
||||
s->packed = TRUE;
|
||||
else
|
||||
s->packed = FALSE;
|
||||
s->band[0].det = 32;
|
||||
s->band[1].det = 8;
|
||||
return s;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
int g722_decode_release(g722_decode_state_t *s)
|
||||
{
|
||||
free(s);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
int g722_decode(g722_decode_state_t *s, int16_t amp[], const uint8_t g722_data[], int len)
|
||||
{
|
||||
static const int wl[8] = {-60, -30, 58, 172, 334, 538, 1198, 3042 };
|
||||
static const int rl42[16] = {0, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 0 };
|
||||
static const int ilb[32] =
|
||||
{
|
||||
2048, 2093, 2139, 2186, 2233, 2282, 2332,
|
||||
2383, 2435, 2489, 2543, 2599, 2656, 2714,
|
||||
2774, 2834, 2896, 2960, 3025, 3091, 3158,
|
||||
3228, 3298, 3371, 3444, 3520, 3597, 3676,
|
||||
3756, 3838, 3922, 4008
|
||||
};
|
||||
static const int wh[3] = {0, -214, 798};
|
||||
static const int rh2[4] = {2, 1, 2, 1};
|
||||
static const int qm2[4] = {-7408, -1616, 7408, 1616};
|
||||
static const int qm4[16] =
|
||||
{
|
||||
0, -20456, -12896, -8968,
|
||||
-6288, -4240, -2584, -1200,
|
||||
20456, 12896, 8968, 6288,
|
||||
4240, 2584, 1200, 0
|
||||
};
|
||||
static const int qm5[32] =
|
||||
{
|
||||
-280, -280, -23352, -17560,
|
||||
-14120, -11664, -9752, -8184,
|
||||
-6864, -5712, -4696, -3784,
|
||||
-2960, -2208, -1520, -880,
|
||||
23352, 17560, 14120, 11664,
|
||||
9752, 8184, 6864, 5712,
|
||||
4696, 3784, 2960, 2208,
|
||||
1520, 880, 280, -280
|
||||
};
|
||||
static const int qm6[64] =
|
||||
{
|
||||
-136, -136, -136, -136,
|
||||
-24808, -21904, -19008, -16704,
|
||||
-14984, -13512, -12280, -11192,
|
||||
-10232, -9360, -8576, -7856,
|
||||
-7192, -6576, -6000, -5456,
|
||||
-4944, -4464, -4008, -3576,
|
||||
-3168, -2776, -2400, -2032,
|
||||
-1688, -1360, -1040, -728,
|
||||
24808, 21904, 19008, 16704,
|
||||
14984, 13512, 12280, 11192,
|
||||
10232, 9360, 8576, 7856,
|
||||
7192, 6576, 6000, 5456,
|
||||
4944, 4464, 4008, 3576,
|
||||
3168, 2776, 2400, 2032,
|
||||
1688, 1360, 1040, 728,
|
||||
432, 136, -432, -136
|
||||
};
|
||||
static const int qmf_coeffs[12] =
|
||||
{
|
||||
3, -11, 12, 32, -210, 951, 3876, -805, 362, -156, 53, -11,
|
||||
};
|
||||
|
||||
int dlowt;
|
||||
int rlow;
|
||||
int ihigh;
|
||||
int dhigh;
|
||||
int rhigh;
|
||||
int xout1;
|
||||
int xout2;
|
||||
int wd1;
|
||||
int wd2;
|
||||
int wd3;
|
||||
int code;
|
||||
int outlen;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
outlen = 0;
|
||||
rhigh = 0;
|
||||
for (j = 0; j < len; )
|
||||
{
|
||||
if (s->packed)
|
||||
{
|
||||
/* Unpack the code bits */
|
||||
if (s->in_bits < s->bits_per_sample)
|
||||
{
|
||||
s->in_buffer |= (g722_data[j++] << s->in_bits);
|
||||
s->in_bits += 8;
|
||||
}
|
||||
code = s->in_buffer & ((1 << s->bits_per_sample) - 1);
|
||||
s->in_buffer >>= s->bits_per_sample;
|
||||
s->in_bits -= s->bits_per_sample;
|
||||
}
|
||||
else
|
||||
{
|
||||
code = g722_data[j++];
|
||||
}
|
||||
|
||||
switch (s->bits_per_sample)
|
||||
{
|
||||
default:
|
||||
case 8:
|
||||
wd1 = code & 0x3F;
|
||||
ihigh = (code >> 6) & 0x03;
|
||||
wd2 = qm6[wd1];
|
||||
wd1 >>= 2;
|
||||
break;
|
||||
case 7:
|
||||
wd1 = code & 0x1F;
|
||||
ihigh = (code >> 5) & 0x03;
|
||||
wd2 = qm5[wd1];
|
||||
wd1 >>= 1;
|
||||
break;
|
||||
case 6:
|
||||
wd1 = code & 0x0F;
|
||||
ihigh = (code >> 4) & 0x03;
|
||||
wd2 = qm4[wd1];
|
||||
break;
|
||||
}
|
||||
/* Block 5L, LOW BAND INVQBL */
|
||||
wd2 = (s->band[0].det*wd2) >> 15;
|
||||
/* Block 5L, RECONS */
|
||||
rlow = s->band[0].s + wd2;
|
||||
/* Block 6L, LIMIT */
|
||||
if (rlow > 16383)
|
||||
rlow = 16383;
|
||||
else if (rlow < -16384)
|
||||
rlow = -16384;
|
||||
|
||||
/* Block 2L, INVQAL */
|
||||
wd2 = qm4[wd1];
|
||||
dlowt = (s->band[0].det*wd2) >> 15;
|
||||
|
||||
/* Block 3L, LOGSCL */
|
||||
wd2 = rl42[wd1];
|
||||
wd1 = (s->band[0].nb*127) >> 7;
|
||||
wd1 += wl[wd2];
|
||||
if (wd1 < 0)
|
||||
wd1 = 0;
|
||||
else if (wd1 > 18432)
|
||||
wd1 = 18432;
|
||||
s->band[0].nb = wd1;
|
||||
|
||||
/* Block 3L, SCALEL */
|
||||
wd1 = (s->band[0].nb >> 6) & 31;
|
||||
wd2 = 8 - (s->band[0].nb >> 11);
|
||||
wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2);
|
||||
s->band[0].det = wd3 << 2;
|
||||
|
||||
block4(s, 0, dlowt);
|
||||
|
||||
if (!s->eight_k)
|
||||
{
|
||||
/* Block 2H, INVQAH */
|
||||
wd2 = qm2[ihigh];
|
||||
dhigh = (s->band[1].det*wd2) >> 15;
|
||||
/* Block 5H, RECONS */
|
||||
rhigh = dhigh + s->band[1].s;
|
||||
/* Block 6H, LIMIT */
|
||||
if (rhigh > 16383)
|
||||
rhigh = 16383;
|
||||
else if (rhigh < -16384)
|
||||
rhigh = -16384;
|
||||
|
||||
/* Block 2H, INVQAH */
|
||||
wd2 = rh2[ihigh];
|
||||
wd1 = (s->band[1].nb*127) >> 7;
|
||||
wd1 += wh[wd2];
|
||||
if (wd1 < 0)
|
||||
wd1 = 0;
|
||||
else if (wd1 > 22528)
|
||||
wd1 = 22528;
|
||||
s->band[1].nb = wd1;
|
||||
|
||||
/* Block 3H, SCALEH */
|
||||
wd1 = (s->band[1].nb >> 6) & 31;
|
||||
wd2 = 10 - (s->band[1].nb >> 11);
|
||||
wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2);
|
||||
s->band[1].det = wd3 << 2;
|
||||
|
||||
block4(s, 1, dhigh);
|
||||
}
|
||||
|
||||
if (s->itu_test_mode)
|
||||
{
|
||||
amp[outlen++] = (int16_t) (rlow << 1);
|
||||
amp[outlen++] = (int16_t) (rhigh << 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s->eight_k)
|
||||
{
|
||||
amp[outlen++] = (int16_t) rlow;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Apply the receive QMF */
|
||||
for (i = 0; i < 22; i++)
|
||||
s->x[i] = s->x[i + 2];
|
||||
s->x[22] = rlow + rhigh;
|
||||
s->x[23] = rlow - rhigh;
|
||||
|
||||
xout1 = 0;
|
||||
xout2 = 0;
|
||||
for (i = 0; i < 12; i++)
|
||||
{
|
||||
xout2 += s->x[2*i]*qmf_coeffs[i];
|
||||
xout1 += s->x[2*i + 1]*qmf_coeffs[11 - i];
|
||||
}
|
||||
amp[outlen++] = (int16_t) (xout1 >> 12);
|
||||
amp[outlen++] = (int16_t) (xout2 >> 12);
|
||||
}
|
||||
}
|
||||
}
|
||||
return outlen;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
/*- End of file ------------------------------------------------------------*/
|
|
@ -1,402 +0,0 @@
|
|||
/*
|
||||
* SpanDSP - a series of DSP components for telephony
|
||||
*
|
||||
* g722_encode.c - The ITU G.722 codec, encode part.
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2005 Steve Underwood
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Despite my general liking of the GPL, I place my own contributions
|
||||
* to this code in the public domain for the benefit of all mankind -
|
||||
* even the slimy ones who might try to proprietize my work and use it
|
||||
* to my detriment.
|
||||
*
|
||||
* Based on a single channel 64kbps only G.722 codec which is:
|
||||
*
|
||||
***** Copyright (c) CMU 1993 *****
|
||||
* Computer Science, Speech Group
|
||||
* Chengxiang Lu and Alex Hauptmann
|
||||
*
|
||||
* $Id: g722_encode.c,v 1.14 2006/07/07 16:37:49 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <memory.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <inttypes.h>
|
||||
#ifdef HAVE_TGMATH_H
|
||||
#include <tgmath.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "g7xx/g722.h"
|
||||
|
||||
#if !defined(FALSE)
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#if !defined(TRUE)
|
||||
#define TRUE (!FALSE)
|
||||
#endif
|
||||
|
||||
static __inline__ int16_t saturate(int32_t amp)
|
||||
{
|
||||
int16_t amp16;
|
||||
|
||||
/* Hopefully this is optimised for the common case - not clipping */
|
||||
amp16 = (int16_t) amp;
|
||||
if (amp == amp16)
|
||||
return amp16;
|
||||
if (amp > INT16_MAX)
|
||||
return INT16_MAX;
|
||||
return INT16_MIN;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static void block4(g722_encode_state_t *s, int band, int d)
|
||||
{
|
||||
int wd1;
|
||||
int wd2;
|
||||
int wd3;
|
||||
int i;
|
||||
|
||||
/* Block 4, RECONS */
|
||||
s->band[band].d[0] = d;
|
||||
s->band[band].r[0] = saturate(s->band[band].s + d);
|
||||
|
||||
/* Block 4, PARREC */
|
||||
s->band[band].p[0] = saturate(s->band[band].sz + d);
|
||||
|
||||
/* Block 4, UPPOL2 */
|
||||
for (i = 0; i < 3; i++)
|
||||
s->band[band].sg[i] = s->band[band].p[i] >> 15;
|
||||
wd1 = saturate(s->band[band].a[1] << 2);
|
||||
|
||||
wd2 = (s->band[band].sg[0] == s->band[band].sg[1]) ? -wd1 : wd1;
|
||||
if (wd2 > 32767)
|
||||
wd2 = 32767;
|
||||
wd3 = (wd2 >> 7) + ((s->band[band].sg[0] == s->band[band].sg[2]) ? 128 : -128);
|
||||
wd3 += (s->band[band].a[2]*32512) >> 15;
|
||||
if (wd3 > 12288)
|
||||
wd3 = 12288;
|
||||
else if (wd3 < -12288)
|
||||
wd3 = -12288;
|
||||
s->band[band].ap[2] = wd3;
|
||||
|
||||
/* Block 4, UPPOL1 */
|
||||
s->band[band].sg[0] = s->band[band].p[0] >> 15;
|
||||
s->band[band].sg[1] = s->band[band].p[1] >> 15;
|
||||
wd1 = (s->band[band].sg[0] == s->band[band].sg[1]) ? 192 : -192;
|
||||
wd2 = (s->band[band].a[1]*32640) >> 15;
|
||||
|
||||
s->band[band].ap[1] = saturate(wd1 + wd2);
|
||||
wd3 = saturate(15360 - s->band[band].ap[2]);
|
||||
if (s->band[band].ap[1] > wd3)
|
||||
s->band[band].ap[1] = wd3;
|
||||
else if (s->band[band].ap[1] < -wd3)
|
||||
s->band[band].ap[1] = -wd3;
|
||||
|
||||
/* Block 4, UPZERO */
|
||||
wd1 = (d == 0) ? 0 : 128;
|
||||
s->band[band].sg[0] = d >> 15;
|
||||
for (i = 1; i < 7; i++)
|
||||
{
|
||||
s->band[band].sg[i] = s->band[band].d[i] >> 15;
|
||||
wd2 = (s->band[band].sg[i] == s->band[band].sg[0]) ? wd1 : -wd1;
|
||||
wd3 = (s->band[band].b[i]*32640) >> 15;
|
||||
s->band[band].bp[i] = saturate(wd2 + wd3);
|
||||
}
|
||||
|
||||
/* Block 4, DELAYA */
|
||||
for (i = 6; i > 0; i--)
|
||||
{
|
||||
s->band[band].d[i] = s->band[band].d[i - 1];
|
||||
s->band[band].b[i] = s->band[band].bp[i];
|
||||
}
|
||||
|
||||
for (i = 2; i > 0; i--)
|
||||
{
|
||||
s->band[band].r[i] = s->band[band].r[i - 1];
|
||||
s->band[band].p[i] = s->band[band].p[i - 1];
|
||||
s->band[band].a[i] = s->band[band].ap[i];
|
||||
}
|
||||
|
||||
/* Block 4, FILTEP */
|
||||
wd1 = saturate(s->band[band].r[1] + s->band[band].r[1]);
|
||||
wd1 = (s->band[band].a[1]*wd1) >> 15;
|
||||
wd2 = saturate(s->band[band].r[2] + s->band[band].r[2]);
|
||||
wd2 = (s->band[band].a[2]*wd2) >> 15;
|
||||
s->band[band].sp = saturate(wd1 + wd2);
|
||||
|
||||
/* Block 4, FILTEZ */
|
||||
s->band[band].sz = 0;
|
||||
for (i = 6; i > 0; i--)
|
||||
{
|
||||
wd1 = saturate(s->band[band].d[i] + s->band[band].d[i]);
|
||||
s->band[band].sz += (s->band[band].b[i]*wd1) >> 15;
|
||||
}
|
||||
s->band[band].sz = saturate(s->band[band].sz);
|
||||
|
||||
/* Block 4, PREDIC */
|
||||
s->band[band].s = saturate(s->band[band].sp + s->band[band].sz);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
g722_encode_state_t *g722_encode_init(g722_encode_state_t *s, int rate, int options)
|
||||
{
|
||||
if (s == NULL)
|
||||
{
|
||||
if ((s = (g722_encode_state_t *) malloc(sizeof(*s))) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
memset(s, 0, sizeof(*s));
|
||||
if (rate == 48000)
|
||||
s->bits_per_sample = 6;
|
||||
else if (rate == 56000)
|
||||
s->bits_per_sample = 7;
|
||||
else
|
||||
s->bits_per_sample = 8;
|
||||
if ((options & G722_SAMPLE_RATE_8000))
|
||||
s->eight_k = TRUE;
|
||||
if ((options & G722_PACKED) && s->bits_per_sample != 8)
|
||||
s->packed = TRUE;
|
||||
else
|
||||
s->packed = FALSE;
|
||||
s->band[0].det = 32;
|
||||
s->band[1].det = 8;
|
||||
return s;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
int g722_encode_release(g722_encode_state_t *s)
|
||||
{
|
||||
free(s);
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
int g722_encode(g722_encode_state_t *s, uint8_t g722_data[], const int16_t amp[], int len)
|
||||
{
|
||||
static const int q6[32] =
|
||||
{
|
||||
0, 35, 72, 110, 150, 190, 233, 276,
|
||||
323, 370, 422, 473, 530, 587, 650, 714,
|
||||
786, 858, 940, 1023, 1121, 1219, 1339, 1458,
|
||||
1612, 1765, 1980, 2195, 2557, 2919, 0, 0
|
||||
};
|
||||
static const int iln[32] =
|
||||
{
|
||||
0, 63, 62, 31, 30, 29, 28, 27,
|
||||
26, 25, 24, 23, 22, 21, 20, 19,
|
||||
18, 17, 16, 15, 14, 13, 12, 11,
|
||||
10, 9, 8, 7, 6, 5, 4, 0
|
||||
};
|
||||
static const int ilp[32] =
|
||||
{
|
||||
0, 61, 60, 59, 58, 57, 56, 55,
|
||||
54, 53, 52, 51, 50, 49, 48, 47,
|
||||
46, 45, 44, 43, 42, 41, 40, 39,
|
||||
38, 37, 36, 35, 34, 33, 32, 0
|
||||
};
|
||||
static const int wl[8] =
|
||||
{
|
||||
-60, -30, 58, 172, 334, 538, 1198, 3042
|
||||
};
|
||||
static const int rl42[16] =
|
||||
{
|
||||
0, 7, 6, 5, 4, 3, 2, 1, 7, 6, 5, 4, 3, 2, 1, 0
|
||||
};
|
||||
static const int ilb[32] =
|
||||
{
|
||||
2048, 2093, 2139, 2186, 2233, 2282, 2332,
|
||||
2383, 2435, 2489, 2543, 2599, 2656, 2714,
|
||||
2774, 2834, 2896, 2960, 3025, 3091, 3158,
|
||||
3228, 3298, 3371, 3444, 3520, 3597, 3676,
|
||||
3756, 3838, 3922, 4008
|
||||
};
|
||||
static const int qm4[16] =
|
||||
{
|
||||
0, -20456, -12896, -8968,
|
||||
-6288, -4240, -2584, -1200,
|
||||
20456, 12896, 8968, 6288,
|
||||
4240, 2584, 1200, 0
|
||||
};
|
||||
static const int qm2[4] =
|
||||
{
|
||||
-7408, -1616, 7408, 1616
|
||||
};
|
||||
static const int qmf_coeffs[12] =
|
||||
{
|
||||
3, -11, 12, 32, -210, 951, 3876, -805, 362, -156, 53, -11,
|
||||
};
|
||||
static const int ihn[3] = {0, 1, 0};
|
||||
static const int ihp[3] = {0, 3, 2};
|
||||
static const int wh[3] = {0, -214, 798};
|
||||
static const int rh2[4] = {2, 1, 2, 1};
|
||||
|
||||
int dlow;
|
||||
int dhigh;
|
||||
int el;
|
||||
int wd;
|
||||
int wd1;
|
||||
int ril;
|
||||
int wd2;
|
||||
int il4;
|
||||
int ih2;
|
||||
int wd3;
|
||||
int eh;
|
||||
int mih;
|
||||
int i;
|
||||
int j;
|
||||
/* Low and high band PCM from the QMF */
|
||||
int xlow;
|
||||
int xhigh;
|
||||
int g722_bytes;
|
||||
/* Even and odd tap accumulators */
|
||||
int sumeven;
|
||||
int sumodd;
|
||||
int ihigh;
|
||||
int ilow;
|
||||
int code;
|
||||
|
||||
g722_bytes = 0;
|
||||
xhigh = 0;
|
||||
for (j = 0; j < len; )
|
||||
{
|
||||
if (s->itu_test_mode)
|
||||
{
|
||||
xlow =
|
||||
xhigh = amp[j++] >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s->eight_k)
|
||||
{
|
||||
xlow = amp[j++];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Apply the transmit QMF */
|
||||
/* Shuffle the buffer down */
|
||||
for (i = 0; i < 22; i++)
|
||||
s->x[i] = s->x[i + 2];
|
||||
s->x[22] = amp[j++];
|
||||
s->x[23] = amp[j++];
|
||||
|
||||
/* Discard every other QMF output */
|
||||
sumeven = 0;
|
||||
sumodd = 0;
|
||||
for (i = 0; i < 12; i++)
|
||||
{
|
||||
sumodd += s->x[2*i]*qmf_coeffs[i];
|
||||
sumeven += s->x[2*i + 1]*qmf_coeffs[11 - i];
|
||||
}
|
||||
xlow = (sumeven + sumodd) >> 13;
|
||||
xhigh = (sumeven - sumodd) >> 13;
|
||||
}
|
||||
}
|
||||
/* Block 1L, SUBTRA */
|
||||
el = saturate(xlow - s->band[0].s);
|
||||
|
||||
/* Block 1L, QUANTL */
|
||||
wd = (el >= 0) ? el : -(el + 1);
|
||||
|
||||
for (i = 1; i < 30; i++)
|
||||
{
|
||||
wd1 = (q6[i]*s->band[0].det) >> 12;
|
||||
if (wd < wd1)
|
||||
break;
|
||||
}
|
||||
ilow = (el < 0) ? iln[i] : ilp[i];
|
||||
|
||||
/* Block 2L, INVQAL */
|
||||
ril = ilow >> 2;
|
||||
wd2 = qm4[ril];
|
||||
dlow = (s->band[0].det*wd2) >> 15;
|
||||
|
||||
/* Block 3L, LOGSCL */
|
||||
il4 = rl42[ril];
|
||||
wd = (s->band[0].nb*127) >> 7;
|
||||
s->band[0].nb = wd + wl[il4];
|
||||
if (s->band[0].nb < 0)
|
||||
s->band[0].nb = 0;
|
||||
else if (s->band[0].nb > 18432)
|
||||
s->band[0].nb = 18432;
|
||||
|
||||
/* Block 3L, SCALEL */
|
||||
wd1 = (s->band[0].nb >> 6) & 31;
|
||||
wd2 = 8 - (s->band[0].nb >> 11);
|
||||
wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2);
|
||||
s->band[0].det = wd3 << 2;
|
||||
|
||||
block4(s, 0, dlow);
|
||||
|
||||
if (s->eight_k)
|
||||
{
|
||||
/* Just leave the high bits as zero */
|
||||
code = (0xC0 | ilow) >> (8 - s->bits_per_sample);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Block 1H, SUBTRA */
|
||||
eh = saturate(xhigh - s->band[1].s);
|
||||
|
||||
/* Block 1H, QUANTH */
|
||||
wd = (eh >= 0) ? eh : -(eh + 1);
|
||||
wd1 = (564*s->band[1].det) >> 12;
|
||||
mih = (wd >= wd1) ? 2 : 1;
|
||||
ihigh = (eh < 0) ? ihn[mih] : ihp[mih];
|
||||
|
||||
/* Block 2H, INVQAH */
|
||||
wd2 = qm2[ihigh];
|
||||
dhigh = (s->band[1].det*wd2) >> 15;
|
||||
|
||||
/* Block 3H, LOGSCH */
|
||||
ih2 = rh2[ihigh];
|
||||
wd = (s->band[1].nb*127) >> 7;
|
||||
s->band[1].nb = wd + wh[ih2];
|
||||
if (s->band[1].nb < 0)
|
||||
s->band[1].nb = 0;
|
||||
else if (s->band[1].nb > 22528)
|
||||
s->band[1].nb = 22528;
|
||||
|
||||
/* Block 3H, SCALEH */
|
||||
wd1 = (s->band[1].nb >> 6) & 31;
|
||||
wd2 = 10 - (s->band[1].nb >> 11);
|
||||
wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2);
|
||||
s->band[1].det = wd3 << 2;
|
||||
|
||||
block4(s, 1, dhigh);
|
||||
code = ((ihigh << 6) | ilow) >> (8 - s->bits_per_sample);
|
||||
}
|
||||
|
||||
if (s->packed)
|
||||
{
|
||||
/* Pack the code bits */
|
||||
s->out_buffer |= (code << s->out_bits);
|
||||
s->out_bits += s->bits_per_sample;
|
||||
if (s->out_bits >= 8)
|
||||
{
|
||||
g722_data[g722_bytes++] = (uint8_t) (s->out_buffer & 0xFF);
|
||||
s->out_bits -= 8;
|
||||
s->out_buffer >>= 8;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g722_data[g722_bytes++] = (uint8_t) code;
|
||||
}
|
||||
}
|
||||
return g722_bytes;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
/*- End of file ------------------------------------------------------------*/
|
File diff suppressed because it is too large
Load Diff
|
@ -1,157 +0,0 @@
|
|||
/*
|
||||
* SpanDSP - a series of DSP components for telephony
|
||||
*
|
||||
* g722.h - The ITU G.722 codec.
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2005 Steve Underwood
|
||||
*
|
||||
* Despite my general liking of the GPL, I place my own contributions
|
||||
* to this code in the public domain for the benefit of all mankind -
|
||||
* even the slimy ones who might try to proprietize my work and use it
|
||||
* to my detriment.
|
||||
*
|
||||
* Based on a single channel G.722 codec which is:
|
||||
*
|
||||
***** Copyright (c) CMU 1993 *****
|
||||
* Computer Science, Speech Group
|
||||
* Chengxiang Lu and Alex Hauptmann
|
||||
*
|
||||
* $Id: g722.h,v 1.10 2006/06/16 12:45:53 steveu Exp $
|
||||
*/
|
||||
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if !defined(_G722_H_)
|
||||
#define _G722_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifndef __inline__
|
||||
#define __inline__ __inline
|
||||
#endif
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
#ifndef INT16_MAX
|
||||
#define INT16_MAX 0x7fff
|
||||
#endif
|
||||
#ifndef INT16_MIN
|
||||
#define INT16_MIN (-INT16_MAX - 1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*! \page g722_page G.722 encoding and decoding
|
||||
\section g722_page_sec_1 What does it do?
|
||||
The G.722 module is a bit exact implementation of the ITU G.722 specification for all three
|
||||
specified bit rates - 64000bps, 56000bps and 48000bps. It passes the ITU tests.
|
||||
|
||||
To allow fast and flexible interworking with narrow band telephony, the encoder and decoder
|
||||
support an option for the linear audio to be an 8k samples/second stream. In this mode the
|
||||
codec is considerably faster, and still fully compatible with wideband terminals using G.722.
|
||||
|
||||
\section g722_page_sec_2 How does it work?
|
||||
???.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
G722_SAMPLE_RATE_8000 = 0x0001,
|
||||
G722_PACKED = 0x0002
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/*! TRUE if the operating in the special ITU test mode, with the band split filters
|
||||
disabled. */
|
||||
int itu_test_mode;
|
||||
/*! TRUE if the G.722 data is packed */
|
||||
int packed;
|
||||
/*! TRUE if encode from 8k samples/second */
|
||||
int eight_k;
|
||||
/*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
|
||||
int bits_per_sample;
|
||||
|
||||
/*! Signal history for the QMF */
|
||||
int x[24];
|
||||
|
||||
struct
|
||||
{
|
||||
int s;
|
||||
int sp;
|
||||
int sz;
|
||||
int r[3];
|
||||
int a[3];
|
||||
int ap[3];
|
||||
int p[3];
|
||||
int d[7];
|
||||
int b[7];
|
||||
int bp[7];
|
||||
int sg[7];
|
||||
int nb;
|
||||
int det;
|
||||
} band[2];
|
||||
|
||||
unsigned int in_buffer;
|
||||
int in_bits;
|
||||
unsigned int out_buffer;
|
||||
int out_bits;
|
||||
} g722_encode_state_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/*! TRUE if the operating in the special ITU test mode, with the band split filters
|
||||
disabled. */
|
||||
int itu_test_mode;
|
||||
/*! TRUE if the G.722 data is packed */
|
||||
int packed;
|
||||
/*! TRUE if decode to 8k samples/second */
|
||||
int eight_k;
|
||||
/*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
|
||||
int bits_per_sample;
|
||||
|
||||
/*! Signal history for the QMF */
|
||||
int x[24];
|
||||
|
||||
struct
|
||||
{
|
||||
int s;
|
||||
int sp;
|
||||
int sz;
|
||||
int r[3];
|
||||
int a[3];
|
||||
int ap[3];
|
||||
int p[3];
|
||||
int d[7];
|
||||
int b[7];
|
||||
int bp[7];
|
||||
int sg[7];
|
||||
int nb;
|
||||
int det;
|
||||
} band[2];
|
||||
|
||||
unsigned int in_buffer;
|
||||
int in_bits;
|
||||
unsigned int out_buffer;
|
||||
int out_bits;
|
||||
} g722_decode_state_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
g722_encode_state_t *g722_encode_init(g722_encode_state_t *s, int rate, int options);
|
||||
int g722_encode_release(g722_encode_state_t *s);
|
||||
int g722_encode(g722_encode_state_t *s, uint8_t g722_data[], const int16_t amp[], int len);
|
||||
|
||||
g722_decode_state_t *g722_decode_init(g722_decode_state_t *s, int rate, int options);
|
||||
int g722_decode_release(g722_decode_state_t *s);
|
||||
int g722_decode(g722_decode_state_t *s, int16_t amp[], const uint8_t g722_data[], int len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,194 +0,0 @@
|
|||
/*
|
||||
* SpanDSP - a series of DSP components for telephony
|
||||
*
|
||||
* g726.h - ITU G.726 codec.
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2006 Steve Underwood
|
||||
*
|
||||
* Despite my general liking of the GPL, I place my own contributions
|
||||
* to this code in the public domain for the benefit of all mankind -
|
||||
* even the slimy ones who might try to proprietize my work and use it
|
||||
* to my detriment.
|
||||
*
|
||||
* Based on G.721/G.723 code which is:
|
||||
*
|
||||
* This source code is a product of Sun Microsystems, Inc. and is provided
|
||||
* for unrestricted use. Users may copy or modify this source code without
|
||||
* charge.
|
||||
*
|
||||
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
|
||||
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun source code is provided with no support and without any obligation on
|
||||
* the part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*
|
||||
* $Id: g726.h,v 1.8 2006/09/03 04:43:46 steveu Exp $
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
#if !defined(_G726_H_)
|
||||
#define _G726_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifndef __inline__
|
||||
#define __inline__ __inline
|
||||
#endif
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
#endif
|
||||
|
||||
/*! \page g726_page G.726 encoding and decoding
|
||||
\section g726_page_sec_1 What does it do?
|
||||
|
||||
The G.726 module is a bit exact implementation of the full ITU G.726 specification.
|
||||
It supports:
|
||||
- 16 kbps, 24kbps, 32kbps, and 40kbps operation.
|
||||
- Tandem adjustment, for interworking with A-law and u-law.
|
||||
- Annex A support, for use in environments not using A-law or u-law.
|
||||
|
||||
It passes the ITU tests.
|
||||
|
||||
\section g726_page_sec_2 How does it work?
|
||||
???.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
G726_ENCODING_LINEAR = 0, /* Interworking with 16 bit signed linear */
|
||||
G726_ENCODING_ULAW, /* Interworking with u-law */
|
||||
G726_ENCODING_ALAW /* Interworking with A-law */
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
G726_PACKING_NONE = 0,
|
||||
G726_PACKING_LEFT = 1,
|
||||
G726_PACKING_RIGHT = 2
|
||||
};
|
||||
|
||||
struct g726_state_s;
|
||||
|
||||
typedef int16_t (*g726_decoder_func_t)(struct g726_state_s *s, uint8_t code);
|
||||
|
||||
typedef uint8_t (*g726_encoder_func_t)(struct g726_state_s *s, int16_t amp);
|
||||
|
||||
/*
|
||||
* The following is the definition of the state structure
|
||||
* used by the G.726 encoder and decoder to preserve their internal
|
||||
* state between successive calls. The meanings of the majority
|
||||
* of the state structure fields are explained in detail in the
|
||||
* CCITT Recommendation G.721. The field names are essentially indentical
|
||||
* to variable names in the bit level description of the coding algorithm
|
||||
* included in this Recommendation.
|
||||
*/
|
||||
typedef struct g726_state_s
|
||||
{
|
||||
/*! The bit rate */
|
||||
int rate;
|
||||
/*! The external coding, for tandem operation */
|
||||
int ext_coding;
|
||||
/*! The number of bits per sample */
|
||||
int bits_per_sample;
|
||||
/*! One fo the G.726_PACKING_xxx options */
|
||||
int packing;
|
||||
|
||||
/*! Locked or steady state step size multiplier. */
|
||||
int32_t yl;
|
||||
/*! Unlocked or non-steady state step size multiplier. */
|
||||
int16_t yu;
|
||||
/*! int16_t term energy estimate. */
|
||||
int16_t dms;
|
||||
/*! Long term energy estimate. */
|
||||
int16_t dml;
|
||||
/*! Linear weighting coefficient of 'yl' and 'yu'. */
|
||||
int16_t ap;
|
||||
|
||||
/*! Coefficients of pole portion of prediction filter. */
|
||||
int16_t a[2];
|
||||
/*! Coefficients of zero portion of prediction filter. */
|
||||
int16_t b[6];
|
||||
/*! Signs of previous two samples of a partially reconstructed signal. */
|
||||
int16_t pk[2];
|
||||
/*! Previous 6 samples of the quantized difference signal represented in
|
||||
an internal floating point format. */
|
||||
int16_t dq[6];
|
||||
/*! Previous 2 samples of the quantized difference signal represented in an
|
||||
internal floating point format. */
|
||||
int16_t sr[2];
|
||||
/*! Delayed tone detect */
|
||||
int td;
|
||||
|
||||
unsigned int in_buffer;
|
||||
int in_bits;
|
||||
unsigned int out_buffer;
|
||||
int out_bits;
|
||||
|
||||
g726_encoder_func_t enc_func;
|
||||
g726_decoder_func_t dec_func;
|
||||
} g726_state_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*! Initialise a G.726 encode or decode context.
|
||||
\param s The G.726 context.
|
||||
\param bit_rate The required bit rate for the ADPCM data.
|
||||
The valid rates are 16000, 24000, 32000 and 40000.
|
||||
\param ext_coding The coding used outside G.726.
|
||||
\param packing One of the G.726_PACKING_xxx options.
|
||||
\return A pointer to the G.726 context, or NULL for error. */
|
||||
g726_state_t *g726_init(g726_state_t *s, int bit_rate, int ext_coding, int packing);
|
||||
|
||||
/*! Free a G.726 encode or decode context.
|
||||
\param s The G.726 context.
|
||||
\return 0 for OK. */
|
||||
int g726_release(g726_state_t *s);
|
||||
|
||||
/*! Decode a buffer of G.726 ADPCM data to linear PCM, a-law or u-law.
|
||||
\param s The G.726 context.
|
||||
\param amp
|
||||
\param g726_data
|
||||
\param g726_bytes
|
||||
\return The number of samples returned. */
|
||||
int g726_decode(g726_state_t *s,
|
||||
int16_t amp[],
|
||||
const uint8_t g726_data[],
|
||||
int g726_bytes);
|
||||
|
||||
/*! Encode a buffer of linear PCM data to G.726 ADPCM.
|
||||
\param s The G.726 context.
|
||||
\param g726_data
|
||||
\param amp
|
||||
\param samples
|
||||
\return The number of bytes of G.726 data produced. */
|
||||
int g726_encode(g726_state_t *s,
|
||||
uint8_t g726_data[],
|
||||
const int16_t amp[],
|
||||
int samples);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/*- End of file ------------------------------------------------------------*/
|
|
@ -1 +0,0 @@
|
|||
Fri Mar 16 17:13:43 EDT 2007
|
|
@ -1,340 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
|
@ -1,16 +0,0 @@
|
|||
Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
|
||||
Technische Universitaet Berlin
|
||||
|
||||
Any use of this software is permitted provided that this notice is not
|
||||
removed and that neither the authors nor the Technische Universitaet Berlin
|
||||
are deemed to have made any representations as to the suitability of this
|
||||
software for any purpose nor are held responsible for any defects of
|
||||
this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
|
||||
As a matter of courtesy, the authors request to be informed about uses
|
||||
this software has found, about bugs in this software, and about any
|
||||
improvements that may be of general interest.
|
||||
|
||||
Berlin, 28.11.1994
|
||||
Jutta Degener
|
||||
Carsten Bormann
|
|
@ -1,236 +0,0 @@
|
|||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
This file is free documentation; the Free Software Foundation gives
|
||||
unlimited permission to copy, distribute and modify it.
|
||||
|
||||
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, and a
|
||||
file `config.log' containing compiler output (useful mainly for
|
||||
debugging `configure').
|
||||
|
||||
It can also use an optional file (typically called `config.cache'
|
||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
||||
the results of its tests to speed up reconfiguring. (Caching is
|
||||
disabled by default to prevent problems with accidental use of stale
|
||||
cache files.)
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how `configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the `README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point `config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file `configure.ac' (or `configure.in') 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. Run `./configure --help' for
|
||||
details on some of the pertinent environment variables.
|
||||
|
||||
You can give `configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here
|
||||
is an example:
|
||||
|
||||
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
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 support 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' installs the package's commands under
|
||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
||||
can specify an installation prefix other than `/usr/local' by giving
|
||||
`configure' the option `--prefix=PREFIX'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
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' cannot figure out automatically,
|
||||
but needs to determine by the type of machine the package will run on.
|
||||
Usually, assuming the package is built to be run on the _same_
|
||||
architectures, `configure' can figure that out, but if it prints a
|
||||
message saying it cannot guess the machine type, give it the
|
||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as `sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS KERNEL-OS
|
||||
|
||||
See the file `config.sub' for the possible values of each field. If
|
||||
`config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option `--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with `--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
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.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to `configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the `configure' command line, using `VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified `gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script). Here is a another example:
|
||||
|
||||
/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
|
||||
configuration-related scripts to be executed by `/bin/bash'.
|
||||
|
||||
`configure' Invocation
|
||||
======================
|
||||
|
||||
`configure' recognizes the following options to control how it operates.
|
||||
|
||||
`--help'
|
||||
`-h'
|
||||
Print a summary of the options to `configure', and exit.
|
||||
|
||||
`--version'
|
||||
`-V'
|
||||
Print the version of Autoconf used to generate the `configure'
|
||||
script, and exit.
|
||||
|
||||
`--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
||||
disable caching.
|
||||
|
||||
`--config-cache'
|
||||
`-C'
|
||||
Alias for `--cache-file=config.cache'.
|
||||
|
||||
`--quiet'
|
||||
`--silent'
|
||||
`-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.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options. Run
|
||||
`configure --help' for more details.
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
EXTRA_DIST =
|
||||
SUBDIRS =
|
||||
AUTOMAKE_OPTS= gnu
|
||||
NAME=libgsm
|
||||
|
||||
AM_CC=gcc
|
||||
AM_CFLAGS = -I./inc -DNeedFunctionPrototypes=1 -fPIC -DSASR -DNDEBUG -DWAV49
|
||||
AM_CPPFLAGS = $(AM_CFLAGS)
|
||||
|
||||
lib_LTLIBRARIES = libgsm.la
|
||||
libgsm_la_SOURCES = src/add.c\
|
||||
src/code.c\
|
||||
src/decode.c\
|
||||
src/gsm_create.c\
|
||||
src/gsm_decode.c\
|
||||
src/gsm_destroy.c\
|
||||
src/gsm_encode.c\
|
||||
src/gsm_lpc.c\
|
||||
src/gsm_option.c\
|
||||
src/long_term.c\
|
||||
src/preprocess.c\
|
||||
src/rpe.c\
|
||||
src/short_term.c\
|
||||
src/table.c
|
||||
|
||||
libgsm_la_CFLAGS = $(AM_CFLAGS)
|
||||
libgsm_la_LDFLAGS =
|
||||
|
||||
library_includedir = $(prefix)/include
|
||||
library_include_HEADERS = inc/config.h\
|
||||
inc/gsm.h\
|
||||
inc/private.h\
|
||||
inc/proto.h\
|
||||
inc/unproto.h
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
|
||||
GSM 06.10 13 kbit/s RPE/LTP speech compression available
|
||||
--------------------------------------------------------
|
||||
|
||||
The Communications and Operating Systems Research Group (KBS) at the
|
||||
Technische Universitaet Berlin is currently working on a set of
|
||||
UNIX-based tools for computer-mediated telecooperation that will be
|
||||
made freely available.
|
||||
|
||||
As part of this effort we are publishing an implementation of the
|
||||
European GSM 06.10 provisional standard for full-rate speech
|
||||
transcoding, prI-ETS 300 036, which uses RPE/LTP (residual pulse
|
||||
excitation/long term prediction) coding at 13 kbit/s.
|
||||
|
||||
GSM 06.10 compresses frames of 160 13-bit samples (8 kHz sampling
|
||||
rate, i.e. a frame rate of 50 Hz) into 260 bits; for compatibility
|
||||
with typical UNIX applications, our implementation turns frames of 160
|
||||
16-bit linear samples into 33-byte frames (1650 Bytes/s).
|
||||
The quality of the algorithm is good enough for reliable speaker
|
||||
recognition; even music often survives transcoding in recognizable
|
||||
form (given the bandwidth limitations of 8 kHz sampling rate).
|
||||
|
||||
The interfaces offered are a front end modelled after compress(1), and
|
||||
a library API. Compression and decompression run faster than realtime
|
||||
on most SPARCstations. The implementation has been verified against the
|
||||
ETSI standard test patterns.
|
||||
|
||||
Jutta Degener (jutta@cs.tu-berlin.de)
|
||||
Carsten Bormann (cabo@cs.tu-berlin.de)
|
||||
|
||||
Communications and Operating Systems Research Group, TU Berlin
|
||||
Fax: +49.30.31425156, Phone: +49.30.31424315
|
||||
|
||||
--
|
||||
Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
|
@ -1,2 +0,0 @@
|
|||
#! /bin/sh
|
||||
./configure "$@" --disable-shared
|
|
@ -1,65 +0,0 @@
|
|||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
|
||||
AM_INIT_AUTOMAKE(libgsm,0.1)
|
||||
AC_CONFIG_SRCDIR([src])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_LIBTOOL
|
||||
AC_PROG_INSTALL
|
||||
|
||||
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
|
||||
])
|
||||
])
|
||||
|
||||
AX_COMPILER_VENDOR
|
||||
|
||||
# Enable 64 bit build
|
||||
AC_ARG_ENABLE(64,
|
||||
[AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"])
|
||||
|
||||
if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
|
||||
if test "${enable_64}" = "yes"; then
|
||||
CFLAGS="$CFLAGS -m64"
|
||||
CXXFLAGS="$CXXFLAGS -m64"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STDC
|
||||
#AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
AC_TYPE_SIZE_T
|
||||
AC_HEADER_TIME
|
||||
AC_STRUCT_TM
|
||||
|
||||
# Checks for library functions.
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_FUNC_MALLOC
|
||||
AC_TYPE_SIGNAL
|
||||
AC_FUNC_STRFTIME
|
||||
#AC_CHECK_FUNCS([gethostname gettimeofday localtime_r memmove memset socket strcasecmp strchr strdup strncasecmp strstr])
|
||||
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
|
||||
AC_OUTPUT
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* config.h
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
/*efine SIGHANDLER_T int * signal handlers are void */
|
||||
/*efine HAS_SYSV_SIGNAL 1 * sigs not blocked/reset? */
|
||||
|
||||
#define HAS_STDLIB_H 1 /* /usr/include/stdlib.h */
|
||||
/*efine HAS_LIMITS_H 1 * /usr/include/limits.h */
|
||||
#define HAS_FCNTL_H 1 /* /usr/include/fcntl.h */
|
||||
/*efine HAS_ERRNO_DECL 1 * errno.h declares errno */
|
||||
|
||||
#define HAS_FSTAT 1 /* fstat syscall */
|
||||
#define HAS_FCHMOD 1 /* fchmod syscall */
|
||||
#define HAS_CHMOD 1 /* chmod syscall */
|
||||
#define HAS_FCHOWN 1 /* fchown syscall */
|
||||
#define HAS_CHOWN 1 /* chown syscall */
|
||||
/*efine HAS__FSETMODE 1 * _fsetmode -- set file mode */
|
||||
|
||||
#define HAS_STRING_H 1 /* /usr/include/string.h */
|
||||
/*efine HAS_STRINGS_H 1 * /usr/include/strings.h */
|
||||
|
||||
#define HAS_UNISTD_H 1 /* /usr/include/unistd.h */
|
||||
#define HAS_UTIME 1 /* POSIX utime(path, times) */
|
||||
/*efine HAS_UTIMES 1 * use utimes() syscall instead */
|
||||
#define HAS_UTIME_H 1 /* UTIME header file */
|
||||
/*efine HAS_UTIMBUF 1 * struct utimbuf */
|
||||
/*efine HAS_UTIMEUSEC 1 * microseconds in utimbuf? */
|
||||
|
||||
#endif /* CONFIG_H */
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* gsm.h
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GSM_H
|
||||
#define GSM_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define NeedFunctionPrototypes 1
|
||||
#endif
|
||||
|
||||
#if __STDC__
|
||||
# define NeedFunctionPrototypes 1
|
||||
#endif
|
||||
|
||||
#ifdef _NO_PROTO
|
||||
# undef NeedFunctionPrototypes
|
||||
#endif
|
||||
|
||||
#ifdef NeedFunctionPrototypes
|
||||
# include <stdio.h> /* for FILE * */
|
||||
#endif
|
||||
|
||||
#undef GSM_P
|
||||
#if NeedFunctionPrototypes
|
||||
# define GSM_P( protos ) protos
|
||||
#else
|
||||
# define GSM_P( protos ) ( /* protos */ )
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Interface
|
||||
*/
|
||||
|
||||
typedef struct gsm_state * gsm;
|
||||
typedef short gsm_signal; /* signed 16 bit */
|
||||
typedef unsigned char gsm_byte;
|
||||
typedef gsm_byte gsm_frame[33]; /* 33 * 8 bits */
|
||||
|
||||
#define GSM_MAGIC 0xD /* 13 kbit/s RPE-LTP */
|
||||
|
||||
#define GSM_PATCHLEVEL 10
|
||||
#define GSM_MINOR 0
|
||||
#define GSM_MAJOR 1
|
||||
|
||||
#define GSM_OPT_VERBOSE 1
|
||||
#define GSM_OPT_FAST 2
|
||||
#define GSM_OPT_LTP_CUT 3
|
||||
#define GSM_OPT_WAV49 4
|
||||
#define GSM_OPT_FRAME_INDEX 5
|
||||
#define GSM_OPT_FRAME_CHAIN 6
|
||||
|
||||
extern gsm gsm_create GSM_P((void));
|
||||
extern void gsm_destroy GSM_P((gsm));
|
||||
|
||||
extern int gsm_print GSM_P((FILE *, gsm, gsm_byte *));
|
||||
extern int gsm_option GSM_P((gsm, int, int *));
|
||||
|
||||
extern void gsm_encode GSM_P((gsm, gsm_signal *, gsm_byte *));
|
||||
extern int gsm_decode GSM_P((gsm, gsm_byte *, gsm_signal *));
|
||||
|
||||
extern int gsm_explode GSM_P((gsm, gsm_byte *, gsm_signal *));
|
||||
extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte *));
|
||||
|
||||
#undef GSM_P
|
||||
|
||||
#endif /* GSM_H */
|
|
@ -1,269 +0,0 @@
|
|||
/*
|
||||
* private.h
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PRIVATE_H
|
||||
#define PRIVATE_H
|
||||
|
||||
typedef short word; /* 16 bit signed int */
|
||||
typedef long longword; /* 32 bit signed int */
|
||||
|
||||
typedef unsigned short uword; /* unsigned word */
|
||||
typedef unsigned long ulongword; /* unsigned longword */
|
||||
|
||||
struct gsm_state {
|
||||
|
||||
word dp0[ 280 ];
|
||||
|
||||
word z1; /* preprocessing.c, Offset_com. */
|
||||
longword L_z2; /* Offset_com. */
|
||||
int mp; /* Preemphasis */
|
||||
|
||||
word u[8]; /* short_term_aly_filter.c */
|
||||
word LARpp[2][8]; /* */
|
||||
word j; /* */
|
||||
|
||||
word ltp_cut; /* long_term.c, LTP crosscorr. */
|
||||
word nrp; /* 40 */ /* long_term.c, synthesis */
|
||||
word v[9]; /* short_term.c, synthesis */
|
||||
word msr; /* decoder.c, Postprocessing */
|
||||
|
||||
int verbose; /* only used if !NDEBUG */
|
||||
char fast; /* only used if FAST */
|
||||
|
||||
char wav_fmt; /* only used if WAV49 defined */
|
||||
unsigned char frame_index; /* odd/even chaining */
|
||||
unsigned char frame_chain; /* half-byte to carry forward */
|
||||
};
|
||||
|
||||
|
||||
#define MIN_WORD (-32767 - 1)
|
||||
#define MAX_WORD 32767
|
||||
|
||||
#define MIN_LONGWORD (-2147483647 - 1)
|
||||
#define MAX_LONGWORD 2147483647
|
||||
|
||||
#ifdef SASR /* flag: >> is a signed arithmetic shift right */
|
||||
#undef SASR
|
||||
#define SASR(x, by) ((x) >> (by))
|
||||
#else
|
||||
#define SASR(x, by) ((x) >= 0 ? (x) >> (by) : (~(-((x) + 1) >> (by))))
|
||||
#endif /* SASR */
|
||||
|
||||
#include "proto.h"
|
||||
|
||||
/*
|
||||
* Prototypes from add.c
|
||||
*/
|
||||
extern word gsm_mult P((word a, word b));
|
||||
extern longword gsm_L_mult P((word a, word b));
|
||||
extern word gsm_mult_r P((word a, word b));
|
||||
|
||||
extern word gsm_div P((word num, word denum));
|
||||
|
||||
extern word gsm_add P(( word a, word b ));
|
||||
extern longword gsm_L_add P(( longword a, longword b ));
|
||||
|
||||
extern word gsm_sub P((word a, word b));
|
||||
extern longword gsm_L_sub P((longword a, longword b));
|
||||
|
||||
extern word gsm_abs P((word a));
|
||||
|
||||
extern word gsm_norm P(( longword a ));
|
||||
|
||||
extern longword gsm_L_asl P((longword a, int n));
|
||||
extern word gsm_asl P((word a, int n));
|
||||
|
||||
extern longword gsm_L_asr P((longword a, int n));
|
||||
extern word gsm_asr P((word a, int n));
|
||||
|
||||
/*
|
||||
* Inlined functions from add.h
|
||||
*/
|
||||
|
||||
/*
|
||||
* #define GSM_MULT_R(a, b) (* word a, word b, !(a == b == MIN_WORD) *) \
|
||||
* (0x0FFFF & SASR(((longword)(a) * (longword)(b) + 16384), 15))
|
||||
*/
|
||||
#define GSM_MULT_R(a, b) /* word a, word b, !(a == b == MIN_WORD) */ \
|
||||
(SASR( ((longword)(a) * (longword)(b) + 16384), 15 ))
|
||||
|
||||
# define GSM_MULT(a,b) /* word a, word b, !(a == b == MIN_WORD) */ \
|
||||
(SASR( ((longword)(a) * (longword)(b)), 15 ))
|
||||
|
||||
# define GSM_L_MULT(a, b) /* word a, word b */ \
|
||||
(((longword)(a) * (longword)(b)) << 1)
|
||||
|
||||
# define GSM_L_ADD(a, b) \
|
||||
( (a) < 0 ? ( (b) >= 0 ? (a) + (b) \
|
||||
: (utmp = (ulongword)-((a) + 1) + (ulongword)-((b) + 1)) \
|
||||
>= MAX_LONGWORD ? MIN_LONGWORD : -(longword)utmp-2 ) \
|
||||
: ((b) <= 0 ? (a) + (b) \
|
||||
: (utmp = (ulongword)(a) + (ulongword)(b)) >= MAX_LONGWORD \
|
||||
? MAX_LONGWORD : utmp))
|
||||
|
||||
/*
|
||||
* # define GSM_ADD(a, b) \
|
||||
* ((ltmp = (longword)(a) + (longword)(b)) >= MAX_WORD \
|
||||
* ? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp)
|
||||
*/
|
||||
/* Nonportable, but faster: */
|
||||
|
||||
#define GSM_ADD(a, b) \
|
||||
((ulongword)((ltmp = (longword)(a) + (longword)(b)) - MIN_WORD) > \
|
||||
MAX_WORD - MIN_WORD ? (ltmp > 0 ? MAX_WORD : MIN_WORD) : ltmp)
|
||||
|
||||
# define GSM_SUB(a, b) \
|
||||
((ltmp = (longword)(a) - (longword)(b)) >= MAX_WORD \
|
||||
? MAX_WORD : ltmp <= MIN_WORD ? MIN_WORD : ltmp)
|
||||
|
||||
# define GSM_ABS(a) ((a) < 0 ? ((a) == MIN_WORD ? MAX_WORD : -(a)) : (a))
|
||||
|
||||
/* Use these if necessary:
|
||||
|
||||
# define GSM_MULT_R(a, b) gsm_mult_r(a, b)
|
||||
# define GSM_MULT(a, b) gsm_mult(a, b)
|
||||
# define GSM_L_MULT(a, b) gsm_L_mult(a, b)
|
||||
|
||||
# define GSM_L_ADD(a, b) gsm_L_add(a, b)
|
||||
# define GSM_ADD(a, b) gsm_add(a, b)
|
||||
# define GSM_SUB(a, b) gsm_sub(a, b)
|
||||
|
||||
# define GSM_ABS(a) gsm_abs(a)
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* More prototypes from implementations..
|
||||
*/
|
||||
extern void Gsm_Coder P((
|
||||
struct gsm_state * S,
|
||||
word * s, /* [0..159] samples IN */
|
||||
word * LARc, /* [0..7] LAR coefficients OUT */
|
||||
word * Nc, /* [0..3] LTP lag OUT */
|
||||
word * bc, /* [0..3] coded LTP gain OUT */
|
||||
word * Mc, /* [0..3] RPE grid selection OUT */
|
||||
word * xmaxc,/* [0..3] Coded maximum amplitude OUT */
|
||||
word * xMc /* [13*4] normalized RPE samples OUT */));
|
||||
|
||||
extern void Gsm_Long_Term_Predictor P(( /* 4x for 160 samples */
|
||||
struct gsm_state * S,
|
||||
word * d, /* [0..39] residual signal IN */
|
||||
word * dp, /* [-120..-1] d' IN */
|
||||
word * e, /* [0..40] OUT */
|
||||
word * dpp, /* [0..40] OUT */
|
||||
word * Nc, /* correlation lag OUT */
|
||||
word * bc /* gain factor OUT */));
|
||||
|
||||
extern void Gsm_LPC_Analysis P((
|
||||
struct gsm_state * S,
|
||||
word * s, /* 0..159 signals IN/OUT */
|
||||
word * LARc)); /* 0..7 LARc's OUT */
|
||||
|
||||
extern void Gsm_Preprocess P((
|
||||
struct gsm_state * S,
|
||||
word * s, word * so));
|
||||
|
||||
extern void Gsm_Encoding P((
|
||||
struct gsm_state * S,
|
||||
word * e,
|
||||
word * ep,
|
||||
word * xmaxc,
|
||||
word * Mc,
|
||||
word * xMc));
|
||||
|
||||
extern void Gsm_Short_Term_Analysis_Filter P((
|
||||
struct gsm_state * S,
|
||||
word * LARc, /* coded log area ratio [0..7] IN */
|
||||
word * d /* st res. signal [0..159] IN/OUT */));
|
||||
|
||||
extern void Gsm_Decoder P((
|
||||
struct gsm_state * S,
|
||||
word * LARcr, /* [0..7] IN */
|
||||
word * Ncr, /* [0..3] IN */
|
||||
word * bcr, /* [0..3] IN */
|
||||
word * Mcr, /* [0..3] IN */
|
||||
word * xmaxcr, /* [0..3] IN */
|
||||
word * xMcr, /* [0..13*4] IN */
|
||||
word * s)); /* [0..159] OUT */
|
||||
|
||||
extern void Gsm_Decoding P((
|
||||
struct gsm_state * S,
|
||||
word xmaxcr,
|
||||
word Mcr,
|
||||
word * xMcr, /* [0..12] IN */
|
||||
word * erp)); /* [0..39] OUT */
|
||||
|
||||
extern void Gsm_Long_Term_Synthesis_Filtering P((
|
||||
struct gsm_state* S,
|
||||
word Ncr,
|
||||
word bcr,
|
||||
word * erp, /* [0..39] IN */
|
||||
word * drp)); /* [-120..-1] IN, [0..40] OUT */
|
||||
|
||||
void Gsm_RPE_Decoding P((
|
||||
struct gsm_state *S,
|
||||
word xmaxcr,
|
||||
word Mcr,
|
||||
word * xMcr, /* [0..12], 3 bits IN */
|
||||
word * erp)); /* [0..39] OUT */
|
||||
|
||||
void Gsm_RPE_Encoding P((
|
||||
struct gsm_state * S,
|
||||
word * e, /* -5..-1][0..39][40..44 IN/OUT */
|
||||
word * xmaxc, /* OUT */
|
||||
word * Mc, /* OUT */
|
||||
word * xMc)); /* [0..12] OUT */
|
||||
|
||||
extern void Gsm_Short_Term_Synthesis_Filter P((
|
||||
struct gsm_state * S,
|
||||
word * LARcr, /* log area ratios [0..7] IN */
|
||||
word * drp, /* received d [0...39] IN */
|
||||
word * s)); /* signal s [0..159] OUT */
|
||||
|
||||
extern void Gsm_Update_of_reconstructed_short_time_residual_signal P((
|
||||
word * dpp, /* [0...39] IN */
|
||||
word * ep, /* [0...39] IN */
|
||||
word * dp)); /* [-120...-1] IN/OUT */
|
||||
|
||||
/*
|
||||
* Tables from table.c
|
||||
*/
|
||||
#ifndef GSM_TABLE_C
|
||||
|
||||
extern word gsm_A[8], gsm_B[8], gsm_MIC[8], gsm_MAC[8];
|
||||
extern word gsm_INVA[8];
|
||||
extern word gsm_DLB[4], gsm_QLB[4];
|
||||
extern word gsm_H[11];
|
||||
extern word gsm_NRFAC[8];
|
||||
extern word gsm_FAC[8];
|
||||
|
||||
#endif /* GSM_TABLE_C */
|
||||
|
||||
/*
|
||||
* Debugging
|
||||
*/
|
||||
#ifdef NDEBUG
|
||||
|
||||
# define gsm_debug_words(a, b, c, d) /* nil */
|
||||
# define gsm_debug_longwords(a, b, c, d) /* nil */
|
||||
# define gsm_debug_word(a, b) /* nil */
|
||||
# define gsm_debug_longword(a, b) /* nil */
|
||||
|
||||
#else /* !NDEBUG => DEBUG */
|
||||
|
||||
extern void gsm_debug_words P((char * name, int, int, word *));
|
||||
extern void gsm_debug_longwords P((char * name, int, int, longword *));
|
||||
extern void gsm_debug_longword P((char * name, longword));
|
||||
extern void gsm_debug_word P((char * name, word));
|
||||
|
||||
#endif /* !NDEBUG */
|
||||
|
||||
#include "unproto.h"
|
||||
|
||||
#endif /* PRIVATE_H */
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* proto.h
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PROTO_H
|
||||
#define PROTO_H
|
||||
|
||||
#if __cplusplus
|
||||
# define NeedFunctionPrototypes 1
|
||||
#endif
|
||||
|
||||
#if __STDC__
|
||||
# define NeedFunctionPrototypes 1
|
||||
#endif
|
||||
|
||||
#ifdef _NO_PROTO
|
||||
# undef NeedFunctionPrototypes
|
||||
#endif
|
||||
|
||||
#undef P /* gnu stdio.h actually defines this... */
|
||||
#undef P0
|
||||
#undef P1
|
||||
#undef P2
|
||||
#undef P3
|
||||
#undef P4
|
||||
#undef P5
|
||||
#undef P6
|
||||
#undef P7
|
||||
#undef P8
|
||||
|
||||
#if NeedFunctionPrototypes
|
||||
|
||||
# define P( protos ) protos
|
||||
|
||||
# define P0() (void)
|
||||
# define P1(x, a) (a)
|
||||
# define P2(x, a, b) (a, b)
|
||||
# define P3(x, a, b, c) (a, b, c)
|
||||
# define P4(x, a, b, c, d) (a, b, c, d)
|
||||
# define P5(x, a, b, c, d, e) (a, b, c, d, e)
|
||||
# define P6(x, a, b, c, d, e, f) (a, b, c, d, e, f)
|
||||
# define P7(x, a, b, c, d, e, f, g) (a, b, c, d, e, f, g)
|
||||
# define P8(x, a, b, c, d, e, f, g, h) (a, b, c, d, e, f, g, h)
|
||||
|
||||
#else /* !NeedFunctionPrototypes */
|
||||
|
||||
# define P( protos ) ( /* protos */ )
|
||||
|
||||
# define P0() ()
|
||||
# define P1(x, a) x a;
|
||||
# define P2(x, a, b) x a; b;
|
||||
# define P3(x, a, b, c) x a; b; c;
|
||||
# define P4(x, a, b, c, d) x a; b; c; d;
|
||||
# define P5(x, a, b, c, d, e) x a; b; c; d; e;
|
||||
# define P6(x, a, b, c, d, e, f) x a; b; c; d; e; f;
|
||||
# define P7(x, a, b, c, d, e, f, g) x a; b; c; d; e; f; g;
|
||||
# define P8(x, a, b, c, d, e, f, g, h) x a; b; c; d; e; f; g; h;
|
||||
|
||||
#endif /* !NeedFunctionPrototypes */
|
||||
|
||||
#endif /* PROTO_H */
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* unproto.h
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef PROTO_H /* sic */
|
||||
#undef PROTO_H
|
||||
|
||||
#undef P
|
||||
#undef P0
|
||||
#undef P1
|
||||
#undef P2
|
||||
#undef P3
|
||||
#undef P4
|
||||
#undef P5
|
||||
#undef P6
|
||||
#undef P7
|
||||
#undef P8
|
||||
|
||||
#endif /* PROTO_H */
|
|
@ -1,238 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="libgsm"
|
||||
ProjectGUID="{8FD2E297-4096-47E5-9258-C48FF1841523}"
|
||||
RootNamespace="libgsm"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(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="inc"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4131;4100"
|
||||
/>
|
||||
<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="$(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="inc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4131;4100"
|
||||
/>
|
||||
<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\add.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\code.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\decode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\gsm_create.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\gsm_decode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\gsm_destroy.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\gsm_encode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\gsm_lpc.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\gsm_option.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\long_term.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\preprocess.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\rpe.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\short_term.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\table.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\inc\config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\inc\gsm.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\inc\private.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\inc\proto.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\inc\unproto.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,239 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="libgsm"
|
||||
ProjectGUID="{8FD2E297-4096-47E5-9258-C48FF1841523}"
|
||||
RootNamespace="libgsm"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(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="inc"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4131;4100"
|
||||
/>
|
||||
<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="$(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="inc"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4131;4100"
|
||||
/>
|
||||
<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\add.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\code.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\decode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\gsm_create.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\gsm_decode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\gsm_destroy.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\gsm_encode.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\gsm_lpc.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\gsm_option.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\long_term.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\preprocess.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\rpe.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\short_term.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\table.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\inc\config.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\inc\gsm.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\inc\private.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\inc\proto.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\inc\unproto.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,235 +0,0 @@
|
|||
/*
|
||||
* add.c
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* See private.h for the more commonly used macro versions.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "private.h"
|
||||
#include "gsm.h"
|
||||
#include "proto.h"
|
||||
|
||||
#define saturate(x) ((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
|
||||
|
||||
word gsm_add P2((a,b), word a, word b)
|
||||
{
|
||||
longword sum = (longword)a + (longword)b;
|
||||
return (word) saturate(sum);
|
||||
}
|
||||
|
||||
word gsm_sub P2((a,b), word a, word b)
|
||||
{
|
||||
longword diff = (longword)a - (longword)b;
|
||||
return (word) saturate(diff);
|
||||
}
|
||||
|
||||
word gsm_mult P2((a,b), word a, word b)
|
||||
{
|
||||
if (a == MIN_WORD && b == MIN_WORD) return MAX_WORD;
|
||||
else return (word) SASR( (longword)a * (longword)b, 15 );
|
||||
}
|
||||
|
||||
word gsm_mult_r P2((a,b), word a, word b)
|
||||
{
|
||||
if (b == MIN_WORD && a == MIN_WORD) return MAX_WORD;
|
||||
else {
|
||||
longword prod = (longword)a * (longword)b + 16384;
|
||||
prod >>= 15;
|
||||
return (word) (prod & 0xFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
word gsm_abs P1((a), word a)
|
||||
{
|
||||
return a < 0 ? (a == MIN_WORD ? MAX_WORD : -a) : a;
|
||||
}
|
||||
|
||||
longword gsm_L_mult P2((a,b),word a, word b)
|
||||
{
|
||||
assert( a != MIN_WORD || b != MIN_WORD );
|
||||
return ((longword)a * (longword)b) << 1;
|
||||
}
|
||||
|
||||
longword gsm_L_add P2((a,b), longword a, longword b)
|
||||
{
|
||||
if (a < 0) {
|
||||
if (b >= 0) return a + b;
|
||||
else {
|
||||
ulongword A = (ulongword)-(a + 1) + (ulongword)-(b + 1);
|
||||
return A >= MAX_LONGWORD ? MIN_LONGWORD :-(longword)A-2;
|
||||
}
|
||||
}
|
||||
else if (b <= 0) return a + b;
|
||||
else {
|
||||
ulongword A = (ulongword)a + (ulongword)b;
|
||||
return A > MAX_LONGWORD ? MAX_LONGWORD : A;
|
||||
}
|
||||
}
|
||||
|
||||
longword gsm_L_sub P2((a,b), longword a, longword b)
|
||||
{
|
||||
if (a >= 0) {
|
||||
if (b >= 0) return a - b;
|
||||
else {
|
||||
/* a>=0, b<0 */
|
||||
|
||||
ulongword A = (ulongword)a + -(b + 1);
|
||||
return A >= MAX_LONGWORD ? MAX_LONGWORD : (A + 1);
|
||||
}
|
||||
}
|
||||
else if (b <= 0) return a - b;
|
||||
else {
|
||||
/* a<0, b>0 */
|
||||
|
||||
ulongword A = (ulongword)-(a + 1) + b;
|
||||
return A >= MAX_LONGWORD ? MIN_LONGWORD : -(longword)A - 1;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned char const bitoff[ 256 ] = {
|
||||
8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
word gsm_norm P1((a), longword a )
|
||||
/*
|
||||
* the number of left shifts needed to normalize the 32 bit
|
||||
* variable L_var1 for positive values on the interval
|
||||
*
|
||||
* with minimum of
|
||||
* minimum of 1073741824 (01000000000000000000000000000000) and
|
||||
* maximum of 2147483647 (01111111111111111111111111111111)
|
||||
*
|
||||
*
|
||||
* and for negative values on the interval with
|
||||
* minimum of -2147483648 (-10000000000000000000000000000000) and
|
||||
* maximum of -1073741824 ( -1000000000000000000000000000000).
|
||||
*
|
||||
* in order to normalize the result, the following
|
||||
* operation must be done: L_norm_var1 = L_var1 << norm( L_var1 );
|
||||
*
|
||||
* (That's 'ffs', only from the left, not the right..)
|
||||
*/
|
||||
{
|
||||
assert(a != 0);
|
||||
|
||||
if (a < 0) {
|
||||
if (a <= -1073741824) return 0;
|
||||
a = ~a;
|
||||
}
|
||||
|
||||
return a & 0xffff0000
|
||||
? ( a & 0xff000000
|
||||
? -1 + bitoff[ 0xFF & (a >> 24) ]
|
||||
: 7 + bitoff[ 0xFF & (a >> 16) ] )
|
||||
: ( a & 0xff00
|
||||
? 15 + bitoff[ 0xFF & (a >> 8) ]
|
||||
: 23 + bitoff[ 0xFF & a ] );
|
||||
}
|
||||
|
||||
longword gsm_L_asl P2((a,n), longword a, int n)
|
||||
{
|
||||
if (n >= 32) return 0;
|
||||
if (n <= -32) return -(a < 0);
|
||||
if (n < 0) return gsm_L_asr(a, -n);
|
||||
return a << n;
|
||||
}
|
||||
|
||||
word gsm_asl P2((a,n), word a, int n)
|
||||
{
|
||||
if (n >= 16) return 0;
|
||||
if (n <= -16) return -(word)(a < 0);
|
||||
if (n < 0) return gsm_asr(a, -n);
|
||||
return (word)(a << n);
|
||||
}
|
||||
|
||||
longword gsm_L_asr P2((a,n), longword a, int n)
|
||||
{
|
||||
if (n >= 32) return -(a < 0);
|
||||
if (n <= -32) return 0;
|
||||
if (n < 0) return a << -n;
|
||||
|
||||
# ifdef SASR
|
||||
return a >> n;
|
||||
# else
|
||||
if (a >= 0) return a >> n;
|
||||
else return -(longword)( -(ulongword)a >> n );
|
||||
# endif
|
||||
}
|
||||
|
||||
word gsm_asr P2((a,n), word a, int n)
|
||||
{
|
||||
if (n >= 16) return -(word)(a < 0);
|
||||
if (n <= -16) return 0;
|
||||
if (n < 0) return (word)(a << -n);
|
||||
|
||||
# ifdef SASR
|
||||
return (word)(a >> n);
|
||||
# else
|
||||
if (a >= 0) return a >> n;
|
||||
else return -(word)( -(uword)a >> n );
|
||||
# endif
|
||||
}
|
||||
|
||||
/*
|
||||
* (From p. 46, end of section 4.2.5)
|
||||
*
|
||||
* NOTE: The following lines gives [sic] one correct implementation
|
||||
* of the div(num, denum) arithmetic operation. Compute div
|
||||
* which is the integer division of num by denum: with denum
|
||||
* >= num > 0
|
||||
*/
|
||||
|
||||
word gsm_div P2((num,denum), word num, word denum)
|
||||
{
|
||||
longword L_num = num;
|
||||
longword L_denum = denum;
|
||||
word div = 0;
|
||||
int k = 15;
|
||||
|
||||
/* The parameter num sometimes becomes zero.
|
||||
* Although this is explicitly guarded against in 4.2.5,
|
||||
* we assume that the result should then be zero as well.
|
||||
*/
|
||||
|
||||
/* assert(num != 0); */
|
||||
|
||||
assert(num >= 0 && denum >= num);
|
||||
if (num == 0)
|
||||
return 0;
|
||||
|
||||
while (k--) {
|
||||
div <<= 1;
|
||||
L_num <<= 1;
|
||||
|
||||
if (L_num >= L_denum) {
|
||||
L_num -= L_denum;
|
||||
div++;
|
||||
}
|
||||
}
|
||||
|
||||
return div;
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
* code.c
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAS_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
#include "proto.h"
|
||||
extern char * memcpy P((char *, char *, int));
|
||||
#endif
|
||||
|
||||
#include "private.h"
|
||||
#include "gsm.h"
|
||||
#include "proto.h"
|
||||
|
||||
/*
|
||||
* 4.2 FIXED POINT IMPLEMENTATION OF THE RPE-LTP CODER
|
||||
*/
|
||||
|
||||
void Gsm_Coder P8((S,s,LARc,Nc,bc,Mc,xmaxc,xMc),
|
||||
|
||||
struct gsm_state * S,
|
||||
|
||||
word * s, /* [0..159] samples IN */
|
||||
|
||||
/*
|
||||
* The RPE-LTD coder works on a frame by frame basis. The length of
|
||||
* the frame is equal to 160 samples. Some computations are done
|
||||
* once per frame to produce at the output of the coder the
|
||||
* LARc[1..8] parameters which are the coded LAR coefficients and
|
||||
* also to realize the inverse filtering operation for the entire
|
||||
* frame (160 samples of signal d[0..159]). These parts produce at
|
||||
* the output of the coder:
|
||||
*/
|
||||
|
||||
word * LARc, /* [0..7] LAR coefficients OUT */
|
||||
|
||||
/*
|
||||
* Procedure 4.2.11 to 4.2.18 are to be executed four times per
|
||||
* frame. That means once for each sub-segment RPE-LTP analysis of
|
||||
* 40 samples. These parts produce at the output of the coder:
|
||||
*/
|
||||
|
||||
word * Nc, /* [0..3] LTP lag OUT */
|
||||
word * bc, /* [0..3] coded LTP gain OUT */
|
||||
word * Mc, /* [0..3] RPE grid selection OUT */
|
||||
word * xmaxc,/* [0..3] Coded maximum amplitude OUT */
|
||||
word * xMc /* [13*4] normalized RPE samples OUT */
|
||||
)
|
||||
{
|
||||
int k;
|
||||
word * dp = S->dp0 + 120; /* [ -120...-1 ] */
|
||||
word * dpp = dp; /* [ 0...39 ] */
|
||||
|
||||
static word e[50];
|
||||
|
||||
word so[160];
|
||||
|
||||
Gsm_Preprocess (S, s, so);
|
||||
Gsm_LPC_Analysis (S, so, LARc);
|
||||
Gsm_Short_Term_Analysis_Filter (S, LARc, so);
|
||||
|
||||
for (k = 0; k <= 3; k++, xMc += 13) {
|
||||
|
||||
Gsm_Long_Term_Predictor ( S,
|
||||
so+k*40, /* d [0..39] IN */
|
||||
dp, /* dp [-120..-1] IN */
|
||||
e + 5, /* e [0..39] OUT */
|
||||
dpp, /* dpp [0..39] OUT */
|
||||
Nc++,
|
||||
bc++);
|
||||
|
||||
Gsm_RPE_Encoding ( S,
|
||||
e + 5, /* e ][0..39][ IN/OUT */
|
||||
xmaxc++, Mc++, xMc );
|
||||
/*
|
||||
* Gsm_Update_of_reconstructed_short_time_residual_signal
|
||||
* ( dpp, e + 5, dp );
|
||||
*/
|
||||
|
||||
{ register int i;
|
||||
register longword ltmp;
|
||||
for (i = 0; i <= 39; i++)
|
||||
dp[ i ] = (word) GSM_ADD( e[5 + i], dpp[i] );
|
||||
}
|
||||
dp += 40;
|
||||
dpp += 40;
|
||||
|
||||
}
|
||||
(void)memcpy( (char *)S->dp0, (char *)(S->dp0 + 160),
|
||||
120 * sizeof(*S->dp0) );
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* decode.c
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "private.h"
|
||||
#include "gsm.h"
|
||||
#include "proto.h"
|
||||
|
||||
/*
|
||||
* 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER
|
||||
*/
|
||||
|
||||
static void Postprocessing P2((S,s),
|
||||
struct gsm_state * S,
|
||||
register word * s)
|
||||
{
|
||||
register int k;
|
||||
register word msr = S->msr;
|
||||
register longword ltmp; /* for GSM_ADD */
|
||||
register word tmp;
|
||||
|
||||
for (k = 160; k--; s++) {
|
||||
tmp = (word) GSM_MULT_R( msr, 28180 );
|
||||
msr = (word) GSM_ADD(*s, tmp); /* Deemphasis */
|
||||
*s = (word) GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */
|
||||
}
|
||||
S->msr = msr;
|
||||
}
|
||||
|
||||
void Gsm_Decoder P8((S,LARcr, Ncr,bcr,Mcr,xmaxcr,xMcr,s),
|
||||
struct gsm_state * S,
|
||||
|
||||
word * LARcr, /* [0..7] IN */
|
||||
|
||||
word * Ncr, /* [0..3] IN */
|
||||
word * bcr, /* [0..3] IN */
|
||||
word * Mcr, /* [0..3] IN */
|
||||
word * xmaxcr, /* [0..3] IN */
|
||||
word * xMcr, /* [0..13*4] IN */
|
||||
|
||||
word * s) /* [0..159] OUT */
|
||||
{
|
||||
int j, k;
|
||||
word erp[40], wt[160];
|
||||
word * drp = S->dp0 + 120;
|
||||
|
||||
for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) {
|
||||
|
||||
Gsm_RPE_Decoding( S, *xmaxcr, *Mcr, xMcr, erp );
|
||||
Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp );
|
||||
|
||||
for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ];
|
||||
}
|
||||
|
||||
Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s );
|
||||
Postprocessing(S, s);
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* gsm_create.c
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAS_STRING_H
|
||||
#include <string.h>
|
||||
#else
|
||||
# include "proto.h"
|
||||
extern char * memset P((char *, int, int));
|
||||
#endif
|
||||
|
||||
#ifdef HAS_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# ifdef HAS_MALLOC_H
|
||||
# include <malloc.h>
|
||||
# else
|
||||
extern char * malloc();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gsm.h"
|
||||
#include "private.h"
|
||||
#include "proto.h"
|
||||
|
||||
gsm gsm_create P0()
|
||||
{
|
||||
gsm r;
|
||||
|
||||
r = (gsm)malloc(sizeof(struct gsm_state));
|
||||
if (!r) return r;
|
||||
|
||||
memset((char *)r, 0, sizeof(*r));
|
||||
r->nrp = 40;
|
||||
|
||||
return r;
|
||||
}
|
|
@ -1,362 +0,0 @@
|
|||
/*
|
||||
* gsm_decode.c
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "private.h"
|
||||
|
||||
#include "gsm.h"
|
||||
#include "proto.h"
|
||||
|
||||
int gsm_decode P3((s, c, target), gsm s, gsm_byte * c, gsm_signal * target)
|
||||
{
|
||||
word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4];
|
||||
|
||||
#ifdef WAV49
|
||||
if (s->wav_fmt) {
|
||||
|
||||
uword sr = 0;
|
||||
|
||||
s->frame_index = !s->frame_index;
|
||||
if (s->frame_index) {
|
||||
|
||||
sr = *c++;
|
||||
LARc[0] = sr & 0x3f; sr >>= 6;
|
||||
sr |= (uword)*c++ << 2;
|
||||
LARc[1] = sr & 0x3f; sr >>= 6;
|
||||
sr |= (uword)*c++ << 4;
|
||||
LARc[2] = sr & 0x1f; sr >>= 5;
|
||||
LARc[3] = sr & 0x1f; sr >>= 5;
|
||||
sr |= (uword)*c++ << 2;
|
||||
LARc[4] = sr & 0xf; sr >>= 4;
|
||||
LARc[5] = sr & 0xf; sr >>= 4;
|
||||
sr |= (uword)*c++ << 2; /* 5 */
|
||||
LARc[6] = sr & 0x7; sr >>= 3;
|
||||
LARc[7] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 4;
|
||||
Nc[0] = sr & 0x7f; sr >>= 7;
|
||||
bc[0] = sr & 0x3; sr >>= 2;
|
||||
Mc[0] = sr & 0x3; sr >>= 2;
|
||||
sr |= (uword)*c++ << 1;
|
||||
xmaxc[0] = sr & 0x3f; sr >>= 6;
|
||||
xmc[0] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++;
|
||||
xmc[1] = sr & 0x7; sr >>= 3;
|
||||
xmc[2] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 2;
|
||||
xmc[3] = sr & 0x7; sr >>= 3;
|
||||
xmc[4] = sr & 0x7; sr >>= 3;
|
||||
xmc[5] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 1; /* 10 */
|
||||
xmc[6] = sr & 0x7; sr >>= 3;
|
||||
xmc[7] = sr & 0x7; sr >>= 3;
|
||||
xmc[8] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++;
|
||||
xmc[9] = sr & 0x7; sr >>= 3;
|
||||
xmc[10] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 2;
|
||||
xmc[11] = sr & 0x7; sr >>= 3;
|
||||
xmc[12] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 4;
|
||||
Nc[1] = sr & 0x7f; sr >>= 7;
|
||||
bc[1] = sr & 0x3; sr >>= 2;
|
||||
Mc[1] = sr & 0x3; sr >>= 2;
|
||||
sr |= (uword)*c++ << 1;
|
||||
xmaxc[1] = sr & 0x3f; sr >>= 6;
|
||||
xmc[13] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++; /* 15 */
|
||||
xmc[14] = sr & 0x7; sr >>= 3;
|
||||
xmc[15] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 2;
|
||||
xmc[16] = sr & 0x7; sr >>= 3;
|
||||
xmc[17] = sr & 0x7; sr >>= 3;
|
||||
xmc[18] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 1;
|
||||
xmc[19] = sr & 0x7; sr >>= 3;
|
||||
xmc[20] = sr & 0x7; sr >>= 3;
|
||||
xmc[21] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++;
|
||||
xmc[22] = sr & 0x7; sr >>= 3;
|
||||
xmc[23] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 2;
|
||||
xmc[24] = sr & 0x7; sr >>= 3;
|
||||
xmc[25] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 4; /* 20 */
|
||||
Nc[2] = sr & 0x7f; sr >>= 7;
|
||||
bc[2] = sr & 0x3; sr >>= 2;
|
||||
Mc[2] = sr & 0x3; sr >>= 2;
|
||||
sr |= (uword)*c++ << 1;
|
||||
xmaxc[2] = sr & 0x3f; sr >>= 6;
|
||||
xmc[26] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++;
|
||||
xmc[27] = sr & 0x7; sr >>= 3;
|
||||
xmc[28] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 2;
|
||||
xmc[29] = sr & 0x7; sr >>= 3;
|
||||
xmc[30] = sr & 0x7; sr >>= 3;
|
||||
xmc[31] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 1;
|
||||
xmc[32] = sr & 0x7; sr >>= 3;
|
||||
xmc[33] = sr & 0x7; sr >>= 3;
|
||||
xmc[34] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++; /* 25 */
|
||||
xmc[35] = sr & 0x7; sr >>= 3;
|
||||
xmc[36] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 2;
|
||||
xmc[37] = sr & 0x7; sr >>= 3;
|
||||
xmc[38] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 4;
|
||||
Nc[3] = sr & 0x7f; sr >>= 7;
|
||||
bc[3] = sr & 0x3; sr >>= 2;
|
||||
Mc[3] = sr & 0x3; sr >>= 2;
|
||||
sr |= (uword)*c++ << 1;
|
||||
xmaxc[3] = sr & 0x3f; sr >>= 6;
|
||||
xmc[39] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++;
|
||||
xmc[40] = sr & 0x7; sr >>= 3;
|
||||
xmc[41] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 2; /* 30 */
|
||||
xmc[42] = sr & 0x7; sr >>= 3;
|
||||
xmc[43] = sr & 0x7; sr >>= 3;
|
||||
xmc[44] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 1;
|
||||
xmc[45] = sr & 0x7; sr >>= 3;
|
||||
xmc[46] = sr & 0x7; sr >>= 3;
|
||||
xmc[47] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++;
|
||||
xmc[48] = sr & 0x7; sr >>= 3;
|
||||
xmc[49] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 2;
|
||||
xmc[50] = sr & 0x7; sr >>= 3;
|
||||
xmc[51] = sr & 0x7; sr >>= 3;
|
||||
|
||||
s->frame_chain = sr & 0xf;
|
||||
}
|
||||
else {
|
||||
sr = s->frame_chain;
|
||||
sr |= (uword)*c++ << 4; /* 1 */
|
||||
LARc[0] = sr & 0x3f; sr >>= 6;
|
||||
LARc[1] = sr & 0x3f; sr >>= 6;
|
||||
sr = *c++;
|
||||
LARc[2] = sr & 0x1f; sr >>= 5;
|
||||
sr |= (uword)*c++ << 3;
|
||||
LARc[3] = sr & 0x1f; sr >>= 5;
|
||||
LARc[4] = sr & 0xf; sr >>= 4;
|
||||
sr |= (uword)*c++ << 2;
|
||||
LARc[5] = sr & 0xf; sr >>= 4;
|
||||
LARc[6] = sr & 0x7; sr >>= 3;
|
||||
LARc[7] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++; /* 5 */
|
||||
Nc[0] = sr & 0x7f; sr >>= 7;
|
||||
sr |= (uword)*c++ << 1;
|
||||
bc[0] = sr & 0x3; sr >>= 2;
|
||||
Mc[0] = sr & 0x3; sr >>= 2;
|
||||
sr |= (uword)*c++ << 5;
|
||||
xmaxc[0] = sr & 0x3f; sr >>= 6;
|
||||
xmc[0] = sr & 0x7; sr >>= 3;
|
||||
xmc[1] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 1;
|
||||
xmc[2] = sr & 0x7; sr >>= 3;
|
||||
xmc[3] = sr & 0x7; sr >>= 3;
|
||||
xmc[4] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++;
|
||||
xmc[5] = sr & 0x7; sr >>= 3;
|
||||
xmc[6] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 2; /* 10 */
|
||||
xmc[7] = sr & 0x7; sr >>= 3;
|
||||
xmc[8] = sr & 0x7; sr >>= 3;
|
||||
xmc[9] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 1;
|
||||
xmc[10] = sr & 0x7; sr >>= 3;
|
||||
xmc[11] = sr & 0x7; sr >>= 3;
|
||||
xmc[12] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++;
|
||||
Nc[1] = sr & 0x7f; sr >>= 7;
|
||||
sr |= (uword)*c++ << 1;
|
||||
bc[1] = sr & 0x3; sr >>= 2;
|
||||
Mc[1] = sr & 0x3; sr >>= 2;
|
||||
sr |= (uword)*c++ << 5;
|
||||
xmaxc[1] = sr & 0x3f; sr >>= 6;
|
||||
xmc[13] = sr & 0x7; sr >>= 3;
|
||||
xmc[14] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 1; /* 15 */
|
||||
xmc[15] = sr & 0x7; sr >>= 3;
|
||||
xmc[16] = sr & 0x7; sr >>= 3;
|
||||
xmc[17] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++;
|
||||
xmc[18] = sr & 0x7; sr >>= 3;
|
||||
xmc[19] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 2;
|
||||
xmc[20] = sr & 0x7; sr >>= 3;
|
||||
xmc[21] = sr & 0x7; sr >>= 3;
|
||||
xmc[22] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 1;
|
||||
xmc[23] = sr & 0x7; sr >>= 3;
|
||||
xmc[24] = sr & 0x7; sr >>= 3;
|
||||
xmc[25] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++;
|
||||
Nc[2] = sr & 0x7f; sr >>= 7;
|
||||
sr |= (uword)*c++ << 1; /* 20 */
|
||||
bc[2] = sr & 0x3; sr >>= 2;
|
||||
Mc[2] = sr & 0x3; sr >>= 2;
|
||||
sr |= (uword)*c++ << 5;
|
||||
xmaxc[2] = sr & 0x3f; sr >>= 6;
|
||||
xmc[26] = sr & 0x7; sr >>= 3;
|
||||
xmc[27] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 1;
|
||||
xmc[28] = sr & 0x7; sr >>= 3;
|
||||
xmc[29] = sr & 0x7; sr >>= 3;
|
||||
xmc[30] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++;
|
||||
xmc[31] = sr & 0x7; sr >>= 3;
|
||||
xmc[32] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 2;
|
||||
xmc[33] = sr & 0x7; sr >>= 3;
|
||||
xmc[34] = sr & 0x7; sr >>= 3;
|
||||
xmc[35] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 1; /* 25 */
|
||||
xmc[36] = sr & 0x7; sr >>= 3;
|
||||
xmc[37] = sr & 0x7; sr >>= 3;
|
||||
xmc[38] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++;
|
||||
Nc[3] = sr & 0x7f; sr >>= 7;
|
||||
sr |= (uword)*c++ << 1;
|
||||
bc[3] = sr & 0x3; sr >>= 2;
|
||||
Mc[3] = sr & 0x3; sr >>= 2;
|
||||
sr |= (uword)*c++ << 5;
|
||||
xmaxc[3] = sr & 0x3f; sr >>= 6;
|
||||
xmc[39] = sr & 0x7; sr >>= 3;
|
||||
xmc[40] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 1;
|
||||
xmc[41] = sr & 0x7; sr >>= 3;
|
||||
xmc[42] = sr & 0x7; sr >>= 3;
|
||||
xmc[43] = sr & 0x7; sr >>= 3;
|
||||
sr = *c++; /* 30 */
|
||||
xmc[44] = sr & 0x7; sr >>= 3;
|
||||
xmc[45] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 2;
|
||||
xmc[46] = sr & 0x7; sr >>= 3;
|
||||
xmc[47] = sr & 0x7; sr >>= 3;
|
||||
xmc[48] = sr & 0x7; sr >>= 3;
|
||||
sr |= (uword)*c++ << 1;
|
||||
xmc[49] = sr & 0x7; sr >>= 3;
|
||||
xmc[50] = sr & 0x7; sr >>= 3;
|
||||
xmc[51] = sr & 0x7; sr >>= 3;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* GSM_MAGIC = (*c >> 4) & 0xF; */
|
||||
|
||||
if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1;
|
||||
|
||||
LARc[0] = (*c++ & 0xF) << 2; /* 1 */
|
||||
LARc[0] |= (*c >> 6) & 0x3;
|
||||
LARc[1] = *c++ & 0x3F;
|
||||
LARc[2] = (*c >> 3) & 0x1F;
|
||||
LARc[3] = (*c++ & 0x7) << 2;
|
||||
LARc[3] |= (*c >> 6) & 0x3;
|
||||
LARc[4] = (*c >> 2) & 0xF;
|
||||
LARc[5] = (*c++ & 0x3) << 2;
|
||||
LARc[5] |= (*c >> 6) & 0x3;
|
||||
LARc[6] = (*c >> 3) & 0x7;
|
||||
LARc[7] = *c++ & 0x7;
|
||||
Nc[0] = (*c >> 1) & 0x7F;
|
||||
bc[0] = (*c++ & 0x1) << 1;
|
||||
bc[0] |= (*c >> 7) & 0x1;
|
||||
Mc[0] = (*c >> 5) & 0x3;
|
||||
xmaxc[0] = (*c++ & 0x1F) << 1;
|
||||
xmaxc[0] |= (*c >> 7) & 0x1;
|
||||
xmc[0] = (*c >> 4) & 0x7;
|
||||
xmc[1] = (*c >> 1) & 0x7;
|
||||
xmc[2] = (*c++ & 0x1) << 2;
|
||||
xmc[2] |= (*c >> 6) & 0x3;
|
||||
xmc[3] = (*c >> 3) & 0x7;
|
||||
xmc[4] = *c++ & 0x7;
|
||||
xmc[5] = (*c >> 5) & 0x7;
|
||||
xmc[6] = (*c >> 2) & 0x7;
|
||||
xmc[7] = (*c++ & 0x3) << 1; /* 10 */
|
||||
xmc[7] |= (*c >> 7) & 0x1;
|
||||
xmc[8] = (*c >> 4) & 0x7;
|
||||
xmc[9] = (*c >> 1) & 0x7;
|
||||
xmc[10] = (*c++ & 0x1) << 2;
|
||||
xmc[10] |= (*c >> 6) & 0x3;
|
||||
xmc[11] = (*c >> 3) & 0x7;
|
||||
xmc[12] = *c++ & 0x7;
|
||||
Nc[1] = (*c >> 1) & 0x7F;
|
||||
bc[1] = (*c++ & 0x1) << 1;
|
||||
bc[1] |= (*c >> 7) & 0x1;
|
||||
Mc[1] = (*c >> 5) & 0x3;
|
||||
xmaxc[1] = (*c++ & 0x1F) << 1;
|
||||
xmaxc[1] |= (*c >> 7) & 0x1;
|
||||
xmc[13] = (*c >> 4) & 0x7;
|
||||
xmc[14] = (*c >> 1) & 0x7;
|
||||
xmc[15] = (*c++ & 0x1) << 2;
|
||||
xmc[15] |= (*c >> 6) & 0x3;
|
||||
xmc[16] = (*c >> 3) & 0x7;
|
||||
xmc[17] = *c++ & 0x7;
|
||||
xmc[18] = (*c >> 5) & 0x7;
|
||||
xmc[19] = (*c >> 2) & 0x7;
|
||||
xmc[20] = (*c++ & 0x3) << 1;
|
||||
xmc[20] |= (*c >> 7) & 0x1;
|
||||
xmc[21] = (*c >> 4) & 0x7;
|
||||
xmc[22] = (*c >> 1) & 0x7;
|
||||
xmc[23] = (*c++ & 0x1) << 2;
|
||||
xmc[23] |= (*c >> 6) & 0x3;
|
||||
xmc[24] = (*c >> 3) & 0x7;
|
||||
xmc[25] = *c++ & 0x7;
|
||||
Nc[2] = (*c >> 1) & 0x7F;
|
||||
bc[2] = (*c++ & 0x1) << 1; /* 20 */
|
||||
bc[2] |= (*c >> 7) & 0x1;
|
||||
Mc[2] = (*c >> 5) & 0x3;
|
||||
xmaxc[2] = (*c++ & 0x1F) << 1;
|
||||
xmaxc[2] |= (*c >> 7) & 0x1;
|
||||
xmc[26] = (*c >> 4) & 0x7;
|
||||
xmc[27] = (*c >> 1) & 0x7;
|
||||
xmc[28] = (*c++ & 0x1) << 2;
|
||||
xmc[28] |= (*c >> 6) & 0x3;
|
||||
xmc[29] = (*c >> 3) & 0x7;
|
||||
xmc[30] = *c++ & 0x7;
|
||||
xmc[31] = (*c >> 5) & 0x7;
|
||||
xmc[32] = (*c >> 2) & 0x7;
|
||||
xmc[33] = (*c++ & 0x3) << 1;
|
||||
xmc[33] |= (*c >> 7) & 0x1;
|
||||
xmc[34] = (*c >> 4) & 0x7;
|
||||
xmc[35] = (*c >> 1) & 0x7;
|
||||
xmc[36] = (*c++ & 0x1) << 2;
|
||||
xmc[36] |= (*c >> 6) & 0x3;
|
||||
xmc[37] = (*c >> 3) & 0x7;
|
||||
xmc[38] = *c++ & 0x7;
|
||||
Nc[3] = (*c >> 1) & 0x7F;
|
||||
bc[3] = (*c++ & 0x1) << 1;
|
||||
bc[3] |= (*c >> 7) & 0x1;
|
||||
Mc[3] = (*c >> 5) & 0x3;
|
||||
xmaxc[3] = (*c++ & 0x1F) << 1;
|
||||
xmaxc[3] |= (*c >> 7) & 0x1;
|
||||
xmc[39] = (*c >> 4) & 0x7;
|
||||
xmc[40] = (*c >> 1) & 0x7;
|
||||
xmc[41] = (*c++ & 0x1) << 2;
|
||||
xmc[41] |= (*c >> 6) & 0x3;
|
||||
xmc[42] = (*c >> 3) & 0x7;
|
||||
xmc[43] = *c++ & 0x7; /* 30 */
|
||||
xmc[44] = (*c >> 5) & 0x7;
|
||||
xmc[45] = (*c >> 2) & 0x7;
|
||||
xmc[46] = (*c++ & 0x3) << 1;
|
||||
xmc[46] |= (*c >> 7) & 0x1;
|
||||
xmc[47] = (*c >> 4) & 0x7;
|
||||
xmc[48] = (*c >> 1) & 0x7;
|
||||
xmc[49] = (*c++ & 0x1) << 2;
|
||||
xmc[49] |= (*c >> 6) & 0x3;
|
||||
xmc[50] = (*c >> 3) & 0x7;
|
||||
xmc[51] = *c & 0x7; /* 33 */
|
||||
}
|
||||
|
||||
Gsm_Decoder(s, LARc, Nc, bc, Mc, xmaxc, xmc, target);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* gsm_destroy.c
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "gsm.h"
|
||||
#include "config.h"
|
||||
#include "proto.h"
|
||||
|
||||
#ifdef HAS_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# ifdef HAS_MALLOC_H
|
||||
# include <malloc.h>
|
||||
# else
|
||||
extern void free();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
void gsm_destroy P1((S), gsm S)
|
||||
{
|
||||
if (S) free((char *)S);
|
||||
}
|
|
@ -1,452 +0,0 @@
|
|||
/*
|
||||
* gsm_encode.c
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "private.h"
|
||||
#include "gsm.h"
|
||||
#include "proto.h"
|
||||
|
||||
void gsm_encode P3((s, source, c), gsm s, gsm_signal * source, gsm_byte * c)
|
||||
{
|
||||
word LARc[8], Nc[4], Mc[4], bc[4], xmaxc[4], xmc[13*4];
|
||||
|
||||
Gsm_Coder(s, source, LARc, Nc, bc, Mc, xmaxc, xmc);
|
||||
|
||||
|
||||
/* variable size
|
||||
|
||||
GSM_MAGIC 4
|
||||
|
||||
LARc[0] 6
|
||||
LARc[1] 6
|
||||
LARc[2] 5
|
||||
LARc[3] 5
|
||||
LARc[4] 4
|
||||
LARc[5] 4
|
||||
LARc[6] 3
|
||||
LARc[7] 3
|
||||
|
||||
Nc[0] 7
|
||||
bc[0] 2
|
||||
Mc[0] 2
|
||||
xmaxc[0] 6
|
||||
xmc[0] 3
|
||||
xmc[1] 3
|
||||
xmc[2] 3
|
||||
xmc[3] 3
|
||||
xmc[4] 3
|
||||
xmc[5] 3
|
||||
xmc[6] 3
|
||||
xmc[7] 3
|
||||
xmc[8] 3
|
||||
xmc[9] 3
|
||||
xmc[10] 3
|
||||
xmc[11] 3
|
||||
xmc[12] 3
|
||||
|
||||
Nc[1] 7
|
||||
bc[1] 2
|
||||
Mc[1] 2
|
||||
xmaxc[1] 6
|
||||
xmc[13] 3
|
||||
xmc[14] 3
|
||||
xmc[15] 3
|
||||
xmc[16] 3
|
||||
xmc[17] 3
|
||||
xmc[18] 3
|
||||
xmc[19] 3
|
||||
xmc[20] 3
|
||||
xmc[21] 3
|
||||
xmc[22] 3
|
||||
xmc[23] 3
|
||||
xmc[24] 3
|
||||
xmc[25] 3
|
||||
|
||||
Nc[2] 7
|
||||
bc[2] 2
|
||||
Mc[2] 2
|
||||
xmaxc[2] 6
|
||||
xmc[26] 3
|
||||
xmc[27] 3
|
||||
xmc[28] 3
|
||||
xmc[29] 3
|
||||
xmc[30] 3
|
||||
xmc[31] 3
|
||||
xmc[32] 3
|
||||
xmc[33] 3
|
||||
xmc[34] 3
|
||||
xmc[35] 3
|
||||
xmc[36] 3
|
||||
xmc[37] 3
|
||||
xmc[38] 3
|
||||
|
||||
Nc[3] 7
|
||||
bc[3] 2
|
||||
Mc[3] 2
|
||||
xmaxc[3] 6
|
||||
xmc[39] 3
|
||||
xmc[40] 3
|
||||
xmc[41] 3
|
||||
xmc[42] 3
|
||||
xmc[43] 3
|
||||
xmc[44] 3
|
||||
xmc[45] 3
|
||||
xmc[46] 3
|
||||
xmc[47] 3
|
||||
xmc[48] 3
|
||||
xmc[49] 3
|
||||
xmc[50] 3
|
||||
xmc[51] 3
|
||||
*/
|
||||
|
||||
#ifdef WAV49
|
||||
|
||||
if (s->wav_fmt) {
|
||||
s->frame_index = !s->frame_index;
|
||||
if (s->frame_index) {
|
||||
|
||||
uword sr;
|
||||
|
||||
sr = 0;
|
||||
sr = sr >> 6 | LARc[0] << 10;
|
||||
sr = sr >> 6 | LARc[1] << 10;
|
||||
*c++ = sr >> 4;
|
||||
sr = sr >> 5 | LARc[2] << 11;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 5 | LARc[3] << 11;
|
||||
sr = sr >> 4 | LARc[4] << 12;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 4 | LARc[5] << 12;
|
||||
sr = sr >> 3 | LARc[6] << 13;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | LARc[7] << 13;
|
||||
sr = sr >> 7 | Nc[0] << 9;
|
||||
*c++ = sr >> 5;
|
||||
sr = sr >> 2 | bc[0] << 14;
|
||||
sr = sr >> 2 | Mc[0] << 14;
|
||||
sr = sr >> 6 | xmaxc[0] << 10;
|
||||
*c++ = sr >> 3;
|
||||
sr = sr >> 3 | xmc[0] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 3 | xmc[1] << 13;
|
||||
sr = sr >> 3 | xmc[2] << 13;
|
||||
sr = sr >> 3 | xmc[3] << 13;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[4] << 13;
|
||||
sr = sr >> 3 | xmc[5] << 13;
|
||||
sr = sr >> 3 | xmc[6] << 13;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 3 | xmc[7] << 13;
|
||||
sr = sr >> 3 | xmc[8] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 3 | xmc[9] << 13;
|
||||
sr = sr >> 3 | xmc[10] << 13;
|
||||
sr = sr >> 3 | xmc[11] << 13;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[12] << 13;
|
||||
sr = sr >> 7 | Nc[1] << 9;
|
||||
*c++ = sr >> 5;
|
||||
sr = sr >> 2 | bc[1] << 14;
|
||||
sr = sr >> 2 | Mc[1] << 14;
|
||||
sr = sr >> 6 | xmaxc[1] << 10;
|
||||
*c++ = sr >> 3;
|
||||
sr = sr >> 3 | xmc[13] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 3 | xmc[14] << 13;
|
||||
sr = sr >> 3 | xmc[15] << 13;
|
||||
sr = sr >> 3 | xmc[16] << 13;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[17] << 13;
|
||||
sr = sr >> 3 | xmc[18] << 13;
|
||||
sr = sr >> 3 | xmc[19] << 13;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 3 | xmc[20] << 13;
|
||||
sr = sr >> 3 | xmc[21] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 3 | xmc[22] << 13;
|
||||
sr = sr >> 3 | xmc[23] << 13;
|
||||
sr = sr >> 3 | xmc[24] << 13;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[25] << 13;
|
||||
sr = sr >> 7 | Nc[2] << 9;
|
||||
*c++ = sr >> 5;
|
||||
sr = sr >> 2 | bc[2] << 14;
|
||||
sr = sr >> 2 | Mc[2] << 14;
|
||||
sr = sr >> 6 | xmaxc[2] << 10;
|
||||
*c++ = sr >> 3;
|
||||
sr = sr >> 3 | xmc[26] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 3 | xmc[27] << 13;
|
||||
sr = sr >> 3 | xmc[28] << 13;
|
||||
sr = sr >> 3 | xmc[29] << 13;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[30] << 13;
|
||||
sr = sr >> 3 | xmc[31] << 13;
|
||||
sr = sr >> 3 | xmc[32] << 13;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 3 | xmc[33] << 13;
|
||||
sr = sr >> 3 | xmc[34] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 3 | xmc[35] << 13;
|
||||
sr = sr >> 3 | xmc[36] << 13;
|
||||
sr = sr >> 3 | xmc[37] << 13;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[38] << 13;
|
||||
sr = sr >> 7 | Nc[3] << 9;
|
||||
*c++ = sr >> 5;
|
||||
sr = sr >> 2 | bc[3] << 14;
|
||||
sr = sr >> 2 | Mc[3] << 14;
|
||||
sr = sr >> 6 | xmaxc[3] << 10;
|
||||
*c++ = sr >> 3;
|
||||
sr = sr >> 3 | xmc[39] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 3 | xmc[40] << 13;
|
||||
sr = sr >> 3 | xmc[41] << 13;
|
||||
sr = sr >> 3 | xmc[42] << 13;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[43] << 13;
|
||||
sr = sr >> 3 | xmc[44] << 13;
|
||||
sr = sr >> 3 | xmc[45] << 13;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 3 | xmc[46] << 13;
|
||||
sr = sr >> 3 | xmc[47] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 3 | xmc[48] << 13;
|
||||
sr = sr >> 3 | xmc[49] << 13;
|
||||
sr = sr >> 3 | xmc[50] << 13;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[51] << 13;
|
||||
sr = sr >> 4;
|
||||
*c = sr >> 8;
|
||||
s->frame_chain = *c;
|
||||
}
|
||||
else {
|
||||
uword sr;
|
||||
|
||||
sr = 0;
|
||||
sr = sr >> 4 | s->frame_chain << 12;
|
||||
sr = sr >> 6 | LARc[0] << 10;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 6 | LARc[1] << 10;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 5 | LARc[2] << 11;
|
||||
sr = sr >> 5 | LARc[3] << 11;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 4 | LARc[4] << 12;
|
||||
sr = sr >> 4 | LARc[5] << 12;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 3 | LARc[6] << 13;
|
||||
sr = sr >> 3 | LARc[7] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 7 | Nc[0] << 9;
|
||||
sr = sr >> 2 | bc[0] << 14;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 2 | Mc[0] << 14;
|
||||
sr = sr >> 6 | xmaxc[0] << 10;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[0] << 13;
|
||||
sr = sr >> 3 | xmc[1] << 13;
|
||||
sr = sr >> 3 | xmc[2] << 13;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 3 | xmc[3] << 13;
|
||||
sr = sr >> 3 | xmc[4] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 3 | xmc[5] << 13;
|
||||
sr = sr >> 3 | xmc[6] << 13;
|
||||
sr = sr >> 3 | xmc[7] << 13;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[8] << 13;
|
||||
sr = sr >> 3 | xmc[9] << 13;
|
||||
sr = sr >> 3 | xmc[10] << 13;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 3 | xmc[11] << 13;
|
||||
sr = sr >> 3 | xmc[12] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 7 | Nc[1] << 9;
|
||||
sr = sr >> 2 | bc[1] << 14;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 2 | Mc[1] << 14;
|
||||
sr = sr >> 6 | xmaxc[1] << 10;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[13] << 13;
|
||||
sr = sr >> 3 | xmc[14] << 13;
|
||||
sr = sr >> 3 | xmc[15] << 13;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 3 | xmc[16] << 13;
|
||||
sr = sr >> 3 | xmc[17] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 3 | xmc[18] << 13;
|
||||
sr = sr >> 3 | xmc[19] << 13;
|
||||
sr = sr >> 3 | xmc[20] << 13;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[21] << 13;
|
||||
sr = sr >> 3 | xmc[22] << 13;
|
||||
sr = sr >> 3 | xmc[23] << 13;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 3 | xmc[24] << 13;
|
||||
sr = sr >> 3 | xmc[25] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 7 | Nc[2] << 9;
|
||||
sr = sr >> 2 | bc[2] << 14;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 2 | Mc[2] << 14;
|
||||
sr = sr >> 6 | xmaxc[2] << 10;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[26] << 13;
|
||||
sr = sr >> 3 | xmc[27] << 13;
|
||||
sr = sr >> 3 | xmc[28] << 13;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 3 | xmc[29] << 13;
|
||||
sr = sr >> 3 | xmc[30] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 3 | xmc[31] << 13;
|
||||
sr = sr >> 3 | xmc[32] << 13;
|
||||
sr = sr >> 3 | xmc[33] << 13;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[34] << 13;
|
||||
sr = sr >> 3 | xmc[35] << 13;
|
||||
sr = sr >> 3 | xmc[36] << 13;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 3 | xmc[37] << 13;
|
||||
sr = sr >> 3 | xmc[38] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 7 | Nc[3] << 9;
|
||||
sr = sr >> 2 | bc[3] << 14;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 2 | Mc[3] << 14;
|
||||
sr = sr >> 6 | xmaxc[3] << 10;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[39] << 13;
|
||||
sr = sr >> 3 | xmc[40] << 13;
|
||||
sr = sr >> 3 | xmc[41] << 13;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 3 | xmc[42] << 13;
|
||||
sr = sr >> 3 | xmc[43] << 13;
|
||||
*c++ = sr >> 8;
|
||||
sr = sr >> 3 | xmc[44] << 13;
|
||||
sr = sr >> 3 | xmc[45] << 13;
|
||||
sr = sr >> 3 | xmc[46] << 13;
|
||||
*c++ = sr >> 7;
|
||||
sr = sr >> 3 | xmc[47] << 13;
|
||||
sr = sr >> 3 | xmc[48] << 13;
|
||||
sr = sr >> 3 | xmc[49] << 13;
|
||||
*c++ = sr >> 6;
|
||||
sr = sr >> 3 | xmc[50] << 13;
|
||||
sr = sr >> 3 | xmc[51] << 13;
|
||||
*c++ = sr >> 8;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
#endif /* WAV49 */
|
||||
{
|
||||
|
||||
*c++ = (gsm_byte)(((GSM_MAGIC & 0xF) << 4) /* 1 */
|
||||
| ((LARc[0] >> 2) & 0xF));
|
||||
*c++ = (gsm_byte)(((LARc[0] & 0x3) << 6)
|
||||
| (LARc[1] & 0x3F));
|
||||
*c++ = (gsm_byte)(((LARc[2] & 0x1F) << 3)
|
||||
| ((LARc[3] >> 2) & 0x7));
|
||||
*c++ = (gsm_byte)(((LARc[3] & 0x3) << 6)
|
||||
| ((LARc[4] & 0xF) << 2)
|
||||
| ((LARc[5] >> 2) & 0x3));
|
||||
*c++ = (gsm_byte)(((LARc[5] & 0x3) << 6)
|
||||
| ((LARc[6] & 0x7) << 3)
|
||||
| (LARc[7] & 0x7));
|
||||
*c++ = (gsm_byte)(((Nc[0] & 0x7F) << 1)
|
||||
| ((bc[0] >> 1) & 0x1));
|
||||
*c++ = (gsm_byte)(((bc[0] & 0x1) << 7)
|
||||
| ((Mc[0] & 0x3) << 5)
|
||||
| ((xmaxc[0] >> 1) & 0x1F));
|
||||
*c++ = (gsm_byte)(((xmaxc[0] & 0x1) << 7)
|
||||
| ((xmc[0] & 0x7) << 4)
|
||||
| ((xmc[1] & 0x7) << 1)
|
||||
| ((xmc[2] >> 2) & 0x1));
|
||||
*c++ = (gsm_byte)(((xmc[2] & 0x3) << 6)
|
||||
| ((xmc[3] & 0x7) << 3)
|
||||
| (xmc[4] & 0x7));
|
||||
*c++ = (gsm_byte)(((xmc[5] & 0x7) << 5) /* 10 */
|
||||
| ((xmc[6] & 0x7) << 2)
|
||||
| ((xmc[7] >> 1) & 0x3));
|
||||
*c++ = (gsm_byte)(((xmc[7] & 0x1) << 7)
|
||||
| ((xmc[8] & 0x7) << 4)
|
||||
| ((xmc[9] & 0x7) << 1)
|
||||
| ((xmc[10] >> 2) & 0x1));
|
||||
*c++ = (gsm_byte)(((xmc[10] & 0x3) << 6)
|
||||
| ((xmc[11] & 0x7) << 3)
|
||||
| (xmc[12] & 0x7));
|
||||
*c++ = (gsm_byte)(((Nc[1] & 0x7F) << 1)
|
||||
| ((bc[1] >> 1) & 0x1));
|
||||
*c++ = (gsm_byte)(((bc[1] & 0x1) << 7)
|
||||
| ((Mc[1] & 0x3) << 5)
|
||||
| ((xmaxc[1] >> 1) & 0x1F));
|
||||
*c++ = (gsm_byte)(((xmaxc[1] & 0x1) << 7)
|
||||
| ((xmc[13] & 0x7) << 4)
|
||||
| ((xmc[14] & 0x7) << 1)
|
||||
| ((xmc[15] >> 2) & 0x1));
|
||||
*c++ = (gsm_byte)(((xmc[15] & 0x3) << 6)
|
||||
| ((xmc[16] & 0x7) << 3)
|
||||
| (xmc[17] & 0x7));
|
||||
*c++ = (gsm_byte)(((xmc[18] & 0x7) << 5)
|
||||
| ((xmc[19] & 0x7) << 2)
|
||||
| ((xmc[20] >> 1) & 0x3));
|
||||
*c++ = (gsm_byte)(((xmc[20] & 0x1) << 7)
|
||||
| ((xmc[21] & 0x7) << 4)
|
||||
| ((xmc[22] & 0x7) << 1)
|
||||
| ((xmc[23] >> 2) & 0x1));
|
||||
*c++ = (gsm_byte)(((xmc[23] & 0x3) << 6)
|
||||
| ((xmc[24] & 0x7) << 3)
|
||||
| (xmc[25] & 0x7));
|
||||
*c++ = (gsm_byte)(((Nc[2] & 0x7F) << 1) /* 20 */
|
||||
| ((bc[2] >> 1) & 0x1));
|
||||
*c++ = (gsm_byte)(((bc[2] & 0x1) << 7)
|
||||
| ((Mc[2] & 0x3) << 5)
|
||||
| ((xmaxc[2] >> 1) & 0x1F));
|
||||
*c++ = (gsm_byte)(((xmaxc[2] & 0x1) << 7)
|
||||
| ((xmc[26] & 0x7) << 4)
|
||||
| ((xmc[27] & 0x7) << 1)
|
||||
| ((xmc[28] >> 2) & 0x1));
|
||||
*c++ = (gsm_byte)(((xmc[28] & 0x3) << 6)
|
||||
| ((xmc[29] & 0x7) << 3)
|
||||
| (xmc[30] & 0x7));
|
||||
*c++ = (gsm_byte)(((xmc[31] & 0x7) << 5)
|
||||
| ((xmc[32] & 0x7) << 2)
|
||||
| ((xmc[33] >> 1) & 0x3));
|
||||
*c++ = (gsm_byte)(((xmc[33] & 0x1) << 7)
|
||||
| ((xmc[34] & 0x7) << 4)
|
||||
| ((xmc[35] & 0x7) << 1)
|
||||
| ((xmc[36] >> 2) & 0x1));
|
||||
*c++ = (gsm_byte)(((xmc[36] & 0x3) << 6)
|
||||
| ((xmc[37] & 0x7) << 3)
|
||||
| (xmc[38] & 0x7));
|
||||
*c++ = (gsm_byte)(((Nc[3] & 0x7F) << 1)
|
||||
| ((bc[3] >> 1) & 0x1));
|
||||
*c++ = (gsm_byte)(((bc[3] & 0x1) << 7)
|
||||
| ((Mc[3] & 0x3) << 5)
|
||||
| ((xmaxc[3] >> 1) & 0x1F));
|
||||
*c++ = (gsm_byte)(((xmaxc[3] & 0x1) << 7)
|
||||
| ((xmc[39] & 0x7) << 4)
|
||||
| ((xmc[40] & 0x7) << 1)
|
||||
| ((xmc[41] >> 2) & 0x1));
|
||||
*c++ = (gsm_byte)(((xmc[41] & 0x3) << 6) /* 30 */
|
||||
| ((xmc[42] & 0x7) << 3)
|
||||
| (xmc[43] & 0x7));
|
||||
*c++ = (gsm_byte)(((xmc[44] & 0x7) << 5)
|
||||
| ((xmc[45] & 0x7) << 2)
|
||||
| ((xmc[46] >> 1) & 0x3));
|
||||
*c++ = (gsm_byte)(((xmc[46] & 0x1) << 7)
|
||||
| ((xmc[47] & 0x7) << 4)
|
||||
| ((xmc[48] & 0x7) << 1)
|
||||
| ((xmc[49] >> 2) & 0x1));
|
||||
*c++ = (gsm_byte)(((xmc[49] & 0x3) << 6)
|
||||
| ((xmc[50] & 0x7) << 3)
|
||||
| (xmc[51] & 0x7));
|
||||
|
||||
}
|
||||
}
|
|
@ -1,342 +0,0 @@
|
|||
/*
|
||||
* gsm_lpc.c
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "private.h"
|
||||
|
||||
#include "gsm.h"
|
||||
#include "proto.h"
|
||||
|
||||
#undef P
|
||||
|
||||
/*
|
||||
* 4.2.4 .. 4.2.7 LPC ANALYSIS SECTION
|
||||
*/
|
||||
|
||||
/* 4.2.4 */
|
||||
|
||||
|
||||
static void Autocorrelation P2((s, L_ACF),
|
||||
word * s, /* [0..159] IN/OUT */
|
||||
longword * L_ACF) /* [0..8] OUT */
|
||||
/*
|
||||
* The goal is to compute the array L_ACF[k]. The signal s[i] must
|
||||
* be scaled in order to avoid an overflow situation.
|
||||
*/
|
||||
{
|
||||
register int k, i;
|
||||
|
||||
word temp, smax, scalauto;
|
||||
|
||||
#ifdef USE_FLOAT_MUL
|
||||
float float_s[160];
|
||||
#endif
|
||||
|
||||
/* Dynamic scaling of the array s[0..159]
|
||||
*/
|
||||
|
||||
/* Search for the maximum.
|
||||
*/
|
||||
smax = 0;
|
||||
for (k = 0; k <= 159; k++) {
|
||||
temp = GSM_ABS( s[k] );
|
||||
if (temp > smax) smax = temp;
|
||||
}
|
||||
|
||||
/* Computation of the scaling factor.
|
||||
*/
|
||||
if (smax == 0) scalauto = 0;
|
||||
else {
|
||||
assert(smax > 0);
|
||||
scalauto = 4 - gsm_norm( (longword)smax << 16 );/* sub(4,..) */
|
||||
}
|
||||
|
||||
/* Scaling of the array s[0...159]
|
||||
*/
|
||||
|
||||
if (scalauto > 0) {
|
||||
|
||||
# ifdef USE_FLOAT_MUL
|
||||
# define SCALE(n) \
|
||||
case n: for (k = 0; k <= 159; k++) \
|
||||
float_s[k] = (float) \
|
||||
(s[k] = GSM_MULT_R(s[k], 16384 >> (n-1)));\
|
||||
break;
|
||||
# else
|
||||
# define SCALE(n) \
|
||||
case n: for (k = 0; k <= 159; k++) \
|
||||
s[k] = (word) GSM_MULT_R( s[k], 16384 >> (n-1) );\
|
||||
break;
|
||||
# endif /* USE_FLOAT_MUL */
|
||||
|
||||
switch (scalauto) {
|
||||
SCALE(1)
|
||||
SCALE(2)
|
||||
SCALE(3)
|
||||
SCALE(4)
|
||||
}
|
||||
# undef SCALE
|
||||
}
|
||||
# ifdef USE_FLOAT_MUL
|
||||
else for (k = 0; k <= 159; k++) float_s[k] = (float) s[k];
|
||||
# endif
|
||||
|
||||
/* Compute the L_ACF[..].
|
||||
*/
|
||||
{
|
||||
# ifdef USE_FLOAT_MUL
|
||||
register float * sp = float_s;
|
||||
register float sl = *sp;
|
||||
|
||||
# define STEP(k) L_ACF[k] += (longword)(sl * sp[ -(k) ]);
|
||||
# else
|
||||
word * sp = s;
|
||||
word sl = *sp;
|
||||
|
||||
# define STEP(k) L_ACF[k] += ((longword)sl * sp[ -(k) ]);
|
||||
# endif
|
||||
|
||||
# define NEXTI sl = *++sp
|
||||
|
||||
|
||||
for (k = 9; k--; L_ACF[k] = 0) ;
|
||||
|
||||
STEP (0);
|
||||
NEXTI;
|
||||
STEP(0); STEP(1);
|
||||
NEXTI;
|
||||
STEP(0); STEP(1); STEP(2);
|
||||
NEXTI;
|
||||
STEP(0); STEP(1); STEP(2); STEP(3);
|
||||
NEXTI;
|
||||
STEP(0); STEP(1); STEP(2); STEP(3); STEP(4);
|
||||
NEXTI;
|
||||
STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5);
|
||||
NEXTI;
|
||||
STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5); STEP(6);
|
||||
NEXTI;
|
||||
STEP(0); STEP(1); STEP(2); STEP(3); STEP(4); STEP(5); STEP(6); STEP(7);
|
||||
|
||||
for (i = 8; i <= 159; i++) {
|
||||
|
||||
NEXTI;
|
||||
|
||||
STEP(0);
|
||||
STEP(1); STEP(2); STEP(3); STEP(4);
|
||||
STEP(5); STEP(6); STEP(7); STEP(8);
|
||||
}
|
||||
|
||||
for (k = 9; k--; L_ACF[k] <<= 1) ;
|
||||
|
||||
}
|
||||
/* Rescaling of the array s[0..159]
|
||||
*/
|
||||
if (scalauto > 0) {
|
||||
assert(scalauto <= 4);
|
||||
for (k = 160; k--; *s++ <<= scalauto) ;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(USE_FLOAT_MUL) && defined(FAST)
|
||||
|
||||
static void Fast_Autocorrelation P2((s, L_ACF),
|
||||
word * s, /* [0..159] IN/OUT */
|
||||
longword * L_ACF) /* [0..8] OUT */
|
||||
{
|
||||
register int k, i;
|
||||
float f_L_ACF[9];
|
||||
float scale;
|
||||
|
||||
float s_f[160];
|
||||
register float *sf = s_f;
|
||||
|
||||
for (i = 0; i < 160; ++i) sf[i] = s[i];
|
||||
for (k = 0; k <= 8; k++) {
|
||||
register float L_temp2 = 0;
|
||||
register float *sfl = sf - k;
|
||||
for (i = k; i < 160; ++i) L_temp2 += sf[i] * sfl[i];
|
||||
f_L_ACF[k] = L_temp2;
|
||||
}
|
||||
scale = MAX_LONGWORD / f_L_ACF[0];
|
||||
|
||||
for (k = 0; k <= 8; k++) {
|
||||
L_ACF[k] = f_L_ACF[k] * scale;
|
||||
}
|
||||
}
|
||||
#endif /* defined (USE_FLOAT_MUL) && defined (FAST) */
|
||||
|
||||
/* 4.2.5 */
|
||||
|
||||
static void Reflection_coefficients P2( (L_ACF, r),
|
||||
longword * L_ACF, /* 0...8 IN */
|
||||
register word * r /* 0...7 OUT */
|
||||
)
|
||||
{
|
||||
register int i, m, n;
|
||||
register word temp;
|
||||
register longword ltmp;
|
||||
word ACF[9]; /* 0..8 */
|
||||
word P[ 9]; /* 0..8 */
|
||||
word K[ 9]; /* 2..8 */
|
||||
|
||||
/* Schur recursion with 16 bits arithmetic.
|
||||
*/
|
||||
|
||||
if (L_ACF[0] == 0) {
|
||||
for (i = 8; i--; *r++ = 0) ;
|
||||
return;
|
||||
}
|
||||
|
||||
assert( L_ACF[0] != 0 );
|
||||
temp = gsm_norm( L_ACF[0] );
|
||||
|
||||
assert(temp >= 0 && temp < 32);
|
||||
|
||||
/* ? overflow ? */
|
||||
for (i = 0; i <= 8; i++) ACF[i] = (word) SASR( L_ACF[i] << temp, 16 );
|
||||
|
||||
/* Initialize array P[..] and K[..] for the recursion.
|
||||
*/
|
||||
|
||||
for (i = 1; i <= 7; i++) K[ i ] = ACF[ i ];
|
||||
for (i = 0; i <= 8; i++) P[ i ] = ACF[ i ];
|
||||
|
||||
/* Compute reflection coefficients
|
||||
*/
|
||||
for (n = 1; n <= 8; n++, r++) {
|
||||
|
||||
temp = P[1];
|
||||
temp = GSM_ABS(temp);
|
||||
if (P[0] < temp) {
|
||||
for (i = n; i <= 8; i++) *r++ = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
*r = gsm_div( temp, P[0] );
|
||||
|
||||
assert(*r >= 0);
|
||||
if (P[1] > 0) *r = -*r; /* r[n] = sub(0, r[n]) */
|
||||
assert (*r != MIN_WORD);
|
||||
if (n == 8) return;
|
||||
|
||||
/* Schur recursion
|
||||
*/
|
||||
temp = (word) GSM_MULT_R( P[1], *r );
|
||||
P[0] = (word) GSM_ADD( P[0], temp );
|
||||
|
||||
for (m = 1; m <= 8 - n; m++) {
|
||||
temp = (word) GSM_MULT_R( K[ m ], *r );
|
||||
P[m] = (word) GSM_ADD( P[ m+1 ], temp );
|
||||
|
||||
temp = (word) GSM_MULT_R( P[ m+1 ], *r );
|
||||
K[m] = (word) GSM_ADD( K[ m ], temp );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 4.2.6 */
|
||||
|
||||
static void Transformation_to_Log_Area_Ratios P1((r),
|
||||
register word * r /* 0..7 IN/OUT */
|
||||
)
|
||||
/*
|
||||
* The following scaling for r[..] and LAR[..] has been used:
|
||||
*
|
||||
* r[..] = integer( real_r[..]*32768. ); -1 <= real_r < 1.
|
||||
* LAR[..] = integer( real_LAR[..] * 16384 );
|
||||
* with -1.625 <= real_LAR <= 1.625
|
||||
*/
|
||||
{
|
||||
register word temp;
|
||||
register int i;
|
||||
|
||||
|
||||
/* Computation of the LAR[0..7] from the r[0..7]
|
||||
*/
|
||||
for (i = 1; i <= 8; i++, r++) {
|
||||
|
||||
temp = *r;
|
||||
temp = GSM_ABS(temp);
|
||||
assert(temp >= 0);
|
||||
|
||||
if (temp < 22118) {
|
||||
temp >>= 1;
|
||||
} else if (temp < 31130) {
|
||||
assert( temp >= 11059 );
|
||||
temp -= 11059;
|
||||
} else {
|
||||
assert( temp >= 26112 );
|
||||
temp -= 26112;
|
||||
temp <<= 2;
|
||||
}
|
||||
|
||||
*r = *r < 0 ? -temp : temp;
|
||||
assert( *r != MIN_WORD );
|
||||
}
|
||||
}
|
||||
|
||||
/* 4.2.7 */
|
||||
|
||||
static void Quantization_and_coding P1((LAR),
|
||||
register word * LAR /* [0..7] IN/OUT */
|
||||
)
|
||||
{
|
||||
register word temp;
|
||||
longword ltmp;
|
||||
|
||||
|
||||
/* This procedure needs four tables; the following equations
|
||||
* give the optimum scaling for the constants:
|
||||
*
|
||||
* A[0..7] = integer( real_A[0..7] * 1024 )
|
||||
* B[0..7] = integer( real_B[0..7] * 512 )
|
||||
* MAC[0..7] = maximum of the LARc[0..7]
|
||||
* MIC[0..7] = minimum of the LARc[0..7]
|
||||
*/
|
||||
|
||||
# undef STEP
|
||||
# define STEP( A, B, MAC, MIC ) \
|
||||
temp = (word)GSM_MULT( A, *LAR ); \
|
||||
temp = (word) GSM_ADD( temp, B ); \
|
||||
temp = (word) GSM_ADD( temp, 256 ); \
|
||||
temp = (word)SASR( temp, 9 ); \
|
||||
*LAR = temp>MAC ? MAC - MIC : (temp<MIC ? 0 : temp - MIC); \
|
||||
LAR++;
|
||||
|
||||
STEP( 20480, 0, 31, -32 );
|
||||
STEP( 20480, 0, 31, -32 );
|
||||
STEP( 20480, 2048, 15, -16 );
|
||||
STEP( 20480, -2560, 15, -16 );
|
||||
|
||||
STEP( 13964, 94, 7, -8 );
|
||||
STEP( 15360, -1792, 7, -8 );
|
||||
STEP( 8534, -341, 3, -4 );
|
||||
STEP( 9036, -1144, 3, -4 );
|
||||
|
||||
# undef STEP
|
||||
}
|
||||
|
||||
void Gsm_LPC_Analysis P3((S, s,LARc),
|
||||
struct gsm_state *S,
|
||||
word * s, /* 0..159 signals IN/OUT */
|
||||
word * LARc) /* 0..7 LARc's OUT */
|
||||
{
|
||||
longword L_ACF[9];
|
||||
|
||||
#if defined(USE_FLOAT_MUL) && defined(FAST)
|
||||
if (S->fast) Fast_Autocorrelation (s, L_ACF );
|
||||
else
|
||||
#endif
|
||||
Autocorrelation (s, L_ACF );
|
||||
Reflection_coefficients (L_ACF, LARc );
|
||||
Transformation_to_Log_Area_Ratios (LARc);
|
||||
Quantization_and_coding (LARc);
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
/*
|
||||
* gsm_option.c
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "private.h"
|
||||
|
||||
#include "gsm.h"
|
||||
#include "proto.h"
|
||||
|
||||
int gsm_option P3((r, opt, val), gsm r, int opt, int * val)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
switch (opt) {
|
||||
case GSM_OPT_LTP_CUT:
|
||||
#ifdef LTP_CUT
|
||||
result = r->ltp_cut;
|
||||
if (val) r->ltp_cut = *val;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case GSM_OPT_VERBOSE:
|
||||
#ifndef NDEBUG
|
||||
result = r->verbose;
|
||||
if (val) r->verbose = *val;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case GSM_OPT_FAST:
|
||||
|
||||
#if defined(FAST) && defined(USE_FLOAT_MUL)
|
||||
result = r->fast;
|
||||
if (val) r->fast = !!*val;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case GSM_OPT_FRAME_CHAIN:
|
||||
|
||||
#ifdef WAV49
|
||||
result = r->frame_chain;
|
||||
if (val) r->frame_chain = *val;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case GSM_OPT_FRAME_INDEX:
|
||||
|
||||
#ifdef WAV49
|
||||
result = r->frame_index;
|
||||
if (val) r->frame_index = *val;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case GSM_OPT_WAV49:
|
||||
|
||||
#ifdef WAV49
|
||||
result = r->wav_fmt;
|
||||
if (val) r->wav_fmt = !!*val;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
|
@ -1,950 +0,0 @@
|
|||
/*
|
||||
* long_term.c
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "private.h"
|
||||
|
||||
#include "gsm.h"
|
||||
#include "proto.h"
|
||||
|
||||
/*
|
||||
* 4.2.11 .. 4.2.12 LONG TERM PREDICTOR (LTP) SECTION
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This module computes the LTP gain (bc) and the LTP lag (Nc)
|
||||
* for the long term analysis filter. This is done by calculating a
|
||||
* maximum of the cross-correlation function between the current
|
||||
* sub-segment short term residual signal d[0..39] (output of
|
||||
* the short term analysis filter; for simplification the index
|
||||
* of this array begins at 0 and ends at 39 for each sub-segment of the
|
||||
* RPE-LTP analysis) and the previous reconstructed short term
|
||||
* residual signal dp[ -120 .. -1 ]. A dynamic scaling must be
|
||||
* performed to avoid overflow.
|
||||
*/
|
||||
|
||||
/* The next procedure exists in six versions. First two integer
|
||||
* version (if USE_FLOAT_MUL is not defined); then four floating
|
||||
* point versions, twice with proper scaling (USE_FLOAT_MUL defined),
|
||||
* once without (USE_FLOAT_MUL and FAST defined, and fast run-time
|
||||
* option used). Every pair has first a Cut version (see the -C
|
||||
* option to toast or the LTP_CUT option to gsm_option()), then the
|
||||
* uncut one. (For a detailed explanation of why this is altogether
|
||||
* a bad idea, see Henry Spencer and Geoff Collyer, ``#ifdef Considered
|
||||
* Harmful''.)
|
||||
*/
|
||||
|
||||
#ifndef USE_FLOAT_MUL
|
||||
|
||||
#ifdef LTP_CUT
|
||||
|
||||
static void Cut_Calculation_of_the_LTP_parameters P5((st, d,dp,bc_out,Nc_out),
|
||||
|
||||
struct gsm_state * st,
|
||||
|
||||
register word * d, /* [0..39] IN */
|
||||
register word * dp, /* [-120..-1] IN */
|
||||
word * bc_out, /* OUT */
|
||||
word * Nc_out /* OUT */
|
||||
)
|
||||
{
|
||||
register int k, lambda;
|
||||
word Nc, bc;
|
||||
word wt[40];
|
||||
|
||||
longword L_result;
|
||||
longword L_max, L_power;
|
||||
word R, S, dmax, scal, best_k;
|
||||
word ltp_cut;
|
||||
|
||||
register word temp, wt_k;
|
||||
|
||||
/* Search of the optimum scaling of d[0..39].
|
||||
*/
|
||||
dmax = 0;
|
||||
for (k = 0; k <= 39; k++) {
|
||||
temp = d[k];
|
||||
temp = GSM_ABS( temp );
|
||||
if (temp > dmax) {
|
||||
dmax = temp;
|
||||
best_k = k;
|
||||
}
|
||||
}
|
||||
temp = 0;
|
||||
if (dmax == 0) scal = 0;
|
||||
else {
|
||||
assert(dmax > 0);
|
||||
temp = gsm_norm( (longword)dmax << 16 );
|
||||
}
|
||||
if (temp > 6) scal = 0;
|
||||
else scal = 6 - temp;
|
||||
assert(scal >= 0);
|
||||
|
||||
/* Search for the maximum cross-correlation and coding of the LTP lag
|
||||
*/
|
||||
L_max = 0;
|
||||
Nc = 40; /* index for the maximum cross-correlation */
|
||||
wt_k = SASR(d[best_k], scal);
|
||||
|
||||
for (lambda = 40; lambda <= 120; lambda++) {
|
||||
L_result = (longword)wt_k * dp[best_k - lambda];
|
||||
if (L_result > L_max) {
|
||||
Nc = lambda;
|
||||
L_max = L_result;
|
||||
}
|
||||
}
|
||||
*Nc_out = Nc;
|
||||
L_max <<= 1;
|
||||
|
||||
/* Rescaling of L_max
|
||||
*/
|
||||
assert(scal <= 100 && scal >= -100);
|
||||
L_max = L_max >> (6 - scal); /* sub(6, scal) */
|
||||
|
||||
assert( Nc <= 120 && Nc >= 40);
|
||||
|
||||
/* Compute the power of the reconstructed short term residual
|
||||
* signal dp[..]
|
||||
*/
|
||||
L_power = 0;
|
||||
for (k = 0; k <= 39; k++) {
|
||||
|
||||
register longword L_temp;
|
||||
|
||||
L_temp = SASR( dp[k - Nc], 3 );
|
||||
L_power += L_temp * L_temp;
|
||||
}
|
||||
L_power <<= 1; /* from L_MULT */
|
||||
|
||||
/* Normalization of L_max and L_power
|
||||
*/
|
||||
|
||||
if (L_max <= 0) {
|
||||
*bc_out = 0;
|
||||
return;
|
||||
}
|
||||
if (L_max >= L_power) {
|
||||
*bc_out = 3;
|
||||
return;
|
||||
}
|
||||
|
||||
temp = gsm_norm( L_power );
|
||||
|
||||
R = SASR( L_max << temp, 16 );
|
||||
S = SASR( L_power << temp, 16 );
|
||||
|
||||
/* Coding of the LTP gain
|
||||
*/
|
||||
|
||||
/* Table 4.3a must be used to obtain the level DLB[i] for the
|
||||
* quantization of the LTP gain b to get the coded version bc.
|
||||
*/
|
||||
for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break;
|
||||
*bc_out = bc;
|
||||
}
|
||||
|
||||
#endif /* LTP_CUT */
|
||||
|
||||
static void Calculation_of_the_LTP_parameters P4((d,dp,bc_out,Nc_out),
|
||||
register word * d, /* [0..39] IN */
|
||||
register word * dp, /* [-120..-1] IN */
|
||||
word * bc_out, /* OUT */
|
||||
word * Nc_out /* OUT */
|
||||
)
|
||||
{
|
||||
register int k, lambda;
|
||||
word Nc, bc;
|
||||
word wt[40];
|
||||
|
||||
longword L_max, L_power;
|
||||
word R, S, dmax, scal;
|
||||
register word temp;
|
||||
|
||||
/* Search of the optimum scaling of d[0..39].
|
||||
*/
|
||||
dmax = 0;
|
||||
|
||||
for (k = 0; k <= 39; k++) {
|
||||
temp = d[k];
|
||||
temp = GSM_ABS( temp );
|
||||
if (temp > dmax) dmax = temp;
|
||||
}
|
||||
|
||||
temp = 0;
|
||||
if (dmax == 0) scal = 0;
|
||||
else {
|
||||
assert(dmax > 0);
|
||||
temp = gsm_norm( (longword)dmax << 16 );
|
||||
}
|
||||
|
||||
if (temp > 6) scal = 0;
|
||||
else scal = 6 - temp;
|
||||
|
||||
assert(scal >= 0);
|
||||
|
||||
/* Initialization of a working array wt
|
||||
*/
|
||||
|
||||
for (k = 0; k <= 39; k++) wt[k] = (word)SASR( d[k], scal );
|
||||
|
||||
/* Search for the maximum cross-correlation and coding of the LTP lag
|
||||
*/
|
||||
L_max = 0;
|
||||
Nc = 40; /* index for the maximum cross-correlation */
|
||||
|
||||
for (lambda = 40; lambda <= 120; lambda++) {
|
||||
|
||||
# undef STEP
|
||||
# define STEP(k) (longword)wt[k] * dp[k - lambda]
|
||||
|
||||
register longword L_result;
|
||||
|
||||
L_result = STEP(0) ; L_result += STEP(1) ;
|
||||
L_result += STEP(2) ; L_result += STEP(3) ;
|
||||
L_result += STEP(4) ; L_result += STEP(5) ;
|
||||
L_result += STEP(6) ; L_result += STEP(7) ;
|
||||
L_result += STEP(8) ; L_result += STEP(9) ;
|
||||
L_result += STEP(10) ; L_result += STEP(11) ;
|
||||
L_result += STEP(12) ; L_result += STEP(13) ;
|
||||
L_result += STEP(14) ; L_result += STEP(15) ;
|
||||
L_result += STEP(16) ; L_result += STEP(17) ;
|
||||
L_result += STEP(18) ; L_result += STEP(19) ;
|
||||
L_result += STEP(20) ; L_result += STEP(21) ;
|
||||
L_result += STEP(22) ; L_result += STEP(23) ;
|
||||
L_result += STEP(24) ; L_result += STEP(25) ;
|
||||
L_result += STEP(26) ; L_result += STEP(27) ;
|
||||
L_result += STEP(28) ; L_result += STEP(29) ;
|
||||
L_result += STEP(30) ; L_result += STEP(31) ;
|
||||
L_result += STEP(32) ; L_result += STEP(33) ;
|
||||
L_result += STEP(34) ; L_result += STEP(35) ;
|
||||
L_result += STEP(36) ; L_result += STEP(37) ;
|
||||
L_result += STEP(38) ; L_result += STEP(39) ;
|
||||
|
||||
if (L_result > L_max) {
|
||||
|
||||
Nc = (word)lambda;
|
||||
L_max = L_result;
|
||||
}
|
||||
}
|
||||
|
||||
*Nc_out = Nc;
|
||||
|
||||
L_max <<= 1;
|
||||
|
||||
/* Rescaling of L_max
|
||||
*/
|
||||
assert(scal <= 100 && scal >= -100);
|
||||
L_max = L_max >> (6 - scal); /* sub(6, scal) */
|
||||
|
||||
assert( Nc <= 120 && Nc >= 40);
|
||||
|
||||
/* Compute the power of the reconstructed short term residual
|
||||
* signal dp[..]
|
||||
*/
|
||||
L_power = 0;
|
||||
for (k = 0; k <= 39; k++) {
|
||||
|
||||
register longword L_temp;
|
||||
|
||||
L_temp = SASR( dp[k - Nc], 3 );
|
||||
L_power += L_temp * L_temp;
|
||||
}
|
||||
L_power <<= 1; /* from L_MULT */
|
||||
|
||||
/* Normalization of L_max and L_power
|
||||
*/
|
||||
|
||||
if (L_max <= 0) {
|
||||
*bc_out = 0;
|
||||
return;
|
||||
}
|
||||
if (L_max >= L_power) {
|
||||
*bc_out = 3;
|
||||
return;
|
||||
}
|
||||
|
||||
temp = gsm_norm( L_power );
|
||||
|
||||
R = (word) SASR( L_max << temp, 16 );
|
||||
S = (word) SASR( L_power << temp, 16 );
|
||||
|
||||
/* Coding of the LTP gain
|
||||
*/
|
||||
|
||||
/* Table 4.3a must be used to obtain the level DLB[i] for the
|
||||
* quantization of the LTP gain b to get the coded version bc.
|
||||
*/
|
||||
for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break;
|
||||
*bc_out = bc;
|
||||
}
|
||||
|
||||
#else /* USE_FLOAT_MUL */
|
||||
|
||||
#ifdef LTP_CUT
|
||||
|
||||
static void Cut_Calculation_of_the_LTP_parameters P5((st, d,dp,bc_out,Nc_out),
|
||||
struct gsm_state * st, /* IN */
|
||||
register word * d, /* [0..39] IN */
|
||||
register word * dp, /* [-120..-1] IN */
|
||||
word * bc_out, /* OUT */
|
||||
word * Nc_out /* OUT */
|
||||
)
|
||||
{
|
||||
register int k, lambda;
|
||||
word Nc, bc;
|
||||
word ltp_cut;
|
||||
|
||||
float wt_float[40];
|
||||
float dp_float_base[120], * dp_float = dp_float_base + 120;
|
||||
|
||||
longword L_max, L_power;
|
||||
word R, S, dmax, scal;
|
||||
register word temp;
|
||||
|
||||
/* Search of the optimum scaling of d[0..39].
|
||||
*/
|
||||
dmax = 0;
|
||||
|
||||
for (k = 0; k <= 39; k++) {
|
||||
temp = d[k];
|
||||
temp = GSM_ABS( temp );
|
||||
if (temp > dmax) dmax = temp;
|
||||
}
|
||||
|
||||
temp = 0;
|
||||
if (dmax == 0) scal = 0;
|
||||
else {
|
||||
assert(dmax > 0);
|
||||
temp = gsm_norm( (longword)dmax << 16 );
|
||||
}
|
||||
|
||||
if (temp > 6) scal = 0;
|
||||
else scal = 6 - temp;
|
||||
|
||||
assert(scal >= 0);
|
||||
ltp_cut = (longword)SASR(dmax, scal) * st->ltp_cut / 100;
|
||||
|
||||
|
||||
/* Initialization of a working array wt
|
||||
*/
|
||||
|
||||
for (k = 0; k < 40; k++) {
|
||||
register word w = SASR( d[k], scal );
|
||||
if (w < 0 ? w > -ltp_cut : w < ltp_cut) {
|
||||
wt_float[k] = 0.0;
|
||||
}
|
||||
else {
|
||||
wt_float[k] = w;
|
||||
}
|
||||
}
|
||||
for (k = -120; k < 0; k++) dp_float[k] = dp[k];
|
||||
|
||||
/* Search for the maximum cross-correlation and coding of the LTP lag
|
||||
*/
|
||||
L_max = 0;
|
||||
Nc = 40; /* index for the maximum cross-correlation */
|
||||
|
||||
for (lambda = 40; lambda <= 120; lambda += 9) {
|
||||
|
||||
/* Calculate L_result for l = lambda .. lambda + 9.
|
||||
*/
|
||||
register float *lp = dp_float - lambda;
|
||||
|
||||
register float W;
|
||||
register float a = lp[-8], b = lp[-7], c = lp[-6],
|
||||
d = lp[-5], e = lp[-4], f = lp[-3],
|
||||
g = lp[-2], h = lp[-1];
|
||||
register float E;
|
||||
register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0,
|
||||
S5 = 0, S6 = 0, S7 = 0, S8 = 0;
|
||||
|
||||
# undef STEP
|
||||
# define STEP(K, a, b, c, d, e, f, g, h) \
|
||||
if ((W = wt_float[K]) != 0.0) { \
|
||||
E = W * a; S8 += E; \
|
||||
E = W * b; S7 += E; \
|
||||
E = W * c; S6 += E; \
|
||||
E = W * d; S5 += E; \
|
||||
E = W * e; S4 += E; \
|
||||
E = W * f; S3 += E; \
|
||||
E = W * g; S2 += E; \
|
||||
E = W * h; S1 += E; \
|
||||
a = lp[K]; \
|
||||
E = W * a; S0 += E; } else (a = lp[K])
|
||||
|
||||
# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h)
|
||||
# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a)
|
||||
# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b)
|
||||
# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c)
|
||||
# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d)
|
||||
# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e)
|
||||
# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f)
|
||||
# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g)
|
||||
|
||||
STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3);
|
||||
STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7);
|
||||
|
||||
STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11);
|
||||
STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15);
|
||||
|
||||
STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19);
|
||||
STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23);
|
||||
|
||||
STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27);
|
||||
STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31);
|
||||
|
||||
STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35);
|
||||
STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39);
|
||||
|
||||
if (S0 > L_max) { L_max = S0; Nc = lambda; }
|
||||
if (S1 > L_max) { L_max = S1; Nc = lambda + 1; }
|
||||
if (S2 > L_max) { L_max = S2; Nc = lambda + 2; }
|
||||
if (S3 > L_max) { L_max = S3; Nc = lambda + 3; }
|
||||
if (S4 > L_max) { L_max = S4; Nc = lambda + 4; }
|
||||
if (S5 > L_max) { L_max = S5; Nc = lambda + 5; }
|
||||
if (S6 > L_max) { L_max = S6; Nc = lambda + 6; }
|
||||
if (S7 > L_max) { L_max = S7; Nc = lambda + 7; }
|
||||
if (S8 > L_max) { L_max = S8; Nc = lambda + 8; }
|
||||
|
||||
}
|
||||
*Nc_out = Nc;
|
||||
|
||||
L_max <<= 1;
|
||||
|
||||
/* Rescaling of L_max
|
||||
*/
|
||||
assert(scal <= 100 && scal >= -100);
|
||||
L_max = L_max >> (6 - scal); /* sub(6, scal) */
|
||||
|
||||
assert( Nc <= 120 && Nc >= 40);
|
||||
|
||||
/* Compute the power of the reconstructed short term residual
|
||||
* signal dp[..]
|
||||
*/
|
||||
L_power = 0;
|
||||
for (k = 0; k <= 39; k++) {
|
||||
|
||||
register longword L_temp;
|
||||
|
||||
L_temp = SASR( dp[k - Nc], 3 );
|
||||
L_power += L_temp * L_temp;
|
||||
}
|
||||
L_power <<= 1; /* from L_MULT */
|
||||
|
||||
/* Normalization of L_max and L_power
|
||||
*/
|
||||
|
||||
if (L_max <= 0) {
|
||||
*bc_out = 0;
|
||||
return;
|
||||
}
|
||||
if (L_max >= L_power) {
|
||||
*bc_out = 3;
|
||||
return;
|
||||
}
|
||||
|
||||
temp = gsm_norm( L_power );
|
||||
|
||||
R = SASR( L_max << temp, 16 );
|
||||
S = SASR( L_power << temp, 16 );
|
||||
|
||||
/* Coding of the LTP gain
|
||||
*/
|
||||
|
||||
/* Table 4.3a must be used to obtain the level DLB[i] for the
|
||||
* quantization of the LTP gain b to get the coded version bc.
|
||||
*/
|
||||
for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break;
|
||||
*bc_out = bc;
|
||||
}
|
||||
|
||||
#endif /* LTP_CUT */
|
||||
|
||||
static void Calculation_of_the_LTP_parameters P4((d,dp,bc_out,Nc_out),
|
||||
register word * d, /* [0..39] IN */
|
||||
register word * dp, /* [-120..-1] IN */
|
||||
word * bc_out, /* OUT */
|
||||
word * Nc_out /* OUT */
|
||||
)
|
||||
{
|
||||
register int k, lambda;
|
||||
word Nc, bc;
|
||||
|
||||
float wt_float[40];
|
||||
float dp_float_base[120], * dp_float = dp_float_base + 120;
|
||||
|
||||
longword L_max, L_power;
|
||||
word R, S, dmax, scal;
|
||||
register word temp;
|
||||
|
||||
/* Search of the optimum scaling of d[0..39].
|
||||
*/
|
||||
dmax = 0;
|
||||
|
||||
for (k = 0; k <= 39; k++) {
|
||||
temp = d[k];
|
||||
temp = GSM_ABS( temp );
|
||||
if (temp > dmax) dmax = temp;
|
||||
}
|
||||
|
||||
temp = 0;
|
||||
if (dmax == 0) scal = 0;
|
||||
else {
|
||||
assert(dmax > 0);
|
||||
temp = gsm_norm( (longword)dmax << 16 );
|
||||
}
|
||||
|
||||
if (temp > 6) scal = 0;
|
||||
else scal = 6 - temp;
|
||||
|
||||
assert(scal >= 0);
|
||||
|
||||
/* Initialization of a working array wt
|
||||
*/
|
||||
|
||||
for (k = 0; k < 40; k++) wt_float[k] = SASR( d[k], scal );
|
||||
for (k = -120; k < 0; k++) dp_float[k] = dp[k];
|
||||
|
||||
/* Search for the maximum cross-correlation and coding of the LTP lag
|
||||
*/
|
||||
L_max = 0;
|
||||
Nc = 40; /* index for the maximum cross-correlation */
|
||||
|
||||
for (lambda = 40; lambda <= 120; lambda += 9) {
|
||||
|
||||
/* Calculate L_result for l = lambda .. lambda + 9.
|
||||
*/
|
||||
register float *lp = dp_float - lambda;
|
||||
|
||||
register float W;
|
||||
register float a = lp[-8], b = lp[-7], c = lp[-6],
|
||||
d = lp[-5], e = lp[-4], f = lp[-3],
|
||||
g = lp[-2], h = lp[-1];
|
||||
register float E;
|
||||
register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0,
|
||||
S5 = 0, S6 = 0, S7 = 0, S8 = 0;
|
||||
|
||||
# undef STEP
|
||||
# define STEP(K, a, b, c, d, e, f, g, h) \
|
||||
W = wt_float[K]; \
|
||||
E = W * a; S8 += E; \
|
||||
E = W * b; S7 += E; \
|
||||
E = W * c; S6 += E; \
|
||||
E = W * d; S5 += E; \
|
||||
E = W * e; S4 += E; \
|
||||
E = W * f; S3 += E; \
|
||||
E = W * g; S2 += E; \
|
||||
E = W * h; S1 += E; \
|
||||
a = lp[K]; \
|
||||
E = W * a; S0 += E
|
||||
|
||||
# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h)
|
||||
# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a)
|
||||
# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b)
|
||||
# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c)
|
||||
# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d)
|
||||
# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e)
|
||||
# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f)
|
||||
# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g)
|
||||
|
||||
STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3);
|
||||
STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7);
|
||||
|
||||
STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11);
|
||||
STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15);
|
||||
|
||||
STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19);
|
||||
STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23);
|
||||
|
||||
STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27);
|
||||
STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31);
|
||||
|
||||
STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35);
|
||||
STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39);
|
||||
|
||||
if (S0 > L_max) { L_max = S0; Nc = lambda; }
|
||||
if (S1 > L_max) { L_max = S1; Nc = lambda + 1; }
|
||||
if (S2 > L_max) { L_max = S2; Nc = lambda + 2; }
|
||||
if (S3 > L_max) { L_max = S3; Nc = lambda + 3; }
|
||||
if (S4 > L_max) { L_max = S4; Nc = lambda + 4; }
|
||||
if (S5 > L_max) { L_max = S5; Nc = lambda + 5; }
|
||||
if (S6 > L_max) { L_max = S6; Nc = lambda + 6; }
|
||||
if (S7 > L_max) { L_max = S7; Nc = lambda + 7; }
|
||||
if (S8 > L_max) { L_max = S8; Nc = lambda + 8; }
|
||||
}
|
||||
*Nc_out = Nc;
|
||||
|
||||
L_max <<= 1;
|
||||
|
||||
/* Rescaling of L_max
|
||||
*/
|
||||
assert(scal <= 100 && scal >= -100);
|
||||
L_max = L_max >> (6 - scal); /* sub(6, scal) */
|
||||
|
||||
assert( Nc <= 120 && Nc >= 40);
|
||||
|
||||
/* Compute the power of the reconstructed short term residual
|
||||
* signal dp[..]
|
||||
*/
|
||||
L_power = 0;
|
||||
for (k = 0; k <= 39; k++) {
|
||||
|
||||
register longword L_temp;
|
||||
|
||||
L_temp = SASR( dp[k - Nc], 3 );
|
||||
L_power += L_temp * L_temp;
|
||||
}
|
||||
L_power <<= 1; /* from L_MULT */
|
||||
|
||||
/* Normalization of L_max and L_power
|
||||
*/
|
||||
|
||||
if (L_max <= 0) {
|
||||
*bc_out = 0;
|
||||
return;
|
||||
}
|
||||
if (L_max >= L_power) {
|
||||
*bc_out = 3;
|
||||
return;
|
||||
}
|
||||
|
||||
temp = gsm_norm( L_power );
|
||||
|
||||
R = SASR( L_max << temp, 16 );
|
||||
S = SASR( L_power << temp, 16 );
|
||||
|
||||
/* Coding of the LTP gain
|
||||
*/
|
||||
|
||||
/* Table 4.3a must be used to obtain the level DLB[i] for the
|
||||
* quantization of the LTP gain b to get the coded version bc.
|
||||
*/
|
||||
for (bc = 0; bc <= 2; bc++) if (R <= gsm_mult(S, gsm_DLB[bc])) break;
|
||||
*bc_out = bc;
|
||||
}
|
||||
|
||||
#ifdef FAST
|
||||
#ifdef LTP_CUT
|
||||
|
||||
static void Cut_Fast_Calculation_of_the_LTP_parameters P5((st,
|
||||
d,dp,bc_out,Nc_out),
|
||||
struct gsm_state * st, /* IN */
|
||||
register word * d, /* [0..39] IN */
|
||||
register word * dp, /* [-120..-1] IN */
|
||||
word * bc_out, /* OUT */
|
||||
word * Nc_out /* OUT */
|
||||
)
|
||||
{
|
||||
register int k, lambda;
|
||||
register float wt_float;
|
||||
word Nc, bc;
|
||||
word wt_max, best_k, ltp_cut;
|
||||
|
||||
float dp_float_base[120], * dp_float = dp_float_base + 120;
|
||||
|
||||
register float L_result, L_max, L_power;
|
||||
|
||||
wt_max = 0;
|
||||
|
||||
for (k = 0; k < 40; ++k) {
|
||||
if ( d[k] > wt_max) wt_max = d[best_k = k];
|
||||
else if (-d[k] > wt_max) wt_max = -d[best_k = k];
|
||||
}
|
||||
|
||||
assert(wt_max >= 0);
|
||||
wt_float = (float)wt_max;
|
||||
|
||||
for (k = -120; k < 0; ++k) dp_float[k] = (float)dp[k];
|
||||
|
||||
/* Search for the maximum cross-correlation and coding of the LTP lag
|
||||
*/
|
||||
L_max = 0;
|
||||
Nc = 40; /* index for the maximum cross-correlation */
|
||||
|
||||
for (lambda = 40; lambda <= 120; lambda++) {
|
||||
L_result = wt_float * dp_float[best_k - lambda];
|
||||
if (L_result > L_max) {
|
||||
Nc = lambda;
|
||||
L_max = L_result;
|
||||
}
|
||||
}
|
||||
|
||||
*Nc_out = Nc;
|
||||
if (L_max <= 0.) {
|
||||
*bc_out = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Compute the power of the reconstructed short term residual
|
||||
* signal dp[..]
|
||||
*/
|
||||
dp_float -= Nc;
|
||||
L_power = 0;
|
||||
for (k = 0; k < 40; ++k) {
|
||||
register float f = dp_float[k];
|
||||
L_power += f * f;
|
||||
}
|
||||
|
||||
if (L_max >= L_power) {
|
||||
*bc_out = 3;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Coding of the LTP gain
|
||||
* Table 4.3a must be used to obtain the level DLB[i] for the
|
||||
* quantization of the LTP gain b to get the coded version bc.
|
||||
*/
|
||||
lambda = L_max / L_power * 32768.;
|
||||
for (bc = 0; bc <= 2; ++bc) if (lambda <= gsm_DLB[bc]) break;
|
||||
*bc_out = bc;
|
||||
}
|
||||
|
||||
#endif /* LTP_CUT */
|
||||
|
||||
static void Fast_Calculation_of_the_LTP_parameters P4((d,dp,bc_out,Nc_out),
|
||||
register word * d, /* [0..39] IN */
|
||||
register word * dp, /* [-120..-1] IN */
|
||||
word * bc_out, /* OUT */
|
||||
word * Nc_out /* OUT */
|
||||
)
|
||||
{
|
||||
register int k, lambda;
|
||||
word Nc, bc;
|
||||
|
||||
float wt_float[40];
|
||||
float dp_float_base[120], * dp_float = dp_float_base + 120;
|
||||
|
||||
register float L_max, L_power;
|
||||
|
||||
for (k = 0; k < 40; ++k) wt_float[k] = (float)d[k];
|
||||
for (k = -120; k < 0; ++k) dp_float[k] = (float)dp[k];
|
||||
|
||||
/* Search for the maximum cross-correlation and coding of the LTP lag
|
||||
*/
|
||||
L_max = 0;
|
||||
Nc = 40; /* index for the maximum cross-correlation */
|
||||
|
||||
for (lambda = 40; lambda <= 120; lambda += 9) {
|
||||
|
||||
/* Calculate L_result for l = lambda .. lambda + 9.
|
||||
*/
|
||||
register float *lp = dp_float - lambda;
|
||||
|
||||
register float W;
|
||||
register float a = lp[-8], b = lp[-7], c = lp[-6],
|
||||
d = lp[-5], e = lp[-4], f = lp[-3],
|
||||
g = lp[-2], h = lp[-1];
|
||||
register float E;
|
||||
register float S0 = 0, S1 = 0, S2 = 0, S3 = 0, S4 = 0,
|
||||
S5 = 0, S6 = 0, S7 = 0, S8 = 0;
|
||||
|
||||
# undef STEP
|
||||
# define STEP(K, a, b, c, d, e, f, g, h) \
|
||||
W = wt_float[K]; \
|
||||
E = W * a; S8 += E; \
|
||||
E = W * b; S7 += E; \
|
||||
E = W * c; S6 += E; \
|
||||
E = W * d; S5 += E; \
|
||||
E = W * e; S4 += E; \
|
||||
E = W * f; S3 += E; \
|
||||
E = W * g; S2 += E; \
|
||||
E = W * h; S1 += E; \
|
||||
a = lp[K]; \
|
||||
E = W * a; S0 += E
|
||||
|
||||
# define STEP_A(K) STEP(K, a, b, c, d, e, f, g, h)
|
||||
# define STEP_B(K) STEP(K, b, c, d, e, f, g, h, a)
|
||||
# define STEP_C(K) STEP(K, c, d, e, f, g, h, a, b)
|
||||
# define STEP_D(K) STEP(K, d, e, f, g, h, a, b, c)
|
||||
# define STEP_E(K) STEP(K, e, f, g, h, a, b, c, d)
|
||||
# define STEP_F(K) STEP(K, f, g, h, a, b, c, d, e)
|
||||
# define STEP_G(K) STEP(K, g, h, a, b, c, d, e, f)
|
||||
# define STEP_H(K) STEP(K, h, a, b, c, d, e, f, g)
|
||||
|
||||
STEP_A( 0); STEP_B( 1); STEP_C( 2); STEP_D( 3);
|
||||
STEP_E( 4); STEP_F( 5); STEP_G( 6); STEP_H( 7);
|
||||
|
||||
STEP_A( 8); STEP_B( 9); STEP_C(10); STEP_D(11);
|
||||
STEP_E(12); STEP_F(13); STEP_G(14); STEP_H(15);
|
||||
|
||||
STEP_A(16); STEP_B(17); STEP_C(18); STEP_D(19);
|
||||
STEP_E(20); STEP_F(21); STEP_G(22); STEP_H(23);
|
||||
|
||||
STEP_A(24); STEP_B(25); STEP_C(26); STEP_D(27);
|
||||
STEP_E(28); STEP_F(29); STEP_G(30); STEP_H(31);
|
||||
|
||||
STEP_A(32); STEP_B(33); STEP_C(34); STEP_D(35);
|
||||
STEP_E(36); STEP_F(37); STEP_G(38); STEP_H(39);
|
||||
|
||||
if (S0 > L_max) { L_max = S0; Nc = lambda; }
|
||||
if (S1 > L_max) { L_max = S1; Nc = lambda + 1; }
|
||||
if (S2 > L_max) { L_max = S2; Nc = lambda + 2; }
|
||||
if (S3 > L_max) { L_max = S3; Nc = lambda + 3; }
|
||||
if (S4 > L_max) { L_max = S4; Nc = lambda + 4; }
|
||||
if (S5 > L_max) { L_max = S5; Nc = lambda + 5; }
|
||||
if (S6 > L_max) { L_max = S6; Nc = lambda + 6; }
|
||||
if (S7 > L_max) { L_max = S7; Nc = lambda + 7; }
|
||||
if (S8 > L_max) { L_max = S8; Nc = lambda + 8; }
|
||||
}
|
||||
*Nc_out = Nc;
|
||||
|
||||
if (L_max <= 0.) {
|
||||
*bc_out = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Compute the power of the reconstructed short term residual
|
||||
* signal dp[..]
|
||||
*/
|
||||
dp_float -= Nc;
|
||||
L_power = 0;
|
||||
for (k = 0; k < 40; ++k) {
|
||||
register float f = dp_float[k];
|
||||
L_power += f * f;
|
||||
}
|
||||
|
||||
if (L_max >= L_power) {
|
||||
*bc_out = 3;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Coding of the LTP gain
|
||||
* Table 4.3a must be used to obtain the level DLB[i] for the
|
||||
* quantization of the LTP gain b to get the coded version bc.
|
||||
*/
|
||||
lambda = L_max / L_power * 32768.;
|
||||
for (bc = 0; bc <= 2; ++bc) if (lambda <= gsm_DLB[bc]) break;
|
||||
*bc_out = bc;
|
||||
}
|
||||
|
||||
#endif /* FAST */
|
||||
#endif /* USE_FLOAT_MUL */
|
||||
|
||||
|
||||
/* 4.2.12 */
|
||||
|
||||
static void Long_term_analysis_filtering P6((bc,Nc,dp,d,dpp,e),
|
||||
word bc, /* IN */
|
||||
word Nc, /* IN */
|
||||
register word * dp, /* previous d [-120..-1] IN */
|
||||
register word * d, /* d [0..39] IN */
|
||||
register word * dpp, /* estimate [0..39] OUT */
|
||||
register word * e /* long term res. signal [0..39] OUT */
|
||||
)
|
||||
/*
|
||||
* In this part, we have to decode the bc parameter to compute
|
||||
* the samples of the estimate dpp[0..39]. The decoding of bc needs the
|
||||
* use of table 4.3b. The long term residual signal e[0..39]
|
||||
* is then calculated to be fed to the RPE encoding section.
|
||||
*/
|
||||
{
|
||||
register int k;
|
||||
register longword ltmp;
|
||||
|
||||
# undef STEP
|
||||
# define STEP(BP) \
|
||||
for (k = 0; k <= 39; k++) { \
|
||||
dpp[k] = (word) GSM_MULT_R( BP, dp[k - Nc]); \
|
||||
e[k] = (word) GSM_SUB( d[k], dpp[k] ); \
|
||||
}
|
||||
|
||||
switch (bc) {
|
||||
case 0: STEP( 3277 ); break;
|
||||
case 1: STEP( 11469 ); break;
|
||||
case 2: STEP( 21299 ); break;
|
||||
case 3: STEP( 32767 ); break;
|
||||
}
|
||||
}
|
||||
|
||||
void Gsm_Long_Term_Predictor P7((S,d,dp,e,dpp,Nc,bc), /* 4x for 160 samples */
|
||||
|
||||
struct gsm_state * S,
|
||||
|
||||
word * d, /* [0..39] residual signal IN */
|
||||
word * dp, /* [-120..-1] d' IN */
|
||||
|
||||
word * e, /* [0..39] OUT */
|
||||
word * dpp, /* [0..39] OUT */
|
||||
word * Nc, /* correlation lag OUT */
|
||||
word * bc /* gain factor OUT */
|
||||
)
|
||||
{
|
||||
assert( d ); assert( dp ); assert( e );
|
||||
assert( dpp); assert( Nc ); assert( bc );
|
||||
|
||||
#if defined(FAST) && defined(USE_FLOAT_MUL)
|
||||
if (S->fast)
|
||||
#if defined (LTP_CUT)
|
||||
if (S->ltp_cut)
|
||||
Cut_Fast_Calculation_of_the_LTP_parameters(S,
|
||||
d, dp, bc, Nc);
|
||||
else
|
||||
#endif /* LTP_CUT */
|
||||
Fast_Calculation_of_the_LTP_parameters(d, dp, bc, Nc );
|
||||
else
|
||||
#endif /* FAST & USE_FLOAT_MUL */
|
||||
#ifdef LTP_CUT
|
||||
if (S->ltp_cut)
|
||||
Cut_Calculation_of_the_LTP_parameters(S, d, dp, bc, Nc);
|
||||
else
|
||||
#endif
|
||||
Calculation_of_the_LTP_parameters(d, dp, bc, Nc);
|
||||
|
||||
Long_term_analysis_filtering( *bc, *Nc, dp, d, dpp, e );
|
||||
}
|
||||
|
||||
/* 4.3.2 */
|
||||
void Gsm_Long_Term_Synthesis_Filtering P5((S,Ncr,bcr,erp,drp),
|
||||
struct gsm_state * S,
|
||||
|
||||
word Ncr,
|
||||
word bcr,
|
||||
register word * erp, /* [0..39] IN */
|
||||
register word * drp /* [-120..-1] IN, [-120..40] OUT */
|
||||
)
|
||||
/*
|
||||
* This procedure uses the bcr and Ncr parameter to realize the
|
||||
* long term synthesis filtering. The decoding of bcr needs
|
||||
* table 4.3b.
|
||||
*/
|
||||
{
|
||||
register longword ltmp; /* for ADD */
|
||||
register int k;
|
||||
word brp, drpp, Nr;
|
||||
|
||||
/* Check the limits of Nr.
|
||||
*/
|
||||
Nr = Ncr < 40 || Ncr > 120 ? S->nrp : Ncr;
|
||||
S->nrp = Nr;
|
||||
assert(Nr >= 40 && Nr <= 120);
|
||||
|
||||
/* Decoding of the LTP gain bcr
|
||||
*/
|
||||
brp = gsm_QLB[ bcr ];
|
||||
|
||||
/* Computation of the reconstructed short term residual
|
||||
* signal drp[0..39]
|
||||
*/
|
||||
assert(brp != MIN_WORD);
|
||||
|
||||
for (k = 0; k <= 39; k++) {
|
||||
drpp = (word) GSM_MULT_R( brp, drp[ k - Nr ] );
|
||||
drp[k] = (word) GSM_ADD( erp[k], drpp );
|
||||
}
|
||||
|
||||
/*
|
||||
* Update of the reconstructed short term residual signal
|
||||
* drp[ -1..-120 ]
|
||||
*/
|
||||
|
||||
for (k = 0; k <= 119; k++) drp[ -120 + k ] = drp[ -80 + k ];
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
/*
|
||||
* preprocess.c
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "private.h"
|
||||
|
||||
#include "gsm.h"
|
||||
#include "proto.h"
|
||||
|
||||
/* 4.2.0 .. 4.2.3 PREPROCESSING SECTION
|
||||
*
|
||||
* After A-law to linear conversion (or directly from the
|
||||
* Ato D converter) the following scaling is assumed for
|
||||
* input to the RPE-LTP algorithm:
|
||||
*
|
||||
* in: 0.1.....................12
|
||||
* S.v.v.v.v.v.v.v.v.v.v.v.v.*.*.*
|
||||
*
|
||||
* Where S is the sign bit, v a valid bit, and * a "don't care" bit.
|
||||
* The original signal is called sop[..]
|
||||
*
|
||||
* out: 0.1................... 12
|
||||
* S.S.v.v.v.v.v.v.v.v.v.v.v.v.0.0
|
||||
*/
|
||||
|
||||
|
||||
void Gsm_Preprocess P3((S, s, so),
|
||||
struct gsm_state * S,
|
||||
word * s,
|
||||
word * so ) /* [0..159] IN/OUT */
|
||||
{
|
||||
|
||||
word z1 = S->z1;
|
||||
longword L_z2 = S->L_z2;
|
||||
word mp = (word)S->mp;
|
||||
|
||||
word s1;
|
||||
longword L_s2;
|
||||
|
||||
longword L_temp;
|
||||
|
||||
word msp, lsp;
|
||||
word SO;
|
||||
|
||||
longword ltmp; /* for ADD */
|
||||
ulongword utmp; /* for L_ADD */
|
||||
|
||||
register int k = 160;
|
||||
|
||||
while (k--) {
|
||||
|
||||
/* 4.2.1 Downscaling of the input signal
|
||||
*/
|
||||
SO = (word)SASR( *s, 3 ) << 2;
|
||||
s++;
|
||||
|
||||
assert (SO >= -0x4000); /* downscaled by */
|
||||
assert (SO <= 0x3FFC); /* previous routine. */
|
||||
|
||||
|
||||
/* 4.2.2 Offset compensation
|
||||
*
|
||||
* This part implements a high-pass filter and requires extended
|
||||
* arithmetic precision for the recursive part of this filter.
|
||||
* The input of this procedure is the array so[0...159] and the
|
||||
* output the array sof[ 0...159 ].
|
||||
*/
|
||||
/* Compute the non-recursive part
|
||||
*/
|
||||
|
||||
s1 = SO - z1; /* s1 = gsm_sub( *so, z1 ); */
|
||||
z1 = SO;
|
||||
|
||||
assert(s1 != MIN_WORD);
|
||||
|
||||
/* Compute the recursive part
|
||||
*/
|
||||
L_s2 = s1;
|
||||
L_s2 <<= 15;
|
||||
|
||||
/* Execution of a 31 bv 16 bits multiplication
|
||||
*/
|
||||
|
||||
msp = (word) SASR( L_z2, 15 );
|
||||
lsp = (word) (L_z2-((longword)msp<<15)); /* gsm_L_sub(L_z2,(msp<<15)); */
|
||||
|
||||
L_s2 += GSM_MULT_R( lsp, 32735 );
|
||||
L_temp = (longword)msp * 32735; /* GSM_L_MULT(msp,32735) >> 1;*/
|
||||
L_z2 = GSM_L_ADD( L_temp, L_s2 );
|
||||
|
||||
/* Compute sof[k] with rounding
|
||||
*/
|
||||
L_temp = GSM_L_ADD( L_z2, 16384 );
|
||||
|
||||
/* 4.2.3 Preemphasis
|
||||
*/
|
||||
|
||||
msp = (word) GSM_MULT_R( mp, -28180 );
|
||||
mp = (word) SASR( L_temp, 15 );
|
||||
*so++ = (word) GSM_ADD( mp, msp );
|
||||
}
|
||||
|
||||
S->z1 = z1;
|
||||
S->L_z2 = L_z2;
|
||||
S->mp = mp;
|
||||
}
|
|
@ -1,489 +0,0 @@
|
|||
/*
|
||||
* rpe.c
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "private.h"
|
||||
|
||||
#include "gsm.h"
|
||||
#include "proto.h"
|
||||
|
||||
/* 4.2.13 .. 4.2.17 RPE ENCODING SECTION
|
||||
*/
|
||||
|
||||
/* 4.2.13 */
|
||||
|
||||
static void Weighting_filter P2((e, x),
|
||||
register word * e, /* signal [-5..0.39.44] IN */
|
||||
word * x /* signal [0..39] OUT */
|
||||
)
|
||||
/*
|
||||
* The coefficients of the weighting filter are stored in a table
|
||||
* (see table 4.4). The following scaling is used:
|
||||
*
|
||||
* H[0..10] = integer( real_H[ 0..10] * 8192 );
|
||||
*/
|
||||
{
|
||||
/* word wt[ 50 ]; */
|
||||
|
||||
register longword L_result;
|
||||
register int k /* , i */ ;
|
||||
|
||||
/* Initialization of a temporary working array wt[0...49]
|
||||
*/
|
||||
|
||||
/* for (k = 0; k <= 4; k++) wt[k] = 0;
|
||||
* for (k = 5; k <= 44; k++) wt[k] = *e++;
|
||||
* for (k = 45; k <= 49; k++) wt[k] = 0;
|
||||
*
|
||||
* (e[-5..-1] and e[40..44] are allocated by the caller,
|
||||
* are initially zero and are not written anywhere.)
|
||||
*/
|
||||
e -= 5;
|
||||
|
||||
/* Compute the signal x[0..39]
|
||||
*/
|
||||
for (k = 0; k <= 39; k++) {
|
||||
|
||||
L_result = 8192 >> 1;
|
||||
|
||||
/* for (i = 0; i <= 10; i++) {
|
||||
* L_temp = GSM_L_MULT( wt[k+i], gsm_H[i] );
|
||||
* L_result = GSM_L_ADD( L_result, L_temp );
|
||||
* }
|
||||
*/
|
||||
|
||||
#undef STEP
|
||||
#define STEP( i, H ) (e[ k + i ] * (longword)H)
|
||||
|
||||
/* Every one of these multiplications is done twice --
|
||||
* but I don't see an elegant way to optimize this.
|
||||
* Do you?
|
||||
*/
|
||||
|
||||
#ifdef STUPID_COMPILER
|
||||
L_result += STEP( 0, -134 ) ;
|
||||
L_result += STEP( 1, -374 ) ;
|
||||
/* + STEP( 2, 0 ) */
|
||||
L_result += STEP( 3, 2054 ) ;
|
||||
L_result += STEP( 4, 5741 ) ;
|
||||
L_result += STEP( 5, 8192 ) ;
|
||||
L_result += STEP( 6, 5741 ) ;
|
||||
L_result += STEP( 7, 2054 ) ;
|
||||
/* + STEP( 8, 0 ) */
|
||||
L_result += STEP( 9, -374 ) ;
|
||||
L_result += STEP( 10, -134 ) ;
|
||||
#else
|
||||
L_result +=
|
||||
STEP( 0, -134 )
|
||||
+ STEP( 1, -374 )
|
||||
/* + STEP( 2, 0 ) */
|
||||
+ STEP( 3, 2054 )
|
||||
+ STEP( 4, 5741 )
|
||||
+ STEP( 5, 8192 )
|
||||
+ STEP( 6, 5741 )
|
||||
+ STEP( 7, 2054 )
|
||||
/* + STEP( 8, 0 ) */
|
||||
+ STEP( 9, -374 )
|
||||
+ STEP(10, -134 )
|
||||
;
|
||||
#endif
|
||||
|
||||
/* L_result = GSM_L_ADD( L_result, L_result ); (* scaling(x2) *)
|
||||
* L_result = GSM_L_ADD( L_result, L_result ); (* scaling(x4) *)
|
||||
*
|
||||
* x[k] = SASR( L_result, 16 );
|
||||
*/
|
||||
|
||||
/* 2 adds vs. >>16 => 14, minus one shift to compensate for
|
||||
* those we lost when replacing L_MULT by '*'.
|
||||
*/
|
||||
|
||||
L_result = SASR( L_result, 13 );
|
||||
x[k] = (word) (( L_result < MIN_WORD ? MIN_WORD
|
||||
: (L_result > MAX_WORD ? MAX_WORD : L_result )));
|
||||
}
|
||||
}
|
||||
|
||||
/* 4.2.14 */
|
||||
|
||||
static void RPE_grid_selection P3((x,xM,Mc_out),
|
||||
word * x, /* [0..39] IN */
|
||||
word * xM, /* [0..12] OUT */
|
||||
word * Mc_out /* OUT */
|
||||
)
|
||||
/*
|
||||
* The signal x[0..39] is used to select the RPE grid which is
|
||||
* represented by Mc.
|
||||
*/
|
||||
{
|
||||
/* register word temp1; */
|
||||
register int /* m, */ i;
|
||||
register longword L_result, L_temp;
|
||||
longword EM; /* xxx should be L_EM? */
|
||||
word Mc;
|
||||
|
||||
longword L_common_0_3;
|
||||
|
||||
EM = 0;
|
||||
Mc = 0;
|
||||
|
||||
/* for (m = 0; m <= 3; m++) {
|
||||
* L_result = 0;
|
||||
*
|
||||
*
|
||||
* for (i = 0; i <= 12; i++) {
|
||||
*
|
||||
* temp1 = SASR( x[m + 3*i], 2 );
|
||||
*
|
||||
* assert(temp1 != MIN_WORD);
|
||||
*
|
||||
* L_temp = GSM_L_MULT( temp1, temp1 );
|
||||
* L_result = GSM_L_ADD( L_temp, L_result );
|
||||
* }
|
||||
*
|
||||
* if (L_result > EM) {
|
||||
* Mc = m;
|
||||
* EM = L_result;
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
#undef STEP
|
||||
#define STEP( m, i ) L_temp = SASR( x[m + 3 * i], 2 ); \
|
||||
L_result += L_temp * L_temp;
|
||||
|
||||
/* common part of 0 and 3 */
|
||||
|
||||
L_result = 0;
|
||||
STEP( 0, 1 ); STEP( 0, 2 ); STEP( 0, 3 ); STEP( 0, 4 );
|
||||
STEP( 0, 5 ); STEP( 0, 6 ); STEP( 0, 7 ); STEP( 0, 8 );
|
||||
STEP( 0, 9 ); STEP( 0, 10); STEP( 0, 11); STEP( 0, 12);
|
||||
L_common_0_3 = L_result;
|
||||
|
||||
/* i = 0 */
|
||||
|
||||
STEP( 0, 0 );
|
||||
L_result <<= 1; /* implicit in L_MULT */
|
||||
EM = L_result;
|
||||
|
||||
/* i = 1 */
|
||||
|
||||
L_result = 0;
|
||||
STEP( 1, 0 );
|
||||
STEP( 1, 1 ); STEP( 1, 2 ); STEP( 1, 3 ); STEP( 1, 4 );
|
||||
STEP( 1, 5 ); STEP( 1, 6 ); STEP( 1, 7 ); STEP( 1, 8 );
|
||||
STEP( 1, 9 ); STEP( 1, 10); STEP( 1, 11); STEP( 1, 12);
|
||||
L_result <<= 1;
|
||||
if (L_result > EM) {
|
||||
Mc = 1;
|
||||
EM = L_result;
|
||||
}
|
||||
|
||||
/* i = 2 */
|
||||
|
||||
L_result = 0;
|
||||
STEP( 2, 0 );
|
||||
STEP( 2, 1 ); STEP( 2, 2 ); STEP( 2, 3 ); STEP( 2, 4 );
|
||||
STEP( 2, 5 ); STEP( 2, 6 ); STEP( 2, 7 ); STEP( 2, 8 );
|
||||
STEP( 2, 9 ); STEP( 2, 10); STEP( 2, 11); STEP( 2, 12);
|
||||
L_result <<= 1;
|
||||
if (L_result > EM) {
|
||||
Mc = 2;
|
||||
EM = L_result;
|
||||
}
|
||||
|
||||
/* i = 3 */
|
||||
|
||||
L_result = L_common_0_3;
|
||||
STEP( 3, 12 );
|
||||
L_result <<= 1;
|
||||
if (L_result > EM) {
|
||||
Mc = 3;
|
||||
EM = L_result;
|
||||
}
|
||||
|
||||
/**/
|
||||
|
||||
/* Down-sampling by a factor 3 to get the selected xM[0..12]
|
||||
* RPE sequence.
|
||||
*/
|
||||
for (i = 0; i <= 12; i ++) xM[i] = x[Mc + 3*i];
|
||||
*Mc_out = Mc;
|
||||
}
|
||||
|
||||
/* 4.12.15 */
|
||||
|
||||
static void APCM_quantization_xmaxc_to_exp_mant P3((xmaxc,exp_out,mant_out),
|
||||
word xmaxc, /* IN */
|
||||
word * exp_out, /* OUT */
|
||||
word * mant_out ) /* OUT */
|
||||
{
|
||||
word exp, mant;
|
||||
|
||||
/* Compute exponent and mantissa of the decoded version of xmaxc
|
||||
*/
|
||||
|
||||
exp = 0;
|
||||
if (xmaxc > 15) exp = (word)SASR(xmaxc, 3) - 1;
|
||||
mant = xmaxc - (exp << 3);
|
||||
|
||||
if (mant == 0) {
|
||||
exp = -4;
|
||||
mant = 7;
|
||||
}
|
||||
else {
|
||||
while (mant <= 7) {
|
||||
mant = mant << 1 | 1;
|
||||
exp--;
|
||||
}
|
||||
mant -= 8;
|
||||
}
|
||||
|
||||
assert( exp >= -4 && exp <= 6 );
|
||||
assert( mant >= 0 && mant <= 7 );
|
||||
|
||||
*exp_out = exp;
|
||||
*mant_out = mant;
|
||||
}
|
||||
|
||||
static void APCM_quantization P5((xM,xMc,mant_out,exp_out,xmaxc_out),
|
||||
word * xM, /* [0..12] IN */
|
||||
|
||||
word * xMc, /* [0..12] OUT */
|
||||
word * mant_out, /* OUT */
|
||||
word * exp_out, /* OUT */
|
||||
word * xmaxc_out /* OUT */
|
||||
)
|
||||
{
|
||||
int i, itest;
|
||||
|
||||
word xmax, xmaxc, temp, temp1, temp2;
|
||||
word exp, mant;
|
||||
|
||||
|
||||
/* Find the maximum absolute value xmax of xM[0..12].
|
||||
*/
|
||||
|
||||
xmax = 0;
|
||||
for (i = 0; i <= 12; i++) {
|
||||
temp = xM[i];
|
||||
temp = GSM_ABS(temp);
|
||||
if (temp > xmax) xmax = temp;
|
||||
}
|
||||
|
||||
/* Qantizing and coding of xmax to get xmaxc.
|
||||
*/
|
||||
|
||||
exp = 0;
|
||||
temp = (word)SASR( xmax, 9 );
|
||||
itest = 0;
|
||||
|
||||
for (i = 0; i <= 5; i++) {
|
||||
|
||||
itest |= (temp <= 0);
|
||||
temp = (word)SASR( temp, 1 );
|
||||
|
||||
assert(exp <= 5);
|
||||
if (itest == 0) exp++; /* exp = add (exp, 1) */
|
||||
}
|
||||
|
||||
assert(exp <= 6 && exp >= 0);
|
||||
temp = exp + 5;
|
||||
|
||||
assert(temp <= 11 && temp >= 0);
|
||||
xmaxc = gsm_add( SASR(xmax, temp), exp << 3 );
|
||||
|
||||
/* Quantizing and coding of the xM[0..12] RPE sequence
|
||||
* to get the xMc[0..12]
|
||||
*/
|
||||
|
||||
APCM_quantization_xmaxc_to_exp_mant( xmaxc, &exp, &mant );
|
||||
|
||||
/* This computation uses the fact that the decoded version of xmaxc
|
||||
* can be calculated by using the exponent and the mantissa part of
|
||||
* xmaxc (logarithmic table).
|
||||
* So, this method avoids any division and uses only a scaling
|
||||
* of the RPE samples by a function of the exponent. A direct
|
||||
* multiplication by the inverse of the mantissa (NRFAC[0..7]
|
||||
* found in table 4.5) gives the 3 bit coded version xMc[0..12]
|
||||
* of the RPE samples.
|
||||
*/
|
||||
|
||||
|
||||
/* Direct computation of xMc[0..12] using table 4.5
|
||||
*/
|
||||
|
||||
assert( exp <= 4096 && exp >= -4096);
|
||||
assert( mant >= 0 && mant <= 7 );
|
||||
|
||||
temp1 = 6 - exp; /* normalization by the exponent */
|
||||
temp2 = gsm_NRFAC[ mant ]; /* inverse mantissa */
|
||||
|
||||
for (i = 0; i <= 12; i++) {
|
||||
|
||||
assert(temp1 >= 0 && temp1 < 16);
|
||||
|
||||
temp = xM[i] << temp1;
|
||||
temp = (word) GSM_MULT( temp, temp2 );
|
||||
temp = (word)SASR(temp, 12);
|
||||
xMc[i] = temp + 4; /* see note below */
|
||||
}
|
||||
|
||||
/* NOTE: This equation is used to make all the xMc[i] positive.
|
||||
*/
|
||||
|
||||
*mant_out = mant;
|
||||
*exp_out = exp;
|
||||
*xmaxc_out = xmaxc;
|
||||
}
|
||||
|
||||
/* 4.2.16 */
|
||||
|
||||
static void APCM_inverse_quantization P4((xMc,mant,exp,xMp),
|
||||
register word * xMc, /* [0..12] IN */
|
||||
word mant,
|
||||
word exp,
|
||||
register word * xMp) /* [0..12] OUT */
|
||||
/*
|
||||
* This part is for decoding the RPE sequence of coded xMc[0..12]
|
||||
* samples to obtain the xMp[0..12] array. Table 4.6 is used to get
|
||||
* the mantissa of xmaxc (FAC[0..7]).
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
word temp, temp1, temp2, temp3;
|
||||
longword ltmp;
|
||||
|
||||
assert( mant >= 0 && mant <= 7 );
|
||||
|
||||
temp1 = gsm_FAC[ mant ]; /* see 4.2-15 for mant */
|
||||
temp2 = gsm_sub( 6, exp ); /* see 4.2-15 for exp */
|
||||
temp3 = gsm_asl( 1, gsm_sub( temp2, 1 ));
|
||||
|
||||
for (i = 13; i--;) {
|
||||
|
||||
assert( *xMc <= 7 && *xMc >= 0 ); /* 3 bit unsigned */
|
||||
|
||||
/* temp = gsm_sub( *xMc++ << 1, 7 ); */
|
||||
temp = (*xMc++ << 1) - 7; /* restore sign */
|
||||
assert( temp <= 7 && temp >= -7 ); /* 4 bit signed */
|
||||
|
||||
temp <<= 12; /* 16 bit signed */
|
||||
temp = (word) GSM_MULT_R( temp1, temp );
|
||||
temp = (word) GSM_ADD( temp, temp3 );
|
||||
*xMp++ = gsm_asr( temp, temp2 );
|
||||
}
|
||||
}
|
||||
|
||||
/* 4.2.17 */
|
||||
|
||||
static void RPE_grid_positioning P3((Mc,xMp,ep),
|
||||
word Mc, /* grid position IN */
|
||||
register word * xMp, /* [0..12] IN */
|
||||
register word * ep /* [0..39] OUT */
|
||||
)
|
||||
/*
|
||||
* This procedure computes the reconstructed long term residual signal
|
||||
* ep[0..39] for the LTP analysis filter. The inputs are the Mc
|
||||
* which is the grid position selection and the xMp[0..12] decoded
|
||||
* RPE samples which are upsampled by a factor of 3 by inserting zero
|
||||
* values.
|
||||
*/
|
||||
{
|
||||
int i = 13;
|
||||
|
||||
assert(0 <= Mc && Mc <= 3);
|
||||
|
||||
switch (Mc) {
|
||||
case 3: *ep++ = 0;
|
||||
case 2: do {
|
||||
*ep++ = 0;
|
||||
case 1: *ep++ = 0;
|
||||
case 0: *ep++ = *xMp++;
|
||||
} while (--i);
|
||||
}
|
||||
while (++Mc < 4) *ep++ = 0;
|
||||
|
||||
/*
|
||||
|
||||
int i, k;
|
||||
for (k = 0; k <= 39; k++) ep[k] = 0;
|
||||
for (i = 0; i <= 12; i++) {
|
||||
ep[ Mc + (3*i) ] = xMp[i];
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/* 4.2.18 */
|
||||
|
||||
/* This procedure adds the reconstructed long term residual signal
|
||||
* ep[0..39] to the estimated signal dpp[0..39] from the long term
|
||||
* analysis filter to compute the reconstructed short term residual
|
||||
* signal dp[-40..-1]; also the reconstructed short term residual
|
||||
* array dp[-120..-41] is updated.
|
||||
*/
|
||||
|
||||
#if 0 /* Has been inlined in code.c */
|
||||
void Gsm_Update_of_reconstructed_short_time_residual_signal P3((dpp, ep, dp),
|
||||
word * dpp, /* [0...39] IN */
|
||||
word * ep, /* [0...39] IN */
|
||||
word * dp) /* [-120...-1] IN/OUT */
|
||||
{
|
||||
int k;
|
||||
|
||||
for (k = 0; k <= 79; k++)
|
||||
dp[ -120 + k ] = dp[ -80 + k ];
|
||||
|
||||
for (k = 0; k <= 39; k++)
|
||||
dp[ -40 + k ] = gsm_add( ep[k], dpp[k] );
|
||||
}
|
||||
#endif /* Has been inlined in code.c */
|
||||
|
||||
void Gsm_RPE_Encoding P5((S,e,xmaxc,Mc,xMc),
|
||||
|
||||
struct gsm_state * S,
|
||||
|
||||
word * e, /* -5..-1][0..39][40..44 IN/OUT */
|
||||
word * xmaxc, /* OUT */
|
||||
word * Mc, /* OUT */
|
||||
word * xMc) /* [0..12] OUT */
|
||||
{
|
||||
word x[40];
|
||||
word xM[13], xMp[13];
|
||||
word mant, exp;
|
||||
|
||||
Weighting_filter(e, x);
|
||||
RPE_grid_selection(x, xM, Mc);
|
||||
|
||||
APCM_quantization( xM, xMc, &mant, &exp, xmaxc);
|
||||
APCM_inverse_quantization( xMc, mant, exp, xMp);
|
||||
|
||||
RPE_grid_positioning( *Mc, xMp, e );
|
||||
|
||||
}
|
||||
|
||||
void Gsm_RPE_Decoding P5((S, xmaxcr, Mcr, xMcr, erp),
|
||||
struct gsm_state * S,
|
||||
|
||||
word xmaxcr,
|
||||
word Mcr,
|
||||
word * xMcr, /* [0..12], 3 bits IN */
|
||||
word * erp /* [0..39] OUT */
|
||||
)
|
||||
{
|
||||
word exp, mant;
|
||||
word xMp[ 13 ];
|
||||
|
||||
APCM_quantization_xmaxc_to_exp_mant( xmaxcr, &exp, &mant );
|
||||
APCM_inverse_quantization( xMcr, mant, exp, xMp );
|
||||
RPE_grid_positioning( Mcr, xMp, erp );
|
||||
|
||||
}
|
|
@ -1,430 +0,0 @@
|
|||
/*
|
||||
* short_term.c
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "private.h"
|
||||
|
||||
#include "gsm.h"
|
||||
#include "proto.h"
|
||||
|
||||
/*
|
||||
* SHORT TERM ANALYSIS FILTERING SECTION
|
||||
*/
|
||||
|
||||
/* 4.2.8 */
|
||||
|
||||
static void Decoding_of_the_coded_Log_Area_Ratios P2((LARc,LARpp),
|
||||
word * LARc, /* coded log area ratio [0..7] IN */
|
||||
word * LARpp) /* out: decoded .. */
|
||||
{
|
||||
register word temp1 /* , temp2 */;
|
||||
register long ltmp; /* for GSM_ADD */
|
||||
|
||||
/* This procedure requires for efficient implementation
|
||||
* two tables.
|
||||
*
|
||||
* INVA[1..8] = integer( (32768 * 8) / real_A[1..8])
|
||||
* MIC[1..8] = minimum value of the LARc[1..8]
|
||||
*/
|
||||
|
||||
/* Compute the LARpp[1..8]
|
||||
*/
|
||||
|
||||
/* for (i = 1; i <= 8; i++, B++, MIC++, INVA++, LARc++, LARpp++) {
|
||||
*
|
||||
* temp1 = GSM_ADD( *LARc, *MIC ) << 10;
|
||||
* temp2 = *B << 1;
|
||||
* temp1 = GSM_SUB( temp1, temp2 );
|
||||
*
|
||||
* assert(*INVA != MIN_WORD);
|
||||
*
|
||||
* temp1 = GSM_MULT_R( *INVA, temp1 );
|
||||
* *LARpp = GSM_ADD( temp1, temp1 );
|
||||
* }
|
||||
*/
|
||||
|
||||
#undef STEP
|
||||
#define STEP( B, MIC, INVA ) \
|
||||
temp1 = (word) GSM_ADD( *LARc++, MIC ) << 10; \
|
||||
temp1 = (word) GSM_SUB( temp1, B << 1 ); \
|
||||
temp1 = (word) GSM_MULT_R( INVA, temp1 ); \
|
||||
*LARpp++ = (word) GSM_ADD( temp1, temp1 );
|
||||
|
||||
STEP( 0, -32, 13107 );
|
||||
STEP( 0, -32, 13107 );
|
||||
STEP( 2048, -16, 13107 );
|
||||
STEP( -2560, -16, 13107 );
|
||||
|
||||
STEP( 94, -8, 19223 );
|
||||
STEP( -1792, -8, 17476 );
|
||||
STEP( -341, -4, 31454 );
|
||||
STEP( -1144, -4, 29708 );
|
||||
|
||||
/* NOTE: the addition of *MIC is used to restore
|
||||
* the sign of *LARc.
|
||||
*/
|
||||
}
|
||||
|
||||
/* 4.2.9 */
|
||||
/* Computation of the quantized reflection coefficients
|
||||
*/
|
||||
|
||||
/* 4.2.9.1 Interpolation of the LARpp[1..8] to get the LARp[1..8]
|
||||
*/
|
||||
|
||||
/*
|
||||
* Within each frame of 160 analyzed speech samples the short term
|
||||
* analysis and synthesis filters operate with four different sets of
|
||||
* coefficients, derived from the previous set of decoded LARs(LARpp(j-1))
|
||||
* and the actual set of decoded LARs (LARpp(j))
|
||||
*
|
||||
* (Initial value: LARpp(j-1)[1..8] = 0.)
|
||||
*/
|
||||
|
||||
static void Coefficients_0_12 P3((LARpp_j_1, LARpp_j, LARp),
|
||||
register word * LARpp_j_1,
|
||||
register word * LARpp_j,
|
||||
register word * LARp)
|
||||
{
|
||||
register int i;
|
||||
register longword ltmp;
|
||||
|
||||
for (i = 1; i <= 8; i++, LARp++, LARpp_j_1++, LARpp_j++) {
|
||||
*LARp = (word) GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 ));
|
||||
*LARp = (word) GSM_ADD( *LARp, SASR( *LARpp_j_1, 1));
|
||||
}
|
||||
}
|
||||
|
||||
static void Coefficients_13_26 P3((LARpp_j_1, LARpp_j, LARp),
|
||||
register word * LARpp_j_1,
|
||||
register word * LARpp_j,
|
||||
register word * LARp)
|
||||
{
|
||||
register int i;
|
||||
register longword ltmp;
|
||||
for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) {
|
||||
*LARp = (word) GSM_ADD( SASR( *LARpp_j_1, 1), SASR( *LARpp_j, 1 ));
|
||||
}
|
||||
}
|
||||
|
||||
static void Coefficients_27_39 P3((LARpp_j_1, LARpp_j, LARp),
|
||||
register word * LARpp_j_1,
|
||||
register word * LARpp_j,
|
||||
register word * LARp)
|
||||
{
|
||||
register int i;
|
||||
register longword ltmp;
|
||||
|
||||
for (i = 1; i <= 8; i++, LARpp_j_1++, LARpp_j++, LARp++) {
|
||||
*LARp = (word) GSM_ADD( SASR( *LARpp_j_1, 2 ), SASR( *LARpp_j, 2 ));
|
||||
*LARp = (word) GSM_ADD( *LARp, SASR( *LARpp_j, 1 ));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void Coefficients_40_159 P2((LARpp_j, LARp),
|
||||
register word * LARpp_j,
|
||||
register word * LARp)
|
||||
{
|
||||
register int i;
|
||||
|
||||
for (i = 1; i <= 8; i++, LARp++, LARpp_j++)
|
||||
*LARp = *LARpp_j;
|
||||
}
|
||||
|
||||
/* 4.2.9.2 */
|
||||
|
||||
static void LARp_to_rp P1((LARp),
|
||||
register word * LARp) /* [0..7] IN/OUT */
|
||||
/*
|
||||
* The input of this procedure is the interpolated LARp[0..7] array.
|
||||
* The reflection coefficients, rp[i], are used in the analysis
|
||||
* filter and in the synthesis filter.
|
||||
*/
|
||||
{
|
||||
register int i;
|
||||
register word temp;
|
||||
register longword ltmp;
|
||||
|
||||
for (i = 1; i <= 8; i++, LARp++) {
|
||||
|
||||
/* temp = GSM_ABS( *LARp );
|
||||
*
|
||||
* if (temp < 11059) temp <<= 1;
|
||||
* else if (temp < 20070) temp += 11059;
|
||||
* else temp = GSM_ADD( temp >> 2, 26112 );
|
||||
*
|
||||
* *LARp = *LARp < 0 ? -temp : temp;
|
||||
*/
|
||||
|
||||
if (*LARp < 0) {
|
||||
temp = *LARp == MIN_WORD ? MAX_WORD : -(*LARp);
|
||||
*LARp =(word)( - ((temp < 11059) ? (word)(temp << 1)
|
||||
: ((temp < 20070) ? (word)(temp + 11059)
|
||||
: (word) GSM_ADD( temp >> 2, 26112 ))));
|
||||
} else {
|
||||
temp = *LARp;
|
||||
*LARp = (temp < 11059) ? temp << 1
|
||||
: ((temp < 20070) ? temp + 11059
|
||||
: (word) GSM_ADD( temp >> 2, 26112 ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 4.2.10 */
|
||||
static void Short_term_analysis_filtering P4((S,rp,k_n,s),
|
||||
struct gsm_state * S,
|
||||
register word * rp, /* [0..7] IN */
|
||||
register int k_n, /* k_end - k_start */
|
||||
register word * s /* [0..n-1] IN/OUT */
|
||||
)
|
||||
/*
|
||||
* This procedure computes the short term residual signal d[..] to be fed
|
||||
* to the RPE-LTP loop from the s[..] signal and from the local rp[..]
|
||||
* array (quantized reflection coefficients). As the call of this
|
||||
* procedure can be done in many ways (see the interpolation of the LAR
|
||||
* coefficient), it is assumed that the computation begins with index
|
||||
* k_start (for arrays d[..] and s[..]) and stops with index k_end
|
||||
* (k_start and k_end are defined in 4.2.9.1). This procedure also
|
||||
* needs to keep the array u[0..7] in memory for each call.
|
||||
*/
|
||||
{
|
||||
register word * u = S->u;
|
||||
register int i;
|
||||
register word di, zzz, ui, sav, rpi;
|
||||
register longword ltmp;
|
||||
|
||||
for (; k_n--; s++) {
|
||||
|
||||
di = sav = *s;
|
||||
|
||||
for (i = 0; i < 8; i++) { /* YYY */
|
||||
|
||||
ui = u[i];
|
||||
rpi = rp[i];
|
||||
u[i] = sav;
|
||||
|
||||
zzz = (word) GSM_MULT_R(rpi, di);
|
||||
sav = (word) GSM_ADD( ui, zzz);
|
||||
|
||||
zzz = (word) GSM_MULT_R(rpi, ui);
|
||||
di = (word) GSM_ADD( di, zzz );
|
||||
}
|
||||
|
||||
*s = di;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(USE_FLOAT_MUL) && defined(FAST)
|
||||
|
||||
static void Fast_Short_term_analysis_filtering P4((S,rp,k_n,s),
|
||||
struct gsm_state * S,
|
||||
register word * rp, /* [0..7] IN */
|
||||
register int k_n, /* k_end - k_start */
|
||||
register word * s /* [0..n-1] IN/OUT */
|
||||
)
|
||||
{
|
||||
register word * u = S->u;
|
||||
register int i;
|
||||
|
||||
float uf[8],
|
||||
rpf[8];
|
||||
|
||||
register float scalef = 3.0517578125e-5;
|
||||
register float sav, di, temp;
|
||||
|
||||
for (i = 0; i < 8; ++i) {
|
||||
uf[i] = u[i];
|
||||
rpf[i] = rp[i] * scalef;
|
||||
}
|
||||
for (; k_n--; s++) {
|
||||
sav = di = *s;
|
||||
for (i = 0; i < 8; ++i) {
|
||||
register float rpfi = rpf[i];
|
||||
register float ufi = uf[i];
|
||||
|
||||
uf[i] = sav;
|
||||
temp = rpfi * di + ufi;
|
||||
di += rpfi * ufi;
|
||||
sav = temp;
|
||||
}
|
||||
*s = di;
|
||||
}
|
||||
for (i = 0; i < 8; ++i) u[i] = uf[i];
|
||||
}
|
||||
#endif /* ! (defined (USE_FLOAT_MUL) && defined (FAST)) */
|
||||
|
||||
static void Short_term_synthesis_filtering P5((S,rrp,k,wt,sr),
|
||||
struct gsm_state * S,
|
||||
register word * rrp, /* [0..7] IN */
|
||||
register int k, /* k_end - k_start */
|
||||
register word * wt, /* [0..k-1] IN */
|
||||
register word * sr /* [0..k-1] OUT */
|
||||
)
|
||||
{
|
||||
register word * v = S->v;
|
||||
register int i;
|
||||
register word sri, tmp1, tmp2;
|
||||
register longword ltmp; /* for GSM_ADD & GSM_SUB */
|
||||
|
||||
while (k--) {
|
||||
sri = *wt++;
|
||||
for (i = 8; i--;) {
|
||||
|
||||
/* sri = GSM_SUB( sri, gsm_mult_r( rrp[i], v[i] ) );
|
||||
*/
|
||||
tmp1 = rrp[i];
|
||||
tmp2 = v[i];
|
||||
tmp2 = (word) ( tmp1 == MIN_WORD && tmp2 == MIN_WORD
|
||||
? MAX_WORD
|
||||
: 0x0FFFF & (( (longword)tmp1 * (longword)tmp2
|
||||
+ 16384) >> 15)) ;
|
||||
|
||||
sri = (word) GSM_SUB( sri, tmp2 );
|
||||
|
||||
/* v[i+1] = GSM_ADD( v[i], gsm_mult_r( rrp[i], sri ) );
|
||||
*/
|
||||
tmp1 = (word) ( tmp1 == MIN_WORD && sri == MIN_WORD
|
||||
? MAX_WORD
|
||||
: 0x0FFFF & (( (longword)tmp1 * (longword)sri
|
||||
+ 16384) >> 15)) ;
|
||||
|
||||
v[i+1] = (word) GSM_ADD( v[i], tmp1);
|
||||
}
|
||||
*sr++ = v[0] = sri;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(FAST) && defined(USE_FLOAT_MUL)
|
||||
|
||||
static void Fast_Short_term_synthesis_filtering P5((S,rrp,k,wt,sr),
|
||||
struct gsm_state * S,
|
||||
register word * rrp, /* [0..7] IN */
|
||||
register int k, /* k_end - k_start */
|
||||
register word * wt, /* [0..k-1] IN */
|
||||
register word * sr /* [0..k-1] OUT */
|
||||
)
|
||||
{
|
||||
register word * v = S->v;
|
||||
register int i;
|
||||
|
||||
float va[9], rrpa[8];
|
||||
register float scalef = 3.0517578125e-5, temp;
|
||||
|
||||
for (i = 0; i < 8; ++i) {
|
||||
va[i] = v[i];
|
||||
rrpa[i] = (float)rrp[i] * scalef;
|
||||
}
|
||||
while (k--) {
|
||||
register float sri = *wt++;
|
||||
for (i = 8; i--;) {
|
||||
sri -= rrpa[i] * va[i];
|
||||
if (sri < -32768.) sri = -32768.;
|
||||
else if (sri > 32767.) sri = 32767.;
|
||||
|
||||
temp = va[i] + rrpa[i] * sri;
|
||||
if (temp < -32768.) temp = -32768.;
|
||||
else if (temp > 32767.) temp = 32767.;
|
||||
va[i+1] = temp;
|
||||
}
|
||||
*sr++ = va[0] = sri;
|
||||
}
|
||||
for (i = 0; i < 9; ++i) v[i] = va[i];
|
||||
}
|
||||
|
||||
#endif /* defined(FAST) && defined(USE_FLOAT_MUL) */
|
||||
|
||||
void Gsm_Short_Term_Analysis_Filter P3((S,LARc,s),
|
||||
|
||||
struct gsm_state * S,
|
||||
|
||||
word * LARc, /* coded log area ratio [0..7] IN */
|
||||
word * s /* signal [0..159] IN/OUT */
|
||||
)
|
||||
{
|
||||
word * LARpp_j = S->LARpp[ S->j ];
|
||||
word * LARpp_j_1 = S->LARpp[ S->j ^= 1 ];
|
||||
|
||||
word LARp[8];
|
||||
|
||||
#undef FILTER
|
||||
#if defined(FAST) && defined(USE_FLOAT_MUL)
|
||||
# define FILTER (* (S->fast \
|
||||
? Fast_Short_term_analysis_filtering \
|
||||
: Short_term_analysis_filtering ))
|
||||
|
||||
#else
|
||||
# define FILTER Short_term_analysis_filtering
|
||||
#endif
|
||||
|
||||
Decoding_of_the_coded_Log_Area_Ratios( LARc, LARpp_j );
|
||||
|
||||
Coefficients_0_12( LARpp_j_1, LARpp_j, LARp );
|
||||
LARp_to_rp( LARp );
|
||||
FILTER( S, LARp, 13, s);
|
||||
|
||||
Coefficients_13_26( LARpp_j_1, LARpp_j, LARp);
|
||||
LARp_to_rp( LARp );
|
||||
FILTER( S, LARp, 14, s + 13);
|
||||
|
||||
Coefficients_27_39( LARpp_j_1, LARpp_j, LARp);
|
||||
LARp_to_rp( LARp );
|
||||
FILTER( S, LARp, 13, s + 27);
|
||||
|
||||
Coefficients_40_159( LARpp_j, LARp);
|
||||
LARp_to_rp( LARp );
|
||||
FILTER( S, LARp, 120, s + 40);
|
||||
}
|
||||
|
||||
void Gsm_Short_Term_Synthesis_Filter P4((S, LARcr, wt, s),
|
||||
struct gsm_state * S,
|
||||
|
||||
word * LARcr, /* received log area ratios [0..7] IN */
|
||||
word * wt, /* received d [0..159] IN */
|
||||
|
||||
word * s /* signal s [0..159] OUT */
|
||||
)
|
||||
{
|
||||
word * LARpp_j = S->LARpp[ S->j ];
|
||||
word * LARpp_j_1 = S->LARpp[ S->j ^=1 ];
|
||||
|
||||
word LARp[8];
|
||||
|
||||
#undef FILTER
|
||||
#if defined(FAST) && defined(USE_FLOAT_MUL)
|
||||
|
||||
# define FILTER (* (S->fast \
|
||||
? Fast_Short_term_synthesis_filtering \
|
||||
: Short_term_synthesis_filtering ))
|
||||
#else
|
||||
# define FILTER Short_term_synthesis_filtering
|
||||
#endif
|
||||
|
||||
Decoding_of_the_coded_Log_Area_Ratios( LARcr, LARpp_j );
|
||||
|
||||
Coefficients_0_12( LARpp_j_1, LARpp_j, LARp );
|
||||
LARp_to_rp( LARp );
|
||||
FILTER( S, LARp, 13, wt, s );
|
||||
|
||||
Coefficients_13_26( LARpp_j_1, LARpp_j, LARp);
|
||||
LARp_to_rp( LARp );
|
||||
FILTER( S, LARp, 14, wt + 13, s + 13 );
|
||||
|
||||
Coefficients_27_39( LARpp_j_1, LARpp_j, LARp);
|
||||
LARp_to_rp( LARp );
|
||||
FILTER( S, LARp, 13, wt + 27, s + 27 );
|
||||
|
||||
Coefficients_40_159( LARpp_j, LARp );
|
||||
LARp_to_rp( LARp );
|
||||
FILTER(S, LARp, 120, wt + 40, s + 40);
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* table.c
|
||||
*
|
||||
* Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
|
||||
* Universitaet Berlin. See the accompanying file "COPYRIGHT" for
|
||||
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
/* Most of these tables are inlined at their point of use.
|
||||
*/
|
||||
|
||||
/* 4.4 TABLES USED IN THE FIXED POINT IMPLEMENTATION OF THE RPE-LTP
|
||||
* CODER AND DECODER
|
||||
*
|
||||
* (Most of them inlined, so watch out.)
|
||||
*/
|
||||
|
||||
#define GSM_TABLE_C
|
||||
#include "private.h"
|
||||
#include "gsm.h"
|
||||
|
||||
/* Table 4.1 Quantization of the Log.-Area Ratios
|
||||
*/
|
||||
/* i 1 2 3 4 5 6 7 8 */
|
||||
word gsm_A[8] = {20480, 20480, 20480, 20480, 13964, 15360, 8534, 9036};
|
||||
word gsm_B[8] = { 0, 0, 2048, -2560, 94, -1792, -341, -1144};
|
||||
word gsm_MIC[8] = { -32, -32, -16, -16, -8, -8, -4, -4 };
|
||||
word gsm_MAC[8] = { 31, 31, 15, 15, 7, 7, 3, 3 };
|
||||
|
||||
|
||||
/* Table 4.2 Tabulation of 1/A[1..8]
|
||||
*/
|
||||
word gsm_INVA[8]={ 13107, 13107, 13107, 13107, 19223, 17476, 31454, 29708 };
|
||||
|
||||
|
||||
/* Table 4.3a Decision level of the LTP gain quantizer
|
||||
*/
|
||||
/* bc 0 1 2 3 */
|
||||
word gsm_DLB[4] = { 6554, 16384, 26214, 32767 };
|
||||
|
||||
|
||||
/* Table 4.3b Quantization levels of the LTP gain quantizer
|
||||
*/
|
||||
/* bc 0 1 2 3 */
|
||||
word gsm_QLB[4] = { 3277, 11469, 21299, 32767 };
|
||||
|
||||
|
||||
/* Table 4.4 Coefficients of the weighting filter
|
||||
*/
|
||||
/* i 0 1 2 3 4 5 6 7 8 9 10 */
|
||||
word gsm_H[11] = {-134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134 };
|
||||
|
||||
|
||||
/* Table 4.5 Normalized inverse mantissa used to compute xM/xmax
|
||||
*/
|
||||
/* i 0 1 2 3 4 5 6 7 */
|
||||
word gsm_NRFAC[8] = { 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384 };
|
||||
|
||||
|
||||
/* Table 4.6 Normalized direct mantissa used to compute xM/xmax
|
||||
*/
|
||||
/* i 0 1 2 3 4 5 6 7 */
|
||||
word gsm_FAC[8] = { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 };
|
|
@ -1,10 +0,0 @@
|
|||
BASE=../../../..
|
||||
G7XX_DIR=$(BASE)/libs/codec/g7xx
|
||||
G7XXLA=$(G7XX_DIR)/libg7xx.la
|
||||
LOCAL_CFLAGS=-I$(G7XX_DIR)/src/include/
|
||||
LOCAL_LIBADD=$(G7XXLA)
|
||||
include $(BASE)/build/modmake.rules
|
||||
|
||||
$(G7XXLA): $(G7XX_DIR) $(G7XX_DIR)/.update
|
||||
cd $(G7XX_DIR) && $(MAKE)
|
||||
$(TOUCH_TARGET)
|
|
@ -1,156 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="mod_g722"
|
||||
ProjectGUID="{D42518CC-7475-454D-B392-0E132C07D761}"
|
||||
RootNamespace="mod_g722"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\g7xx\src\include""
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories=""..\..\..\..\libs\codec\g726\$(OutDir)""
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\g7xx\src\include""
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories=""..\..\..\..\libs\codec\g726\$(OutDir)""
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="mod_g722.c"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,155 +0,0 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / G722 codec module
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Brian K. West <brian.west@mac.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Brian K. West <brian.west@mac.com>
|
||||
* Anthony Minessale II <anthmct@yahoo.com>
|
||||
* Michael Jerris <mike@jerris.com>
|
||||
*
|
||||
* mod_g722.c -- G.722 Codec Module
|
||||
*
|
||||
*/
|
||||
|
||||
#include <switch.h>
|
||||
#include "g7xx/g722.h"
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_g722_load);
|
||||
SWITCH_MODULE_DEFINITION(mod_g722, mod_g722_load, NULL, NULL);
|
||||
|
||||
struct g722_context {
|
||||
g722_decode_state_t decoder_object;
|
||||
g722_encode_state_t encoder_object;
|
||||
};
|
||||
|
||||
static switch_status_t switch_g722_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
int encoding, decoding;
|
||||
struct g722_context *context = NULL;
|
||||
|
||||
encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
|
||||
decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
|
||||
|
||||
if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(struct g722_context))))) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
} else {
|
||||
if (encoding) {
|
||||
if (codec->implementation->actual_samples_per_second == 16000) {
|
||||
g722_encode_init(&context->encoder_object, 64000, G722_PACKED);
|
||||
} else {
|
||||
g722_encode_init(&context->encoder_object, 64000, G722_SAMPLE_RATE_8000);
|
||||
}
|
||||
}
|
||||
if (decoding) {
|
||||
if (codec->implementation->actual_samples_per_second == 16000) {
|
||||
g722_decode_init(&context->decoder_object, 64000, G722_PACKED);
|
||||
} else {
|
||||
g722_decode_init(&context->decoder_object, 64000, G722_SAMPLE_RATE_8000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
codec->private_info = context;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t switch_g722_encode(switch_codec_t *codec,
|
||||
switch_codec_t *other_codec,
|
||||
void *decoded_data,
|
||||
uint32_t decoded_data_len,
|
||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
|
||||
unsigned int *flag)
|
||||
{
|
||||
struct g722_context *context = codec->private_info;
|
||||
|
||||
if (!context) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
*encoded_data_len = g722_encode(&context->encoder_object, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t switch_g722_decode(switch_codec_t *codec,
|
||||
switch_codec_t *other_codec,
|
||||
void *encoded_data,
|
||||
uint32_t encoded_data_len,
|
||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
|
||||
unsigned int *flag)
|
||||
{
|
||||
struct g722_context *context = codec->private_info;
|
||||
|
||||
if (!context) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
*decoded_data_len = (2 * g722_decode(&context->decoder_object, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t switch_g722_destroy(switch_codec_t *codec)
|
||||
{
|
||||
/* We do not need to use release here as the pool memory is taken care of for us */
|
||||
codec->private_info = NULL;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_g722_load)
|
||||
{
|
||||
switch_codec_interface_t *codec_interface;
|
||||
int mpf = 10000, spf = 80, bpf = 320, ebpf = 80, count;
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
|
||||
SWITCH_ADD_CODEC(codec_interface, "G.722");
|
||||
for (count = 12; count > 0; count--) {
|
||||
switch_core_codec_add_implementation(pool, codec_interface,
|
||||
SWITCH_CODEC_TYPE_AUDIO, 9, "G722", NULL, 8000, 16000, 64000,
|
||||
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
|
||||
switch_g722_init, switch_g722_encode, switch_g722_decode, switch_g722_destroy);
|
||||
}
|
||||
SWITCH_ADD_CODEC(codec_interface, "G.722_8");
|
||||
for (count = 12; count > 0; count--) {
|
||||
switch_core_codec_add_implementation(pool, codec_interface,
|
||||
SWITCH_CODEC_TYPE_AUDIO, 109, "G722_8", NULL, 8000, 8000, 64000,
|
||||
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
|
||||
switch_g722_init, switch_g722_encode, switch_g722_decode, switch_g722_destroy);
|
||||
}
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
|
||||
*/
|
|
@ -1,61 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="mod_g722"
|
||||
ProjectGUID="{D42518CC-7475-454D-B392-0E132C07D761}"
|
||||
RootNamespace="mod_g722"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\g7xx\src\include""
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories=""..\..\..\..\libs\codec\g726\$(OutDir)""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\g7xx\src\include""
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories=""..\..\..\..\libs\codec\g726\$(OutDir)""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="mod_g722.c"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,10 +0,0 @@
|
|||
BASE=../../../..
|
||||
G7XX_DIR=$(BASE)/libs/codec/g7xx
|
||||
G7XXLA=$(G7XX_DIR)/libg7xx.la
|
||||
LOCAL_CFLAGS=-I$(G7XX_DIR)/src/include/
|
||||
LOCAL_LIBADD=$(G7XXLA)
|
||||
include $(BASE)/build/modmake.rules
|
||||
|
||||
$(G7XXLA): $(G7XX_DIR) $(G7XX_DIR)/.update
|
||||
cd $(G7XX_DIR) && $(MAKE)
|
||||
$(TOUCH_TARGET)
|
|
@ -1,156 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="mod_g726"
|
||||
ProjectGUID="{486369EB-F150-4B56-BCC8-77B9E18FF5F5}"
|
||||
RootNamespace="mod_g726"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\g7xx\src\include""
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories=""..\..\..\..\libs\codec\g726\$(OutDir)""
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\g7xx\src\include""
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories=""..\..\..\..\libs\codec\g726\$(OutDir)""
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="mod_g726.c"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,190 +0,0 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Anthony Minessale II <anthmct@yahoo.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Brian K. West <brian.west@mac.com>
|
||||
*
|
||||
*
|
||||
* mod_g726.c -- G726 Codec Module
|
||||
*
|
||||
*/
|
||||
#include "switch.h"
|
||||
#include "g7xx/g726.h"
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_g726_load);
|
||||
SWITCH_MODULE_DEFINITION(mod_g726, mod_g726_load, NULL, NULL);
|
||||
|
||||
static switch_status_t switch_g726_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
uint32_t encoding, decoding;
|
||||
int packing = G726_PACKING_RIGHT;
|
||||
g726_state_t *context;
|
||||
|
||||
encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
|
||||
decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
|
||||
|
||||
if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context))))) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
} else {
|
||||
if ((flags & SWITCH_CODEC_FLAG_AAL2 || strstr(codec->implementation->iananame, "AAL2"))) {
|
||||
packing = G726_PACKING_LEFT;
|
||||
}
|
||||
|
||||
g726_init(context, codec->implementation->bits_per_second, G726_ENCODING_LINEAR, packing);
|
||||
|
||||
codec->private_info = context;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
static switch_status_t switch_g726_destroy(switch_codec_t *codec)
|
||||
{
|
||||
codec->private_info = NULL;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t switch_g726_encode(switch_codec_t *codec,
|
||||
switch_codec_t *other_codec,
|
||||
void *decoded_data,
|
||||
uint32_t decoded_data_len,
|
||||
uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
|
||||
unsigned int *flag)
|
||||
{
|
||||
g726_state_t *context = codec->private_info;
|
||||
|
||||
if (!context) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
*encoded_data_len = g726_encode(context, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t switch_g726_decode(switch_codec_t *codec,
|
||||
switch_codec_t *other_codec,
|
||||
void *encoded_data,
|
||||
uint32_t encoded_data_len,
|
||||
uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
|
||||
unsigned int *flag)
|
||||
{
|
||||
g726_state_t *context = codec->private_info;
|
||||
|
||||
if (!context) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
*decoded_data_len = (2 * g726_decode(context, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_g726_load)
|
||||
{
|
||||
switch_codec_interface_t *codec_interface;
|
||||
int mpf = 10000, spf = 80, bpf = 160, ebpf = 20, count;
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
|
||||
SWITCH_ADD_CODEC(codec_interface, "G.726 16k (AAL2)");
|
||||
for (count = 12; count > 0; count--) {
|
||||
switch_core_codec_add_implementation(pool, codec_interface,
|
||||
SWITCH_CODEC_TYPE_AUDIO, 124, "AAL2-G726-16", NULL, 8000, 8000, 16000,
|
||||
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
|
||||
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
|
||||
}
|
||||
SWITCH_ADD_CODEC(codec_interface, "G.726 16k");
|
||||
for (count = 12; count > 0; count--) {
|
||||
switch_core_codec_add_implementation(pool, codec_interface,
|
||||
SWITCH_CODEC_TYPE_AUDIO, 127, "G726-16", NULL, 8000, 8000, 16000,
|
||||
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
|
||||
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
|
||||
}
|
||||
/* Increase encoded bytes per frame by 10 */
|
||||
ebpf = ebpf + 10;
|
||||
|
||||
SWITCH_ADD_CODEC(codec_interface, "G.726 24k (AAL2)");
|
||||
for (count = 12; count > 0; count--) {
|
||||
switch_core_codec_add_implementation(pool, codec_interface,
|
||||
SWITCH_CODEC_TYPE_AUDIO, 123, "AAL2-G726-24", NULL, 8000, 8000, 24000,
|
||||
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
|
||||
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
|
||||
}
|
||||
SWITCH_ADD_CODEC(codec_interface, "G.726 24k");
|
||||
for (count = 12; count > 0; count--) {
|
||||
switch_core_codec_add_implementation(pool, codec_interface,
|
||||
SWITCH_CODEC_TYPE_AUDIO, 126, "G726-24", NULL, 8000, 8000, 24000,
|
||||
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
|
||||
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
|
||||
}
|
||||
/* Increase encoded bytes per frame by 10 */
|
||||
ebpf = ebpf + 10;
|
||||
|
||||
SWITCH_ADD_CODEC(codec_interface, "G.726 32k (AAL2)");
|
||||
for (count = 12; count > 0; count--) {
|
||||
switch_core_codec_add_implementation(pool, codec_interface,
|
||||
SWITCH_CODEC_TYPE_AUDIO, 2, "AAL2-G726-32", NULL, 8000, 8000, 32000,
|
||||
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
|
||||
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
|
||||
}
|
||||
SWITCH_ADD_CODEC(codec_interface, "G.726 32k");
|
||||
for (count = 12; count > 0; count--) {
|
||||
switch_core_codec_add_implementation(pool, codec_interface,
|
||||
SWITCH_CODEC_TYPE_AUDIO, 2, "G726-32", NULL, 8000, 8000, 32000,
|
||||
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
|
||||
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
|
||||
}
|
||||
/* Increase encoded bytes per frame by 10 */
|
||||
ebpf = ebpf + 10;
|
||||
|
||||
SWITCH_ADD_CODEC(codec_interface, "G.726 40k (AAL2)");
|
||||
for (count = 12; count > 0; count--) {
|
||||
switch_core_codec_add_implementation(pool, codec_interface,
|
||||
SWITCH_CODEC_TYPE_AUDIO, 122, "AAL2-G726-40", NULL, 8000, 8000, 40000,
|
||||
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
|
||||
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
|
||||
}
|
||||
SWITCH_ADD_CODEC(codec_interface, "G.726 40k");
|
||||
for (count = 12; count > 0; count--) {
|
||||
switch_core_codec_add_implementation(pool, codec_interface,
|
||||
SWITCH_CODEC_TYPE_AUDIO, 125, "G726-40", NULL, 8000, 8000, 40000,
|
||||
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
|
||||
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
|
||||
}
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
|
||||
*/
|
|
@ -1,157 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="mod_g726"
|
||||
ProjectGUID="{486369EB-F150-4B56-BCC8-77B9E18FF5F5}"
|
||||
RootNamespace="mod_g726"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\g7xx\src\include""
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories=""..\..\..\..\libs\codec\g726\$(OutDir)""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\g7xx\src\include""
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories=""..\..\..\..\libs\codec\g726\$(OutDir)""
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="mod_g726.c"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,10 +0,0 @@
|
|||
BASE=../../../..
|
||||
GSM_DIR=$(BASE)/libs/codec/gsm
|
||||
GSMLA=$(GSM_DIR)/libgsm.la
|
||||
LOCAL_CFLAGS=-I$(GSM_DIR)/inc
|
||||
LOCAL_LIBADD=$(GSMLA)
|
||||
include $(BASE)/build/modmake.rules
|
||||
|
||||
$(GSMLA): $(GSM_DIR) $(GSM_DIR)/.update
|
||||
cd $(GSM_DIR) && $(MAKE)
|
||||
$(TOUCH_TARGET)
|
|
@ -1,156 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="mod_gsm"
|
||||
ProjectGUID="{4926323F-4EA8-4B7D-A3D3-65488725988F}"
|
||||
RootNamespace="mod_gsm"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\gsm\inc""
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories=""..\..\..\..\libs\codec\gsm\$(OutDir)""
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\gsm\inc""
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories=""..\..\..\..\libs\codec\gsm\$(OutDir)""
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="mod_gsm.c"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,168 +0,0 @@
|
|||
/*
|
||||
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
|
||||
*
|
||||
* Version: MPL 1.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Anthony Minessale II <anthmct@yahoo.com>
|
||||
* Portions created by the Initial Developer are Copyright (C)
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Anthony Minessale II <anthmct@yahoo.com>
|
||||
* Michael Jerris <mike@jerris.com>
|
||||
*
|
||||
* mod_gsm.c -- GSM-FR Codec Module
|
||||
*
|
||||
*/
|
||||
|
||||
#include "switch.h"
|
||||
#include "gsm.h"
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_gsm_load);
|
||||
SWITCH_MODULE_DEFINITION(mod_gsm, mod_gsm_load, NULL, NULL);
|
||||
|
||||
struct gsm_context {
|
||||
gsm encoder;
|
||||
gsm decoder;
|
||||
};
|
||||
|
||||
static switch_status_t switch_gsm_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
|
||||
{
|
||||
struct gsm_context *context;
|
||||
int encoding, decoding;
|
||||
encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
|
||||
decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
|
||||
if (!(encoding || decoding)) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
} else {
|
||||
context = switch_core_alloc(codec->memory_pool, sizeof(*context));
|
||||
if (encoding)
|
||||
context->encoder = gsm_create();
|
||||
if (decoding)
|
||||
context->decoder = gsm_create();
|
||||
}
|
||||
codec->private_info = context;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t switch_gsm_destroy(switch_codec_t *codec)
|
||||
{
|
||||
struct gsm_context *context = codec->private_info;
|
||||
int encoding = (codec->flags & SWITCH_CODEC_FLAG_ENCODE);
|
||||
int decoding = (codec->flags & SWITCH_CODEC_FLAG_DECODE);
|
||||
if (encoding)
|
||||
gsm_destroy(context->encoder);
|
||||
if (decoding)
|
||||
gsm_destroy(context->decoder);
|
||||
codec->private_info = NULL;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t switch_gsm_encode(switch_codec_t *codec, switch_codec_t *other_codec, void *decoded_data,
|
||||
uint32_t decoded_data_len, uint32_t decoded_rate, void *encoded_data,
|
||||
uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
|
||||
{
|
||||
struct gsm_context *context = codec->private_info;
|
||||
if (!context) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
if (decoded_data_len % 320 == 0) {
|
||||
uint32_t new_len = 0;
|
||||
gsm_signal *ddp = decoded_data;
|
||||
gsm_byte *edp = encoded_data;
|
||||
int x;
|
||||
int loops = (int) decoded_data_len / 320;
|
||||
for (x = 0; x < loops && new_len < *encoded_data_len; x++) {
|
||||
gsm_encode(context->encoder, ddp, edp);
|
||||
edp += 33;
|
||||
ddp += 160;
|
||||
new_len += 33;
|
||||
}
|
||||
if (new_len <= *encoded_data_len) {
|
||||
*encoded_data_len = new_len;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!! %u >= %u\n", new_len, *encoded_data_len);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static switch_status_t switch_gsm_decode(switch_codec_t *codec, switch_codec_t *other_codec, void *encoded_data,
|
||||
uint32_t encoded_data_len, uint32_t encoded_rate, void *decoded_data,
|
||||
uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
|
||||
{
|
||||
struct gsm_context *context = codec->private_info;
|
||||
if (!context) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (encoded_data_len % 33 == 0) {
|
||||
int loops = (int) encoded_data_len / 33;
|
||||
gsm_byte *edp = encoded_data;
|
||||
gsm_signal *ddp = decoded_data;
|
||||
int x;
|
||||
uint32_t new_len = 0;
|
||||
|
||||
for (x = 0; x < loops && new_len < *decoded_data_len; x++) {
|
||||
gsm_decode(context->decoder, edp, ddp);
|
||||
ddp += 160;
|
||||
edp += 33;
|
||||
new_len += 320;
|
||||
}
|
||||
if (new_len <= *decoded_data_len) {
|
||||
*decoded_data_len = new_len;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "buffer overflow!!! %u %u\n", new_len, *decoded_data_len);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "yo this frame is an odd size [%u]\n", encoded_data_len);
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_MODULE_LOAD_FUNCTION(mod_gsm_load)
|
||||
{
|
||||
switch_codec_interface_t *codec_interface;
|
||||
int mpf = 20000, spf = 160, bpf = 320, ebpf = 33, count;
|
||||
|
||||
/* connect my internal structure to the blank pointer passed to me */
|
||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||
SWITCH_ADD_CODEC(codec_interface, "GSM-FR");
|
||||
for (count = 6; count > 0; count--) {
|
||||
switch_core_codec_add_implementation(pool, codec_interface,
|
||||
SWITCH_CODEC_TYPE_AUDIO, 3, "GSM", NULL, 8000, 8000, 13200,
|
||||
mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 6,
|
||||
switch_gsm_init, switch_gsm_encode, switch_gsm_decode, switch_gsm_destroy);
|
||||
}
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
* indent-tabs-mode:t
|
||||
* tab-width:4
|
||||
* c-basic-offset:4
|
||||
* End:
|
||||
* For VIM:
|
||||
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
|
||||
*/
|
|
@ -1,61 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="mod_gsm"
|
||||
ProjectGUID="{4926323F-4EA8-4B7D-A3D3-65488725988F}"
|
||||
RootNamespace="mod_gsm"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\gsm\inc""
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories=""..\..\..\..\libs\codec\gsm\$(OutDir)""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\codec\gsm\inc""
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories=""..\..\..\..\libs\codec\gsm\$(OutDir)""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="mod_gsm.c"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
Loading…
Reference in New Issue