[xiph-commits] r14028 - in trunk/speex: doc include/speex libspeex

jm at svn.xiph.org jm at svn.xiph.org
Sun Oct 21 07:52:06 PDT 2007


Author: jm
Date: 2007-10-21 07:52:05 -0700 (Sun, 21 Oct 2007)
New Revision: 14028

Added:
   trunk/speex/libspeex/modes_wb.c
Modified:
   trunk/speex/doc/manual.lyx
   trunk/speex/include/speex/speex.h
   trunk/speex/libspeex/Makefile.am
   trunk/speex/libspeex/modes.c
   trunk/speex/libspeex/nb_celp.c
   trunk/speex/libspeex/speex.c
Log:
Re-arranged the wideband mode so that programs using narrowband only and
linking statically don't carry the wideband stuff.


Modified: trunk/speex/doc/manual.lyx
===================================================================
--- trunk/speex/doc/manual.lyx	2007-10-21 14:49:54 UTC (rev 14027)
+++ trunk/speex/doc/manual.lyx	2007-10-21 14:52:05 UTC (rev 14028)
@@ -1110,8 +1110,108 @@
  certain architectures or operating systems in README.xxx files.
 \end_layout
 
+\begin_layout Section
+Porting and Optimising
+\end_layout
+
 \begin_layout Standard
+Here are a few things to consider when porting or optimising Speex for a
+ new platform or an existing one.
+\end_layout
 
+\begin_layout Subsection
+CPU optimisation
+\end_layout
+
+\begin_layout Standard
+The following functions are usually the first ones you should consider optimisin
+g:
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+inline true
+status collapsed
+
+\begin_layout Standard
+
+filter_mem16()
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+inline true
+status collapsed
+
+\begin_layout Standard
+
+iir_mem16()
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Itemize
+\begin_inset listings
+inline true
+status collapsed
+
+\begin_layout Standard
+
+pitch_xcorr()
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Subsection
+Memory optimisation
+\end_layout
+
+\begin_layout Standard
+Memory optimisation is mainly something that should be considered for small
+ embedded platforms.
+ For PCs, Speex is already so tiny that it's just not worth doing any of
+ the things suggested here.
+ There are several ways to reduce the memory usage of Speex, both in terms
+ of code size and data size.
+ For optimising code size, the trick is to first remove features you do
+ not need.
+ Some examples of things that can easily be disabled 
+\series bold
+if you don't need them
+\series default
+ are:
+\end_layout
+
+\begin_layout Itemize
+Wideband support (--disable-wideband)
+\end_layout
+
+\begin_layout Itemize
+Support for stereo (removing stereo.c)
+\end_layout
+
+\begin_layout Itemize
+VBR support (vbr.c and a few lines in nb_celp.c)
+\end_layout
+
+\begin_layout Itemize
+Static codebooks that are not needed for the bit-rates you are using (*_table.c
+ files)
+\end_layout
+
+\begin_layout Standard
+
 \newpage
 
 \end_layout

Modified: trunk/speex/include/speex/speex.h
===================================================================
--- trunk/speex/include/speex/speex.h	2007-10-21 14:49:54 UTC (rev 14027)
+++ trunk/speex/include/speex/speex.h	2007-10-21 14:52:05 UTC (rev 14028)
@@ -421,6 +421,9 @@
 /** Obtain one of the modes available */
 const SpeexMode * speex_lib_get_mode (int mode);
 
+/* We actually override the fucntion 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))
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/speex/libspeex/Makefile.am
===================================================================
--- trunk/speex/libspeex/Makefile.am	2007-10-21 14:49:54 UTC (rev 14027)
+++ trunk/speex/libspeex/Makefile.am	2007-10-21 14:52:05 UTC (rev 14028)
@@ -9,13 +9,12 @@
 lib_LTLIBRARIES = libspeex.la libspeexdsp.la
 
 # Sources for compilation in the library
-libspeex_la_SOURCES = bits.c 	cb_search.c 	exc_10_32_table.c exc_20_32_table.c \
-	exc_5_64_table.c 	exc_8_128_table.c 	filters.c 	gain_table.c gain_table_lbr.c \
-	hexc_10_32_table.c 	hexc_table.c 	high_lsp_tables.c 	lbr_48k_tables.c lpc.c 	lsp.c 	ltp.c \
-	quant_lsp.c sb_celp.c 	speex.c \
-	speex_header.c 	stereo.c 	vbr.c 	vq.c buffer.c exc_10_16_table.c \
-	exc_5_256_table.c lsp_tables_nb.c modes.c nb_celp.c speex_callbacks.c \
-	window.c
+libspeex_la_SOURCES = 	cb_search.c 	exc_10_32_table.c 	exc_8_128_table.c \
+		filters.c 	gain_table.c 	hexc_table.c 	high_lsp_tables.c 	lbr_48k_tables.c 	lsp.c \
+		ltp.c 	speex.c 	stereo.c 	vbr.c 	vq.c bits.c buffer.c exc_10_16_table.c \
+	exc_20_32_table.c exc_5_256_table.c exc_5_64_table.c gain_table_lbr.c hexc_10_32_table.c \
+	lpc.c lsp_tables_nb.c modes.c modes_wb.c nb_celp.c quant_lsp.c sb_celp.c \
+	speex_callbacks.c speex_header.c window.c
 
 libspeexdsp_la_SOURCES = preprocess.c 	smallft.c 	lbr_48k_tables.c \
 				jitter.c 	mdf.c fftwrap.c kiss_fft.c _kiss_fft_guts.h kiss_fft.h \

Modified: trunk/speex/libspeex/modes.c
===================================================================
--- trunk/speex/libspeex/modes.c	2007-10-21 14:49:54 UTC (rev 14027)
+++ trunk/speex/libspeex/modes.c	2007-10-21 14:52:05 UTC (rev 14028)
@@ -50,21 +50,16 @@
 #define NULL 0
 #endif
 
-#define MAX_IN_SAMPLES 640
 
-const SpeexMode * const speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode};
-
 /* Extern declarations for all codebooks we use here */
 extern const signed char gain_cdbk_nb[];
 extern const signed char gain_cdbk_lbr[];
-extern const signed char hexc_table[];
 extern const signed char exc_5_256_table[];
 extern const signed char exc_5_64_table[];
 extern const signed char exc_8_128_table[];
 extern const signed char exc_10_32_table[];
 extern const signed char exc_10_16_table[];
 extern const signed char exc_20_32_table[];
-extern const signed char hexc_10_32_table[];
 
 
 /* Parameters for Long-Term Prediction (LTP)*/
@@ -150,29 +145,8 @@
    0,
 };
 
-#ifndef DISABLE_WIDEBAND
 
-/* Split-VQ innovation for high-band wideband */
-static const 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 const split_cb_params split_cb_high_lbr = {
-   10,               /*subvect_size*/
-   4,               /*nb_subvect*/
-   hexc_10_32_table,       /*shape_cb*/
-   5,               /*shape_bits*/
-   0,
-};
-
-#endif
-
 /* 2150 bps "vocoder-like" mode for comfort noise */
 static const SpeexSubmode nb_submode1 = {
    0,
@@ -386,190 +360,7 @@
 
 /* Wideband part */
 
-static const 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,
-   -1,
-   36
-};
 
-
-static const 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,
-#ifdef DISABLE_WIDEBAND
-   NULL,
-#else
-   &split_cb_high_lbr,
-#endif
-   -1,
-   112
-};
-
-
-static const 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,
-#ifdef DISABLE_WIDEBAND
-   NULL,
-#else
-   &split_cb_high,
-#endif
-   -1,
-   192
-};
-
-static const 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,
-#ifdef DISABLE_WIDEBAND
-   NULL,
-#else
-   &split_cb_high,
-#endif
-   -1,
-   352
-};
-
-
-/* Split-band wideband CELP mode*/
-static const SpeexSBMode sb_wb_mode = {
-   &speex_nb_mode,
-   160,    /*frameSize*/
-   40,     /*subframeSize*/
-   8,     /*lpcSize*/
-   640,    /*bufSize*/
-#ifdef FIXED_POINT
-   29491, 19661, /* gamma1, gamma2 */
-#else
-   0.9, 0.6, /* gamma1, gamma2 */
-#endif
-   .012,   /*lag_factor*/
-   QCONST16(.0002,15), /*lpc_floor*/
-   QCONST16(0.9f,15),
-   {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
-};
-
-
-const 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 const SpeexSBMode sb_uwb_mode = {
-   &speex_wb_mode,
-   320,    /*frameSize*/
-   80,     /*subframeSize*/
-   8,     /*lpcSize*/
-   1280,    /*bufSize*/
-#ifdef FIXED_POINT
-   29491, 19661, /* gamma1, gamma2 */
-#else
-   0.9, 0.6, /* gamma1, gamma2 */
-#endif
-   .012,   /*lag_factor*/
-   QCONST16(.0002,15), /*lpc_floor*/
-   QCONST16(0.7f,15),
-   {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
-};
-
-
-const 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,
-};
-
-
-
-
 #ifdef EPIC_48K
 
 extern const signed char gain_cdbk_ulbr[];
@@ -656,13 +447,3 @@
    return mode->query(mode->mode, request, ptr);
 }
 
-const SpeexMode * speex_lib_get_mode (int mode)
-{
-#ifdef EPIC_48K
-  if (mode == SPEEX_MODEID_NB_48K) return &speex_nb_48k_mode;
-#endif
-
-  if (mode < 0 || mode >= SPEEX_NB_MODES) return NULL;
-
-  return speex_mode_list[mode];
-}

Added: trunk/speex/libspeex/modes_wb.c
===================================================================
--- trunk/speex/libspeex/modes_wb.c	                        (rev 0)
+++ trunk/speex/libspeex/modes_wb.c	2007-10-21 14:52:05 UTC (rev 14028)
@@ -0,0 +1,304 @@
+/* Copyright (C) 2002-2007 Jean-Marc Valin 
+   File: modes.c
+
+   Describes the wideband 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.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#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"
+#include <math.h>
+#include "os_support.h"
+
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+const SpeexMode * const speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode};
+
+extern const signed char hexc_table[];
+extern const signed char hexc_10_32_table[];
+
+#ifndef DISABLE_WIDEBAND
+
+/* Split-VQ innovation for high-band wideband */
+static const 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 const split_cb_params split_cb_high_lbr = {
+   10,               /*subvect_size*/
+   4,               /*nb_subvect*/
+   hexc_10_32_table,       /*shape_cb*/
+   5,               /*shape_bits*/
+   0,
+};
+
+#endif
+
+
+static const 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,
+   -1,
+   36
+};
+
+
+static const 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,
+#ifdef DISABLE_WIDEBAND
+   NULL,
+#else
+   &split_cb_high_lbr,
+#endif
+   -1,
+   112
+};
+
+
+static const 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,
+#ifdef DISABLE_WIDEBAND
+   NULL,
+#else
+   &split_cb_high,
+#endif
+   -1,
+   192
+};
+
+static const 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,
+#ifdef DISABLE_WIDEBAND
+   NULL,
+#else
+   &split_cb_high,
+#endif
+   -1,
+   352
+};
+
+
+/* Split-band wideband CELP mode*/
+static const SpeexSBMode sb_wb_mode = {
+   &speex_nb_mode,
+   160,    /*frameSize*/
+   40,     /*subframeSize*/
+   8,     /*lpcSize*/
+   640,    /*bufSize*/
+#ifdef FIXED_POINT
+   29491, 19661, /* gamma1, gamma2 */
+#else
+   0.9, 0.6, /* gamma1, gamma2 */
+#endif
+   .012,   /*lag_factor*/
+   QCONST16(.0002,15), /*lpc_floor*/
+            QCONST16(0.9f,15),
+                     {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
+};
+
+
+const 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 const SpeexSBMode sb_uwb_mode = {
+   &speex_wb_mode,
+   320,    /*frameSize*/
+   80,     /*subframeSize*/
+   8,     /*lpcSize*/
+   1280,    /*bufSize*/
+#ifdef FIXED_POINT
+   29491, 19661, /* gamma1, gamma2 */
+#else
+   0.9, 0.6, /* gamma1, gamma2 */
+#endif
+   .012,   /*lag_factor*/
+   QCONST16(.0002,15), /*lpc_floor*/
+            QCONST16(0.7f,15),
+                     {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
+};
+
+int wb_mode_query(const void *mode, int request, void *ptr)
+{
+   const SpeexSBMode *m = (const 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;
+}
+
+
+const 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,
+};
+
+/* We have defined speex_lib_get_mode() as a macro in speex.h */
+#undef speex_lib_get_mode
+
+const SpeexMode * speex_lib_get_mode (int mode)
+{
+#ifdef EPIC_48K
+   if (mode == SPEEX_MODEID_NB_48K) return &speex_nb_48k_mode;
+#endif
+
+   if (mode < 0 || mode >= SPEEX_NB_MODES) return NULL;
+
+   return speex_mode_list[mode];
+}
+
+
+

Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c	2007-10-21 14:49:54 UTC (rev 14027)
+++ trunk/speex/libspeex/nb_celp.c	2007-10-21 14:52:05 UTC (rev 14028)
@@ -1187,7 +1187,9 @@
       st->pitch_gain_buf_idx = 0;
 }
 
-
+/* Just so we don't need to carry the complete wideband mode information */
+static const int wb_skip_table[8] = {0, 36, 112, 192, 352, 0, 0, 0};
+   
 int nb_decode(void *state, SpeexBits *bits, void *vout)
 {
    DecState *st;
@@ -1246,7 +1248,8 @@
             int submode;
             int advance;
             advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
-            speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);
+            /*speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);*/
+            advance = wb_skip_table[submode];
             if (advance < 0)
             {
                speex_notify("Invalid mode encountered. The stream is corrupted.");
@@ -1261,7 +1264,8 @@
             if (wideband)
             {
                advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
-               speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);
+               /*speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);*/
+               advance = wb_skip_table[submode];
                if (advance < 0)
                {
                   speex_notify("Invalid mode encountered. The stream is corrupted.");

Modified: trunk/speex/libspeex/speex.c
===================================================================
--- trunk/speex/libspeex/speex.c	2007-10-21 14:49:54 UTC (rev 14027)
+++ trunk/speex/libspeex/speex.c	2007-10-21 14:52:05 UTC (rev 14028)
@@ -209,31 +209,8 @@
    return 0;
 }
 
-int wb_mode_query(const void *mode, int request, void *ptr)
-{
-   const SpeexSBMode *m = (const 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_lib_ctl(int request, void *ptr)
 {
    switch (request)



More information about the commits mailing list