Starting work so I can use the Vorbis psychoacoustics
authorjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Wed, 5 Oct 2005 06:09:30 +0000 (06:09 +0000)
committerjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>
Wed, 5 Oct 2005 06:09:30 +0000 (06:09 +0000)
git-svn-id: http://svn.xiph.org/trunk/speex@10118 0101bb08-14d6-0310-b084-bc0e0c8e3800

libspeex/Makefile.am
libspeex/curves.c [new file with mode: 0644]

index d96e155..0955f57 100644 (file)
@@ -9,41 +9,13 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I$(top_builddir) @
 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 \
-       speex.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 \
-       preprocess.c \
-       smallft.c \
-       lbr_48k_tables.c \
-       jitter.c \
-       mdf.c
+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         speex.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        preprocess.c    smallft.c       lbr_48k_tables.c \
+               jitter.c        mdf.c curves.c
 
 noinst_HEADERS = lsp.h \
        nb_celp.h \
diff --git a/libspeex/curves.c b/libspeex/curves.c
new file mode 100644 (file)
index 0000000..91716c2
--- /dev/null
@@ -0,0 +1,57 @@
+/* Copyright (C) 2005 Jean-Marc Valin / CSIRO
+   File: curves
+
+   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.
+*/
+
+#ifdef VORBIS_PSYCHO
+
+
+#include "smallft.h"
+#include "lpc.h"
+
+struct drft_lookup lookup;
+
+/* */
+void curve_to_lpc(float *curve, int len, float *ak, int ord)
+{
+   int i;
+   float ac[len*2];
+   for (i=0;i<2*len;i++)
+      ac[i] = 0;
+   for (i=1;i<len;i++)
+      ac[2*i-1] = curve[i];
+   ac[0] = curve[0];
+   ac[2*len-1] = curve[len-1];
+   
+   spx_drft_backward(&lookup, ac);
+   _spx_lpc(ak, ac, ord);
+}
+
+
+#endif
\ No newline at end of file