[xiph-commits] r7119 - in branches/rel-1-0-branch/speex: . include
jm at dactyl.lonelymoon.com
jm
Tue Jul 13 23:03:23 PDT 2004
include/speex libspeex src
Message-ID: <20040714060323.C77AD9AAAB at dactyl.lonelymoon.com>
Author: jm
Date: Tue Jul 13 23:03:23 2004
New Revision: 7119
Added:
branches/rel-1-0-branch/speex/include/
branches/rel-1-0-branch/speex/include/Makefile.am
branches/rel-1-0-branch/speex/include/speex.h
branches/rel-1-0-branch/speex/include/speex/
branches/rel-1-0-branch/speex/include/speex/Makefile.am
branches/rel-1-0-branch/speex/include/speex/speex.h
branches/rel-1-0-branch/speex/include/speex/speex_bits.h
branches/rel-1-0-branch/speex/include/speex/speex_callbacks.h
branches/rel-1-0-branch/speex/include/speex/speex_header.h
branches/rel-1-0-branch/speex/include/speex/speex_stereo.h
branches/rel-1-0-branch/speex/include/speex_bits.h
branches/rel-1-0-branch/speex/include/speex_callbacks.h
branches/rel-1-0-branch/speex/include/speex_header.h
branches/rel-1-0-branch/speex/include/speex_stereo.h
branches/rel-1-0-branch/speex/speex.m4
branches/rel-1-0-branch/speex/speex.pc.in
Removed:
branches/rel-1-0-branch/speex/libspeex/speex.h
branches/rel-1-0-branch/speex/libspeex/speex_bits.h
branches/rel-1-0-branch/speex/libspeex/speex_callbacks.h
branches/rel-1-0-branch/speex/libspeex/speex_header.h
branches/rel-1-0-branch/speex/libspeex/speex_stereo.h
Modified:
branches/rel-1-0-branch/speex/Makefile.am
branches/rel-1-0-branch/speex/Speex.spec.in
branches/rel-1-0-branch/speex/configure.in
branches/rel-1-0-branch/speex/libspeex/Makefile.am
branches/rel-1-0-branch/speex/libspeex/bits.c
branches/rel-1-0-branch/speex/libspeex/cb_search.h
branches/rel-1-0-branch/speex/libspeex/ltp.c
branches/rel-1-0-branch/speex/libspeex/ltp.h
branches/rel-1-0-branch/speex/libspeex/misc.h
branches/rel-1-0-branch/speex/libspeex/modes.c
branches/rel-1-0-branch/speex/libspeex/modes.h
branches/rel-1-0-branch/speex/libspeex/nb_celp.c
branches/rel-1-0-branch/speex/libspeex/nb_celp.h
branches/rel-1-0-branch/speex/libspeex/quant_lsp.h
branches/rel-1-0-branch/speex/libspeex/sb_celp.c
branches/rel-1-0-branch/speex/libspeex/sb_celp.h
branches/rel-1-0-branch/speex/libspeex/speex_callbacks.c
branches/rel-1-0-branch/speex/libspeex/speex_header.c
branches/rel-1-0-branch/speex/libspeex/stereo.c
branches/rel-1-0-branch/speex/libspeex/testenc.c
branches/rel-1-0-branch/speex/libspeex/testenc_uwb.c
branches/rel-1-0-branch/speex/libspeex/testenc_wb.c
branches/rel-1-0-branch/speex/src/Makefile.am
branches/rel-1-0-branch/speex/src/speexdec.c
branches/rel-1-0-branch/speex/src/speexenc.c
Log:
Moved includes to /usr/include/speex, backported gapless support
Modified: branches/rel-1-0-branch/speex/Makefile.am
===================================================================
--- branches/rel-1-0-branch/speex/Makefile.am 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/Makefile.am 2004-07-14 06:03:21 UTC (rev 7119)
@@ -3,9 +3,17 @@
# Disable automatic dependency tracking if using other tools than gcc and gmake
#AUTOMAKE_OPTIONS = no-dependencies
-EXTRA_DIST = Speex.spec Speex.spec.in
+m4datadir = $(datadir)/aclocal
+m4data_DATA = speex.m4
-SUBDIRS = libspeex @src@ doc win32
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = speex.pc
+EXTRA_DIST = Speex.spec Speex.spec.in speex.m4 speex.pc.in
+
+SUBDIRS = libspeex include @src@ doc win32
+
+DIST_SUBDIRS = libspeex include src doc win32
+
rpm: dist
rpmbuild -ta ${PACKAGE}-${VERSION}.tar.gz
Modified: branches/rel-1-0-branch/speex/Speex.spec.in
===================================================================
--- branches/rel-1-0-branch/speex/Speex.spec.in 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/Speex.spec.in 2004-07-14 06:03:21 UTC (rev 7119)
@@ -65,4 +65,7 @@
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/libspeex*.la
%{_includedir}/speex*.h
+%{_includedir}/speex/speex*.h
+/usr/share/aclocal/speex.m4
+%{_libdir}/pkgconfig/speex.pc
%{_libdir}/libspeex*.a
Modified: branches/rel-1-0-branch/speex/configure.in
===================================================================
--- branches/rel-1-0-branch/speex/configure.in 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/configure.in 2004-07-14 06:03:21 UTC (rev 7119)
@@ -1,15 +1,16 @@
dnl Process this file with autoconf to produce a configure script. -*-m4-*-
-AC_INIT(libspeex/speex.h)
+AC_INIT(libspeex/nb_celp.c)
SPEEX_MAJOR_VERSION=1
SPEEX_MINOR_VERSION=0
SPEEX_MICRO_VERSION=4
-SPEEX_VERSION=1.0.4
+SPEEX_EXTRA_VERSION=
+SPEEX_VERSION=$SPEEX_MAJOR_VERSION.$SPEEX_MINOR_VERSION.$SPEEX_MICRO_VERSION$SPEEX_EXTRA_VERSION
-SPEEX_LT_CURRENT=2
-SPEEX_LT_REVISION=3
-SPEEX_LT_AGE=1
+SPEEX_LT_CURRENT=3
+SPEEX_LT_REVISION=0
+SPEEX_LT_AGE=2
AC_SUBST(SPEEX_LT_CURRENT)
AC_SUBST(SPEEX_LT_REVISION)
@@ -51,13 +52,19 @@
AC_CHECK_LIB(m, sin)
AC_CHECK_LIB(gnugetopt, getopt_long)
-AC_DEFINE_UNQUOTED(VERSION, "${VERSION}")
+AC_DEFINE_UNQUOTED(SPEEX_VERSION, "${SPEEX_VERSION}")
+AC_DEFINE_UNQUOTED(SPEEX_MAJOR_VERSION, ${SPEEX_MAJOR_VERSION})
+AC_DEFINE_UNQUOTED(SPEEX_MINOR_VERSION, ${SPEEX_MINOR_VERSION})
+AC_DEFINE_UNQUOTED(SPEEX_MICRO_VERSION, ${SPEEX_MICRO_VERSION})
+AC_DEFINE_UNQUOTED(SPEEX_EXTRA_VERSION, "${SPEEX_EXTRA_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
+ include/Makefile include/speex/Makefile speex.pc
win32/Makefile win32/libspeex/Makefile win32/speexenc/Makefile
win32/speexdec/Makefile ])
Added: branches/rel-1-0-branch/speex/include/Makefile.am
===================================================================
--- branches/rel-1-0-branch/speex/include/Makefile.am 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/include/Makefile.am 2004-07-14 06:03:21 UTC (rev 7119)
@@ -0,0 +1,9 @@
+
+SUBDIRS = speex
+
+include_HEADERS = speex.h \
+ speex_bits.h \
+ speex_header.h \
+ speex_callbacks.h \
+ speex_stereo.h
+
Added: branches/rel-1-0-branch/speex/include/speex/Makefile.am
===================================================================
--- branches/rel-1-0-branch/speex/include/speex/Makefile.am 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/include/speex/Makefile.am 2004-07-14 06:03:21 UTC (rev 7119)
@@ -0,0 +1,9 @@
+# Disable automatic dependency tracking if using other tools than gcc and gmake
+#AUTOMAKE_OPTIONS = no-dependencies
+
+pkginclude_HEADERS = speex.h \
+ speex_bits.h \
+ speex_header.h \
+ speex_callbacks.h \
+ speex_stereo.h
+
Copied: branches/rel-1-0-branch/speex/include/speex/speex.h (from rev 6146, branches/rel-1-0-branch/speex/libspeex/speex.h)
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/speex.h 2004-03-21 06:22:48 UTC (rev 6146)
+++ branches/rel-1-0-branch/speex/include/speex/speex.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -0,0 +1,344 @@
+/* Copyright (C) 2002 Jean-Marc Valin*/
+/**
+ @file speex.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 SPEEX_H
+#define SPEEX_H
+
+#include "speex_bits.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Values allowed for *ctl() requests */
+
+/** Set enhancement on/off (decoder only) */
+#define SPEEX_SET_ENH 0
+/** Get enhancement state (decoder only) */
+#define SPEEX_GET_ENH 1
+
+/*Would be SPEEX_SET_FRAME_SIZE, but it's (currently) invalid*/
+/** Obtain frame size used by encoder/decoder */
+#define SPEEX_GET_FRAME_SIZE 3
+
+/** Set quality value */
+#define SPEEX_SET_QUALITY 4
+/** Get current quality setting */
+#define SPEEX_GET_QUALITY 5
+
+/** Set sub-mode to use */
+#define SPEEX_SET_MODE 6
+/** Get current sub-mode in use */
+#define SPEEX_GET_MODE 7
+
+/** Set low-band sub-mode to use (wideband only)*/
+#define SPEEX_SET_LOW_MODE 8
+/** Get current low-band mode in use (wideband only)*/
+#define SPEEX_GET_LOW_MODE 9
+
+/** Set high-band sub-mode to use (wideband only)*/
+#define SPEEX_SET_HIGH_MODE 10
+/** Get current high-band mode in use (wideband only)*/
+#define SPEEX_GET_HIGH_MODE 11
+
+/** Set VBR on (1) or off (0) */
+#define SPEEX_SET_VBR 12
+/** Get VBR status (1 for on, 0 for off) */
+#define SPEEX_GET_VBR 13
+
+/** Set quality value for VBR encoding (0-10) */
+#define SPEEX_SET_VBR_QUALITY 14
+/** Get current quality value for VBR encoding (0-10) */
+#define SPEEX_GET_VBR_QUALITY 15
+
+/** Set complexity of the encoder (0-10) */
+#define SPEEX_SET_COMPLEXITY 16
+/** Get current complexity of the encoder (0-10) */
+#define SPEEX_GET_COMPLEXITY 17
+
+/** Set bit-rate used by the encoder (or lower) */
+#define SPEEX_SET_BITRATE 18
+/** 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 SPEEX_SET_HANDLER 20
+
+/**Define a handler function for in-band user-defined request*/
+#define SPEEX_SET_USER_HANDLER 22
+
+/** Set sampling rate used in bit-rate computation */
+#define SPEEX_SET_SAMPLING_RATE 24
+/** Get sampling rate used in bit-rate computation */
+#define SPEEX_GET_SAMPLING_RATE 25
+
+/** Reset the encoder/decoder memories to zero*/
+#define SPEEX_RESET_STATE 26
+
+/** Get VBR info (mostly used internally) */
+#define SPEEX_GET_RELATIVE_QUALITY 29
+
+/** Set VAD status (1 for on, 0 for off) */
+#define SPEEX_SET_VAD 30
+
+/** Get VAD status (1 for on, 0 for off) */
+#define SPEEX_GET_VAD 31
+
+/** Set Average Bit-Rate (ABR) to n bits per seconds */
+#define SPEEX_SET_ABR 32
+/** Get Average Bit-Rate (ABR) setting (in bps) */
+#define SPEEX_GET_ABR 33
+
+/** Set DTX status (1 for on, 0 for off) */
+#define SPEEX_SET_DTX 34
+/** Get DTX status (1 for on, 0 for off) */
+#define SPEEX_GET_DTX 35
+
+/* 36 and 37 aren't supported in this version */
+#define SPEEX_GET_LOOKAHEAD 39
+
+
+/* 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
+
+
+/* Preserving compatibility:*/
+/** Equivalent to SPEEX_SET_ENH */
+#define SPEEX_SET_PF 0
+/** Equivalent to SPEEX_GET_ENH */
+#define SPEEX_GET_PF 1
+
+
+/* Values allowed for mode queries */
+/** Query the frame size of a mode */
+#define SPEEX_MODE_FRAME_SIZE 0
+
+/** Query the size of an encoded frame for a particular sub-mode */
+#define SPEEX_SUBMODE_BITS_PER_FRAME 1
+
+#define SPEEX_LIB_GET_MAJOR_VERSION 1
+#define SPEEX_LIB_GET_MINOR_VERSION 3
+#define SPEEX_LIB_GET_MICRO_VERSION 5
+#define SPEEX_LIB_GET_EXTRA_VERSION 7
+#define SPEEX_LIB_GET_VERSION_STRING 9
+
+/** Number of defined modes in Speex */
+#define SPEEX_NB_MODES 3
+
+struct SpeexMode;
+
+
+/* Prototypes for mode function pointers */
+
+/** Encoder state initialization function */
+typedef void *(*encoder_init_func)(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);
+
+/** 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);
+
+/** Decoder state destruction function */
+typedef void (*decoder_destroy_func)(void *st);
+
+/** Main decoding function */
+typedef int (*decode_func)(void *state, SpeexBits *bits, float *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);
+
+/** Struct defining a Speex mode */
+typedef struct SpeexMode {
+ /** Pointer to the low-level mode data */
+ 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;
+
+ /**ID of the mode*/
+ int modeID;
+
+ /**Version number of the bitstream (incremented every time we break
+ bitstream compatibility*/
+ int bitstream_version;
+
+ /** Pointer to encoder initialization function */
+ encoder_init_func enc_init;
+
+ /** Pointer to encoder destruction function */
+ encoder_destroy_func enc_destroy;
+
+ /** Pointer to frame encoding function */
+ encode_func enc;
+
+ /** Pointer to decoder initialization function */
+ decoder_init_func dec_init;
+
+ /** Pointer to decoder destruction function */
+ decoder_destroy_func dec_destroy;
+
+ /** Pointer to frame decoding function */
+ decode_func dec;
+
+ /** ioctl-like requests for encoder */
+ encoder_ctl_func enc_ctl;
+
+ /** ioctl-like requests for decoder */
+ decoder_ctl_func dec_ctl;
+
+} 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
+ * 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
+ */
+void *speex_encoder_init(SpeexMode *mode);
+
+/** 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 bits Bit-stream where the data will be written
+ */
+int speex_encode(void *state, float *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
+ */
+int speex_encoder_ctl(void *state, int request, void *ptr);
+
+
+/** 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);
+
+/** Frees all resources associated to an existing decoder state.
+ *
+ * @param state State to be destroyed
+ */
+void speex_decoder_destroy(void *state);
+
+/** 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 other)
+ */
+int speex_decode(void *state, SpeexBits *bits, float *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
+ */
+int speex_decoder_ctl(void *state, int request, void *ptr);
+
+
+/** Query function for mode information
+ *
+ * @param mode Speex mode
+ * @param request ioctl-type request (one of the SPEEX_* macros)
+ * @param ptr Data exchanged to-from function
+ */
+int speex_mode_query(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
+ * */
+int speex_lib_ctl(int request, void *ptr);
+
+/** Default narrowband mode */
+extern SpeexMode speex_nb_mode;
+
+/** Default wideband mode */
+extern SpeexMode speex_wb_mode;
+
+/** Default "ultra-wideband" mode */
+extern SpeexMode speex_uwb_mode;
+
+/** List of all modes available */
+extern SpeexMode *speex_mode_list[SPEEX_NB_MODES];
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
Copied: branches/rel-1-0-branch/speex/include/speex/speex_bits.h (from rev 6146, branches/rel-1-0-branch/speex/libspeex/speex_bits.h)
Copied: branches/rel-1-0-branch/speex/include/speex/speex_callbacks.h (from rev 6146, branches/rel-1-0-branch/speex/libspeex/speex_callbacks.h)
Copied: branches/rel-1-0-branch/speex/include/speex/speex_header.h (from rev 6146, branches/rel-1-0-branch/speex/libspeex/speex_header.h)
Copied: branches/rel-1-0-branch/speex/include/speex/speex_stereo.h (from rev 6146, branches/rel-1-0-branch/speex/libspeex/speex_stereo.h)
Added: branches/rel-1-0-branch/speex/include/speex.h
===================================================================
--- branches/rel-1-0-branch/speex/include/speex.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/include/speex.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -0,0 +1 @@
+#include <speex/speex.h>
Added: branches/rel-1-0-branch/speex/include/speex_bits.h
===================================================================
--- branches/rel-1-0-branch/speex/include/speex_bits.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/include/speex_bits.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -0,0 +1 @@
+#include <speex/speex_bits.h>
Added: branches/rel-1-0-branch/speex/include/speex_callbacks.h
===================================================================
--- branches/rel-1-0-branch/speex/include/speex_callbacks.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/include/speex_callbacks.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -0,0 +1 @@
+#include <speex/speex_callbacks.h>
Added: branches/rel-1-0-branch/speex/include/speex_header.h
===================================================================
--- branches/rel-1-0-branch/speex/include/speex_header.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/include/speex_header.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -0,0 +1 @@
+#include <speex/speex_header.h>
Added: branches/rel-1-0-branch/speex/include/speex_stereo.h
===================================================================
--- branches/rel-1-0-branch/speex/include/speex_stereo.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/include/speex_stereo.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -0,0 +1 @@
+#include <speex/speex_stereo.h>
Modified: branches/rel-1-0-branch/speex/libspeex/Makefile.am
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/Makefile.am 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/Makefile.am 2004-07-14 06:03:21 UTC (rev 7119)
@@ -5,6 +5,8 @@
# Disable automatic dependency tracking if using other tools than gcc and gmake
#AUTOMAKE_OPTIONS = no-dependencies
+INCLUDES = -I$(top_srcdir)/include
+
lib_LTLIBRARIES = libspeex.la
# Sources for compilation in the library
@@ -39,12 +41,6 @@
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 \
Modified: branches/rel-1-0-branch/speex/libspeex/bits.c
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/bits.c 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/bits.c 2004-07-14 06:03:21 UTC (rev 7119)
@@ -32,7 +32,7 @@
*/
-#include "speex_bits.h"
+#include <speex/speex_bits.h>
#include "misc.h"
void speex_bits_init(SpeexBits *bits)
Modified: branches/rel-1-0-branch/speex/libspeex/cb_search.h
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/cb_search.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/cb_search.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -33,7 +33,7 @@
#ifndef CB_SEARCH_H
#define CB_SEARCH_H
-#include "speex_bits.h"
+#include <speex/speex_bits.h>
typedef struct split_cb_params {
int subvect_size;
Modified: branches/rel-1-0-branch/speex/libspeex/ltp.c
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/ltp.c 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/ltp.c 2004-07-14 06:03:21 UTC (rev 7119)
@@ -34,7 +34,7 @@
#include "ltp.h"
#include "stack_alloc.h"
#include "filters.h"
-#include "speex_bits.h"
+#include <speex/speex_bits.h>
#ifdef _USE_SSE
#include "ltp_sse.h"
Modified: branches/rel-1-0-branch/speex/libspeex/ltp.h
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/ltp.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/ltp.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -30,7 +30,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "speex_bits.h"
+#include <speex/speex_bits.h>
typedef struct ltp_params {
Modified: branches/rel-1-0-branch/speex/libspeex/misc.h
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/misc.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/misc.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -35,8 +35,12 @@
#ifndef MISC_H
#define MISC_H
-#ifndef VERSION
-#define VERSION "speex-1.0.3"
+#ifndef SPEEX_VERSION
+#define SPEEX_MAJOR_VERSION 1
+#define SPEEX_MINOR_VERSION 0
+#define SPEEX_MICRO_VERSION 4
+#define SPEEX_EXTRA_VERSION ""
+#define SPEEX_VERSION "speex-1.0.4"
#endif
/*Disable some warnings on VC++*/
Modified: branches/rel-1-0-branch/speex/libspeex/modes.c
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/modes.c 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/modes.c 2004-07-14 06:03:21 UTC (rev 7119)
@@ -648,3 +648,38 @@
{
return mode->query(mode->mode, request, ptr);
}
+
+int speex_lib_ctl(int request, void *ptr)
+{
+ switch (request)
+ {
+ case SPEEX_LIB_GET_MAJOR_VERSION:
+ *((int*)ptr) = SPEEX_MAJOR_VERSION;
+ break;
+ case SPEEX_LIB_GET_MINOR_VERSION:
+ *((int*)ptr) = SPEEX_MINOR_VERSION;
+ break;
+ case SPEEX_LIB_GET_MICRO_VERSION:
+ *((int*)ptr) = SPEEX_MICRO_VERSION;
+ break;
+ case SPEEX_LIB_GET_EXTRA_VERSION:
+ *((char**)ptr) = SPEEX_EXTRA_VERSION;
+ break;
+ case SPEEX_LIB_GET_VERSION_STRING:
+ *((char**)ptr) = SPEEX_VERSION;
+ break;
+ /*case SPEEX_LIB_SET_ALLOC_FUNC:
+ break;
+ case SPEEX_LIB_GET_ALLOC_FUNC:
+ break;
+ case SPEEX_LIB_SET_FREE_FUNC:
+ break;
+ case SPEEX_LIB_GET_FREE_FUNC:
+ break;*/
+ default:
+ speex_warning_int("Unknown wb_mode_query request: ", request);
+ return -1;
+ break;
+ }
+ return 0;
+}
Modified: branches/rel-1-0-branch/speex/libspeex/modes.h
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/modes.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/modes.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -36,8 +36,8 @@
#ifndef MODES_H
#define MODES_H
-#include "speex.h"
-#include "speex_bits.h"
+#include <speex/speex.h>
+#include <speex/speex_bits.h>
#define NB_SUBMODES 16
Modified: branches/rel-1-0-branch/speex/libspeex/nb_celp.c
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/nb_celp.c 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/nb_celp.c 2004-07-14 06:03:21 UTC (rev 7119)
@@ -39,10 +39,10 @@
#include "filters.h"
#include "stack_alloc.h"
#include "vq.h"
-#include "speex_bits.h"
+#include <speex/speex_bits.h>
#include "vbr.h"
#include "misc.h"
-#include "speex_callbacks.h"
+#include <speex/speex_callbacks.h>
#ifdef SLOW_TRIG
#include "math_approx.h"
@@ -1590,6 +1590,9 @@
st->excBuf[i]=st->swBuf[i]=st->inBuf[i]=st->exc2Buf[i]=0;
}
break;
+ case SPEEX_GET_LOOKAHEAD:
+ (*(int*)ptr)=(st->windowSize-st->frameSize);
+ break;
case SPEEX_GET_PI_GAIN:
{
int i;
Modified: branches/rel-1-0-branch/speex/libspeex/nb_celp.h
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/nb_celp.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/nb_celp.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -37,8 +37,8 @@
#define NB_CELP_H
#include "modes.h"
-#include "speex_bits.h"
-#include "speex_callbacks.h"
+#include <speex/speex_bits.h>
+#include <speex/speex_callbacks.h>
#include "vbr.h"
#include "filters.h"
Modified: branches/rel-1-0-branch/speex/libspeex/quant_lsp.h
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/quant_lsp.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/quant_lsp.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -33,7 +33,7 @@
#ifndef QUANT_LSP_H
#define QUANT_LSP_H
-#include "speex_bits.h"
+#include <speex/speex_bits.h>
#define MAX_LSP_SIZE 20
Modified: branches/rel-1-0-branch/speex/libspeex/sb_celp.c
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/sb_celp.c 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/sb_celp.c 2004-07-14 06:03:21 UTC (rev 7119)
@@ -1207,6 +1207,10 @@
st->h0_mem[i]=st->h1_mem[i]=st->g0_mem[i]=st->g1_mem[i]=0;
}
break;
+ case SPEEX_GET_LOOKAHEAD:
+ speex_encoder_ctl(st->st_low, SPEEX_GET_LOOKAHEAD, ptr);
+ (*(int*)ptr) = 2*(*(int*)ptr) + QMF_ORDER - 1;
+ break;
case SPEEX_GET_PI_GAIN:
{
int i;
Modified: branches/rel-1-0-branch/speex/libspeex/sb_celp.h
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/sb_celp.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/sb_celp.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -37,7 +37,7 @@
#define SB_CELP_H
#include "modes.h"
-#include "speex_bits.h"
+#include <speex/speex_bits.h>
#include "nb_celp.h"
/**Structure representing the full state of the sub-band encoder*/
Deleted: branches/rel-1-0-branch/speex/libspeex/speex.h
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/speex.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/speex.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -1,331 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin*/
-/**
- @file speex.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 SPEEX_H
-#define SPEEX_H
-
-#include "speex_bits.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Values allowed for *ctl() requests */
-
-/** Set enhancement on/off (decoder only) */
-#define SPEEX_SET_ENH 0
-/** Get enhancement state (decoder only) */
-#define SPEEX_GET_ENH 1
-
-/*Would be SPEEX_SET_FRAME_SIZE, but it's (currently) invalid*/
-/** Obtain frame size used by encoder/decoder */
-#define SPEEX_GET_FRAME_SIZE 3
-
-/** Set quality value */
-#define SPEEX_SET_QUALITY 4
-/** Get current quality setting */
-#define SPEEX_GET_QUALITY 5
-
-/** Set sub-mode to use */
-#define SPEEX_SET_MODE 6
-/** Get current sub-mode in use */
-#define SPEEX_GET_MODE 7
-
-/** Set low-band sub-mode to use (wideband only)*/
-#define SPEEX_SET_LOW_MODE 8
-/** Get current low-band mode in use (wideband only)*/
-#define SPEEX_GET_LOW_MODE 9
-
-/** Set high-band sub-mode to use (wideband only)*/
-#define SPEEX_SET_HIGH_MODE 10
-/** Get current high-band mode in use (wideband only)*/
-#define SPEEX_GET_HIGH_MODE 11
-
-/** Set VBR on (1) or off (0) */
-#define SPEEX_SET_VBR 12
-/** Get VBR status (1 for on, 0 for off) */
-#define SPEEX_GET_VBR 13
-
-/** Set quality value for VBR encoding (0-10) */
-#define SPEEX_SET_VBR_QUALITY 14
-/** Get current quality value for VBR encoding (0-10) */
-#define SPEEX_GET_VBR_QUALITY 15
-
-/** Set complexity of the encoder (0-10) */
-#define SPEEX_SET_COMPLEXITY 16
-/** Get current complexity of the encoder (0-10) */
-#define SPEEX_GET_COMPLEXITY 17
-
-/** Set bit-rate used by the encoder (or lower) */
-#define SPEEX_SET_BITRATE 18
-/** 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 SPEEX_SET_HANDLER 20
-
-/**Define a handler function for in-band user-defined request*/
-#define SPEEX_SET_USER_HANDLER 22
-
-/** Set sampling rate used in bit-rate computation */
-#define SPEEX_SET_SAMPLING_RATE 24
-/** Get sampling rate used in bit-rate computation */
-#define SPEEX_GET_SAMPLING_RATE 25
-
-/** Reset the encoder/decoder memories to zero*/
-#define SPEEX_RESET_STATE 26
-
-/** Get VBR info (mostly used internally) */
-#define SPEEX_GET_RELATIVE_QUALITY 29
-
-/** Set VAD status (1 for on, 0 for off) */
-#define SPEEX_SET_VAD 30
-
-/** Get VAD status (1 for on, 0 for off) */
-#define SPEEX_GET_VAD 31
-
-/** Set Average Bit-Rate (ABR) to n bits per seconds */
-#define SPEEX_SET_ABR 32
-/** Get Average Bit-Rate (ABR) setting (in bps) */
-#define SPEEX_GET_ABR 33
-
-/** Set DTX status (1 for on, 0 for off) */
-#define SPEEX_SET_DTX 34
-/** Get DTX status (1 for on, 0 for off) */
-#define SPEEX_GET_DTX 35
-
-
-/* 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
-
-
-/* Preserving compatibility:*/
-/** Equivalent to SPEEX_SET_ENH */
-#define SPEEX_SET_PF 0
-/** Equivalent to SPEEX_GET_ENH */
-#define SPEEX_GET_PF 1
-
-
-/* Values allowed for mode queries */
-/** Query the frame size of a mode */
-#define SPEEX_MODE_FRAME_SIZE 0
-
-/** Query the size of an encoded frame for a particular sub-mode */
-#define SPEEX_SUBMODE_BITS_PER_FRAME 1
-
-
-/** Number of defined modes in Speex */
-#define SPEEX_NB_MODES 3
-
-struct SpeexMode;
-
-
-/* Prototypes for mode function pointers */
-
-/** Encoder state initialization function */
-typedef void *(*encoder_init_func)(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);
-
-/** 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);
-
-/** Decoder state destruction function */
-typedef void (*decoder_destroy_func)(void *st);
-
-/** Main decoding function */
-typedef int (*decode_func)(void *state, SpeexBits *bits, float *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);
-
-/** Struct defining a Speex mode */
-typedef struct SpeexMode {
- /** Pointer to the low-level mode data */
- 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;
-
- /**ID of the mode*/
- int modeID;
-
- /**Version number of the bitstream (incremented every time we break
- bitstream compatibility*/
- int bitstream_version;
-
- /** Pointer to encoder initialization function */
- encoder_init_func enc_init;
-
- /** Pointer to encoder destruction function */
- encoder_destroy_func enc_destroy;
-
- /** Pointer to frame encoding function */
- encode_func enc;
-
- /** Pointer to decoder initialization function */
- decoder_init_func dec_init;
-
- /** Pointer to decoder destruction function */
- decoder_destroy_func dec_destroy;
-
- /** Pointer to frame decoding function */
- decode_func dec;
-
- /** ioctl-like requests for encoder */
- encoder_ctl_func enc_ctl;
-
- /** ioctl-like requests for decoder */
- decoder_ctl_func dec_ctl;
-
-} 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
- * 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
- */
-void *speex_encoder_init(SpeexMode *mode);
-
-/** 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 bits Bit-stream where the data will be written
- */
-int speex_encode(void *state, float *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
- */
-int speex_encoder_ctl(void *state, int request, void *ptr);
-
-
-/** 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);
-
-/** Frees all resources associated to an existing decoder state.
- *
- * @param state State to be destroyed
- */
-void speex_decoder_destroy(void *state);
-
-/** 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 other)
- */
-int speex_decode(void *state, SpeexBits *bits, float *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
- */
-int speex_decoder_ctl(void *state, int request, void *ptr);
-
-
-/** Query function for mode information
- *
- * @param mode Speex mode
- * @param request ioctl-type request (one of the SPEEX_* macros)
- * @param ptr Data exchanged to-from function
- */
-int speex_mode_query(SpeexMode *mode, int request, void *ptr);
-
-
-/** Default narrowband mode */
-extern SpeexMode speex_nb_mode;
-
-/** Default wideband mode */
-extern SpeexMode speex_wb_mode;
-
-/** Default "ultra-wideband" mode */
-extern SpeexMode speex_uwb_mode;
-
-/** List of all modes available */
-extern SpeexMode *speex_mode_list[SPEEX_NB_MODES];
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
Deleted: branches/rel-1-0-branch/speex/libspeex/speex_bits.h
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/speex_bits.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/speex_bits.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -1,154 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file speex_bits.h
- @brief 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.
-
-*/
-
-#ifndef BITS_H
-#define BITS_H
-
-#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 */
- 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 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 */
- void *reserved2; /**< Reserved for future use */
-} SpeexBits;
-
-/** Initializes and allocates resources for a SpeexBits struct */
-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);
-
-/** 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);
-
-/** Resets bits to initial value (just after initialization, erasing content)*/
-void speex_bits_reset(SpeexBits *bits);
-
-/** Rewind the bit-stream to the beginning (ready for read) without erasing the content */
-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);
-
-/** 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);
-
-/** Write the content of a bit-stream to an area of memory */
-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 */
-int speex_bits_write_whole_bytes(SpeexBits *bits, char *bytes, int max_len);
-
-/** Append bits to the bit-stream
- * @param bits Bit-stream to operate on
- * @param data Value to append as integer
- * @param nbBits number of bits to consider in "data"
- */
-void speex_bits_pack(SpeexBits *bits, int data, int nbBits);
-
-/** Interpret the next bits in the bit-stream as a signed integer
- *
- * @param bits Bit-stream to operate on
- * @param nbBits Number of bits to interpret
- * @return A signed integer represented by the bits read
- */
-int speex_bits_unpack_signed(SpeexBits *bits, int nbBits);
-
-/** Interpret the next bits in the bit-stream as an unsigned integer
- *
- * @param bits Bit-stream to operate on
- * @param nbBits Number of bits to interpret
- * @return An unsigned integer represented by the bits read
- */
-unsigned int speex_bits_unpack_unsigned(SpeexBits *bits, int nbBits);
-
-/** Returns the number of bytes in the bit-stream, including the last one even if it is not "full"
- *
- * @param bits Bit-stream to operate on
- * @return Number of bytes in the stream
- */
-int speex_bits_nbytes(SpeexBits *bits);
-
-/** Same as speex_bits_unpack_unsigned, but without modifying the cursor position */
-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
- *
- * @param bits Bit-stream to operate on
- */
-int speex_bits_peek(SpeexBits *bits);
-
-/** Advances the position of the "bit cursor" in the stream
- *
- * @param bits Bit-stream to operate on
- * @param n Number of bits to advance
- */
-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
- */
-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
- *
- * @param bits Bit-stream to operate on
- */
-void speex_bits_insert_terminator(SpeexBits *bits);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
Modified: branches/rel-1-0-branch/speex/libspeex/speex_callbacks.c
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/speex_callbacks.c 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/speex_callbacks.c 2004-07-14 06:03:21 UTC (rev 7119)
@@ -32,7 +32,7 @@
*/
-#include "speex_callbacks.h"
+#include <speex/speex_callbacks.h>
#include "misc.h"
int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state)
Deleted: branches/rel-1-0-branch/speex/libspeex/speex_callbacks.h
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/speex_callbacks.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/speex_callbacks.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -1,128 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin*/
-/**
- @file speex_callbacks.h
- @brief Describes 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.
-
-*/
-
-#ifndef SPEEX_CALLBACKS_H
-#define SPEEX_CALLBACKS_H
-
-#include "speex.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Total number of callbacks */
-#define SPEEX_MAX_CALLBACKS 16
-
-/* Describes all the in-band requests */
-
-/*These are 1-bit requests*/
-/** Request for perceptual enhancement (1 for on, 0 for off) */
-#define SPEEX_INBAND_ENH_REQUEST 0
-/** Reserved */
-#define SPEEX_INBAND_RESERVED1 1
-
-/*These are 4-bit requests*/
-/** Request for a mode change */
-#define SPEEX_INBAND_MODE_REQUEST 2
-/** Request for a low mode change */
-#define SPEEX_INBAND_LOW_MODE_REQUEST 3
-/** Request for a high mode change */
-#define SPEEX_INBAND_HIGH_MODE_REQUEST 4
-/** Request for VBR (1 on, 0 off) */
-#define SPEEX_INBAND_VBR_QUALITY_REQUEST 5
-/** Request to be sent acknowledge */
-#define SPEEX_INBAND_ACKNOWLEDGE_REQUEST 6
-/** Request for VBR (1 for on, 0 for off) */
-#define SPEEX_INBAND_VBR_REQUEST 7
-
-/*These are 8-bit requests*/
-/** Send a character in-band */
-#define SPEEX_INBAND_CHAR 8
-/** Intensity stereo information */
-#define SPEEX_INBAND_STEREO 9
-
-/*These are 16-bit requests*/
-/** Transmit max bit-rate allowed */
-#define SPEEX_INBAND_MAX_BITRATE 10
-
-/*These are 32-bit requests*/
-/** Acknowledge packet reception */
-#define SPEEX_INBAND_ACKNOWLEDGE 12
-
-/** Callback function type */
-typedef int (*speex_callback_func)(SpeexBits *bits, void *state, void *data);
-
-/** Callback information */
-typedef struct SpeexCallback {
- int callback_id; /**< ID associated to the callback */
- speex_callback_func func; /**< Callback handler function */
- void *data; /**< Data that will be sent to the handler */
- void *reserved1; /**< Reserved for future use */
- int reserved2; /**< Reserved for future use */
-} SpeexCallback;
-
-/** Handle in-band request */
-int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state);
-
-/** Standard handler for mode request (change mode, no questions asked) */
-int speex_std_mode_request_handler(SpeexBits *bits, void *state, void *data);
-
-/** Standard handler for high mode request (change high mode, no questions asked) */
-int speex_std_high_mode_request_handler(SpeexBits *bits, void *state, void *data);
-
-/** Standard handler for in-band characters (write to stderr) */
-int speex_std_char_handler(SpeexBits *bits, void *state, void *data);
-
-/** Default handler for user-defined requests: in this case, just ignore */
-int speex_default_user_handler(SpeexBits *bits, void *state, void *data);
-
-
-
-
-int speex_std_low_mode_request_handler(SpeexBits *bits, void *state, void *data);
-
-int speex_std_vbr_request_handler(SpeexBits *bits, void *state, void *data);
-
-int speex_std_enh_request_handler(SpeexBits *bits, void *state, void *data);
-
-int speex_std_vbr_quality_request_handler(SpeexBits *bits, void *state, void *data);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
Modified: branches/rel-1-0-branch/speex/libspeex/speex_header.c
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/speex_header.c 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/speex_header.c 2004-07-14 06:03:21 UTC (rev 7119)
@@ -31,9 +31,9 @@
*/
-#include "speex_header.h"
+#include <speex/speex_header.h>
#include "misc.h"
-#include "speex.h"
+#include <speex/speex.h>
#ifndef NULL
#define NULL 0
@@ -68,13 +68,13 @@
char *h="Speex ";
/*
strncpy(header->speex_string, "Speex ", 8);
- strncpy(header->speex_version, VERSION, SPEEX_HEADER_VERSION_LENGTH-1);
+ strncpy(header->speex_version, SPEEX_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=0;i<SPEEX_HEADER_VERSION_LENGTH-1 && SPEEX_VERSION[i];i++)
+ header->speex_version[i]=SPEEX_VERSION[i];
for (;i<SPEEX_HEADER_VERSION_LENGTH;i++)
header->speex_version[i]=0;
Deleted: branches/rel-1-0-branch/speex/libspeex/speex_header.h
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/speex_header.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/speex_header.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -1,82 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin */
-/**
- @file speex_header.h
- @brief 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.
-
-*/
-
-
-#ifndef SPEEX_HEADER_H
-#define SPEEX_HEADER_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct SpeexMode;
-
-/** 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_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 */
-} SpeexHeader;
-
-/** Initializes a SpeexHeader using basic information */
-void speex_init_header(SpeexHeader *header, int rate, int nb_channels, struct SpeexMode *m);
-
-/** Creates the header packet from the header itself (mostly involves endianness conversion) */
-char *speex_header_to_packet(SpeexHeader *header, int *size);
-
-/** Creates a SpeexHeader from a packet */
-SpeexHeader *speex_packet_to_header(char *packet, int size);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
Deleted: branches/rel-1-0-branch/speex/libspeex/speex_stereo.h
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/speex_stereo.h 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/speex_stereo.h 2004-07-14 06:03:21 UTC (rev 7119)
@@ -1,71 +0,0 @@
-/* Copyright (C) 2002 Jean-Marc Valin*/
-/**
- @file speex_stereo.h
- @brief Describes the handling for intensity stereo
-*/
-/*
- 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 STEREO_H
-#define STEREO_H
-
-#include "speex_bits.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** State used for decoding (intensity) stereo information */
-typedef struct SpeexStereoState {
- float balance; /**< Left/right balance info */
- float e_ratio; /**< Ratio of energies: E(left+right)/[E(left)+E(right)] */
- float smooth_left; /**< Smoothed left channel gain */
- float smooth_right; /**< Smoothed right channel gain */
- float reserved1; /**< Reserved for future use */
- float reserved2; /**< Reserved for future use */
-} SpeexStereoState;
-
-/** Initialization value for a stereo state */
-#define SPEEX_STEREO_STATE_INIT {1,.5,1,1}
-
-/** 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 mono frame into a stereo frame using intensity stereo info */
-void speex_decode_stereo(float *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
Modified: branches/rel-1-0-branch/speex/libspeex/stereo.c
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/stereo.c 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/stereo.c 2004-07-14 06:03:21 UTC (rev 7119)
@@ -29,8 +29,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "speex_stereo.h"
-#include "speex_callbacks.h"
+#include <speex/speex_stereo.h>
+#include <speex/speex_callbacks.h>
#include "vq.h"
#include <math.h>
Modified: branches/rel-1-0-branch/speex/libspeex/testenc.c
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/testenc.c 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/testenc.c 2004-07-14 06:03:21 UTC (rev 7119)
@@ -1,7 +1,7 @@
-#include "speex.h"
+#include <speex/speex.h>
#include <stdio.h>
#include <stdlib.h>
-#include "speex_callbacks.h"
+#include <speex/speex_callbacks.h>
#define FRAME_SIZE 160
#include <math.h>
Modified: branches/rel-1-0-branch/speex/libspeex/testenc_uwb.c
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/testenc_uwb.c 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/testenc_uwb.c 2004-07-14 06:03:21 UTC (rev 7119)
@@ -1,4 +1,4 @@
-#include "speex.h"
+#include <speex/speex.h>
#include <stdio.h>
#include <stdlib.h>
Modified: branches/rel-1-0-branch/speex/libspeex/testenc_wb.c
===================================================================
--- branches/rel-1-0-branch/speex/libspeex/testenc_wb.c 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/libspeex/testenc_wb.c 2004-07-14 06:03:21 UTC (rev 7119)
@@ -1,4 +1,4 @@
-#include "speex.h"
+#include <speex/speex.h>
#include <stdio.h>
#include <stdlib.h>
Added: branches/rel-1-0-branch/speex/speex.m4
===================================================================
--- branches/rel-1-0-branch/speex/speex.m4 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/speex.m4 2004-07-14 06:03:21 UTC (rev 7119)
@@ -0,0 +1,104 @@
+# Configure paths for libspeex
+# Jean-Marc Valin <jean-marc.valin at usherbrooke.ca>
+# Shamelessly stolen from:
+# Jack Moffitt <jack at icecast.org> 10-21-2000
+# Shamelessly stolen from Owen Taylor and Manish Singh
+
+dnl XIPH_PATH_SPEEX([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
+dnl Test for libspeex, and define SPEEX_CFLAGS and SPEEX_LIBS
+dnl
+AC_DEFUN(XIPH_PATH_SPEEX,
+[dnl
+dnl Get the cflags and libraries
+dnl
+AC_ARG_WITH(speex,[ --with-speex=PFX Prefix where libspeex is installed (optional)], speex_prefix="$withval", speex_prefix="")
+AC_ARG_WITH(speex-libraries,[ --with-speex-libraries=DIR Directory where libspeex library is installed (optional)], speex_libraries="$withval", speex_libraries="")
+AC_ARG_WITH(speex-includes,[ --with-speex-includes=DIR Directory where libspeex header files are installed (optional)], speex_includes="$withval", speex_includes="")
+AC_ARG_ENABLE(speextest, [ --disable-speextest Do not try to compile and run a test Speex program],, enable_speextest=yes)
+
+ if test "x$speex_libraries" != "x" ; then
+ SPEEX_LIBS="-L$speex_libraries"
+ elif test "x$speex_prefix" != "x" ; then
+ SPEEX_LIBS="-L$speex_prefix/lib"
+ elif test "x$prefix" != "xNONE" ; then
+ SPEEX_LIBS="-L$prefix/lib"
+ fi
+
+ SPEEX_LIBS="$SPEEX_LIBS -lspeex"
+
+ if test "x$speex_includes" != "x" ; then
+ SPEEX_CFLAGS="-I$speex_includes"
+ elif test "x$speex_prefix" != "x" ; then
+ SPEEX_CFLAGS="-I$speex_prefix/include"
+ elif test "x$prefix" != "xNONE"; then
+ SPEEX_CFLAGS="-I$prefix/include"
+ fi
+
+ AC_MSG_CHECKING(for Speex)
+ no_speex=""
+
+
+ if test "x$enable_speextest" = "xyes" ; then
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $SPEEX_CFLAGS"
+ LIBS="$LIBS $SPEEX_LIBS"
+dnl
+dnl Now check if the installed Speex is sufficiently new.
+dnl
+ rm -f conf.speextest
+ AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <speex/speex.h>
+
+int main ()
+{
+ system("touch conf.speextest");
+ return 0;
+}
+
+],, no_speex=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+
+ if test "x$no_speex" = "x" ; then
+ AC_MSG_RESULT(yes)
+ ifelse([$1], , :, [$1])
+ else
+ AC_MSG_RESULT(no)
+ if test -f conf.speextest ; then
+ :
+ else
+ echo "*** Could not run Speex test program, checking why..."
+ CFLAGS="$CFLAGS $SPEEX_CFLAGS"
+ LIBS="$LIBS $SPEEX_LIBS"
+ AC_TRY_LINK([
+#include <stdio.h>
+#include <speex/speex.h>
+], [ return 0; ],
+ [ echo "*** The test program compiled, but did not run. This usually means"
+ echo "*** that the run-time linker is not finding Speex or finding the wrong"
+ echo "*** version of Speex. If it is not finding Speex, you'll need to set your"
+ echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+ echo "*** to the installed location Also, make sure you have run ldconfig if that"
+ echo "*** is required on your system"
+ echo "***"
+ echo "*** If you have an old version installed, it is best to remove it, although"
+ echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
+ [ echo "*** The test program failed to compile or link. See the file config.log for the"
+ echo "*** exact error that occured. This usually means Speex was incorrectly installed"
+ echo "*** or that you have moved Speex since it was installed." ])
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ fi
+ SPEEX_CFLAGS=""
+ SPEEX_LIBS=""
+ ifelse([$2], , :, [$2])
+ fi
+ AC_SUBST(SPEEX_CFLAGS)
+ AC_SUBST(SPEEX_LIBS)
+ rm -f conf.speextest
+])
Added: branches/rel-1-0-branch/speex/speex.pc.in
===================================================================
--- branches/rel-1-0-branch/speex/speex.pc.in 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/speex.pc.in 2004-07-14 06:03:21 UTC (rev 7119)
@@ -0,0 +1,14 @@
+# libogg pkg-config source file
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: speex
+Description: Speex is an audio codec tuned for speech
+Version: @SPEEX_VERSION@
+Requires: ogg
+Conflicts:
+Libs: -L${libdir} -lspeex
+Cflags: -I${includedir}
Modified: branches/rel-1-0-branch/speex/src/Makefile.am
===================================================================
--- branches/rel-1-0-branch/speex/src/Makefile.am 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/src/Makefile.am 2004-07-14 06:03:21 UTC (rev 7119)
@@ -5,7 +5,7 @@
# Disable automatic dependency tracking if using other tools than gcc and gmake
#AUTOMAKE_OPTIONS = no-dependencies
-INCLUDES = -I$(top_srcdir)/libspeex $(OGG_INCLUDES)
+INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/libspeex $(OGG_INCLUDES)
mandir = $(prefix)/share/man
man_MANS = speexenc.1 speexdec.1
Modified: branches/rel-1-0-branch/speex/src/speexdec.c
===================================================================
--- branches/rel-1-0-branch/speex/src/speexdec.c 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/src/speexdec.c 2004-07-14 06:03:21 UTC (rev 7119)
@@ -37,8 +37,8 @@
#include <stdlib.h>
#include <string.h>
-#include "speex.h"
-#include "ogg/ogg.h"
+#include <speex/speex.h>
+#include <ogg/ogg.h>
#if defined WIN32 || defined _WIN32
#include <windows.h>
@@ -50,6 +50,10 @@
#endif
#include <math.h>
+#ifdef __MINGW32__
+#include "wave_out.c"
+#endif
+
#ifdef HAVE_SYS_SOUNDCARD_H
#include <sys/soundcard.h>
#include <sys/types.h>
@@ -70,9 +74,9 @@
#include <string.h>
#include "wav_io.h"
-#include "speex_header.h"
-#include "speex_stereo.h"
-#include "speex_callbacks.h"
+#include <speex/speex_header.h>
+#include <speex/speex_stereo.h>
+#include <speex/speex_callbacks.h>
#include "misc.h"
#define MAX_FRAME_SIZE 2000
@@ -278,17 +282,17 @@
void version()
{
- printf ("speexdec (Speex decoder) version " VERSION " (compiled " __DATE__ ")\n");
+ printf ("speexdec (Speex decoder) version " SPEEX_VERSION " (compiled " __DATE__ ")\n");
printf ("Copyright (C) 2002-2003 Jean-Marc Valin\n");
}
void version_short()
{
- printf ("speexdec version " VERSION "\n");
+ printf ("speexdec version " SPEEX_VERSION "\n");
printf ("Copyright (C) 2002-2003 Jean-Marc Valin\n");
}
-static void *process_header(ogg_packet *op, int enh_enabled, int *frame_size, int *rate, int *nframes, int forceMode, int *channels, SpeexStereoState *stereo, int *extra_headers)
+static void *process_header(ogg_packet *op, int enh_enabled, int *frame_size, int *rate, int *nframes, int forceMode, int *channels, SpeexStereoState *stereo, int *extra_headers, int quiet)
{
void *st;
SpeexMode *mode;
@@ -365,20 +369,23 @@
if (*channels==-1)
*channels = header->nb_channels;
- fprintf (stderr, "Decoding %d Hz audio using %s mode",
- *rate, mode->modeName);
+ if (!quiet)
+ {
+ fprintf (stderr, "Decoding %d Hz audio using %s mode",
+ *rate, mode->modeName);
- if (*channels==1)
- fprintf (stderr, " (mono");
- else
- fprintf (stderr, " (stereo");
+ if (*channels==1)
+ fprintf (stderr, " (mono");
+ else
+ fprintf (stderr, " (stereo");
- if (header->vbr)
- fprintf (stderr, ", VBR)\n");
- else
- fprintf(stderr, ")\n");
- /*fprintf (stderr, "Decoding %d Hz audio at %d bps using %s mode\n",
- *rate, mode->bitrate, mode->modeName);*/
+ if (header->vbr)
+ fprintf (stderr, ", VBR)\n");
+ else
+ fprintf(stderr, ")\n");
+ /*fprintf (stderr, "Decoding %d Hz audio at %d bps using %s mode\n",
+ *rate, mode->bitrate, mode->modeName);*/
+ }
*extra_headers = header->extra_headers;
@@ -399,9 +406,13 @@
SpeexBits bits;
int packet_count=0;
int stream_init = 0;
+ int quiet = 0;
+ ogg_int64_t page_granule=0, last_granule=0;
+ int skip_samples=0, page_nb_packets;
struct option long_options[] =
{
{"help", no_argument, NULL, 0},
+ {"quiet", no_argument, NULL, 0},
{"version", no_argument, NULL, 0},
{"version-short", no_argument, NULL, 0},
{"enh", no_argument, NULL, 0},
@@ -452,6 +463,9 @@
{
usage();
exit(0);
+ } else if (strcmp(long_options[option_index].name,"quiet")==0)
+ {
+ quiet = 1;
} else if (strcmp(long_options[option_index].name,"version")==0)
{
version();
@@ -566,19 +580,36 @@
/*Loop for all complete pages we got (most likely only one)*/
while (ogg_sync_pageout(&oy, &og)==1)
{
+ int packet_no;
if (stream_init == 0) {
ogg_stream_init(&os, ogg_page_serialno(&og));
stream_init = 1;
}
/*Add page to the bitstream*/
ogg_stream_pagein(&os, &og);
+ page_granule = ogg_page_granulepos(&og);
+ page_nb_packets = ogg_page_packets(&og);
+ if (page_granule>0 && frame_size)
+ {
+ skip_samples = page_nb_packets*frame_size*nframes - (page_granule-last_granule);
+ if (ogg_page_eos(&og))
+ skip_samples = -skip_samples;
+ /*else if (!ogg_page_bos(&og))
+ skip_samples = 0;*/
+ } else
+ {
+ skip_samples = 0;
+ }
+ /*printf ("page granulepos: %d %d %d\n", skip_samples, page_nb_packets, (int)page_granule);*/
+ last_granule = page_granule;
/*Extract all available packets*/
+ packet_no=0;
while (!eos && ogg_stream_packetout(&os, &op)==1)
{
/*If first packet, process as Speex header*/
if (packet_count==0)
{
- st = process_header(&op, enh_enabled, &frame_size, &rate, &nframes, forceMode, &channels, &stereo, &extra_headers);
+ st = process_header(&op, enh_enabled, &frame_size, &rate, &nframes, forceMode, &channels, &stereo, &extra_headers, quiet);
if (!nframes)
nframes=1;
if (!st)
@@ -587,12 +618,13 @@
} else if (packet_count==1)
{
- print_comments((char*)op.packet, op.bytes);
+ if (!quiet)
+ print_comments((char*)op.packet, op.bytes);
} else if (packet_count<=1+extra_headers)
{
/* Ignore extra headers */
} else {
-
+ packet_no++;
int lost=0;
if (loss_percent>0 && 100*((float)rand())/RAND_MAX<loss_percent)
lost=1;
@@ -651,14 +683,38 @@
for (i=0;i<frame_size*channels;i++)
out[i]=(short)floor(.5+output[i]);
}
+ {
+ int frame_offset = 0;
+ int new_frame_size = frame_size;
+ /*printf ("packet %d %d\n", packet_no, skip_samples);*/
+ if (packet_no == 1 && j==0 && skip_samples > 0)
+ {
+ /*printf ("chopping first packet\n");*/
+ new_frame_size -= skip_samples;
+ frame_offset = skip_samples;
+ }
+ if (packet_no == page_nb_packets && skip_samples < 0)
+ {
+ int packet_length = nframes*frame_size+skip_samples;
+ new_frame_size = packet_length - j*frame_size;
+ if (new_frame_size<0)
+ new_frame_size = 0;
+ if (new_frame_size>frame_size)
+ new_frame_size = frame_size;
+ /*printf ("chopping end: %d %d %d\n", new_frame_size, packet_length, packet_no);*/
+ }
+ if (new_frame_size)
+ {
#if defined WIN32 || defined _WIN32
- if (strlen(outFile)==0)
- WIN_Play_Samples (out, sizeof(short) * frame_size*channels);
- else
+ if (strlen(outFile)==0)
+ WIN_Play_Samples (out+frame_offset*channels, sizeof(short) * new_frame_size*channels);
+ else
#endif
- fwrite(out, sizeof(short), frame_size*channels, fout);
+ fwrite(out+frame_offset*channels, sizeof(short), new_frame_size*channels, fout);
- audio_size+=sizeof(short)*frame_size*channels;
+ audio_size+=sizeof(short)*new_frame_size*channels;
+ }
+ }
}
}
packet_count++;
Modified: branches/rel-1-0-branch/speex/src/speexenc.c
===================================================================
--- branches/rel-1-0-branch/speex/src/speexenc.c 2004-07-14 05:05:45 UTC (rev 7118)
+++ branches/rel-1-0-branch/speex/src/speexenc.c 2004-07-14 06:03:21 UTC (rev 7119)
@@ -38,12 +38,13 @@
#include <string.h>
#include <time.h>
-#include "speex.h"
+#include <speex/speex.h>
#include <ogg/ogg.h>
#include "wav_io.h"
-#include "speex_header.h"
-#include "speex_stereo.h"
+#include <speex/speex_header.h>
+#include <speex/speex_stereo.h>
#include "misc.h"
+#include <speex/speex_preprocess.h>
#if defined WIN32 || defined _WIN32
#include "getopt_win.h"
@@ -99,7 +100,7 @@
/*fprintf (stderr, "%d\n", nb_read);*/
if (nb_read==0)
- return 1;
+ return 0;
s=(short*)in;
if(bits==8)
@@ -121,6 +122,7 @@
}
}
+ /* FIXME: This is probably redundent now */
/* copy to float input buffer */
for (i=0;i<frame_size*channels;i++)
{
@@ -133,18 +135,18 @@
}
- return 0;
+ return nb_read;
}
void version()
{
- printf ("speexenc (Speex encoder) version " VERSION " (compiled " __DATE__ ")\n");
+ printf ("speexenc (Speex encoder) version " SPEEX_VERSION " (compiled " __DATE__ ")\n");
printf ("Copyright (C) 2002-2003 Jean-Marc Valin\n");
}
void version_short()
{
- printf ("speexenc version " VERSION "\n");
+ printf ("speexenc version " SPEEX_VERSION "\n");
printf ("Copyright (C) 2002-2003 Jean-Marc Valin\n");
}
@@ -199,12 +201,14 @@
int main(int argc, char **argv)
{
+ int nb_samples, total_samples=0, nb_encoded;
int c;
int option_index = 0;
char *inFile, *outFile;
FILE *fin, *fout;
float input[MAX_FRAME_SIZE];
int frame_size;
+ int quiet=0;
int vbr_enabled=0;
int abr_enabled=0;
int vad_enabled=0;
@@ -228,6 +232,7 @@
{"nframes", required_argument, NULL, 0},
{"comp", required_argument, NULL, 0},
{"help", no_argument, NULL, 0},
+ {"quiet", no_argument, NULL, 0},
{"le", no_argument, NULL, 0},
{"be", no_argument, NULL, 0},
{"8bit", no_argument, NULL, 0},
@@ -256,7 +261,7 @@
SpeexHeader header;
int nframes=1;
int complexity=3;
- char *vendor_string = "Encoded with Speex " VERSION;
+ char *vendor_string = "Encoded with Speex " SPEEX_VERSION;
char *comments;
int comments_length;
int close_in=0, close_out=0;
@@ -266,6 +271,7 @@
char first_bytes[12];
int wave_input=0;
int tmp;
+ int lookahead = 0;
comment_init(&comments, &comments_length, vendor_string);
@@ -327,6 +333,9 @@
{
usage();
exit(0);
+ } else if (strcmp(long_options[option_index].name,"quiet")==0)
+ {
+ quiet = 1;
} else if (strcmp(long_options[option_index].name,"version")==0)
{
version();
@@ -498,8 +507,9 @@
rate=32000;
}
- if (rate!=8000 && rate!=16000 && rate!=32000)
- fprintf (stderr, "Warning: Speex is only optimized for 8, 16 and 32 kHz. It will still work at %d Hz but your mileage may vary\n", rate);
+ if (!quiet)
+ if (rate!=8000 && rate!=16000 && rate!=32000)
+ fprintf (stderr, "Warning: Speex is only optimized for 8, 16 and 32 kHz. It will still work at %d Hz but your mileage may vary\n", rate);
speex_init_header(&header, rate, 1, mode);
header.frames_per_packet=nframes;
@@ -510,7 +520,8 @@
char *st_string="mono";
if (chan==2)
st_string="stereo";
- fprintf (stderr, "Encoding %d Hz audio using %s mode (%s)\n",
+ if (!quiet)
+ fprintf (stderr, "Encoding %d Hz audio using %s mode (%s)\n",
header.rate, mode->modeName, st_string);
}
/*fprintf (stderr, "Encoding %d Hz audio at %d bps using %s mode\n",
@@ -537,42 +548,6 @@
close_out=1;
}
-
- /*Write header*/
- {
-
- op.packet = (unsigned char *)speex_header_to_packet(&header, (int*)&(op.bytes));
- op.b_o_s = 1;
- op.e_o_s = 0;
- op.granulepos = 0;
- op.packetno = 0;
- ogg_stream_packetin(&os, &op);
- free(op.packet);
-
- op.packet = (unsigned char *)comments;
- op.bytes = comments_length;
- op.b_o_s = 0;
- op.e_o_s = 0;
- op.granulepos = 0;
- op.packetno = 1;
- ogg_stream_packetin(&os, &op);
-
- while((result = ogg_stream_flush(&os, &og)))
- {
- if(!result) break;
- ret = oe_write_page(&og, fout);
- if(ret != og.header_len + og.body_len)
- {
- fprintf (stderr,"Error: failed writing header to output stream\n");
- exit(1);
- }
- else
- bytes_written += ret;
- }
- }
-
- free(comments);
-
speex_encoder_ctl(st, SPEEX_GET_FRAME_SIZE, &frame_size);
speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &complexity);
speex_encoder_ctl(st, SPEEX_SET_SAMPLING_RATE, &rate);
@@ -614,25 +589,64 @@
speex_encoder_ctl(st, SPEEX_SET_ABR, &abr_enabled);
}
+ speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &lookahead);
+
+ /*Write header*/
+ {
+
+ op.packet = (unsigned char *)speex_header_to_packet(&header, (int*)&(op.bytes));
+ op.b_o_s = 1;
+ op.e_o_s = 0;
+ op.granulepos = 0;
+ op.packetno = 0;
+ ogg_stream_packetin(&os, &op);
+ free(op.packet);
+
+ op.packet = (unsigned char *)comments;
+ op.bytes = comments_length;
+ op.b_o_s = 0;
+ op.e_o_s = 0;
+ op.granulepos = 0;
+ op.packetno = 1;
+ ogg_stream_packetin(&os, &op);
+
+ while((result = ogg_stream_flush(&os, &og)))
+ {
+ if(!result) break;
+ ret = oe_write_page(&og, fout);
+ if(ret != og.header_len + og.body_len)
+ {
+ fprintf (stderr,"Error: failed writing header to output stream\n");
+ exit(1);
+ }
+ else
+ bytes_written += ret;
+ }
+ }
+
+ free(comments);
+
speex_bits_init(&bits);
if (!wave_input)
{
- if (read_samples(fin,frame_size,fmt,chan,lsb,input, first_bytes, NULL))
- eos=1;
+ nb_samples = read_samples(fin,frame_size,fmt,chan,lsb,input, first_bytes, NULL);
} else {
- if (read_samples(fin,frame_size,fmt,chan,lsb,input, NULL, &size))
- eos=1;
+ nb_samples = read_samples(fin,frame_size,fmt,chan,lsb,input, NULL, &size);
}
+ if (nb_samples==0)
+ eos=1;
+ total_samples += nb_samples;
+ nb_encoded = -lookahead;
/*Main encoding loop (one frame per iteration)*/
- while (!eos)
+ while (!eos || total_samples>nb_encoded)
{
id++;
/*Encode current frame*/
if (chan==2)
speex_encode_stereo(input, frame_size, &bits);
speex_encode(st, input, &bits);
-
+ nb_encoded += frame_size;
if (print_bitrate) {
int tmp;
char ch=13;
@@ -640,27 +654,31 @@
fputc (ch, stderr);
cumul_bits += tmp;
enc_frames += 1;
- if (vad_enabled || vbr_enabled || abr_enabled)
- fprintf (stderr, "Bitrate is use: %d bps (average %d bps) ", tmp, (int)(cumul_bits/enc_frames));
- else
- fprintf (stderr, "Bitrate is use: %d bps ", tmp);
+ if (!quiet)
+ {
+ if (vad_enabled || vbr_enabled || abr_enabled)
+ fprintf (stderr, "Bitrate is use: %d bps (average %d bps) ", tmp, (int)(cumul_bits/enc_frames));
+ else
+ fprintf (stderr, "Bitrate is use: %d bps ", tmp);
+ }
}
if (wave_input)
{
- if (read_samples(fin,frame_size,fmt,chan,lsb,input, NULL, &size))
- {
- eos=1;
- op.e_o_s = 1;
- }
+ nb_samples = read_samples(fin,frame_size,fmt,chan,lsb,input, NULL, &size);
} else {
- if (read_samples(fin,frame_size,fmt,chan,lsb,input, NULL, NULL))
- {
- eos=1;
- op.e_o_s = 1;
- }
+ nb_samples = read_samples(fin,frame_size,fmt,chan,lsb,input, NULL, NULL);
}
+ if (nb_samples==0)
+ {
+ eos=1;
+ }
+ if (eos && total_samples<=nb_encoded)
+ op.e_o_s = 1;
+ else
+ op.e_o_s = 0;
+ total_samples += nb_samples;
if ((id+1)%nframes!=0)
continue;
@@ -670,11 +688,15 @@
op.packet = (unsigned char *)cbits;
op.bytes = nbBytes;
op.b_o_s = 0;
- if (eos)
+ /*Is this redundent?*/
+ if (eos && total_samples<=nb_encoded)
op.e_o_s = 1;
else
op.e_o_s = 0;
- op.granulepos = (id+nframes)*frame_size;
+ op.granulepos = (id+1)*frame_size-lookahead;
+ if (op.granulepos>total_samples)
+ op.granulepos = total_samples;
+ /*printf ("granulepos: %d %d %d %d %d %d\n", (int)op.granulepos, id, nframes, lookahead, 5, 6);*/
op.packetno = 2+id/nframes;
ogg_stream_packetin(&os, &op);
@@ -703,7 +725,10 @@
op.bytes = nbBytes;
op.b_o_s = 0;
op.e_o_s = 1;
- op.granulepos = (id+nframes)*frame_size;
+ op.granulepos = (id+1)*frame_size-lookahead;
+ if (op.granulepos>total_samples)
+ op.granulepos = total_samples;
+
op.packetno = 2+id/nframes;
ogg_stream_packetin(&os, &op);
}
More information about the commits
mailing list