mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +00:00
engine: get opus voice codec
This commit is contained in:
@@ -45,7 +45,7 @@ damage. */
|
||||
|
||||
#include "iframeencoder.h"
|
||||
|
||||
#include <speex.h>
|
||||
#include <speex/speex.h>
|
||||
|
||||
class VoiceEncoder_Speex : public IFrameEncoder
|
||||
{
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
Jean-Marc Valin <jean-marc.valin@hermes.usherb.ca>
|
||||
All the code except the following
|
||||
|
||||
David Rowe <david@voicetronix.com.au> via VoiceTronix
|
||||
lsp.c lsp.h
|
||||
Also ideas and feedback
|
||||
|
||||
John Francis Edwards:
|
||||
wave_out.[ch], some #ifdefs for windows port and MSVC project files
|
||||
|
||||
Atsuhiko Yamanaka <ymnk@jcraft.com>:
|
||||
Patch to speexenc.c to add Vorbis comment format
|
||||
|
||||
Radim Kolar <hsn@cybermail.net>:
|
||||
Patch to speexenc.c for supporting more input formats
|
||||
@@ -1,26 +0,0 @@
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,6 +0,0 @@
|
||||
2002/03/27 Jean-Marc Valin:
|
||||
Working encoder and decoder for both narrowband and wideband.
|
||||
|
||||
2002/02/27 Jean-Marc Valin:
|
||||
Got the basic encoder working as a demo with quantization only on some
|
||||
parameters.
|
||||
@@ -1,8 +0,0 @@
|
||||
Installing Speex is as easy as:
|
||||
|
||||
% ./configure [--prefix=<install-path>]
|
||||
% make
|
||||
% make install
|
||||
|
||||
Note that if you are using the code from CVS, you will need to run "autogen.sh"
|
||||
instead of "configure".
|
||||
@@ -1,11 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in. -*-Makefile-*-
|
||||
|
||||
# Disable automatic dependency tracking if using other tools than gcc and gmake
|
||||
#AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
EXTRA_DIST = Speex.spec Speex.spec.in
|
||||
|
||||
SUBDIRS = libspeex @src@ doc win32
|
||||
|
||||
rpm: dist
|
||||
rpmbuild -ta ${PACKAGE}-${VERSION}.tar.gz
|
||||
@@ -1,347 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
# Disable automatic dependency tracking if using other tools than gcc and gmake
|
||||
#AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AS = @AS@
|
||||
CC = @CC@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
EXEEXT = @EXEEXT@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OGG_INCLUDES = @OGG_INCLUDES@
|
||||
OGG_LDFLAGS = @OGG_LDFLAGS@
|
||||
OGG_LIBS = @OGG_LIBS@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
SPEEX_LT_AGE = @SPEEX_LT_AGE@
|
||||
SPEEX_LT_CURRENT = @SPEEX_LT_CURRENT@
|
||||
SPEEX_LT_REVISION = @SPEEX_LT_REVISION@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
src = @src@
|
||||
|
||||
EXTRA_DIST = Speex.spec Speex.spec.in
|
||||
|
||||
SUBDIRS = libspeex @src@ doc win32
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES = Speex.spec
|
||||
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
|
||||
Makefile.in NEWS Speex.spec.in TODO acinclude.m4 aclocal.m4 \
|
||||
config.guess config.sub configure configure.in install-sh ltmain.sh \
|
||||
missing mkinstalldirs
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4
|
||||
cd $(srcdir) && $(ACLOCAL)
|
||||
|
||||
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
Speex.spec: $(top_builddir)/config.status Speex.spec.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive info-recursive dvi-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
rev="$$subdir $$rev"; \
|
||||
test "$$subdir" != "." || dot_seen=yes; \
|
||||
done; \
|
||||
test "$$dot_seen" = "no" && rev=". $$rev"; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
-rm -rf $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
dc_install_base=`cd $(distdir)/=inst && pwd`; \
|
||||
cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist
|
||||
-rm -rf $(distdir)
|
||||
@banner="$(distdir).tar.gz is ready for distribution"; \
|
||||
dashes=`echo "$$banner" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
echo "$$dashes"
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
dist-all: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
distdir: $(DISTFILES)
|
||||
-rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
-chmod 777 $(distdir)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
info: info-recursive
|
||||
dvi-am:
|
||||
dvi: dvi-recursive
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
installcheck-am:
|
||||
installcheck: installcheck-recursive
|
||||
install-exec-am:
|
||||
install-exec: install-exec-recursive
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-recursive
|
||||
uninstall-am:
|
||||
uninstall: uninstall-recursive
|
||||
all-am: Makefile
|
||||
all-redirect: all-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-tags mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
clean-am: clean-tags clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-recursive
|
||||
|
||||
distclean-am: distclean-tags distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
|
||||
distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: install-data-recursive uninstall-data-recursive \
|
||||
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
|
||||
uninstalldirs-recursive all-recursive check-recursive \
|
||||
installcheck-recursive info-recursive dvi-recursive \
|
||||
mostlyclean-recursive distclean-recursive clean-recursive \
|
||||
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs-am \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
rpm: dist
|
||||
rpmbuild -ta ${PACKAGE}-${VERSION}.tar.gz
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1 +0,0 @@
|
||||
2002/02/13: Creation of the "Speex" project
|
||||
@@ -1,9 +0,0 @@
|
||||
See INSTALL file for instruction on how to install Speex.
|
||||
|
||||
The Speex is a patent-free, Open Source/Free Software voice codec. Unlike other codecs like MP3 and Ogg Vorbis, Speex is designed to compress voice at bitrates in the 2-45 kbps range. Possible applications include VoIP, internet audio streaming, archiving of speech data (e.g. voice mail), and audio books. In some sense, it is meant to be complementary to the Ogg Vorbis codec.
|
||||
|
||||
To use the Speex command line tools:
|
||||
|
||||
% speexenc [options] input_file.wav compressed_file.spx
|
||||
|
||||
% speexdec [options] compressed_file.spx output_file.wav
|
||||
@@ -1,68 +0,0 @@
|
||||
%define name speex
|
||||
%define ver 1.0.1
|
||||
%define rel 1
|
||||
|
||||
Summary: An open-source, patent-free speech codec
|
||||
Name: %name
|
||||
Version: %ver
|
||||
Release: %rel
|
||||
Copyright: BSD
|
||||
Group: Application/Devel
|
||||
Source: http://www.speex.org/download/%{name}-%{ver}.tar.gz
|
||||
URL: http://www.speex.org/
|
||||
Vendor: Speex
|
||||
Packager: Jean-Marc Valin (jean-marc.valin@hermes.usherb.ca)
|
||||
BuildRoot: /var/tmp/%{name}-build-root
|
||||
Docdir: /usr/share/doc
|
||||
|
||||
%description
|
||||
Speex is a patent-free audio codec designed especially for voice (unlike
|
||||
Vorbis which targets general audio) signals and providing good narrowband
|
||||
and wideband quality. This project aims to be complementary to the Vorbis
|
||||
codec.
|
||||
|
||||
%package devel
|
||||
Summary: Speex development files
|
||||
Group: Development/Libraries
|
||||
Requires: %{name} = %{version}
|
||||
|
||||
%description devel
|
||||
Speex development files.
|
||||
|
||||
%changelog
|
||||
* Thu Oct 03 2002 Jean-Marc Valin
|
||||
- Added devel package inspired from PLD spec file
|
||||
|
||||
* Tue Jul 30 2002 Fredrik Rambris <boost@users.sourceforge.net> 0.5.2
|
||||
- Added buildroot and docdir and ldconfig. Makes it builadble by non-roots
|
||||
and also doesn't write to actual library paths when building.
|
||||
|
||||
%prep
|
||||
%setup
|
||||
|
||||
%build
|
||||
export CFLAGS='-O3 -DRELEASE'
|
||||
./configure --prefix=/usr --enable-shared --enable-static
|
||||
make
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
%files
|
||||
%defattr(644,root,root,755)
|
||||
%doc COPYING AUTHORS ChangeLog NEWS README
|
||||
%doc doc/manual.pdf
|
||||
/usr/share/man/man1/speexenc.1*
|
||||
/usr/share/man/man1/speexdec.1*
|
||||
%attr(755,root,root) %{_bindir}/speex*
|
||||
%attr(755,root,root) %{_libdir}/libspeex*.so*
|
||||
|
||||
%files devel
|
||||
%defattr(644,root,root,755)
|
||||
%attr(755,root,root) %{_libdir}/libspeex*.la
|
||||
%{_includedir}/speex*.h
|
||||
%{_libdir}/libspeex*.a
|
||||
@@ -1,68 +0,0 @@
|
||||
%define name @PACKAGE@
|
||||
%define ver @VERSION@
|
||||
%define rel 1
|
||||
|
||||
Summary: An open-source, patent-free speech codec
|
||||
Name: %name
|
||||
Version: %ver
|
||||
Release: %rel
|
||||
Copyright: BSD
|
||||
Group: Application/Devel
|
||||
Source: http://www.speex.org/download/%{name}-%{ver}.tar.gz
|
||||
URL: http://www.speex.org/
|
||||
Vendor: Speex
|
||||
Packager: Jean-Marc Valin (jean-marc.valin@hermes.usherb.ca)
|
||||
BuildRoot: /var/tmp/%{name}-build-root
|
||||
Docdir: /usr/share/doc
|
||||
|
||||
%description
|
||||
Speex is a patent-free audio codec designed especially for voice (unlike
|
||||
Vorbis which targets general audio) signals and providing good narrowband
|
||||
and wideband quality. This project aims to be complementary to the Vorbis
|
||||
codec.
|
||||
|
||||
%package devel
|
||||
Summary: Speex development files
|
||||
Group: Development/Libraries
|
||||
Requires: %{name} = %{version}
|
||||
|
||||
%description devel
|
||||
Speex development files.
|
||||
|
||||
%changelog
|
||||
* Thu Oct 03 2002 Jean-Marc Valin
|
||||
- Added devel package inspired from PLD spec file
|
||||
|
||||
* Tue Jul 30 2002 Fredrik Rambris <boost@users.sourceforge.net> 0.5.2
|
||||
- Added buildroot and docdir and ldconfig. Makes it builadble by non-roots
|
||||
and also doesn't write to actual library paths when building.
|
||||
|
||||
%prep
|
||||
%setup
|
||||
|
||||
%build
|
||||
export CFLAGS='-O3 -DRELEASE'
|
||||
./configure --prefix=/usr --enable-shared --enable-static
|
||||
make
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
%files
|
||||
%defattr(644,root,root,755)
|
||||
%doc COPYING AUTHORS ChangeLog NEWS README
|
||||
%doc doc/manual.pdf
|
||||
/usr/share/man/man1/speexenc.1*
|
||||
/usr/share/man/man1/speexdec.1*
|
||||
%attr(755,root,root) %{_bindir}/speex*
|
||||
%attr(755,root,root) %{_libdir}/libspeex*.so*
|
||||
|
||||
%files devel
|
||||
%defattr(644,root,root,755)
|
||||
%attr(755,root,root) %{_libdir}/libspeex*.la
|
||||
%{_includedir}/speex*.h
|
||||
%{_libdir}/libspeex*.a
|
||||
@@ -1,18 +0,0 @@
|
||||
Features
|
||||
-Add maximum/minimum bit-rate control for VBR
|
||||
-Get the encoder to use the rate of packet loss (more conservative pitch gains)
|
||||
|
||||
Long-term quality improvements
|
||||
-Improve perceptual enhancement (including wideband)
|
||||
|
||||
Standards
|
||||
*Complete Speex RTP profile
|
||||
-MIME type registration
|
||||
-MS ACM wrapper
|
||||
|
||||
*required for 1.0
|
||||
|
||||
ideas:
|
||||
Peelable stream (double codebook, higher bands, stereo)
|
||||
LPC from spectral domain
|
||||
Better psycho-acoustics? Masking curve from Vorbis
|
||||
@@ -1,84 +0,0 @@
|
||||
AC_DEFUN(AC_FIND_FILE,
|
||||
[
|
||||
$3=NONE
|
||||
for i in $2;
|
||||
do
|
||||
for j in $1;
|
||||
do
|
||||
if test -r "$i/$j"; then
|
||||
$3=$i
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_PATH_LIBOGG,
|
||||
[
|
||||
OGG_LIBS="-logg"
|
||||
|
||||
AC_MSG_CHECKING([for libogg])
|
||||
|
||||
ac_ogg_includes=NONE ac_ogg_libraries=NONE ac_ogg_bindir=NONE
|
||||
ogg_libraries=""
|
||||
ogg_includes=""
|
||||
AC_ARG_WITH(ogg-dir,
|
||||
[ --with-ogg-dir=DIR where the root of OGG is installed ],
|
||||
[ ac_ogg_includes="$withval"/include
|
||||
ac_ogg_libraries="$withval"/lib
|
||||
])
|
||||
|
||||
AC_ARG_WITH(ogg-includes,
|
||||
[ --with-ogg-includes=DIR where the OGG includes are. ],
|
||||
[
|
||||
ac_ogg_includes="$withval"
|
||||
])
|
||||
|
||||
ogg_libs_given=no
|
||||
|
||||
AC_ARG_WITH(ogg-libraries,
|
||||
[ --with-ogg-libraries=DIR where the OGG library is installed.],
|
||||
[ ac_ogg_libraries="$withval"
|
||||
ogg_libs_given=yes
|
||||
])
|
||||
|
||||
ogg_incdirs="/usr/include /usr/lib/ogg/include /opt/include /usr/local/ogg/include /usr/include/ogg /usr/include /usr/local/include"
|
||||
if test ! "$ac_ogg_includes" = "NONE"; then
|
||||
ogg_incdirs="$ac_ogg_includes $ac_ogg_includes/.. $ogg_incdirs"
|
||||
fi
|
||||
AC_FIND_FILE(ogg/ogg.h, $ogg_incdirs, ogg_incdir)
|
||||
echo "Ogg includes in $ogg_incdir"
|
||||
|
||||
|
||||
ogg_libdirs="$ac_ogg_libraries /usr/lib/ogg/lib /usr/lib /opt/lib /usr/local/ogg/lib /usr/local/lib /usr/lib/ogg /usr/local/lib"
|
||||
test -n "$OGGDIR" && ogg_libdirs="$OGGDIR/lib $OGGDIR $ogg_libdirs"
|
||||
if test ! "$ac_ogg_libraries" = "NONE"; then
|
||||
ogg_libdirs="$ac_ogg_libraries $ogg_libdirs"
|
||||
fi
|
||||
|
||||
test=NONE
|
||||
ogg_libdir=NONE
|
||||
for dir in $ogg_libdirs; do
|
||||
try="ls -1 $dir/libogg*"
|
||||
if test=`eval $try 2> /dev/null`; then ogg_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
|
||||
done
|
||||
|
||||
echo "Ogg libraries in $ogg_libdir"
|
||||
|
||||
if test "$ogg_libdir" = "NONE" || test "$ogg_incdir" = "NONE"; then
|
||||
have_libogg=no
|
||||
else
|
||||
have_libogg=yes
|
||||
AC_DEFINE(HAVE_LIBOGG)
|
||||
fi
|
||||
|
||||
OGG_INCLUDES="-I$ogg_incdir"
|
||||
OGG_LDFLAGS="-L$ogg_libdir"
|
||||
|
||||
|
||||
AC_SUBST(OGG_LIBS)
|
||||
AC_SUBST(OGG_INCLUDES)
|
||||
AC_SUBST(OGG_LDFLAGS)
|
||||
|
||||
])
|
||||
|
||||
-3894
File diff suppressed because it is too large
Load Diff
-1363
File diff suppressed because it is too large
Load Diff
-1470
File diff suppressed because it is too large
Load Diff
-6110
File diff suppressed because it is too large
Load Diff
@@ -1,69 +0,0 @@
|
||||
dnl Process this file with autoconf to produce a configure script. -*-m4-*-
|
||||
|
||||
AC_INIT(libspeex/speex.h)
|
||||
|
||||
SPEEX_MAJOR_VERSION=1
|
||||
SPEEX_MINOR_VERSION=0
|
||||
SPEEX_MICRO_VERSION=1
|
||||
SPEEX_VERSION=1.0.1
|
||||
|
||||
SPEEX_LT_CURRENT=2
|
||||
SPEEX_LT_REVISION=0
|
||||
SPEEX_LT_AGE=1
|
||||
|
||||
AC_SUBST(SPEEX_LT_CURRENT)
|
||||
AC_SUBST(SPEEX_LT_REVISION)
|
||||
AC_SUBST(SPEEX_LT_AGE)
|
||||
|
||||
# For automake.
|
||||
VERSION=$SPEEX_VERSION
|
||||
PACKAGE=speex
|
||||
|
||||
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
AM_PROG_LIBTOOL
|
||||
|
||||
AC_C_BIGENDIAN
|
||||
AC_CHECK_HEADERS(sys/soundcard.h)
|
||||
|
||||
AC_ARG_ENABLE(ogg,
|
||||
[ --enable-ogg=[yes/no] Turn on or off the use of ogg
|
||||
libraries [default=yes]],
|
||||
[case "${enableval}" in
|
||||
yes) useogg=true ;;
|
||||
no) useogg=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-ogg) ;;
|
||||
esac],[useogg=true])
|
||||
|
||||
if test x$useogg = xtrue; then
|
||||
AC_PATH_LIBOGG
|
||||
fi
|
||||
|
||||
if test "$have_libogg" = yes; then
|
||||
src=src
|
||||
else
|
||||
src=
|
||||
fi
|
||||
AC_SUBST(src)
|
||||
|
||||
AC_CHECK_LIB(m, sin)
|
||||
AC_CHECK_LIB(gnugetopt, getopt_long)
|
||||
|
||||
AC_DEFINE_UNQUOTED(VERSION, "${VERSION}")
|
||||
|
||||
AC_ARG_ENABLE(sse, [ --enable-sse enable SSE support], [if test "$enableval" = yes; then AC_DEFINE(_USE_SSE) fi])
|
||||
|
||||
dnl Output the makefiles and version.h.
|
||||
|
||||
AC_OUTPUT([Makefile libspeex/Makefile src/Makefile doc/Makefile Speex.spec
|
||||
win32/Makefile win32/libspeex/Makefile win32/speexenc/Makefile
|
||||
win32/speexdec/Makefile ])
|
||||
|
||||
if test "x$src" = "x"; then
|
||||
echo "You don't seem to have libogg installed. Only the Speex library (libspeex) will be built (no encoder/decoder executable)"
|
||||
echo "You can download libogg from http://www.ogg.org/ogg/index.html"
|
||||
fi
|
||||
|
||||
echo "Type \"make; make install\" to compile and install Speex";
|
||||
@@ -1,5 +0,0 @@
|
||||
docdir=$(prefix)/share/doc/@PACKAGE@-@VERSION@
|
||||
|
||||
doc_DATA = manual.pdf
|
||||
|
||||
EXTRA_DIST = $(doc_DATA)
|
||||
@@ -1,213 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AS = @AS@
|
||||
CC = @CC@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
EXEEXT = @EXEEXT@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OGG_INCLUDES = @OGG_INCLUDES@
|
||||
OGG_LDFLAGS = @OGG_LDFLAGS@
|
||||
OGG_LIBS = @OGG_LIBS@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
SPEEX_LT_AGE = @SPEEX_LT_AGE@
|
||||
SPEEX_LT_CURRENT = @SPEEX_LT_CURRENT@
|
||||
SPEEX_LT_REVISION = @SPEEX_LT_REVISION@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
src = @src@
|
||||
|
||||
docdir = $(prefix)/share/doc/@PACKAGE@-@VERSION@
|
||||
|
||||
doc_DATA = manual.pdf
|
||||
|
||||
EXTRA_DIST = $(doc_DATA)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
DATA = $(doc_DATA)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps doc/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
install-docDATA: $(doc_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(docdir)
|
||||
@list='$(doc_DATA)'; for p in $$list; do \
|
||||
if test -f $(srcdir)/$$p; then \
|
||||
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(docdir)/$$p"; \
|
||||
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(docdir)/$$p; \
|
||||
else if test -f $$p; then \
|
||||
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(docdir)/$$p"; \
|
||||
$(INSTALL_DATA) $$p $(DESTDIR)$(docdir)/$$p; \
|
||||
fi; fi; \
|
||||
done
|
||||
|
||||
uninstall-docDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(doc_DATA)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(docdir)/$$p; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = doc
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am:
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am: install-docDATA
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-docDATA
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(DATA)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(docdir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: uninstall-docDATA install-docDATA tags distdir info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
Binary file not shown.
@@ -1,251 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5 (mit/util/scripts/install.sh).
|
||||
#
|
||||
# Copyright 1991 by the Massachusetts Institute of Technology
|
||||
#
|
||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||
# documentation for any purpose is hereby granted without fee, provided that
|
||||
# the above copyright notice appear in all copies and that both that
|
||||
# copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that the name of M.I.T. not be used in advertising or
|
||||
# publicity pertaining to distribution of the software without specific,
|
||||
# written prior permission. M.I.T. makes no representations about the
|
||||
# suitability of this software for any purpose. It is provided "as is"
|
||||
# without express or implied warranty.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d $dst ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=mkdir
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f $src -o -d $src ]
|
||||
then
|
||||
true
|
||||
else
|
||||
echo "install: $src does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
else
|
||||
true
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-${defaultIFS}}"
|
||||
|
||||
oIFS="${IFS}"
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS="${oIFS}"
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp="${pathcomp}${1}"
|
||||
shift
|
||||
|
||||
if [ ! -d "${pathcomp}" ] ;
|
||||
then
|
||||
$mkdirprog "${pathcomp}"
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
pathcomp="${pathcomp}/"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd $dst &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
dstfile=`basename $dst $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename $dst`
|
||||
else
|
||||
true
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp &&
|
||||
|
||||
trap "rm -f ${dsttmp}" 0 &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd -f $dstdir/$dstfile &&
|
||||
$doit $mvcmd $dsttmp $dstdir/$dstfile
|
||||
|
||||
fi &&
|
||||
|
||||
|
||||
exit 0
|
||||
@@ -1,77 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in. -*-Makefile-*-
|
||||
|
||||
# $Id: Makefile.am,v 1.49 2003/03/17 22:40:57 jm Exp $
|
||||
|
||||
# Disable automatic dependency tracking if using other tools than gcc and gmake
|
||||
#AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
lib_LTLIBRARIES = libspeex.la
|
||||
|
||||
# Sources for compilation in the library
|
||||
libspeex_la_SOURCES = nb_celp.c \
|
||||
sb_celp.c \
|
||||
lpc.c \
|
||||
ltp.c \
|
||||
lsp.c \
|
||||
quant_lsp.c \
|
||||
lsp_tables_nb.c \
|
||||
gain_table.c \
|
||||
gain_table_lbr.c \
|
||||
cb_search.c \
|
||||
filters.c \
|
||||
bits.c \
|
||||
modes.c \
|
||||
vq.c \
|
||||
high_lsp_tables.c \
|
||||
vbr.c \
|
||||
hexc_table.c \
|
||||
exc_5_256_table.c \
|
||||
exc_5_64_table.c \
|
||||
exc_8_128_table.c \
|
||||
exc_10_32_table.c \
|
||||
exc_10_16_table.c \
|
||||
exc_20_32_table.c \
|
||||
hexc_10_32_table.c \
|
||||
misc.c \
|
||||
speex_header.c \
|
||||
speex_callbacks.c \
|
||||
math_approx.c \
|
||||
stereo.c
|
||||
|
||||
|
||||
include_HEADERS = speex.h \
|
||||
speex_bits.h \
|
||||
speex_header.h \
|
||||
speex_callbacks.h \
|
||||
speex_stereo.h
|
||||
|
||||
noinst_HEADERS = lsp.h \
|
||||
nb_celp.h \
|
||||
lpc.h \
|
||||
ltp.h \
|
||||
quant_lsp.h \
|
||||
cb_search.h \
|
||||
filters.h \
|
||||
stack_alloc.h \
|
||||
vq.h \
|
||||
modes.h \
|
||||
sb_celp.h \
|
||||
vbr.h \
|
||||
misc.h \
|
||||
ltp_sse.h \
|
||||
filters_sse.h \
|
||||
math_approx.h
|
||||
|
||||
|
||||
libspeex_la_LDFLAGS = -version-info @SPEEX_LT_CURRENT@:@SPEEX_LT_REVISION@:@SPEEX_LT_AGE@
|
||||
|
||||
noinst_PROGRAMS = testenc testenc_wb testenc_uwb
|
||||
|
||||
testenc_SOURCES = testenc.c
|
||||
testenc_LDADD = libspeex.la
|
||||
|
||||
testenc_wb_SOURCES = testenc_wb.c
|
||||
testenc_wb_LDADD = libspeex.la
|
||||
|
||||
testenc_uwb_SOURCES = testenc_uwb.c
|
||||
testenc_uwb_LDADD = libspeex.la
|
||||
@@ -1,450 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
# $Id: Makefile.am,v 1.49 2003/03/17 22:40:57 jm Exp $
|
||||
|
||||
# Disable automatic dependency tracking if using other tools than gcc and gmake
|
||||
#AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AS = @AS@
|
||||
CC = @CC@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
ECHO = @ECHO@
|
||||
EXEEXT = @EXEEXT@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OGG_INCLUDES = @OGG_INCLUDES@
|
||||
OGG_LDFLAGS = @OGG_LDFLAGS@
|
||||
OGG_LIBS = @OGG_LIBS@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
SPEEX_LT_AGE = @SPEEX_LT_AGE@
|
||||
SPEEX_LT_CURRENT = @SPEEX_LT_CURRENT@
|
||||
SPEEX_LT_REVISION = @SPEEX_LT_REVISION@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
src = @src@
|
||||
|
||||
lib_LTLIBRARIES = libspeex.la
|
||||
|
||||
# Sources for compilation in the library
|
||||
libspeex_la_SOURCES = nb_celp.c sb_celp.c lpc.c ltp.c lsp.c quant_lsp.c lsp_tables_nb.c gain_table.c gain_table_lbr.c cb_search.c filters.c bits.c modes.c vq.c high_lsp_tables.c vbr.c hexc_table.c exc_5_256_table.c exc_5_64_table.c exc_8_128_table.c exc_10_32_table.c exc_10_16_table.c exc_20_32_table.c hexc_10_32_table.c misc.c speex_header.c speex_callbacks.c math_approx.c stereo.c
|
||||
|
||||
|
||||
include_HEADERS = speex.h speex_bits.h speex_header.h speex_callbacks.h speex_stereo.h
|
||||
|
||||
|
||||
noinst_HEADERS = lsp.h nb_celp.h lpc.h ltp.h quant_lsp.h cb_search.h filters.h stack_alloc.h vq.h modes.h sb_celp.h vbr.h misc.h ltp_sse.h filters_sse.h math_approx.h
|
||||
|
||||
|
||||
libspeex_la_LDFLAGS = -version-info @SPEEX_LT_CURRENT@:@SPEEX_LT_REVISION@:@SPEEX_LT_AGE@
|
||||
|
||||
noinst_PROGRAMS = testenc testenc_wb testenc_uwb
|
||||
|
||||
testenc_SOURCES = testenc.c
|
||||
testenc_LDADD = libspeex.la
|
||||
|
||||
testenc_wb_SOURCES = testenc_wb.c
|
||||
testenc_wb_LDADD = libspeex.la
|
||||
|
||||
testenc_uwb_SOURCES = testenc_uwb.c
|
||||
testenc_uwb_LDADD = libspeex.la
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
libspeex_la_LIBADD =
|
||||
libspeex_la_OBJECTS = nb_celp.lo sb_celp.lo lpc.lo ltp.lo lsp.lo \
|
||||
quant_lsp.lo lsp_tables_nb.lo gain_table.lo gain_table_lbr.lo \
|
||||
cb_search.lo filters.lo bits.lo modes.lo vq.lo high_lsp_tables.lo \
|
||||
vbr.lo hexc_table.lo exc_5_256_table.lo exc_5_64_table.lo \
|
||||
exc_8_128_table.lo exc_10_32_table.lo exc_10_16_table.lo \
|
||||
exc_20_32_table.lo hexc_10_32_table.lo misc.lo speex_header.lo \
|
||||
speex_callbacks.lo math_approx.lo stereo.lo
|
||||
noinst_PROGRAMS = testenc$(EXEEXT) testenc_wb$(EXEEXT) \
|
||||
testenc_uwb$(EXEEXT)
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
|
||||
testenc_OBJECTS = testenc.$(OBJEXT)
|
||||
testenc_DEPENDENCIES = libspeex.la
|
||||
testenc_LDFLAGS =
|
||||
testenc_wb_OBJECTS = testenc_wb.$(OBJEXT)
|
||||
testenc_wb_DEPENDENCIES = libspeex.la
|
||||
testenc_wb_LDFLAGS =
|
||||
testenc_uwb_OBJECTS = testenc_uwb.$(OBJEXT)
|
||||
testenc_uwb_DEPENDENCIES = libspeex.la
|
||||
testenc_uwb_LDFLAGS =
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
HEADERS = $(include_HEADERS) $(noinst_HEADERS)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
SOURCES = $(libspeex_la_SOURCES) $(testenc_SOURCES) $(testenc_wb_SOURCES) $(testenc_uwb_SOURCES)
|
||||
OBJECTS = $(libspeex_la_OBJECTS) $(testenc_OBJECTS) $(testenc_wb_OBJECTS) $(testenc_uwb_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .lo .o .obj .s
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps libspeex/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-libLTLIBRARIES:
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
|
||||
distclean-libLTLIBRARIES:
|
||||
|
||||
maintainer-clean-libLTLIBRARIES:
|
||||
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
|
||||
done
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
# FIXME: We should only use cygpath when building on Windows,
|
||||
# and only if it is available.
|
||||
.c.obj:
|
||||
$(COMPILE) -c `cygpath -w $<`
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.c.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
libspeex.la: $(libspeex_la_OBJECTS) $(libspeex_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(libdir) $(libspeex_la_LDFLAGS) $(libspeex_la_OBJECTS) $(libspeex_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-noinstPROGRAMS:
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
|
||||
|
||||
distclean-noinstPROGRAMS:
|
||||
|
||||
maintainer-clean-noinstPROGRAMS:
|
||||
|
||||
testenc$(EXEEXT): $(testenc_OBJECTS) $(testenc_DEPENDENCIES)
|
||||
@rm -f testenc$(EXEEXT)
|
||||
$(LINK) $(testenc_LDFLAGS) $(testenc_OBJECTS) $(testenc_LDADD) $(LIBS)
|
||||
|
||||
testenc_wb$(EXEEXT): $(testenc_wb_OBJECTS) $(testenc_wb_DEPENDENCIES)
|
||||
@rm -f testenc_wb$(EXEEXT)
|
||||
$(LINK) $(testenc_wb_LDFLAGS) $(testenc_wb_OBJECTS) $(testenc_wb_LDADD) $(LIBS)
|
||||
|
||||
testenc_uwb$(EXEEXT): $(testenc_uwb_OBJECTS) $(testenc_uwb_DEPENDENCIES)
|
||||
@rm -f testenc_uwb$(EXEEXT)
|
||||
$(LINK) $(testenc_uwb_LDFLAGS) $(testenc_uwb_OBJECTS) $(testenc_uwb_LDADD) $(LIBS)
|
||||
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(includedir)
|
||||
@list='$(include_HEADERS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
|
||||
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
|
||||
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(include_HEADERS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = libspeex
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
bits.lo bits.o : bits.c speex_bits.h misc.h
|
||||
cb_search.lo cb_search.o : cb_search.c cb_search.h speex_bits.h \
|
||||
filters.h stack_alloc.h vq.h misc.h
|
||||
exc_10_16_table.lo exc_10_16_table.o : exc_10_16_table.c
|
||||
exc_10_32_table.lo exc_10_32_table.o : exc_10_32_table.c
|
||||
exc_20_32_table.lo exc_20_32_table.o : exc_20_32_table.c
|
||||
exc_5_256_table.lo exc_5_256_table.o : exc_5_256_table.c
|
||||
exc_5_64_table.lo exc_5_64_table.o : exc_5_64_table.c
|
||||
exc_8_128_table.lo exc_8_128_table.o : exc_8_128_table.c
|
||||
filters.lo filters.o : filters.c filters.h stack_alloc.h
|
||||
gain_table.lo gain_table.o : gain_table.c
|
||||
gain_table_lbr.lo gain_table_lbr.o : gain_table_lbr.c
|
||||
hexc_10_32_table.lo hexc_10_32_table.o : hexc_10_32_table.c
|
||||
hexc_table.lo hexc_table.o : hexc_table.c
|
||||
high_lsp_tables.lo high_lsp_tables.o : high_lsp_tables.c
|
||||
lpc.lo lpc.o : lpc.c lpc.h
|
||||
lsp.lo lsp.o : lsp.c lsp.h stack_alloc.h
|
||||
lsp_tables_nb.lo lsp_tables_nb.o : lsp_tables_nb.c
|
||||
ltp.lo ltp.o : ltp.c ltp.h speex_bits.h stack_alloc.h filters.h
|
||||
math_approx.lo math_approx.o : math_approx.c math_approx.h
|
||||
misc.lo misc.o : misc.c misc.h
|
||||
modes.lo modes.o : modes.c modes.h speex.h speex_bits.h ltp.h \
|
||||
quant_lsp.h cb_search.h sb_celp.h nb_celp.h speex_callbacks.h \
|
||||
vbr.h filters.h misc.h
|
||||
nb_celp.lo nb_celp.o : nb_celp.c nb_celp.h modes.h speex.h speex_bits.h \
|
||||
speex_callbacks.h vbr.h filters.h lpc.h lsp.h ltp.h quant_lsp.h \
|
||||
cb_search.h stack_alloc.h vq.h misc.h
|
||||
quant_lsp.lo quant_lsp.o : quant_lsp.c quant_lsp.h speex_bits.h
|
||||
sb_celp.lo sb_celp.o : sb_celp.c sb_celp.h modes.h speex.h speex_bits.h \
|
||||
nb_celp.h speex_callbacks.h vbr.h filters.h lpc.h lsp.h \
|
||||
stack_alloc.h cb_search.h quant_lsp.h vq.h ltp.h misc.h
|
||||
speex_callbacks.lo speex_callbacks.o : speex_callbacks.c \
|
||||
speex_callbacks.h speex.h speex_bits.h misc.h
|
||||
speex_header.lo speex_header.o : speex_header.c speex_header.h misc.h \
|
||||
speex.h speex_bits.h
|
||||
stereo.lo stereo.o : stereo.c speex_stereo.h speex_bits.h \
|
||||
speex_callbacks.h speex.h vq.h
|
||||
testenc.o: testenc.c speex.h speex_bits.h speex_callbacks.h
|
||||
testenc_uwb.o: testenc_uwb.c speex.h speex_bits.h
|
||||
testenc_wb.o: testenc_wb.c speex.h speex_bits.h
|
||||
vbr.lo vbr.o : vbr.c vbr.h
|
||||
vq.lo vq.o : vq.c vq.h
|
||||
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am: install-libLTLIBRARIES
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am: install-includeHEADERS
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-libLTLIBRARIES uninstall-includeHEADERS
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-noinstPROGRAMS \
|
||||
mostlyclean-tags mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-libLTLIBRARIES clean-compile clean-libtool \
|
||||
clean-noinstPROGRAMS clean-tags clean-generic \
|
||||
mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-libLTLIBRARIES distclean-compile \
|
||||
distclean-libtool distclean-noinstPROGRAMS \
|
||||
distclean-tags distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-noinstPROGRAMS maintainer-clean-tags \
|
||||
maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
|
||||
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
|
||||
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
|
||||
distclean-compile clean-compile maintainer-clean-compile \
|
||||
mostlyclean-libtool distclean-libtool clean-libtool \
|
||||
maintainer-clean-libtool mostlyclean-noinstPROGRAMS \
|
||||
distclean-noinstPROGRAMS clean-noinstPROGRAMS \
|
||||
maintainer-clean-noinstPROGRAMS uninstall-includeHEADERS \
|
||||
install-includeHEADERS tags mostlyclean-tags distclean-tags clean-tags \
|
||||
maintainer-clean-tags distdir info-am info dvi-am dvi check check-am \
|
||||
installcheck-am installcheck install-exec-am install-exec \
|
||||
install-data-am install-data install-am install uninstall-am uninstall \
|
||||
all-redirect all-am all installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,352 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: speex_bits.c
|
||||
|
||||
Handles bit packing/unpacking
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "speex_bits.h"
|
||||
#include "misc.h"
|
||||
|
||||
void speex_bits_init(SpeexBits *bits)
|
||||
{
|
||||
int i;
|
||||
bits->bytes = (char*)speex_alloc(MAX_BYTES_PER_FRAME);
|
||||
bits->buf_size = MAX_BYTES_PER_FRAME;
|
||||
|
||||
for (i=0;i<bits->buf_size;i++)
|
||||
bits->bytes[i]=0;
|
||||
bits->nbBits=0;
|
||||
bits->bytePtr=0;
|
||||
bits->bitPtr=0;
|
||||
bits->owner=1;
|
||||
bits->overflow=0;
|
||||
}
|
||||
|
||||
void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
|
||||
{
|
||||
int i;
|
||||
bits->bytes = (char*)buff;
|
||||
bits->buf_size = buf_size;
|
||||
|
||||
for (i=0;i<buf_size;i++)
|
||||
bits->bytes[i]=0;
|
||||
bits->nbBits=0;
|
||||
bits->bytePtr=0;
|
||||
bits->bitPtr=0;
|
||||
bits->owner=0;
|
||||
bits->overflow=0;
|
||||
}
|
||||
|
||||
void speex_bits_destroy(SpeexBits *bits)
|
||||
{
|
||||
if (bits->owner)
|
||||
speex_free(bits->bytes);
|
||||
/* Will do something once the allocation is dynamic */
|
||||
}
|
||||
|
||||
void speex_bits_reset(SpeexBits *bits)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<bits->buf_size;i++)
|
||||
bits->bytes[i]=0;
|
||||
bits->nbBits=0;
|
||||
bits->bytePtr=0;
|
||||
bits->bitPtr=0;
|
||||
bits->overflow=0;
|
||||
}
|
||||
|
||||
void speex_bits_rewind(SpeexBits *bits)
|
||||
{
|
||||
bits->bytePtr=0;
|
||||
bits->bitPtr=0;
|
||||
bits->overflow=0;
|
||||
}
|
||||
|
||||
void speex_bits_read_from(SpeexBits *bits, char *bytes, int len)
|
||||
{
|
||||
int i;
|
||||
if (len > bits->buf_size)
|
||||
{
|
||||
speex_warning_int("Packet if larger than allocated buffer: ", len);
|
||||
if (bits->owner)
|
||||
{
|
||||
char *tmp = (char*)speex_realloc(bits->bytes, len);
|
||||
if (tmp)
|
||||
{
|
||||
bits->buf_size=len;
|
||||
bits->bytes=tmp;
|
||||
} else {
|
||||
len=bits->buf_size;
|
||||
speex_warning("Could not resize input buffer: truncating input");
|
||||
}
|
||||
} else {
|
||||
speex_warning("Do not own input buffer: truncating input");
|
||||
len=bits->buf_size;
|
||||
}
|
||||
}
|
||||
for (i=0;i<len;i++)
|
||||
bits->bytes[i]=bytes[i];
|
||||
bits->nbBits=len<<3;
|
||||
bits->bytePtr=0;
|
||||
bits->bitPtr=0;
|
||||
bits->overflow=0;
|
||||
}
|
||||
|
||||
static void speex_bits_flush(SpeexBits *bits)
|
||||
{
|
||||
int i;
|
||||
if (bits->bytePtr>0)
|
||||
{
|
||||
for (i=bits->bytePtr;i<((bits->nbBits+7)>>3);i++)
|
||||
bits->bytes[i-bits->bytePtr]=bits->bytes[i];
|
||||
}
|
||||
bits->nbBits -= bits->bytePtr<<3;
|
||||
bits->bytePtr=0;
|
||||
}
|
||||
|
||||
void speex_bits_read_whole_bytes(SpeexBits *bits, char *bytes, int len)
|
||||
{
|
||||
int i,pos;
|
||||
|
||||
if ((bits->nbBits>>3)+len+1 > bits->buf_size)
|
||||
{
|
||||
speex_warning_int("Packet if larger than allocated buffer: ", len);
|
||||
if (bits->owner)
|
||||
{
|
||||
char *tmp = (char*)speex_realloc(bits->bytes, (bits->nbBits>>3)+len+1);
|
||||
if (tmp)
|
||||
{
|
||||
bits->buf_size=(bits->nbBits>>3)+len+1;
|
||||
bits->bytes=tmp;
|
||||
} else {
|
||||
len=bits->buf_size-(bits->nbBits>>3)-1;
|
||||
speex_warning("Could not resize input buffer: truncating input");
|
||||
}
|
||||
} else {
|
||||
speex_warning("Do not own input buffer: truncating input");
|
||||
len=bits->buf_size;
|
||||
}
|
||||
}
|
||||
|
||||
speex_bits_flush(bits);
|
||||
pos=bits->nbBits>>3;
|
||||
for (i=0;i<len;i++)
|
||||
bits->bytes[pos+i]=bytes[i];
|
||||
bits->nbBits+=len<<3;
|
||||
}
|
||||
|
||||
int speex_bits_write(SpeexBits *bits, char *bytes, int max_len)
|
||||
{
|
||||
int i;
|
||||
if (max_len > ((bits->nbBits+7)>>3))
|
||||
max_len = ((bits->nbBits+7)>>3);
|
||||
for (i=0;i<max_len;i++)
|
||||
bytes[i]=bits->bytes[i];
|
||||
return max_len;
|
||||
}
|
||||
|
||||
int speex_bits_write_whole_bytes(SpeexBits *bits, char *bytes, int max_len)
|
||||
{
|
||||
int i;
|
||||
if (max_len > ((bits->nbBits)>>3))
|
||||
max_len = ((bits->nbBits)>>3);
|
||||
for (i=0;i<max_len;i++)
|
||||
bytes[i]=bits->bytes[i];
|
||||
|
||||
if (bits->bitPtr>0)
|
||||
bits->bytes[0]=bits->bytes[max_len];
|
||||
else
|
||||
bits->bytes[0]=0;
|
||||
for (i=1;i<((bits->nbBits)>>3)+1;i++)
|
||||
bits->bytes[i]=0;
|
||||
bits->bytePtr=0;
|
||||
bits->nbBits &= 7;
|
||||
return max_len;
|
||||
}
|
||||
|
||||
|
||||
void speex_bits_pack(SpeexBits *bits, int data, int nbBits)
|
||||
{
|
||||
int i;
|
||||
unsigned int d=data;
|
||||
|
||||
if (bits->bytePtr+((nbBits+bits->bitPtr)>>3) >= bits->buf_size)
|
||||
{
|
||||
speex_warning("Buffer too small to pack bits");
|
||||
if (bits->owner)
|
||||
{
|
||||
char *tmp = (char*)speex_realloc(bits->bytes, ((bits->buf_size+5)*3)>>1);
|
||||
if (tmp)
|
||||
{
|
||||
for (i=bits->buf_size;i<(((bits->buf_size+5)*3)>>1);i++)
|
||||
tmp[i]=0;
|
||||
bits->buf_size=((bits->buf_size+5)*3)>>1;
|
||||
bits->bytes=tmp;
|
||||
} else {
|
||||
speex_warning("Could not resize input buffer: not packing");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
speex_warning("Do not own input buffer: not packing");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
while(nbBits)
|
||||
{
|
||||
int bit;
|
||||
bit = (d>>(nbBits-1))&1;
|
||||
bits->bytes[bits->bytePtr] |= bit<<(7-bits->bitPtr);
|
||||
bits->bitPtr++;
|
||||
|
||||
if (bits->bitPtr==8)
|
||||
{
|
||||
bits->bitPtr=0;
|
||||
bits->bytePtr++;
|
||||
}
|
||||
bits->nbBits++;
|
||||
nbBits--;
|
||||
}
|
||||
}
|
||||
|
||||
int speex_bits_unpack_signed(SpeexBits *bits, int nbBits)
|
||||
{
|
||||
unsigned int d=speex_bits_unpack_unsigned(bits,nbBits);
|
||||
/* If number is negative */
|
||||
if (d>>(nbBits-1))
|
||||
{
|
||||
d |= (-1)<<nbBits;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits)
|
||||
{
|
||||
unsigned int d=0;
|
||||
if ((bits->bytePtr<<3)+bits->bitPtr+nbBits>bits->nbBits)
|
||||
bits->overflow=1;
|
||||
if (bits->overflow)
|
||||
return 0;
|
||||
while(nbBits)
|
||||
{
|
||||
d<<=1;
|
||||
d |= (bits->bytes[bits->bytePtr]>>(7-bits->bitPtr))&1;
|
||||
bits->bitPtr++;
|
||||
if (bits->bitPtr==8)
|
||||
{
|
||||
bits->bitPtr=0;
|
||||
bits->bytePtr++;
|
||||
}
|
||||
nbBits--;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits)
|
||||
{
|
||||
unsigned int d=0;
|
||||
int bitPtr, bytePtr;
|
||||
char *bytes;
|
||||
|
||||
if ((bits->bytePtr<<3)+bits->bitPtr+nbBits>bits->nbBits)
|
||||
bits->overflow=1;
|
||||
if (bits->overflow)
|
||||
return 0;
|
||||
|
||||
bitPtr=bits->bitPtr;
|
||||
bytePtr=bits->bytePtr;
|
||||
bytes = bits->bytes;
|
||||
while(nbBits)
|
||||
{
|
||||
d<<=1;
|
||||
d |= (bytes[bytePtr]>>(7-bitPtr))&1;
|
||||
bitPtr++;
|
||||
if (bitPtr==8)
|
||||
{
|
||||
bitPtr=0;
|
||||
bytePtr++;
|
||||
}
|
||||
nbBits--;
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
int speex_bits_peek(SpeexBits *bits)
|
||||
{
|
||||
if ((bits->bytePtr<<3)+bits->bitPtr+1>bits->nbBits)
|
||||
bits->overflow=1;
|
||||
if (bits->overflow)
|
||||
return 0;
|
||||
return (bits->bytes[bits->bytePtr]>>(7-bits->bitPtr))&1;
|
||||
}
|
||||
|
||||
void speex_bits_advance(SpeexBits *bits, int n)
|
||||
{
|
||||
int nbytes, nbits;
|
||||
|
||||
if ((bits->bytePtr<<3)+bits->bitPtr+n>bits->nbBits)
|
||||
bits->overflow=1;
|
||||
if (bits->overflow)
|
||||
return;
|
||||
|
||||
nbytes = n >> 3;
|
||||
nbits = n & 7;
|
||||
|
||||
bits->bytePtr += nbytes;
|
||||
bits->bitPtr += nbits;
|
||||
|
||||
if (bits->bitPtr>7)
|
||||
{
|
||||
bits->bitPtr-=8;
|
||||
bits->bytePtr++;
|
||||
}
|
||||
}
|
||||
|
||||
int speex_bits_remaining(SpeexBits *bits)
|
||||
{
|
||||
if (bits->overflow)
|
||||
return -1;
|
||||
else
|
||||
return bits->nbBits-((bits->bytePtr<<3)+bits->bitPtr);
|
||||
}
|
||||
|
||||
int speex_bits_nbytes(SpeexBits *bits)
|
||||
{
|
||||
return ((bits->nbBits+7)>>3);
|
||||
}
|
||||
|
||||
void speex_bits_insert_terminator(SpeexBits *bits)
|
||||
{
|
||||
if (bits->bitPtr<7)
|
||||
speex_bits_pack(bits, 0, 1);
|
||||
while (bits->bitPtr<7)
|
||||
speex_bits_pack(bits, 1, 1);
|
||||
}
|
||||
@@ -1,387 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: cb_search.c
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#include "cb_search.h"
|
||||
#include "filters.h"
|
||||
#include "stack_alloc.h"
|
||||
#include "vq.h"
|
||||
#include "misc.h"
|
||||
|
||||
void split_cb_search_shape_sign(
|
||||
float target[], /* target vector */
|
||||
float ak[], /* LPCs for this subframe */
|
||||
float awk1[], /* Weighted LPCs for this subframe */
|
||||
float awk2[], /* Weighted LPCs for this subframe */
|
||||
void *par, /* Codebook/search parameters*/
|
||||
int p, /* number of LPC coeffs */
|
||||
int nsf, /* number of samples in subframe */
|
||||
float *exc,
|
||||
float *r,
|
||||
SpeexBits *bits,
|
||||
char *stack,
|
||||
int complexity
|
||||
)
|
||||
{
|
||||
int i,j,k,m,n,q;
|
||||
float *resp;
|
||||
float *t, *e, *E, *r2;
|
||||
float *tmp;
|
||||
float *ndist, *odist;
|
||||
int *itmp;
|
||||
float **ot, **nt;
|
||||
int **nind, **oind;
|
||||
int *ind;
|
||||
signed char *shape_cb;
|
||||
int shape_cb_size, subvect_size, nb_subvect;
|
||||
split_cb_params *params;
|
||||
int N=2;
|
||||
int *best_index;
|
||||
float *best_dist;
|
||||
int have_sign;
|
||||
|
||||
N=complexity;
|
||||
if (N>10)
|
||||
N=10;
|
||||
|
||||
ot=PUSH(stack, N, float*);
|
||||
nt=PUSH(stack, N, float*);
|
||||
oind=PUSH(stack, N, int*);
|
||||
nind=PUSH(stack, N, int*);
|
||||
|
||||
params = (split_cb_params *) par;
|
||||
subvect_size = params->subvect_size;
|
||||
nb_subvect = params->nb_subvect;
|
||||
shape_cb_size = 1<<params->shape_bits;
|
||||
shape_cb = params->shape_cb;
|
||||
have_sign = params->have_sign;
|
||||
resp = PUSH(stack, shape_cb_size*subvect_size, float);
|
||||
t = PUSH(stack, nsf, float);
|
||||
e = PUSH(stack, nsf, float);
|
||||
r2 = PUSH(stack, nsf, float);
|
||||
E = PUSH(stack, shape_cb_size, float);
|
||||
ind = PUSH(stack, nb_subvect, int);
|
||||
|
||||
tmp = PUSH(stack, 2*N*nsf, float);
|
||||
for (i=0;i<N;i++)
|
||||
{
|
||||
ot[i]=tmp;
|
||||
tmp += nsf;
|
||||
nt[i]=tmp;
|
||||
tmp += nsf;
|
||||
}
|
||||
|
||||
best_index = PUSH(stack, N, int);
|
||||
best_dist = PUSH(stack, N, float);
|
||||
ndist = PUSH(stack, N, float);
|
||||
odist = PUSH(stack, N, float);
|
||||
|
||||
itmp = PUSH(stack, 2*N*nb_subvect, int);
|
||||
for (i=0;i<N;i++)
|
||||
{
|
||||
nind[i]=itmp;
|
||||
itmp+=nb_subvect;
|
||||
oind[i]=itmp;
|
||||
itmp+=nb_subvect;
|
||||
for (j=0;j<nb_subvect;j++)
|
||||
nind[i][j]=oind[i][j]=-1;
|
||||
}
|
||||
|
||||
for (j=0;j<N;j++)
|
||||
for (i=0;i<nsf;i++)
|
||||
ot[j][i]=target[i];
|
||||
|
||||
for (i=0;i<nsf;i++)
|
||||
t[i]=target[i];
|
||||
|
||||
/* Pre-compute codewords response and energy */
|
||||
for (i=0;i<shape_cb_size;i++)
|
||||
{
|
||||
float *res;
|
||||
signed char *shape;
|
||||
|
||||
res = resp+i*subvect_size;
|
||||
shape = shape_cb+i*subvect_size;
|
||||
|
||||
/* Compute codeword response using convolution with impulse response */
|
||||
for(j=0;j<subvect_size;j++)
|
||||
{
|
||||
res[j]=0;
|
||||
for (k=0;k<=j;k++)
|
||||
res[j] += 0.03125*shape[k]*r[j-k];
|
||||
}
|
||||
|
||||
/* Compute codeword energy */
|
||||
E[i]=0;
|
||||
for(j=0;j<subvect_size;j++)
|
||||
E[i]+=res[j]*res[j];
|
||||
}
|
||||
|
||||
for (j=0;j<N;j++)
|
||||
odist[j]=0;
|
||||
/*For all subvectors*/
|
||||
for (i=0;i<nb_subvect;i++)
|
||||
{
|
||||
/*"erase" nbest list*/
|
||||
for (j=0;j<N;j++)
|
||||
ndist[j]=-1;
|
||||
|
||||
/*For all n-bests of previous subvector*/
|
||||
for (j=0;j<N;j++)
|
||||
{
|
||||
float *x=ot[j]+subvect_size*i;
|
||||
/*Find new n-best based on previous n-best j*/
|
||||
if (have_sign)
|
||||
vq_nbest_sign(x, resp, subvect_size, shape_cb_size, E, N, best_index, best_dist);
|
||||
else
|
||||
vq_nbest(x, resp, subvect_size, shape_cb_size, E, N, best_index, best_dist);
|
||||
|
||||
/*For all new n-bests*/
|
||||
for (k=0;k<N;k++)
|
||||
{
|
||||
float *ct;
|
||||
float err=0;
|
||||
ct = ot[j];
|
||||
/*update target*/
|
||||
|
||||
/*previous target*/
|
||||
for (m=i*subvect_size;m<(i+1)*subvect_size;m++)
|
||||
t[m]=ct[m];
|
||||
|
||||
/* New code: update only enough of the target to calculate error*/
|
||||
{
|
||||
int rind;
|
||||
float *res;
|
||||
float sign=1;
|
||||
rind = best_index[k];
|
||||
if (rind>=shape_cb_size)
|
||||
{
|
||||
sign=-1;
|
||||
rind-=shape_cb_size;
|
||||
}
|
||||
res = resp+rind*subvect_size;
|
||||
if (sign>0)
|
||||
for (m=0;m<subvect_size;m++)
|
||||
t[subvect_size*i+m] -= res[m];
|
||||
else
|
||||
for (m=0;m<subvect_size;m++)
|
||||
t[subvect_size*i+m] += res[m];
|
||||
}
|
||||
|
||||
/*compute error (distance)*/
|
||||
err=odist[j];
|
||||
for (m=i*subvect_size;m<(i+1)*subvect_size;m++)
|
||||
err += t[m]*t[m];
|
||||
/*update n-best list*/
|
||||
if (err<ndist[N-1] || ndist[N-1]<-.5)
|
||||
{
|
||||
|
||||
/*previous target (we don't care what happened before*/
|
||||
for (m=(i+1)*subvect_size;m<nsf;m++)
|
||||
t[m]=ct[m];
|
||||
/* New code: update the rest of the target only if it's worth it */
|
||||
for (m=0;m<subvect_size;m++)
|
||||
{
|
||||
float g;
|
||||
int rind;
|
||||
float sign=1;
|
||||
rind = best_index[k];
|
||||
if (rind>=shape_cb_size)
|
||||
{
|
||||
sign=-1;
|
||||
rind-=shape_cb_size;
|
||||
}
|
||||
|
||||
g=sign*0.03125*shape_cb[rind*subvect_size+m];
|
||||
q=subvect_size-m;
|
||||
for (n=subvect_size*(i+1);n<nsf;n++,q++)
|
||||
t[n] -= g*r[q];
|
||||
}
|
||||
|
||||
|
||||
for (m=0;m<N;m++)
|
||||
{
|
||||
if (err < ndist[m] || ndist[m]<-.5)
|
||||
{
|
||||
for (n=N-1;n>m;n--)
|
||||
{
|
||||
for (q=(i+1)*subvect_size;q<nsf;q++)
|
||||
nt[n][q]=nt[n-1][q];
|
||||
for (q=0;q<nb_subvect;q++)
|
||||
nind[n][q]=nind[n-1][q];
|
||||
ndist[n]=ndist[n-1];
|
||||
}
|
||||
for (q=(i+1)*subvect_size;q<nsf;q++)
|
||||
nt[m][q]=t[q];
|
||||
for (q=0;q<nb_subvect;q++)
|
||||
nind[m][q]=oind[j][q];
|
||||
nind[m][i]=best_index[k];
|
||||
ndist[m]=err;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i==0)
|
||||
break;
|
||||
}
|
||||
|
||||
/*update old-new data*/
|
||||
/* just swap pointers instead of a long copy */
|
||||
{
|
||||
float **tmp2;
|
||||
tmp2=ot;
|
||||
ot=nt;
|
||||
nt=tmp2;
|
||||
}
|
||||
for (j=0;j<N;j++)
|
||||
for (m=0;m<nb_subvect;m++)
|
||||
oind[j][m]=nind[j][m];
|
||||
for (j=0;j<N;j++)
|
||||
odist[j]=ndist[j];
|
||||
}
|
||||
|
||||
/*save indices*/
|
||||
for (i=0;i<nb_subvect;i++)
|
||||
{
|
||||
ind[i]=nind[0][i];
|
||||
speex_bits_pack(bits,ind[i],params->shape_bits+have_sign);
|
||||
}
|
||||
|
||||
/* Put everything back together */
|
||||
for (i=0;i<nb_subvect;i++)
|
||||
{
|
||||
int rind;
|
||||
float sign=1;
|
||||
rind = ind[i];
|
||||
if (rind>=shape_cb_size)
|
||||
{
|
||||
sign=-1;
|
||||
rind-=shape_cb_size;
|
||||
}
|
||||
|
||||
for (j=0;j<subvect_size;j++)
|
||||
e[subvect_size*i+j]=sign*0.03125*shape_cb[rind*subvect_size+j];
|
||||
}
|
||||
/* Update excitation */
|
||||
for (j=0;j<nsf;j++)
|
||||
exc[j]+=e[j];
|
||||
|
||||
/* Update target */
|
||||
syn_percep_zero(e, ak, awk1, awk2, r2, nsf,p, stack);
|
||||
for (j=0;j<nsf;j++)
|
||||
target[j]-=r2[j];
|
||||
|
||||
}
|
||||
|
||||
|
||||
void split_cb_shape_sign_unquant(
|
||||
float *exc,
|
||||
void *par, /* non-overlapping codebook */
|
||||
int nsf, /* number of samples in subframe */
|
||||
SpeexBits *bits,
|
||||
char *stack
|
||||
)
|
||||
{
|
||||
int i,j;
|
||||
int *ind, *signs;
|
||||
signed char *shape_cb;
|
||||
int shape_cb_size, subvect_size, nb_subvect;
|
||||
split_cb_params *params;
|
||||
int have_sign;
|
||||
|
||||
params = (split_cb_params *) par;
|
||||
subvect_size = params->subvect_size;
|
||||
nb_subvect = params->nb_subvect;
|
||||
shape_cb_size = 1<<params->shape_bits;
|
||||
shape_cb = params->shape_cb;
|
||||
have_sign = params->have_sign;
|
||||
|
||||
ind = PUSH(stack, nb_subvect, int);
|
||||
signs = PUSH(stack, nb_subvect, int);
|
||||
|
||||
/* Decode codewords and gains */
|
||||
for (i=0;i<nb_subvect;i++)
|
||||
{
|
||||
if (have_sign)
|
||||
signs[i] = speex_bits_unpack_unsigned(bits, 1);
|
||||
else
|
||||
signs[i] = 0;
|
||||
ind[i] = speex_bits_unpack_unsigned(bits, params->shape_bits);
|
||||
}
|
||||
/* Compute decoded excitation */
|
||||
for (i=0;i<nb_subvect;i++)
|
||||
{
|
||||
float s=1;
|
||||
if (signs[i])
|
||||
s=-1;
|
||||
for (j=0;j<subvect_size;j++)
|
||||
exc[subvect_size*i+j]+=s*0.03125*shape_cb[ind[i]*subvect_size+j];
|
||||
}
|
||||
}
|
||||
|
||||
void noise_codebook_quant(
|
||||
float target[], /* target vector */
|
||||
float ak[], /* LPCs for this subframe */
|
||||
float awk1[], /* Weighted LPCs for this subframe */
|
||||
float awk2[], /* Weighted LPCs for this subframe */
|
||||
void *par, /* Codebook/search parameters*/
|
||||
int p, /* number of LPC coeffs */
|
||||
int nsf, /* number of samples in subframe */
|
||||
float *exc,
|
||||
float *r,
|
||||
SpeexBits *bits,
|
||||
char *stack,
|
||||
int complexity
|
||||
)
|
||||
{
|
||||
int i;
|
||||
float *tmp=PUSH(stack, nsf, float);
|
||||
residue_percep_zero(target, ak, awk1, awk2, tmp, nsf, p, stack);
|
||||
|
||||
for (i=0;i<nsf;i++)
|
||||
exc[i]+=tmp[i];
|
||||
for (i=0;i<nsf;i++)
|
||||
target[i]=0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void noise_codebook_unquant(
|
||||
float *exc,
|
||||
void *par, /* non-overlapping codebook */
|
||||
int nsf, /* number of samples in subframe */
|
||||
SpeexBits *bits,
|
||||
char *stack
|
||||
)
|
||||
{
|
||||
speex_rand_vec(1, exc, nsf);
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin & David Rowe
|
||||
File: cb_search.c
|
||||
Overlapped codebook search
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef CB_SEARCH_H
|
||||
#define CB_SEARCH_H
|
||||
|
||||
#include "speex_bits.h"
|
||||
|
||||
typedef struct split_cb_params {
|
||||
int subvect_size;
|
||||
int nb_subvect;
|
||||
signed char *shape_cb;
|
||||
int shape_bits;
|
||||
int have_sign;
|
||||
} split_cb_params;
|
||||
|
||||
|
||||
void split_cb_search_shape_sign(
|
||||
float target[], /* target vector */
|
||||
float ak[], /* LPCs for this subframe */
|
||||
float awk1[], /* Weighted LPCs for this subframe */
|
||||
float awk2[], /* Weighted LPCs for this subframe */
|
||||
void *par, /* Codebook/search parameters*/
|
||||
int p, /* number of LPC coeffs */
|
||||
int nsf, /* number of samples in subframe */
|
||||
float *exc,
|
||||
float *r,
|
||||
SpeexBits *bits,
|
||||
char *stack,
|
||||
int complexity
|
||||
);
|
||||
|
||||
void split_cb_shape_sign_unquant(
|
||||
float *exc,
|
||||
void *par, /* non-overlapping codebook */
|
||||
int nsf, /* number of samples in subframe */
|
||||
SpeexBits *bits,
|
||||
char *stack
|
||||
);
|
||||
|
||||
|
||||
void noise_codebook_quant(
|
||||
float target[], /* target vector */
|
||||
float ak[], /* LPCs for this subframe */
|
||||
float awk1[], /* Weighted LPCs for this subframe */
|
||||
float awk2[], /* Weighted LPCs for this subframe */
|
||||
void *par, /* Codebook/search parameters*/
|
||||
int p, /* number of LPC coeffs */
|
||||
int nsf, /* number of samples in subframe */
|
||||
float *exc,
|
||||
float *r,
|
||||
SpeexBits *bits,
|
||||
char *stack,
|
||||
int complexity
|
||||
);
|
||||
|
||||
|
||||
void noise_codebook_unquant(
|
||||
float *exc,
|
||||
void *par, /* non-overlapping codebook */
|
||||
int nsf, /* number of samples in subframe */
|
||||
SpeexBits *bits,
|
||||
char *stack
|
||||
);
|
||||
|
||||
#endif
|
||||
@@ -1,50 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: exc_10_16_table.c
|
||||
Codebook for excitation in narrowband CELP mode (3200 bps)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
signed char exc_10_16_table[160] = {
|
||||
22,39,14,44,11,35,-2,23,-4,6,
|
||||
46,-28,13,-27,-23,12,4,20,-5,9,
|
||||
37,-18,-23,23,0,9,-6,-20,4,-1,
|
||||
-17,-5,-4,17,0,1,9,-2,1,2,
|
||||
2,-12,8,-25,39,15,9,16,-55,-11,
|
||||
9,11,5,10,-2,-60,8,13,-6,11,
|
||||
-16,27,-47,-12,11,1,16,-7,9,-3,
|
||||
-29,9,-14,25,-19,34,36,12,40,-10,
|
||||
-3,-24,-14,-37,-21,-35,-2,-36,3,-6,
|
||||
67,28,6,-17,-3,-12,-16,-15,-17,-7,
|
||||
-59,-36,-13,1,7,1,2,10,2,11,
|
||||
13,10,8,-2,7,3,5,4,2,2,
|
||||
-3,-8,4,-5,6,7,-42,15,35,-2,
|
||||
-46,38,28,-20,-9,1,7,-3,0,-2,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
-15,-28,52,32,5,-5,-17,-20,-10,-1};
|
||||
@@ -1,66 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: exc_10_32_table.c
|
||||
Codebook for excitation in narrowband CELP mode (4000 bps)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
signed char exc_10_32_table[320] = {
|
||||
7,17,17,27,25,22,12,4,-3,0,
|
||||
28,-36,39,-24,-15,3,-9,15,-5,10,
|
||||
31,-28,11,31,-21,9,-11,-11,-2,-7,
|
||||
-25,14,-22,31,4,-14,19,-12,14,-5,
|
||||
4,-7,4,-5,9,0,-2,42,-47,-16,
|
||||
1,8,0,9,23,-57,0,28,-11,6,
|
||||
-31,55,-45,3,-5,4,2,-2,4,-7,
|
||||
-3,6,-2,7,-3,12,5,8,54,-10,
|
||||
8,-7,-8,-24,-25,-27,-14,-5,8,5,
|
||||
44,23,5,-9,-11,-11,-13,-9,-12,-8,
|
||||
-29,-8,-22,6,-15,3,-12,-1,-5,-3,
|
||||
34,-1,29,-16,17,-4,12,2,1,4,
|
||||
-2,-4,2,-1,11,-3,-52,28,30,-9,
|
||||
-32,25,44,-20,-24,4,6,-1,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,
|
||||
-25,-10,22,29,13,-13,-22,-13,-4,0,
|
||||
-4,-16,10,15,-36,-24,28,25,-1,-3,
|
||||
66,-33,-11,-15,6,0,3,4,-2,5,
|
||||
24,-20,-47,29,19,-2,-4,-1,0,-1,
|
||||
-2,3,1,8,-11,5,5,-57,28,28,
|
||||
0,-16,4,-4,12,-6,-1,2,-20,61,
|
||||
-9,24,-22,-42,29,6,17,8,4,2,
|
||||
-65,15,8,10,5,6,5,3,2,-2,
|
||||
-3,5,-9,4,-5,23,13,23,-3,-63,
|
||||
3,-5,-4,-6,0,-3,23,-36,-46,9,
|
||||
5,5,8,4,9,-5,1,-3,10,1,
|
||||
-6,10,-11,24,-47,31,22,-12,14,-10,
|
||||
6,11,-7,-7,7,-31,51,-12,-6,7,
|
||||
6,-17,9,-11,-20,52,-19,3,-6,-6,
|
||||
-8,-5,23,-41,37,1,-21,10,-14,8,
|
||||
7,5,-15,-15,23,39,-26,-33,7,2,
|
||||
-32,-30,-21,-8,4,12,17,15,14,11};
|
||||
@@ -1,66 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: exc_20_32_table.c
|
||||
Codebook for excitation in narrowband CELP mode (2000 bps)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
signed char exc_20_32_table[640] = {
|
||||
12,32,25,46,36,33,9,14,-3,6,1,-8,0,-10,-5,-7,-7,-7,-5,-5,
|
||||
31,-27,24,-32,-4,10,-11,21,-3,19,23,-9,22,24,-10,-1,-10,-13,-7,-11,
|
||||
42,-33,31,19,-8,0,-10,-16,1,-21,-17,10,-8,14,8,4,11,-2,5,-2,
|
||||
-33,11,-16,33,11,-4,9,-4,11,2,6,-5,8,-5,11,-4,-6,26,-36,-16,
|
||||
0,4,-2,-8,12,6,-1,34,-46,-22,9,9,21,9,5,-66,-5,26,2,10,
|
||||
13,2,19,9,12,-81,3,13,13,0,-14,22,-35,6,-7,-4,6,-6,10,-6,
|
||||
-31,38,-33,0,-10,-11,5,-12,12,-17,5,0,-6,13,-9,10,8,25,33,2,
|
||||
-12,8,-6,10,-2,21,7,17,43,5,11,-7,-9,-20,-36,-20,-23,-4,-4,-3,
|
||||
27,-9,-9,-49,-39,-38,-11,-9,6,5,23,25,5,3,3,4,1,2,-3,-1,
|
||||
87,39,17,-21,-9,-19,-9,-15,-13,-14,-17,-11,-10,-11,-8,-6,-1,-3,-3,-1,
|
||||
-54,-34,-27,-8,-11,-4,-5,0,0,4,8,6,9,7,9,7,6,5,5,5,
|
||||
48,10,19,-10,12,-1,9,-3,2,5,-3,2,-2,-2,0,-2,-26,6,9,-7,
|
||||
-16,-9,2,7,7,-5,-43,11,22,-11,-9,34,37,-15,-13,-6,1,-1,1,1,
|
||||
-64,56,52,-11,-27,5,4,3,1,2,1,3,-1,-4,-4,-10,-7,-4,-4,2,
|
||||
-1,-7,-7,-12,-10,-15,-9,-5,-5,-11,-16,-13,6,16,4,-13,-16,-10,-4,2,
|
||||
-47,-13,25,47,19,-14,-20,-8,-17,0,-3,-13,1,6,-17,-14,15,1,10,6,
|
||||
-24,0,-10,19,-69,-8,14,49,17,-5,33,-29,3,-4,0,2,-8,5,-6,2,
|
||||
120,-56,-12,-47,23,-9,6,-5,1,2,-5,1,-10,4,-1,-1,4,-1,0,-3,
|
||||
30,-52,-67,30,22,11,-1,-4,3,0,7,2,0,1,-10,-4,-8,-13,5,1,
|
||||
1,-1,5,13,-9,-3,-10,-62,22,48,-4,-6,2,3,5,1,1,4,1,13,
|
||||
3,-20,10,-9,13,-2,-4,9,-20,44,-1,20,-32,-67,19,0,28,11,8,2,
|
||||
-11,15,-19,-53,31,2,34,10,6,-4,-58,8,10,13,14,1,12,2,0,0,
|
||||
-128,37,-8,44,-9,26,-3,18,2,6,11,-1,9,1,5,3,0,1,1,2,
|
||||
12,3,-2,-3,7,25,9,18,-6,-37,3,-8,-16,3,-10,-7,17,-34,-44,11,
|
||||
17,-15,-3,-16,-1,-13,11,-46,-65,-2,8,13,2,4,4,5,15,5,9,6,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
-9,19,-12,12,-28,38,29,-1,12,2,5,23,-10,3,4,-15,21,-4,3,3,
|
||||
6,17,-9,-4,-8,-20,26,5,-10,6,1,-19,18,-15,-12,47,-6,-2,-7,-9,
|
||||
-1,-17,-2,-2,-14,30,-14,2,-7,-4,-1,-12,11,-25,16,-3,-12,11,-7,7,
|
||||
-17,1,19,-28,31,-7,-10,7,-10,3,12,5,-16,6,24,41,-29,-54,0,1,
|
||||
7,-1,5,-6,13,10,-4,-8,8,-9,-27,-53,-38,-1,10,19,17,16,12,12,
|
||||
0,3,-7,-4,13,12,-31,-14,6,-5,3,5,17,43,50,25,10,1,-6,-2};
|
||||
@@ -1,290 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: exc_5_256_table.c
|
||||
Codebook for excitation in narrowband CELP mode (12800 bps)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
signed char exc_5_256_table[1280] = {
|
||||
-8,-37,5,-43,5,
|
||||
73,61,39,12,-3,
|
||||
-61,-32,2,42,30,
|
||||
-3,17,-27,9,34,
|
||||
20,-1,-5,2,23,
|
||||
-7,-46,26,53,-47,
|
||||
20,-2,-33,-89,-51,
|
||||
-64,27,11,15,-34,
|
||||
-5,-56,25,-9,-1,
|
||||
-29,1,40,67,-23,
|
||||
-16,16,33,19,7,
|
||||
14,85,22,-10,-10,
|
||||
-12,-7,-1,52,89,
|
||||
29,11,-20,-37,-46,
|
||||
-15,17,-24,-28,24,
|
||||
2,1,0,23,-101,
|
||||
23,14,-1,-23,-18,
|
||||
9,5,-13,38,1,
|
||||
-28,-28,4,27,51,
|
||||
-26,34,-40,35,47,
|
||||
54,38,-54,-26,-6,
|
||||
42,-25,13,-30,-36,
|
||||
18,41,-4,-33,23,
|
||||
-32,-7,-4,51,-3,
|
||||
17,-52,56,-47,36,
|
||||
-2,-21,36,10,8,
|
||||
-33,31,19,9,-5,
|
||||
-40,10,-9,-21,19,
|
||||
18,-78,-18,-5,0,
|
||||
-26,-36,-47,-51,-44,
|
||||
18,40,27,-2,29,
|
||||
49,-26,2,32,-54,
|
||||
30,-73,54,3,-5,
|
||||
36,22,53,10,-1,
|
||||
-84,-53,-29,-5,3,
|
||||
-44,53,-51,4,22,
|
||||
71,-35,-1,33,-5,
|
||||
-27,-7,36,17,-23,
|
||||
-39,16,-9,-55,-15,
|
||||
-20,39,-35,6,-39,
|
||||
-14,18,48,-64,-17,
|
||||
-15,9,39,81,37,
|
||||
-68,37,47,-21,-6,
|
||||
-104,13,6,9,-2,
|
||||
35,8,-23,18,42,
|
||||
45,21,33,-5,-49,
|
||||
9,-6,-43,-56,39,
|
||||
2,-16,-25,87,1,
|
||||
-3,-9,17,-25,-11,
|
||||
-9,-1,10,2,-14,
|
||||
-14,4,-1,-10,28,
|
||||
-23,40,-32,26,-9,
|
||||
26,4,-27,-23,3,
|
||||
42,-60,1,49,-3,
|
||||
27,10,-52,-40,-2,
|
||||
18,45,-23,17,-44,
|
||||
3,-3,17,-46,52,
|
||||
-40,-47,25,75,31,
|
||||
-49,53,30,-30,-32,
|
||||
-36,38,-6,-15,-16,
|
||||
54,-27,-48,3,38,
|
||||
-29,-32,-22,-14,-4,
|
||||
-23,-13,32,-39,9,
|
||||
8,-45,-13,34,-16,
|
||||
49,40,32,31,28,
|
||||
23,23,32,47,59,
|
||||
-68,8,62,44,25,
|
||||
-14,-24,-65,-16,36,
|
||||
67,-25,-38,-21,4,
|
||||
-33,-2,42,5,-63,
|
||||
40,11,26,-42,-23,
|
||||
-61,79,-31,23,-20,
|
||||
10,-32,53,-25,-36,
|
||||
10,-26,-5,3,0,
|
||||
-71,5,-10,-37,1,
|
||||
-24,21,-54,-17,1,
|
||||
-29,-25,-15,-27,32,
|
||||
68,45,-16,-37,-18,
|
||||
-5,1,0,-77,71,
|
||||
-6,3,-20,71,-67,
|
||||
29,-35,10,-30,19,
|
||||
4,16,17,5,0,
|
||||
-14,19,2,28,26,
|
||||
59,3,2,24,39,
|
||||
55,-50,-45,-18,-17,
|
||||
33,-35,14,-1,1,
|
||||
8,87,-35,-29,0,
|
||||
-27,13,-7,23,-13,
|
||||
37,-40,50,-35,14,
|
||||
19,-7,-14,49,54,
|
||||
-5,22,-2,-29,-8,
|
||||
-27,38,13,27,48,
|
||||
12,-41,-21,-15,28,
|
||||
7,-16,-24,-19,-20,
|
||||
11,-20,9,2,13,
|
||||
23,-20,11,27,-27,
|
||||
71,-69,8,2,-6,
|
||||
22,12,16,16,9,
|
||||
-16,-8,-17,1,25,
|
||||
1,40,-37,-33,66,
|
||||
94,53,4,-22,-25,
|
||||
-41,-42,25,35,-16,
|
||||
-15,57,31,-29,-32,
|
||||
21,16,-60,45,15,
|
||||
-1,7,57,-26,-47,
|
||||
-29,11,8,15,19,
|
||||
-105,-8,54,27,10,
|
||||
-17,6,-12,-1,-10,
|
||||
4,0,23,-10,31,
|
||||
13,11,10,12,-64,
|
||||
23,-3,-8,-19,16,
|
||||
52,24,-40,16,10,
|
||||
40,5,9,0,-13,
|
||||
-7,-21,-8,-6,-7,
|
||||
-21,59,16,-53,18,
|
||||
-60,11,-47,14,-18,
|
||||
25,-13,-24,4,-39,
|
||||
16,-28,54,26,-67,
|
||||
30,27,-20,-52,20,
|
||||
-12,55,12,18,-16,
|
||||
39,-14,-6,-26,56,
|
||||
-88,-55,12,25,26,
|
||||
-37,6,75,0,-34,
|
||||
-81,54,-30,1,-7,
|
||||
49,-23,-14,21,10,
|
||||
-62,-58,-57,-47,-34,
|
||||
15,-4,34,-78,31,
|
||||
25,-11,7,50,-10,
|
||||
42,-63,14,-36,-4,
|
||||
57,55,57,53,42,
|
||||
-42,-1,15,40,37,
|
||||
15,25,-11,6,1,
|
||||
31,-2,-6,-1,-7,
|
||||
-64,34,28,30,-1,
|
||||
3,21,0,-88,-12,
|
||||
-56,25,-28,40,8,
|
||||
-28,-14,9,12,2,
|
||||
-6,-17,22,49,-6,
|
||||
-26,14,28,-20,4,
|
||||
-12,50,35,40,13,
|
||||
-38,-58,-29,17,30,
|
||||
22,60,26,-54,-39,
|
||||
-12,58,-28,-63,10,
|
||||
-21,-8,-12,26,-62,
|
||||
6,-10,-11,-22,-6,
|
||||
-7,4,1,18,2,
|
||||
-70,11,14,4,13,
|
||||
19,-24,-34,24,67,
|
||||
17,51,-21,13,23,
|
||||
54,-30,48,1,-13,
|
||||
80,26,-16,-2,13,
|
||||
-4,6,-30,29,-24,
|
||||
73,-58,30,-27,20,
|
||||
-2,-21,41,45,30,
|
||||
-27,-3,-5,-18,-20,
|
||||
-49,-3,-35,10,42,
|
||||
-19,-67,-53,-11,9,
|
||||
13,-15,-33,-51,-30,
|
||||
15,7,25,-30,4,
|
||||
28,-22,-34,54,-29,
|
||||
39,-46,20,16,34,
|
||||
-4,47,75,1,-44,
|
||||
-55,-24,7,-1,9,
|
||||
-42,50,-8,-36,41,
|
||||
68,0,-4,-10,-23,
|
||||
-15,-50,64,36,-9,
|
||||
-27,12,25,-38,-47,
|
||||
-37,32,-49,51,-36,
|
||||
2,-4,69,-26,19,
|
||||
7,45,67,46,13,
|
||||
-63,46,15,-47,4,
|
||||
-41,13,-6,5,-21,
|
||||
37,26,-55,-7,33,
|
||||
-1,-28,10,-17,-64,
|
||||
-14,0,-36,-17,93,
|
||||
-3,-9,-66,44,-21,
|
||||
3,-12,38,-6,-13,
|
||||
-12,19,13,43,-43,
|
||||
-10,-12,6,-5,9,
|
||||
-49,32,-5,2,4,
|
||||
5,15,-16,10,-21,
|
||||
8,-62,-8,64,8,
|
||||
79,-1,-66,-49,-18,
|
||||
5,40,-5,-30,-45,
|
||||
1,-6,21,-32,93,
|
||||
-18,-30,-21,32,21,
|
||||
-18,22,8,5,-41,
|
||||
-54,80,22,-10,-7,
|
||||
-8,-23,-64,66,56,
|
||||
-14,-30,-41,-46,-14,
|
||||
-29,-37,27,-14,42,
|
||||
-2,-9,-29,34,14,
|
||||
33,-14,22,4,10,
|
||||
26,26,28,32,23,
|
||||
-72,-32,3,0,-14,
|
||||
35,-42,-78,-32,6,
|
||||
29,-18,-45,-5,7,
|
||||
-33,-45,-3,-22,-34,
|
||||
8,-8,4,-51,-25,
|
||||
-9,59,-78,21,-5,
|
||||
-25,-48,66,-15,-17,
|
||||
-24,-49,-13,25,-23,
|
||||
-64,-6,40,-24,-19,
|
||||
-11,57,-33,-8,1,
|
||||
10,-52,-54,28,39,
|
||||
49,34,-11,-61,-41,
|
||||
-43,10,15,-15,51,
|
||||
30,15,-51,32,-34,
|
||||
-2,-34,14,18,16,
|
||||
1,1,-3,-3,1,
|
||||
1,-18,6,16,48,
|
||||
12,-5,-42,7,36,
|
||||
48,7,-20,-10,7,
|
||||
12,2,54,39,-38,
|
||||
37,54,4,-11,-8,
|
||||
-46,-10,5,-10,-34,
|
||||
46,-12,29,-37,39,
|
||||
36,-11,24,56,17,
|
||||
14,20,25,0,-25,
|
||||
-28,55,-7,-5,27,
|
||||
3,9,-26,-8,6,
|
||||
-24,-10,-30,-31,-34,
|
||||
18,4,22,21,40,
|
||||
-1,-29,-37,-8,-21,
|
||||
92,-29,11,-3,11,
|
||||
73,23,22,7,4,
|
||||
-44,-9,-11,21,-13,
|
||||
11,9,-78,-1,47,
|
||||
114,-12,-37,-19,-5,
|
||||
-11,-22,19,12,-30,
|
||||
7,38,45,-21,-8,
|
||||
-9,55,-45,56,-21,
|
||||
7,17,46,-57,-87,
|
||||
-6,27,31,31,7,
|
||||
-56,-12,46,21,-5,
|
||||
-12,36,3,3,-21,
|
||||
43,19,12,-7,9,
|
||||
-14,0,-9,-33,-91,
|
||||
7,26,3,-11,64,
|
||||
83,-31,-46,25,2,
|
||||
9,5,2,2,-1,
|
||||
20,-17,10,-5,-27,
|
||||
-8,20,8,-19,16,
|
||||
-21,-13,-31,5,5,
|
||||
42,24,9,34,-20,
|
||||
28,-61,22,11,-39,
|
||||
64,-20,-1,-30,-9,
|
||||
-20,24,-25,-24,-29,
|
||||
22,-60,6,-5,41,
|
||||
-9,-87,14,34,15,
|
||||
-57,52,69,15,-3,
|
||||
-102,58,16,3,6,
|
||||
60,-75,-32,26,7,
|
||||
-57,-27,-32,-24,-21,
|
||||
-29,-16,62,-46,31,
|
||||
30,-27,-15,7,15};
|
||||
@@ -1,98 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: exc_5_64_table.c
|
||||
Codebook for excitation in narrowband CELP mode (9600 bps)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
signed char exc_5_64_table[320]={
|
||||
1,5,-15,49,-66,
|
||||
-48,-4,50,-44,7,
|
||||
37,16,-18,25,-26,
|
||||
-26,-15,19,19,-27,
|
||||
-47,28,57,5,-17,
|
||||
-32,-41,68,21,-2,
|
||||
64,56,8,-16,-13,
|
||||
-26,-9,-16,11,6,
|
||||
-39,25,-19,22,-31,
|
||||
20,-45,55,-43,10,
|
||||
-16,47,-40,40,-20,
|
||||
-51,3,-17,-14,-15,
|
||||
-24,53,-20,-46,46,
|
||||
27,-68,32,3,-18,
|
||||
-5,9,-31,16,-9,
|
||||
-10,-1,-23,48,95,
|
||||
47,25,-41,-32,-3,
|
||||
15,-25,-55,36,41,
|
||||
-27,20,5,13,14,
|
||||
-22,5,2,-23,18,
|
||||
46,-15,17,-18,-34,
|
||||
-5,-8,27,-55,73,
|
||||
16,2,-1,-17,40,
|
||||
-78,33,0,2,19,
|
||||
4,53,-16,-15,-16,
|
||||
-28,-3,-13,49,8,
|
||||
-7,-29,27,-13,32,
|
||||
20,32,-61,16,14,
|
||||
41,44,40,24,20,
|
||||
7,4,48,-60,-77,
|
||||
17,-6,-48,65,-15,
|
||||
32,-30,-71,-10,-3,
|
||||
-6,10,-2,-7,-29,
|
||||
-56,67,-30,7,-5,
|
||||
86,-6,-10,0,5,
|
||||
-31,60,34,-38,-3,
|
||||
24,10,-2,30,23,
|
||||
24,-41,12,70,-43,
|
||||
15,-17,6,13,16,
|
||||
-13,8,30,-15,-8,
|
||||
5,23,-34,-98,-4,
|
||||
-13,13,-48,-31,70,
|
||||
12,31,25,24,-24,
|
||||
26,-7,33,-16,8,
|
||||
5,-11,-14,-8,-65,
|
||||
13,10,-2,-9,0,
|
||||
-3,-68,5,35,7,
|
||||
0,-31,-1,-17,-9,
|
||||
-9,16,-37,-18,-1,
|
||||
69,-48,-28,22,-21,
|
||||
-11,5,49,55,23,
|
||||
-86,-36,16,2,13,
|
||||
63,-51,30,-11,13,
|
||||
24,-18,-6,14,-19,
|
||||
1,41,9,-5,27,
|
||||
-36,-44,-34,-37,-21,
|
||||
-26,31,-39,15,43,
|
||||
5,-8,29,20,-8,
|
||||
-20,-52,-28,-1,13,
|
||||
26,-34,-10,-9,27,
|
||||
-8,8,27,-66,4,
|
||||
12,-22,49,10,-77,
|
||||
32,-18,3,-38,12,
|
||||
-3,-1,2,2,0};
|
||||
@@ -1,162 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: exc_8_128_table.c
|
||||
Codebook for excitation in narrowband CELP mode (7000 bps)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
signed char exc_8_128_table[1024] = {
|
||||
-14,9,13,-32,2,-10,31,-10,
|
||||
-8,-8,6,-4,-1,10,-64,23,
|
||||
6,20,13,6,8,-22,16,34,
|
||||
7,42,-49,-28,5,26,4,-15,
|
||||
41,34,41,32,33,24,23,14,
|
||||
8,40,34,4,-24,-41,-19,-15,
|
||||
13,-13,33,-54,24,27,-44,33,
|
||||
27,-15,-15,24,-19,14,-36,14,
|
||||
-9,24,-12,-4,37,-5,16,-34,
|
||||
5,10,33,-15,-54,-16,12,25,
|
||||
12,1,2,0,3,-1,-4,-4,
|
||||
11,2,-56,54,27,-20,13,-6,
|
||||
-46,-41,-33,-11,-5,7,12,14,
|
||||
-14,-5,8,20,6,3,4,-8,
|
||||
-5,-42,11,8,-14,25,-2,2,
|
||||
13,11,-22,39,-9,9,5,-45,
|
||||
-9,7,-9,12,-7,34,-17,-102,
|
||||
7,2,-42,18,35,-9,-34,11,
|
||||
-5,-2,3,22,46,-52,-25,-9,
|
||||
-94,8,11,-5,-5,-5,4,-7,
|
||||
-35,-7,54,5,-32,3,24,-9,
|
||||
-22,8,65,37,-1,-12,-23,-6,
|
||||
-9,-28,55,-33,14,-3,2,18,
|
||||
-60,41,-17,8,-16,17,-11,0,
|
||||
-11,29,-28,37,9,-53,33,-14,
|
||||
-9,7,-25,-7,-11,26,-32,-8,
|
||||
24,-21,22,-19,19,-10,29,-14,
|
||||
0,0,0,0,0,0,0,0,
|
||||
-5,-52,10,41,6,-30,-4,16,
|
||||
32,22,-27,-22,32,-3,-28,-3,
|
||||
3,-35,6,17,23,21,8,2,
|
||||
4,-45,-17,14,23,-4,-31,-11,
|
||||
-3,14,1,19,-11,2,61,-8,
|
||||
9,-12,7,-10,12,-3,-24,99,
|
||||
-48,23,50,-37,-5,-23,0,8,
|
||||
-14,35,-64,-5,46,-25,13,-1,
|
||||
-49,-19,-15,9,34,50,25,11,
|
||||
-6,-9,-16,-20,-32,-33,-32,-27,
|
||||
10,-8,12,-15,56,-14,-32,33,
|
||||
3,-9,1,65,-9,-9,-10,-2,
|
||||
-6,-23,9,17,3,-28,13,-32,
|
||||
4,-2,-10,4,-16,76,12,-52,
|
||||
6,13,33,-6,4,-14,-9,-3,
|
||||
1,-15,-16,28,1,-15,11,16,
|
||||
9,4,-21,-37,-40,-6,22,12,
|
||||
-15,-23,-14,-17,-16,-9,-10,-9,
|
||||
13,-39,41,5,-9,16,-38,25,
|
||||
46,-47,4,49,-14,17,-2,6,
|
||||
18,5,-6,-33,-22,44,50,-2,
|
||||
1,3,-6,7,7,-3,-21,38,
|
||||
-18,34,-14,-41,60,-13,6,16,
|
||||
-24,35,19,-13,-36,24,3,-17,
|
||||
-14,-10,36,44,-44,-29,-3,3,
|
||||
-54,-8,12,55,26,4,-2,-5,
|
||||
2,-11,22,-23,2,22,1,-25,
|
||||
-39,66,-49,21,-8,-2,10,-14,
|
||||
-60,25,6,10,27,-25,16,5,
|
||||
-2,-9,26,-13,-20,58,-2,7,
|
||||
52,-9,2,5,-4,-15,23,-1,
|
||||
-38,23,8,27,-6,0,-27,-7,
|
||||
39,-10,-14,26,11,-45,-12,9,
|
||||
-5,34,4,-35,10,43,-22,-11,
|
||||
56,-7,20,1,10,1,-26,9,
|
||||
94,11,-27,-14,-13,1,-11,0,
|
||||
14,-5,-6,-10,-4,-15,-8,-41,
|
||||
21,-5,1,-28,-8,22,-9,33,
|
||||
-23,-4,-4,-12,39,4,-7,3,
|
||||
-60,80,8,-17,2,-6,12,-5,
|
||||
1,9,15,27,31,30,27,23,
|
||||
61,47,26,10,-5,-8,-12,-13,
|
||||
5,-18,25,-15,-4,-15,-11,12,
|
||||
-2,-2,-16,-2,-6,24,12,11,
|
||||
-4,9,1,-9,14,-45,57,12,
|
||||
20,-35,26,11,-64,32,-10,-10,
|
||||
42,-4,-9,-16,32,24,7,10,
|
||||
52,-11,-57,29,0,8,0,-6,
|
||||
17,-17,-56,-40,7,20,18,12,
|
||||
-6,16,5,7,-1,9,1,10,
|
||||
29,12,16,13,-2,23,7,9,
|
||||
-3,-4,-5,18,-64,13,55,-25,
|
||||
9,-9,24,14,-25,15,-11,-40,
|
||||
-30,37,1,-19,22,-5,-31,13,
|
||||
-2,0,7,-4,16,-67,12,66,
|
||||
-36,24,-8,18,-15,-23,19,0,
|
||||
-45,-7,4,3,-13,13,35,5,
|
||||
13,33,10,27,23,0,-7,-11,
|
||||
43,-74,36,-12,2,5,-8,6,
|
||||
-33,11,-16,-14,-5,-7,-3,17,
|
||||
-34,27,-16,11,-9,15,33,-31,
|
||||
8,-16,7,-6,-7,63,-55,-17,
|
||||
11,-1,20,-46,34,-30,6,9,
|
||||
19,28,-9,5,-24,-8,-23,-2,
|
||||
31,-19,-16,-5,-15,-18,0,26,
|
||||
18,37,-5,-15,-2,17,5,-27,
|
||||
21,-33,44,12,-27,-9,17,11,
|
||||
25,-21,-31,-7,13,33,-8,-25,
|
||||
-7,7,-10,4,-6,-9,48,-82,
|
||||
-23,-8,6,11,-23,3,-3,49,
|
||||
-29,25,31,4,14,16,9,-4,
|
||||
-18,10,-26,3,5,-44,-9,9,
|
||||
-47,-55,15,9,28,1,4,-3,
|
||||
46,6,-6,-38,-29,-31,-15,-6,
|
||||
3,0,14,-6,8,-54,-50,33,
|
||||
-5,1,-14,33,-48,26,-4,-5,
|
||||
-3,-5,-3,-5,-28,-22,77,55,
|
||||
-1,2,10,10,-9,-14,-66,-49,
|
||||
11,-36,-6,-20,10,-10,16,12,
|
||||
4,-1,-16,45,-44,-50,31,-2,
|
||||
25,42,23,-32,-22,0,11,20,
|
||||
-40,-35,-40,-36,-32,-26,-21,-13,
|
||||
52,-22,6,-24,-20,17,-5,-8,
|
||||
36,-25,-11,21,-26,6,34,-8,
|
||||
7,20,-3,5,-25,-8,18,-5,
|
||||
-9,-4,1,-9,20,20,39,48,
|
||||
-24,9,5,-65,22,29,4,3,
|
||||
-43,-11,32,-6,9,19,-27,-10,
|
||||
-47,-14,24,10,-7,-36,-7,-1,
|
||||
-4,-5,-5,16,53,25,-26,-29,
|
||||
-4,-12,45,-58,-34,33,-5,2,
|
||||
-1,27,-48,31,-15,22,-5,4,
|
||||
7,7,-25,-3,11,-22,16,-12,
|
||||
8,-3,7,-11,45,14,-73,-19,
|
||||
56,-46,24,-20,28,-12,-2,-1,
|
||||
-36,-3,-33,19,-6,7,2,-15,
|
||||
5,-31,-45,8,35,13,20,0,
|
||||
-9,48,-13,-43,-3,-13,2,-5,
|
||||
72,-68,-27,2,1,-2,-7,5,
|
||||
36,33,-40,-12,-4,-5,23,19};
|
||||
@@ -1,292 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: filters.c
|
||||
Various analysis/synthesis filters
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "filters.h"
|
||||
#include "stack_alloc.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
void bw_lpc(float gamma, float *lpc_in, float *lpc_out, int order)
|
||||
{
|
||||
int i;
|
||||
float tmp=1;
|
||||
for (i=0;i<order+1;i++)
|
||||
{
|
||||
lpc_out[i] = tmp * lpc_in[i];
|
||||
tmp *= gamma;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _USE_SSE
|
||||
#include "filters_sse.h"
|
||||
#else
|
||||
void filter_mem2(float *x, float *num, float *den, float *y, int N, int ord, float *mem)
|
||||
{
|
||||
int i,j;
|
||||
float xi,yi;
|
||||
for (i=0;i<N;i++)
|
||||
{
|
||||
xi=x[i];
|
||||
y[i] = num[0]*xi + mem[0];
|
||||
yi=y[i];
|
||||
for (j=0;j<ord-1;j++)
|
||||
{
|
||||
mem[j] = mem[j+1] + num[j+1]*xi - den[j+1]*yi;
|
||||
}
|
||||
mem[ord-1] = num[ord]*xi - den[ord]*yi;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void iir_mem2(float *x, float *den, float *y, int N, int ord, float *mem)
|
||||
{
|
||||
int i,j;
|
||||
for (i=0;i<N;i++)
|
||||
{
|
||||
y[i] = x[i] + mem[0];
|
||||
for (j=0;j<ord-1;j++)
|
||||
{
|
||||
mem[j] = mem[j+1] - den[j+1]*y[i];
|
||||
}
|
||||
mem[ord-1] = - den[ord]*y[i];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void fir_mem2(float *x, float *num, float *y, int N, int ord, float *mem)
|
||||
{
|
||||
int i,j;
|
||||
float xi;
|
||||
for (i=0;i<N;i++)
|
||||
{
|
||||
xi=x[i];
|
||||
y[i] = num[0]*xi + mem[0];
|
||||
for (j=0;j<ord-1;j++)
|
||||
{
|
||||
mem[j] = mem[j+1] + num[j+1]*xi;
|
||||
}
|
||||
mem[ord-1] = num[ord]*xi;
|
||||
}
|
||||
}
|
||||
|
||||
void syn_percep_zero(float *xx, float *ak, float *awk1, float *awk2, float *y, int N, int ord, char *stack)
|
||||
{
|
||||
int i;
|
||||
float *mem = PUSH(stack,ord, float);
|
||||
for (i=0;i<ord;i++)
|
||||
mem[i]=0;
|
||||
filter_mem2(xx, awk1, ak, y, N, ord, mem);
|
||||
for (i=0;i<ord;i++)
|
||||
mem[i]=0;
|
||||
iir_mem2(y, awk2, y, N, ord, mem);
|
||||
}
|
||||
|
||||
void residue_percep_zero(float *xx, float *ak, float *awk1, float *awk2, float *y, int N, int ord, char *stack)
|
||||
{
|
||||
int i;
|
||||
float *mem = PUSH(stack,ord, float);
|
||||
for (i=0;i<ord;i++)
|
||||
mem[i]=0;
|
||||
filter_mem2(xx, ak, awk1, y, N, ord, mem);
|
||||
for (i=0;i<ord;i++)
|
||||
mem[i]=0;
|
||||
fir_mem2(y, awk2, y, N, ord, mem);
|
||||
}
|
||||
|
||||
|
||||
void qmf_decomp(float *xx, float *aa, float *y1, float *y2, int N, int M, float *mem, char *stack)
|
||||
{
|
||||
int i,j,k,M2;
|
||||
float *a;
|
||||
float *x;
|
||||
float *x2;
|
||||
|
||||
a = PUSH(stack, M, float);
|
||||
x = PUSH(stack, N+M-1, float);
|
||||
x2=x+M-1;
|
||||
M2=M>>1;
|
||||
for (i=0;i<M;i++)
|
||||
a[M-i-1]=aa[i];
|
||||
for (i=0;i<M-1;i++)
|
||||
x[i]=mem[M-i-2];
|
||||
for (i=0;i<N;i++)
|
||||
x[i+M-1]=xx[i];
|
||||
for (i=0,k=0;i<N;i+=2,k++)
|
||||
{
|
||||
y1[k]=0;
|
||||
y2[k]=0;
|
||||
for (j=0;j<M2;j++)
|
||||
{
|
||||
y1[k]+=a[j]*(x[i+j]+x2[i-j]);
|
||||
y2[k]-=a[j]*(x[i+j]-x2[i-j]);
|
||||
j++;
|
||||
y1[k]+=a[j]*(x[i+j]+x2[i-j]);
|
||||
y2[k]+=a[j]*(x[i+j]-x2[i-j]);
|
||||
}
|
||||
}
|
||||
for (i=0;i<M-1;i++)
|
||||
mem[i]=xx[N-i-1];
|
||||
}
|
||||
|
||||
/* By segher */
|
||||
void fir_mem_up(float *x, float *a, float *y, int N, int M, float *mem, char *stack)
|
||||
/* assumptions:
|
||||
all odd x[i] are zero -- well, actually they are left out of the array now
|
||||
N and M are multiples of 4 */
|
||||
{
|
||||
int i, j;
|
||||
float *xx=PUSH(stack, M+N-1, float);
|
||||
|
||||
for (i = 0; i < N/2; i++)
|
||||
xx[2*i] = x[N/2-1-i];
|
||||
for (i = 0; i < M - 1; i += 2)
|
||||
xx[N+i] = mem[i+1];
|
||||
|
||||
for (i = 0; i < N; i += 4) {
|
||||
float y0, y1, y2, y3;
|
||||
float x0;
|
||||
|
||||
y0 = y1 = y2 = y3 = 0.f;
|
||||
x0 = xx[N-4-i];
|
||||
|
||||
for (j = 0; j < M; j += 4) {
|
||||
float x1;
|
||||
float a0, a1;
|
||||
|
||||
a0 = a[j];
|
||||
a1 = a[j+1];
|
||||
x1 = xx[N-2+j-i];
|
||||
|
||||
y0 += a0 * x1;
|
||||
y1 += a1 * x1;
|
||||
y2 += a0 * x0;
|
||||
y3 += a1 * x0;
|
||||
|
||||
a0 = a[j+2];
|
||||
a1 = a[j+3];
|
||||
x0 = xx[N+j-i];
|
||||
|
||||
y0 += a0 * x0;
|
||||
y1 += a1 * x0;
|
||||
y2 += a0 * x1;
|
||||
y3 += a1 * x1;
|
||||
}
|
||||
y[i] = y0;
|
||||
y[i+1] = y1;
|
||||
y[i+2] = y2;
|
||||
y[i+3] = y3;
|
||||
}
|
||||
|
||||
for (i = 0; i < M - 1; i += 2)
|
||||
mem[i+1] = xx[i];
|
||||
}
|
||||
|
||||
|
||||
void comp_filter_mem_init (CombFilterMem *mem)
|
||||
{
|
||||
mem->last_pitch=0;
|
||||
mem->last_pitch_gain[0]=mem->last_pitch_gain[1]=mem->last_pitch_gain[2]=0;
|
||||
mem->smooth_gain=1;
|
||||
}
|
||||
|
||||
void comb_filter(
|
||||
float *exc, /*decoded excitation*/
|
||||
float *new_exc, /*enhanced excitation*/
|
||||
float *ak, /*LPC filter coefs*/
|
||||
int p, /*LPC order*/
|
||||
int nsf, /*sub-frame size*/
|
||||
int pitch, /*pitch period*/
|
||||
float *pitch_gain, /*pitch gain (3-tap)*/
|
||||
float comb_gain, /*gain of comb filter*/
|
||||
CombFilterMem *mem
|
||||
)
|
||||
{
|
||||
int i;
|
||||
float exc_energy=0, new_exc_energy=0;
|
||||
float gain;
|
||||
float step;
|
||||
float fact;
|
||||
/*Compute excitation energy prior to enhancement*/
|
||||
for (i=0;i<nsf;i++)
|
||||
exc_energy+=exc[i]*exc[i];
|
||||
|
||||
/*Some gain adjustment is pitch is too high or if unvoiced*/
|
||||
{
|
||||
float g=0;
|
||||
g = .5*fabs(pitch_gain[0]+pitch_gain[1]+pitch_gain[2] +
|
||||
mem->last_pitch_gain[0] + mem->last_pitch_gain[1] + mem->last_pitch_gain[2]);
|
||||
if (g>1.3)
|
||||
comb_gain*=1.3/g;
|
||||
if (g<.5)
|
||||
comb_gain*=2*g;
|
||||
}
|
||||
step = 1.0/nsf;
|
||||
fact=0;
|
||||
/*Apply pitch comb-filter (filter out noise between pitch harmonics)*/
|
||||
for (i=0;i<nsf;i++)
|
||||
{
|
||||
fact += step;
|
||||
|
||||
new_exc[i] = exc[i] + comb_gain * fact * (
|
||||
pitch_gain[0]*exc[i-pitch+1] +
|
||||
pitch_gain[1]*exc[i-pitch] +
|
||||
pitch_gain[2]*exc[i-pitch-1]
|
||||
)
|
||||
+ comb_gain * (1-fact) * (
|
||||
mem->last_pitch_gain[0]*exc[i-mem->last_pitch+1] +
|
||||
mem->last_pitch_gain[1]*exc[i-mem->last_pitch] +
|
||||
mem->last_pitch_gain[2]*exc[i-mem->last_pitch-1]
|
||||
);
|
||||
}
|
||||
|
||||
mem->last_pitch_gain[0] = pitch_gain[0];
|
||||
mem->last_pitch_gain[1] = pitch_gain[1];
|
||||
mem->last_pitch_gain[2] = pitch_gain[2];
|
||||
mem->last_pitch = pitch;
|
||||
|
||||
/*Gain after enhancement*/
|
||||
for (i=0;i<nsf;i++)
|
||||
new_exc_energy+=new_exc[i]*new_exc[i];
|
||||
|
||||
/*Compute scaling factor and normalize energy*/
|
||||
gain = sqrt(exc_energy)/sqrt(.1+new_exc_energy);
|
||||
if (gain < .5)
|
||||
gain=.5;
|
||||
if (gain>1)
|
||||
gain=1;
|
||||
|
||||
for (i=0;i<nsf;i++)
|
||||
{
|
||||
mem->smooth_gain = .96*mem->smooth_gain + .04*gain;
|
||||
new_exc[i] *= mem->smooth_gain;
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: filters.h
|
||||
Various analysis/synthesis filters
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef FILTERS_H
|
||||
#define FILTERS_H
|
||||
|
||||
|
||||
typedef struct CombFilterMem {
|
||||
int last_pitch;
|
||||
float last_pitch_gain[3];
|
||||
float smooth_gain;
|
||||
} CombFilterMem;
|
||||
|
||||
|
||||
void qmf_decomp(float *xx, float *aa, float *y1, float *y2, int N, int M, float *mem, char *stack);
|
||||
void fir_mem_up(float *x, float *a, float *y, int N, int M, float *mem, char *stack);
|
||||
|
||||
|
||||
void filter_mem2(float *x, float *num, float *den, float *y, int N, int ord, float *mem);
|
||||
void fir_mem2(float *x, float *num, float *y, int N, int ord, float *mem);
|
||||
void iir_mem2(float *x, float *den, float *y, int N, int ord, float *mem);
|
||||
|
||||
/* Apply bandwidth expansion on LPC coef */
|
||||
void bw_lpc(float gamma, float *lpc_in, float *lpc_out, int order);
|
||||
|
||||
|
||||
|
||||
/* FIR filter */
|
||||
void fir_decim_mem(float *x, float *a, float *y, int N, int M, float *mem);
|
||||
|
||||
void syn_percep_zero(float *x, float *ak, float *awk1, float *awk2, float *y, int N, int ord, char *stack);
|
||||
|
||||
void residue_percep_zero(float *xx, float *ak, float *awk1, float *awk2, float *y, int N, int ord, char *stack);
|
||||
|
||||
void comp_filter_mem_init (CombFilterMem *mem);
|
||||
|
||||
void comb_filter(
|
||||
float *exc, /*decoded excitation*/
|
||||
float *new_exc, /*enhanced excitation*/
|
||||
float *ak, /*LPC filter coefs*/
|
||||
int p, /*LPC order*/
|
||||
int nsf, /*sub-frame size*/
|
||||
int pitch, /*pitch period*/
|
||||
float *pitch_gain, /*pitch gain (3-tap)*/
|
||||
float comb_gain, /*gain of comb filter*/
|
||||
CombFilterMem *mem
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,289 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: filters.c
|
||||
Various analysis/synthesis filters
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
void filter_mem2(float *x, float *_num, float *_den, float *y, int N, int ord, float *_mem)
|
||||
{
|
||||
float __num[20], __den[20], __mem[20];
|
||||
float *num, *den, *mem;
|
||||
int i;
|
||||
|
||||
num = (float*)(((int)(__num+4))&0xfffffff0)-1;
|
||||
den = (float*)(((int)(__den+4))&0xfffffff0)-1;
|
||||
mem = (float*)(((int)(__mem+4))&0xfffffff0)-1;
|
||||
for (i=0;i<=10;i++)
|
||||
num[i]=den[i]=0;
|
||||
for (i=0;i<10;i++)
|
||||
mem[i]=0;
|
||||
|
||||
for (i=0;i<ord+1;i++)
|
||||
{
|
||||
num[i]=_num[i];
|
||||
den[i]=_den[i];
|
||||
}
|
||||
for (i=0;i<ord;i++)
|
||||
mem[i]=_mem[i];
|
||||
for (i=0;i<N;i+=4)
|
||||
{
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"\tmovss (%1), %%xmm0\n"
|
||||
"\tmovss (%0), %%xmm1\n"
|
||||
"\taddss %%xmm0, %%xmm1\n"
|
||||
"\tmovss %%xmm1, (%2)\n"
|
||||
"\tshufps $0x00, %%xmm0, %%xmm0\n"
|
||||
"\tshufps $0x00, %%xmm1, %%xmm1\n"
|
||||
|
||||
"\tmovaps 4(%3), %%xmm2\n"
|
||||
"\tmovaps 4(%4), %%xmm3\n"
|
||||
"\tmulps %%xmm0, %%xmm2\n"
|
||||
"\tmulps %%xmm1, %%xmm3\n"
|
||||
"\tmovaps 20(%3), %%xmm4\n"
|
||||
"\tmulps %%xmm0, %%xmm4\n"
|
||||
"\taddps 4(%0), %%xmm2\n"
|
||||
"\tmovaps 20(%4), %%xmm5\n"
|
||||
"\tmulps %%xmm1, %%xmm5\n"
|
||||
"\taddps 20(%0), %%xmm4\n"
|
||||
"\tsubps %%xmm3, %%xmm2\n"
|
||||
"\tmovups %%xmm2, (%0)\n"
|
||||
"\tsubps %%xmm5, %%xmm4\n"
|
||||
"\tmovups %%xmm4, 16(%0)\n"
|
||||
|
||||
"\tmovss 36(%3), %%xmm2\n"
|
||||
"\tmulss %%xmm0, %%xmm2\n"
|
||||
"\tmovss 36(%4), %%xmm3\n"
|
||||
"\tmulss %%xmm1, %%xmm3\n"
|
||||
"\taddss 36(%0), %%xmm2\n"
|
||||
"\tmovss 40(%3), %%xmm4\n"
|
||||
"\tmulss %%xmm0, %%xmm4\n"
|
||||
"\tmovss 40(%4), %%xmm5\n"
|
||||
"\tmulss %%xmm1, %%xmm5\n"
|
||||
"\tsubss %%xmm3, %%xmm2\n"
|
||||
"\tmovss %%xmm2, 32(%0) \n"
|
||||
"\tsubss %%xmm5, %%xmm4\n"
|
||||
"\tmovss %%xmm4, 36(%0)\n"
|
||||
|
||||
|
||||
|
||||
"\tmovss 4(%1), %%xmm0\n"
|
||||
"\tmovss (%0), %%xmm1\n"
|
||||
"\taddss %%xmm0, %%xmm1\n"
|
||||
"\tmovss %%xmm1, 4(%2)\n"
|
||||
"\tshufps $0x00, %%xmm0, %%xmm0\n"
|
||||
"\tshufps $0x00, %%xmm1, %%xmm1\n"
|
||||
|
||||
"\tmovaps 4(%3), %%xmm2\n"
|
||||
"\tmovaps 4(%4), %%xmm3\n"
|
||||
"\tmulps %%xmm0, %%xmm2\n"
|
||||
"\tmulps %%xmm1, %%xmm3\n"
|
||||
"\tmovaps 20(%3), %%xmm4\n"
|
||||
"\tmulps %%xmm0, %%xmm4\n"
|
||||
"\taddps 4(%0), %%xmm2\n"
|
||||
"\tmovaps 20(%4), %%xmm5\n"
|
||||
"\tmulps %%xmm1, %%xmm5\n"
|
||||
"\taddps 20(%0), %%xmm4\n"
|
||||
"\tsubps %%xmm3, %%xmm2\n"
|
||||
"\tmovups %%xmm2, (%0)\n"
|
||||
"\tsubps %%xmm5, %%xmm4\n"
|
||||
"\tmovups %%xmm4, 16(%0)\n"
|
||||
|
||||
"\tmovss 36(%3), %%xmm2\n"
|
||||
"\tmulss %%xmm0, %%xmm2\n"
|
||||
"\tmovss 36(%4), %%xmm3\n"
|
||||
"\tmulss %%xmm1, %%xmm3\n"
|
||||
"\taddss 36(%0), %%xmm2\n"
|
||||
"\tmovss 40(%3), %%xmm4\n"
|
||||
"\tmulss %%xmm0, %%xmm4\n"
|
||||
"\tmovss 40(%4), %%xmm5\n"
|
||||
"\tmulss %%xmm1, %%xmm5\n"
|
||||
"\tsubss %%xmm3, %%xmm2\n"
|
||||
"\tmovss %%xmm2, 32(%0) \n"
|
||||
"\tsubss %%xmm5, %%xmm4\n"
|
||||
"\tmovss %%xmm4, 36(%0)\n"
|
||||
|
||||
|
||||
|
||||
"\tmovss 8(%1), %%xmm0\n"
|
||||
"\tmovss (%0), %%xmm1\n"
|
||||
"\taddss %%xmm0, %%xmm1\n"
|
||||
"\tmovss %%xmm1, 8(%2)\n"
|
||||
"\tshufps $0x00, %%xmm0, %%xmm0\n"
|
||||
"\tshufps $0x00, %%xmm1, %%xmm1\n"
|
||||
|
||||
"\tmovaps 4(%3), %%xmm2\n"
|
||||
"\tmovaps 4(%4), %%xmm3\n"
|
||||
"\tmulps %%xmm0, %%xmm2\n"
|
||||
"\tmulps %%xmm1, %%xmm3\n"
|
||||
"\tmovaps 20(%3), %%xmm4\n"
|
||||
"\tmulps %%xmm0, %%xmm4\n"
|
||||
"\taddps 4(%0), %%xmm2\n"
|
||||
"\tmovaps 20(%4), %%xmm5\n"
|
||||
"\tmulps %%xmm1, %%xmm5\n"
|
||||
"\taddps 20(%0), %%xmm4\n"
|
||||
"\tsubps %%xmm3, %%xmm2\n"
|
||||
"\tmovups %%xmm2, (%0)\n"
|
||||
"\tsubps %%xmm5, %%xmm4\n"
|
||||
"\tmovups %%xmm4, 16(%0)\n"
|
||||
|
||||
"\tmovss 36(%3), %%xmm2\n"
|
||||
"\tmulss %%xmm0, %%xmm2\n"
|
||||
"\tmovss 36(%4), %%xmm3\n"
|
||||
"\tmulss %%xmm1, %%xmm3\n"
|
||||
"\taddss 36(%0), %%xmm2\n"
|
||||
"\tmovss 40(%3), %%xmm4\n"
|
||||
"\tmulss %%xmm0, %%xmm4\n"
|
||||
"\tmovss 40(%4), %%xmm5\n"
|
||||
"\tmulss %%xmm1, %%xmm5\n"
|
||||
"\tsubss %%xmm3, %%xmm2\n"
|
||||
"\tmovss %%xmm2, 32(%0) \n"
|
||||
"\tsubss %%xmm5, %%xmm4\n"
|
||||
"\tmovss %%xmm4, 36(%0)\n"
|
||||
|
||||
|
||||
|
||||
"\tmovss 12(%1), %%xmm0\n"
|
||||
"\tmovss (%0), %%xmm1\n"
|
||||
"\taddss %%xmm0, %%xmm1\n"
|
||||
"\tmovss %%xmm1, 12(%2)\n"
|
||||
"\tshufps $0x00, %%xmm0, %%xmm0\n"
|
||||
"\tshufps $0x00, %%xmm1, %%xmm1\n"
|
||||
|
||||
"\tmovaps 4(%3), %%xmm2\n"
|
||||
"\tmovaps 4(%4), %%xmm3\n"
|
||||
"\tmulps %%xmm0, %%xmm2\n"
|
||||
"\tmulps %%xmm1, %%xmm3\n"
|
||||
"\tmovaps 20(%3), %%xmm4\n"
|
||||
"\tmulps %%xmm0, %%xmm4\n"
|
||||
"\taddps 4(%0), %%xmm2\n"
|
||||
"\tmovaps 20(%4), %%xmm5\n"
|
||||
"\tmulps %%xmm1, %%xmm5\n"
|
||||
"\taddps 20(%0), %%xmm4\n"
|
||||
"\tsubps %%xmm3, %%xmm2\n"
|
||||
"\tmovups %%xmm2, (%0)\n"
|
||||
"\tsubps %%xmm5, %%xmm4\n"
|
||||
"\tmovups %%xmm4, 16(%0)\n"
|
||||
|
||||
"\tmovss 36(%3), %%xmm2\n"
|
||||
"\tmulss %%xmm0, %%xmm2\n"
|
||||
"\tmovss 36(%4), %%xmm3\n"
|
||||
"\tmulss %%xmm1, %%xmm3\n"
|
||||
"\taddss 36(%0), %%xmm2\n"
|
||||
"\tmovss 40(%3), %%xmm4\n"
|
||||
"\tmulss %%xmm0, %%xmm4\n"
|
||||
"\tmovss 40(%4), %%xmm5\n"
|
||||
"\tmulss %%xmm1, %%xmm5\n"
|
||||
"\tsubss %%xmm3, %%xmm2\n"
|
||||
"\tmovss %%xmm2, 32(%0) \n"
|
||||
"\tsubss %%xmm5, %%xmm4\n"
|
||||
"\tmovss %%xmm4, 36(%0)\n"
|
||||
|
||||
: : "r" (mem), "r" (x+i), "r" (y+i), "r" (num), "r" (den)
|
||||
: "memory" );
|
||||
|
||||
}
|
||||
for (i=0;i<ord;i++)
|
||||
_mem[i]=mem[i];
|
||||
|
||||
}
|
||||
|
||||
|
||||
void iir_mem2(float *x, float *_den, float *y, int N, int ord, float *_mem)
|
||||
{
|
||||
float __den[20], __mem[20];
|
||||
float *den, *mem;
|
||||
int i;
|
||||
|
||||
den = (float*)(((int)(__den+4))&0xfffffff0)-1;
|
||||
mem = (float*)(((int)(__mem+4))&0xfffffff0)-1;
|
||||
for (i=0;i<=10;i++)
|
||||
den[i]=0;
|
||||
for (i=0;i<10;i++)
|
||||
mem[i]=0;
|
||||
for (i=0;i<ord+1;i++)
|
||||
{
|
||||
den[i]=_den[i];
|
||||
}
|
||||
for (i=0;i<ord;i++)
|
||||
mem[i]=_mem[i];
|
||||
|
||||
for (i=0;i<N;i++)
|
||||
{
|
||||
#if 0
|
||||
y[i] = x[i] + mem[0];
|
||||
for (j=0;j<ord-1;j++)
|
||||
{
|
||||
mem[j] = mem[j+1] - den[j+1]*y[i];
|
||||
}
|
||||
mem[ord-1] = - den[ord]*y[i];
|
||||
#else
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"\tmovss (%1), %%xmm0\n"
|
||||
"\tmovss (%0), %%xmm1\n"
|
||||
"\taddss %%xmm0, %%xmm1\n"
|
||||
"\tmovss %%xmm1, (%2)\n"
|
||||
"\tshufps $0x00, %%xmm0, %%xmm0\n"
|
||||
"\tshufps $0x00, %%xmm1, %%xmm1\n"
|
||||
|
||||
|
||||
"\tmovaps 4(%3), %%xmm2\n"
|
||||
"\tmovaps 20(%3), %%xmm3\n"
|
||||
"\tmulps %%xmm1, %%xmm2\n"
|
||||
"\tmulps %%xmm1, %%xmm3\n"
|
||||
"\tmovss 36(%3), %%xmm4\n"
|
||||
"\tmovss 40(%3), %%xmm5\n"
|
||||
"\tmulss %%xmm1, %%xmm4\n"
|
||||
"\tmulss %%xmm1, %%xmm5\n"
|
||||
"\tmovaps 4(%0), %%xmm6\n"
|
||||
"\tsubps %%xmm2, %%xmm6\n"
|
||||
"\tmovups %%xmm6, (%0)\n"
|
||||
"\tmovaps 20(%0), %%xmm7\n"
|
||||
"\tsubps %%xmm3, %%xmm7\n"
|
||||
"\tmovups %%xmm7, 16(%0)\n"
|
||||
|
||||
|
||||
"\tmovss 36(%0), %%xmm7\n"
|
||||
"\tsubss %%xmm4, %%xmm7\n"
|
||||
"\tmovss %%xmm7, 32(%0) \n"
|
||||
"\txorps %%xmm2, %%xmm2\n"
|
||||
"\tsubss %%xmm5, %%xmm2\n"
|
||||
"\tmovss %%xmm2, 36(%0)\n"
|
||||
|
||||
: : "r" (mem), "r" (x+i), "r" (y+i), "r" (den)
|
||||
: "memory" );
|
||||
#endif
|
||||
}
|
||||
for (i=0;i<ord;i++)
|
||||
_mem[i]=mem[i];
|
||||
|
||||
}
|
||||
|
||||
@@ -1,160 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: gain_table.c
|
||||
Codebook for 3-tap pitch prediction gain (128 entries)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
signed char gain_cdbk_nb[384] = {
|
||||
-32,-32,-32,
|
||||
-28,-67,-5,
|
||||
-42,-6,-32,
|
||||
-57,-10,-54,
|
||||
-16,27,-41,
|
||||
19,-19,-40,
|
||||
-45,24,-21,
|
||||
-8,-14,-18,
|
||||
1,14,-58,
|
||||
-18,-88,-39,
|
||||
-38,21,-18,
|
||||
-19,20,-43,
|
||||
10,17,-48,
|
||||
-52,-58,-13,
|
||||
-44,-1,-11,
|
||||
-12,-11,-34,
|
||||
14,0,-46,
|
||||
-37,-35,-34,
|
||||
-25,44,-30,
|
||||
6,-4,-63,
|
||||
-31,43,-41,
|
||||
-23,30,-43,
|
||||
-43,26,-14,
|
||||
-33,1,-13,
|
||||
-13,18,-37,
|
||||
-46,-73,-45,
|
||||
-36,24,-25,
|
||||
-36,-11,-20,
|
||||
-25,12,-18,
|
||||
-36,-69,-59,
|
||||
-45,6,8,
|
||||
-22,-14,-24,
|
||||
-1,13,-44,
|
||||
-39,-48,-26,
|
||||
-32,31,-37,
|
||||
-33,15,-46,
|
||||
-24,30,-36,
|
||||
-41,31,-23,
|
||||
-50,22,-4,
|
||||
-22,2,-21,
|
||||
-17,30,-34,
|
||||
-7,-60,-28,
|
||||
-38,42,-28,
|
||||
-44,-11,21,
|
||||
-16,8,-44,
|
||||
-39,-55,-43,
|
||||
-11,-35,26,
|
||||
-9,0,-34,
|
||||
-8,121,-81,
|
||||
7,-16,-22,
|
||||
-37,33,-31,
|
||||
-27,-7,-36,
|
||||
-34,70,-57,
|
||||
-37,-11,-48,
|
||||
-40,17,-1,
|
||||
-33,6,-6,
|
||||
-9,0,-20,
|
||||
-21,69,-33,
|
||||
-29,33,-31,
|
||||
-55,12,-1,
|
||||
-33,27,-22,
|
||||
-50,-33,-47,
|
||||
-50,54,51,
|
||||
-1,-5,-44,
|
||||
-4,22,-40,
|
||||
-39,-66,-25,
|
||||
-33,1,-26,
|
||||
-24,-23,-25,
|
||||
-11,21,-45,
|
||||
-25,-45,-19,
|
||||
-43,105,-16,
|
||||
5,-21,1,
|
||||
-16,11,-33,
|
||||
-13,-99,-4,
|
||||
-37,33,-15,
|
||||
-25,37,-63,
|
||||
-36,24,-31,
|
||||
-53,-56,-38,
|
||||
-41,-4,4,
|
||||
-33,13,-30,
|
||||
49,52,-94,
|
||||
-5,-30,-15,
|
||||
1,38,-40,
|
||||
-23,12,-36,
|
||||
-17,40,-47,
|
||||
-37,-41,-39,
|
||||
-49,34,0,
|
||||
-18,-7,-4,
|
||||
-16,17,-27,
|
||||
30,5,-62,
|
||||
4,48,-68,
|
||||
-43,11,-11,
|
||||
-18,19,-15,
|
||||
-23,-62,-39,
|
||||
-42,10,-2,
|
||||
-21,-13,-13,
|
||||
-9,13,-47,
|
||||
-23,-62,-24,
|
||||
-44,60,-21,
|
||||
-18,-3,-52,
|
||||
-22,22,-36,
|
||||
-75,57,16,
|
||||
-19,3,10,
|
||||
-29,23,-38,
|
||||
-5,-62,-51,
|
||||
-51,40,-18,
|
||||
-42,13,-24,
|
||||
-34,14,-20,
|
||||
-56,-75,-26,
|
||||
-26,32,15,
|
||||
-26,17,-29,
|
||||
-7,28,-52,
|
||||
-12,-30,5,
|
||||
-5,-48,-5,
|
||||
2,2,-43,
|
||||
21,16,16,
|
||||
-25,-45,-32,
|
||||
-43,18,-10,
|
||||
9,0,-1,
|
||||
-1,7,-30,
|
||||
19,-48,-4,
|
||||
-28,25,-29,
|
||||
-22,0,-31,
|
||||
-32,17,-10,
|
||||
-64,-41,-62,
|
||||
-52,15,16,
|
||||
-30,-22,-32,
|
||||
-7,9,-38};
|
||||
@@ -1,64 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: gain_table_lbr.c
|
||||
Codebook for 3-tap pitch prediction gain (32 entries)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
signed char gain_cdbk_lbr[96] = {
|
||||
-32,-32,-32,
|
||||
-31,-58,-16,
|
||||
-41,-24,-43,
|
||||
-56,-22,-55,
|
||||
-13,33,-41,
|
||||
-4,-39,-9,
|
||||
-41,15,-12,
|
||||
-8,-15,-12,
|
||||
1,2,-44,
|
||||
-22,-66,-42,
|
||||
-38,28,-23,
|
||||
-21,14,-37,
|
||||
0,21,-50,
|
||||
-53,-71,-27,
|
||||
-37,-1,-19,
|
||||
-19,-5,-28,
|
||||
6,65,-44,
|
||||
-33,-48,-33,
|
||||
-40,57,-14,
|
||||
-17,4,-45,
|
||||
-31,38,-33,
|
||||
-23,28,-40,
|
||||
-43,29,-12,
|
||||
-34,13,-23,
|
||||
-16,15,-27,
|
||||
-14,-82,-15,
|
||||
-31,25,-32,
|
||||
-21,5,-5,
|
||||
-47,-63,-51,
|
||||
-46,12,3,
|
||||
-28,-17,-29,
|
||||
-10,14,-40};
|
||||
@@ -1,66 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: hexc_10_32_table.c
|
||||
Codebook for high-band excitation in SB-CELP mode (4000 bps)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
signed char hexc_10_32_table[320] = {
|
||||
-3, -2, -1, 0, -4, 5, 35, -40, -9, 13,
|
||||
-44, 5, -27, -1, -7, 6, -11, 7, -8, 7,
|
||||
19, -14, 15, -4, 9, -10, 10, -8, 10, -9,
|
||||
-1, 1, 0, 0, 2, 5, -18, 22, -53, 50,
|
||||
1, -23, 50, -36, 15, 3, -13, 14, -10, 6,
|
||||
1, 5, -3, 4, -2, 5, -32, 25, 5, -2,
|
||||
-1, -4, 1, 11, -29, 26, -6, -15, 30, -18,
|
||||
0, 15, -17, 40, -41, 3, 9, -2, -2, 3,
|
||||
-3, -1, -5, 2, 21, -6, -16, -21, 23, 2,
|
||||
60, 15, 16, -16, -9, 14, 9, -1, 7, -9,
|
||||
0, 1, 1, 0, -1, -6, 17, -28, 54, -45,
|
||||
-1, 1, -1, -6, -6, 2, 11, 26, -29, -2,
|
||||
46, -21, 34, 12, -23, 32, -23, 16, -10, 3,
|
||||
66, 19, -20, 24, 7, 11, -3, 0, -3, -1,
|
||||
-50, -46, 2, -18, -3, 4, -1, -2, 3, -3,
|
||||
-19, 41, -36, 9, 11, -24, 21, -16, 9, -3,
|
||||
-25, -3, 10, 18, -9, -2, -5, -1, -5, 6,
|
||||
-4, -3, 2, -26, 21, -19, 35, -15, 7, -13,
|
||||
17, -19, 39, -43, 48, -31, 16, -9, 7, -2,
|
||||
-5, 3, -4, 9, -19, 27, -55, 63, -35, 10,
|
||||
26, -44, -2, 9, 4, 1, -6, 8, -9, 5,
|
||||
-8, -1, -3, -16, 45, -42, 5, 15, -16, 10,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
-16, 24, -55, 47, -38, 27, -19, 7, -3, 1,
|
||||
16, 27, 20, -19, 18, 5, -7, 1, -5, 2,
|
||||
-6, 8, -22, 0, -3, -3, 8, -1, 7, -8,
|
||||
1, -3, 5, 0, 17, -48, 58, -52, 29, -7,
|
||||
-2, 3, -10, 6, -26, 58, -31, 1, -6, 3,
|
||||
93, -29, 39, 3, 17, 5, 6, -1, -1, -1,
|
||||
27, 13, 10, 19, -7, -34, 12, 10, -4, 9,
|
||||
-76, 9, 8, -28, -2, -11, 2, -1, 3, 1,
|
||||
-83, 38, -39, 4, -16, -6, -2, -5, 5, -2,
|
||||
};
|
||||
@@ -1,162 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: hexc_table.c
|
||||
Codebook for high-band excitation in SB-CELP mode (8000 bps with sign)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
signed char hexc_table[1024] = {
|
||||
-24, 21, -20, 5, -5, -7, 14, -10,
|
||||
2, -27, 16, -20, 0, -32, 26, 19,
|
||||
8, -11, -41, 31, 28, -27, -32, 34,
|
||||
42, 34, -17, 22, -10, 13, -29, 18,
|
||||
-12, -26, -24, 11, 22, 5, -5, -5,
|
||||
54, -68, -43, 57, -25, 24, 4, 4,
|
||||
26, -8, -12, -17, 54, 30, -45, 1,
|
||||
10, -15, 18, -41, 11, 68, -67, 37,
|
||||
-16, -24, -16, 38, -22, 6, -29, 30,
|
||||
66, -27, 5, 7, -16, 13, 2, -12,
|
||||
-7, -3, -20, 36, 4, -28, 9, 3,
|
||||
32, 48, 26, 39, 3, 0, 7, -21,
|
||||
-13, 5, -82, -7, 73, -20, 34, -9,
|
||||
-5, 1, -1, 10, -5, -10, -1, 9,
|
||||
1, -9, 10, 0, -14, 11, -1, -2,
|
||||
-1, 11, 20, 96, -81, -22, -12, -9,
|
||||
-58, 9, 24, -30, 26, -35, 27, -12,
|
||||
13, -18, 56, -59, 15, -7, 23, -15,
|
||||
-1, 6, -25, 14, -22, -20, 47, -11,
|
||||
16, 2, 38, -23, -19, -30, -9, 40,
|
||||
-11, 5, 4, -6, 8, 26, -21, -11,
|
||||
131, 4, 1, 6, -9, 2, -7, -2,
|
||||
-3, 7, -5, 10, -19, 7, -106, 91,
|
||||
-3, 9, -4, 21, -8, 26, -80, 8,
|
||||
1, -2, -10, -17, -17, -27, 32, 71,
|
||||
6, -29, 11, -23, 54, -38, 29, -22,
|
||||
39, 87, -31, -12, -20, 3, -2, -2,
|
||||
2, 20, 0, -1, -35, 27, 9, -6,
|
||||
-12, 3, -12, -6, 13, 1, 14, -22,
|
||||
-59, -15, -17, -25, 13, -7, 7, 3,
|
||||
0, 1, -7, 6, -3, 61, -37, -23,
|
||||
-23, -29, 38, -31, 27, 1, -8, 2,
|
||||
-27, 23, -26, 36, -34, 5, 24, -24,
|
||||
-6, 7, 3, -59, 78, -62, 44, -16,
|
||||
1, 6, 0, 17, 8, 45, 0, -110,
|
||||
6, 14, -2, 32, -77, -56, 62, -3,
|
||||
3, -13, 4, -16, 102, -15, -36, -1,
|
||||
9, -113, 6, 23, 0, 9, 9, 5,
|
||||
-8, -1, -14, 5, -12, 121, -53, -27,
|
||||
-8, -9, 22, -13, 3, 2, -3, 1,
|
||||
-2, -71, 95, 38, -19, 15, -16, -5,
|
||||
71, 10, 2, -32, -13, -5, 15, -1,
|
||||
-2, -14, -85, 30, 29, 6, 3, 2,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
2, -65, -56, -9, 18, 18, 23, -14,
|
||||
-2, 0, 12, -29, 26, -12, 1, 2,
|
||||
-12, -64, 90, -6, 4, 1, 5, -5,
|
||||
-110, -3, -31, 22, -29, 9, 0, 8,
|
||||
-40, -5, 21, -5, -5, 13, 10, -18,
|
||||
40, 1, 35, -20, 30, -28, 11, -6,
|
||||
19, 7, 14, 18, -64, 9, -6, 16,
|
||||
51, 68, 8, 16, 12, -8, 0, -9,
|
||||
20, -22, 25, 7, -4, -13, 41, -35,
|
||||
93, -18, -54, 11, -1, 1, -9, 4,
|
||||
-66, 66, -31, 20, -22, 25, -23, 11,
|
||||
10, 9, 19, 15, 11, -5, -31, -10,
|
||||
-23, -28, -6, -6, -3, -4, 5, 3,
|
||||
-28, 22, -11, -42, 25, -25, -16, 41,
|
||||
34, 47, -6, 2, 42, -19, -22, 5,
|
||||
-39, 32, 6, -35, 22, 17, -30, 8,
|
||||
-26, -11, -11, 3, -12, 33, 33, -37,
|
||||
21, -1, 6, -4, 3, 0, -5, 5,
|
||||
12, -12, 57, 27, -61, -3, 20, -17,
|
||||
2, 0, 4, 0, -2, -33, -58, 81,
|
||||
-23, 39, -10, -5, 2, 6, -7, 5,
|
||||
4, -3, -2, -13, -23, -72, 107, 15,
|
||||
-5, 0, -7, -3, -6, 5, -4, 15,
|
||||
47, 12, -31, 25, -16, 8, 22, -25,
|
||||
-62, -56, -18, 14, 28, 12, 2, -11,
|
||||
74, -66, 41, -20, -7, 16, -20, 16,
|
||||
-8, 0, -16, 4, -19, 92, 12, -59,
|
||||
-14, -39, 49, -25, -16, 23, -27, 19,
|
||||
-3, -33, 19, 85, -29, 6, -7, -10,
|
||||
16, -7, -12, 1, -6, 2, 4, -2,
|
||||
64, 10, -25, 41, -2, -31, 15, 0,
|
||||
110, 50, 69, 35, 28, 19, -10, 2,
|
||||
-43, -49, -56, -15, -16, 10, 3, 12,
|
||||
-1, -8, 1, 26, -12, -1, 7, -11,
|
||||
-27, 41, 25, 1, -11, -18, 22, -7,
|
||||
-1, -47, -8, 23, -3, -17, -7, 18,
|
||||
-125, 59, -5, 3, 18, 1, 2, 3,
|
||||
27, -35, 65, -53, 50, -46, 37, -21,
|
||||
-28, 7, 14, -37, -5, -5, 12, 5,
|
||||
-8, 78, -19, 21, -6, -16, 8, -7,
|
||||
5, 2, 7, 2, 10, -6, 12, -60,
|
||||
44, 11, -36, -32, 31, 0, 2, -2,
|
||||
2, 1, -3, 7, -10, 17, -21, 10,
|
||||
6, -2, 19, -2, 59, -38, -86, 38,
|
||||
8, -41, -30, -45, -33, 7, 15, 28,
|
||||
29, -7, 24, -40, 7, 7, 5, -2,
|
||||
9, 24, -23, -18, 6, -29, 30, 2,
|
||||
28, 49, -11, -46, 10, 43, -13, -9,
|
||||
-1, -3, -7, -7, -17, -6, 97, -33,
|
||||
-21, 3, 5, 1, 12, -43, -8, 28,
|
||||
7, -43, -7, 17, -20, 19, -1, 2,
|
||||
-13, 9, 54, 34, 9, -28, -11, -9,
|
||||
-17, 110, -59, 44, -26, 0, 3, -12,
|
||||
-47, 73, -34, -43, 38, -33, 16, -5,
|
||||
-46, -4, -6, -2, -25, 19, -29, 28,
|
||||
-13, 5, 14, 27, -40, -43, 4, 32,
|
||||
-13, -2, -35, -4, 112, -42, 9, -12,
|
||||
37, -28, 17, 14, -19, 35, -39, 23,
|
||||
3, -14, -1, -57, -5, 94, -9, 3,
|
||||
-39, 5, 30, -10, -32, 42, -13, -14,
|
||||
-97, -63, 30, -9, 1, -7, 12, 5,
|
||||
20, 17, -9, -36, -30, 25, 47, -9,
|
||||
-15, 12, -22, 98, -8, -50, 15, -27,
|
||||
21, -16, -11, 2, 12, -10, 10, -3,
|
||||
33, 36, -96, 0, -17, 31, -9, 9,
|
||||
3, -20, 13, -11, 8, -4, 10, -10,
|
||||
9, 1, 112, -70, -27, 5, -21, 2,
|
||||
-57, -3, -29, 10, 19, -21, 21, -10,
|
||||
-66, -3, 91, -35, 30, -12, 0, -7,
|
||||
59, -28, 26, 2, 14, -18, 1, 1,
|
||||
11, 17, 20, -54, -59, 27, 4, 29,
|
||||
32, 5, 19, 12, -4, 1, 7, -10,
|
||||
5, -2, 10, 0, 23, -5, 28, -104,
|
||||
46, 11, 16, 3, 29, 1, -8, -14,
|
||||
1, 7, -50, 88, -62, 26, 8, -17,
|
||||
-14, 50, 0, 32, -12, -3, -27, 18,
|
||||
-8, -5, 8, 3, -20, -11, 37, -12,
|
||||
9, 33, 46, -101, -1, -4, 1, 6,
|
||||
-1, 28, -42, -15, 16, 5, -1, -2,
|
||||
-55, 85, 38, -9, -4, 11, -2, -9,
|
||||
-6, 3, -20, -10, -77, 89, 24, -3,
|
||||
-104, -57, -26, -31, -20, -6, -9, 14,
|
||||
20, -23, 46, -15, -31, 28, 1, -15,
|
||||
-2, 6, -2, 31, 45, -76, 23, -25,
|
||||
};
|
||||
@@ -1,163 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: high_lsp_tables.c
|
||||
Codebooks for high-band LSPs in SB-CELP mode
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
signed char high_lsp_cdbk[512]={
|
||||
39,12,-14,-20,-29,-61,-67,-76,
|
||||
-32,-71,-67,68,77,46,34,5,
|
||||
-13,-48,-46,-72,-81,-84,-60,-58,
|
||||
-40,-28,82,93,68,45,29,3,
|
||||
-19,-47,-28,-43,-35,-30,-8,-13,
|
||||
-39,-91,-91,-123,-96,10,10,-6,
|
||||
-18,-55,-60,-91,-56,-36,-27,-16,
|
||||
-48,-75,40,28,-10,-28,35,9,
|
||||
37,19,1,-20,-31,-41,-18,-25,
|
||||
-35,-68,-80,45,27,-1,47,13,
|
||||
0,-29,-35,-57,-50,-79,-73,-38,
|
||||
-19,5,35,14,-10,-23,16,-8,
|
||||
5,-24,-40,-62,-23,-27,-22,-16,
|
||||
-18,-46,-72,-77,43,21,33,1,
|
||||
-80,-70,-70,-64,-56,-52,-39,-33,
|
||||
-31,-38,-19,-19,-15,32,33,-2,
|
||||
7,-15,-15,-24,-23,-33,-41,-56,
|
||||
-24,-57,5,89,64,41,27,5,
|
||||
-9,-47,-60,-97,-97,-124,-20,-9,
|
||||
-44,-73,31,29,-4,64,48,7,
|
||||
-35,-57,0,-3,-26,-47,-3,-6,
|
||||
-40,-76,-79,-48,12,81,55,10,
|
||||
9,-24,-43,-73,-57,-69,16,5,
|
||||
-28,-53,18,29,20,0,-4,-11,
|
||||
6,-13,23,7,-17,-35,-37,-37,
|
||||
-30,-68,-63,6,24,-9,-14,3,
|
||||
21,-13,-27,-57,-49,-80,-24,-41,
|
||||
-5,-16,-5,1,45,25,12,-7,
|
||||
3,-15,-6,-16,-15,-8,6,-13,
|
||||
-42,-81,-80,-87,14,1,-10,-3,
|
||||
-43,-69,-46,-24,-28,-29,36,6,
|
||||
-43,-56,-12,12,54,79,43,9,
|
||||
54,22,2,8,-12,-43,-46,-52,
|
||||
-38,-69,-89,-5,75,38,33,5,
|
||||
-13,-53,-62,-87,-89,-113,-99,-55,
|
||||
-34,-37,62,55,33,16,21,-2,
|
||||
-17,-46,-29,-38,-38,-48,-39,-42,
|
||||
-36,-75,-72,-88,-48,-30,21,2,
|
||||
-15,-57,-64,-98,-84,-76,25,1,
|
||||
-46,-80,-12,18,-7,3,34,6,
|
||||
38,31,23,4,-1,20,14,-15,
|
||||
-43,-78,-91,-24,14,-3,54,16,
|
||||
0,-27,-28,-44,-56,-83,-92,-89,
|
||||
-3,34,56,41,36,22,20,-8,
|
||||
-7,-35,-42,-62,-49,3,12,-10,
|
||||
-50,-87,-96,-66,92,70,38,9,
|
||||
-70,-71,-62,-42,-39,-43,-11,-7,
|
||||
-50,-79,-58,-50,-31,32,31,-6,
|
||||
-4,-25,7,-17,-38,-70,-58,-27,
|
||||
-43,-83,-28,59,36,20,31,2,
|
||||
-27,-71,-80,-109,-98,-75,-33,-32,
|
||||
-31,-2,33,15,-6,43,33,-5,
|
||||
0,-22,-10,-27,-34,-49,-11,-20,
|
||||
-41,-91,-100,-121,-39,57,41,10,
|
||||
-19,-50,-38,-59,-60,-70,-18,-20,
|
||||
-8,-31,-8,-15,1,-14,-26,-25,
|
||||
33,21,32,17,1,-19,-19,-26,
|
||||
-58,-81,-35,-22,45,30,11,-11,
|
||||
3,-26,-48,-87,-67,-83,-58,3,
|
||||
-1,-26,-20,44,10,25,39,5,
|
||||
-9,-35,-27,-38,7,10,4,-9,
|
||||
-42,-85,-102,-127,52,44,28,10,
|
||||
-47,-61,-40,-39,-17,-1,-10,-33,
|
||||
-42,-74,-48,21,-4,70,52,10};
|
||||
|
||||
|
||||
signed char high_lsp_cdbk2[512]={
|
||||
-36,-62,6,-9,-10,-14,-56,23,
|
||||
1,-26,23,-48,-17,12,8,-7,
|
||||
23,29,-36,-28,-6,-29,-17,-5,
|
||||
40,23,10,10,-46,-13,36,6,
|
||||
4,-30,-29,62,32,-32,-1,22,
|
||||
-14,1,-4,-22,-45,2,54,4,
|
||||
-30,-57,-59,-12,27,-3,-31,8,
|
||||
-9,5,10,-14,32,66,19,9,
|
||||
2,-25,-37,23,-15,18,-38,-31,
|
||||
5,-9,-21,15,0,22,62,30,
|
||||
15,-12,-14,-46,77,21,33,3,
|
||||
34,29,-19,50,2,11,9,-38,
|
||||
-12,-37,62,1,-15,54,32,6,
|
||||
2,-24,20,35,-21,2,19,24,
|
||||
-13,55,4,9,39,-19,30,-1,
|
||||
-21,73,54,33,8,18,3,15,
|
||||
6,-19,-47,6,-3,-48,-50,1,
|
||||
26,20,8,-23,-50,65,-14,-55,
|
||||
-17,-31,-37,-28,53,-1,-17,-53,
|
||||
1,57,11,-8,-25,-30,-37,64,
|
||||
5,-52,-45,15,23,31,15,14,
|
||||
-25,24,33,-2,-44,-56,-18,6,
|
||||
-21,-43,4,-12,17,-37,20,-10,
|
||||
34,15,2,15,55,21,-11,-31,
|
||||
-6,46,25,16,-9,-25,-8,-62,
|
||||
28,17,20,-32,-29,26,30,25,
|
||||
-19,2,-16,-17,26,-51,2,50,
|
||||
42,19,-66,23,29,-2,3,19,
|
||||
-19,-37,32,15,6,30,-34,13,
|
||||
11,-5,40,31,10,-42,4,-9,
|
||||
26,-9,-70,17,-2,-23,20,-22,
|
||||
-55,51,-24,-31,22,-22,15,-13,
|
||||
3,-10,-28,-16,56,4,-63,11,
|
||||
-18,-15,-18,-38,-35,16,-7,34,
|
||||
-1,-21,-49,-47,9,-37,7,8,
|
||||
69,55,20,6,-33,-45,-10,-9,
|
||||
6,-9,12,71,15,-3,-42,-7,
|
||||
-24,32,-35,-2,-42,-17,-5,0,
|
||||
-2,-33,-54,13,-12,-34,47,23,
|
||||
19,55,7,-8,74,31,14,16,
|
||||
-23,-26,19,12,-18,-49,-28,-31,
|
||||
-20,2,-14,-20,-47,78,40,13,
|
||||
-23,-11,21,-6,18,1,47,5,
|
||||
38,35,32,46,22,8,13,16,
|
||||
-14,18,51,19,40,39,11,-26,
|
||||
-1,-17,47,2,-53,-15,31,-22,
|
||||
38,21,-15,-16,5,-33,53,15,
|
||||
-38,86,11,-3,-24,49,13,-4,
|
||||
-11,-18,28,20,-12,-27,-26,35,
|
||||
-25,-35,-3,-20,-61,30,10,-55,
|
||||
-12,-22,-52,-54,-14,19,-32,-12,
|
||||
45,15,-8,-48,-9,11,-32,8,
|
||||
-16,-34,-13,51,18,38,-2,-32,
|
||||
-17,22,-2,-18,-28,-70,59,27,
|
||||
-28,-19,-10,-20,-9,-9,-8,-21,
|
||||
21,-8,35,-2,45,-3,-9,12,
|
||||
0,30,7,-39,43,27,-38,-91,
|
||||
30,26,19,-55,-4,63,14,-17,
|
||||
13,9,13,2,7,4,6,61,
|
||||
72,-1,-17,29,-1,-22,-17,8,
|
||||
-28,-37,63,44,41,3,2,14,
|
||||
9,-6,75,-8,-7,-12,-15,-12,
|
||||
13,9,-4,30,-22,-65,15,0,
|
||||
-45,4,-4,1,5,22,11,23};
|
||||
Binary file not shown.
@@ -1,119 +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
|
||||
|
||||
|
||||
Code slightly modified by Jean-Marc Valin
|
||||
|
||||
Speex License:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* LPC- and Reflection Coefficients
|
||||
*
|
||||
* The next two functions calculate linear prediction coefficients
|
||||
* and/or the related reflection coefficients from the first P_MAX+1
|
||||
* values of the autocorrelation function.
|
||||
*/
|
||||
|
||||
/* Invented by N. Levinson in 1947, modified by J. Durbin in 1959.
|
||||
*/
|
||||
|
||||
#include "lpc.h"
|
||||
|
||||
float /* returns minimum mean square error */
|
||||
wld(
|
||||
float * lpc, /* [0...p-1] LPC coefficients */
|
||||
const float * ac, /* in: [0...p] autocorrelation values */
|
||||
float * ref, /* out: [0...p-1] reflection coef's */
|
||||
int p
|
||||
)
|
||||
{
|
||||
int i, j; float r, error = ac[0];
|
||||
|
||||
if (ac[0] == 0) {
|
||||
for (i = 0; i < p; i++) ref[i] = 0; return 0; }
|
||||
|
||||
for (i = 0; i < p; i++) {
|
||||
|
||||
/* Sum up this iteration's reflection coefficient.
|
||||
*/
|
||||
r = -ac[i + 1];
|
||||
for (j = 0; j < i; j++) r -= lpc[j] * ac[i - j];
|
||||
ref[i] = r /= error;
|
||||
|
||||
/* Update LPC coefficients and total error.
|
||||
*/
|
||||
lpc[i] = r;
|
||||
for (j = 0; j < i/2; j++) {
|
||||
float tmp = lpc[j];
|
||||
lpc[j] += r * lpc[i-1-j];
|
||||
lpc[i-1-j] += r * tmp;
|
||||
}
|
||||
if (i % 2) lpc[j] += lpc[j] * r;
|
||||
|
||||
error *= 1.0 - r * r;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
/* Compute the autocorrelation
|
||||
* ,--,
|
||||
* ac(i) = > x(n) * x(n-i) for all n
|
||||
* `--'
|
||||
* for lags between 0 and lag-1, and x == 0 outside 0...n-1
|
||||
*/
|
||||
void _spx_autocorr(
|
||||
const float * x, /* in: [0...n-1] samples x */
|
||||
float *ac, /* out: [0...lag-1] ac values */
|
||||
int lag, int n)
|
||||
{
|
||||
float d; int i;
|
||||
while (lag--) {
|
||||
for (i = lag, d = 0; i < n; i++) d += x[i] * x[i-lag];
|
||||
ac[lag] = d;
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: lpc.h
|
||||
Functions for LPC (Linear Prediction Coefficients) analysis
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LPC_H
|
||||
#define LPC_H
|
||||
|
||||
void _spx_autocorr(
|
||||
const float * x, /* in: [0...n-1] samples x */
|
||||
float *ac, /* out: [0...lag-1] ac values */
|
||||
int lag, int n);
|
||||
|
||||
float /* returns minimum mean square error */
|
||||
wld(
|
||||
float * lpc, /* [0...p-1] LPC coefficients */
|
||||
const float * ac, /* in: [0...p] autocorrelation values */
|
||||
float * ref, /* out: [0...p-1] reflection coef's */
|
||||
int p
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,328 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Original copyright
|
||||
FILE........: AKSLSPD.C
|
||||
TYPE........: Turbo C
|
||||
COMPANY.....: Voicetronix
|
||||
AUTHOR......: David Rowe
|
||||
DATE CREATED: 24/2/93
|
||||
|
||||
Modified by Jean-Marc Valin
|
||||
|
||||
This file contains functions for converting Linear Prediction
|
||||
Coefficients (LPC) to Line Spectral Pair (LSP) and back. Note that the
|
||||
LSP coefficients are not in radians format but in the x domain of the
|
||||
unit circle.
|
||||
|
||||
Speex License:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "lsp.h"
|
||||
#include "stack_alloc.h"
|
||||
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846 /* pi */
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
|
||||
FUNCTION....: cheb_poly_eva()
|
||||
|
||||
AUTHOR......: David Rowe
|
||||
DATE CREATED: 24/2/93
|
||||
|
||||
This function evaluates a series of Chebyshev polynomials
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
static float cheb_poly_eva(float *coef,float x,int m,char *stack)
|
||||
/* float coef[] coefficients of the polynomial to be evaluated */
|
||||
/* float x the point where polynomial is to be evaluated */
|
||||
/* int m order of the polynomial */
|
||||
{
|
||||
int i;
|
||||
float *T,sum;
|
||||
int m2=m>>1;
|
||||
|
||||
/* Allocate memory for Chebyshev series formulation */
|
||||
T=PUSH(stack, m2+1, float);
|
||||
|
||||
/* Initialise values */
|
||||
T[0]=1;
|
||||
T[1]=x;
|
||||
|
||||
/* Evaluate Chebyshev series formulation using iterative approach */
|
||||
/* Evaluate polynomial and return value also free memory space */
|
||||
sum = coef[m2] + coef[m2-1]*x;
|
||||
x *= 2;
|
||||
for(i=2;i<=m2;i++)
|
||||
{
|
||||
T[i] = x*T[i-1] - T[i-2];
|
||||
sum += coef[m2-i] * T[i];
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
|
||||
FUNCTION....: lpc_to_lsp()
|
||||
|
||||
AUTHOR......: David Rowe
|
||||
DATE CREATED: 24/2/93
|
||||
|
||||
This function converts LPC coefficients to LSP
|
||||
coefficients.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
int lpc_to_lsp (float *a,int lpcrdr,float *freq,int nb,float delta, char *stack)
|
||||
/* float *a lpc coefficients */
|
||||
/* int lpcrdr order of LPC coefficients (10) */
|
||||
/* float *freq LSP frequencies in the x domain */
|
||||
/* int nb number of sub-intervals (4) */
|
||||
/* float delta grid spacing interval (0.02) */
|
||||
|
||||
|
||||
{
|
||||
|
||||
float psuml,psumr,psumm,temp_xr,xl,xr,xm=0;
|
||||
float temp_psumr/*,temp_qsumr*/;
|
||||
int i,j,m,flag,k;
|
||||
float *Q; /* ptrs for memory allocation */
|
||||
float *P;
|
||||
float *px; /* ptrs of respective P'(z) & Q'(z) */
|
||||
float *qx;
|
||||
float *p;
|
||||
float *q;
|
||||
float *pt; /* ptr used for cheb_poly_eval()
|
||||
whether P' or Q' */
|
||||
int roots=0; /* DR 8/2/94: number of roots found */
|
||||
flag = 1; /* program is searching for a root when,
|
||||
1 else has found one */
|
||||
m = lpcrdr/2; /* order of P'(z) & Q'(z) polynomials */
|
||||
|
||||
|
||||
/* Allocate memory space for polynomials */
|
||||
Q = PUSH(stack, (m+1), float);
|
||||
P = PUSH(stack, (m+1), float);
|
||||
|
||||
/* determine P'(z)'s and Q'(z)'s coefficients where
|
||||
P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */
|
||||
|
||||
px = P; /* initialise ptrs */
|
||||
qx = Q;
|
||||
p = px;
|
||||
q = qx;
|
||||
*px++ = 1.0;
|
||||
*qx++ = 1.0;
|
||||
for(i=1;i<=m;i++){
|
||||
*px++ = a[i]+a[lpcrdr+1-i]-*p++;
|
||||
*qx++ = a[i]-a[lpcrdr+1-i]+*q++;
|
||||
}
|
||||
px = P;
|
||||
qx = Q;
|
||||
for(i=0;i<m;i++){
|
||||
*px = 2**px;
|
||||
*qx = 2**qx;
|
||||
px++;
|
||||
qx++;
|
||||
}
|
||||
px = P; /* re-initialise ptrs */
|
||||
qx = Q;
|
||||
|
||||
/* Search for a zero in P'(z) polynomial first and then alternate to Q'(z).
|
||||
Keep alternating between the two polynomials as each zero is found */
|
||||
|
||||
xr = 0; /* initialise xr to zero */
|
||||
xl = 1.0; /* start at point xl = 1 */
|
||||
|
||||
|
||||
for(j=0;j<lpcrdr;j++){
|
||||
if(j%2) /* determines whether P' or Q' is eval. */
|
||||
pt = qx;
|
||||
else
|
||||
pt = px;
|
||||
|
||||
psuml = cheb_poly_eva(pt,xl,lpcrdr,stack); /* evals poly. at xl */
|
||||
flag = 1;
|
||||
while(flag && (xr >= -1.0)){
|
||||
float dd;
|
||||
/* Modified by JMV to provide smaller steps around x=+-1 */
|
||||
dd=(delta*(1-.9*xl*xl));
|
||||
if (fabs(psuml)<.2)
|
||||
dd *= .5;
|
||||
|
||||
xr = xl - dd; /* interval spacing */
|
||||
psumr = cheb_poly_eva(pt,xr,lpcrdr,stack);/* poly(xl-delta_x) */
|
||||
temp_psumr = psumr;
|
||||
temp_xr = xr;
|
||||
|
||||
/* if no sign change increment xr and re-evaluate poly(xr). Repeat til
|
||||
sign change.
|
||||
if a sign change has occurred the interval is bisected and then
|
||||
checked again for a sign change which determines in which
|
||||
interval the zero lies in.
|
||||
If there is no sign change between poly(xm) and poly(xl) set interval
|
||||
between xm and xr else set interval between xl and xr and repeat till
|
||||
root is located within the specified limits */
|
||||
|
||||
if((psumr*psuml)<0.0){
|
||||
roots++;
|
||||
|
||||
psumm=psuml;
|
||||
for(k=0;k<=nb;k++){
|
||||
xm = (xl+xr)/2; /* bisect the interval */
|
||||
psumm=cheb_poly_eva(pt,xm,lpcrdr,stack);
|
||||
if(psumm*psuml>0.){
|
||||
psuml=psumm;
|
||||
xl=xm;
|
||||
}
|
||||
else{
|
||||
psumr=psumm;
|
||||
xr=xm;
|
||||
}
|
||||
}
|
||||
|
||||
/* once zero is found, reset initial interval to xr */
|
||||
freq[j] = (xm);
|
||||
xl = xm;
|
||||
flag = 0; /* reset flag for next search */
|
||||
}
|
||||
else{
|
||||
psuml=temp_psumr;
|
||||
xl=temp_xr;
|
||||
}
|
||||
}
|
||||
}
|
||||
return(roots);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
|
||||
FUNCTION....: lsp_to_lpc()
|
||||
|
||||
AUTHOR......: David Rowe
|
||||
DATE CREATED: 24/2/93
|
||||
|
||||
lsp_to_lpc: This function converts LSP coefficients to LPC
|
||||
coefficients.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
void lsp_to_lpc(float *freq,float *ak,int lpcrdr, char *stack)
|
||||
/* float *freq array of LSP frequencies in the x domain */
|
||||
/* float *ak array of LPC coefficients */
|
||||
/* int lpcrdr order of LPC coefficients */
|
||||
|
||||
|
||||
{
|
||||
int i,j;
|
||||
float xout1,xout2,xin1,xin2;
|
||||
float *Wp;
|
||||
float *pw,*n1,*n2,*n3,*n4=NULL;
|
||||
int m = lpcrdr/2;
|
||||
|
||||
Wp = PUSH(stack, 4*m+2, float);
|
||||
pw = Wp;
|
||||
|
||||
/* initialise contents of array */
|
||||
|
||||
for(i=0;i<=4*m+1;i++){ /* set contents of buffer to 0 */
|
||||
*pw++ = 0.0;
|
||||
}
|
||||
|
||||
/* Set pointers up */
|
||||
|
||||
pw = Wp;
|
||||
xin1 = 1.0;
|
||||
xin2 = 1.0;
|
||||
|
||||
/* reconstruct P(z) and Q(z) by cascading second order
|
||||
polynomials in form 1 - 2xz(-1) +z(-2), where x is the
|
||||
LSP coefficient */
|
||||
|
||||
for(j=0;j<=lpcrdr;j++){
|
||||
int i2=0;
|
||||
for(i=0;i<m;i++,i2+=2){
|
||||
n1 = pw+(i*4);
|
||||
n2 = n1 + 1;
|
||||
n3 = n2 + 1;
|
||||
n4 = n3 + 1;
|
||||
xout1 = xin1 - 2*(freq[i2]) * *n1 + *n2;
|
||||
xout2 = xin2 - 2*(freq[i2+1]) * *n3 + *n4;
|
||||
*n2 = *n1;
|
||||
*n4 = *n3;
|
||||
*n1 = xin1;
|
||||
*n3 = xin2;
|
||||
xin1 = xout1;
|
||||
xin2 = xout2;
|
||||
}
|
||||
xout1 = xin1 + *(n4+1);
|
||||
xout2 = xin2 - *(n4+2);
|
||||
ak[j] = (xout1 + xout2)*0.5;
|
||||
*(n4+1) = xin1;
|
||||
*(n4+2) = xin2;
|
||||
|
||||
xin1 = 0.0;
|
||||
xin2 = 0.0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*Added by JMV
|
||||
Makes sure the LSPs are stable*/
|
||||
void lsp_enforce_margin(float *lsp, int len, float margin)
|
||||
{
|
||||
int i;
|
||||
if (lsp[0]<margin)
|
||||
lsp[0]=margin;
|
||||
if (lsp[len-1]>M_PI-margin)
|
||||
lsp[len-1]=M_PI-margin;
|
||||
for (i=1;i<len-1;i++)
|
||||
{
|
||||
if (lsp[i]<lsp[i-1]+margin)
|
||||
lsp[i]=lsp[i-1]+margin;
|
||||
|
||||
if (lsp[i]>lsp[i+1]-margin)
|
||||
lsp[i]= .5* (lsp[i] + lsp[i+1]-margin);
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Original Copyright
|
||||
FILE........: AK2LSPD.H
|
||||
TYPE........: Turbo C header file
|
||||
COMPANY.....: Voicetronix
|
||||
AUTHOR......: James Whitehall
|
||||
DATE CREATED: 21/11/95
|
||||
|
||||
Modified by Jean-Marc Valin
|
||||
|
||||
This file contains functions for converting Linear Prediction
|
||||
Coefficients (LPC) to Line Spectral Pair (LSP) and back. Note that the
|
||||
LSP coefficients are not in radians format but in the x domain of the
|
||||
unit circle.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
/* Speex License:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __AK2LSPD__
|
||||
#define __AK2LSPD__
|
||||
|
||||
int lpc_to_lsp (float *a, int lpcrdr, float *freq, int nb, float delta, char *stack);
|
||||
void lsp_to_lpc(float *freq, float *ak, int lpcrdr, char *stack);
|
||||
|
||||
/*Added by JMV*/
|
||||
void lsp_enforce_margin(float *lsp, int len, float margin);
|
||||
|
||||
|
||||
#endif /* __AK2LSPD__ */
|
||||
@@ -1,360 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: lsp_tables_nb.c
|
||||
Codebooks for LSPs in narrowband CELP mode
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
signed char cdbk_nb[640]={
|
||||
30,19,38,34,40,32,46,43,58,43,
|
||||
5,-18,-25,-40,-33,-55,-52,20,34,28,
|
||||
-20,-63,-97,-92,61,53,47,49,53,75,
|
||||
-14,-53,-77,-79,0,-3,-5,19,22,26,
|
||||
-9,-53,-55,66,90,72,85,68,74,52,
|
||||
-4,-41,-58,-31,-18,-31,27,32,30,18,
|
||||
24,3,8,5,-12,-3,26,28,74,63,
|
||||
-2,-39,-67,-77,-106,-74,59,59,73,65,
|
||||
44,40,71,72,82,83,98,88,89,60,
|
||||
-6,-31,-47,-48,-13,-39,-9,7,2,79,
|
||||
-1,-39,-60,-17,87,81,65,50,45,19,
|
||||
-21,-67,-91,-87,-41,-50,7,18,39,74,
|
||||
10,-31,-28,39,24,13,23,5,56,45,
|
||||
29,10,-5,-13,-11,-35,-18,-8,-10,-8,
|
||||
-25,-71,-77,-21,2,16,50,63,87,87,
|
||||
5,-32,-40,-51,-68,0,12,6,54,34,
|
||||
5,-12,32,52,68,64,69,59,65,45,
|
||||
14,-16,-31,-40,-65,-67,41,49,47,37,
|
||||
-11,-52,-75,-84,-4,57,48,42,42,33,
|
||||
-11,-51,-68,-6,13,0,8,-8,26,32,
|
||||
-23,-53,0,36,56,76,97,105,111,97,
|
||||
-1,-28,-39,-40,-43,-54,-44,-40,-18,35,
|
||||
16,-20,-19,-28,-42,29,47,38,74,45,
|
||||
3,-29,-48,-62,-80,-104,-33,56,59,59,
|
||||
10,17,46,72,84,101,117,123,123,106,
|
||||
-7,-33,-49,-51,-70,-67,-27,-31,70,67,
|
||||
-16,-62,-85,-20,82,71,86,80,85,74,
|
||||
-19,-58,-75,-45,-29,-33,-18,-25,45,57,
|
||||
-12,-42,-5,12,28,36,52,64,81,82,
|
||||
13,-9,-27,-28,22,3,2,22,26,6,
|
||||
-6,-44,-51,2,15,10,48,43,49,34,
|
||||
-19,-62,-84,-89,-102,-24,8,17,61,68,
|
||||
39,24,23,19,16,-5,12,15,27,15,
|
||||
-8,-44,-49,-60,-18,-32,-28,52,54,62,
|
||||
-8,-48,-77,-70,66,101,83,63,61,37,
|
||||
-12,-50,-75,-64,33,17,13,25,15,77,
|
||||
1,-42,-29,72,64,46,49,31,61,44,
|
||||
-8,-47,-54,-46,-30,19,20,-1,-16,0,
|
||||
16,-12,-18,-9,-26,-27,-10,-22,53,45,
|
||||
-10,-47,-75,-82,-105,-109,8,25,49,77,
|
||||
50,65,114,117,124,118,115,96,90,61,
|
||||
-9,-45,-63,-60,-75,-57,8,11,20,29,
|
||||
0,-35,-49,-43,40,47,35,40,55,38,
|
||||
-24,-76,-103,-112,-27,3,23,34,52,75,
|
||||
8,-29,-43,12,63,38,35,29,24,8,
|
||||
25,11,1,-15,-18,-43,-7,37,40,21,
|
||||
-20,-56,-19,-19,-4,-2,11,29,51,63,
|
||||
-2,-44,-62,-75,-89,30,57,51,74,51,
|
||||
50,46,68,64,65,52,63,55,65,43,
|
||||
18,-9,-26,-35,-55,-69,3,6,8,17,
|
||||
-15,-61,-86,-97,1,86,93,74,78,67,
|
||||
-1,-38,-66,-48,48,39,29,25,17,-1,
|
||||
13,13,29,39,50,51,69,82,97,98,
|
||||
-2,-36,-46,-27,-16,-30,-13,-4,-7,-4,
|
||||
25,-5,-11,-6,-25,-21,33,12,31,29,
|
||||
-8,-38,-52,-63,-68,-89,-33,-1,10,74,
|
||||
-2,-15,59,91,105,105,101,87,84,62,
|
||||
-7,-33,-50,-35,-54,-47,25,17,82,81,
|
||||
-13,-56,-83,21,58,31,42,25,72,65,
|
||||
-24,-66,-91,-56,9,-2,21,10,69,75,
|
||||
2,-24,11,22,25,28,38,34,48,33,
|
||||
7,-29,-26,17,15,-1,14,0,-2,0,
|
||||
-6,-41,-67,6,-2,-9,19,2,85,74,
|
||||
-22,-67,-84,-71,-50,3,11,-9,2,62};
|
||||
|
||||
signed char cdbk_nb_low1[320]={
|
||||
-34,-52,-15,45,2,
|
||||
23,21,52,24,-33,
|
||||
-9,-1,9,-44,-41,
|
||||
-13,-17,44,22,-17,
|
||||
-6,-4,-1,22,38,
|
||||
26,16,2,50,27,
|
||||
-35,-34,-9,-41,6,
|
||||
0,-16,-34,51,8,
|
||||
-14,-31,-49,15,-33,
|
||||
45,49,33,-11,-37,
|
||||
-62,-54,45,11,-5,
|
||||
-72,11,-1,-12,-11,
|
||||
24,27,-11,-43,46,
|
||||
43,33,-12,-9,-1,
|
||||
1,-4,-23,-57,-71,
|
||||
11,8,16,17,-8,
|
||||
-20,-31,-41,53,48,
|
||||
-16,3,65,-24,-8,
|
||||
-23,-32,-37,-32,-49,
|
||||
-10,-17,6,38,5,
|
||||
-9,-17,-46,8,52,
|
||||
3,6,45,40,39,
|
||||
-7,-6,-34,-74,31,
|
||||
8,1,-16,43,68,
|
||||
-11,-19,-31,4,6,
|
||||
0,-6,-17,-16,-38,
|
||||
-16,-30,2,9,-39,
|
||||
-16,-1,43,-10,48,
|
||||
3,3,-16,-31,-3,
|
||||
62,68,43,13,3,
|
||||
-10,8,20,-56,12,
|
||||
12,-2,-18,22,-15,
|
||||
-40,-36,1,7,41,
|
||||
0,1,46,-6,-62,
|
||||
-4,-12,-2,-11,-83,
|
||||
-13,-2,91,33,-10,
|
||||
0,4,-11,-16,79,
|
||||
32,37,14,9,51,
|
||||
-21,-28,-56,-34,0,
|
||||
21,9,-26,11,28,
|
||||
-42,-54,-23,-2,-15,
|
||||
31,30,8,-39,-66,
|
||||
-39,-36,31,-28,-40,
|
||||
-46,35,40,22,24,
|
||||
33,48,23,-34,14,
|
||||
40,32,17,27,-3,
|
||||
25,26,-13,-61,-17,
|
||||
11,4,31,60,-6,
|
||||
-26,-41,-64,13,16,
|
||||
-26,54,31,-11,-23,
|
||||
-9,-11,-34,-71,-21,
|
||||
-34,-35,55,50,29,
|
||||
-22,-27,-50,-38,57,
|
||||
33,42,57,48,26,
|
||||
11,0,-49,-31,26,
|
||||
-4,-14,5,78,37,
|
||||
17,0,-49,-12,-23,
|
||||
26,14,2,2,-43,
|
||||
-17,-12,10,-8,-4,
|
||||
8,18,12,-6,20,
|
||||
-12,-6,-13,-25,34,
|
||||
15,40,49,7,8,
|
||||
13,20,20,-19,-22,
|
||||
-2,-8,2,51,-51};
|
||||
|
||||
signed char cdbk_nb_low2[320]={
|
||||
-6,53,-21,-24,4,
|
||||
26,17,-4,-37,25,
|
||||
17,-36,-13,31,3,
|
||||
-6,27,15,-10,31,
|
||||
28,26,-10,-10,-40,
|
||||
16,-7,15,13,41,
|
||||
-9,0,-4,50,-6,
|
||||
-7,14,38,22,0,
|
||||
-48,2,1,-13,-19,
|
||||
32,-3,-60,11,-17,
|
||||
-1,-24,-34,-1,35,
|
||||
-5,-27,28,44,13,
|
||||
25,15,42,-11,15,
|
||||
51,35,-36,20,8,
|
||||
-4,-12,-29,19,-47,
|
||||
49,-15,-4,16,-29,
|
||||
-39,14,-30,4,25,
|
||||
-9,-5,-51,-14,-3,
|
||||
-40,-32,38,5,-9,
|
||||
-8,-4,-1,-22,71,
|
||||
-3,14,26,-18,-22,
|
||||
24,-41,-25,-24,6,
|
||||
23,19,-10,39,-26,
|
||||
-27,65,45,2,-7,
|
||||
-26,-8,22,-12,16,
|
||||
15,16,-35,-5,33,
|
||||
-21,-8,0,23,33,
|
||||
34,6,21,36,6,
|
||||
-7,-22,8,-37,-14,
|
||||
31,38,11,-4,-3,
|
||||
-39,-32,-8,32,-23,
|
||||
-6,-12,16,20,-28,
|
||||
-4,23,13,-52,-1,
|
||||
22,6,-33,-40,-6,
|
||||
4,-62,13,5,-26,
|
||||
35,39,11,2,57,
|
||||
-11,9,-20,-28,-33,
|
||||
52,-5,-6,-2,22,
|
||||
-14,-16,-48,35,1,
|
||||
-58,20,13,33,-1,
|
||||
-74,56,-18,-22,-31,
|
||||
12,6,-14,4,-2,
|
||||
-9,-47,10,-3,29,
|
||||
-17,-5,61,14,47,
|
||||
-12,2,72,-39,-17,
|
||||
92,64,-53,-51,-15,
|
||||
-30,-38,-41,-29,-28,
|
||||
27,9,36,9,-35,
|
||||
-42,81,-21,20,25,
|
||||
-16,-5,-17,-35,21,
|
||||
15,-28,48,2,-2,
|
||||
9,-19,29,-40,30,
|
||||
-18,-18,18,-16,-57,
|
||||
15,-20,-12,-15,-37,
|
||||
-15,33,-39,21,-22,
|
||||
-13,35,11,13,-38,
|
||||
-63,29,23,-27,32,
|
||||
18,3,-26,42,33,
|
||||
-64,-66,-17,16,56,
|
||||
2,36,3,31,21,
|
||||
-41,-39,8,-57,14,
|
||||
37,-2,19,-36,-19,
|
||||
-23,-29,-16,1,-3,
|
||||
-8,-10,31,64,-65};
|
||||
|
||||
signed char cdbk_nb_high1[320]={
|
||||
-26,-8,29,21,4,
|
||||
19,-39,33,-7,-36,
|
||||
56,54,48,40,29,
|
||||
-4,-24,-42,-66,-43,
|
||||
-60,19,-2,37,41,
|
||||
-10,-37,-60,-64,18,
|
||||
-22,77,73,40,25,
|
||||
4,19,-19,-66,-2,
|
||||
11,5,21,14,26,
|
||||
-25,-86,-4,18,1,
|
||||
26,-37,10,37,-1,
|
||||
24,-12,-59,-11,20,
|
||||
-6,34,-16,-16,42,
|
||||
19,-28,-51,53,32,
|
||||
4,10,62,21,-12,
|
||||
-34,27,4,-48,-48,
|
||||
-50,-49,31,-7,-21,
|
||||
-42,-25,-4,-43,-22,
|
||||
59,2,27,12,-9,
|
||||
-6,-16,-8,-32,-58,
|
||||
-16,-29,-5,41,23,
|
||||
-30,-33,-46,-13,-10,
|
||||
-38,52,52,1,-17,
|
||||
-9,10,26,-25,-6,
|
||||
33,-20,53,55,25,
|
||||
-32,-5,-42,23,21,
|
||||
66,5,-28,20,9,
|
||||
75,29,-7,-42,-39,
|
||||
15,3,-23,21,6,
|
||||
11,1,-29,14,63,
|
||||
10,54,26,-24,-51,
|
||||
-49,7,-23,-51,15,
|
||||
-66,1,60,25,10,
|
||||
0,-30,-4,-15,17,
|
||||
19,59,40,4,-5,
|
||||
33,6,-22,-58,-70,
|
||||
-5,23,-6,60,44,
|
||||
-29,-16,-47,-29,52,
|
||||
-19,50,28,16,35,
|
||||
31,36,0,-21,6,
|
||||
21,27,22,42,7,
|
||||
-66,-40,-8,7,19,
|
||||
46,0,-4,60,36,
|
||||
45,-7,-29,-6,-32,
|
||||
-39,2,6,-9,33,
|
||||
20,-51,-34,18,-6,
|
||||
19,6,11,5,-19,
|
||||
-29,-2,42,-11,-45,
|
||||
-21,-55,57,37,2,
|
||||
-14,-67,-16,-27,-38,
|
||||
69,48,19,2,-17,
|
||||
20,-20,-16,-34,-17,
|
||||
-25,-61,10,73,45,
|
||||
16,-40,-64,-17,-29,
|
||||
-22,56,17,-39,8,
|
||||
-11,8,-25,-18,-13,
|
||||
-19,8,54,57,36,
|
||||
-17,-26,-4,6,-21,
|
||||
40,42,-4,20,31,
|
||||
53,10,-34,-53,31,
|
||||
-17,35,0,15,-6,
|
||||
-20,-63,-73,22,25,
|
||||
29,17,8,-29,-39,
|
||||
-69,18,15,-15,-5};
|
||||
|
||||
signed char cdbk_nb_high2[320]={
|
||||
11,47,16,-9,-46,
|
||||
-32,26,-64,34,-5,
|
||||
38,-7,47,20,2,
|
||||
-73,-99,-3,-45,20,
|
||||
70,-52,15,-6,-7,
|
||||
-82,31,21,47,51,
|
||||
39,-3,9,0,-41,
|
||||
-7,-15,-54,2,0,
|
||||
27,-31,9,-45,-22,
|
||||
-38,-24,-24,8,-33,
|
||||
23,5,50,-36,-17,
|
||||
-18,-51,-2,13,19,
|
||||
43,12,-15,-12,61,
|
||||
38,38,7,13,0,
|
||||
6,-1,3,62,9,
|
||||
27,22,-33,38,-35,
|
||||
-9,30,-43,-9,-32,
|
||||
-1,4,-4,1,-5,
|
||||
-11,-8,38,31,11,
|
||||
-10,-42,-21,-37,1,
|
||||
43,15,-13,-35,-19,
|
||||
-18,15,23,-26,59,
|
||||
1,-21,53,8,-41,
|
||||
-50,-14,-28,4,21,
|
||||
25,-28,-40,5,-40,
|
||||
-41,4,51,-33,-8,
|
||||
-8,1,17,-60,12,
|
||||
25,-41,17,34,43,
|
||||
19,45,7,-37,24,
|
||||
-15,56,-2,35,-10,
|
||||
48,4,-47,-2,5,
|
||||
-5,-54,5,-3,-33,
|
||||
-10,30,-2,-44,-24,
|
||||
-38,9,-9,42,4,
|
||||
6,-56,44,-16,9,
|
||||
-40,-26,18,-20,10,
|
||||
28,-41,-21,-4,13,
|
||||
-18,32,-30,-3,37,
|
||||
15,22,28,50,-40,
|
||||
3,-29,-64,7,51,
|
||||
-19,-11,17,-27,-40,
|
||||
-64,24,-12,-7,-27,
|
||||
3,37,48,-1,2,
|
||||
-9,-38,-34,46,1,
|
||||
27,-6,19,-13,26,
|
||||
10,34,20,25,40,
|
||||
50,-6,-7,30,9,
|
||||
-24,0,-23,71,-61,
|
||||
22,58,-34,-4,2,
|
||||
-49,-33,25,30,-8,
|
||||
-6,-16,77,2,38,
|
||||
-8,-35,-6,-30,56,
|
||||
78,31,33,-20,13,
|
||||
-39,20,22,4,21,
|
||||
-8,4,-6,10,-83,
|
||||
-41,9,-25,-43,15,
|
||||
-7,-12,-34,-39,-37,
|
||||
-33,19,30,16,-33,
|
||||
42,-25,25,-68,44,
|
||||
-15,-11,-4,23,50,
|
||||
14,4,-39,-43,20,
|
||||
-30,60,9,-20,7,
|
||||
16,19,-33,37,29,
|
||||
16,-35,7,38,-27};
|
||||
@@ -1,548 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: ltp.c
|
||||
Long-Term Prediction functions
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "ltp.h"
|
||||
#include "stack_alloc.h"
|
||||
#include "filters.h"
|
||||
#include "speex_bits.h"
|
||||
|
||||
#ifdef _USE_SSE
|
||||
#include "ltp_sse.h"
|
||||
#else
|
||||
static float inner_prod(float *x, float *y, int len)
|
||||
{
|
||||
int i;
|
||||
float sum1=0,sum2=0,sum3=0,sum4=0;
|
||||
for (i=0;i<len;)
|
||||
{
|
||||
sum1 += x[i]*y[i];
|
||||
sum2 += x[i+1]*y[i+1];
|
||||
sum3 += x[i+2]*y[i+2];
|
||||
sum4 += x[i+3]*y[i+3];
|
||||
i+=4;
|
||||
}
|
||||
return sum1+sum2+sum3+sum4;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*Original, non-optimized version*/
|
||||
/*static float inner_prod(float *x, float *y, int len)
|
||||
{
|
||||
int i;
|
||||
float sum=0;
|
||||
for (i=0;i<len;i++)
|
||||
sum += x[i]*y[i];
|
||||
return sum;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
void open_loop_nbest_pitch(float *sw, int start, int end, int len, int *pitch, float *gain, int N, char *stack)
|
||||
{
|
||||
int i,j,k;
|
||||
/*float corr=0;*/
|
||||
/*float energy;*/
|
||||
float *best_score;
|
||||
float e0;
|
||||
float *corr, *energy, *score;
|
||||
|
||||
best_score = PUSH(stack,N, float);
|
||||
corr = PUSH(stack,end-start+1, float);
|
||||
energy = PUSH(stack,end-start+2, float);
|
||||
score = PUSH(stack,end-start+1, float);
|
||||
for (i=0;i<N;i++)
|
||||
{
|
||||
best_score[i]=-1;
|
||||
gain[i]=0;
|
||||
}
|
||||
energy[0]=inner_prod(sw-start, sw-start, len);
|
||||
e0=inner_prod(sw, sw, len);
|
||||
for (i=start;i<=end;i++)
|
||||
{
|
||||
/* Update energy for next pitch*/
|
||||
energy[i-start+1] = energy[i-start] + sw[-i-1]*sw[-i-1] - sw[-i+len-1]*sw[-i+len-1];
|
||||
}
|
||||
for (i=start;i<=end;i++)
|
||||
{
|
||||
corr[i-start]=0;
|
||||
score[i-start]=0;
|
||||
}
|
||||
|
||||
for (i=start;i<=end;i++)
|
||||
{
|
||||
/* Compute correlation*/
|
||||
corr[i-start]=inner_prod(sw, sw-i, len);
|
||||
score[i-start]=corr[i-start]*corr[i-start]/(energy[i-start]+1);
|
||||
}
|
||||
for (i=start;i<=end;i++)
|
||||
{
|
||||
if (score[i-start]>best_score[N-1])
|
||||
{
|
||||
float g1, g;
|
||||
g1 = corr[i-start]/(energy[i-start]+10);
|
||||
g = sqrt(g1*corr[i-start]/(e0+10));
|
||||
if (g>g1)
|
||||
g=g1;
|
||||
if (g<0)
|
||||
g=0;
|
||||
for (j=0;j<N;j++)
|
||||
{
|
||||
if (score[i-start] > best_score[j])
|
||||
{
|
||||
for (k=N-1;k>j;k--)
|
||||
{
|
||||
best_score[k]=best_score[k-1];
|
||||
pitch[k]=pitch[k-1];
|
||||
gain[k] = gain[k-1];
|
||||
}
|
||||
best_score[j]=score[i-start];
|
||||
pitch[j]=i;
|
||||
gain[j]=g;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */
|
||||
float pitch_gain_search_3tap(
|
||||
float target[], /* Target vector */
|
||||
float ak[], /* LPCs for this subframe */
|
||||
float awk1[], /* Weighted LPCs #1 for this subframe */
|
||||
float awk2[], /* Weighted LPCs #2 for this subframe */
|
||||
float exc[], /* Excitation */
|
||||
void *par,
|
||||
int pitch, /* Pitch value */
|
||||
int p, /* Number of LPC coeffs */
|
||||
int nsf, /* Number of samples in subframe */
|
||||
SpeexBits *bits,
|
||||
char *stack,
|
||||
float *exc2,
|
||||
float *r,
|
||||
int *cdbk_index
|
||||
)
|
||||
{
|
||||
int i,j;
|
||||
float *tmp, *tmp2;
|
||||
float *x[3];
|
||||
float *e[3];
|
||||
float corr[3];
|
||||
float A[3][3];
|
||||
float gain[3];
|
||||
int gain_cdbk_size;
|
||||
signed char *gain_cdbk;
|
||||
float err1,err2;
|
||||
|
||||
ltp_params *params;
|
||||
params = (ltp_params*) par;
|
||||
gain_cdbk=params->gain_cdbk;
|
||||
gain_cdbk_size=1<<params->gain_bits;
|
||||
tmp = PUSH(stack, 3*nsf, float);
|
||||
tmp2 = PUSH(stack, 3*nsf, float);
|
||||
|
||||
x[0]=tmp;
|
||||
x[1]=tmp+nsf;
|
||||
x[2]=tmp+2*nsf;
|
||||
|
||||
e[0]=tmp2;
|
||||
e[1]=tmp2+nsf;
|
||||
e[2]=tmp2+2*nsf;
|
||||
|
||||
for (i=2;i>=0;i--)
|
||||
{
|
||||
int pp=pitch+1-i;
|
||||
for (j=0;j<nsf;j++)
|
||||
{
|
||||
if (j-pp<0)
|
||||
e[i][j]=exc2[j-pp];
|
||||
else if (j-pp-pitch<0)
|
||||
e[i][j]=exc2[j-pp-pitch];
|
||||
else
|
||||
e[i][j]=0;
|
||||
}
|
||||
|
||||
if (i==2)
|
||||
syn_percep_zero(e[i], ak, awk1, awk2, x[i], nsf, p, stack);
|
||||
else {
|
||||
for (j=0;j<nsf-1;j++)
|
||||
x[i][j+1]=x[i+1][j];
|
||||
x[i][0]=0;
|
||||
for (j=0;j<nsf;j++)
|
||||
x[i][j]+=e[i][0]*r[j];
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0;i<3;i++)
|
||||
corr[i]=inner_prod(x[i],target,nsf);
|
||||
|
||||
for (i=0;i<3;i++)
|
||||
for (j=0;j<=i;j++)
|
||||
A[i][j]=A[j][i]=inner_prod(x[i],x[j],nsf);
|
||||
|
||||
{
|
||||
float C[9];
|
||||
signed char *ptr=gain_cdbk;
|
||||
int best_cdbk=0;
|
||||
float best_sum=0;
|
||||
C[0]=corr[2];
|
||||
C[1]=corr[1];
|
||||
C[2]=corr[0];
|
||||
C[3]=A[1][2];
|
||||
C[4]=A[0][1];
|
||||
C[5]=A[0][2];
|
||||
C[6]=A[2][2];
|
||||
C[7]=A[1][1];
|
||||
C[8]=A[0][0];
|
||||
|
||||
for (i=0;i<gain_cdbk_size;i++)
|
||||
{
|
||||
float sum=0;
|
||||
float g0,g1,g2;
|
||||
ptr = gain_cdbk+3*i;
|
||||
g0=0.015625*ptr[0]+.5;
|
||||
g1=0.015625*ptr[1]+.5;
|
||||
g2=0.015625*ptr[2]+.5;
|
||||
|
||||
sum += C[0]*g0;
|
||||
sum += C[1]*g1;
|
||||
sum += C[2]*g2;
|
||||
sum -= C[3]*g0*g1;
|
||||
sum -= C[4]*g2*g1;
|
||||
sum -= C[5]*g2*g0;
|
||||
sum -= .5*C[6]*g0*g0;
|
||||
sum -= .5*C[7]*g1*g1;
|
||||
sum -= .5*C[8]*g2*g2;
|
||||
|
||||
/* If 1, force "safe" pitch values to handle packet loss better */
|
||||
if (0) {
|
||||
float tot = fabs(ptr[1]);
|
||||
if (ptr[0]>0)
|
||||
tot+=ptr[0];
|
||||
if (ptr[2]>0)
|
||||
tot+=ptr[2];
|
||||
if (tot>1)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sum>best_sum || i==0)
|
||||
{
|
||||
best_sum=sum;
|
||||
best_cdbk=i;
|
||||
}
|
||||
}
|
||||
gain[0] = 0.015625*gain_cdbk[best_cdbk*3] + .5;
|
||||
gain[1] = 0.015625*gain_cdbk[best_cdbk*3+1]+ .5;
|
||||
gain[2] = 0.015625*gain_cdbk[best_cdbk*3+2]+ .5;
|
||||
|
||||
*cdbk_index=best_cdbk;
|
||||
}
|
||||
|
||||
for (i=0;i<nsf;i++)
|
||||
exc[i]=gain[0]*e[2][i]+gain[1]*e[1][i]+gain[2]*e[0][i];
|
||||
|
||||
err1=0;
|
||||
err2=0;
|
||||
for (i=0;i<nsf;i++)
|
||||
err1+=target[i]*target[i];
|
||||
for (i=0;i<nsf;i++)
|
||||
err2+=(target[i]-gain[2]*x[0][i]-gain[1]*x[1][i]-gain[0]*x[2][i])
|
||||
* (target[i]-gain[2]*x[0][i]-gain[1]*x[1][i]-gain[0]*x[2][i]);
|
||||
|
||||
return err2;
|
||||
}
|
||||
|
||||
|
||||
/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */
|
||||
int pitch_search_3tap(
|
||||
float target[], /* Target vector */
|
||||
float *sw,
|
||||
float ak[], /* LPCs for this subframe */
|
||||
float awk1[], /* Weighted LPCs #1 for this subframe */
|
||||
float awk2[], /* Weighted LPCs #2 for this subframe */
|
||||
float exc[], /* Excitation */
|
||||
void *par,
|
||||
int start, /* Smallest pitch value allowed */
|
||||
int end, /* Largest pitch value allowed */
|
||||
float pitch_coef, /* Voicing (pitch) coefficient */
|
||||
int p, /* Number of LPC coeffs */
|
||||
int nsf, /* Number of samples in subframe */
|
||||
SpeexBits *bits,
|
||||
char *stack,
|
||||
float *exc2,
|
||||
float *r,
|
||||
int complexity
|
||||
)
|
||||
{
|
||||
int i,j;
|
||||
int cdbk_index, pitch=0, best_gain_index=0;
|
||||
float *best_exc;
|
||||
int best_pitch=0;
|
||||
float err, best_err=-1;
|
||||
int N;
|
||||
ltp_params *params;
|
||||
int *nbest;
|
||||
float *gains;
|
||||
|
||||
N=complexity;
|
||||
if (N>10)
|
||||
N=10;
|
||||
|
||||
nbest=PUSH(stack, N, int);
|
||||
gains = PUSH(stack, N, float);
|
||||
params = (ltp_params*) par;
|
||||
|
||||
if (N==0 || end<start)
|
||||
{
|
||||
speex_bits_pack(bits, 0, params->pitch_bits);
|
||||
speex_bits_pack(bits, 0, params->gain_bits);
|
||||
for (i=0;i<nsf;i++)
|
||||
exc[i]=0;
|
||||
return start;
|
||||
}
|
||||
|
||||
best_exc=PUSH(stack,nsf, float);
|
||||
|
||||
if (N>end-start+1)
|
||||
N=end-start+1;
|
||||
open_loop_nbest_pitch(sw, start, end, nsf, nbest, gains, N, stack);
|
||||
for (i=0;i<N;i++)
|
||||
{
|
||||
pitch=nbest[i];
|
||||
for (j=0;j<nsf;j++)
|
||||
exc[j]=0;
|
||||
err=pitch_gain_search_3tap(target, ak, awk1, awk2, exc, par, pitch, p, nsf,
|
||||
bits, stack, exc2, r, &cdbk_index);
|
||||
if (err<best_err || best_err<0)
|
||||
{
|
||||
for (j=0;j<nsf;j++)
|
||||
best_exc[j]=exc[j];
|
||||
best_err=err;
|
||||
best_pitch=pitch;
|
||||
best_gain_index=cdbk_index;
|
||||
}
|
||||
}
|
||||
|
||||
/*printf ("pitch: %d %d\n", best_pitch, best_gain_index);*/
|
||||
speex_bits_pack(bits, best_pitch-start, params->pitch_bits);
|
||||
speex_bits_pack(bits, best_gain_index, params->gain_bits);
|
||||
/*printf ("encode pitch: %d %d\n", best_pitch, best_gain_index);*/
|
||||
for (i=0;i<nsf;i++)
|
||||
exc[i]=best_exc[i];
|
||||
|
||||
return pitch;
|
||||
}
|
||||
|
||||
void pitch_unquant_3tap(
|
||||
float exc[], /* Excitation */
|
||||
int start, /* Smallest pitch value allowed */
|
||||
int end, /* Largest pitch value allowed */
|
||||
float pitch_coef, /* Voicing (pitch) coefficient */
|
||||
void *par,
|
||||
int nsf, /* Number of samples in subframe */
|
||||
int *pitch_val,
|
||||
float *gain_val,
|
||||
SpeexBits *bits,
|
||||
char *stack,
|
||||
int count_lost,
|
||||
int subframe_offset,
|
||||
float last_pitch_gain)
|
||||
{
|
||||
int i;
|
||||
int pitch;
|
||||
int gain_index;
|
||||
float gain[3];
|
||||
signed char *gain_cdbk;
|
||||
ltp_params *params;
|
||||
params = (ltp_params*) par;
|
||||
gain_cdbk=params->gain_cdbk;
|
||||
|
||||
pitch = speex_bits_unpack_unsigned(bits, params->pitch_bits);
|
||||
pitch += start;
|
||||
gain_index = speex_bits_unpack_unsigned(bits, params->gain_bits);
|
||||
/*printf ("decode pitch: %d %d\n", pitch, gain_index);*/
|
||||
gain[0] = 0.015625*gain_cdbk[gain_index*3]+.5;
|
||||
gain[1] = 0.015625*gain_cdbk[gain_index*3+1]+.5;
|
||||
gain[2] = 0.015625*gain_cdbk[gain_index*3+2]+.5;
|
||||
|
||||
if (count_lost && pitch > subframe_offset)
|
||||
{
|
||||
float gain_sum;
|
||||
|
||||
if (1) {
|
||||
float tmp = count_lost < 4 ? last_pitch_gain : 0.4 * last_pitch_gain;
|
||||
if (tmp>.95)
|
||||
tmp=.95;
|
||||
gain_sum = fabs(gain[1]);
|
||||
if (gain[0]>0)
|
||||
gain_sum += gain[0];
|
||||
else
|
||||
gain_sum -= .5*gain[0];
|
||||
if (gain[2]>0)
|
||||
gain_sum += gain[2];
|
||||
else
|
||||
gain_sum -= .5*gain[2];
|
||||
if (gain_sum > tmp) {
|
||||
float fact = tmp/gain_sum;
|
||||
for (i=0;i<3;i++)
|
||||
gain[i]*=fact;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (0) {
|
||||
gain_sum = fabs(gain[0])+fabs(gain[1])+fabs(gain[2]);
|
||||
if (gain_sum>.95) {
|
||||
float fact = .95/gain_sum;
|
||||
for (i=0;i<3;i++)
|
||||
gain[i]*=fact;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*pitch_val = pitch;
|
||||
/**gain_val = gain[0]+gain[1]+gain[2];*/
|
||||
gain_val[0]=gain[0];
|
||||
gain_val[1]=gain[1];
|
||||
gain_val[2]=gain[2];
|
||||
|
||||
{
|
||||
float *e[3];
|
||||
float *tmp2;
|
||||
tmp2=PUSH(stack, 3*nsf, float);
|
||||
e[0]=tmp2;
|
||||
e[1]=tmp2+nsf;
|
||||
e[2]=tmp2+2*nsf;
|
||||
|
||||
for (i=0;i<3;i++)
|
||||
{
|
||||
int j;
|
||||
int pp=pitch+1-i;
|
||||
#if 0
|
||||
for (j=0;j<nsf;j++)
|
||||
{
|
||||
if (j-pp<0)
|
||||
e[i][j]=exc[j-pp];
|
||||
else if (j-pp-pitch<0)
|
||||
e[i][j]=exc[j-pp-pitch];
|
||||
else
|
||||
e[i][j]=0;
|
||||
}
|
||||
#else
|
||||
{
|
||||
int tmp1, tmp3;
|
||||
tmp1=nsf;
|
||||
if (tmp1>pp)
|
||||
tmp1=pp;
|
||||
for (j=0;j<tmp1;j++)
|
||||
e[i][j]=exc[j-pp];
|
||||
tmp3=nsf;
|
||||
if (tmp3>pp+pitch)
|
||||
tmp3=pp+pitch;
|
||||
for (j=tmp1;j<tmp3;j++)
|
||||
e[i][j]=exc[j-pp-pitch];
|
||||
for (j=tmp3;j<nsf;j++)
|
||||
e[i][j]=0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
for (i=0;i<nsf;i++)
|
||||
exc[i]=gain[0]*e[2][i]+gain[1]*e[1][i]+gain[2]*e[0][i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Forced pitch delay and gain */
|
||||
int forced_pitch_quant(
|
||||
float target[], /* Target vector */
|
||||
float *sw,
|
||||
float ak[], /* LPCs for this subframe */
|
||||
float awk1[], /* Weighted LPCs #1 for this subframe */
|
||||
float awk2[], /* Weighted LPCs #2 for this subframe */
|
||||
float exc[], /* Excitation */
|
||||
void *par,
|
||||
int start, /* Smallest pitch value allowed */
|
||||
int end, /* Largest pitch value allowed */
|
||||
float pitch_coef, /* Voicing (pitch) coefficient */
|
||||
int p, /* Number of LPC coeffs */
|
||||
int nsf, /* Number of samples in subframe */
|
||||
SpeexBits *bits,
|
||||
char *stack,
|
||||
float *exc2,
|
||||
float *r,
|
||||
int complexity
|
||||
)
|
||||
{
|
||||
int i;
|
||||
if (pitch_coef>.99)
|
||||
pitch_coef=.99;
|
||||
for (i=0;i<nsf;i++)
|
||||
{
|
||||
exc[i]=exc[i-start]*pitch_coef;
|
||||
}
|
||||
return start;
|
||||
}
|
||||
|
||||
/** Unquantize forced pitch delay and gain */
|
||||
void forced_pitch_unquant(
|
||||
float exc[], /* Excitation */
|
||||
int start, /* Smallest pitch value allowed */
|
||||
int end, /* Largest pitch value allowed */
|
||||
float pitch_coef, /* Voicing (pitch) coefficient */
|
||||
void *par,
|
||||
int nsf, /* Number of samples in subframe */
|
||||
int *pitch_val,
|
||||
float *gain_val,
|
||||
SpeexBits *bits,
|
||||
char *stack,
|
||||
int count_lost,
|
||||
int subframe_offset,
|
||||
float last_pitch_gain)
|
||||
{
|
||||
int i;
|
||||
/*pitch_coef=.9;*/
|
||||
if (pitch_coef>.99)
|
||||
pitch_coef=.99;
|
||||
for (i=0;i<nsf;i++)
|
||||
{
|
||||
exc[i]=exc[i-start]*pitch_coef;
|
||||
}
|
||||
*pitch_val = start;
|
||||
gain_val[0]=gain_val[2]=0;
|
||||
gain_val[1] = pitch_coef;
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: ltp.h
|
||||
Long-Term Prediction functions
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "speex_bits.h"
|
||||
|
||||
|
||||
typedef struct ltp_params {
|
||||
signed char *gain_cdbk;
|
||||
int gain_bits;
|
||||
int pitch_bits;
|
||||
} ltp_params;
|
||||
|
||||
|
||||
void open_loop_nbest_pitch(float *sw, int start, int end, int len, int *pitch, float *gain, int N, char *stack);
|
||||
|
||||
|
||||
/** Finds the best quantized 3-tap pitch predictor by analysis by synthesis */
|
||||
int pitch_search_3tap(
|
||||
float target[], /* Target vector */
|
||||
float *sw,
|
||||
float ak[], /* LPCs for this subframe */
|
||||
float awk1[], /* Weighted LPCs #1 for this subframe */
|
||||
float awk2[], /* Weighted LPCs #2 for this subframe */
|
||||
float exc[], /* Overlapping codebook */
|
||||
void *par,
|
||||
int start, /* Smallest pitch value allowed */
|
||||
int end, /* Largest pitch value allowed */
|
||||
float pitch_coef, /* Voicing (pitch) coefficient */
|
||||
int p, /* Number of LPC coeffs */
|
||||
int nsf, /* Number of samples in subframe */
|
||||
SpeexBits *bits,
|
||||
char *stack,
|
||||
float *exc2,
|
||||
float *r,
|
||||
int complexity
|
||||
);
|
||||
|
||||
/*Unquantize adaptive codebook and update pitch contribution*/
|
||||
void pitch_unquant_3tap(
|
||||
float exc[], /* Excitation */
|
||||
int start, /* Smallest pitch value allowed */
|
||||
int end, /* Largest pitch value allowed */
|
||||
float pitch_coef, /* Voicing (pitch) coefficient */
|
||||
void *par,
|
||||
int nsf, /* Number of samples in subframe */
|
||||
int *pitch_val,
|
||||
float *gain_val,
|
||||
SpeexBits *bits,
|
||||
char *stack,
|
||||
int lost,
|
||||
int subframe_offset,
|
||||
float last_pitch_gain
|
||||
);
|
||||
|
||||
float pitch_gain_search_3tap(
|
||||
float target[], /* Target vector */
|
||||
float ak[], /* LPCs for this subframe */
|
||||
float awk1[], /* Weighted LPCs #1 for this subframe */
|
||||
float awk2[], /* Weighted LPCs #2 for this subframe */
|
||||
float exc[], /* Excitation */
|
||||
void *par,
|
||||
int pitch, /* Pitch value */
|
||||
int p, /* Number of LPC coeffs */
|
||||
int nsf, /* Number of samples in subframe */
|
||||
SpeexBits *bits,
|
||||
char *stack,
|
||||
float *exc2,
|
||||
float *r,
|
||||
int *cdbk_index
|
||||
);
|
||||
|
||||
|
||||
/** Forced pitch delay and gain */
|
||||
int forced_pitch_quant(
|
||||
float target[], /* Target vector */
|
||||
float *sw,
|
||||
float ak[], /* LPCs for this subframe */
|
||||
float awk1[], /* Weighted LPCs #1 for this subframe */
|
||||
float awk2[], /* Weighted LPCs #2 for this subframe */
|
||||
float exc[], /* Excitation */
|
||||
void *par,
|
||||
int start, /* Smallest pitch value allowed */
|
||||
int end, /* Largest pitch value allowed */
|
||||
float pitch_coef, /* Voicing (pitch) coefficient */
|
||||
int p, /* Number of LPC coeffs */
|
||||
int nsf, /* Number of samples in subframe */
|
||||
SpeexBits *bits,
|
||||
char *stack,
|
||||
float *exc2,
|
||||
float *r,
|
||||
int complexity
|
||||
);
|
||||
|
||||
/** Unquantize forced pitch delay and gain */
|
||||
void forced_pitch_unquant(
|
||||
float exc[], /* Excitation */
|
||||
int start, /* Smallest pitch value allowed */
|
||||
int end, /* Largest pitch value allowed */
|
||||
float pitch_coef, /* Voicing (pitch) coefficient */
|
||||
void *par,
|
||||
int nsf, /* Number of samples in subframe */
|
||||
int *pitch_val,
|
||||
float *gain_val,
|
||||
SpeexBits *bits,
|
||||
char *stack,
|
||||
int lost,
|
||||
int subframe_offset,
|
||||
float last_pitch_gain
|
||||
);
|
||||
@@ -1,95 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: ltp.c
|
||||
Lont-Term Prediction functions
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
static float inner_prod(float *a, float *b, int len)
|
||||
{
|
||||
float sum;
|
||||
__asm__ __volatile__ (
|
||||
"\tpush %%eax\n"
|
||||
"\tpush %%edi\n"
|
||||
"\tpush %%ecx\n"
|
||||
"\txorps %%xmm3, %%xmm3\n"
|
||||
"\txorps %%xmm4, %%xmm4\n"
|
||||
|
||||
"\tsub $20, %%ecx\n"
|
||||
|
||||
".mul20_loop%=:\n"
|
||||
|
||||
"\tmovups (%%eax), %%xmm0\n"
|
||||
"\tmovups (%%edi), %%xmm1\n"
|
||||
"\tmulps %%xmm0, %%xmm1\n"
|
||||
|
||||
"\tmovups 16(%%eax), %%xmm5\n"
|
||||
"\tmovups 16(%%edi), %%xmm6\n"
|
||||
"\tmulps %%xmm5, %%xmm6\n"
|
||||
"\taddps %%xmm1, %%xmm3\n"
|
||||
|
||||
"\tmovups 32(%%eax), %%xmm0\n"
|
||||
"\tmovups 32(%%edi), %%xmm1\n"
|
||||
"\tmulps %%xmm0, %%xmm1\n"
|
||||
"\taddps %%xmm6, %%xmm4\n"
|
||||
|
||||
"\tmovups 48(%%eax), %%xmm5\n"
|
||||
"\tmovups 48(%%edi), %%xmm6\n"
|
||||
"\tmulps %%xmm5, %%xmm6\n"
|
||||
"\taddps %%xmm1, %%xmm3\n"
|
||||
|
||||
"\tmovups 64(%%eax), %%xmm0\n"
|
||||
"\tmovups 64(%%edi), %%xmm1\n"
|
||||
"\tmulps %%xmm0, %%xmm1\n"
|
||||
"\taddps %%xmm6, %%xmm4\n"
|
||||
"\taddps %%xmm1, %%xmm3\n"
|
||||
|
||||
|
||||
"\tadd $80, %%eax\n"
|
||||
"\tadd $80, %%edi\n"
|
||||
|
||||
"\tsub $20, %%ecx\n"
|
||||
|
||||
"\tjae .mul20_loop%=\n"
|
||||
|
||||
"\taddps %%xmm4, %%xmm3\n"
|
||||
|
||||
"\tmovhlps %%xmm3, %%xmm4\n"
|
||||
"\taddps %%xmm4, %%xmm3\n"
|
||||
"\tmovaps %%xmm3, %%xmm4\n"
|
||||
"\tshufps $0x55, %%xmm4, %%xmm4\n"
|
||||
"\taddss %%xmm4, %%xmm3\n"
|
||||
"\tmovss %%xmm3, (%%edx)\n"
|
||||
|
||||
"\tpop %%ecx\n"
|
||||
"\tpop %%edi\n"
|
||||
"\tpop %%eax\n"
|
||||
: : "a" (a), "D" (b), "c" (len), "d" (&sum) : "memory");
|
||||
return sum;
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: math_approx.c
|
||||
Various math approximation functions for Speex
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include "math_approx.h"
|
||||
|
||||
#ifdef SLOW_TRIG
|
||||
|
||||
float cos_sin[102] = {
|
||||
1.00000000, 0.00000000,
|
||||
0.99804751, 0.06245932,
|
||||
0.99219767, 0.12467473,
|
||||
0.98247331, 0.18640330,
|
||||
0.96891242, 0.24740396,
|
||||
0.95156795, 0.30743851,
|
||||
0.93050762, 0.36627253,
|
||||
0.90581368, 0.42367626,
|
||||
0.87758256, 0.47942554,
|
||||
0.84592450, 0.53330267,
|
||||
0.81096312, 0.58509727,
|
||||
0.77283495, 0.63460708,
|
||||
0.73168887, 0.68163876,
|
||||
0.68768556, 0.72600866,
|
||||
0.64099686, 0.76754350,
|
||||
0.59180508, 0.80608111,
|
||||
0.54030231, 0.84147098,
|
||||
0.48668967, 0.87357494,
|
||||
0.43117652, 0.90226759,
|
||||
0.37397963, 0.92743692,
|
||||
0.31532236, 0.94898462,
|
||||
0.25543377, 0.96682656,
|
||||
0.19454771, 0.98089306,
|
||||
0.13290194, 0.99112919,
|
||||
0.07073720, 0.99749499,
|
||||
0.00829623, 0.99996559,
|
||||
-0.05417714, 0.99853134,
|
||||
-0.11643894, 0.99319785,
|
||||
-0.17824606, 0.98398595,
|
||||
-0.23935712, 0.97093160,
|
||||
-0.29953351, 0.95408578,
|
||||
-0.35854022, 0.93351428,
|
||||
-0.41614684, 0.90929743,
|
||||
-0.47212841, 0.88152979,
|
||||
-0.52626633, 0.85031979,
|
||||
-0.57834920, 0.81578931,
|
||||
-0.62817362, 0.77807320,
|
||||
-0.67554504, 0.73731872,
|
||||
-0.72027847, 0.69368503,
|
||||
-0.76219923, 0.64734252,
|
||||
-0.80114362, 0.59847214,
|
||||
-0.83695955, 0.54726475,
|
||||
-0.86950718, 0.49392030,
|
||||
-0.89865940, 0.43864710,
|
||||
-0.92430238, 0.38166099,
|
||||
-0.94633597, 0.32318451,
|
||||
-0.96467415, 0.26344599,
|
||||
-0.97924529, 0.20267873,
|
||||
-0.98999250, 0.14112001,
|
||||
-0.99687381, 0.07901022,
|
||||
-0.99986235, 0.01659189
|
||||
};
|
||||
|
||||
float speex_cos(float x)
|
||||
{
|
||||
int ind;
|
||||
float delta;
|
||||
ind = (int)floor(x*16+.5);
|
||||
delta = x-0.062500*ind;
|
||||
ind <<= 1;
|
||||
return cos_sin[ind] - delta*(cos_sin[ind+1] +
|
||||
.5*delta*(cos_sin[ind] -
|
||||
.3333333*delta*cos_sin[ind+1]));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: math_approx.c
|
||||
Various math approximation functions for Speex
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef MATH_APPROX_H
|
||||
#define MATH_APPROX_H
|
||||
|
||||
float speex_cos(float x);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,145 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: mics.c
|
||||
Various utility routines for Speex
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "misc.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef RELEASE
|
||||
void print_vec(float *vec, int len, char *name)
|
||||
{
|
||||
int i;
|
||||
printf ("%s ", name);
|
||||
for (i=0;i<len;i++)
|
||||
printf (" %f", vec[i]);
|
||||
printf ("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned int be_int(unsigned int i)
|
||||
{
|
||||
unsigned int ret=i;
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
ret = i>>24;
|
||||
ret += (i>>8)&0x0000ff00;
|
||||
ret += (i<<8)&0x00ff0000;
|
||||
ret += (i<<24);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned int le_int(unsigned int i)
|
||||
{
|
||||
unsigned int ret=i;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
ret = i>>24;
|
||||
ret += (i>>8)&0x0000ff00;
|
||||
ret += (i<<8)&0x00ff0000;
|
||||
ret += (i<<24);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned short be_short(unsigned short s)
|
||||
{
|
||||
unsigned short ret=s;
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
ret = s>>8;
|
||||
ret += s<<8;
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned short le_short(unsigned short s)
|
||||
{
|
||||
unsigned short ret=s;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
ret = s>>8;
|
||||
ret += s<<8;
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
void *speex_alloc (int size)
|
||||
{
|
||||
return calloc(size,1);
|
||||
}
|
||||
|
||||
void *speex_realloc (void *ptr, int size)
|
||||
{
|
||||
return realloc(ptr, size);
|
||||
}
|
||||
|
||||
void speex_free (void *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
void *speex_move (void *dest, void *src, int n)
|
||||
{
|
||||
return memmove(dest,src,n);
|
||||
}
|
||||
|
||||
void speex_error(char *str)
|
||||
{
|
||||
fprintf (stderr, "Fatal error: %s\n", str);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void speex_warning(char *str)
|
||||
{
|
||||
fprintf (stderr, "warning: %s\n", str);
|
||||
}
|
||||
|
||||
void speex_warning_int(char *str, int val)
|
||||
{
|
||||
fprintf (stderr, "warning: %s %d\n", str, val);
|
||||
}
|
||||
|
||||
void speex_rand_vec(float std, float *data, int len)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<len;i++)
|
||||
data[i]+=3*std*((((float)rand())/RAND_MAX)-.5);
|
||||
}
|
||||
|
||||
float speex_rand(float std)
|
||||
{
|
||||
return 3*std*((((float)rand())/RAND_MAX)-.5);
|
||||
}
|
||||
|
||||
void _speex_putc(int ch, void *file)
|
||||
{
|
||||
FILE *f = (FILE *)file;
|
||||
fputc(ch, f);
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin */
|
||||
/**
|
||||
@file misc.h
|
||||
@brief Various compatibility routines for Speex
|
||||
*/
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef MISC_H
|
||||
#define MISC_H
|
||||
|
||||
#ifndef VERSION
|
||||
#define VERSION "speex-1.0"
|
||||
#endif
|
||||
|
||||
/*Disable some warnings on VC++*/
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4244)
|
||||
#pragma warning(disable : 4305)
|
||||
#endif
|
||||
|
||||
#ifndef RELEASE
|
||||
void print_vec(float *vec, int len, char *name);
|
||||
#endif
|
||||
|
||||
unsigned int be_int(unsigned int i);
|
||||
unsigned int le_int(unsigned int i);
|
||||
|
||||
|
||||
unsigned short be_short(unsigned short s);
|
||||
unsigned short le_short(unsigned short s);
|
||||
|
||||
/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free */
|
||||
void *speex_alloc (int size);
|
||||
|
||||
/** Speex wrapper for realloc. To do your own dynamic allocation, all you need to do is replace this function, speex_alloc and speex_free */
|
||||
void *speex_realloc (void *ptr, int size);
|
||||
|
||||
/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_alloc */
|
||||
void speex_free (void *ptr);
|
||||
|
||||
/** Speex wrapper for mem_move */
|
||||
void *speex_move (void *dest, void *src, int n);
|
||||
|
||||
void speex_error(char *str);
|
||||
|
||||
void speex_warning(char *str);
|
||||
|
||||
void speex_warning_int(char *str, int val);
|
||||
|
||||
void speex_rand_vec(float std, float *data, int len);
|
||||
|
||||
float speex_rand(float std);
|
||||
|
||||
void _speex_putc(int ch, void *file);
|
||||
|
||||
#endif
|
||||
@@ -1,650 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: modes.c
|
||||
|
||||
Describes the different modes of the codec
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "modes.h"
|
||||
#include "ltp.h"
|
||||
#include "quant_lsp.h"
|
||||
#include "cb_search.h"
|
||||
#include "sb_celp.h"
|
||||
#include "nb_celp.h"
|
||||
#include "vbr.h"
|
||||
#include "misc.h"
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
SpeexMode *speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode};
|
||||
|
||||
/* Extern declarations for all codebooks we use here */
|
||||
extern signed char gain_cdbk_nb[];
|
||||
extern signed char gain_cdbk_lbr[];
|
||||
extern signed char hexc_table[];
|
||||
extern signed char exc_5_256_table[];
|
||||
extern signed char exc_5_64_table[];
|
||||
extern signed char exc_8_128_table[];
|
||||
extern signed char exc_10_32_table[];
|
||||
extern signed char exc_10_16_table[];
|
||||
extern signed char exc_20_32_table[];
|
||||
extern signed char hexc_10_32_table[];
|
||||
|
||||
static int nb_mode_query(void *mode, int request, void *ptr);
|
||||
static int wb_mode_query(void *mode, int request, void *ptr);
|
||||
|
||||
/* Parameters for Long-Term Prediction (LTP)*/
|
||||
static ltp_params ltp_params_nb = {
|
||||
gain_cdbk_nb,
|
||||
7,
|
||||
7
|
||||
};
|
||||
|
||||
/* Parameters for Long-Term Prediction (LTP)*/
|
||||
static ltp_params ltp_params_vlbr = {
|
||||
gain_cdbk_lbr,
|
||||
5,
|
||||
0
|
||||
};
|
||||
|
||||
/* Parameters for Long-Term Prediction (LTP)*/
|
||||
static ltp_params ltp_params_lbr = {
|
||||
gain_cdbk_lbr,
|
||||
5,
|
||||
7
|
||||
};
|
||||
|
||||
/* Parameters for Long-Term Prediction (LTP)*/
|
||||
static ltp_params ltp_params_med = {
|
||||
gain_cdbk_lbr,
|
||||
5,
|
||||
7
|
||||
};
|
||||
|
||||
/* Split-VQ innovation parameters for very low bit-rate narrowband */
|
||||
static split_cb_params split_cb_nb_vlbr = {
|
||||
10, /*subvect_size*/
|
||||
4, /*nb_subvect*/
|
||||
exc_10_16_table, /*shape_cb*/
|
||||
4, /*shape_bits*/
|
||||
0,
|
||||
};
|
||||
|
||||
/* Split-VQ innovation parameters for very low bit-rate narrowband */
|
||||
static split_cb_params split_cb_nb_ulbr = {
|
||||
20, /*subvect_size*/
|
||||
2, /*nb_subvect*/
|
||||
exc_20_32_table, /*shape_cb*/
|
||||
5, /*shape_bits*/
|
||||
0,
|
||||
};
|
||||
|
||||
/* Split-VQ innovation parameters for low bit-rate narrowband */
|
||||
static split_cb_params split_cb_nb_lbr = {
|
||||
10, /*subvect_size*/
|
||||
4, /*nb_subvect*/
|
||||
exc_10_32_table, /*shape_cb*/
|
||||
5, /*shape_bits*/
|
||||
0,
|
||||
};
|
||||
|
||||
|
||||
/* Split-VQ innovation parameters narrowband */
|
||||
static split_cb_params split_cb_nb = {
|
||||
5, /*subvect_size*/
|
||||
8, /*nb_subvect*/
|
||||
exc_5_64_table, /*shape_cb*/
|
||||
6, /*shape_bits*/
|
||||
0,
|
||||
};
|
||||
|
||||
/* Split-VQ innovation parameters narrowband */
|
||||
static split_cb_params split_cb_nb_med = {
|
||||
8, /*subvect_size*/
|
||||
5, /*nb_subvect*/
|
||||
exc_8_128_table, /*shape_cb*/
|
||||
7, /*shape_bits*/
|
||||
0,
|
||||
};
|
||||
|
||||
/* Split-VQ innovation for low-band wideband */
|
||||
static split_cb_params split_cb_sb = {
|
||||
5, /*subvect_size*/
|
||||
8, /*nb_subvect*/
|
||||
exc_5_256_table, /*shape_cb*/
|
||||
8, /*shape_bits*/
|
||||
0,
|
||||
};
|
||||
|
||||
/* Split-VQ innovation for high-band wideband */
|
||||
static split_cb_params split_cb_high = {
|
||||
8, /*subvect_size*/
|
||||
5, /*nb_subvect*/
|
||||
hexc_table, /*shape_cb*/
|
||||
7, /*shape_bits*/
|
||||
1,
|
||||
};
|
||||
|
||||
|
||||
/* Split-VQ innovation for high-band wideband */
|
||||
static split_cb_params split_cb_high_lbr = {
|
||||
10, /*subvect_size*/
|
||||
4, /*nb_subvect*/
|
||||
hexc_10_32_table, /*shape_cb*/
|
||||
5, /*shape_bits*/
|
||||
0,
|
||||
};
|
||||
|
||||
/* 2150 bps "vocoder-like" mode for comfort noise */
|
||||
static SpeexSubmode nb_submode1 = {
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
/* LSP quantization */
|
||||
lsp_quant_lbr,
|
||||
lsp_unquant_lbr,
|
||||
/* No pitch quantization */
|
||||
forced_pitch_quant,
|
||||
forced_pitch_unquant,
|
||||
NULL,
|
||||
/* No innovation quantization (noise only) */
|
||||
noise_codebook_quant,
|
||||
noise_codebook_unquant,
|
||||
NULL,
|
||||
.7, .7, -1,
|
||||
43
|
||||
};
|
||||
|
||||
/* 3.95 kbps very low bit-rate mode */
|
||||
static SpeexSubmode nb_submode8 = {
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
/*LSP quantization*/
|
||||
lsp_quant_lbr,
|
||||
lsp_unquant_lbr,
|
||||
/*No pitch quantization*/
|
||||
forced_pitch_quant,
|
||||
forced_pitch_unquant,
|
||||
NULL,
|
||||
/*Innovation quantization*/
|
||||
split_cb_search_shape_sign,
|
||||
split_cb_shape_sign_unquant,
|
||||
&split_cb_nb_ulbr,
|
||||
|
||||
0.7, 0.5, .65,
|
||||
79
|
||||
};
|
||||
|
||||
/* 5.95 kbps very low bit-rate mode */
|
||||
static SpeexSubmode nb_submode2 = {
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
/*LSP quantization*/
|
||||
lsp_quant_lbr,
|
||||
lsp_unquant_lbr,
|
||||
/*No pitch quantization*/
|
||||
pitch_search_3tap,
|
||||
pitch_unquant_3tap,
|
||||
<p_params_vlbr,
|
||||
/*Innovation quantization*/
|
||||
split_cb_search_shape_sign,
|
||||
split_cb_shape_sign_unquant,
|
||||
&split_cb_nb_vlbr,
|
||||
|
||||
0.7, 0.5, .55,
|
||||
119
|
||||
};
|
||||
|
||||
/* 8 kbps low bit-rate mode */
|
||||
static SpeexSubmode nb_submode3 = {
|
||||
-1,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
/*LSP quantization*/
|
||||
lsp_quant_lbr,
|
||||
lsp_unquant_lbr,
|
||||
/*Pitch quantization*/
|
||||
pitch_search_3tap,
|
||||
pitch_unquant_3tap,
|
||||
<p_params_lbr,
|
||||
/*Innovation quantization*/
|
||||
split_cb_search_shape_sign,
|
||||
split_cb_shape_sign_unquant,
|
||||
&split_cb_nb_lbr,
|
||||
|
||||
0.7, 0.55, .45,
|
||||
160
|
||||
};
|
||||
|
||||
/* 11 kbps medium bit-rate mode */
|
||||
static SpeexSubmode nb_submode4 = {
|
||||
-1,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
/*LSP quantization*/
|
||||
lsp_quant_lbr,
|
||||
lsp_unquant_lbr,
|
||||
/*Pitch quantization*/
|
||||
pitch_search_3tap,
|
||||
pitch_unquant_3tap,
|
||||
<p_params_med,
|
||||
/*Innovation quantization*/
|
||||
split_cb_search_shape_sign,
|
||||
split_cb_shape_sign_unquant,
|
||||
&split_cb_nb_med,
|
||||
|
||||
0.7, 0.63, .35,
|
||||
220
|
||||
};
|
||||
|
||||
/* 15 kbps high bit-rate mode */
|
||||
static SpeexSubmode nb_submode5 = {
|
||||
-1,
|
||||
0,
|
||||
3,
|
||||
0,
|
||||
/*LSP quantization*/
|
||||
lsp_quant_nb,
|
||||
lsp_unquant_nb,
|
||||
/*Pitch quantization*/
|
||||
pitch_search_3tap,
|
||||
pitch_unquant_3tap,
|
||||
<p_params_nb,
|
||||
/*Innovation quantization*/
|
||||
split_cb_search_shape_sign,
|
||||
split_cb_shape_sign_unquant,
|
||||
&split_cb_nb,
|
||||
|
||||
0.7, 0.65, .25,
|
||||
300
|
||||
};
|
||||
|
||||
/* 18.2 high bit-rate mode */
|
||||
static SpeexSubmode nb_submode6 = {
|
||||
-1,
|
||||
0,
|
||||
3,
|
||||
0,
|
||||
/*LSP quantization*/
|
||||
lsp_quant_nb,
|
||||
lsp_unquant_nb,
|
||||
/*Pitch quantization*/
|
||||
pitch_search_3tap,
|
||||
pitch_unquant_3tap,
|
||||
<p_params_nb,
|
||||
/*Innovation quantization*/
|
||||
split_cb_search_shape_sign,
|
||||
split_cb_shape_sign_unquant,
|
||||
&split_cb_sb,
|
||||
|
||||
0.68, 0.65, .1,
|
||||
364
|
||||
};
|
||||
|
||||
/* 24.6 kbps high bit-rate mode */
|
||||
static SpeexSubmode nb_submode7 = {
|
||||
-1,
|
||||
0,
|
||||
3,
|
||||
1,
|
||||
/*LSP quantization*/
|
||||
lsp_quant_nb,
|
||||
lsp_unquant_nb,
|
||||
/*Pitch quantization*/
|
||||
pitch_search_3tap,
|
||||
pitch_unquant_3tap,
|
||||
<p_params_nb,
|
||||
/*Innovation quantization*/
|
||||
split_cb_search_shape_sign,
|
||||
split_cb_shape_sign_unquant,
|
||||
&split_cb_nb,
|
||||
|
||||
0.65, 0.65, -1,
|
||||
492
|
||||
};
|
||||
|
||||
|
||||
/* Default mode for narrowband */
|
||||
static SpeexNBMode nb_mode = {
|
||||
160, /*frameSize*/
|
||||
40, /*subframeSize*/
|
||||
10, /*lpcSize*/
|
||||
640, /*bufSize*/
|
||||
17, /*pitchStart*/
|
||||
144, /*pitchEnd*/
|
||||
0.9, /*gamma1*/
|
||||
0.6, /*gamma2*/
|
||||
.01, /*lag_factor*/
|
||||
1.0001, /*lpc_floor*/
|
||||
0.0, /*preemph*/
|
||||
{NULL, &nb_submode1, &nb_submode2, &nb_submode3, &nb_submode4, &nb_submode5, &nb_submode6, &nb_submode7,
|
||||
&nb_submode8, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
|
||||
5,
|
||||
{1, 8, 2, 3, 3, 4, 4, 5, 5, 6, 7}
|
||||
};
|
||||
|
||||
|
||||
/* Default mode for narrowband */
|
||||
SpeexMode speex_nb_mode = {
|
||||
&nb_mode,
|
||||
nb_mode_query,
|
||||
"narrowband",
|
||||
0,
|
||||
4,
|
||||
&nb_encoder_init,
|
||||
&nb_encoder_destroy,
|
||||
&nb_encode,
|
||||
&nb_decoder_init,
|
||||
&nb_decoder_destroy,
|
||||
&nb_decode,
|
||||
&nb_encoder_ctl,
|
||||
&nb_decoder_ctl,
|
||||
};
|
||||
|
||||
|
||||
/* Wideband part */
|
||||
|
||||
static SpeexSubmode wb_submode1 = {
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
/*LSP quantization*/
|
||||
lsp_quant_high,
|
||||
lsp_unquant_high,
|
||||
/*Pitch quantization*/
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
/*No innovation quantization*/
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
.75, .75, -1,
|
||||
36
|
||||
};
|
||||
|
||||
|
||||
static SpeexSubmode wb_submode2 = {
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
/*LSP quantization*/
|
||||
lsp_quant_high,
|
||||
lsp_unquant_high,
|
||||
/*Pitch quantization*/
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
/*Innovation quantization*/
|
||||
split_cb_search_shape_sign,
|
||||
split_cb_shape_sign_unquant,
|
||||
&split_cb_high_lbr,
|
||||
|
||||
.85, .6, -1,
|
||||
112
|
||||
};
|
||||
|
||||
|
||||
static SpeexSubmode wb_submode3 = {
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
/*LSP quantization*/
|
||||
lsp_quant_high,
|
||||
lsp_unquant_high,
|
||||
/*Pitch quantization*/
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
/*Innovation quantization*/
|
||||
split_cb_search_shape_sign,
|
||||
split_cb_shape_sign_unquant,
|
||||
&split_cb_high,
|
||||
|
||||
.75, .7, -1,
|
||||
192
|
||||
};
|
||||
|
||||
static SpeexSubmode wb_submode4 = {
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
/*LSP quantization*/
|
||||
lsp_quant_high,
|
||||
lsp_unquant_high,
|
||||
/*Pitch quantization*/
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
/*Innovation quantization*/
|
||||
split_cb_search_shape_sign,
|
||||
split_cb_shape_sign_unquant,
|
||||
&split_cb_high,
|
||||
|
||||
.75, .75, -1,
|
||||
352
|
||||
};
|
||||
|
||||
|
||||
/* Split-band wideband CELP mode*/
|
||||
static SpeexSBMode sb_wb_mode = {
|
||||
&speex_nb_mode,
|
||||
160, /*frameSize*/
|
||||
40, /*subframeSize*/
|
||||
8, /*lpcSize*/
|
||||
640, /*bufSize*/
|
||||
.9, /*gamma1*/
|
||||
0.6, /*gamma2*/
|
||||
.002, /*lag_factor*/
|
||||
1.0001, /*lpc_floor*/
|
||||
0.0, /*preemph*/
|
||||
0.9,
|
||||
{NULL, &wb_submode1, &wb_submode2, &wb_submode3, &wb_submode4, NULL, NULL, NULL},
|
||||
3,
|
||||
{1, 8, 2, 3, 4, 5, 5, 6, 6, 7, 7},
|
||||
{1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4},
|
||||
vbr_hb_thresh,
|
||||
5
|
||||
};
|
||||
|
||||
|
||||
SpeexMode speex_wb_mode = {
|
||||
&sb_wb_mode,
|
||||
wb_mode_query,
|
||||
"wideband (sub-band CELP)",
|
||||
1,
|
||||
4,
|
||||
&sb_encoder_init,
|
||||
&sb_encoder_destroy,
|
||||
&sb_encode,
|
||||
&sb_decoder_init,
|
||||
&sb_decoder_destroy,
|
||||
&sb_decode,
|
||||
&sb_encoder_ctl,
|
||||
&sb_decoder_ctl,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* "Ultra-wideband" mode stuff */
|
||||
|
||||
|
||||
|
||||
/* Split-band "ultra-wideband" (32 kbps) CELP mode*/
|
||||
static SpeexSBMode sb_uwb_mode = {
|
||||
&speex_wb_mode,
|
||||
320, /*frameSize*/
|
||||
80, /*subframeSize*/
|
||||
8, /*lpcSize*/
|
||||
1280, /*bufSize*/
|
||||
.9, /*gamma1*/
|
||||
0.6, /*gamma2*/
|
||||
.002, /*lag_factor*/
|
||||
1.0001, /*lpc_floor*/
|
||||
0.0, /*preemph*/
|
||||
0.7,
|
||||
{NULL, &wb_submode1, NULL, NULL, NULL, NULL, NULL, NULL},
|
||||
1,
|
||||
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
|
||||
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
||||
vbr_uhb_thresh,
|
||||
2
|
||||
};
|
||||
|
||||
|
||||
SpeexMode speex_uwb_mode = {
|
||||
&sb_uwb_mode,
|
||||
wb_mode_query,
|
||||
"ultra-wideband (sub-band CELP)",
|
||||
2,
|
||||
4,
|
||||
&sb_encoder_init,
|
||||
&sb_encoder_destroy,
|
||||
&sb_encode,
|
||||
&sb_decoder_init,
|
||||
&sb_decoder_destroy,
|
||||
&sb_decode,
|
||||
&sb_encoder_ctl,
|
||||
&sb_decoder_ctl,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
void *speex_encoder_init(SpeexMode *mode)
|
||||
{
|
||||
return mode->enc_init(mode);
|
||||
}
|
||||
|
||||
void *speex_decoder_init(SpeexMode *mode)
|
||||
{
|
||||
return mode->dec_init(mode);
|
||||
}
|
||||
|
||||
void speex_encoder_destroy(void *state)
|
||||
{
|
||||
(*((SpeexMode**)state))->enc_destroy(state);
|
||||
}
|
||||
|
||||
int speex_encode(void *state, float *in, SpeexBits *bits)
|
||||
{
|
||||
return (*((SpeexMode**)state))->enc(state, in, bits);
|
||||
}
|
||||
|
||||
void speex_decoder_destroy(void *state)
|
||||
{
|
||||
(*((SpeexMode**)state))->dec_destroy(state);
|
||||
}
|
||||
|
||||
int speex_decode(void *state, SpeexBits *bits, float *out)
|
||||
{
|
||||
return (*((SpeexMode**)state))->dec(state, bits, out);
|
||||
}
|
||||
|
||||
|
||||
int speex_encoder_ctl(void *state, int request, void *ptr)
|
||||
{
|
||||
return (*((SpeexMode**)state))->enc_ctl(state, request, ptr);
|
||||
}
|
||||
|
||||
int speex_decoder_ctl(void *state, int request, void *ptr)
|
||||
{
|
||||
return (*((SpeexMode**)state))->dec_ctl(state, request, ptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int nb_mode_query(void *mode, int request, void *ptr)
|
||||
{
|
||||
SpeexNBMode *m = (SpeexNBMode*)mode;
|
||||
|
||||
switch (request)
|
||||
{
|
||||
case SPEEX_MODE_FRAME_SIZE:
|
||||
*((int*)ptr)=m->frameSize;
|
||||
break;
|
||||
case SPEEX_SUBMODE_BITS_PER_FRAME:
|
||||
if (*((int*)ptr)==0)
|
||||
*((int*)ptr) = NB_SUBMODE_BITS+1;
|
||||
else if (m->submodes[*((int*)ptr)]==NULL)
|
||||
*((int*)ptr) = -1;
|
||||
else
|
||||
*((int*)ptr) = m->submodes[*((int*)ptr)]->bits_per_frame;
|
||||
break;
|
||||
default:
|
||||
speex_warning_int("Unknown nb_mode_query request: ", request);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int wb_mode_query(void *mode, int request, void *ptr)
|
||||
{
|
||||
SpeexSBMode *m = (SpeexSBMode*)mode;
|
||||
|
||||
switch (request)
|
||||
{
|
||||
case SPEEX_MODE_FRAME_SIZE:
|
||||
*((int*)ptr)=2*m->frameSize;
|
||||
break;
|
||||
case SPEEX_SUBMODE_BITS_PER_FRAME:
|
||||
if (*((int*)ptr)==0)
|
||||
*((int*)ptr) = SB_SUBMODE_BITS+1;
|
||||
else if (m->submodes[*((int*)ptr)]==NULL)
|
||||
*((int*)ptr) = -1;
|
||||
else
|
||||
*((int*)ptr) = m->submodes[*((int*)ptr)]->bits_per_frame;
|
||||
break;
|
||||
default:
|
||||
speex_warning_int("Unknown wb_mode_query request: ", request);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int speex_mode_query(SpeexMode *mode, int request, void *ptr)
|
||||
{
|
||||
return mode->query(mode->mode, request, ptr);
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin */
|
||||
/**
|
||||
@file modes.h
|
||||
@brief Describes the different modes of the codec
|
||||
*/
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef MODES_H
|
||||
#define MODES_H
|
||||
|
||||
#include "speex.h"
|
||||
#include "speex_bits.h"
|
||||
|
||||
|
||||
#define NB_SUBMODES 16
|
||||
#define NB_SUBMODE_BITS 4
|
||||
|
||||
#define SB_SUBMODES 8
|
||||
#define SB_SUBMODE_BITS 3
|
||||
|
||||
|
||||
/** Quantizes LSPs */
|
||||
typedef void (*lsp_quant_func)(float *, float *, int, SpeexBits *);
|
||||
|
||||
/** Decodes quantized LSPs */
|
||||
typedef void (*lsp_unquant_func)(float *, int, SpeexBits *);
|
||||
|
||||
|
||||
/** Long-term predictor quantization */
|
||||
typedef int (*ltp_quant_func)(float *, float *, float *, float *,
|
||||
float *, float *, void *, int, int, float,
|
||||
int, int, SpeexBits*, char *, float *, float *, int);
|
||||
|
||||
/** Long-term un-quantize */
|
||||
typedef void (*ltp_unquant_func)(float *, int, int, float, void *, int, int *,
|
||||
float *, SpeexBits*, char*, int, int, float);
|
||||
|
||||
|
||||
/** Innovation quantization function */
|
||||
typedef void (*innovation_quant_func)(float *, float *, float *, float *, void *, int, int,
|
||||
float *, float *, SpeexBits *, char *, int);
|
||||
|
||||
/** Innovation unquantization function */
|
||||
typedef void (*innovation_unquant_func)(float *, void *, int, SpeexBits*, char *);
|
||||
|
||||
/** Description of a Speex sub-mode (wither narrowband or wideband */
|
||||
typedef struct SpeexSubmode {
|
||||
int lbr_pitch; /**< Set to -1 for "normal" modes, otherwise encode pitch using a global pitch and allowing a +- lbr_pitch variation (for low not-rates)*/
|
||||
int forced_pitch_gain; /**< Use the same (forced) pitch gain for all sub-frames */
|
||||
int have_subframe_gain; /**< Number of bits to use as sub-frame innovation gain */
|
||||
int double_codebook; /**< Apply innovation quantization twice for higher quality (and higher bit-rate)*/
|
||||
/*LSP functions*/
|
||||
lsp_quant_func lsp_quant; /**< LSP quantization function */
|
||||
lsp_unquant_func lsp_unquant; /**< LSP unquantization function */
|
||||
|
||||
/*Lont-term predictor functions*/
|
||||
ltp_quant_func ltp_quant; /**< Long-term predictor (pitch) quantizer */
|
||||
ltp_unquant_func ltp_unquant; /**< Long-term predictor (pitch) un-quantizer */
|
||||
void *ltp_params; /**< Pitch parameters (options) */
|
||||
|
||||
/*Quantization of innovation*/
|
||||
innovation_quant_func innovation_quant; /**< Innovation quantization */
|
||||
innovation_unquant_func innovation_unquant; /**< Innovation un-quantization */
|
||||
void *innovation_params; /**< Innovation quantization parameters*/
|
||||
|
||||
/*Synthesis filter enhancement*/
|
||||
float lpc_enh_k1; /**< Enhancer constant */
|
||||
float lpc_enh_k2; /**< Enhancer constant */
|
||||
float comb_gain; /**< Gain of enhancer comb filter */
|
||||
|
||||
int bits_per_frame; /**< Number of bits per frame after encoding*/
|
||||
} SpeexSubmode;
|
||||
|
||||
/** Struct defining the encoding/decoding mode*/
|
||||
typedef struct SpeexNBMode {
|
||||
int frameSize; /**< Size of frames used for encoding */
|
||||
int subframeSize; /**< Size of sub-frames used for encoding */
|
||||
int lpcSize; /**< Order of LPC filter */
|
||||
int bufSize; /**< Size of signal buffer to use in encoder */
|
||||
int pitchStart; /**< Smallest pitch value allowed */
|
||||
int pitchEnd; /**< Largest pitch value allowed */
|
||||
|
||||
float gamma1; /**< Perceptual filter parameter #1 */
|
||||
float gamma2; /**< Perceptual filter parameter #2 */
|
||||
float lag_factor; /**< Lag-windowing parameter */
|
||||
float lpc_floor; /**< Noise floor for LPC analysis */
|
||||
float preemph; /**< Pre-emphasis */
|
||||
|
||||
SpeexSubmode *submodes[NB_SUBMODES]; /**< Sub-mode data for the mode */
|
||||
int defaultSubmode; /**< Default sub-mode to use when encoding */
|
||||
int quality_map[11]; /**< Mode corresponding to each quality setting */
|
||||
} SpeexNBMode;
|
||||
|
||||
|
||||
/** Struct defining the encoding/decoding mode for SB-CELP (wideband) */
|
||||
typedef struct SpeexSBMode {
|
||||
SpeexMode *nb_mode; /**< Embedded narrowband mode */
|
||||
int frameSize; /**< Size of frames used for encoding */
|
||||
int subframeSize; /**< Size of sub-frames used for encoding */
|
||||
int lpcSize; /**< Order of LPC filter */
|
||||
int bufSize; /**< Signal buffer size in encoder */
|
||||
float gamma1; /**< Perceptual filter parameter #1 */
|
||||
float gamma2; /**< Perceptual filter parameter #1 */
|
||||
float lag_factor; /**< Lag-windowing parameter */
|
||||
float lpc_floor; /**< Noise floor for LPC analysis */
|
||||
float preemph; /**< Pre-emphasis */
|
||||
float folding_gain;
|
||||
|
||||
SpeexSubmode *submodes[SB_SUBMODES]; /**< Sub-mode data for the mode */
|
||||
int defaultSubmode; /**< Default sub-mode to use when encoding */
|
||||
int low_quality_map[11]; /**< Mode corresponding to each quality setting */
|
||||
int quality_map[11]; /**< Mode corresponding to each quality setting */
|
||||
float (*vbr_thresh)[11];
|
||||
int nb_modes;
|
||||
} SpeexSBMode;
|
||||
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,202 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin */
|
||||
/**
|
||||
@file nb_celp.h
|
||||
@brief Narrowband CELP encoder/decoder
|
||||
*/
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef NB_CELP_H
|
||||
#define NB_CELP_H
|
||||
|
||||
#include "modes.h"
|
||||
#include "speex_bits.h"
|
||||
#include "speex_callbacks.h"
|
||||
#include "vbr.h"
|
||||
#include "filters.h"
|
||||
|
||||
/**Structure representing the full state of the narrowband encoder*/
|
||||
typedef struct EncState {
|
||||
SpeexMode *mode; /**< Mode corresponding to the state */
|
||||
int first; /**< Is this the first frame? */
|
||||
int frameSize; /**< Size of frames */
|
||||
int subframeSize; /**< Size of sub-frames */
|
||||
int nbSubframes; /**< Number of sub-frames */
|
||||
int windowSize; /**< Analysis (LPC) window length */
|
||||
int lpcSize; /**< LPC order */
|
||||
int bufSize; /**< Buffer size */
|
||||
int min_pitch; /**< Minimum pitch value allowed */
|
||||
int max_pitch; /**< Maximum pitch value allowed */
|
||||
|
||||
int safe_pitch; /**< Don't use too large values for pitch (in case we lose a packet) */
|
||||
int bounded_pitch; /**< Next frame should not rely on previous frames for pitch */
|
||||
int ol_pitch; /**< Open-loop pitch */
|
||||
int ol_voiced; /**< Open-loop voiced/non-voiced decision */
|
||||
int *pitch;
|
||||
float gamma1; /**< Perceptual filter: A(z/gamma1) */
|
||||
float gamma2; /**< Perceptual filter: A(z/gamma2) */
|
||||
float lag_factor; /**< Lag windowing Gaussian width */
|
||||
float lpc_floor; /**< Noise floor multiplier for A[0] in LPC analysis*/
|
||||
float preemph; /**< Pre-emphasis: P(z) = 1 - a*z^-1*/
|
||||
float pre_mem; /**< 1-element memory for pre-emphasis */
|
||||
float pre_mem2; /**< 1-element memory for pre-emphasis */
|
||||
char *stack; /**< Pseudo-stack allocation for temporary memory */
|
||||
float *inBuf; /**< Input buffer (original signal) */
|
||||
float *frame; /**< Start of original frame */
|
||||
float *excBuf; /**< Excitation buffer */
|
||||
float *exc; /**< Start of excitation frame */
|
||||
float *exc2Buf; /**< "Pitch enhanced" excitation */
|
||||
float *exc2; /**< "Pitch enhanced" excitation */
|
||||
float *swBuf; /**< Weighted signal buffer */
|
||||
float *sw; /**< Start of weighted signal frame */
|
||||
float *innov; /**< Innovation for the frame */
|
||||
float *window; /**< Temporary (Hanning) window */
|
||||
float *buf2; /**< 2nd temporary buffer */
|
||||
float *autocorr; /**< auto-correlation */
|
||||
float *lagWindow; /**< Window applied to auto-correlation */
|
||||
float *lpc; /**< LPCs for current frame */
|
||||
float *lsp; /**< LSPs for current frame */
|
||||
float *qlsp; /**< Quantized LSPs for current frame */
|
||||
float *old_lsp; /**< LSPs for previous frame */
|
||||
float *old_qlsp; /**< Quantized LSPs for previous frame */
|
||||
float *interp_lsp; /**< Interpolated LSPs */
|
||||
float *interp_qlsp; /**< Interpolated quantized LSPs */
|
||||
float *interp_lpc; /**< Interpolated LPCs */
|
||||
float *interp_qlpc; /**< Interpolated quantized LPCs */
|
||||
float *bw_lpc1; /**< LPCs after bandwidth expansion by gamma1 for perceptual weighting*/
|
||||
float *bw_lpc2; /**< LPCs after bandwidth expansion by gamma2 for perceptual weighting*/
|
||||
float *rc; /**< Reflection coefficients */
|
||||
float *mem_sp; /**< Filter memory for signal synthesis */
|
||||
float *mem_sw; /**< Filter memory for perceptually-weighted signal */
|
||||
float *mem_sw_whole; /**< Filter memory for perceptually-weighted signal (whole frame)*/
|
||||
float *mem_exc; /**< Filter memory for excitation (whole frame) */
|
||||
float *pi_gain; /**< Gain of LPC filter at theta=pi (fe/2) */
|
||||
|
||||
VBRState *vbr; /**< State of the VBR data */
|
||||
float vbr_quality; /**< Quality setting for VBR encoding */
|
||||
float relative_quality; /**< Relative quality that will be needed by VBR */
|
||||
int vbr_enabled; /**< 1 for enabling VBR, 0 otherwise */
|
||||
int vad_enabled; /**< 1 for enabling VAD, 0 otherwise */
|
||||
int dtx_enabled; /**< 1 for enabling DTX, 0 otherwise */
|
||||
int dtx_count; /**< Number of consecutive DTX frames */
|
||||
int abr_enabled; /**< ABR setting (in bps), 0 if off */
|
||||
float abr_drift;
|
||||
float abr_drift2;
|
||||
float abr_count;
|
||||
int complexity; /**< Complexity setting (0-10 from least complex to most complex) */
|
||||
int sampling_rate;
|
||||
|
||||
SpeexSubmode **submodes; /**< Sub-mode data */
|
||||
int submodeID; /**< Activated sub-mode */
|
||||
int submodeSelect; /**< Mode chosen by the user (may differ from submodeID if VAD is on) */
|
||||
} EncState;
|
||||
|
||||
/**Structure representing the full state of the narrowband decoder*/
|
||||
typedef struct DecState {
|
||||
SpeexMode *mode; /**< Mode corresponding to the state */
|
||||
int first; /**< Is this the first frame? */
|
||||
int count_lost; /**< Was the last frame lost? */
|
||||
int frameSize; /**< Size of frames */
|
||||
int subframeSize; /**< Size of sub-frames */
|
||||
int nbSubframes; /**< Number of sub-frames */
|
||||
int windowSize; /**< Analysis (LPC) window length */
|
||||
int lpcSize; /**< LPC order */
|
||||
int bufSize; /**< Buffer size */
|
||||
int min_pitch; /**< Minimum pitch value allowed */
|
||||
int max_pitch; /**< Maximum pitch value allowed */
|
||||
int sampling_rate;
|
||||
float last_ol_gain; /**< Open-loop gain for previous frame */
|
||||
|
||||
|
||||
float gamma1; /**< Perceptual filter: A(z/gamma1) */
|
||||
float gamma2; /**< Perceptual filter: A(z/gamma2) */
|
||||
float preemph; /**< Pre-emphasis: P(z) = 1 - a*z^-1*/
|
||||
float pre_mem; /**< 1-element memory for pre-emphasis */
|
||||
char *stack; /**< Pseudo-stack allocation for temporary memory */
|
||||
float *inBuf; /**< Input buffer (original signal) */
|
||||
float *frame; /**< Start of original frame */
|
||||
float *excBuf; /**< Excitation buffer */
|
||||
float *exc; /**< Start of excitation frame */
|
||||
float *innov; /**< Innovation for the frame */
|
||||
float *qlsp; /**< Quantized LSPs for current frame */
|
||||
float *old_qlsp; /**< Quantized LSPs for previous frame */
|
||||
float *interp_qlsp; /**< Interpolated quantized LSPs */
|
||||
float *interp_qlpc; /**< Interpolated quantized LPCs */
|
||||
float *mem_sp; /**< Filter memory for synthesis signal */
|
||||
float *pi_gain; /**< Gain of LPC filter at theta=pi (fe/2) */
|
||||
int last_pitch; /**< Pitch of last correctly decoded frame */
|
||||
float last_pitch_gain; /**< Pitch gain of last correctly decoded frame */
|
||||
float pitch_gain_buf[3]; /**< Pitch gain of last decoded frames */
|
||||
int pitch_gain_buf_idx; /**< Tail of the buffer */
|
||||
|
||||
SpeexSubmode **submodes; /**< Sub-mode data */
|
||||
int submodeID; /**< Activated sub-mode */
|
||||
int lpc_enh_enabled; /**< 1 when LPC enhancer is on, 0 otherwise */
|
||||
CombFilterMem *comb_mem;
|
||||
SpeexCallback speex_callbacks[SPEEX_MAX_CALLBACKS];
|
||||
|
||||
SpeexCallback user_callback;
|
||||
|
||||
/*Vocoder data*/
|
||||
float voc_m1;
|
||||
float voc_m2;
|
||||
float voc_mean;
|
||||
int voc_offset;
|
||||
|
||||
int dtx_enabled;
|
||||
} DecState;
|
||||
|
||||
/** Initializes encoder state*/
|
||||
void *nb_encoder_init(SpeexMode *m);
|
||||
|
||||
/** De-allocates encoder state resources*/
|
||||
void nb_encoder_destroy(void *state);
|
||||
|
||||
/** Encodes one frame*/
|
||||
int nb_encode(void *state, float *in, SpeexBits *bits);
|
||||
|
||||
|
||||
/** Initializes decoder state*/
|
||||
void *nb_decoder_init(SpeexMode *m);
|
||||
|
||||
/** De-allocates decoder state resources*/
|
||||
void nb_decoder_destroy(void *state);
|
||||
|
||||
/** Decodes one frame*/
|
||||
int nb_decode(void *state, SpeexBits *bits, float *out);
|
||||
|
||||
/** ioctl-like function for controlling a narrowband encoder */
|
||||
int nb_encoder_ctl(void *state, int request, void *ptr);
|
||||
|
||||
/** ioctl-like function for controlling a narrowband decoder */
|
||||
int nb_decoder_ctl(void *state, int request, void *ptr);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,311 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: quant_lsp.c
|
||||
LSP vector quantization
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "quant_lsp.h"
|
||||
#include <math.h>
|
||||
|
||||
extern int lsp_nb_vqid[64];
|
||||
static float quant_weight[MAX_LSP_SIZE];
|
||||
|
||||
/* Note: x is modified*/
|
||||
static int lsp_quant(float *x, signed char *cdbk, int nbVec, int nbDim)
|
||||
{
|
||||
int i,j;
|
||||
float dist, tmp;
|
||||
float best_dist=0;
|
||||
int best_id=0;
|
||||
signed char *ptr=cdbk;
|
||||
for (i=0;i<nbVec;i++)
|
||||
{
|
||||
dist=0;
|
||||
for (j=0;j<nbDim;j++)
|
||||
{
|
||||
tmp=(x[j]-*ptr++);
|
||||
dist+=tmp*tmp;
|
||||
}
|
||||
if (dist<best_dist || i==0)
|
||||
{
|
||||
best_dist=dist;
|
||||
best_id=i;
|
||||
}
|
||||
}
|
||||
|
||||
for (j=0;j<nbDim;j++)
|
||||
x[j] -= cdbk[best_id*nbDim+j];
|
||||
|
||||
return best_id;
|
||||
}
|
||||
|
||||
/* Note: x is modified*/
|
||||
static int lsp_weight_quant(float *x, float *weight, signed char *cdbk, int nbVec, int nbDim)
|
||||
{
|
||||
int i,j;
|
||||
float dist, tmp;
|
||||
float best_dist=0;
|
||||
int best_id=0;
|
||||
signed char *ptr=cdbk;
|
||||
for (i=0;i<nbVec;i++)
|
||||
{
|
||||
dist=0;
|
||||
for (j=0;j<nbDim;j++)
|
||||
{
|
||||
tmp=(x[j]-*ptr++);
|
||||
dist+=weight[j]*tmp*tmp;
|
||||
}
|
||||
if (dist<best_dist || i==0)
|
||||
{
|
||||
best_dist=dist;
|
||||
best_id=i;
|
||||
}
|
||||
}
|
||||
|
||||
for (j=0;j<nbDim;j++)
|
||||
x[j] -= cdbk[best_id*nbDim+j];
|
||||
return best_id;
|
||||
}
|
||||
|
||||
|
||||
void lsp_quant_nb(float *lsp, float *qlsp, int order, SpeexBits *bits)
|
||||
{
|
||||
int i;
|
||||
float tmp1, tmp2;
|
||||
int id;
|
||||
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]=lsp[i];
|
||||
|
||||
quant_weight[0] = 1/(qlsp[1]-qlsp[0]);
|
||||
quant_weight[order-1] = 1/(qlsp[order-1]-qlsp[order-2]);
|
||||
for (i=1;i<order-1;i++)
|
||||
{
|
||||
#if 1
|
||||
tmp1 = 1/((.15+qlsp[i]-qlsp[i-1])*(.15+qlsp[i]-qlsp[i-1]));
|
||||
tmp2 = 1/((.15+qlsp[i+1]-qlsp[i])*(.15+qlsp[i+1]-qlsp[i]));
|
||||
#else
|
||||
tmp1 = 1/(qlsp[i]-qlsp[i-1]);
|
||||
tmp2 = 1/(qlsp[i+1]-qlsp[i]);
|
||||
#endif
|
||||
quant_weight[i] = tmp1 > tmp2 ? tmp1 : tmp2;
|
||||
}
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]-=(.25*i+.25);
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]*=256;
|
||||
|
||||
id = lsp_quant(qlsp, cdbk_nb, NB_CDBK_SIZE, order);
|
||||
speex_bits_pack(bits, id, 6);
|
||||
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]*=2;
|
||||
|
||||
id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low1, NB_CDBK_SIZE_LOW1, 5);
|
||||
speex_bits_pack(bits, id, 6);
|
||||
|
||||
for (i=0;i<5;i++)
|
||||
qlsp[i]*=2;
|
||||
|
||||
id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low2, NB_CDBK_SIZE_LOW2, 5);
|
||||
speex_bits_pack(bits, id, 6);
|
||||
|
||||
id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high1, NB_CDBK_SIZE_HIGH1, 5);
|
||||
speex_bits_pack(bits, id, 6);
|
||||
|
||||
for (i=5;i<10;i++)
|
||||
qlsp[i]*=2;
|
||||
|
||||
id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high2, NB_CDBK_SIZE_HIGH2, 5);
|
||||
speex_bits_pack(bits, id, 6);
|
||||
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]*=.00097656;
|
||||
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]=lsp[i]-qlsp[i];
|
||||
}
|
||||
|
||||
void lsp_unquant_nb(float *lsp, int order, SpeexBits *bits)
|
||||
{
|
||||
int i, id;
|
||||
for (i=0;i<order;i++)
|
||||
lsp[i]=.25*i+.25;
|
||||
|
||||
|
||||
id=speex_bits_unpack_unsigned(bits, 6);
|
||||
for (i=0;i<10;i++)
|
||||
lsp[i] += 0.0039062*cdbk_nb[id*10+i];
|
||||
|
||||
id=speex_bits_unpack_unsigned(bits, 6);
|
||||
for (i=0;i<5;i++)
|
||||
lsp[i] += 0.0019531 * cdbk_nb_low1[id*5+i];
|
||||
|
||||
id=speex_bits_unpack_unsigned(bits, 6);
|
||||
for (i=0;i<5;i++)
|
||||
lsp[i] += 0.00097656 * cdbk_nb_low2[id*5+i];
|
||||
|
||||
id=speex_bits_unpack_unsigned(bits, 6);
|
||||
for (i=0;i<5;i++)
|
||||
lsp[i+5] += 0.0019531 * cdbk_nb_high1[id*5+i];
|
||||
|
||||
id=speex_bits_unpack_unsigned(bits, 6);
|
||||
for (i=0;i<5;i++)
|
||||
lsp[i+5] += 0.00097656 * cdbk_nb_high2[id*5+i];
|
||||
}
|
||||
|
||||
|
||||
void lsp_quant_lbr(float *lsp, float *qlsp, int order, SpeexBits *bits)
|
||||
{
|
||||
int i;
|
||||
float tmp1, tmp2;
|
||||
int id;
|
||||
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]=lsp[i];
|
||||
|
||||
quant_weight[0] = 1/(qlsp[1]-qlsp[0]);
|
||||
quant_weight[order-1] = 1/(qlsp[order-1]-qlsp[order-2]);
|
||||
for (i=1;i<order-1;i++)
|
||||
{
|
||||
#if 1
|
||||
tmp1 = 1/((.15+qlsp[i]-qlsp[i-1])*(.15+qlsp[i]-qlsp[i-1]));
|
||||
tmp2 = 1/((.15+qlsp[i+1]-qlsp[i])*(.15+qlsp[i+1]-qlsp[i]));
|
||||
#else
|
||||
tmp1 = 1/(qlsp[i]-qlsp[i-1]);
|
||||
tmp2 = 1/(qlsp[i+1]-qlsp[i]);
|
||||
#endif
|
||||
quant_weight[i] = tmp1 > tmp2 ? tmp1 : tmp2;
|
||||
}
|
||||
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]-=(.25*i+.25);
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]*=256;
|
||||
|
||||
id = lsp_quant(qlsp, cdbk_nb, NB_CDBK_SIZE, order);
|
||||
speex_bits_pack(bits, id, 6);
|
||||
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]*=2;
|
||||
|
||||
id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low1, NB_CDBK_SIZE_LOW1, 5);
|
||||
speex_bits_pack(bits, id, 6);
|
||||
|
||||
id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high1, NB_CDBK_SIZE_HIGH1, 5);
|
||||
speex_bits_pack(bits, id, 6);
|
||||
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]*=0.0019531;
|
||||
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]=lsp[i]-qlsp[i];
|
||||
}
|
||||
|
||||
void lsp_unquant_lbr(float *lsp, int order, SpeexBits *bits)
|
||||
{
|
||||
int i, id;
|
||||
for (i=0;i<order;i++)
|
||||
lsp[i]=.25*i+.25;
|
||||
|
||||
|
||||
id=speex_bits_unpack_unsigned(bits, 6);
|
||||
for (i=0;i<10;i++)
|
||||
lsp[i] += 0.0039062*cdbk_nb[id*10+i];
|
||||
|
||||
id=speex_bits_unpack_unsigned(bits, 6);
|
||||
for (i=0;i<5;i++)
|
||||
lsp[i] += 0.0019531*cdbk_nb_low1[id*5+i];
|
||||
|
||||
id=speex_bits_unpack_unsigned(bits, 6);
|
||||
for (i=0;i<5;i++)
|
||||
lsp[i+5] += 0.0019531*cdbk_nb_high1[id*5+i];
|
||||
|
||||
}
|
||||
|
||||
|
||||
extern signed char high_lsp_cdbk[];
|
||||
extern signed char high_lsp_cdbk2[];
|
||||
|
||||
|
||||
void lsp_quant_high(float *lsp, float *qlsp, int order, SpeexBits *bits)
|
||||
{
|
||||
int i;
|
||||
float tmp1, tmp2;
|
||||
int id;
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]=lsp[i];
|
||||
|
||||
quant_weight[0] = 1/(qlsp[1]-qlsp[0]);
|
||||
quant_weight[order-1] = 1/(qlsp[order-1]-qlsp[order-2]);
|
||||
for (i=1;i<order-1;i++)
|
||||
{
|
||||
tmp1 = 1/(qlsp[i]-qlsp[i-1]);
|
||||
tmp2 = 1/(qlsp[i+1]-qlsp[i]);
|
||||
quant_weight[i] = tmp1 > tmp2 ? tmp1 : tmp2;
|
||||
}
|
||||
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]-=(.3125*i+.75);
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]*=256;
|
||||
|
||||
id = lsp_quant(qlsp, high_lsp_cdbk, 64, order);
|
||||
speex_bits_pack(bits, id, 6);
|
||||
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]*=2;
|
||||
|
||||
id = lsp_weight_quant(qlsp, quant_weight, high_lsp_cdbk2, 64, order);
|
||||
speex_bits_pack(bits, id, 6);
|
||||
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]*=0.0019531;
|
||||
|
||||
for (i=0;i<order;i++)
|
||||
qlsp[i]=lsp[i]-qlsp[i];
|
||||
}
|
||||
|
||||
void lsp_unquant_high(float *lsp, int order, SpeexBits *bits)
|
||||
{
|
||||
|
||||
int i, id;
|
||||
for (i=0;i<order;i++)
|
||||
lsp[i]=.3125*i+.75;
|
||||
|
||||
|
||||
id=speex_bits_unpack_unsigned(bits, 6);
|
||||
for (i=0;i<order;i++)
|
||||
lsp[i] += 0.0039062*high_lsp_cdbk[id*order+i];
|
||||
|
||||
|
||||
id=speex_bits_unpack_unsigned(bits, 6);
|
||||
for (i=0;i<order;i++)
|
||||
lsp[i] += 0.0019531*high_lsp_cdbk2[id*order+i];
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: quant_lsp.h
|
||||
LSP vector quantization
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef QUANT_LSP_H
|
||||
#define QUANT_LSP_H
|
||||
|
||||
#include "speex_bits.h"
|
||||
|
||||
#define MAX_LSP_SIZE 20
|
||||
|
||||
#define NB_CDBK_SIZE 64
|
||||
#define NB_CDBK_SIZE_LOW1 64
|
||||
#define NB_CDBK_SIZE_LOW2 64
|
||||
#define NB_CDBK_SIZE_HIGH1 64
|
||||
#define NB_CDBK_SIZE_HIGH2 64
|
||||
|
||||
/*Narrowband codebooks*/
|
||||
extern signed char cdbk_nb[];
|
||||
extern signed char cdbk_nb_low1[];
|
||||
extern signed char cdbk_nb_low2[];
|
||||
extern signed char cdbk_nb_high1[];
|
||||
extern signed char cdbk_nb_high2[];
|
||||
|
||||
/* Quantizes narrowband LSPs with 30 bits */
|
||||
void lsp_quant_nb(float *lsp, float *qlsp, int order, SpeexBits *bits);
|
||||
|
||||
/* Decodes quantized narrowband LSPs */
|
||||
void lsp_unquant_nb(float *lsp, int order, SpeexBits *bits);
|
||||
|
||||
/* Quantizes low bit-rate narrowband LSPs with 18 bits */
|
||||
void lsp_quant_lbr(float *lsp, float *qlsp, int order, SpeexBits *bits);
|
||||
|
||||
/* Decodes quantized low bit-rate narrowband LSPs */
|
||||
void lsp_unquant_lbr(float *lsp, int order, SpeexBits *bits);
|
||||
|
||||
/* Quantizes high-band LSPs with 12 bits */
|
||||
void lsp_quant_high(float *lsp, float *qlsp, int order, SpeexBits *bits);
|
||||
|
||||
/* Decodes high-band LSPs */
|
||||
void lsp_unquant_high(float *lsp, int order, SpeexBits *bits);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,167 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin */
|
||||
/**
|
||||
@file sb_celp.h
|
||||
@brief Sub-band CELP mode used for wideband encoding
|
||||
*/
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef SB_CELP_H
|
||||
#define SB_CELP_H
|
||||
|
||||
#include "modes.h"
|
||||
#include "speex_bits.h"
|
||||
#include "nb_celp.h"
|
||||
|
||||
/**Structure representing the full state of the sub-band encoder*/
|
||||
typedef struct SBEncState {
|
||||
SpeexMode *mode; /**< Pointer to the mode (containing for vtable info) */
|
||||
void *st_low; /**< State of the low-band (narrowband) encoder */
|
||||
int full_frame_size; /**< Length of full-band frames*/
|
||||
int frame_size; /**< Length of high-band frames*/
|
||||
int subframeSize; /**< Length of high-band sub-frames*/
|
||||
int nbSubframes; /**< Number of high-band sub-frames*/
|
||||
int windowSize; /**< Length of high-band LPC window*/
|
||||
int lpcSize; /**< Order of high-band LPC analysis */
|
||||
int bufSize; /**< Buffer size */
|
||||
int first; /**< First frame? */
|
||||
float lag_factor; /**< Lag-windowing control parameter */
|
||||
float lpc_floor; /**< Controls LPC analysis noise floor */
|
||||
float gamma1; /**< Perceptual weighting coef 1 */
|
||||
float gamma2; /**< Perceptual weighting coef 2 */
|
||||
|
||||
char *stack; /**< Temporary allocation stack */
|
||||
float *x0d, *x1d; /**< QMF filter signals*/
|
||||
float *high; /**< High-band signal (buffer) */
|
||||
float *y0, *y1; /**< QMF synthesis signals */
|
||||
float *h0_mem, *h1_mem, *g0_mem, *g1_mem; /**< QMF memories */
|
||||
|
||||
float *excBuf; /**< High-band excitation */
|
||||
float *exc; /**< High-band excitation (for QMF only)*/
|
||||
float *buf; /**< Temporary buffer */
|
||||
float *res; /**< Zero-input response (ringing) */
|
||||
float *sw; /**< Perceptually weighted signal */
|
||||
float *target; /**< Weighted target signal (analysis by synthesis) */
|
||||
float *window; /**< LPC analysis window */
|
||||
float *lagWindow; /**< Auto-correlation window */
|
||||
float *autocorr; /**< Auto-correlation (for LPC analysis) */
|
||||
float *rc; /**< Reflection coefficients (unused) */
|
||||
float *lpc; /**< LPC coefficients */
|
||||
float *lsp; /**< LSP coefficients */
|
||||
float *qlsp; /**< Quantized LSPs */
|
||||
float *old_lsp; /**< LSPs of previous frame */
|
||||
float *old_qlsp; /**< Quantized LSPs of previous frame */
|
||||
float *interp_lsp; /**< Interpolated LSPs for current sub-frame */
|
||||
float *interp_qlsp; /**< Interpolated quantized LSPs for current sub-frame */
|
||||
float *interp_lpc; /**< Interpolated LPCs for current sub-frame */
|
||||
float *interp_qlpc; /**< Interpolated quantized LPCs for current sub-frame */
|
||||
float *bw_lpc1; /**< Bandwidth-expanded version of LPCs (#1) */
|
||||
float *bw_lpc2; /**< Bandwidth-expanded version of LPCs (#2) */
|
||||
|
||||
float *mem_sp; /**< Synthesis signal memory */
|
||||
float *mem_sp2;
|
||||
float *mem_sw; /**< Perceptual signal memory */
|
||||
float *pi_gain;
|
||||
|
||||
float vbr_quality; /**< Quality setting for VBR encoding */
|
||||
int vbr_enabled; /**< 1 for enabling VBR, 0 otherwise */
|
||||
int abr_enabled; /**< ABR setting (in bps), 0 if off */
|
||||
float abr_drift;
|
||||
float abr_drift2;
|
||||
float abr_count;
|
||||
int vad_enabled; /**< 1 for enabling VAD, 0 otherwise */
|
||||
float relative_quality;
|
||||
|
||||
SpeexSubmode **submodes;
|
||||
int submodeID;
|
||||
int submodeSelect;
|
||||
int complexity;
|
||||
int sampling_rate;
|
||||
|
||||
} SBEncState;
|
||||
|
||||
|
||||
/**Structure representing the full state of the sub-band decoder*/
|
||||
typedef struct SBDecState {
|
||||
SpeexMode *mode; /**< Pointer to the mode (containing for vtable info) */
|
||||
void *st_low; /**< State of the low-band (narrowband) encoder */
|
||||
int full_frame_size;
|
||||
int frame_size;
|
||||
int subframeSize;
|
||||
int nbSubframes;
|
||||
int lpcSize;
|
||||
int first;
|
||||
int sampling_rate;
|
||||
int lpc_enh_enabled;
|
||||
|
||||
char *stack;
|
||||
float *x0d, *x1d;
|
||||
float *high;
|
||||
float *y0, *y1;
|
||||
float *h0_mem, *h1_mem, *g0_mem, *g1_mem;
|
||||
|
||||
float *exc;
|
||||
float *qlsp;
|
||||
float *old_qlsp;
|
||||
float *interp_qlsp;
|
||||
float *interp_qlpc;
|
||||
|
||||
float *mem_sp;
|
||||
float *pi_gain;
|
||||
|
||||
SpeexSubmode **submodes;
|
||||
int submodeID;
|
||||
} SBDecState;
|
||||
|
||||
|
||||
/**Initializes encoder state*/
|
||||
void *sb_encoder_init(SpeexMode *m);
|
||||
|
||||
/**De-allocates encoder state resources*/
|
||||
void sb_encoder_destroy(void *state);
|
||||
|
||||
/**Encodes one frame*/
|
||||
int sb_encode(void *state, float *in, SpeexBits *bits);
|
||||
|
||||
|
||||
/**Initializes decoder state*/
|
||||
void *sb_decoder_init(SpeexMode *m);
|
||||
|
||||
/**De-allocates decoder state resources*/
|
||||
void sb_decoder_destroy(void *state);
|
||||
|
||||
/**Decodes one frame*/
|
||||
int sb_decode(void *state, SpeexBits *bits, float *out);
|
||||
|
||||
int sb_encoder_ctl(void *state, int request, void *ptr);
|
||||
|
||||
int sb_decoder_ctl(void *state, int request, void *ptr);
|
||||
|
||||
#endif
|
||||
@@ -1,135 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File speex_callbacks.c
|
||||
Callback handling and in-band signalling
|
||||
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "speex_callbacks.h"
|
||||
#include "misc.h"
|
||||
|
||||
int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state)
|
||||
{
|
||||
int id;
|
||||
SpeexCallback *callback;
|
||||
/*speex_bits_advance(bits, 5);*/
|
||||
id=speex_bits_unpack_unsigned(bits, 4);
|
||||
callback = callback_list+id;
|
||||
|
||||
if (callback->func)
|
||||
{
|
||||
return callback->func(bits, state, callback->data);
|
||||
} else
|
||||
/*If callback is not registered, skip the right number of bits*/
|
||||
{
|
||||
int adv;
|
||||
if (id<2)
|
||||
adv = 1;
|
||||
else if (id<8)
|
||||
adv = 4;
|
||||
else if (id<10)
|
||||
adv = 8;
|
||||
else if (id<12)
|
||||
adv = 16;
|
||||
else if (id<14)
|
||||
adv = 32;
|
||||
else
|
||||
adv = 64;
|
||||
speex_bits_advance(bits, adv);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data)
|
||||
{
|
||||
int m;
|
||||
m = speex_bits_unpack_unsigned(bits, 4);
|
||||
speex_encoder_ctl(data, SPEEX_SET_MODE, &m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data)
|
||||
{
|
||||
int m;
|
||||
m = speex_bits_unpack_unsigned(bits, 4);
|
||||
speex_encoder_ctl(data, SPEEX_SET_LOW_MODE, &m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data)
|
||||
{
|
||||
int m;
|
||||
m = speex_bits_unpack_unsigned(bits, 4);
|
||||
speex_encoder_ctl(data, SPEEX_SET_HIGH_MODE, &m);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data)
|
||||
{
|
||||
int vbr;
|
||||
vbr = speex_bits_unpack_unsigned(bits, 1);
|
||||
speex_encoder_ctl(data, SPEEX_SET_VBR, &vbr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data)
|
||||
{
|
||||
int enh;
|
||||
enh = speex_bits_unpack_unsigned(bits, 1);
|
||||
speex_decoder_ctl(data, SPEEX_SET_ENH, &enh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data)
|
||||
{
|
||||
int qual;
|
||||
qual = speex_bits_unpack_unsigned(bits, 4);
|
||||
speex_encoder_ctl(data, SPEEX_SET_VBR_QUALITY, &qual);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int speex_std_char_handler(SpeexBits *bits, void *state, void *data)
|
||||
{
|
||||
unsigned char ch;
|
||||
ch = speex_bits_unpack_unsigned(bits, 8);
|
||||
_speex_putc(ch, data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Default handler for user callbacks: skip it */
|
||||
int speex_default_user_handler(SpeexBits *bits, void *state, void *data)
|
||||
{
|
||||
int req_size = speex_bits_unpack_unsigned(bits, 4);
|
||||
speex_bits_advance(bits, 5+8*req_size);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: speex_header.c
|
||||
Describes the Speex header
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "speex_header.h"
|
||||
#include "misc.h"
|
||||
#include "speex.h"
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#define ENDIAN_SWITCH(x) {x=le_int(x);}
|
||||
|
||||
|
||||
/*
|
||||
typedef struct SpeexHeader {
|
||||
char speex_string[8];
|
||||
char speex_version[SPEEX_HEADER_VERSION_LENGTH];
|
||||
int speex_version_id;
|
||||
int header_size;
|
||||
int rate;
|
||||
int mode;
|
||||
int mode_bitstream_version;
|
||||
int nb_channels;
|
||||
int bitrate;
|
||||
int frame_size;
|
||||
int vbr;
|
||||
int frames_per_packet;
|
||||
int extra_headers;
|
||||
int reserved1;
|
||||
int reserved2;
|
||||
} SpeexHeader;
|
||||
*/
|
||||
|
||||
void speex_init_header(SpeexHeader *header, int rate, int nb_channels, SpeexMode *m)
|
||||
{
|
||||
int i;
|
||||
char *h="Speex ";
|
||||
/*
|
||||
strncpy(header->speex_string, "Speex ", 8);
|
||||
strncpy(header->speex_version, VERSION, SPEEX_HEADER_VERSION_LENGTH-1);
|
||||
header->speex_version[SPEEX_HEADER_VERSION_LENGTH-1]=0;
|
||||
*/
|
||||
for (i=0;i<8;i++)
|
||||
header->speex_string[i]=h[i];
|
||||
for (i=0;i<SPEEX_HEADER_VERSION_LENGTH-1 && VERSION[i];i++)
|
||||
header->speex_version[i]=VERSION[i];
|
||||
for (;i<SPEEX_HEADER_VERSION_LENGTH;i++)
|
||||
header->speex_version[i]=0;
|
||||
|
||||
header->speex_version_id = 1;
|
||||
header->header_size = sizeof(SpeexHeader);
|
||||
|
||||
header->rate = rate;
|
||||
header->mode = m->modeID;
|
||||
header->mode_bitstream_version = m->bitstream_version;
|
||||
if (m->modeID<0)
|
||||
speex_warning("This mode is meant to be used alone");
|
||||
header->nb_channels = nb_channels;
|
||||
header->bitrate = -1;
|
||||
speex_mode_query(m, SPEEX_MODE_FRAME_SIZE, &header->frame_size);
|
||||
header->vbr = 0;
|
||||
|
||||
header->frames_per_packet = 0;
|
||||
header->extra_headers = 0;
|
||||
header->reserved1 = 0;
|
||||
header->reserved2 = 0;
|
||||
}
|
||||
|
||||
char *speex_header_to_packet(SpeexHeader *header, int *size)
|
||||
{
|
||||
SpeexHeader *le_header;
|
||||
le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader));
|
||||
|
||||
speex_move(le_header, header, sizeof(SpeexHeader));
|
||||
|
||||
/*Make sure everything is now little-endian*/
|
||||
ENDIAN_SWITCH(le_header->speex_version_id);
|
||||
ENDIAN_SWITCH(le_header->header_size);
|
||||
ENDIAN_SWITCH(le_header->rate);
|
||||
ENDIAN_SWITCH(le_header->mode);
|
||||
ENDIAN_SWITCH(le_header->mode_bitstream_version);
|
||||
ENDIAN_SWITCH(le_header->nb_channels);
|
||||
ENDIAN_SWITCH(le_header->bitrate);
|
||||
ENDIAN_SWITCH(le_header->frame_size);
|
||||
ENDIAN_SWITCH(le_header->vbr);
|
||||
ENDIAN_SWITCH(le_header->frames_per_packet);
|
||||
ENDIAN_SWITCH(le_header->extra_headers);
|
||||
|
||||
*size = sizeof(SpeexHeader);
|
||||
return (char *)le_header;
|
||||
}
|
||||
|
||||
SpeexHeader *speex_packet_to_header(char *packet, int size)
|
||||
{
|
||||
int i;
|
||||
SpeexHeader *le_header;
|
||||
char *h = "Speex ";
|
||||
for (i=0;i<8;i++)
|
||||
if (packet[i]!=h[i])
|
||||
{
|
||||
speex_warning ("This doesn't look like a Speex file");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*FIXME: Do we allow larger headers?*/
|
||||
if (size < sizeof(SpeexHeader))
|
||||
{
|
||||
speex_warning("Speex header too small");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader));
|
||||
|
||||
speex_move(le_header, packet, sizeof(SpeexHeader));
|
||||
|
||||
/*Make sure everything is converted correctly from little-endian*/
|
||||
ENDIAN_SWITCH(le_header->speex_version_id);
|
||||
ENDIAN_SWITCH(le_header->header_size);
|
||||
ENDIAN_SWITCH(le_header->rate);
|
||||
ENDIAN_SWITCH(le_header->mode);
|
||||
ENDIAN_SWITCH(le_header->mode_bitstream_version);
|
||||
ENDIAN_SWITCH(le_header->nb_channels);
|
||||
ENDIAN_SWITCH(le_header->bitrate);
|
||||
ENDIAN_SWITCH(le_header->frame_size);
|
||||
ENDIAN_SWITCH(le_header->vbr);
|
||||
ENDIAN_SWITCH(le_header->frames_per_packet);
|
||||
ENDIAN_SWITCH(le_header->extra_headers);
|
||||
|
||||
return le_header;
|
||||
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: stack_alloc.h
|
||||
|
||||
Temporary memory allocation on stack
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef STACK_ALLOC_H
|
||||
#define STACK_ALLOC_H
|
||||
|
||||
#if 0
|
||||
|
||||
/*Aligns the stack to a 'size' boundary */
|
||||
#define ALIGN(stack, size) (stack=(void*)((((int)stack)+((size)-1)) & (-(size))))
|
||||
/*Aligns the stack to a 'size' boundary minus k */
|
||||
#define ALIGN_1(stack, size, k) (stack=(void*)(((((int)stack)+((size)-1+(k))) & (-(size)))-(k)))
|
||||
|
||||
/* Allocates 'size' elements of type 'type' on the stack */
|
||||
#define PUSH(stack, size, type) (ALIGN(stack,sizeof(type)),stack=(void*)(((int)stack)+((size)*sizeof(type))),(type*)(((int)stack)-((size)*sizeof(type))))
|
||||
|
||||
|
||||
#else
|
||||
|
||||
/*Aligns the stack to a 'size' boundary */
|
||||
#define ALIGN(stack, size) ((stack) += ((size) - (int)(stack)) & ((size) - 1))
|
||||
|
||||
/* Allocates 'size' elements of type 'type' on the stack */
|
||||
#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
|
||||
|
||||
/* Allocates a struct stack */
|
||||
#define PUSHS(stack, type) (ALIGN((stack),sizeof(long)),(stack)+=(sizeof(type)),(type*)((stack)-(sizeof(type))))
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,122 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: stereo.c
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "speex_stereo.h"
|
||||
#include "speex_callbacks.h"
|
||||
#include "vq.h"
|
||||
#include <math.h>
|
||||
|
||||
/*float e_ratio_quant[4] = {1, 1.26, 1.587, 2};*/
|
||||
static float e_ratio_quant[4] = {.25, .315, .397, .5};
|
||||
|
||||
void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits)
|
||||
{
|
||||
int i, tmp;
|
||||
float e_left=0, e_right=0, e_tot=0;
|
||||
float balance, e_ratio;
|
||||
for (i=0;i<frame_size;i++)
|
||||
{
|
||||
e_left += data[2*i]*data[2*i];
|
||||
e_right += data[2*i+1]*data[2*i+1];
|
||||
data[i] = .5*(data[2*i]+data[2*i+1]);
|
||||
e_tot += data[i]*data[i];
|
||||
}
|
||||
balance=(e_left+1)/(e_right+1);
|
||||
e_ratio = e_tot/(1+e_left+e_right);
|
||||
|
||||
/*Quantization*/
|
||||
speex_bits_pack(bits, 14, 5);
|
||||
speex_bits_pack(bits, SPEEX_INBAND_STEREO, 4);
|
||||
|
||||
balance=4*log(balance);
|
||||
|
||||
/*Pack sign*/
|
||||
if (balance>0)
|
||||
speex_bits_pack(bits, 0, 1);
|
||||
else
|
||||
speex_bits_pack(bits, 1, 1);
|
||||
balance=floor(.5+fabs(balance));
|
||||
if (balance>30)
|
||||
balance=31;
|
||||
|
||||
speex_bits_pack(bits, (int)balance, 5);
|
||||
|
||||
/*Quantize energy ratio*/
|
||||
tmp=vq_index(&e_ratio, e_ratio_quant, 1, 4);
|
||||
speex_bits_pack(bits, tmp, 2);
|
||||
}
|
||||
|
||||
void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *stereo)
|
||||
{
|
||||
float balance, e_ratio;
|
||||
int i;
|
||||
float e_tot=0, e_left, e_right, e_sum;
|
||||
|
||||
balance=stereo->balance;
|
||||
e_ratio=stereo->e_ratio;
|
||||
for (i=frame_size-1;i>=0;i--)
|
||||
{
|
||||
e_tot += data[i]*data[i];
|
||||
}
|
||||
e_sum=e_tot/e_ratio;
|
||||
e_left = e_sum*balance / (1+balance);
|
||||
e_right = e_sum-e_left;
|
||||
|
||||
e_left = sqrt(e_left/(e_tot+.01));
|
||||
e_right = sqrt(e_right/(e_tot+.01));
|
||||
|
||||
for (i=frame_size-1;i>=0;i--)
|
||||
{
|
||||
float ftmp=data[i];
|
||||
stereo->smooth_left = .98*stereo->smooth_left + .02*e_left;
|
||||
stereo->smooth_right = .98*stereo->smooth_right + .02*e_right;
|
||||
data[2*i] = stereo->smooth_left*ftmp;
|
||||
data[2*i+1] = stereo->smooth_right*ftmp;
|
||||
}
|
||||
}
|
||||
|
||||
int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data)
|
||||
{
|
||||
SpeexStereoState *stereo;
|
||||
float sign=1;
|
||||
int tmp;
|
||||
|
||||
stereo = (SpeexStereoState*)data;
|
||||
if (speex_bits_unpack_unsigned(bits, 1))
|
||||
sign=-1;
|
||||
tmp = speex_bits_unpack_unsigned(bits, 5);
|
||||
stereo->balance = exp(sign*.25*tmp);
|
||||
|
||||
tmp = speex_bits_unpack_unsigned(bits, 2);
|
||||
stereo->e_ratio = e_ratio_quant[tmp];
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
#include "speex.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "speex_callbacks.h"
|
||||
|
||||
#define FRAME_SIZE 160
|
||||
#include <math.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *inFile, *outFile, *bitsFile;
|
||||
FILE *fin, *fout, *fbits=NULL;
|
||||
short in[FRAME_SIZE];
|
||||
float input[FRAME_SIZE], bak[FRAME_SIZE], bak2[FRAME_SIZE];
|
||||
char cbits[200];
|
||||
int nbBits;
|
||||
int i;
|
||||
void *st;
|
||||
void *dec;
|
||||
SpeexBits bits;
|
||||
int tmp;
|
||||
int bitCount=0;
|
||||
SpeexCallback callback;
|
||||
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
bak2[i]=0;
|
||||
st = speex_encoder_init(&speex_nb_mode);
|
||||
dec = speex_decoder_init(&speex_nb_mode);
|
||||
|
||||
callback.callback_id = SPEEX_INBAND_CHAR;
|
||||
callback.func = speex_std_char_handler;
|
||||
callback.data = stderr;
|
||||
speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback);
|
||||
|
||||
callback.callback_id = SPEEX_INBAND_MODE_REQUEST;
|
||||
callback.func = speex_std_mode_request_handler;
|
||||
callback.data = st;
|
||||
speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback);
|
||||
|
||||
tmp=0;
|
||||
speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp);
|
||||
tmp=0;
|
||||
speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp);
|
||||
tmp=8;
|
||||
speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp);
|
||||
tmp=1;
|
||||
speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);
|
||||
|
||||
speex_mode_query(&speex_nb_mode, SPEEX_MODE_FRAME_SIZE, &tmp);
|
||||
fprintf (stderr, "frame size: %d\n", tmp);
|
||||
|
||||
if (argc != 4 && argc != 3)
|
||||
{
|
||||
fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc);
|
||||
exit(1);
|
||||
}
|
||||
inFile = argv[1];
|
||||
fin = fopen(inFile, "r");
|
||||
outFile = argv[2];
|
||||
fout = fopen(outFile, "w");
|
||||
if (argc==4)
|
||||
{
|
||||
bitsFile = argv[3];
|
||||
fbits = fopen(bitsFile, "w");
|
||||
}
|
||||
speex_bits_init(&bits);
|
||||
while (!feof(fin))
|
||||
{
|
||||
fread(in, sizeof(short), FRAME_SIZE, fin);
|
||||
if (feof(fin))
|
||||
break;
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
bak[i]=input[i]=in[i];
|
||||
speex_bits_reset(&bits);
|
||||
/*
|
||||
speex_bits_pack(&bits, 14, 5);
|
||||
speex_bits_pack(&bits, SPEEX_INBAND_CHAR, 4);
|
||||
speex_bits_pack(&bits, 'A', 8);
|
||||
|
||||
speex_bits_pack(&bits, 14, 5);
|
||||
speex_bits_pack(&bits, SPEEX_INBAND_MODE_REQUEST, 4);
|
||||
speex_bits_pack(&bits, 7, 4);
|
||||
|
||||
speex_bits_pack(&bits, 15, 5);
|
||||
speex_bits_pack(&bits, 2, 4);
|
||||
speex_bits_pack(&bits, 0, 16);
|
||||
*/
|
||||
speex_encode(st, input, &bits);
|
||||
nbBits = speex_bits_write(&bits, cbits, 200);
|
||||
bitCount+=bits.nbBits;
|
||||
printf ("Encoding frame in %d bits\n", nbBits*8);
|
||||
if (argc==4)
|
||||
fwrite(cbits, 1, nbBits, fbits);
|
||||
{
|
||||
float enoise=0, esig=0, snr;
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
{
|
||||
enoise+=(bak2[i]-input[i])*(bak2[i]-input[i]);
|
||||
esig += bak2[i]*bak2[i];
|
||||
}
|
||||
snr = 10*log10((esig+1)/(enoise+1));
|
||||
printf ("real SNR = %f\n", snr);
|
||||
}
|
||||
speex_bits_rewind(&bits);
|
||||
|
||||
speex_decode(dec, &bits, input);
|
||||
|
||||
/* Save the bits here */
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
{
|
||||
if (input[i]>32000)
|
||||
input[i]=32000;
|
||||
else if (input[i]<-32000)
|
||||
input[i]=-32000;
|
||||
}
|
||||
speex_bits_reset(&bits);
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
in[i]=(short)input[i];
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
bak2[i]=bak[i];
|
||||
fwrite(in, sizeof(short), FRAME_SIZE, fout);
|
||||
}
|
||||
fprintf (stderr, "Total encoded size: %d bits\n", bitCount);
|
||||
|
||||
speex_encoder_destroy(st);
|
||||
speex_decoder_destroy(dec);
|
||||
return 1;
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
#include "speex.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define FRAME_SIZE 640
|
||||
#include <math.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *inFile, *outFile, *bitsFile;
|
||||
FILE *fin, *fout, *fbits=NULL;
|
||||
short in[FRAME_SIZE];
|
||||
float input[FRAME_SIZE], bak[FRAME_SIZE], bak2[FRAME_SIZE];
|
||||
char cbits[200];
|
||||
int nbBits;
|
||||
int i;
|
||||
void *st;
|
||||
void *dec;
|
||||
SpeexBits bits;
|
||||
int tmp;
|
||||
int bitCount=0;
|
||||
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
bak2[i]=0;
|
||||
st = speex_encoder_init(&speex_uwb_mode);
|
||||
dec = speex_decoder_init(&speex_uwb_mode);
|
||||
|
||||
tmp=0;
|
||||
/*speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp);
|
||||
tmp=0;
|
||||
speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp);
|
||||
tmp=10;
|
||||
speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp);
|
||||
tmp=3;
|
||||
speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);
|
||||
tmp=3;
|
||||
speex_encoder_ctl(st, SPEEX_SET_HIGH_MODE, &tmp);
|
||||
tmp=6;
|
||||
speex_encoder_ctl(st, SPEEX_SET_LOW_MODE, &tmp);
|
||||
*/
|
||||
if (argc != 4 && argc != 3)
|
||||
{
|
||||
fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc);
|
||||
exit(1);
|
||||
}
|
||||
inFile = argv[1];
|
||||
fin = fopen(inFile, "r");
|
||||
outFile = argv[2];
|
||||
fout = fopen(outFile, "w");
|
||||
if (argc==4)
|
||||
{
|
||||
bitsFile = argv[3];
|
||||
fbits = fopen(bitsFile, "w");
|
||||
}
|
||||
speex_bits_init(&bits);
|
||||
while (!feof(fin))
|
||||
{
|
||||
fread(in, sizeof(short), FRAME_SIZE, fin);
|
||||
if (feof(fin))
|
||||
break;
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
bak[i]=input[i]=in[i];
|
||||
speex_bits_reset(&bits);
|
||||
speex_encode(st, input, &bits);
|
||||
nbBits = speex_bits_write(&bits, cbits, 200);
|
||||
bitCount+=bits.nbBits;
|
||||
printf ("Encoding frame in %d bits\n", nbBits*8);
|
||||
if (argc==4)
|
||||
fwrite(cbits, 1, nbBits, fbits);
|
||||
{
|
||||
float enoise=0, esig=0, snr;
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
{
|
||||
enoise+=(bak2[i]-input[i])*(bak2[i]-input[i]);
|
||||
esig += bak2[i]*bak2[i];
|
||||
}
|
||||
snr = 10*log10((esig+1)/(enoise+1));
|
||||
printf ("real SNR = %f\n", snr);
|
||||
}
|
||||
speex_bits_rewind(&bits);
|
||||
|
||||
speex_decode(dec, &bits, input);
|
||||
|
||||
/* Save the bits here */
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
{
|
||||
if (input[i]>32000)
|
||||
input[i]=32000;
|
||||
else if (input[i]<-32000)
|
||||
input[i]=-32000;
|
||||
}
|
||||
speex_bits_reset(&bits);
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
in[i]=(short)input[i];
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
bak2[i]=bak[i];
|
||||
fwrite(in, sizeof(short), FRAME_SIZE, fout);
|
||||
}
|
||||
|
||||
fprintf (stderr, "Total encoded size: %d bits\n", bitCount);
|
||||
speex_encoder_destroy(st);
|
||||
speex_decoder_destroy(dec);
|
||||
speex_bits_destroy(&bits);
|
||||
fclose(fin);
|
||||
fclose(fout);
|
||||
return 1;
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
#include "speex.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define FRAME_SIZE 320
|
||||
#include <math.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *inFile, *outFile, *bitsFile;
|
||||
FILE *fin, *fout, *fbits=NULL;
|
||||
short in[FRAME_SIZE];
|
||||
float input[FRAME_SIZE], bak[FRAME_SIZE], bak2[FRAME_SIZE];
|
||||
char cbits[200];
|
||||
int nbBits;
|
||||
int i;
|
||||
void *st;
|
||||
void *dec;
|
||||
SpeexBits bits;
|
||||
int tmp;
|
||||
int bitCount=0;
|
||||
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
bak2[i]=0;
|
||||
st = speex_encoder_init(&speex_wb_mode);
|
||||
dec = speex_decoder_init(&speex_wb_mode);
|
||||
|
||||
tmp=0;
|
||||
speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp);
|
||||
tmp=0;
|
||||
speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp);
|
||||
tmp=10;
|
||||
speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp);
|
||||
tmp=3;
|
||||
speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);
|
||||
tmp=3;
|
||||
speex_encoder_ctl(st, SPEEX_SET_HIGH_MODE, &tmp);
|
||||
tmp=6;
|
||||
speex_encoder_ctl(st, SPEEX_SET_LOW_MODE, &tmp);
|
||||
|
||||
if (argc != 4 && argc != 3)
|
||||
{
|
||||
fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc);
|
||||
exit(1);
|
||||
}
|
||||
inFile = argv[1];
|
||||
fin = fopen(inFile, "r");
|
||||
outFile = argv[2];
|
||||
fout = fopen(outFile, "w");
|
||||
if (argc==4)
|
||||
{
|
||||
bitsFile = argv[3];
|
||||
fbits = fopen(bitsFile, "w");
|
||||
}
|
||||
speex_bits_init(&bits);
|
||||
while (!feof(fin))
|
||||
{
|
||||
fread(in, sizeof(short), FRAME_SIZE, fin);
|
||||
if (feof(fin))
|
||||
break;
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
bak[i]=input[i]=in[i];
|
||||
speex_bits_reset(&bits);
|
||||
speex_encode(st, input, &bits);
|
||||
nbBits = speex_bits_write(&bits, cbits, 200);
|
||||
bitCount+=bits.nbBits;
|
||||
printf ("Encoding frame in %d bits\n", nbBits*8);
|
||||
if (argc==4)
|
||||
fwrite(cbits, 1, nbBits, fbits);
|
||||
{
|
||||
float enoise=0, esig=0, snr;
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
{
|
||||
enoise+=(bak2[i]-input[i])*(bak2[i]-input[i]);
|
||||
esig += bak2[i]*bak2[i];
|
||||
}
|
||||
snr = 10*log10((esig+1)/(enoise+1));
|
||||
printf ("real SNR = %f\n", snr);
|
||||
}
|
||||
speex_bits_rewind(&bits);
|
||||
|
||||
speex_decode(dec, &bits, input);
|
||||
|
||||
/* Save the bits here */
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
{
|
||||
if (input[i]>32000)
|
||||
input[i]=32000;
|
||||
else if (input[i]<-32000)
|
||||
input[i]=-32000;
|
||||
}
|
||||
speex_bits_reset(&bits);
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
in[i]=(short)input[i];
|
||||
for (i=0;i<FRAME_SIZE;i++)
|
||||
bak2[i]=bak[i];
|
||||
fwrite(in, sizeof(short), FRAME_SIZE, fout);
|
||||
}
|
||||
|
||||
fprintf (stderr, "Total encoded size: %d bits\n", bitCount);
|
||||
speex_encoder_destroy(st);
|
||||
speex_decoder_destroy(dec);
|
||||
speex_bits_destroy(&bits);
|
||||
fclose(fin);
|
||||
fclose(fout);
|
||||
return 1;
|
||||
}
|
||||
@@ -1,268 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: vbr.c
|
||||
|
||||
VBR-related routines
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include "vbr.h"
|
||||
#include <math.h>
|
||||
|
||||
|
||||
#define sqr(x) ((x)*(x))
|
||||
|
||||
#define MIN_ENERGY 6000
|
||||
#define NOISE_POW .3
|
||||
|
||||
|
||||
float vbr_nb_thresh[9][11]={
|
||||
{-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}, /* CNG */
|
||||
{ 3.5, 2.5, 2.0, 1.2, 0.5, 0.0, -0.5, -0.7, -0.8, -0.9, -1.0}, /* 2 kbps */
|
||||
{10.0, 6.5, 5.2, 4.5, 3.9, 3.5, 3.0, 2.5, 2.3, 1.8, 1.0}, /* 6 kbps */
|
||||
{11.0, 8.8, 7.5, 6.5, 5.0, 3.9, 3.9, 3.9, 3.5, 3.0, 1.0}, /* 8 kbps */
|
||||
{11.0, 11.0, 9.9, 9.0, 8.0, 7.0, 6.5, 6.0, 5.0, 4.0, 2.0}, /* 11 kbps */
|
||||
{11.0, 11.0, 11.0, 11.0, 9.5, 9.0, 8.0, 7.0, 6.5, 5.0, 3.0}, /* 15 kbps */
|
||||
{11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 9.5, 8.5, 8.0, 6.5, 4.0}, /* 18 kbps */
|
||||
{11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 9.8, 7.5, 5.5}, /* 24 kbps */
|
||||
{ 8.0, 5.0, 3.7, 3.0, 2.5, 2.0, 1.8, 1.5, 1.0, 0.0, 0.0} /* 4 kbps */
|
||||
};
|
||||
|
||||
|
||||
float vbr_hb_thresh[5][11]={
|
||||
{-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}, /* silence */
|
||||
{-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}, /* 2 kbps */
|
||||
{11.0, 11.0, 9.5, 8.5, 7.5, 6.0, 5.0, 3.9, 3.0, 2.0, 1.0}, /* 6 kbps */
|
||||
{11.0, 11.0, 11.0, 11.0, 11.0, 9.5, 8.7, 7.8, 7.0, 6.5, 4.0}, /* 10 kbps */
|
||||
{11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 11.0, 9.8, 7.5, 5.5} /* 18 kbps */
|
||||
};
|
||||
|
||||
float vbr_uhb_thresh[2][11]={
|
||||
{-1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}, /* silence */
|
||||
{ 3.9, 2.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.0} /* 2 kbps */
|
||||
};
|
||||
|
||||
void vbr_init(VBRState *vbr)
|
||||
{
|
||||
int i;
|
||||
|
||||
vbr->average_energy=0;
|
||||
vbr->last_energy=1;
|
||||
vbr->accum_sum=0;
|
||||
vbr->energy_alpha=.1;
|
||||
vbr->soft_pitch=0;
|
||||
vbr->last_pitch_coef=0;
|
||||
vbr->last_quality=0;
|
||||
|
||||
vbr->noise_accum = .05*pow(MIN_ENERGY, NOISE_POW);
|
||||
vbr->noise_accum_count=.05;
|
||||
vbr->noise_level=vbr->noise_accum/vbr->noise_accum_count;
|
||||
vbr->consec_noise=0;
|
||||
|
||||
|
||||
for (i=0;i<VBR_MEMORY_SIZE;i++)
|
||||
vbr->last_log_energy[i] = log(MIN_ENERGY);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
This function should analyse the signal and decide how critical the
|
||||
coding error will be perceptually. The following factors should be
|
||||
taken into account:
|
||||
|
||||
-Attacks (positive energy derivative) should be coded with more bits
|
||||
|
||||
-Stationary voiced segments should receive more bits
|
||||
|
||||
-Segments with (very) low absolute energy should receive less bits (maybe
|
||||
only shaped noise?)
|
||||
|
||||
-DTX for near-zero energy?
|
||||
|
||||
-Stationary fricative segments should have less bits
|
||||
|
||||
-Temporal masking: when energy slope is decreasing, decrease the bit-rate
|
||||
|
||||
-Decrease bit-rate for males (low pitch)?
|
||||
|
||||
-(wideband only) less bits in the high-band when signal is very
|
||||
non-stationary (harder to notice high-frequency noise)???
|
||||
|
||||
*/
|
||||
|
||||
float vbr_analysis(VBRState *vbr, float *sig, int len, int pitch, float pitch_coef)
|
||||
{
|
||||
int i;
|
||||
float ener=0, ener1=0, ener2=0;
|
||||
float qual=7;
|
||||
int va;
|
||||
float log_energy;
|
||||
float non_st=0;
|
||||
float voicing;
|
||||
float pow_ener;
|
||||
|
||||
for (i=0;i<len>>1;i++)
|
||||
ener1 += sig[i]*sig[i];
|
||||
|
||||
for (i=len>>1;i<len;i++)
|
||||
ener2 += sig[i]*sig[i];
|
||||
ener=ener1+ener2;
|
||||
|
||||
log_energy = log(ener+MIN_ENERGY);
|
||||
for (i=0;i<VBR_MEMORY_SIZE;i++)
|
||||
non_st += sqr(log_energy-vbr->last_log_energy[i]);
|
||||
non_st = non_st/(30*VBR_MEMORY_SIZE);
|
||||
if (non_st>1)
|
||||
non_st=1;
|
||||
|
||||
voicing = 3*(pitch_coef-.4)*fabs(pitch_coef-.4);
|
||||
vbr->average_energy = (1-vbr->energy_alpha)*vbr->average_energy + vbr->energy_alpha*ener;
|
||||
vbr->noise_level=vbr->noise_accum/vbr->noise_accum_count;
|
||||
pow_ener = pow(ener,NOISE_POW);
|
||||
if (vbr->noise_accum_count<.06 && ener>MIN_ENERGY)
|
||||
vbr->noise_accum = .05*pow_ener;
|
||||
|
||||
if ((voicing<.3 && non_st < .2 && pow_ener < 1.2*vbr->noise_level)
|
||||
|| (voicing<.3 && non_st < .05 && pow_ener < 1.5*vbr->noise_level)
|
||||
|| (voicing<.4 && non_st < .05 && pow_ener < 1.2*vbr->noise_level)
|
||||
|| (voicing<0 && non_st < .05))
|
||||
{
|
||||
float tmp;
|
||||
va = 0;
|
||||
vbr->consec_noise++;
|
||||
if (pow_ener > 3*vbr->noise_level)
|
||||
tmp = 3*vbr->noise_level;
|
||||
else
|
||||
tmp = pow_ener;
|
||||
if (vbr->consec_noise>=4)
|
||||
{
|
||||
vbr->noise_accum = .95*vbr->noise_accum + .05*tmp;
|
||||
vbr->noise_accum_count = .95*vbr->noise_accum_count + .05;
|
||||
}
|
||||
} else {
|
||||
va = 1;
|
||||
vbr->consec_noise=0;
|
||||
}
|
||||
|
||||
if (pow_ener < vbr->noise_level && ener>MIN_ENERGY)
|
||||
{
|
||||
vbr->noise_accum = .95*vbr->noise_accum + .05*pow_ener;
|
||||
vbr->noise_accum_count = .95*vbr->noise_accum_count + .05;
|
||||
}
|
||||
|
||||
/* Checking for very low absolute energy */
|
||||
if (ener < 30000)
|
||||
{
|
||||
qual -= .7;
|
||||
if (ener < 10000)
|
||||
qual-=.7;
|
||||
if (ener < 3000)
|
||||
qual-=.7;
|
||||
} else {
|
||||
float short_diff, long_diff;
|
||||
short_diff = log((ener+1)/(1+vbr->last_energy));
|
||||
long_diff = log((ener+1)/(1+vbr->average_energy));
|
||||
/*fprintf (stderr, "%f %f\n", short_diff, long_diff);*/
|
||||
|
||||
if (long_diff<-5)
|
||||
long_diff=-5;
|
||||
if (long_diff>2)
|
||||
long_diff=2;
|
||||
|
||||
if (long_diff>0)
|
||||
qual += .6*long_diff;
|
||||
if (long_diff<0)
|
||||
qual += .5*long_diff;
|
||||
if (short_diff>0)
|
||||
{
|
||||
if (short_diff>5)
|
||||
short_diff=5;
|
||||
qual += .5*short_diff;
|
||||
}
|
||||
/* Checking for energy increases */
|
||||
if (ener2 > 1.6*ener1)
|
||||
qual += .5;
|
||||
}
|
||||
vbr->last_energy = ener;
|
||||
vbr->soft_pitch = .6*vbr->soft_pitch + .4*pitch_coef;
|
||||
qual += 2.2*((pitch_coef-.4) + (vbr->soft_pitch-.4));
|
||||
|
||||
if (qual < vbr->last_quality)
|
||||
qual = .5*qual + .5*vbr->last_quality;
|
||||
if (qual<4)
|
||||
qual=4;
|
||||
if (qual>10)
|
||||
qual=10;
|
||||
|
||||
/*
|
||||
if (vbr->consec_noise>=2)
|
||||
qual-=1.3;
|
||||
if (vbr->consec_noise>=5)
|
||||
qual-=1.3;
|
||||
if (vbr->consec_noise>=12)
|
||||
qual-=1.3;
|
||||
*/
|
||||
if (vbr->consec_noise>=3)
|
||||
qual=4;
|
||||
|
||||
if (vbr->consec_noise)
|
||||
qual -= 1.0 * (log(3.0 + vbr->consec_noise)-log(3));
|
||||
if (qual<0)
|
||||
qual=0;
|
||||
|
||||
if (ener<60000)
|
||||
{
|
||||
if (vbr->consec_noise>2)
|
||||
qual-=0.5*(log(3.0 + vbr->consec_noise)-log(3));
|
||||
if (ener<10000&&vbr->consec_noise>2)
|
||||
qual-=0.5*(log(3.0 + vbr->consec_noise)-log(3));
|
||||
if (qual<0)
|
||||
qual=0;
|
||||
qual += .3*log(ener/60000.0);
|
||||
}
|
||||
if (qual<-1)
|
||||
qual=-1;
|
||||
|
||||
/*printf ("%f %f %f %f %d\n", qual, voicing, non_st, pow_ener/(.01+vbr->noise_level), va);*/
|
||||
|
||||
vbr->last_pitch_coef = pitch_coef;
|
||||
vbr->last_quality = qual;
|
||||
|
||||
for (i=VBR_MEMORY_SIZE-1;i>0;i--)
|
||||
vbr->last_log_energy[i] = vbr->last_log_energy[i-1];
|
||||
vbr->last_log_energy[0] = log_energy;
|
||||
|
||||
/*printf ("VBR: %f %f %f %d %f\n", (float)(log_energy-log(vbr->average_energy+MIN_ENERGY)), non_st, voicing, va, vbr->noise_level);*/
|
||||
|
||||
return qual;
|
||||
}
|
||||
|
||||
void vbr_destroy(VBRState *vbr)
|
||||
{
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: vbr.h
|
||||
|
||||
VBR-related routines
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef VBR_H
|
||||
#define VBR_H
|
||||
|
||||
#define VBR_MEMORY_SIZE 5
|
||||
|
||||
extern float vbr_nb_thresh[9][11];
|
||||
extern float vbr_hb_thresh[5][11];
|
||||
extern float vbr_uhb_thresh[2][11];
|
||||
|
||||
typedef struct VBRState {
|
||||
float energy_alpha;
|
||||
float average_energy;
|
||||
float last_energy;
|
||||
float last_log_energy[VBR_MEMORY_SIZE];
|
||||
float accum_sum;
|
||||
float last_pitch_coef;
|
||||
float soft_pitch;
|
||||
float last_quality;
|
||||
float noise_level;
|
||||
float noise_accum;
|
||||
float noise_accum_count;
|
||||
int consec_noise;
|
||||
} VBRState;
|
||||
|
||||
void vbr_init(VBRState *vbr);
|
||||
|
||||
float vbr_analysis(VBRState *vbr, float *sig, int len, int pitch, float pitch_coef);
|
||||
|
||||
void vbr_destroy(VBRState *vbr);
|
||||
|
||||
#endif
|
||||
@@ -1,116 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: vq.c
|
||||
Vector quantization
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "vq.h"
|
||||
|
||||
/*Finds the index of the entry in a codebook that best matches the input*/
|
||||
int vq_index(float *in, float *codebook, int len, int entries)
|
||||
{
|
||||
int i,j;
|
||||
float min_dist=0;
|
||||
int best_index=0;
|
||||
for (i=0;i<entries;i++)
|
||||
{
|
||||
float dist=0;
|
||||
for (j=0;j<len;j++)
|
||||
{
|
||||
float tmp = in[j]-*codebook++;
|
||||
dist += tmp*tmp;
|
||||
}
|
||||
if (i==0 || dist<min_dist)
|
||||
{
|
||||
min_dist=dist;
|
||||
best_index=i;
|
||||
}
|
||||
}
|
||||
return best_index;
|
||||
}
|
||||
|
||||
|
||||
/*Finds the indices of the n-best entries in a codebook*/
|
||||
void vq_nbest(float *in, float *codebook, int len, int entries, float *E, int N, int *nbest, float *best_dist)
|
||||
{
|
||||
int i,j,k,used;
|
||||
used = 0;
|
||||
for (i=0;i<entries;i++)
|
||||
{
|
||||
float dist=.5*E[i];
|
||||
for (j=0;j<len;j++)
|
||||
dist -= in[j]**codebook++;
|
||||
if (i<N || dist<best_dist[N-1])
|
||||
{
|
||||
for (k=N-1; (k >= 1) && (k > used || dist < best_dist[k-1]); k--)
|
||||
{
|
||||
best_dist[k]=best_dist[k-1];
|
||||
nbest[k] = nbest[k-1];
|
||||
}
|
||||
best_dist[k]=dist;
|
||||
nbest[k]=i;
|
||||
used++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Finds the indices of the n-best entries in a codebook with sign*/
|
||||
void vq_nbest_sign(float *in, float *codebook, int len, int entries, float *E, int N, int *nbest, float *best_dist)
|
||||
{
|
||||
int i,j,k, sign, used;
|
||||
used=0;
|
||||
for (i=0;i<entries;i++)
|
||||
{
|
||||
float dist=0;
|
||||
for (j=0;j<len;j++)
|
||||
dist -= in[j]**codebook++;
|
||||
if (dist>0)
|
||||
{
|
||||
sign=1;
|
||||
dist=-dist;
|
||||
} else
|
||||
{
|
||||
sign=0;
|
||||
}
|
||||
dist += .5*E[i];
|
||||
if (i<N || dist<best_dist[N-1])
|
||||
{
|
||||
for (k=N-1; (k >= 1) && (k > used || dist < best_dist[k-1]); k--)
|
||||
{
|
||||
best_dist[k]=best_dist[k-1];
|
||||
nbest[k] = nbest[k-1];
|
||||
}
|
||||
best_dist[k]=dist;
|
||||
nbest[k]=i;
|
||||
used++;
|
||||
if (sign)
|
||||
nbest[k]+=entries;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin
|
||||
File: vq.h
|
||||
Vector quantization
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef VQ_H
|
||||
#define VQ_H
|
||||
|
||||
int vq_index(float *in, float *codebook, int len, int entries);
|
||||
|
||||
void vq_nbest(float *in, float *codebook, int len, int entries, float *E, int N, int *nbest, float *best_dist);
|
||||
|
||||
void vq_nbest_sign(float *in, float *codebook, int len, int entries, float *E, int N, int *nbest, float *best_dist);
|
||||
|
||||
#endif
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,198 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
# Copyright (C) 1996, 1997, 2001, 2002 Free Software Foundation, Inc.
|
||||
# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# 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, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.in; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing - GNU libit 0.0"
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aclocal*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acinclude.m4' or \`$configure_ac'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`$configure_ac'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acconfig.h' or \`$configure_ac'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' $configure_ac`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case "$f" in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`$configure_ac'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f y.tab.h ]; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if [ ! -f y.tab.c ]; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f lex.yy.c ]; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||
fi
|
||||
touch $file
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequirements for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -1,40 +0,0 @@
|
||||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
|
||||
|
||||
errstatus=0
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# mkinstalldirs ends here
|
||||
Binary file not shown.
@@ -1,22 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibSpeex", "speex.vcxproj", "{60902B83-8B26-4DBD-B635-4CECF5F4744C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{60902B83-8B26-4DBD-B635-4CECF5F4744C}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{60902B83-8B26-4DBD-B635-4CECF5F4744C}.Debug|x86.Build.0 = Debug|Win32
|
||||
{60902B83-8B26-4DBD-B635-4CECF5F4744C}.Release|x86.ActiveCfg = Release|Win32
|
||||
{60902B83-8B26-4DBD-B635-4CECF5F4744C}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,167 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>LibSpeex</ProjectName>
|
||||
<ProjectGuid>{60902B83-8B26-4DBD-B635-4CECF5F4744C}</ProjectGuid>
|
||||
<RootNamespace>LibSpeex</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>14.0.25431.1</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Configuration)_2015\lib\</OutDir>
|
||||
<IntDir>$(SolutionDir)$(Configuration)_2015\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Configuration)_2015\lib\</OutDir>
|
||||
<IntDir>$(SolutionDir)$(Configuration)_2015\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>../../speex/include;../../speex/win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;M_PI=3.14159265358979323846;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<ExceptionHandling />
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4018;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>win32\libspeex\2015\debug\libspeex.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>../../speex/include;../../speex/win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;M_PI=3.14159265358979323846;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<ExceptionHandling />
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4018;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>win32\libspeex\2015\release\libspeex.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="libspeex\bits.c" />
|
||||
<ClCompile Include="libspeex\cb_search.c" />
|
||||
<ClCompile Include="libspeex\exc_10_16_table.c" />
|
||||
<ClCompile Include="libspeex\exc_10_32_table.c" />
|
||||
<ClCompile Include="libspeex\exc_20_32_table.c" />
|
||||
<ClCompile Include="libspeex\exc_5_256_table.c" />
|
||||
<ClCompile Include="libspeex\exc_5_64_table.c" />
|
||||
<ClCompile Include="libspeex\exc_8_128_table.c" />
|
||||
<ClCompile Include="libspeex\filters.c" />
|
||||
<ClCompile Include="libspeex\gain_table.c" />
|
||||
<ClCompile Include="libspeex\gain_table_lbr.c" />
|
||||
<ClCompile Include="libspeex\hexc_10_32_table.c" />
|
||||
<ClCompile Include="libspeex\hexc_table.c" />
|
||||
<ClCompile Include="libspeex\high_lsp_tables.c" />
|
||||
<ClCompile Include="libspeex\lpc.c" />
|
||||
<ClCompile Include="libspeex\lsp.c" />
|
||||
<ClCompile Include="libspeex\lsp_tables_nb.c" />
|
||||
<ClCompile Include="libspeex\ltp.c" />
|
||||
<ClCompile Include="libspeex\math_approx.c" />
|
||||
<ClCompile Include="libspeex\misc.c" />
|
||||
<ClCompile Include="libspeex\modes.c" />
|
||||
<ClCompile Include="libspeex\nb_celp.c" />
|
||||
<ClCompile Include="libspeex\quant_lsp.c" />
|
||||
<ClCompile Include="libspeex\sb_celp.c" />
|
||||
<ClCompile Include="libspeex\speex_callbacks.c" />
|
||||
<ClCompile Include="libspeex\speex_header.c" />
|
||||
<ClCompile Include="libspeex\stereo.c" />
|
||||
<ClCompile Include="libspeex\testenc.c" />
|
||||
<ClCompile Include="libspeex\testenc_uwb.c" />
|
||||
<ClCompile Include="libspeex\testenc_wb.c" />
|
||||
<ClCompile Include="libspeex\vbr.c" />
|
||||
<ClCompile Include="libspeex\vq.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="libspeex\cb_search.h" />
|
||||
<ClInclude Include="libspeex\cb_search_sse.h" />
|
||||
<ClInclude Include="libspeex\fftwrap.h" />
|
||||
<ClInclude Include="libspeex\filterbank.h" />
|
||||
<ClInclude Include="libspeex\filters.h" />
|
||||
<ClInclude Include="libspeex\filters_sse.h" />
|
||||
<ClInclude Include="libspeex\fixed_bfin.h" />
|
||||
<ClInclude Include="libspeex\fixed_debug.h" />
|
||||
<ClInclude Include="libspeex\fixed_generic.h" />
|
||||
<ClInclude Include="libspeex\kiss_fft.h" />
|
||||
<ClInclude Include="libspeex\kiss_fftr.h" />
|
||||
<ClInclude Include="libspeex\lpc.h" />
|
||||
<ClInclude Include="libspeex\lsp.h" />
|
||||
<ClInclude Include="libspeex\ltp.h" />
|
||||
<ClInclude Include="libspeex\ltp_sse.h" />
|
||||
<ClInclude Include="libspeex\math_approx.h" />
|
||||
<ClInclude Include="libspeex\modes.h" />
|
||||
<ClInclude Include="libspeex\nb_celp.h" />
|
||||
<ClInclude Include="libspeex\os_support.h" />
|
||||
<ClInclude Include="libspeex\pseudofloat.h" />
|
||||
<ClInclude Include="libspeex\quant_lsp.h" />
|
||||
<ClInclude Include="libspeex\resample_sse.h" />
|
||||
<ClInclude Include="libspeex\sb_celp.h" />
|
||||
<ClInclude Include="libspeex\smallft.h" />
|
||||
<ClInclude Include="libspeex\stack_alloc.h" />
|
||||
<ClInclude Include="libspeex\vbr.h" />
|
||||
<ClInclude Include="libspeex\vorbis_psy.h" />
|
||||
<ClInclude Include="libspeex\vq.h" />
|
||||
<ClInclude Include="libspeex\vq_sse.h" />
|
||||
<ClInclude Include="win32\config.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+141
-47
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin*/
|
||||
/* Copyright (C) 2002-2006 Jean-Marc Valin*/
|
||||
/**
|
||||
@file speex.h
|
||||
@brief Describes the different modes of the codec
|
||||
@@ -7,18 +7,18 @@
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
@@ -35,7 +35,12 @@
|
||||
|
||||
#ifndef SPEEX_H
|
||||
#define SPEEX_H
|
||||
/** @defgroup Codec Speex encoder and decoder
|
||||
* This is the Speex codec itself.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "speex_types.h"
|
||||
#include "speex_bits.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -56,7 +61,7 @@ extern "C" {
|
||||
/** Set quality value */
|
||||
#define SPEEX_SET_QUALITY 4
|
||||
/** Get current quality setting */
|
||||
#define SPEEX_GET_QUALITY 5
|
||||
/* #define SPEEX_GET_QUALITY 5 -- Doesn't make much sense, does it? */
|
||||
|
||||
/** Set sub-mode to use */
|
||||
#define SPEEX_SET_MODE 6
|
||||
@@ -93,10 +98,10 @@ extern "C" {
|
||||
/** Get current bit-rate used by the encoder or decoder */
|
||||
#define SPEEX_GET_BITRATE 19
|
||||
|
||||
/**Define a handler function for in-band Speex request*/
|
||||
/** Define a handler function for in-band Speex request*/
|
||||
#define SPEEX_SET_HANDLER 20
|
||||
|
||||
/**Define a handler function for in-band user-defined request*/
|
||||
/** Define a handler function for in-band user-defined request*/
|
||||
#define SPEEX_SET_USER_HANDLER 22
|
||||
|
||||
/** Set sampling rate used in bit-rate computation */
|
||||
@@ -126,16 +131,34 @@ extern "C" {
|
||||
/** Get DTX status (1 for on, 0 for off) */
|
||||
#define SPEEX_GET_DTX 35
|
||||
|
||||
/** Set submode encoding in each frame (1 for yes, 0 for no, setting to no breaks the standard) */
|
||||
#define SPEEX_SET_SUBMODE_ENCODING 36
|
||||
/** Get submode encoding in each frame */
|
||||
#define SPEEX_GET_SUBMODE_ENCODING 37
|
||||
|
||||
/* Used internally, not to be used in applications */
|
||||
/** Used internally*/
|
||||
#define SPEEX_GET_PI_GAIN 100
|
||||
/** Used internally*/
|
||||
#define SPEEX_GET_EXC 101
|
||||
/** Used internally*/
|
||||
#define SPEEX_GET_INNOV 102
|
||||
/** Used internally*/
|
||||
#define SPEEX_GET_DTX_STATUS 103
|
||||
/*#define SPEEX_SET_LOOKAHEAD 38*/
|
||||
/** Returns the lookahead used by Speex separately for an encoder and a decoder.
|
||||
* Sum encoder and decoder lookahead values to get the total codec lookahead. */
|
||||
#define SPEEX_GET_LOOKAHEAD 39
|
||||
|
||||
/** Sets tuning for packet-loss concealment (expected loss rate) */
|
||||
#define SPEEX_SET_PLC_TUNING 40
|
||||
/** Gets tuning for PLC */
|
||||
#define SPEEX_GET_PLC_TUNING 41
|
||||
|
||||
/** Sets the max bit-rate allowed in VBR mode */
|
||||
#define SPEEX_SET_VBR_MAX_BITRATE 42
|
||||
/** Gets the max bit-rate allowed in VBR mode */
|
||||
#define SPEEX_GET_VBR_MAX_BITRATE 43
|
||||
|
||||
/** Turn on/off input/output high-pass filtering */
|
||||
#define SPEEX_SET_HIGHPASS 44
|
||||
/** Get status of input/output high-pass filtering */
|
||||
#define SPEEX_GET_HIGHPASS 45
|
||||
|
||||
/** Get "activity level" of the last decoded frame, i.e.
|
||||
how much damage we cause if we remove the frame */
|
||||
#define SPEEX_GET_ACTIVITY 47
|
||||
|
||||
|
||||
/* Preserving compatibility:*/
|
||||
@@ -145,6 +168,8 @@ extern "C" {
|
||||
#define SPEEX_GET_PF 1
|
||||
|
||||
|
||||
|
||||
|
||||
/* Values allowed for mode queries */
|
||||
/** Query the frame size of a mode */
|
||||
#define SPEEX_MODE_FRAME_SIZE 0
|
||||
@@ -153,52 +178,84 @@ extern "C" {
|
||||
#define SPEEX_SUBMODE_BITS_PER_FRAME 1
|
||||
|
||||
|
||||
|
||||
/** Get major Speex version */
|
||||
#define SPEEX_LIB_GET_MAJOR_VERSION 1
|
||||
/** Get minor Speex version */
|
||||
#define SPEEX_LIB_GET_MINOR_VERSION 3
|
||||
/** Get micro Speex version */
|
||||
#define SPEEX_LIB_GET_MICRO_VERSION 5
|
||||
/** Get extra Speex version */
|
||||
#define SPEEX_LIB_GET_EXTRA_VERSION 7
|
||||
/** Get Speex version string */
|
||||
#define SPEEX_LIB_GET_VERSION_STRING 9
|
||||
|
||||
/*#define SPEEX_LIB_SET_ALLOC_FUNC 10
|
||||
#define SPEEX_LIB_GET_ALLOC_FUNC 11
|
||||
#define SPEEX_LIB_SET_FREE_FUNC 12
|
||||
#define SPEEX_LIB_GET_FREE_FUNC 13
|
||||
|
||||
#define SPEEX_LIB_SET_WARNING_FUNC 14
|
||||
#define SPEEX_LIB_GET_WARNING_FUNC 15
|
||||
#define SPEEX_LIB_SET_ERROR_FUNC 16
|
||||
#define SPEEX_LIB_GET_ERROR_FUNC 17
|
||||
*/
|
||||
|
||||
/** Number of defined modes in Speex */
|
||||
#define SPEEX_NB_MODES 3
|
||||
|
||||
/** modeID for the defined narrowband mode */
|
||||
#define SPEEX_MODEID_NB 0
|
||||
|
||||
/** modeID for the defined wideband mode */
|
||||
#define SPEEX_MODEID_WB 1
|
||||
|
||||
/** modeID for the defined ultra-wideband mode */
|
||||
#define SPEEX_MODEID_UWB 2
|
||||
|
||||
struct SpeexMode;
|
||||
|
||||
|
||||
/* Prototypes for mode function pointers */
|
||||
|
||||
/** Encoder state initialization function */
|
||||
typedef void *(*encoder_init_func)(struct SpeexMode *mode);
|
||||
typedef void *(*encoder_init_func)(const struct SpeexMode *mode);
|
||||
|
||||
/** Encoder state destruction function */
|
||||
typedef void (*encoder_destroy_func)(void *st);
|
||||
|
||||
/** Main encoding function */
|
||||
typedef int (*encode_func)(void *state, float *in, SpeexBits *bits);
|
||||
typedef int (*encode_func)(void *state, void *in, SpeexBits *bits);
|
||||
|
||||
/** Function for controlling the encoder options */
|
||||
typedef int (*encoder_ctl_func)(void *state, int request, void *ptr);
|
||||
|
||||
/** Decoder state initialization function */
|
||||
typedef void *(*decoder_init_func)(struct SpeexMode *mode);
|
||||
typedef void *(*decoder_init_func)(const struct SpeexMode *mode);
|
||||
|
||||
/** Decoder state destruction function */
|
||||
typedef void (*decoder_destroy_func)(void *st);
|
||||
|
||||
/** Main decoding function */
|
||||
typedef int (*decode_func)(void *state, SpeexBits *bits, float *out);
|
||||
typedef int (*decode_func)(void *state, SpeexBits *bits, void *out);
|
||||
|
||||
/** Function for controlling the decoder options */
|
||||
typedef int (*decoder_ctl_func)(void *state, int request, void *ptr);
|
||||
|
||||
|
||||
/** Query function for a mode */
|
||||
typedef int (*mode_query_func)(void *mode, int request, void *ptr);
|
||||
typedef int (*mode_query_func)(const void *mode, int request, void *ptr);
|
||||
|
||||
/** Struct defining a Speex mode */
|
||||
/** Struct defining a Speex mode */
|
||||
typedef struct SpeexMode {
|
||||
/** Pointer to the low-level mode data */
|
||||
void *mode;
|
||||
const void *mode;
|
||||
|
||||
/** Pointer to the mode query function */
|
||||
mode_query_func query;
|
||||
|
||||
|
||||
/** The name of the mode (you should not rely on this to identify the mode)*/
|
||||
char *modeName;
|
||||
const char *modeName;
|
||||
|
||||
/**ID of the mode*/
|
||||
int modeID;
|
||||
@@ -234,47 +291,59 @@ typedef struct SpeexMode {
|
||||
} SpeexMode;
|
||||
|
||||
/**
|
||||
* Returns a handle to a newly created Speex encoder state structure. For now,
|
||||
* the "mode" argument can be &nb_mode or &wb_mode . In the future, more modes
|
||||
* may be added. Note that for now if you have more than one channels to
|
||||
* Returns a handle to a newly created Speex encoder state structure. For now,
|
||||
* the "mode" argument can be &nb_mode or &wb_mode . In the future, more modes
|
||||
* may be added. Note that for now if you have more than one channels to
|
||||
* encode, you need one state per channel.
|
||||
*
|
||||
* @param mode The mode to use (either speex_nb_mode or speex_wb.mode)
|
||||
* @return A newly created encoder
|
||||
* @param mode The mode to use (either speex_nb_mode or speex_wb.mode)
|
||||
* @return A newly created encoder state or NULL if state allocation fails
|
||||
*/
|
||||
void *speex_encoder_init(SpeexMode *mode);
|
||||
void *speex_encoder_init(const SpeexMode *mode);
|
||||
|
||||
/** Frees all resources associated to an existing Speex encoder state.
|
||||
/** Frees all resources associated to an existing Speex encoder state.
|
||||
* @param state Encoder state to be destroyed */
|
||||
void speex_encoder_destroy(void *state);
|
||||
|
||||
/** Uses an existing encoder state to encode one frame of speech pointed to by
|
||||
"in". The encoded bit-stream is saved in "bits".
|
||||
@param state Encoder state
|
||||
@param in Frame that will be encoded with a +-2^16 range
|
||||
@param in Frame that will be encoded with a +-2^15 range. This data MAY be
|
||||
overwritten by the encoder and should be considered uninitialised
|
||||
after the call.
|
||||
@param bits Bit-stream where the data will be written
|
||||
@return 0 if frame needs not be transmitted (DTX only), 1 otherwise
|
||||
*/
|
||||
int speex_encode(void *state, float *in, SpeexBits *bits);
|
||||
|
||||
/** Uses an existing encoder state to encode one frame of speech pointed to by
|
||||
"in". The encoded bit-stream is saved in "bits".
|
||||
@param state Encoder state
|
||||
@param in Frame that will be encoded with a +-2^15 range
|
||||
@param bits Bit-stream where the data will be written
|
||||
@return 0 if frame needs not be transmitted (DTX only), 1 otherwise
|
||||
*/
|
||||
int speex_encode_int(void *state, spx_int16_t *in, SpeexBits *bits);
|
||||
|
||||
/** Used like the ioctl function to control the encoder parameters
|
||||
*
|
||||
* @param state Encoder state
|
||||
* @param request ioctl-type request (one of the SPEEX_* macros)
|
||||
* @param ptr Data exchanged to-from function
|
||||
* @return 0 if frame needs not be transmitted (DTX only), 1 otherwise
|
||||
* @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
|
||||
*/
|
||||
int speex_encoder_ctl(void *state, int request, void *ptr);
|
||||
|
||||
|
||||
/** Returns a handle to a newly created decoder state structure. For now,
|
||||
/** Returns a handle to a newly created decoder state structure. For now,
|
||||
* the mode argument can be &nb_mode or &wb_mode . In the future, more modes
|
||||
* may be added. Note that for now if you have more than one channels to
|
||||
* decode, you need one state per channel.
|
||||
*
|
||||
* @param mode Speex mode (one of speex_nb_mode or speex_wb_mode)
|
||||
* @return A newly created decoder state
|
||||
*/
|
||||
void *speex_decoder_init(SpeexMode *mode);
|
||||
* @return A newly created decoder state or NULL if state allocation fails
|
||||
*/
|
||||
void *speex_decoder_init(const SpeexMode *mode);
|
||||
|
||||
/** Frees all resources associated to an existing decoder state.
|
||||
*
|
||||
@@ -288,16 +357,26 @@ void speex_decoder_destroy(void *state);
|
||||
* @param state Decoder state
|
||||
* @param bits Bit-stream from which to decode the frame (NULL if the packet was lost)
|
||||
* @param out Where to write the decoded frame
|
||||
* @return return status (0 for no error, -1 for end of stream, -2 other)
|
||||
* @return return status (0 for no error, -1 for end of stream, -2 corrupt stream)
|
||||
*/
|
||||
int speex_decode(void *state, SpeexBits *bits, float *out);
|
||||
|
||||
/** Uses an existing decoder state to decode one frame of speech from
|
||||
* bit-stream bits. The output speech is saved written to out.
|
||||
*
|
||||
* @param state Decoder state
|
||||
* @param bits Bit-stream from which to decode the frame (NULL if the packet was lost)
|
||||
* @param out Where to write the decoded frame
|
||||
* @return return status (0 for no error, -1 for end of stream, -2 corrupt stream)
|
||||
*/
|
||||
int speex_decode_int(void *state, SpeexBits *bits, spx_int16_t *out);
|
||||
|
||||
/** Used like the ioctl function to control the encoder parameters
|
||||
*
|
||||
* @param state Decoder state
|
||||
* @param request ioctl-type request (one of the SPEEX_* macros)
|
||||
* @param ptr Data exchanged to-from function
|
||||
* @return 0 for no error, 1 if a terminator is reached, 2 for another error
|
||||
* @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
|
||||
*/
|
||||
int speex_decoder_ctl(void *state, int request, void *ptr);
|
||||
|
||||
@@ -307,25 +386,40 @@ int speex_decoder_ctl(void *state, int request, void *ptr);
|
||||
* @param mode Speex mode
|
||||
* @param request ioctl-type request (one of the SPEEX_* macros)
|
||||
* @param ptr Data exchanged to-from function
|
||||
* @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
|
||||
*/
|
||||
int speex_mode_query(SpeexMode *mode, int request, void *ptr);
|
||||
int speex_mode_query(const SpeexMode *mode, int request, void *ptr);
|
||||
|
||||
/** Functions for controlling the behavior of libspeex
|
||||
* @param request ioctl-type request (one of the SPEEX_LIB_* macros)
|
||||
* @param ptr Data exchanged to-from function
|
||||
* @return 0 if no error, -1 if request in unknown, -2 for invalid parameter
|
||||
*/
|
||||
int speex_lib_ctl(int request, void *ptr);
|
||||
|
||||
/** Default narrowband mode */
|
||||
extern SpeexMode speex_nb_mode;
|
||||
extern const SpeexMode speex_nb_mode;
|
||||
|
||||
/** Default wideband mode */
|
||||
extern SpeexMode speex_wb_mode;
|
||||
extern const SpeexMode speex_wb_mode;
|
||||
|
||||
/** Default "ultra-wideband" mode */
|
||||
extern SpeexMode speex_uwb_mode;
|
||||
extern const SpeexMode speex_uwb_mode;
|
||||
|
||||
/** List of all modes available */
|
||||
extern SpeexMode *speex_mode_list[SPEEX_NB_MODES];
|
||||
extern const SpeexMode * const speex_mode_list[SPEEX_NB_MODES];
|
||||
|
||||
/** Obtain one of the modes available */
|
||||
const SpeexMode * speex_lib_get_mode (int mode);
|
||||
|
||||
#ifndef WIN32
|
||||
/* We actually override the function in the narrowband case so that we can avoid linking in the wideband stuff */
|
||||
#define speex_lib_get_mode(mode) ((mode)==SPEEX_MODEID_NB ? &speex_nb_mode : speex_lib_get_mode (mode))
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/** @}*/
|
||||
#endif
|
||||
+40
-20
@@ -7,18 +7,18 @@
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
@@ -35,21 +35,23 @@
|
||||
|
||||
#ifndef BITS_H
|
||||
#define BITS_H
|
||||
/** @defgroup SpeexBits SpeexBits: Bit-stream manipulations
|
||||
* This is the structure that holds the bit-stream when encoding or decoding
|
||||
* with Speex. It allows some manipulations as well.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Maximum size of the bit-stream (for fixed-size allocation) */
|
||||
#define MAX_BYTES_PER_FRAME 2000
|
||||
|
||||
/** Bit-packing data structure representing (part of) a bit-stream. */
|
||||
typedef struct SpeexBits {
|
||||
char *bytes; /**< "raw" data */
|
||||
char *chars; /**< "raw" data */
|
||||
int nbBits; /**< Total number of bits stored in the stream*/
|
||||
int bytePtr; /**< Position of the byte "cursor" */
|
||||
int bitPtr; /**< Position of the bit "cursor" within the current byte */
|
||||
int owner; /**< Does the struct "own" the "raw" buffer (member "bytes") */
|
||||
int charPtr; /**< Position of the byte "cursor" */
|
||||
int bitPtr; /**< Position of the bit "cursor" within the current char */
|
||||
int owner; /**< Does the struct "own" the "raw" buffer (member "chars") */
|
||||
int overflow;/**< Set to one if we try to read past the valid data */
|
||||
int buf_size;/**< Allocated size for buffer */
|
||||
int reserved1; /**< Reserved for future use */
|
||||
@@ -62,6 +64,9 @@ void speex_bits_init(SpeexBits *bits);
|
||||
/** Initializes SpeexBits struct using a pre-allocated buffer*/
|
||||
void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size);
|
||||
|
||||
/** Sets the bits in a SpeexBits struct to use data from an existing buffer (for decoding without copying data) */
|
||||
void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size);
|
||||
|
||||
/** Frees all resources associated to a SpeexBits struct. Right now this does nothing since no resources are allocated, but this could change in the future.*/
|
||||
void speex_bits_destroy(SpeexBits *bits);
|
||||
|
||||
@@ -72,16 +77,23 @@ void speex_bits_reset(SpeexBits *bits);
|
||||
void speex_bits_rewind(SpeexBits *bits);
|
||||
|
||||
/** Initializes the bit-stream from the data in an area of memory */
|
||||
void speex_bits_read_from(SpeexBits *bits, char *bytes, int len);
|
||||
void speex_bits_read_from(SpeexBits *bits, const char *bytes, int len);
|
||||
|
||||
/** Append bytes to the bit-stream
|
||||
*
|
||||
* @param bits Bit-stream to operate on
|
||||
* @param bytes pointer to the bytes what will be appended
|
||||
* @param len Number of bytes of append
|
||||
*/
|
||||
void speex_bits_read_whole_bytes(SpeexBits *bits, char *bytes, int len);
|
||||
void speex_bits_read_whole_bytes(SpeexBits *bits, const char *bytes, int len);
|
||||
|
||||
/** Write the content of a bit-stream to an area of memory */
|
||||
/** Write the content of a bit-stream to an area of memory
|
||||
*
|
||||
* @param bits Bit-stream to operate on
|
||||
* @param bytes Memory location where to write the bits
|
||||
* @param max_len Maximum number of bytes to write (i.e. size of the "bytes" buffer)
|
||||
* @return Number of bytes written to the "bytes" buffer
|
||||
*/
|
||||
int speex_bits_write(SpeexBits *bits, char *bytes, int max_len);
|
||||
|
||||
/** Like speex_bits_write, but writes only the complete bytes in the stream. Also removes the written bytes from the stream */
|
||||
@@ -117,17 +129,23 @@ unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits);
|
||||
*/
|
||||
int speex_bits_nbytes(SpeexBits *bits);
|
||||
|
||||
/** Same as speex_bits_unpack_unsigned, but without modifying the cursor position */
|
||||
/** Same as speex_bits_unpack_unsigned, but without modifying the cursor position
|
||||
*
|
||||
* @param bits Bit-stream to operate on
|
||||
* @param nbBits Number of bits to look for
|
||||
* @return Value of the bits peeked, interpreted as unsigned
|
||||
*/
|
||||
unsigned int speex_bits_peek_unsigned(SpeexBits *bits, int nbBits);
|
||||
|
||||
/** Get the value of the next bit in the stream, without modifying the
|
||||
* "cursor" position
|
||||
*
|
||||
* "cursor" position
|
||||
*
|
||||
* @param bits Bit-stream to operate on
|
||||
* @return Value of the bit peeked (one bit only)
|
||||
*/
|
||||
int speex_bits_peek(SpeexBits *bits);
|
||||
|
||||
/** Advances the position of the "bit cursor" in the stream
|
||||
/** Advances the position of the "bit cursor" in the stream
|
||||
*
|
||||
* @param bits Bit-stream to operate on
|
||||
* @param n Number of bits to advance
|
||||
@@ -137,11 +155,12 @@ void speex_bits_advance(SpeexBits *bits, int n);
|
||||
/** Returns the number of bits remaining to be read in a stream
|
||||
*
|
||||
* @param bits Bit-stream to operate on
|
||||
* @return Number of bits that can still be read from the stream
|
||||
*/
|
||||
int speex_bits_remaining(SpeexBits *bits);
|
||||
|
||||
/** Insert a terminator so that the data can be sent as a packet while auto-detecting
|
||||
* the number of frames in each packet
|
||||
/** Insert a terminator so that the data can be sent as a packet while auto-detecting
|
||||
* the number of frames in each packet
|
||||
*
|
||||
* @param bits Bit-stream to operate on
|
||||
*/
|
||||
@@ -151,4 +170,5 @@ void speex_bits_insert_terminator(SpeexBits *bits);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* @} */
|
||||
#endif
|
||||
+12
-6
@@ -7,18 +7,18 @@
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
@@ -35,6 +35,9 @@
|
||||
|
||||
#ifndef SPEEX_CALLBACKS_H
|
||||
#define SPEEX_CALLBACKS_H
|
||||
/** @defgroup SpeexCallbacks Various definitions for Speex callbacks supported by the decoder.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "speex.h"
|
||||
|
||||
@@ -110,13 +113,16 @@ int speex_default_user_handler(SpeexBits *bits, void *state, void *data);
|
||||
|
||||
|
||||
|
||||
|
||||
/** Standard handler for low mode request (change low mode, no questions asked) */
|
||||
int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data);
|
||||
|
||||
/** Standard handler for VBR request (Set VBR, no questions asked) */
|
||||
int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data);
|
||||
|
||||
/** Standard handler for enhancer request (Turn enhancer on/off, no questions asked) */
|
||||
int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data);
|
||||
|
||||
/** Standard handler for VBR quality request (Set VBR quality, no questions asked) */
|
||||
int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data);
|
||||
|
||||
|
||||
@@ -124,5 +130,5 @@ int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *da
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef __SPEEX_TYPES_H__
|
||||
#define __SPEEX_TYPES_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int16_t spx_int16_t;
|
||||
typedef uint16_t spx_uint16_t;
|
||||
typedef int32_t spx_int32_t;
|
||||
typedef uint32_t spx_uint32_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
/* Copyright (C) Jean-Marc Valin */
|
||||
/**
|
||||
@file speex_echo.h
|
||||
@brief Echo cancellation
|
||||
*/
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef SPEEX_ECHO_H
|
||||
#define SPEEX_ECHO_H
|
||||
/** @defgroup SpeexEchoState SpeexEchoState: Acoustic echo canceller
|
||||
* This is the acoustic echo canceller module.
|
||||
* @{
|
||||
*/
|
||||
#include "speexdsp_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Obtain frame size used by the AEC */
|
||||
#define SPEEX_ECHO_GET_FRAME_SIZE 3
|
||||
|
||||
/** Set sampling rate */
|
||||
#define SPEEX_ECHO_SET_SAMPLING_RATE 24
|
||||
/** Get sampling rate */
|
||||
#define SPEEX_ECHO_GET_SAMPLING_RATE 25
|
||||
|
||||
/* Can't set window sizes */
|
||||
/** Get size of impulse response (int32) */
|
||||
#define SPEEX_ECHO_GET_IMPULSE_RESPONSE_SIZE 27
|
||||
|
||||
/* Can't set window content */
|
||||
/** Get impulse response (int32[]) */
|
||||
#define SPEEX_ECHO_GET_IMPULSE_RESPONSE 29
|
||||
|
||||
/** Internal echo canceller state. Should never be accessed directly. */
|
||||
struct SpeexEchoState_;
|
||||
|
||||
/** @class SpeexEchoState
|
||||
* This holds the state of the echo canceller. You need one per channel.
|
||||
*/
|
||||
|
||||
/** Internal echo canceller state. Should never be accessed directly. */
|
||||
typedef struct SpeexEchoState_ SpeexEchoState;
|
||||
|
||||
/** Creates a new echo canceller state
|
||||
* @param frame_size Number of samples to process at one time (should correspond to 10-20 ms)
|
||||
* @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms)
|
||||
* @return Newly-created echo canceller state
|
||||
*/
|
||||
SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length);
|
||||
|
||||
/** Creates a new multi-channel echo canceller state
|
||||
* @param frame_size Number of samples to process at one time (should correspond to 10-20 ms)
|
||||
* @param filter_length Number of samples of echo to cancel (should generally correspond to 100-500 ms)
|
||||
* @param nb_mic Number of microphone channels
|
||||
* @param nb_speakers Number of speaker channels
|
||||
* @return Newly-created echo canceller state
|
||||
*/
|
||||
SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers);
|
||||
|
||||
/** Destroys an echo canceller state
|
||||
* @param st Echo canceller state
|
||||
*/
|
||||
void speex_echo_state_destroy(SpeexEchoState *st);
|
||||
|
||||
/** Performs echo cancellation a frame, based on the audio sent to the speaker (no delay is added
|
||||
* to playback in this form)
|
||||
*
|
||||
* @param st Echo canceller state
|
||||
* @param rec Signal from the microphone (near end + far end echo)
|
||||
* @param play Signal played to the speaker (received from far end)
|
||||
* @param out Returns near-end signal with echo removed
|
||||
*/
|
||||
void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out);
|
||||
|
||||
/** Performs echo cancellation a frame (deprecated) */
|
||||
void speex_echo_cancel(SpeexEchoState *st, const spx_int16_t *rec, const spx_int16_t *play, spx_int16_t *out, spx_int32_t *Yout);
|
||||
|
||||
/** Perform echo cancellation using internal playback buffer, which is delayed by two frames
|
||||
* to account for the delay introduced by most soundcards (but it could be off!)
|
||||
* @param st Echo canceller state
|
||||
* @param rec Signal from the microphone (near end + far end echo)
|
||||
* @param out Returns near-end signal with echo removed
|
||||
*/
|
||||
void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t *out);
|
||||
|
||||
/** Let the echo canceller know that a frame was just queued to the soundcard
|
||||
* @param st Echo canceller state
|
||||
* @param play Signal played to the speaker (received from far end)
|
||||
*/
|
||||
void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play);
|
||||
|
||||
/** Reset the echo canceller to its original state
|
||||
* @param st Echo canceller state
|
||||
*/
|
||||
void speex_echo_state_reset(SpeexEchoState *st);
|
||||
|
||||
/** Used like the ioctl function to control the echo canceller parameters
|
||||
*
|
||||
* @param st Echo canceller state
|
||||
* @param request ioctl-type request (one of the SPEEX_ECHO_* macros)
|
||||
* @param ptr Data exchanged to-from function
|
||||
* @return 0 if no error, -1 if request in unknown
|
||||
*/
|
||||
int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr);
|
||||
|
||||
|
||||
|
||||
struct SpeexDecorrState_;
|
||||
|
||||
typedef struct SpeexDecorrState_ SpeexDecorrState;
|
||||
|
||||
|
||||
/** Create a state for the channel decorrelation algorithm
|
||||
This is useful for multi-channel echo cancellation only
|
||||
* @param rate Sampling rate
|
||||
* @param channels Number of channels (it's a bit pointless if you don't have at least 2)
|
||||
* @param frame_size Size of the frame to process at ones (counting samples *per* channel)
|
||||
*/
|
||||
SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame_size);
|
||||
|
||||
/** Remove correlation between the channels by modifying the phase and possibly
|
||||
adding noise in a way that is not (or little) perceptible.
|
||||
* @param st Decorrelator state
|
||||
* @param in Input audio in interleaved format
|
||||
* @param out Result of the decorrelation (out *may* alias in)
|
||||
* @param strength How much alteration of the audio to apply from 0 to 100.
|
||||
*/
|
||||
void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int strength);
|
||||
|
||||
/** Destroy a Decorrelation state
|
||||
* @param st State to destroy
|
||||
*/
|
||||
void speex_decorrelate_destroy(SpeexDecorrState *st);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/** @}*/
|
||||
#endif
|
||||
+32
-20
@@ -7,18 +7,18 @@
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
@@ -36,6 +36,12 @@
|
||||
|
||||
#ifndef SPEEX_HEADER_H
|
||||
#define SPEEX_HEADER_H
|
||||
/** @defgroup SpeexHeader SpeexHeader: Makes it easy to write/parse an Ogg/Speex header
|
||||
* This is the Speex header for the Ogg encapsulation. You don't need that if you just use RTP.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "speex_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -43,30 +49,33 @@ extern "C" {
|
||||
|
||||
struct SpeexMode;
|
||||
|
||||
/** Length of the Speex header identifier */
|
||||
#define SPEEX_HEADER_STRING_LENGTH 8
|
||||
|
||||
/** Maximum number of characters for encoding the Speex version number in the header */
|
||||
#define SPEEX_HEADER_VERSION_LENGTH 20
|
||||
|
||||
/** Speex header info for file-based formats */
|
||||
typedef struct SpeexHeader {
|
||||
char speex_string[8]; /**< Identifies a Speex bit-stream, always set to "Speex " */
|
||||
char speex_string[SPEEX_HEADER_STRING_LENGTH]; /**< Identifies a Speex bit-stream, always set to "Speex " */
|
||||
char speex_version[SPEEX_HEADER_VERSION_LENGTH]; /**< Speex version */
|
||||
int speex_version_id; /**< Version for Speex (for checking compatibility) */
|
||||
int header_size; /**< Total size of the header ( sizeof(SpeexHeader) ) */
|
||||
int rate; /**< Sampling rate used */
|
||||
int mode; /**< Mode used (0 for narrowband, 1 for wideband) */
|
||||
int mode_bitstream_version; /**< Version ID of the bit-stream */
|
||||
int nb_channels; /**< Number of channels encoded */
|
||||
int bitrate; /**< Bit-rate used */
|
||||
int frame_size; /**< Size of frames */
|
||||
int vbr; /**< 1 for a VBR encoding, 0 otherwise */
|
||||
int frames_per_packet; /**< Number of frames stored per Ogg packet */
|
||||
int extra_headers; /**< Number of additional headers after the comments */
|
||||
int reserved1; /**< Reserved for future use, must be zero */
|
||||
int reserved2; /**< Reserved for future use, must be zero */
|
||||
spx_int32_t speex_version_id; /**< Version for Speex (for checking compatibility) */
|
||||
spx_int32_t header_size; /**< Total size of the header ( sizeof(SpeexHeader) ) */
|
||||
spx_int32_t rate; /**< Sampling rate used */
|
||||
spx_int32_t mode; /**< Mode used (0 for narrowband, 1 for wideband) */
|
||||
spx_int32_t mode_bitstream_version; /**< Version ID of the bit-stream */
|
||||
spx_int32_t nb_channels; /**< Number of channels encoded */
|
||||
spx_int32_t bitrate; /**< Bit-rate used */
|
||||
spx_int32_t frame_size; /**< Size of frames */
|
||||
spx_int32_t vbr; /**< 1 for a VBR encoding, 0 otherwise */
|
||||
spx_int32_t frames_per_packet; /**< Number of frames stored per Ogg packet */
|
||||
spx_int32_t extra_headers; /**< Number of additional headers after the comments */
|
||||
spx_int32_t reserved1; /**< Reserved for future use, must be zero */
|
||||
spx_int32_t reserved2; /**< Reserved for future use, must be zero */
|
||||
} SpeexHeader;
|
||||
|
||||
/** Initializes a SpeexHeader using basic information */
|
||||
void speex_init_header(SpeexHeader *header, int rate, int nb_channels, struct SpeexMode *m);
|
||||
void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const struct SpeexMode *m);
|
||||
|
||||
/** Creates the header packet from the header itself (mostly involves endianness conversion) */
|
||||
char *speex_header_to_packet(SpeexHeader *header, int *size);
|
||||
@@ -74,9 +83,12 @@ char *speex_header_to_packet(SpeexHeader *header, int *size);
|
||||
/** Creates a SpeexHeader from a packet */
|
||||
SpeexHeader *speex_packet_to_header(char *packet, int size);
|
||||
|
||||
/** Frees the memory allocated by either speex_header_to_packet() or speex_packet_to_header() */
|
||||
void speex_header_free(void *ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
@@ -0,0 +1,197 @@
|
||||
/* Copyright (C) 2002 Jean-Marc Valin */
|
||||
/**
|
||||
@file speex_jitter.h
|
||||
@brief Adaptive jitter buffer for Speex
|
||||
*/
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef SPEEX_JITTER_H
|
||||
#define SPEEX_JITTER_H
|
||||
/** @defgroup JitterBuffer JitterBuffer: Adaptive jitter buffer
|
||||
* This is the jitter buffer that reorders UDP/RTP packets and adjusts the buffer size
|
||||
* to maintain good quality and low latency.
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "speexdsp_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Generic adaptive jitter buffer state */
|
||||
struct JitterBuffer_;
|
||||
|
||||
/** Generic adaptive jitter buffer state */
|
||||
typedef struct JitterBuffer_ JitterBuffer;
|
||||
|
||||
/** Definition of an incoming packet */
|
||||
typedef struct _JitterBufferPacket JitterBufferPacket;
|
||||
|
||||
/** Definition of an incoming packet */
|
||||
struct _JitterBufferPacket {
|
||||
char *data; /**< Data bytes contained in the packet */
|
||||
spx_uint32_t len; /**< Length of the packet in bytes */
|
||||
spx_uint32_t timestamp; /**< Timestamp for the packet */
|
||||
spx_uint32_t span; /**< Time covered by the packet (same units as timestamp) */
|
||||
spx_uint16_t sequence; /**< RTP Sequence number if available (0 otherwise) */
|
||||
spx_uint32_t user_data; /**< Put whatever data you like here (it's ignored by the jitter buffer) */
|
||||
};
|
||||
|
||||
/** Packet has been retrieved */
|
||||
#define JITTER_BUFFER_OK 0
|
||||
/** Packet is lost or is late */
|
||||
#define JITTER_BUFFER_MISSING 1
|
||||
/** A "fake" packet is meant to be inserted here to increase buffering */
|
||||
#define JITTER_BUFFER_INSERTION 2
|
||||
/** There was an error in the jitter buffer */
|
||||
#define JITTER_BUFFER_INTERNAL_ERROR -1
|
||||
/** Invalid argument */
|
||||
#define JITTER_BUFFER_BAD_ARGUMENT -2
|
||||
|
||||
|
||||
/** Set minimum amount of extra buffering required (margin) */
|
||||
#define JITTER_BUFFER_SET_MARGIN 0
|
||||
/** Get minimum amount of extra buffering required (margin) */
|
||||
#define JITTER_BUFFER_GET_MARGIN 1
|
||||
/* JITTER_BUFFER_SET_AVAILABLE_COUNT wouldn't make sense */
|
||||
|
||||
/** Get the amount of available packets currently buffered */
|
||||
#define JITTER_BUFFER_GET_AVAILABLE_COUNT 3
|
||||
/** Included because of an early misspelling (will remove in next release) */
|
||||
#define JITTER_BUFFER_GET_AVALIABLE_COUNT 3
|
||||
|
||||
/** Assign a function to destroy unused packet. When setting that, the jitter
|
||||
buffer no longer copies packet data. */
|
||||
#define JITTER_BUFFER_SET_DESTROY_CALLBACK 4
|
||||
/** */
|
||||
#define JITTER_BUFFER_GET_DESTROY_CALLBACK 5
|
||||
|
||||
/** Tell the jitter buffer to only adjust the delay in multiples of the step parameter provided */
|
||||
#define JITTER_BUFFER_SET_DELAY_STEP 6
|
||||
/** */
|
||||
#define JITTER_BUFFER_GET_DELAY_STEP 7
|
||||
|
||||
/** Tell the jitter buffer to only do concealment in multiples of the size parameter provided */
|
||||
#define JITTER_BUFFER_SET_CONCEALMENT_SIZE 8
|
||||
#define JITTER_BUFFER_GET_CONCEALMENT_SIZE 9
|
||||
|
||||
/** Absolute max amount of loss that can be tolerated regardless of the delay. Typical loss
|
||||
should be half of that or less. */
|
||||
#define JITTER_BUFFER_SET_MAX_LATE_RATE 10
|
||||
#define JITTER_BUFFER_GET_MAX_LATE_RATE 11
|
||||
|
||||
/** Equivalent cost of one percent late packet in timestamp units */
|
||||
#define JITTER_BUFFER_SET_LATE_COST 12
|
||||
#define JITTER_BUFFER_GET_LATE_COST 13
|
||||
|
||||
|
||||
/** Initialises jitter buffer
|
||||
*
|
||||
* @param step_size Starting value for the size of concleanment packets and delay
|
||||
adjustment steps. Can be changed at any time using JITTER_BUFFER_SET_DELAY_STEP
|
||||
and JITTER_BUFFER_GET_CONCEALMENT_SIZE.
|
||||
* @return Newly created jitter buffer state
|
||||
*/
|
||||
JitterBuffer *jitter_buffer_init(int step_size);
|
||||
|
||||
/** Restores jitter buffer to its original state
|
||||
*
|
||||
* @param jitter Jitter buffer state
|
||||
*/
|
||||
void jitter_buffer_reset(JitterBuffer *jitter);
|
||||
|
||||
/** Destroys jitter buffer
|
||||
*
|
||||
* @param jitter Jitter buffer state
|
||||
*/
|
||||
void jitter_buffer_destroy(JitterBuffer *jitter);
|
||||
|
||||
/** Put one packet into the jitter buffer
|
||||
*
|
||||
* @param jitter Jitter buffer state
|
||||
* @param packet Incoming packet
|
||||
*/
|
||||
void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet);
|
||||
|
||||
/** Get one packet from the jitter buffer
|
||||
*
|
||||
* @param jitter Jitter buffer state
|
||||
* @param packet Returned packet
|
||||
* @param desired_span Number of samples (or units) we wish to get from the buffer (no guarantee)
|
||||
* @param current_timestamp Timestamp for the returned packet
|
||||
*/
|
||||
int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset);
|
||||
|
||||
/** Used right after jitter_buffer_get() to obtain another packet that would have the same timestamp.
|
||||
* This is mainly useful for media where a single "frame" can be split into several packets.
|
||||
*
|
||||
* @param jitter Jitter buffer state
|
||||
* @param packet Returned packet
|
||||
*/
|
||||
int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet);
|
||||
|
||||
/** Get pointer timestamp of jitter buffer
|
||||
*
|
||||
* @param jitter Jitter buffer state
|
||||
*/
|
||||
int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter);
|
||||
|
||||
/** Advance by one tick
|
||||
*
|
||||
* @param jitter Jitter buffer state
|
||||
*/
|
||||
void jitter_buffer_tick(JitterBuffer *jitter);
|
||||
|
||||
/** Telling the jitter buffer about the remaining data in the application buffer
|
||||
* @param jitter Jitter buffer state
|
||||
* @param rem Amount of data buffered by the application (timestamp units)
|
||||
*/
|
||||
void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem);
|
||||
|
||||
/** Used like the ioctl function to control the jitter buffer parameters
|
||||
*
|
||||
* @param jitter Jitter buffer state
|
||||
* @param request ioctl-type request (one of the JITTER_BUFFER_* macros)
|
||||
* @param ptr Data exchanged to-from function
|
||||
* @return 0 if no error, -1 if request in unknown
|
||||
*/
|
||||
int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr);
|
||||
|
||||
int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset);
|
||||
|
||||
/* @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,219 @@
|
||||
/* Copyright (C) 2003 Epic Games
|
||||
Written by Jean-Marc Valin */
|
||||
/**
|
||||
* @file speex_preprocess.h
|
||||
* @brief Speex preprocessor. The preprocess can do noise suppression,
|
||||
* residual echo suppression (after using the echo canceller), automatic
|
||||
* gain control (AGC) and voice activity detection (VAD).
|
||||
*/
|
||||
/*
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef SPEEX_PREPROCESS_H
|
||||
#define SPEEX_PREPROCESS_H
|
||||
/** @defgroup SpeexPreprocessState SpeexPreprocessState: The Speex preprocessor
|
||||
* This is the Speex preprocessor. The preprocess can do noise suppression,
|
||||
* residual echo suppression (after using the echo canceller), automatic
|
||||
* gain control (AGC) and voice activity detection (VAD).
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "speexdsp_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** State of the preprocessor (one per channel). Should never be accessed directly. */
|
||||
struct SpeexPreprocessState_;
|
||||
|
||||
/** State of the preprocessor (one per channel). Should never be accessed directly. */
|
||||
typedef struct SpeexPreprocessState_ SpeexPreprocessState;
|
||||
|
||||
|
||||
/** Creates a new preprocessing state. You MUST create one state per channel processed.
|
||||
* @param frame_size Number of samples to process at one time (should correspond to 10-20 ms). Must be
|
||||
* the same value as that used for the echo canceller for residual echo cancellation to work.
|
||||
* @param sampling_rate Sampling rate used for the input.
|
||||
* @return Newly created preprocessor state
|
||||
*/
|
||||
SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate);
|
||||
|
||||
/** Destroys a preprocessor state
|
||||
* @param st Preprocessor state to destroy
|
||||
*/
|
||||
void speex_preprocess_state_destroy(SpeexPreprocessState *st);
|
||||
|
||||
/** Preprocess a frame
|
||||
* @param st Preprocessor state
|
||||
* @param x Audio sample vector (in and out). Must be same size as specified in speex_preprocess_state_init().
|
||||
* @return Bool value for voice activity (1 for speech, 0 for noise/silence), ONLY if VAD turned on.
|
||||
*/
|
||||
int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x);
|
||||
|
||||
/** Preprocess a frame (deprecated, use speex_preprocess_run() instead)*/
|
||||
int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo);
|
||||
|
||||
/** Update preprocessor state, but do not compute the output
|
||||
* @param st Preprocessor state
|
||||
* @param x Audio sample vector (in only). Must be same size as specified in speex_preprocess_state_init().
|
||||
*/
|
||||
void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x);
|
||||
|
||||
/** Used like the ioctl function to control the preprocessor parameters
|
||||
* @param st Preprocessor state
|
||||
* @param request ioctl-type request (one of the SPEEX_PREPROCESS_* macros)
|
||||
* @param ptr Data exchanged to-from function
|
||||
* @return 0 if no error, -1 if request in unknown
|
||||
*/
|
||||
int speex_preprocess_ctl(SpeexPreprocessState *st, int request, void *ptr);
|
||||
|
||||
|
||||
|
||||
/** Set preprocessor denoiser state */
|
||||
#define SPEEX_PREPROCESS_SET_DENOISE 0
|
||||
/** Get preprocessor denoiser state */
|
||||
#define SPEEX_PREPROCESS_GET_DENOISE 1
|
||||
|
||||
/** Set preprocessor Automatic Gain Control state */
|
||||
#define SPEEX_PREPROCESS_SET_AGC 2
|
||||
/** Get preprocessor Automatic Gain Control state */
|
||||
#define SPEEX_PREPROCESS_GET_AGC 3
|
||||
|
||||
/** Set preprocessor Voice Activity Detection state */
|
||||
#define SPEEX_PREPROCESS_SET_VAD 4
|
||||
/** Get preprocessor Voice Activity Detection state */
|
||||
#define SPEEX_PREPROCESS_GET_VAD 5
|
||||
|
||||
/** Set preprocessor Automatic Gain Control level (float) */
|
||||
#define SPEEX_PREPROCESS_SET_AGC_LEVEL 6
|
||||
/** Get preprocessor Automatic Gain Control level (float) */
|
||||
#define SPEEX_PREPROCESS_GET_AGC_LEVEL 7
|
||||
|
||||
/** Set preprocessor dereverb state */
|
||||
#define SPEEX_PREPROCESS_SET_DEREVERB 8
|
||||
/** Get preprocessor dereverb state */
|
||||
#define SPEEX_PREPROCESS_GET_DEREVERB 9
|
||||
|
||||
/** Set preprocessor dereverb level */
|
||||
#define SPEEX_PREPROCESS_SET_DEREVERB_LEVEL 10
|
||||
/** Get preprocessor dereverb level */
|
||||
#define SPEEX_PREPROCESS_GET_DEREVERB_LEVEL 11
|
||||
|
||||
/** Set preprocessor dereverb decay */
|
||||
#define SPEEX_PREPROCESS_SET_DEREVERB_DECAY 12
|
||||
/** Get preprocessor dereverb decay */
|
||||
#define SPEEX_PREPROCESS_GET_DEREVERB_DECAY 13
|
||||
|
||||
/** Set probability required for the VAD to go from silence to voice */
|
||||
#define SPEEX_PREPROCESS_SET_PROB_START 14
|
||||
/** Get probability required for the VAD to go from silence to voice */
|
||||
#define SPEEX_PREPROCESS_GET_PROB_START 15
|
||||
|
||||
/** Set probability required for the VAD to stay in the voice state (integer percent) */
|
||||
#define SPEEX_PREPROCESS_SET_PROB_CONTINUE 16
|
||||
/** Get probability required for the VAD to stay in the voice state (integer percent) */
|
||||
#define SPEEX_PREPROCESS_GET_PROB_CONTINUE 17
|
||||
|
||||
/** Set maximum attenuation of the noise in dB (negative number) */
|
||||
#define SPEEX_PREPROCESS_SET_NOISE_SUPPRESS 18
|
||||
/** Get maximum attenuation of the noise in dB (negative number) */
|
||||
#define SPEEX_PREPROCESS_GET_NOISE_SUPPRESS 19
|
||||
|
||||
/** Set maximum attenuation of the residual echo in dB (negative number) */
|
||||
#define SPEEX_PREPROCESS_SET_ECHO_SUPPRESS 20
|
||||
/** Get maximum attenuation of the residual echo in dB (negative number) */
|
||||
#define SPEEX_PREPROCESS_GET_ECHO_SUPPRESS 21
|
||||
|
||||
/** Set maximum attenuation of the residual echo in dB when near end is active (negative number) */
|
||||
#define SPEEX_PREPROCESS_SET_ECHO_SUPPRESS_ACTIVE 22
|
||||
/** Get maximum attenuation of the residual echo in dB when near end is active (negative number) */
|
||||
#define SPEEX_PREPROCESS_GET_ECHO_SUPPRESS_ACTIVE 23
|
||||
|
||||
/** Set the corresponding echo canceller state so that residual echo suppression can be performed (NULL for no residual echo suppression) */
|
||||
#define SPEEX_PREPROCESS_SET_ECHO_STATE 24
|
||||
/** Get the corresponding echo canceller state */
|
||||
#define SPEEX_PREPROCESS_GET_ECHO_STATE 25
|
||||
|
||||
/** Set maximal gain increase in dB/second (int32) */
|
||||
#define SPEEX_PREPROCESS_SET_AGC_INCREMENT 26
|
||||
|
||||
/** Get maximal gain increase in dB/second (int32) */
|
||||
#define SPEEX_PREPROCESS_GET_AGC_INCREMENT 27
|
||||
|
||||
/** Set maximal gain decrease in dB/second (int32) */
|
||||
#define SPEEX_PREPROCESS_SET_AGC_DECREMENT 28
|
||||
|
||||
/** Get maximal gain decrease in dB/second (int32) */
|
||||
#define SPEEX_PREPROCESS_GET_AGC_DECREMENT 29
|
||||
|
||||
/** Set maximal gain in dB (int32) */
|
||||
#define SPEEX_PREPROCESS_SET_AGC_MAX_GAIN 30
|
||||
|
||||
/** Get maximal gain in dB (int32) */
|
||||
#define SPEEX_PREPROCESS_GET_AGC_MAX_GAIN 31
|
||||
|
||||
/* Can't set loudness */
|
||||
/** Get loudness */
|
||||
#define SPEEX_PREPROCESS_GET_AGC_LOUDNESS 33
|
||||
|
||||
/* Can't set gain */
|
||||
/** Get current gain (int32 percent) */
|
||||
#define SPEEX_PREPROCESS_GET_AGC_GAIN 35
|
||||
|
||||
/* Can't set spectrum size */
|
||||
/** Get spectrum size for power spectrum (int32) */
|
||||
#define SPEEX_PREPROCESS_GET_PSD_SIZE 37
|
||||
|
||||
/* Can't set power spectrum */
|
||||
/** Get power spectrum (int32[] of squared values) */
|
||||
#define SPEEX_PREPROCESS_GET_PSD 39
|
||||
|
||||
/* Can't set noise size */
|
||||
/** Get spectrum size for noise estimate (int32) */
|
||||
#define SPEEX_PREPROCESS_GET_NOISE_PSD_SIZE 41
|
||||
|
||||
/* Can't set noise estimate */
|
||||
/** Get noise estimate (int32[] of squared values) */
|
||||
#define SPEEX_PREPROCESS_GET_NOISE_PSD 43
|
||||
|
||||
/* Can't set speech probability */
|
||||
/** Get speech probability in last frame (int32). */
|
||||
#define SPEEX_PREPROCESS_GET_PROB 45
|
||||
|
||||
/** Set preprocessor Automatic Gain Control level (int32) */
|
||||
#define SPEEX_PREPROCESS_SET_AGC_TARGET 46
|
||||
/** Get preprocessor Automatic Gain Control level (int32) */
|
||||
#define SPEEX_PREPROCESS_GET_AGC_TARGET 47
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @}*/
|
||||
#endif
|
||||
@@ -0,0 +1,343 @@
|
||||
/* Copyright (C) 2007 Jean-Marc Valin
|
||||
|
||||
File: speex_resampler.h
|
||||
Resampling code
|
||||
|
||||
The design goals of this code are:
|
||||
- Very fast algorithm
|
||||
- Low memory requirement
|
||||
- Good *perceptual* quality (and not best SNR)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SPEEX_RESAMPLER_H
|
||||
#define SPEEX_RESAMPLER_H
|
||||
|
||||
#ifdef OUTSIDE_SPEEX
|
||||
|
||||
/********* WARNING: MENTAL SANITY ENDS HERE *************/
|
||||
|
||||
/* If the resampler is defined outside of Speex, we change the symbol names so that
|
||||
there won't be any clash if linking with Speex later on. */
|
||||
|
||||
/* #define RANDOM_PREFIX your software name here */
|
||||
#ifndef RANDOM_PREFIX
|
||||
#error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes"
|
||||
#endif
|
||||
|
||||
#define CAT_PREFIX2(a,b) a ## b
|
||||
#define CAT_PREFIX(a,b) CAT_PREFIX2(a, b)
|
||||
|
||||
#define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init)
|
||||
#define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac)
|
||||
#define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy)
|
||||
#define speex_resampler_process_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_float)
|
||||
#define speex_resampler_process_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_int)
|
||||
#define speex_resampler_process_interleaved_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_float)
|
||||
#define speex_resampler_process_interleaved_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_int)
|
||||
#define speex_resampler_set_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate)
|
||||
#define speex_resampler_get_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_get_rate)
|
||||
#define speex_resampler_set_rate_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate_frac)
|
||||
#define speex_resampler_get_ratio CAT_PREFIX(RANDOM_PREFIX,_resampler_get_ratio)
|
||||
#define speex_resampler_set_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_set_quality)
|
||||
#define speex_resampler_get_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_get_quality)
|
||||
#define speex_resampler_set_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_input_stride)
|
||||
#define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride)
|
||||
#define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride)
|
||||
#define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride)
|
||||
#define speex_resampler_get_input_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_latency)
|
||||
#define speex_resampler_get_output_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_latency)
|
||||
#define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros)
|
||||
#define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
|
||||
#define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
|
||||
|
||||
#define spx_int16_t short
|
||||
#define spx_int32_t int
|
||||
#define spx_uint16_t unsigned short
|
||||
#define spx_uint32_t unsigned int
|
||||
|
||||
#define speex_assert(cond)
|
||||
|
||||
#else /* OUTSIDE_SPEEX */
|
||||
|
||||
#include "speexdsp_types.h"
|
||||
|
||||
#endif /* OUTSIDE_SPEEX */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SPEEX_RESAMPLER_QUALITY_MAX 10
|
||||
#define SPEEX_RESAMPLER_QUALITY_MIN 0
|
||||
#define SPEEX_RESAMPLER_QUALITY_DEFAULT 4
|
||||
#define SPEEX_RESAMPLER_QUALITY_VOIP 3
|
||||
#define SPEEX_RESAMPLER_QUALITY_DESKTOP 5
|
||||
|
||||
enum {
|
||||
RESAMPLER_ERR_SUCCESS = 0,
|
||||
RESAMPLER_ERR_ALLOC_FAILED = 1,
|
||||
RESAMPLER_ERR_BAD_STATE = 2,
|
||||
RESAMPLER_ERR_INVALID_ARG = 3,
|
||||
RESAMPLER_ERR_PTR_OVERLAP = 4,
|
||||
RESAMPLER_ERR_OVERFLOW = 5,
|
||||
|
||||
RESAMPLER_ERR_MAX_ERROR
|
||||
};
|
||||
|
||||
struct SpeexResamplerState_;
|
||||
typedef struct SpeexResamplerState_ SpeexResamplerState;
|
||||
|
||||
/** Create a new resampler with integer input and output rates.
|
||||
* @param nb_channels Number of channels to be processed
|
||||
* @param in_rate Input sampling rate (integer number of Hz).
|
||||
* @param out_rate Output sampling rate (integer number of Hz).
|
||||
* @param quality Resampling quality between 0 and 10, where 0 has poor quality
|
||||
* and 10 has very high quality.
|
||||
* @return Newly created resampler state
|
||||
* @retval NULL Error: not enough memory
|
||||
*/
|
||||
SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels,
|
||||
spx_uint32_t in_rate,
|
||||
spx_uint32_t out_rate,
|
||||
int quality,
|
||||
int *err);
|
||||
|
||||
/** Create a new resampler with fractional input/output rates. The sampling
|
||||
* rate ratio is an arbitrary rational number with both the numerator and
|
||||
* denominator being 32-bit integers.
|
||||
* @param nb_channels Number of channels to be processed
|
||||
* @param ratio_num Numerator of the sampling rate ratio
|
||||
* @param ratio_den Denominator of the sampling rate ratio
|
||||
* @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
|
||||
* @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
|
||||
* @param quality Resampling quality between 0 and 10, where 0 has poor quality
|
||||
* and 10 has very high quality.
|
||||
* @return Newly created resampler state
|
||||
* @retval NULL Error: not enough memory
|
||||
*/
|
||||
SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels,
|
||||
spx_uint32_t ratio_num,
|
||||
spx_uint32_t ratio_den,
|
||||
spx_uint32_t in_rate,
|
||||
spx_uint32_t out_rate,
|
||||
int quality,
|
||||
int *err);
|
||||
|
||||
/** Destroy a resampler state.
|
||||
* @param st Resampler state
|
||||
*/
|
||||
void speex_resampler_destroy(SpeexResamplerState *st);
|
||||
|
||||
/** Resample a float array. The input and output buffers must *not* overlap.
|
||||
* @param st Resampler state
|
||||
* @param channel_index Index of the channel to process for the multi-channel
|
||||
* base (0 otherwise)
|
||||
* @param in Input buffer
|
||||
* @param in_len Number of input samples in the input buffer. Returns the
|
||||
* number of samples processed
|
||||
* @param out Output buffer
|
||||
* @param out_len Size of the output buffer. Returns the number of samples written
|
||||
*/
|
||||
int speex_resampler_process_float(SpeexResamplerState *st,
|
||||
spx_uint32_t channel_index,
|
||||
const float *in,
|
||||
spx_uint32_t *in_len,
|
||||
float *out,
|
||||
spx_uint32_t *out_len);
|
||||
|
||||
/** Resample an int array. The input and output buffers must *not* overlap.
|
||||
* @param st Resampler state
|
||||
* @param channel_index Index of the channel to process for the multi-channel
|
||||
* base (0 otherwise)
|
||||
* @param in Input buffer
|
||||
* @param in_len Number of input samples in the input buffer. Returns the number
|
||||
* of samples processed
|
||||
* @param out Output buffer
|
||||
* @param out_len Size of the output buffer. Returns the number of samples written
|
||||
*/
|
||||
int speex_resampler_process_int(SpeexResamplerState *st,
|
||||
spx_uint32_t channel_index,
|
||||
const spx_int16_t *in,
|
||||
spx_uint32_t *in_len,
|
||||
spx_int16_t *out,
|
||||
spx_uint32_t *out_len);
|
||||
|
||||
/** Resample an interleaved float array. The input and output buffers must *not* overlap.
|
||||
* @param st Resampler state
|
||||
* @param in Input buffer
|
||||
* @param in_len Number of input samples in the input buffer. Returns the number
|
||||
* of samples processed. This is all per-channel.
|
||||
* @param out Output buffer
|
||||
* @param out_len Size of the output buffer. Returns the number of samples written.
|
||||
* This is all per-channel.
|
||||
*/
|
||||
int speex_resampler_process_interleaved_float(SpeexResamplerState *st,
|
||||
const float *in,
|
||||
spx_uint32_t *in_len,
|
||||
float *out,
|
||||
spx_uint32_t *out_len);
|
||||
|
||||
/** Resample an interleaved int array. The input and output buffers must *not* overlap.
|
||||
* @param st Resampler state
|
||||
* @param in Input buffer
|
||||
* @param in_len Number of input samples in the input buffer. Returns the number
|
||||
* of samples processed. This is all per-channel.
|
||||
* @param out Output buffer
|
||||
* @param out_len Size of the output buffer. Returns the number of samples written.
|
||||
* This is all per-channel.
|
||||
*/
|
||||
int speex_resampler_process_interleaved_int(SpeexResamplerState *st,
|
||||
const spx_int16_t *in,
|
||||
spx_uint32_t *in_len,
|
||||
spx_int16_t *out,
|
||||
spx_uint32_t *out_len);
|
||||
|
||||
/** Set (change) the input/output sampling rates (integer value).
|
||||
* @param st Resampler state
|
||||
* @param in_rate Input sampling rate (integer number of Hz).
|
||||
* @param out_rate Output sampling rate (integer number of Hz).
|
||||
*/
|
||||
int speex_resampler_set_rate(SpeexResamplerState *st,
|
||||
spx_uint32_t in_rate,
|
||||
spx_uint32_t out_rate);
|
||||
|
||||
/** Get the current input/output sampling rates (integer value).
|
||||
* @param st Resampler state
|
||||
* @param in_rate Input sampling rate (integer number of Hz) copied.
|
||||
* @param out_rate Output sampling rate (integer number of Hz) copied.
|
||||
*/
|
||||
void speex_resampler_get_rate(SpeexResamplerState *st,
|
||||
spx_uint32_t *in_rate,
|
||||
spx_uint32_t *out_rate);
|
||||
|
||||
/** Set (change) the input/output sampling rates and resampling ratio
|
||||
* (fractional values in Hz supported).
|
||||
* @param st Resampler state
|
||||
* @param ratio_num Numerator of the sampling rate ratio
|
||||
* @param ratio_den Denominator of the sampling rate ratio
|
||||
* @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
|
||||
* @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
|
||||
*/
|
||||
int speex_resampler_set_rate_frac(SpeexResamplerState *st,
|
||||
spx_uint32_t ratio_num,
|
||||
spx_uint32_t ratio_den,
|
||||
spx_uint32_t in_rate,
|
||||
spx_uint32_t out_rate);
|
||||
|
||||
/** Get the current resampling ratio. This will be reduced to the least
|
||||
* common denominator.
|
||||
* @param st Resampler state
|
||||
* @param ratio_num Numerator of the sampling rate ratio copied
|
||||
* @param ratio_den Denominator of the sampling rate ratio copied
|
||||
*/
|
||||
void speex_resampler_get_ratio(SpeexResamplerState *st,
|
||||
spx_uint32_t *ratio_num,
|
||||
spx_uint32_t *ratio_den);
|
||||
|
||||
/** Set (change) the conversion quality.
|
||||
* @param st Resampler state
|
||||
* @param quality Resampling quality between 0 and 10, where 0 has poor
|
||||
* quality and 10 has very high quality.
|
||||
*/
|
||||
int speex_resampler_set_quality(SpeexResamplerState *st,
|
||||
int quality);
|
||||
|
||||
/** Get the conversion quality.
|
||||
* @param st Resampler state
|
||||
* @param quality Resampling quality between 0 and 10, where 0 has poor
|
||||
* quality and 10 has very high quality.
|
||||
*/
|
||||
void speex_resampler_get_quality(SpeexResamplerState *st,
|
||||
int *quality);
|
||||
|
||||
/** Set (change) the input stride.
|
||||
* @param st Resampler state
|
||||
* @param stride Input stride
|
||||
*/
|
||||
void speex_resampler_set_input_stride(SpeexResamplerState *st,
|
||||
spx_uint32_t stride);
|
||||
|
||||
/** Get the input stride.
|
||||
* @param st Resampler state
|
||||
* @param stride Input stride copied
|
||||
*/
|
||||
void speex_resampler_get_input_stride(SpeexResamplerState *st,
|
||||
spx_uint32_t *stride);
|
||||
|
||||
/** Set (change) the output stride.
|
||||
* @param st Resampler state
|
||||
* @param stride Output stride
|
||||
*/
|
||||
void speex_resampler_set_output_stride(SpeexResamplerState *st,
|
||||
spx_uint32_t stride);
|
||||
|
||||
/** Get the output stride.
|
||||
* @param st Resampler state copied
|
||||
* @param stride Output stride
|
||||
*/
|
||||
void speex_resampler_get_output_stride(SpeexResamplerState *st,
|
||||
spx_uint32_t *stride);
|
||||
|
||||
/** Get the latency introduced by the resampler measured in input samples.
|
||||
* @param st Resampler state
|
||||
*/
|
||||
int speex_resampler_get_input_latency(SpeexResamplerState *st);
|
||||
|
||||
/** Get the latency introduced by the resampler measured in output samples.
|
||||
* @param st Resampler state
|
||||
*/
|
||||
int speex_resampler_get_output_latency(SpeexResamplerState *st);
|
||||
|
||||
/** Make sure that the first samples to go out of the resamplers don't have
|
||||
* leading zeros. This is only useful before starting to use a newly created
|
||||
* resampler. It is recommended to use that when resampling an audio file, as
|
||||
* it will generate a file with the same length. For real-time processing,
|
||||
* it is probably easier not to use this call (so that the output duration
|
||||
* is the same for the first frame).
|
||||
* @param st Resampler state
|
||||
*/
|
||||
int speex_resampler_skip_zeros(SpeexResamplerState *st);
|
||||
|
||||
/** Reset a resampler so a new (unrelated) stream can be processed.
|
||||
* @param st Resampler state
|
||||
*/
|
||||
int speex_resampler_reset_mem(SpeexResamplerState *st);
|
||||
|
||||
/** Returns the English meaning for an error code
|
||||
* @param err Error code
|
||||
* @return English string
|
||||
*/
|
||||
const char *speex_resampler_strerror(int err);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+37
-7
@@ -7,18 +7,18 @@
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
|
||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
@@ -34,10 +34,20 @@
|
||||
|
||||
#ifndef STEREO_H
|
||||
#define STEREO_H
|
||||
/** @defgroup SpeexStereoState SpeexStereoState: Handling Speex stereo files
|
||||
* This describes the Speex intensity stereo encoding/decoding
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "speex_types.h"
|
||||
#include "speex_bits.h"
|
||||
|
||||
/** State used for decoding (intensity) stereo information */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** If you access any of these fields directly, I'll personally come and bite you */
|
||||
typedef struct SpeexStereoState {
|
||||
float balance; /**< Left/right balance info */
|
||||
float e_ratio; /**< Ratio of energies: E(left+right)/[E(left)+E(right)] */
|
||||
@@ -47,16 +57,36 @@ typedef struct SpeexStereoState {
|
||||
float reserved2; /**< Reserved for future use */
|
||||
} SpeexStereoState;
|
||||
|
||||
/** Initialization value for a stereo state */
|
||||
#define SPEEX_STEREO_STATE_INIT {1,.5,1,1}
|
||||
/** Deprecated. Use speex_stereo_state_init() instead. */
|
||||
#define SPEEX_STEREO_STATE_INIT {1,.5,1,1,0,0}
|
||||
|
||||
/** Initialise/create a stereo stereo state */
|
||||
SpeexStereoState *speex_stereo_state_init();
|
||||
|
||||
/** Reset/re-initialise an already allocated stereo state */
|
||||
void speex_stereo_state_reset(SpeexStereoState *stereo);
|
||||
|
||||
/** Destroy a stereo stereo state */
|
||||
void speex_stereo_state_destroy(SpeexStereoState *stereo);
|
||||
|
||||
/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
|
||||
void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits);
|
||||
|
||||
/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
|
||||
void speex_encode_stereo_int(spx_int16_t *data, int frame_size, SpeexBits *bits);
|
||||
|
||||
/** Transforms a mono frame into a stereo frame using intensity stereo info */
|
||||
void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *stereo);
|
||||
|
||||
/** Transforms a mono frame into a stereo frame using intensity stereo info */
|
||||
void speex_decode_stereo_int(spx_int16_t *data, int frame_size, SpeexStereoState *stereo);
|
||||
|
||||
/** Callback handler for intensity stereo info */
|
||||
int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
#endif
|
||||
@@ -0,0 +1,126 @@
|
||||
/* speex_types.h taken from libogg */
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: #ifdef jail to whip a few platforms into the UNIX ideal.
|
||||
last mod: $Id: os_types.h 7524 2004-08-11 04:20:36Z conrad $
|
||||
|
||||
********************************************************************/
|
||||
/**
|
||||
@file speex_types.h
|
||||
@brief Speex types
|
||||
*/
|
||||
#ifndef _SPEEX_TYPES_H
|
||||
#define _SPEEX_TYPES_H
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
# if defined(__CYGWIN__)
|
||||
# include <_G_config.h>
|
||||
typedef _G_int32_t spx_int32_t;
|
||||
typedef _G_uint32_t spx_uint32_t;
|
||||
typedef _G_int16_t spx_int16_t;
|
||||
typedef _G_uint16_t spx_uint16_t;
|
||||
# elif defined(__MINGW32__)
|
||||
typedef short spx_int16_t;
|
||||
typedef unsigned short spx_uint16_t;
|
||||
typedef int spx_int32_t;
|
||||
typedef unsigned int spx_uint32_t;
|
||||
# elif defined(__MWERKS__)
|
||||
typedef int spx_int32_t;
|
||||
typedef unsigned int spx_uint32_t;
|
||||
typedef short spx_int16_t;
|
||||
typedef unsigned short spx_uint16_t;
|
||||
# else
|
||||
/* MSVC/Borland */
|
||||
typedef __int32 spx_int32_t;
|
||||
typedef unsigned __int32 spx_uint32_t;
|
||||
typedef __int16 spx_int16_t;
|
||||
typedef unsigned __int16 spx_uint16_t;
|
||||
# endif
|
||||
|
||||
#elif defined(__MACOS__)
|
||||
|
||||
# include <sys/types.h>
|
||||
typedef SInt16 spx_int16_t;
|
||||
typedef UInt16 spx_uint16_t;
|
||||
typedef SInt32 spx_int32_t;
|
||||
typedef UInt32 spx_uint32_t;
|
||||
|
||||
#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
|
||||
|
||||
# include <sys/types.h>
|
||||
typedef int16_t spx_int16_t;
|
||||
typedef u_int16_t spx_uint16_t;
|
||||
typedef int32_t spx_int32_t;
|
||||
typedef u_int32_t spx_uint32_t;
|
||||
|
||||
#elif defined(__BEOS__)
|
||||
|
||||
/* Be */
|
||||
# include <inttypes.h>
|
||||
typedef int16_t spx_int16_t;
|
||||
typedef u_int16_t spx_uint16_t;
|
||||
typedef int32_t spx_int32_t;
|
||||
typedef u_int32_t spx_uint32_t;
|
||||
|
||||
#elif defined (__EMX__)
|
||||
|
||||
/* OS/2 GCC */
|
||||
typedef short spx_int16_t;
|
||||
typedef unsigned short spx_uint16_t;
|
||||
typedef int spx_int32_t;
|
||||
typedef unsigned int spx_uint32_t;
|
||||
|
||||
#elif defined (DJGPP)
|
||||
|
||||
/* DJGPP */
|
||||
typedef short spx_int16_t;
|
||||
typedef int spx_int32_t;
|
||||
typedef unsigned int spx_uint32_t;
|
||||
|
||||
#elif defined(R5900)
|
||||
|
||||
/* PS2 EE */
|
||||
typedef int spx_int32_t;
|
||||
typedef unsigned spx_uint32_t;
|
||||
typedef short spx_int16_t;
|
||||
|
||||
#elif defined(__SYMBIAN32__)
|
||||
|
||||
/* Symbian GCC */
|
||||
typedef signed short spx_int16_t;
|
||||
typedef unsigned short spx_uint16_t;
|
||||
typedef signed int spx_int32_t;
|
||||
typedef unsigned int spx_uint32_t;
|
||||
|
||||
#elif defined(CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
|
||||
|
||||
typedef short spx_int16_t;
|
||||
typedef unsigned short spx_uint16_t;
|
||||
typedef long spx_int32_t;
|
||||
typedef unsigned long spx_uint32_t;
|
||||
|
||||
#elif defined(CONFIG_TI_C6X)
|
||||
|
||||
typedef short spx_int16_t;
|
||||
typedef unsigned short spx_uint16_t;
|
||||
typedef int spx_int32_t;
|
||||
typedef unsigned int spx_uint32_t;
|
||||
|
||||
#else
|
||||
|
||||
#include "speex_config_types.h"
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _SPEEX_TYPES_H */
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef __SPEEX_TYPES_H__
|
||||
#define __SPEEX_TYPES_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int16_t spx_int16_t;
|
||||
typedef uint16_t spx_uint16_t;
|
||||
typedef int32_t spx_int32_t;
|
||||
typedef uint32_t spx_uint32_t;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
/* speexdsp_types.h taken from libogg */
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: #ifdef jail to whip a few platforms into the UNIX ideal.
|
||||
last mod: $Id: os_types.h 7524 2004-08-11 04:20:36Z conrad $
|
||||
|
||||
********************************************************************/
|
||||
/**
|
||||
@file speexdsp_types.h
|
||||
@brief Speex types
|
||||
*/
|
||||
#ifndef _SPEEX_TYPES_H
|
||||
#define _SPEEX_TYPES_H
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
# if defined(__CYGWIN__)
|
||||
# include <_G_config.h>
|
||||
typedef _G_int32_t spx_int32_t;
|
||||
typedef _G_uint32_t spx_uint32_t;
|
||||
typedef _G_int16_t spx_int16_t;
|
||||
typedef _G_uint16_t spx_uint16_t;
|
||||
# elif defined(__MINGW32__)
|
||||
typedef short spx_int16_t;
|
||||
typedef unsigned short spx_uint16_t;
|
||||
typedef int spx_int32_t;
|
||||
typedef unsigned int spx_uint32_t;
|
||||
# elif defined(__MWERKS__)
|
||||
typedef int spx_int32_t;
|
||||
typedef unsigned int spx_uint32_t;
|
||||
typedef short spx_int16_t;
|
||||
typedef unsigned short spx_uint16_t;
|
||||
# else
|
||||
/* MSVC/Borland */
|
||||
typedef __int32 spx_int32_t;
|
||||
typedef unsigned __int32 spx_uint32_t;
|
||||
typedef __int16 spx_int16_t;
|
||||
typedef unsigned __int16 spx_uint16_t;
|
||||
# endif
|
||||
|
||||
#elif defined(__MACOS__)
|
||||
|
||||
# include <sys/types.h>
|
||||
typedef SInt16 spx_int16_t;
|
||||
typedef UInt16 spx_uint16_t;
|
||||
typedef SInt32 spx_int32_t;
|
||||
typedef UInt32 spx_uint32_t;
|
||||
|
||||
#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
|
||||
|
||||
# include <sys/types.h>
|
||||
typedef int16_t spx_int16_t;
|
||||
typedef u_int16_t spx_uint16_t;
|
||||
typedef int32_t spx_int32_t;
|
||||
typedef u_int32_t spx_uint32_t;
|
||||
|
||||
#elif defined(__BEOS__)
|
||||
|
||||
/* Be */
|
||||
# include <inttypes.h>
|
||||
typedef int16_t spx_int16_t;
|
||||
typedef u_int16_t spx_uint16_t;
|
||||
typedef int32_t spx_int32_t;
|
||||
typedef u_int32_t spx_uint32_t;
|
||||
|
||||
#elif defined (__EMX__)
|
||||
|
||||
/* OS/2 GCC */
|
||||
typedef short spx_int16_t;
|
||||
typedef unsigned short spx_uint16_t;
|
||||
typedef int spx_int32_t;
|
||||
typedef unsigned int spx_uint32_t;
|
||||
|
||||
#elif defined (DJGPP)
|
||||
|
||||
/* DJGPP */
|
||||
typedef short spx_int16_t;
|
||||
typedef int spx_int32_t;
|
||||
typedef unsigned int spx_uint32_t;
|
||||
|
||||
#elif defined(R5900)
|
||||
|
||||
/* PS2 EE */
|
||||
typedef int spx_int32_t;
|
||||
typedef unsigned spx_uint32_t;
|
||||
typedef short spx_int16_t;
|
||||
|
||||
#elif defined(__SYMBIAN32__)
|
||||
|
||||
/* Symbian GCC */
|
||||
typedef signed short spx_int16_t;
|
||||
typedef unsigned short spx_uint16_t;
|
||||
typedef signed int spx_int32_t;
|
||||
typedef unsigned int spx_uint32_t;
|
||||
|
||||
#elif defined(CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
|
||||
|
||||
typedef short spx_int16_t;
|
||||
typedef unsigned short spx_uint16_t;
|
||||
typedef long spx_int32_t;
|
||||
typedef unsigned long spx_uint32_t;
|
||||
|
||||
#elif defined(CONFIG_TI_C6X)
|
||||
|
||||
typedef short spx_int16_t;
|
||||
typedef unsigned short spx_uint16_t;
|
||||
typedef int spx_int32_t;
|
||||
typedef unsigned int spx_uint32_t;
|
||||
|
||||
#else
|
||||
|
||||
#include "speexdsp_config_types.h"
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _SPEEX_TYPES_H */
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
from waflib import Utils
|
||||
import os
|
||||
|
||||
top = '.'
|
||||
PROJECT_NAME = 'vaudio_speex'
|
||||
|
||||
def options(opt):
|
||||
# stub
|
||||
return
|
||||
|
||||
def configure(conf):
|
||||
conf.define('SPEEX_EXPORTS',1)
|
||||
# conf.define('NO_HOOK_MALLOC',1)
|
||||
|
||||
def build(bld):
|
||||
source = [
|
||||
'VoiceEncoder_Speex.cpp',
|
||||
'../frame_encoder/voice_codec_frame.cpp',
|
||||
'../../../tier1/interface.cpp'
|
||||
]
|
||||
|
||||
includes = [
|
||||
'.',
|
||||
'../frame_encoder',
|
||||
'../../../public',
|
||||
'../../../public/tier1',
|
||||
'../../../public/tier0',
|
||||
'../../',
|
||||
'../../../common',
|
||||
'../../audio/public'
|
||||
]
|
||||
|
||||
defines = []
|
||||
|
||||
libs = ['tier0','tier1','vstdlib','SPEEX']
|
||||
|
||||
install_path = bld.env.LIBDIR
|
||||
|
||||
bld.shlib(
|
||||
source = source,
|
||||
target = PROJECT_NAME,
|
||||
name = PROJECT_NAME,
|
||||
features = 'c cxx',
|
||||
includes = includes,
|
||||
defines = defines,
|
||||
use = libs,
|
||||
install_path = install_path,
|
||||
subsystem = bld.env.MSVC_SUBSYSTEM,
|
||||
idx = bld.get_taskgen_count()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user