Clean up embedded targets
authorslicer <slicer@mumble.hive.no>
Thu, 7 Jan 2010 16:18:55 +0000 (17:18 +0100)
committerslicer <slicer@mumble.hive.no>
Thu, 7 Jan 2010 16:18:55 +0000 (17:18 +0100)
14 files changed:
symbian/speex.mmp
ti/Makefile.am
ti/speex_C54_test/speex_C54_test.pjt
ti/speex_C55_test/speex_C55_test.pjt
ti/speex_C64_test/speex_C64_test.pjt
ti/testenc-TI-C5x.c [deleted file]
ti/testenc-TI-C64x.c [deleted file]
tmv/cb_search_tm.h [deleted file]
tmv/filters_tm.h [deleted file]
tmv/lpc_tm.h [deleted file]
tmv/lsp_tm.h [deleted file]
tmv/ltp_tm.h [deleted file]
tmv/quant_lsp_tm.h [deleted file]
tmv/vq_tm.h [deleted file]

index 67b096e..2310096 100644 (file)
@@ -35,11 +35,6 @@ TARGETTYPE    lib
 UID           0\r
 MACRO         HAVE_CONFIG_H\r
 SOURCEPATH    ..\libspeex\r
-SOURCE        bits.c cb_search.c exc_5_64_table.c exc_5_256_table.c exc_8_128_table.c\r
-SOURCE        exc_10_16_table.c exc_10_32_table.c exc_20_32_table.c fftwrap.c kiss_fft.c kiss_fftr.c filterbank.c filters.c gain_table.c\r
-SOURCE        gain_table_lbr.c hexc_10_32_table.c hexc_table.c high_lsp_tables.c jitter.c\r
-SOURCE        lbr_48k_tables.c lpc.c lsp.c lsp_tables_nb.c ltp.c math_approx.c mdf.c misc.c\r
-SOURCE        modes.c nb_celp.c preprocess.c quant_lsp.c sb_celp.c smallft.c\r
-SOURCE        speex.c speex_callbacks.c speex_header.c stereo.c vbr.c vq.c window.c\r
+SOURCE        buffer.c fftwrap.c filterbank.c jitter.c kiss_fft.c kiss_fftr.c mdf.c preprocess.c resample.c scal.c smallft.c \r
 USERINCLUDE   . ..\include\speex\r
 SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\include\r
index 200ca19..fd3c496 100644 (file)
@@ -5,5 +5,5 @@
 
 SUBDIRS = speex_C54_test speex_C55_test speex_C64_test
 
-EXTRA_DIST = config.h testenc-TI-C5x.c os_support_custom.h testenc-TI-C64x.c
+EXTRA_DIST = config.h os_support_custom.h
 
index 73b94fa..3af7ced 100644 (file)
@@ -12,31 +12,16 @@ Config="Debug"
 Config="Release"\r
 \r
 [Source Files]\r
-Source="..\..\libspeex\bits.c"\r
-Source="..\..\libspeex\cb_search.c"\r
-Source="..\..\libspeex\exc_10_16_table.c"\r
-Source="..\..\libspeex\exc_10_32_table.c"\r
-Source="..\..\libspeex\exc_20_32_table.c"\r
-Source="..\..\libspeex\exc_5_256_table.c"\r
-Source="..\..\libspeex\exc_5_64_table.c"\r
-Source="..\..\libspeex\exc_8_128_table.c"\r
-Source="..\..\libspeex\filters.c"\r
-Source="..\..\libspeex\gain_table.c"\r
-Source="..\..\libspeex\gain_table_lbr.c"\r
-Source="..\..\libspeex\lpc.c"\r
-Source="..\..\libspeex\lsp.c"\r
-Source="..\..\libspeex\lsp_tables_nb.c"\r
-Source="..\..\libspeex\ltp.c"\r
-Source="..\..\libspeex\modes.c"\r
-Source="..\..\libspeex\nb_celp.c"\r
-Source="..\..\libspeex\quant_lsp.c"\r
-Source="..\..\libspeex\sb_celp.c"\r
-Source="..\..\libspeex\speex.c"\r
-Source="..\..\libspeex\speex_callbacks.c"\r
-Source="..\..\libspeex\vbr.c"\r
-Source="..\..\libspeex\vq.c"\r
-Source="..\..\libspeex\window.c"\r
-Source="..\..\ti\testenc-TI-C5x.c"\r
+Source="..\..\libspeexdsp\buffer.c"\r
+Source="..\..\libspeexdsp\fftwrap.c"\r
+Source="..\..\libspeexdsp\filterbank.c"\r
+Source="..\..\libspeexdsp\jitter.c"\r
+Source="..\..\libspeexdsp\kiss_fft.c"\r
+Source="..\..\libspeexdsp\kiss_fftr.c"\r
+Source="..\..\libspeexdsp\mdf.c"\r
+Source="..\..\libspeexdsp\preprocess.c"\r
+Source="..\..\libspeexdsp\resample.c"\r
+Source="..\..\libspeexdsp\scal.c"\r
 Source="speex_C54_test.cmd"\r
 \r
 ["Compiler" Settings: "Debug"]\r
index aad9f01..9aa766b 100644 (file)
@@ -12,31 +12,16 @@ Config="Debug"
 Config="Release"\r
 \r
 [Source Files]\r
-Source="..\..\libspeex\bits.c"\r
-Source="..\..\libspeex\cb_search.c"\r
-Source="..\..\libspeex\exc_10_16_table.c"\r
-Source="..\..\libspeex\exc_10_32_table.c"\r
-Source="..\..\libspeex\exc_20_32_table.c"\r
-Source="..\..\libspeex\exc_5_256_table.c"\r
-Source="..\..\libspeex\exc_5_64_table.c"\r
-Source="..\..\libspeex\exc_8_128_table.c"\r
-Source="..\..\libspeex\filters.c"\r
-Source="..\..\libspeex\gain_table.c"\r
-Source="..\..\libspeex\gain_table_lbr.c"\r
-Source="..\..\libspeex\lpc.c"\r
-Source="..\..\libspeex\lsp.c"\r
-Source="..\..\libspeex\lsp_tables_nb.c"\r
-Source="..\..\libspeex\ltp.c"\r
-Source="..\..\libspeex\modes.c"\r
-Source="..\..\libspeex\nb_celp.c"\r
-Source="..\..\libspeex\quant_lsp.c"\r
-Source="..\..\libspeex\sb_celp.c"\r
-Source="..\..\libspeex\speex.c"\r
-Source="..\..\libspeex\speex_callbacks.c"\r
-Source="..\..\libspeex\vbr.c"\r
-Source="..\..\libspeex\vq.c"\r
-Source="..\..\libspeex\window.c"\r
-Source="..\..\ti\testenc-TI-C5x.c"\r
+Source="..\..\libspeexdsp\buffer.c"\r
+Source="..\..\libspeexdsp\fftwrap.c"\r
+Source="..\..\libspeexdsp\filterbank.c"\r
+Source="..\..\libspeexdsp\jitter.c"\r
+Source="..\..\libspeexdsp\kiss_fft.c"\r
+Source="..\..\libspeexdsp\kiss_fftr.c"\r
+Source="..\..\libspeexdsp\mdf.c"\r
+Source="..\..\libspeexdsp\preprocess.c"\r
+Source="..\..\libspeexdsp\resample.c"\r
+Source="..\..\libspeexdsp\scal.c"\r
 Source="speex_C55_test.cmd"\r
 \r
 ["Compiler" Settings: "Debug"]\r
index 10c5356..6731260 100644 (file)
@@ -13,31 +13,16 @@ Config="Release"
 \r
 [Source Files]\r
 Source="..\..\..\..\CCStudio_v3.1\C6000\cgtools\lib\rts6400.lib"\r
-Source="..\..\libspeex\bits.c"\r
-Source="..\..\libspeex\cb_search.c"\r
-Source="..\..\libspeex\exc_10_16_table.c"\r
-Source="..\..\libspeex\exc_10_32_table.c"\r
-Source="..\..\libspeex\exc_20_32_table.c"\r
-Source="..\..\libspeex\exc_5_256_table.c"\r
-Source="..\..\libspeex\exc_5_64_table.c"\r
-Source="..\..\libspeex\exc_8_128_table.c"\r
-Source="..\..\libspeex\filters.c"\r
-Source="..\..\libspeex\gain_table.c"\r
-Source="..\..\libspeex\gain_table_lbr.c"\r
-Source="..\..\libspeex\lpc.c"\r
-Source="..\..\libspeex\lsp.c"\r
-Source="..\..\libspeex\lsp_tables_nb.c"\r
-Source="..\..\libspeex\ltp.c"\r
-Source="..\..\libspeex\modes.c"\r
-Source="..\..\libspeex\nb_celp.c"\r
-Source="..\..\libspeex\quant_lsp.c"\r
-Source="..\..\libspeex\sb_celp.c"\r
-Source="..\..\libspeex\speex.c"\r
-Source="..\..\libspeex\speex_callbacks.c"\r
-Source="..\..\libspeex\vbr.c"\r
-Source="..\..\libspeex\vq.c"\r
-Source="..\..\libspeex\window.c"\r
-Source="..\testenc-TI-C64x.c"\r
+Source="..\..\libspeexdsp\buffer.c"\r
+Source="..\..\libspeexdsp\fftwrap.c"\r
+Source="..\..\libspeexdsp\filterbank.c"\r
+Source="..\..\libspeexdsp\jitter.c"\r
+Source="..\..\libspeexdsp\kiss_fft.c"\r
+Source="..\..\libspeexdsp\kiss_fftr.c"\r
+Source="..\..\libspeexdsp\mdf.c"\r
+Source="..\..\libspeexdsp\preprocess.c"\r
+Source="..\..\libspeexdsp\resample.c"\r
+Source="..\..\libspeexdsp\scal.c"\r
 Source="speex_C64_test.cmd"\r
 \r
 ["Compiler" Settings: "Debug"]\r
diff --git a/ti/testenc-TI-C5x.c b/ti/testenc-TI-C5x.c
deleted file mode 100644 (file)
index 4d72644..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-/* Copyright (C) 2005 Psi Systems, Inc.\r
-   File: testenc-TI-C5x.c\r
-   Encoder/Decoder Loop Main file for TI C54xx and C55xx processors\r
-   for use with TI Code Composer (TM) DSP development tools.\r
-   Modified from speexlib/testenc.c\r
-\r
-\r
-   Redistribution and use in source and binary forms, with or without\r
-   modification, are permitted provided that the following conditions\r
-   are met:\r
-   \r
-   - Redistributions of source code must retain the above copyright\r
-   notice, this list of conditions and the following disclaimer.\r
-   \r
-   - Redistributions in binary form must reproduce the above copyright\r
-   notice, this list of conditions and the following disclaimer in the\r
-   documentation and/or other materials provided with the distribution.\r
-   \r
-   - Neither the name of the Xiph.org Foundation nor the names of its\r
-   contributors may be used to endorse or promote products derived from\r
-   this software without specific prior written permission.\r
-   \r
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
-   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\r
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\r
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-*/\r
-\r
-#ifdef HAVE_CONFIG_H\r
-#include "config.h"\r
-#endif\r
-\r
-/* Modified from speexlib/testenc.c for Code Composer simulator */\r
-\r
-#include <speex/speex.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <speex/speex_callbacks.h>\r
-#include <..\libspeex\arch.h>\r
-\r
-#undef DECODE_ONLY\r
-#define CHECK_RESULT  /* Compares original file with encoded/decoder file */\r
-#define TESTENC_BYTES_PER_FRAME 20  /* 8kbps */\r
-#define TESTENC_QUALITY 4 /* 8kbps */\r
-//#define TESTENC_BYTES_PER_FRAME 28  /* 11kbps */\r
-//#define TESTENC_QUALITY 5          /* 11 kbps */\r
-\r
-/* For narrowband, QUALITY maps to these bit rates (see modes.c, manual.pdf) \r
- *   {1, 8, 2, 3, 3, 4, 4, 5, 5, 6, 7}\r
- * 0 -> 2150\r
- * 1 -> 3950\r
- * 2 -> 5950\r
- * 3 -> 8000\r
- * 4 -> 8000\r
- * 5 -> 11000\r
- * 6 -> 11000\r
- * 7 -> 15000\r
- * 8 -> 15000\r
- * 9 -> 18200\r
- *10 -> 26400  */\r
-\r
-#ifdef FIXED_DEBUG\r
-extern long long spx_mips;\r
-#endif\r
-#include <math.h>\r
-\r
-#ifdef MANUAL_ALLOC\r
-/* Take all Speex space from this private heap */ \r
-/* This is useful for multichannel applications */\r
-#pragma DATA_SECTION(spxHeap, ".myheap"); \r
-static char spxHeap[SPEEX_PERSIST_STACK_SIZE];\r
-\r
-#pragma DATA_SECTION(spxScratch, ".myheap"); \r
-static char spxScratch[SPEEX_SCRATCH_STACK_SIZE];\r
-\r
-char *spxGlobalHeapPtr, *spxGlobalHeapEnd;\r
-char *spxGlobalScratchPtr, *spxGlobalScratchEnd;\r
-#endif\r
-\r
-void byte2word(short* pInBuf, short* pOutBuf, int nWords)\r
-{\r
-   short *pIn, *pOut, sNext;\r
-   int i;\r
-   \r
-   pIn = pInBuf;\r
-   pOut = pOutBuf;\r
-   for(i=0;i<nWords;i++)\r
-   {\r
-      sNext = *pIn++;                  // Get low byte\r
-      *pOut++ = (sNext & 0x00ff) | (*pIn++ << 8);      // insert high byte\r
-   }\r
-}\r
-   \r
-void word2byte(short* pInBuf, short* pOutBuf, int nWords)\r
-{\r
-   short *pIn, *pOut;\r
-   int i;\r
-   \r
-   pIn = pInBuf;\r
-   pOut = pOutBuf;\r
-   for(i=0;i<nWords;i++)\r
-   {\r
-      *pOut++ = *pIn & 0x00ff; // Get low byte\r
-      *pOut++ = (short) ((unsigned short) *pIn++ >> 8);\r
-   }\r
-}\r
-   \r
-void main()\r
-{\r
-   char *outFile, *bitsFile;\r
-   FILE *fout, *fbits=NULL;\r
-#if !defined(DECODE_ONLY) || defined(CHECK_RESULT)\r
-   char *inFile;\r
-   FILE *fin;\r
-   short in_short[FRAME_SIZE];\r
-#endif\r
-   short out_short[FRAME_SIZE];\r
-   short inout_byte[2*FRAME_SIZE];\r
-#ifndef DECODE_ONLY\r
-   int nbChars;\r
-#endif\r
-#ifdef CHECK_RESULT\r
-   float sigpow,errpow,snr, seg_snr=0;\r
-   int snr_frames = 0;\r
-   int i;\r
-#endif\r
-   char cbits[TESTENC_BYTES_PER_FRAME/2 + 2];  /* temp store for encoded data */\r
-   void *st;\r
-   void *dec;\r
-   SpeexBits bits;\r
-   spx_int32_t tmp;\r
-   unsigned long bitCount=0;\r
-   spx_int32_t skip_group_delay;\r
-   SpeexCallback callback;\r
-\r
-   /* C54xx defaults to max wait states, even for parts like C5416 with \r
-      larger internal memory.  Need to force the wait state register to zero */\r
-\r
-#ifdef CONFIG_TI_C54X\r
-   asm("       STM     #0,SWWSR");\r
-#endif\r
-\r
-#ifdef CHECK_RESULT\r
-   sigpow = 0;\r
-   errpow = 0;\r
-#endif\r
-\r
-#ifdef MANUAL_ALLOC\r
-       spxGlobalHeapPtr = spxHeap;\r
-       spxGlobalHeapEnd = spxHeap + sizeof(spxHeap);\r
-\r
-       spxGlobalScratchPtr = spxScratch;\r
-       spxGlobalScratchEnd = spxScratch + sizeof(spxScratch);\r
-#endif\r
-   st = speex_encoder_init(&speex_nb_mode);\r
-#ifdef MANUAL_ALLOC\r
-       spxGlobalScratchPtr = spxScratch;               /* Reuse scratch for decoder */\r
-#endif\r
-   dec = speex_decoder_init(&speex_nb_mode);\r
-\r
-   callback.callback_id = SPEEX_INBAND_CHAR;\r
-   callback.func = speex_std_char_handler;\r
-   callback.data = stderr;\r
-   speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback);\r
-\r
-   callback.callback_id = SPEEX_INBAND_MODE_REQUEST;\r
-   callback.func = speex_std_mode_request_handler;\r
-   callback.data = st;\r
-   speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback);\r
-\r
-   tmp=0;\r
-   speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp);\r
-   tmp=0;\r
-   speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp);\r
-   tmp=TESTENC_QUALITY;\r
-   speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp);\r
-   tmp=1;  /* Lowest */\r
-   speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);\r
-\r
-#ifdef DISABLE_HIGHPASS\r
-   /* Turn this off if you want to measure SNR (on by default) */\r
-   tmp=0;\r
-   speex_encoder_ctl(st, SPEEX_SET_HIGHPASS, &tmp);\r
-   speex_decoder_ctl(dec, SPEEX_SET_HIGHPASS, &tmp);\r
-#endif\r
-\r
-   speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay);\r
-   speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp);\r
-   skip_group_delay += tmp;\r
-   fprintf (stderr, "decoder lookahead = %ld\n", skip_group_delay);\r
-\r
-#ifdef DECODE_ONLY\r
-   bitsFile = "c:\\speextrunktest\\samples\\malebitsin.dat";\r
-   fbits = fopen(bitsFile, "rb");\r
-#else\r
-   bitsFile = "c:\\speextrunktest\\samples\\malebits5x.dat";\r
-   fbits = fopen(bitsFile, "wb");\r
-#endif\r
-#if !defined(DECODE_ONLY) || defined(CHECK_RESULT)\r
-   inFile = "c:\\speextrunktest\\samples\\male.snd";\r
-   fin = fopen(inFile, "rb");\r
-#endif\r
-   outFile = "c:\\speextrunktest\\samples\\maleout5x.snd";\r
-   fout = fopen(outFile, "wb+");\r
\r
-   speex_bits_init(&bits);\r
-#ifndef DECODE_ONLY\r
-   while (!feof(fin))\r
-   {\r
-      fread(inout_byte, 2, FRAME_SIZE, fin);\r
-      byte2word(inout_byte, in_short, FRAME_SIZE);  /* C5x has 16-bit char */\r
-\r
-      if (feof(fin))\r
-         break;\r
-      speex_bits_reset(&bits);\r
-\r
-      speex_encode_int(st, in_short, &bits);\r
-      nbChars = speex_bits_write(&bits, cbits, \r
-                         sizeof(cbits)*BYTES_PER_CHAR) /BYTES_PER_CHAR;\r
-      bitCount+=bits.nbBits;\r
-\r
-      word2byte((short *) cbits, inout_byte, nbChars);\r
-      fwrite(inout_byte, 2, nbChars, fbits);\r
-      speex_bits_rewind(&bits);\r
-\r
-#else /* DECODE_ONLY */\r
-   while (!feof(fbits))\r
-   {\r
-      fread(inout_byte, 1, TESTENC_BYTES_PER_FRAME, fbits);\r
-\r
-      if (feof(fbits))\r
-         break;\r
-\r
-      byte2word(inout_byte, (short *)cbits, TESTENC_BYTES_PER_FRAME/2);\r
-      speex_bits_read_from(&bits, cbits, TESTENC_BYTES_PER_FRAME);\r
-      bitCount+=160;\r
-#endif\r
-      speex_decode_int(dec, &bits, out_short);\r
-      speex_bits_reset(&bits);\r
-\r
-      word2byte(&out_short[skip_group_delay], inout_byte, FRAME_SIZE-skip_group_delay);\r
-      fwrite(inout_byte, 2, FRAME_SIZE-skip_group_delay, fout);\r
-      skip_group_delay = 0;\r
-#if 1\r
-   fprintf (stderr, "Bits so far: %lu \n", bitCount);\r
-#endif\r
-   }\r
-   fprintf (stderr, "Total encoded size: %lu bits\n", bitCount);\r
-   speex_encoder_destroy(st);\r
-   speex_decoder_destroy(dec);\r
-\r
-#ifdef CHECK_RESULT\r
-   rewind(fin);\r
-   rewind(fout);\r
-\r
-   while ( FRAME_SIZE == fread(inout_byte, 2, FRAME_SIZE, fin)) \r
-   {\r
-       float s=0, e=0;\r
-\r
-    byte2word(inout_byte, in_short, FRAME_SIZE);\r
-    fread(inout_byte, 2, FRAME_SIZE, fout);\r
-    byte2word(inout_byte, out_short, FRAME_SIZE);\r
-\r
-        for (i=0;i<FRAME_SIZE;++i) {\r
-            s += (float)in_short[i] * in_short[i];\r
-            e += ((float)in_short[i]-out_short[i]) * ((float)in_short[i]-out_short[i]);\r
-        }\r
-       seg_snr += 10*log10((s+160)/(e+160));\r
-       sigpow += s;\r
-       errpow += e;\r
-       snr_frames++;\r
-   }\r
-\r
-   snr = 10 * log10( sigpow / errpow );\r
-   seg_snr /= snr_frames;\r
-   fprintf(stderr,"SNR = %f\nsegmental SNR = %f\n",snr, seg_snr);\r
-\r
-#ifdef FIXED_DEBUG\r
-   printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames));\r
-#endif\r
-#endif /* CHECK_RESULT */\r
-#if !defined(DECODE_ONLY) || defined(CHECK_RESULT)\r
-   fclose(fin);\r
-#endif\r
-   fclose(fout);\r
-   fclose(fbits);\r
-}\r
diff --git a/ti/testenc-TI-C64x.c b/ti/testenc-TI-C64x.c
deleted file mode 100644 (file)
index 8d6e97a..0000000
+++ /dev/null
@@ -1,249 +0,0 @@
-/* Copyright (C) 2005 Psi Systems, Inc.\r
-   Author:  Jean-Marc Valin \r
-   File: testenc-TI-C64x.c\r
-   Encoder/Decoder Loop Main file for TI TMS320C64xx processor\r
-   for use with TI Code Composer (TM) DSP development tools.\r
-   Modified from speexlib/testenc.c\r
-\r
-\r
-   Redistribution and use in source and binary forms, with or without\r
-   modification, are permitted provided that the following conditions\r
-   are met:\r
-   \r
-   - Redistributions of source code must retain the above copyright\r
-   notice, this list of conditions and the following disclaimer.\r
-   \r
-   - Redistributions in binary form must reproduce the above copyright\r
-   notice, this list of conditions and the following disclaimer in the\r
-   documentation and/or other materials provided with the distribution.\r
-   \r
-   - Neither the name of the Xiph.org Foundation nor the names of its\r
-   contributors may be used to endorse or promote products derived from\r
-   this software without specific prior written permission.\r
-   \r
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
-   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\r
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\r
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-*/\r
-\r
-#ifdef HAVE_CONFIG_H\r
-#include "config.h"\r
-#endif\r
-\r
-#include <speex/speex.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <speex/speex_callbacks.h>\r
-\r
-#undef DECODE_ONLY\r
-#define CHECK_RESULT  /* Compares original file with encoded/decoder file */\r
-#define TESTENC_BYTES_PER_FRAME 20  /* 8kbps */\r
-#define TESTENC_QUALITY 4 /* 8kbps */\r
-//#define TESTENC_BYTES_PER_FRAME 28  /* 11kbps */\r
-//#define TESTENC_QUALITY 5          /* 11 kbps */\r
-\r
-/* For narrowband, QUALITY maps to these bit rates (see modes.c, manual.pdf) \r
- *   {1, 8, 2, 3, 3, 4, 4, 5, 5, 6, 7}\r
- * 0 -> 2150\r
- * 1 -> 3950\r
- * 2 -> 5950\r
- * 3 -> 8000\r
- * 4 -> 8000\r
- * 5 -> 11000\r
- * 6 -> 11000\r
- * 7 -> 15000\r
- * 8 -> 15000\r
- * 9 -> 18200\r
- *10 -> 26400  */\r
-\r
-#ifdef FIXED_DEBUG\r
-extern long long spx_mips;\r
-#endif\r
-\r
-#ifdef MANUAL_ALLOC\r
-/* Take all Speex space from this private heap */ \r
-/* This is useful for multichannel applications */\r
-#pragma DATA_SECTION(spxHeap, ".myheap"); \r
-static char spxHeap[SPEEX_PERSIST_STACK_SIZE];\r
-\r
-#pragma DATA_SECTION(spxScratch, ".myheap"); \r
-static char spxScratch[SPEEX_SCRATCH_STACK_SIZE];\r
-\r
-char *spxGlobalHeapPtr, *spxGlobalHeapEnd;\r
-char *spxGlobalScratchPtr, *spxGlobalScratchEnd;\r
-#endif    /* MANUAL_ALLOC */\r
-\r
-#include <math.h>\r
-void main()\r
-{\r
-   char *outFile, *bitsFile;\r
-   FILE *fout, *fbits=NULL;\r
-#if !defined(DECODE_ONLY) || defined(CHECK_RESULT)\r
-   char *inFile;\r
-   FILE *fin;\r
-   short in_short[FRAME_SIZE];\r
-#endif\r
-   short out_short[FRAME_SIZE];\r
-#ifndef DECODE_ONLY\r
-   int nbBits;\r
-#endif\r
-#ifdef CHECK_RESULT\r
-   float sigpow,errpow,snr, seg_snr=0;\r
-   int snr_frames = 0;\r
-   int i;\r
-#endif\r
-   char cbits[200];\r
-   void *st;\r
-   void *dec;\r
-   SpeexBits bits;\r
-   spx_int32_t tmp;\r
-   unsigned long bitCount=0;\r
-   spx_int32_t skip_group_delay;\r
-   SpeexCallback callback;\r
-\r
-#ifdef CHECK_RESULT\r
-   sigpow = 0;\r
-   errpow = 0;\r
-#endif\r
-\r
-#ifdef MANUAL_ALLOC\r
-       spxGlobalHeapPtr = spxHeap;\r
-       spxGlobalHeapEnd = spxHeap + sizeof(spxHeap);\r
-\r
-       spxGlobalScratchPtr = spxScratch;\r
-       spxGlobalScratchEnd = spxScratch + sizeof(spxScratch);\r
-#endif\r
-   st = speex_encoder_init(&speex_nb_mode);\r
-#ifdef MANUAL_ALLOC\r
-       spxGlobalScratchPtr = spxScratch;               /* Reuse scratch for decoder */\r
-#endif\r
-   dec = speex_decoder_init(&speex_nb_mode);\r
-\r
-   callback.callback_id = SPEEX_INBAND_CHAR;\r
-   callback.func = speex_std_char_handler;\r
-   callback.data = stderr;\r
-   speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback);\r
-\r
-   callback.callback_id = SPEEX_INBAND_MODE_REQUEST;\r
-   callback.func = speex_std_mode_request_handler;\r
-   callback.data = st;\r
-   speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback);\r
-\r
-   tmp=0;\r
-   speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp);\r
-   tmp=0;\r
-   speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp);\r
-   tmp=TESTENC_QUALITY;\r
-   speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp);\r
-   tmp=1;  /* Lowest */\r
-   speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);\r
-\r
-#ifdef DISABLE_HIGHPASS\r
-   /* Turn this off if you want to measure SNR (on by default) */\r
-   tmp=0;\r
-   speex_encoder_ctl(st, SPEEX_SET_HIGHPASS, &tmp);\r
-   speex_decoder_ctl(dec, SPEEX_SET_HIGHPASS, &tmp);\r
-#endif\r
-\r
-   speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay);\r
-   speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp);\r
-   skip_group_delay += tmp;\r
-   fprintf (stderr, "decoder lookahead = %d\n", skip_group_delay);\r
-\r
-#ifdef DECODE_ONLY\r
-   bitsFile = "c:\\speextrunktest\\samples\\malebitsin.dat";\r
-   fbits = fopen(bitsFile, "rb");\r
-#else\r
-   bitsFile = "c:\\speextrunktest\\samples\\malebits6x.dat";\r
-   fbits = fopen(bitsFile, "wb");\r
-#endif\r
-#if !defined(DECODE_ONLY) || defined(CHECK_RESULT)\r
-   inFile = "c:\\speextrunktest\\samples\\male.snd";\r
-   fin = fopen(inFile, "rb");\r
-#endif\r
-   outFile = "c:\\speextrunktest\\samples\\maleout6x.snd";\r
-   fout = fopen(outFile, "wb+");\r
\r
-   speex_bits_init(&bits);\r
-#ifndef DECODE_ONLY\r
-   while (!feof(fin))\r
-   {\r
-      fread(in_short, sizeof(short), FRAME_SIZE, fin);\r
-      if (feof(fin))\r
-         break;\r
-      speex_bits_reset(&bits);\r
-\r
-      speex_encode_int(st, in_short, &bits);\r
-      nbBits = speex_bits_write(&bits, cbits, 200);\r
-      bitCount+=bits.nbBits;\r
-\r
-      fwrite(cbits, 1, nbBits, fbits);\r
-      speex_bits_rewind(&bits);\r
-\r
-#else /* DECODE_ONLY */\r
-   while (!feof(fbits))\r
-   {\r
-      fread(cbits, 1, TESTENC_BYTES_PER_FRAME, fbits);\r
-\r
-      if (feof(fbits))\r
-         break;\r
-\r
-      speex_bits_read_from(&bits, cbits, TESTENC_BYTES_PER_FRAME);\r
-//      bitCount+=160;  /* only correct for 8kbps, but just for the printf */\r
-      bitCount+=bits.nbBits;\r
-#endif\r
-      \r
-      speex_decode_int(dec, &bits, out_short);\r
-      speex_bits_reset(&bits);\r
-\r
-      fwrite(&out_short[skip_group_delay], sizeof(short), FRAME_SIZE-skip_group_delay, fout);\r
-      skip_group_delay = 0;\r
-#if 1\r
-   fprintf (stderr, "Bits so far: %lu \n", bitCount);\r
-#endif\r
-   }\r
-   fprintf (stderr, "Total encoded size: %lu bits\n", bitCount);\r
-   speex_encoder_destroy(st);\r
-   speex_decoder_destroy(dec);\r
-\r
-#ifdef CHECK_RESULT \r
-   rewind(fin);\r
-   rewind(fout);\r
-\r
-   while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin) \r
-           &&\r
-           FRAME_SIZE ==  fread(out_short, sizeof(short), FRAME_SIZE,fout) )\r
-   {\r
-       float s=0, e=0;\r
-        for (i=0;i<FRAME_SIZE;++i) {\r
-            s += (float)in_short[i] * in_short[i];\r
-            e += ((float)in_short[i]-out_short[i]) * ((float)in_short[i]-out_short[i]);\r
-        }\r
-       seg_snr += 10*log10((s+160)/(e+160));\r
-       sigpow += s;\r
-       errpow += e;\r
-       snr_frames++;\r
-   }\r
-\r
-   snr = 10 * log10( sigpow / errpow );\r
-   seg_snr /= snr_frames;\r
-   fprintf(stderr,"SNR = %f\nsegmental SNR = %f\n",snr, seg_snr);\r
-\r
-#ifdef FIXED_DEBUG\r
-   printf ("Total: %f MIPS\n", (float)(1e-6*50*spx_mips/snr_frames));\r
-#endif\r
-#endif /* CHECK_RESULT */\r
-#if !defined(DECODE_ONLY) || defined(CHECK_RESULT)\r
-   fclose(fin);\r
-#endif\r
-   fclose(fout);\r
-   fclose(fbits);\r
-}\r
diff --git a/tmv/cb_search_tm.h b/tmv/cb_search_tm.h
deleted file mode 100644 (file)
index 15ca1d5..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Copyright (C) 2007 Hong Zhiqian */\r
-/**\r
-   @file cb_search_tm.h\r
-   @author Hong Zhiqian\r
-   @brief Various compatibility routines for Speex (TriMedia version)\r
-*/\r
-/*\r
-   Redistribution and use in source and binary forms, with or without\r
-   modification, are permitted provided that the following conditions\r
-   are met:\r
-   \r
-   - Redistributions of source code must retain the above copyright\r
-   notice, this list of conditions and the following disclaimer.\r
-   \r
-   - Redistributions in binary form must reproduce the above copyright\r
-   notice, this list of conditions and the following disclaimer in the\r
-   documentation and/or other materials provided with the distribution.\r
-   \r
-   - Neither the name of the Xiph.org Foundation nor the names of its\r
-   contributors may be used to endorse or promote products derived from\r
-   this software without specific prior written permission.\r
-   \r
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
-   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\r
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\r
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-*/\r
-\r
-#include <ops/custom_defs.h>\r
-#include "profile_tm.h"\r
-\r
-#ifdef FIXED_POINT\r
-\r
-#define OVERRIDE_COMPUTE_WEIGHTED_CODEBOOK\r
-static void compute_weighted_codebook(\r
-       const signed char * restrict shape_cb, \r
-       const Int16 * restrict r, \r
-       Int16 * restrict resp, \r
-       Int16 * restrict resp2, \r
-       Int32 * restrict E, \r
-       int shape_cb_size, int subvect_size, char *stack)\r
-{\r
-       register int i, j;\r
-       register int quadsize;\r
-\r
-       TMDEBUG_ALIGNMEM(r);\r
-       TMDEBUG_ALIGNMEM(resp);\r
-       TMDEBUG_ALIGNMEM(resp2);\r
-\r
-       COMPUTEWEIGHTEDCODEBOOK_START();\r
-\r
-       quadsize = subvect_size << 2;\r
-\r
-       for ( i=0 ; i<shape_cb_size ; i+=4 )\r
-       {       register int e0, e1, e2, e3;\r
-               \r
-               e0 = e1 = e2 = e3 = 0;\r
-               for( j=0 ; j<subvect_size ; ++j )\r
-               {\r
-                       register int k, rr;\r
-                       register int resj0, resj1, resj2, resj3;\r
-                       \r
-                       resj0 = resj1 = resj2 = resj3 = 0;\r
-\r
-                       for ( k=0 ; k<=j ; ++k )\r
-                       {       rr = r[j-k];\r
-                               \r
-                               resj0 += shape_cb[k] * rr;\r
-                               resj1 += shape_cb[k+subvect_size] * rr;\r
-                               resj2 += shape_cb[k+2*subvect_size] * rr;\r
-                               resj3 += shape_cb[k+3*subvect_size] * rr;\r
-                       }\r
-\r
-                       resj0 >>= 13;\r
-                       resj1 >>= 13;\r
-                       resj2 >>= 13;\r
-                       resj3 >>= 13;\r
-\r
-                       e0 += resj0 * resj0;\r
-                       e1 += resj1 * resj1;\r
-                       e2 += resj2 * resj2;\r
-                       e3 += resj3 * resj3;\r
-                       \r
-                       resp[j]                                 = resj0;\r
-                       resp[j+subvect_size]    = resj1;\r
-                       resp[j+2*subvect_size]  = resj2;\r
-                       resp[j+3*subvect_size]  = resj3;\r
-               }\r
-\r
-               E[i]            = e0;\r
-               E[i+1]          = e1;\r
-               E[i+2]          = e2;\r
-               E[i+3]          = e3;\r
-\r
-               resp            += quadsize;\r
-               shape_cb        += quadsize;\r
-       }\r
-       \r
-#ifndef        REMARK_ON\r
-       (void)resp2;\r
-       (void)stack;\r
-#endif\r
-\r
-       COMPUTEWEIGHTEDCODEBOOK_STOP();\r
-}\r
-\r
-#define OVERRIDE_TARGET_UPDATE\r
-static inline void target_update(Int16 * restrict t, Int16 g, Int16 * restrict r, int len)\r
-{\r
-       register int n;\r
-       register int gr1, gr2, t1, t2, r1, r2;\r
-       register int quadsize;\r
-\r
-       TARGETUPDATE_START();\r
-\r
-       quadsize = len & 0xFFFFFFFC;\r
-       \r
-       for ( n=0; n<quadsize ; n+=4 )\r
-       {       gr1 = pack16lsb(PSHR32((g * r[n]),13)  , PSHR32((g * r[n+1]),13));\r
-               gr2 = pack16lsb(PSHR32((g * r[n+2]),13), PSHR32((g * r[n+3]),13));\r
-               \r
-               t1      = pack16lsb(t[n],  t[n+1]);\r
-               t2      = pack16lsb(t[n+2],t[n+3]);\r
-\r
-               r1      = dspidualsub(t1, gr1);\r
-               r2      = dspidualsub(t2, gr2);\r
-\r
-               t[n]    = asri(16,r1);\r
-               t[n+1]  = sex16(r1);\r
-               t[n+2]  = asri(16,r2);\r
-               t[n+3]  = sex16(r2);\r
-       }\r
-\r
-       for ( n=quadsize ; n<len ; ++n )\r
-       {       t[n] = SUB16(t[n],PSHR32(MULT16_16(g,r[n]),13));\r
-       }\r
-\r
-       TARGETUPDATE_STOP();\r
-}\r
-\r
-#endif\r
-\r
diff --git a/tmv/filters_tm.h b/tmv/filters_tm.h
deleted file mode 100644 (file)
index 8f28102..0000000
+++ /dev/null
@@ -1,1521 +0,0 @@
-#include <ops/custom_defs.h>\r
-#include "profile_tm.h"\r
-\r
-#ifdef FIXED_POINT\r
-\r
-#define iadd(a,b)      ((a) + (b))\r
-\r
-#define OVERRIDE_BW_LPC\r
-void bw_lpc(Int16 gamma, const Int16 *lpc_in, Int16 *lpc_out, int order)\r
-{\r
-       register int tmp, g, i;\r
-       \r
-       TMDEBUG_ALIGNMEM(lpc_in);\r
-       TMDEBUG_ALIGNMEM(lpc_out);\r
-\r
-       BWLPC_START();\r
-\r
-       tmp = g = gamma;\r
-       for ( i=0 ; i<4 ; i+=2,lpc_out+=4 )\r
-       {       register int in10, y1, y0, y10;\r
-               register int in32, y3, y2, y32;\r
-\r
-               in10 = ld32x(lpc_in,i);\r
-               y0       = ((tmp * sex16(in10)) + 16384) >> 15;\r
-               tmp  = ((tmp * g) + 16384) >> 15;\r
-               y1       = ((tmp * asri(16,in10)) + 16384) >> 15;\r
-               tmp  = ((tmp * g) + 16384) >> 15;\r
-               y10  =  pack16lsb(y1,y0);\r
-               st32(lpc_out,y10);\r
-\r
-               in32 = ld32x(lpc_in,i+1);\r
-               y2       = ((tmp * sex16(in32)) + 16384) >> 15;\r
-               tmp  = ((tmp * g) + 16384) >> 15;\r
-               y3       = ((tmp * asri(16,in32)) + 16384) >> 15;\r
-               tmp  = ((tmp * g) + 16384) >> 15;\r
-               y32  =  pack16lsb(y3,y2);\r
-               st32d(4,lpc_out,y32);\r
-       }\r
-\r
-       if ( order == 10 )\r
-       {       register int in10, y1, y0, y10;\r
-               \r
-               in10 = ld32x(lpc_in,i);\r
-               y0       = ((tmp * sex16(in10)) + 16384) >> 15;\r
-               tmp  = ((tmp * g) + 16384) >> 15;\r
-               y1       = ((tmp * asri(16,in10)) + 16384) >> 15;\r
-               tmp  = ((tmp * g) + 16384) >> 15;\r
-               y10  =  pack16lsb(y1,y0);\r
-               st32(lpc_out,y10);\r
-       }\r
-\r
-       BWLPC_STOP();\r
-}\r
-\r
-\r
-#define OVERRIDE_HIGHPASS\r
-void highpass(const Int16 *x, Int16 *y, int len, int filtID, Int32 *mem)\r
-{\r
-       const Int16 Pcoef[5][3] = {{16384, -31313, 14991}, {16384, -31569, 15249}, {16384, -31677, 15328}, {16384, -32313, 15947}, {16384, -22446, 6537}};\r
-       const Int16 Zcoef[5][3] = {{15672, -31344, 15672}, {15802, -31601, 15802}, {15847, -31694, 15847}, {16162, -32322, 16162}, {14418, -28836, 14418}};\r
-       register int i;\r
-       register int den1, den2, num0, num1, num2, den11, den22, mem0, mem1;\r
-   \r
-       TMDEBUG_ALIGNMEM(mem);\r
-\r
-       HIGHPASS_START();\r
-\r
-       filtID = imin(4, filtID);\r
-\r
-       den1 = -Pcoef[filtID][1];\r
-       den2 = -Pcoef[filtID][2];\r
-       num0 = Zcoef[filtID][0];\r
-       num1 = Zcoef[filtID][1];\r
-       num2 = Zcoef[filtID][2];\r
-       den11 = den1 << 1;\r
-       den22 = den2 << 1;\r
-       mem0 = mem[0];\r
-       mem1 = mem[1];\r
-       \r
-#if (TM_UNROLL && TM_UNROLL_HIGHPASS)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-       for ( i=0 ; i<len ; ++i )\r
-       {\r
-               register int yi;\r
-               register int vout, xi, vout_i, vout_d;\r
-                       \r
-               xi = x[i];\r
-\r
-               vout    = num0 * xi + mem0;\r
-               vout_i  = vout >> 15;\r
-               vout_d  = vout & 0x7FFF;\r
-               yi              = iclipi(PSHR32(vout,14),32767);\r
-               mem0    = (mem1 + num1 * xi) + (den11 * vout_i) + (((den1 * vout_d) >> 15) << 1);\r
-               mem1    = (num2 * xi) + (den22 * vout_i) + (((den2 *  vout_d) >> 15) << 1);\r
-               \r
-               y[i] = yi;\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_HIGHPASS)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-\r
-       mem[0] = mem0;\r
-       mem[1] = mem1;\r
-\r
-       HIGHPASS_STOP();\r
-}\r
-\r
-\r
-#define OVERRIDE_SIGNALMUL\r
-void signal_mul(const Int32 *x, Int32 *y, Int32 scale, int len)\r
-{\r
-       register int i, scale_i, scale_d;\r
-   \r
-       SIGNALMUL_START();\r
-\r
-       scale_i = scale >> 14;\r
-       scale_d = scale & 0x3FFF;\r
-\r
-#if (TM_UNROLL && TM_UNROLL_SIGNALMUL)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-       for ( i=0 ; i<len ; ++i)\r
-       {\r
-               register int xi;\r
-\r
-               xi = x[i] >> 7;\r
-\r
-               y[i] = ((xi * scale_i + ((xi * scale_d) >> 14)) << 7);\r
-                       \r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_SIGNALMUL)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-\r
-       SIGNALMUL_STOP();\r
-}\r
-\r
-#define OVERRIDE_SIGNALDIV\r
-void signal_div(const Int16 *x, Int16 *y, Int32 scale, int len)\r
-{\r
-       register int i;\r
-   \r
-       SIGNALDIV_START();\r
-\r
-       if (scale > SHL32(EXTEND32(SIG_SCALING), 8))\r
-       {\r
-               register int scale_1;\r
-               scale   = PSHR32(scale, SIG_SHIFT);\r
-               scale_1 = DIV32_16(SHL32(EXTEND32(SIG_SCALING),7),scale);\r
-#if (TM_UNROLL && TM_UNROLL_SIGNALDIV)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-               for ( i=0 ; i<len ; ++i)\r
-               {\r
-                       y[i] = MULT16_16_P15(scale_1, x[i]);\r
-               }\r
-#if (TM_UNROLL && TM_UNROLL_SIGNALDIV)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-       } else if (scale > SHR32(EXTEND32(SIG_SCALING), 2)) {\r
-      \r
-               register int scale_1;\r
-               scale   = PSHR32(scale, SIG_SHIFT-5);\r
-               scale_1 = DIV32_16(SHL32(EXTEND32(SIG_SCALING),3),scale);\r
-#if (TM_UNROLL && TM_UNROLL_SIGNALDIV)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-               for (i=0;i<len;i++)\r
-               {\r
-                       y[i] = PSHR32(MULT16_16(scale_1, SHL16(x[i],2)),8);\r
-               }\r
-#if (TM_UNROLL && TM_UNROLL_SIGNALDIV)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-       } else {\r
-               \r
-               register int scale_1;\r
-               scale = PSHR32(scale, SIG_SHIFT-7);\r
-               scale = imax(5,scale);\r
-               scale_1 = DIV32_16(SHL32(EXTEND32(SIG_SCALING),3),scale);\r
-\r
-#if (TM_UNROLL && TM_UNROLL_SIGNALDIV)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-               for (i=0;i<len;i++)\r
-               {\r
-                        y[i] = PSHR32(MULT16_16(scale_1, SHL16(x[i],2)),6);\r
-               }\r
-#if (TM_UNROLL && TM_UNROLL_SIGNALDIV)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-       }\r
-\r
-       SIGNALMUL_STOP();\r
-}\r
-\r
-\r
-#define OVERRIDE_COMPUTE_RMS\r
-Int16 compute_rms(const Int32 *x, int len)\r
-{\r
-       register int i;\r
-       register int sum=0;\r
-       register int max_val=1;\r
-       register int sig_shift;\r
-       \r
-       TMDEBUG_ALIGNMEM(x);\r
-\r
-       for ( i=0 ; i<len ; i+=4 )\r
-       {\r
-               register int tmp0, tmp1, tmp2, tmp3;\r
-\r
-               tmp0 = ld32x(x,i);\r
-               tmp1 = ld32x(x,i+1);\r
-\r
-               tmp0 = iabs(tmp0);\r
-               tmp1 = iabs(tmp1);\r
-\r
-               tmp2 = ld32x(x,i+2);\r
-               tmp3 = ld32x(x,i+3);\r
-\r
-               tmp2 = iabs(tmp2);\r
-               tmp3 = iabs(tmp3);\r
-\r
-               tmp0 = imax(tmp0, tmp1);\r
-               max_val = imax(max_val, tmp0); \r
-               tmp2 = imax(tmp2, tmp3);                \r
-               max_val = imax(max_val, tmp2);\r
-       }\r
-\r
-       sig_shift = 0;\r
-       while ( max_val>16383 )\r
-       {       sig_shift++;\r
-               max_val >>= 1;\r
-       }\r
-\r
-\r
-       for ( i=0 ; i<len ; i+=4 )\r
-       {\r
-               register int acc0, acc1, acc2;\r
-\r
-               acc0 =  pack16lsb(ld32x(x,i) >> sig_shift, ld32x(x,i+1) >> sig_shift);\r
-               acc1 =  pack16lsb(ld32x(x,i+2) >> sig_shift, ld32x(x,i+3) >> sig_shift);\r
-               acc2 =  ifir16(acc0,acc0) + ifir16(acc1, acc1);\r
-               sum      += acc2 >> 6;\r
-       }\r
-   \r
-   return EXTRACT16(PSHR32(SHL32(EXTEND32(spx_sqrt(DIV32(sum,len))),(sig_shift+3)),SIG_SHIFT));\r
-}\r
-\r
-#define OVERRIDE_COMPUTE_RMS16\r
-Int16 compute_rms16(const Int16 *x, int len)\r
-{\r
-       register int max_val, i;\r
-       \r
-       COMPUTERMS16_START();\r
-       \r
-       max_val = 10;\r
-\r
-#if 0\r
-\r
-       {\r
-               register int len2 = len >> 1;\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTERMS16)\r
-#pragma TCS_unroll=2\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-               for ( i=0 ; i<len2 ; i+=2 )\r
-               {\r
-                       register int x10, x32;\r
-\r
-                       x10 = ld32x(x,i);\r
-                       x32 = ld32x(x,i+1);\r
-                        \r
-                       x10 = dspidualabs(x10);\r
-                       x32 = dspidualabs(x32);\r
-                       \r
-                       x10 = imax(sex16(x10), asri(16,x10));\r
-                       x32 = imax(sex16(x32), asri(16,x32));\r
-                       \r
-                       max_val = imax(max_val,x10);\r
-                       max_val = imax(max_val,x32);\r
-               }\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTERMS16)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-               if (max_val>16383)\r
-               {\r
-                       register int sum = 0;\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTERMS16)\r
-#pragma TCS_unroll=2\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-                       for ( i=0 ; i<len_2; i+=2 )\r
-                       {\r
-                               register int x10, x32;\r
-                               register int acc0, acc1;\r
-\r
-                               x10 = ld32x(x,i);\r
-                               x32 = ld32x(x,i+1);\r
-                               \r
-                               x10 = dualasr(x10,1);\r
-                               x32 = dualasr(x32,1);\r
-\r
-                               acc0 = ifir16(x10,x10);\r
-                               acc1 = ifir16(x32,x32);\r
-                               sum  += (acc0 + acc1) >> 6;\r
-                       }\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTERMS16)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-                       COMPUTERMS16_STOP();\r
-                       return spx_sqrt(sum/len) << 4;\r
-               } else \r
-               {\r
-                       register int sig_shift;\r
-                       register int sum=0;\r
-\r
-                       sig_shift = mux(max_val < 8192, 1, 0);\r
-                       sig_shift = mux(max_val < 4096, 2, sig_shift);\r
-                       sig_shift = mux(max_val < 2048, 3, sig_shift);\r
-\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTERMS16)\r
-#pragma TCS_unroll=2\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-                       for ( i=0 ; i<len_2 ; i+=2 )\r
-                       {\r
-                               register int x10, x32;\r
-                               register int acc0, acc1;\r
-\r
-                               x10 = ld32x(x,i);\r
-                               x32 = ld32x(x,i+1);\r
-\r
-                               x10 = dualasl(x10,sig_shift);\r
-                               x32 = dualasl(x32,sig_shift);\r
-                               \r
-                               acc0 = ifir16(x10,x10);\r
-                               acc1 = ifir16(x32,x32);\r
-                               sum  += (acc0 + acc1) >> 6;\r
-                       }\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTERMS16)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-                       COMPUTERMS16_STOP();\r
-                       return spx_sqrt(sum/len) << (3 - sig_shift);  \r
-               }\r
-       }\r
-\r
-#else\r
-       {\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTERMS16)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-               for ( i=0 ; i<len ; ++i )\r
-               {\r
-                       register int xi;\r
-\r
-                       xi = x[i];\r
-                       xi = iabs(xi);\r
-                       max_val = imax(xi,max_val);\r
-               }\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTERMS16)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-               if (max_val>16383)\r
-               {\r
-                       register int sum = 0;\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTERMS16)\r
-#pragma TCS_unroll=2\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-                       for ( i=0 ; i<len ; i+=4 )\r
-                       {\r
-                               register int x10, x32;\r
-                               register int acc0, acc1;\r
-\r
-                               x10 = pack16lsb(x[i+1],x[i]);\r
-                               x32 = pack16lsb(x[i+3],x[i+2]);\r
-                               \r
-                               x10 = dualasr(x10,1);\r
-                               x32 = dualasr(x32,1);\r
-\r
-                               acc0 = ifir16(x10,x10);\r
-                               acc1 = ifir16(x32,x32);\r
-                               sum  += (acc0 + acc1) >> 6;\r
-                       }\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTERMS16)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-                       COMPUTERMS16_STOP();\r
-                       return spx_sqrt(sum/len) << 4;\r
-               } else {\r
-                       register int sig_shift;\r
-                       register int sum=0;\r
-\r
-                       sig_shift = mux(max_val < 8192, 1, 0);\r
-                       sig_shift = mux(max_val < 4096, 2, sig_shift);\r
-                       sig_shift = mux(max_val < 2048, 3, sig_shift);\r
-\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTERMS16)\r
-#pragma TCS_unroll=2\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-                       for ( i=0 ; i<len ; i+=4 )\r
-                       {\r
-                               register int x10, x32;\r
-                               register int acc0, acc1;\r
-\r
-                               x10 = pack16lsb(x[i+1],x[i]);\r
-                               x32 = pack16lsb(x[i+3],x[i+2]);\r
-\r
-                               x10 = dualasl(x10,sig_shift);\r
-                               x32 = dualasl(x32,sig_shift);\r
-                               \r
-                               acc0 = ifir16(x10,x10);\r
-                               acc1 = ifir16(x32,x32);\r
-                               sum  += (acc0 + acc1) >> 6;\r
-                       }\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTERMS16)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-                       COMPUTERMS16_STOP();\r
-                       return spx_sqrt(sum/len) << (3 - sig_shift);  \r
-               }\r
-       }\r
-#endif\r
-}\r
-\r
-int normalize16_9(const Int32* restrict x, Int16 * restrict y, Int32 max_scale)\r
-{\r
-       register int x0, x1, x2, x3, x4, x5, x6, x7, x8;\r
-       register int max_val, m0, m1, m2, m3, m4;\r
-       register int sig_shift;\r
-       register int y10, y32, y54, y76;\r
-\r
-       TMDEBUG_ALIGNMEM(x);\r
-\r
-       x0 = ld32(x); \r
-       x1 = ld32x(x,1); x2 = ld32x(x,2); x3 = ld32x(x,3); x4 = ld32x(x,4); \r
-       x5 = ld32x(x,5); x6 = ld32x(x,6); x7 = ld32x(x,7); x8 = ld32x(x,8);\r
-\r
-       m0 = imax(iabs(x0), iabs(x1));\r
-       m1 = imax(iabs(x2), iabs(x3));\r
-       m2 = imax(iabs(x4), iabs(x5));\r
-       m3 = imax(iabs(x6), iabs(x7));\r
-       m4 = imax(m0, iabs(x8));\r
-       m1 = imax(m1, m2);\r
-       m3 = imax(m3, m4);\r
-       max_val = imax(1,imax(m1,m3));\r
-\r
-       sig_shift=0;\r
-       while (max_val>max_scale)\r
-       {       sig_shift++;\r
-               max_val >>= 1;\r
-       }\r
-\r
-       if ( sig_shift != 0 )\r
-       {\r
-               y10 = pack16lsb(x1 >> sig_shift, x0 >> sig_shift);\r
-               y32 = pack16lsb(x3 >> sig_shift, x2 >> sig_shift);\r
-               y54 = pack16lsb(x5 >> sig_shift, x4 >> sig_shift);\r
-               y76 = pack16lsb(x7 >> sig_shift, x6 >> sig_shift);\r
-\r
-               y[8] = x8 >> sig_shift;\r
-               st32(y,y10);\r
-               st32d(4,y,y32);\r
-               st32d(8,y,y54);\r
-               st32d(12,y,y76);\r
-       }\r
-       return sig_shift;\r
-}\r
-\r
-int normalize16_mod8(const Int32 * restrict x, Int16 * restrict y, Int32 max_scale,int len)\r
-{\r
-       register int i, max_val, sig_shift;\r
-       \r
-       TMDEBUG_ALIGNMEM(x);\r
-\r
-       max_val = 1;\r
-\r
-       for ( i=0 ; i<len ; i+=4 )\r
-       {\r
-               register int tmp0, tmp1, tmp2, tmp3;\r
-\r
-               tmp0 = ld32x(x,i);\r
-               tmp1 = ld32x(x,i+1);\r
-\r
-               tmp0 = iabs(tmp0);\r
-               tmp1 = iabs(tmp1);\r
-\r
-               tmp2 = ld32x(x,i+2);\r
-               tmp3 = ld32x(x,i+3);\r
-\r
-               tmp2 = iabs(tmp2);\r
-               tmp3 = iabs(tmp3);\r
-\r
-               tmp0 = imax(tmp0, tmp1);\r
-               max_val = imax(max_val, tmp0); \r
-               tmp2 = imax(tmp2, tmp3);                \r
-               max_val = imax(max_val, tmp2);\r
-       }\r
-\r
-       sig_shift=0;\r
-       while (max_val>max_scale)\r
-       {       sig_shift++;\r
-               max_val >>= 1;\r
-       }\r
-\r
-       if ( sig_shift != 0 )\r
-       {\r
-               for ( i=0 ; i<len ; i+=8, y+=8 )\r
-               {\r
-                       register int x0, x1, x2, x3, x4, x5, x6, x7;\r
-                       register int y10, y32, y54, y76;\r
-\r
-                       x0 = ld32x(x,i);   x1 = ld32x(x,i+1); x2 = ld32x(x,i+2); x3 = ld32x(x,i+3); \r
-                       x4 = ld32x(x,i+4); x5 = ld32x(x,i+5); x6 = ld32x(x,i+6); x7 = ld32x(x,i+7);\r
-\r
-                       y10 = pack16lsb(x1 >> sig_shift, x0 >> sig_shift);\r
-                       y32 = pack16lsb(x3 >> sig_shift, x2 >> sig_shift);\r
-                       y54 = pack16lsb(x5 >> sig_shift, x4 >> sig_shift);\r
-                       y76 = pack16lsb(x7 >> sig_shift, x6 >> sig_shift);\r
-\r
-                       st32(y,y10);\r
-                       st32d(4,y,y32);\r
-                       st32d(8,y,y54);\r
-                       st32d(12,y,y76);\r
-               }\r
-       }\r
-       return sig_shift;\r
-}\r
-\r
-\r
-#define OVERRIDE_NORMALIZE16\r
-int normalize16(const Int32 *x, Int16 *y, Int32 max_scale, int len)\r
-{\r
-       TMDEBUG_ALIGNMEM(x);\r
-       TMDEBUG_ALIGNMEM(y);\r
-\r
-       NORMALIZE16_START();\r
-\r
-       if ( len == 9 )\r
-       {       NORMALIZE16_STOP();\r
-               return normalize16_9(x,y,max_scale);\r
-       } else\r
-       {       NORMALIZE16_STOP();\r
-               return normalize16_mod8(x,y,max_scale,len);\r
-       }\r
-}\r
-\r
-\r
-void filter_mem16_10(const Int16 *x, const Int16 *num, const Int16 *den, Int16 *y, int N, Int32 *mem)\r
-{\r
-       register int i;\r
-       register int c9, c8, c7, c6, c5;\r
-       register int c4, c3, c2, c1, c0;\r
-       register int input;\r
-       register int output_0, output_1, output_2, output_3, output_4;\r
-       register int output_5, output_6, output_7, output_8, output_9;\r
-    register Int16 xi, yi;\r
-\r
-       c9 = pack16lsb(-den[9],num[9]);\r
-       c8 = pack16lsb(-den[8],num[8]);\r
-       c7 = pack16lsb(-den[7],num[7]);\r
-       c6 = pack16lsb(-den[6],num[6]);\r
-       c5 = pack16lsb(-den[5],num[5]);\r
-       c4 = pack16lsb(-den[4],num[4]);\r
-       c3 = pack16lsb(-den[3],num[3]);\r
-       c2 = pack16lsb(-den[2],num[2]);\r
-       c1 = pack16lsb(-den[1],num[1]);\r
-       c0 = pack16lsb(-den[0],num[0]);\r
-\r
-       output_0 = mem[0];\r
-       output_1 = mem[1];\r
-       output_2 = mem[2];\r
-       output_3 = mem[3];\r
-       output_4 = mem[4];\r
-       output_5 = mem[5];\r
-       output_6 = mem[6];\r
-       output_7 = mem[7];\r
-       output_8 = mem[8];\r
-       output_9 = mem[9];\r
-\r
-#if (TM_UNROLL && TM_UNROLL_FILTER)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-\r
-       for ( i=0 ; i<N ; i++ )\r
-    {\r
-               xi = (int)(x[i]);\r
-               yi = iclipi(iadd(xi,PSHR32(output_0,LPC_SHIFT)),32767);\r
-\r
-               input   = pack16lsb(yi,xi);\r
-               output_0= iadd(ifir16(c0,input),output_1);\r
-               output_1= iadd(ifir16(c1,input),output_2);\r
-               output_2= iadd(ifir16(c2,input),output_3);\r
-               output_3= iadd(ifir16(c3,input),output_4);\r
-               output_4= iadd(ifir16(c4,input),output_5);\r
-               output_5= iadd(ifir16(c5,input),output_6);\r
-               output_6= iadd(ifir16(c6,input),output_7);\r
-               output_7= iadd(ifir16(c7,input),output_8);\r
-               output_8= iadd(ifir16(c8,input),output_9);\r
-               output_9= ifir16(c9,input);\r
-\r
-               y[i] = yi;\r
-   }\r
-\r
-#if (TM_UNROLL && TM_UNROLL_FILTER)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-\r
-       mem[0] = output_0;\r
-       mem[1] = output_1;\r
-       mem[2] = output_2;\r
-       mem[3] = output_3;\r
-       mem[4] = output_4;\r
-       mem[5] = output_5;\r
-       mem[6] = output_6;\r
-       mem[7] = output_7;\r
-       mem[8] = output_8;\r
-       mem[9] = output_9;\r
-}\r
-\r
-void filter_mem16_8(const Int16 *x, const Int16 *num, const Int16 *den, Int16 *y, int N, Int32 *mem)\r
-{\r
-       register int i;\r
-       register int c7, c6, c5, c4, c3, c2, c1, c0;\r
-       register int output_0, output_1, output_2, output_3, output_4, output_5, output_6, output_7;\r
-       register int input;\r
-    register Int16 xi, yi;\r
-\r
-       c7 = pack16lsb(-den[7],num[7]);\r
-       c6 = pack16lsb(-den[6],num[6]);\r
-       c5 = pack16lsb(-den[5],num[5]);\r
-       c4 = pack16lsb(-den[4],num[4]);\r
-       c3 = pack16lsb(-den[3],num[3]);\r
-       c2 = pack16lsb(-den[2],num[2]);\r
-       c1 = pack16lsb(-den[1],num[1]);\r
-       c0 = pack16lsb(-den[0],num[0]);\r
-\r
-       output_0 = mem[0];\r
-       output_1 = mem[1];\r
-       output_2 = mem[2];\r
-       output_3 = mem[3];\r
-       output_4 = mem[4];\r
-       output_5 = mem[5];\r
-       output_6 = mem[6];\r
-       output_7 = mem[7];\r
-\r
-#if (TM_UNROLL && TM_UNROLL_FILTER)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-\r
-       for ( i=0 ; i<N ; i++ )\r
-    {\r
-               xi = x[i];\r
-               yi = iclipi(iadd((int)(xi),PSHR32(output_0,LPC_SHIFT)),32767);\r
-\r
-               input   = pack16lsb(yi,xi);\r
-               output_0= iadd(ifir16(c0,input),output_1);\r
-               output_1= iadd(ifir16(c1,input),output_2);\r
-               output_2= iadd(ifir16(c2,input),output_3);\r
-               output_3= iadd(ifir16(c3,input),output_4);\r
-               output_4= iadd(ifir16(c4,input),output_5);\r
-               output_5= iadd(ifir16(c5,input),output_6);\r
-               output_6= iadd(ifir16(c6,input),output_7);\r
-               output_7= ifir16(c7,input);\r
-\r
-               y[i] = yi;\r
-   }\r
-\r
-#if (TM_UNROLL && TM_UNROLL_FILTER)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-\r
-\r
-       mem[0] = output_0;\r
-       mem[1] = output_1;\r
-       mem[2] = output_2;\r
-       mem[3] = output_3;\r
-       mem[4] = output_4;\r
-       mem[5] = output_5;\r
-       mem[6] = output_6;\r
-       mem[7] = output_7;\r
-}\r
-\r
-#define OVERRIDE_FILTER_MEM16\r
-void filter_mem16(const Int16 *x, const Int16 *num, const Int16 *den, Int16 *y, int N, int ord, Int32 *mem, char *stack)\r
-{\r
-       TMDEBUG_ALIGNMEM(x);\r
-       TMDEBUG_ALIGNMEM(y);\r
-       TMDEBUG_ALIGNMEM(num);\r
-       TMDEBUG_ALIGNMEM(den);\r
-\r
-       FILTERMEM16_START();\r
-\r
-       if(ord==10)\r
-               filter_mem16_10(x, num, den, y, N, mem);\r
-       else if (ord==8)\r
-               filter_mem16_8(x, num, den, y, N, mem);\r
-\r
-#ifndef REMARK_ON\r
-       (void)stack;\r
-#endif\r
-\r
-       FILTERMEM16_STOP();\r
-}\r
-\r
-void iir_mem16_8(const Int16 *x, const Int16 *den, Int16 *y, int N, Int32 *mem)\r
-{\r
-       register int i;\r
-       register int c67, c45, c23, c01;\r
-       register int r1, r2, r3;\r
-       register int y10, y32, y54, y76, yi;\r
-       \r
-       c67 = pack16lsb(-den[6],-den[7]);\r
-       c45 = pack16lsb(-den[4],-den[5]);\r
-       c23 = pack16lsb(-den[2],-den[3]);\r
-       c01 = pack16lsb(-den[0],-den[1]);\r
-\r
-       y10 = mem[0];\r
-       y32 = mem[1];\r
-       y54 = mem[2];\r
-       y76 = mem[3];\r
-\r
-#if (TM_UNROLL && TM_UNROLL_IIR)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-\r
-       for ( i=0 ; i < N ; ++i )\r
-       {               \r
-               r2 = iadd(ifir16(y10,c67),ifir16(y32,c45));\r
-               r3 = iadd(ifir16(y54,c23),ifir16(y76,c01));\r
-               r1 = iadd(r2,r3);\r
-\r
-               y10 = funshift2(y32, y10);\r
-               y32 = funshift2(y54, y32);\r
-               y54 = funshift2(y76, y54);\r
-               \r
-               yi      = iclipi(iadd((int)(x[i]),PSHR32(r1,LPC_SHIFT)),32767);\r
-               y[i]= yi;\r
-               y76 = funshift2(yi, y76);\r
-       }\r
-\r
-#if (TM_UNROLL && TM_UNROLL_IIR)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-\r
-       mem[0] = y10;\r
-       mem[1] = y32;\r
-       mem[2] = y54;\r
-       mem[3] = y76;\r
-\r
-}\r
-\r
-void iir_mem16_10(const Int16 *x, const Int16 *den, Int16 *y, int N, Int32 *mem)\r
-{\r
-       register int i;\r
-       register int c89, c67, c45, c23, c01;\r
-       register int r1, r2, r3, r4, r5;\r
-       register int y10, y32, y54, y76, y98, yi;\r
-       \r
-       c89 = pack16lsb(-den[8],-den[9]);\r
-       c67 = pack16lsb(-den[6],-den[7]);\r
-       c45 = pack16lsb(-den[4],-den[5]);\r
-       c23 = pack16lsb(-den[2],-den[3]);\r
-       c01 = pack16lsb(-den[0],-den[1]);\r
-\r
-       y10 = mem[0];\r
-       y32 = mem[1];\r
-       y54 = mem[2];\r
-       y76 = mem[3];\r
-       y98 = mem[4];\r
-\r
-#if (TM_UNROLL && TM_UNROLL_IIR)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-\r
-       for ( i=0 ; i < N ; ++i )\r
-       {               \r
-               r2 = iadd(ifir16(y10,c89),ifir16(y32,c67));\r
-               r3 = iadd(ifir16(y54,c45),ifir16(y76,c23));\r
-               r4 = ifir16(y98,c01);\r
-               r5 = iadd(r2,r3);\r
-               r1 = iadd(r4,r5);\r
-\r
-               y10 = funshift2(y32, y10);\r
-               y32 = funshift2(y54, y32);\r
-               y54 = funshift2(y76, y54);\r
-               y76 = funshift2(y98, y76);\r
-               \r
-               yi      = iclipi(iadd((int)(x[i]),PSHR32(r1,LPC_SHIFT)),32767);\r
-               y[i]= yi;\r
-               y98 = funshift2(yi, y98);               \r
-       }\r
-\r
-#if (TM_UNROLL && TM_UNROLL_IIR)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-\r
-       mem[0] = y10;\r
-       mem[1] = y32;\r
-       mem[2] = y54;\r
-       mem[3] = y76;\r
-       mem[4] = y98;\r
-}\r
-\r
-#define OVERRIDE_IIR_MEM16\r
-void iir_mem16(const Int16 *x, const Int16 *den, Int16 *y, int N, int ord, Int32 *mem, char *stack)\r
-{\r
-       TMDEBUG_ALIGNMEM(den);\r
-\r
-       IIRMEM16_START();\r
-\r
-       if(ord==10)\r
-               iir_mem16_10(x, den, y, N, mem);\r
-       else if (ord==8)\r
-               iir_mem16_8(x, den, y, N, mem);\r
-\r
-#ifndef REMARK_ON\r
-       (void)stack;\r
-#endif\r
-\r
-       IIRMEM16_STOP();\r
-}\r
-\r
-void fir_mem16_8(const Int16 *x, const Int16 *num, Int16 *y, int N, Int32 *mem)\r
-{\r
-       register int i, N_2;\r
-       register int c67, c45, c23, c01;\r
-       register int b0, b1, b2, b3;\r
-       register int r1, r2, r3;\r
-       register int x10, x32, x54, x76, xi;\r
-       register Int16 *a; \r
-\r
-       N_2 = N >> 1;\r
-\r
-       c67 = ld32x(num,3);\r
-       c45 = ld32x(num,2);\r
-       c23 = ld32x(num,1);\r
-       c01 = ld32x(num,0);\r
-\r
-       c67 = funshift2(c67,c67);\r
-       c45 = funshift2(c45,c45);\r
-       c23 = funshift2(c23,c23);\r
-       c01 = funshift2(c01,c01);\r
-\r
-       b3 = x76 = ld32x(x,N_2-1);\r
-       b2 = x54 = ld32x(x,N_2-2);\r
-       b1 = x32 = ld32x(x,N_2-3);\r
-       b0 = x10 = ld32x(x,N_2-4);\r
-\r
-#if (TM_UNROLL && TM_UNROLL_FILTER > 0)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-\r
-       for ( i=N-1 ; i >= 8 ; --i )\r
-       {\r
-               xi  = asri(16,x76);\r
-               x76 = funshift2(x76, x54);\r
-               x54 = funshift2(x54, x32);\r
-               x32 = funshift2(x32, x10);\r
-               x10 = pack16lsb(x10, (int)x[i-8]);\r
-\r
-               r2 = iadd(ifir16(x10,c67),ifir16(x32,c45));\r
-               r3 = iadd(ifir16(x54,c23),ifir16(x76,c01));\r
-               r1 = iadd(r2,r3);\r
-               \r
-               y[i] = iclipi(iadd(xi,PSHR32(r1,LPC_SHIFT)),32767);\r
-       }\r
-       for ( i=7, a=(Int16*)mem ; i>=0 ; --i )\r
-       {\r
-               xi  = asri(16,x76);\r
-               x76 = funshift2(x76, x54);\r
-               x54 = funshift2(x54, x32);\r
-               x32 = funshift2(x32, x10);\r
-               x10 = pack16lsb(x10, (int)a[i]);\r
-       \r
-               r2 = iadd(ifir16(x10,c67),ifir16(x32,c45));\r
-               r3 = iadd(ifir16(x54,c23),ifir16(x76,c01));\r
-               r1 = iadd(r2,r3);\r
-               \r
-               y[i] = iclipi(iadd(xi,PSHR32(r1,LPC_SHIFT)),32767);\r
-       }\r
-\r
-#if (TM_UNROLL && TM_UNROLL_FILTER > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-\r
-       mem[0] = b0;\r
-       mem[1] = b1;\r
-       mem[2] = b2;\r
-       mem[3] = b3;\r
-}\r
-\r
-void fir_mem16_10(const Int16  *x, const Int16 *num, Int16  *y, int N, Int32  *mem)\r
-{\r
-       register int N_2, i;\r
-       register int c89, c67, c45, c23, c01;\r
-       register int b0, b1, b2, b3, b4;\r
-       register int r1, r2, r3, r4, r5;\r
-       register int x10, x32, x54, x76, x98, xi;\r
-       register Int16 *a; \r
-\r
-       N_2 = N >> 1;\r
-\r
-       c89 = ld32x(num,4);\r
-       c67 = ld32x(num,3);\r
-       c45 = ld32x(num,2);\r
-       c23 = ld32x(num,1);\r
-       c01 = ld32x(num,0);\r
-\r
-       c89 = funshift2(c89,c89);\r
-       c67 = funshift2(c67,c67);\r
-       c45 = funshift2(c45,c45);\r
-       c23 = funshift2(c23,c23);\r
-       c01 = funshift2(c01,c01);\r
-\r
-       b4 = x98 = ld32x(x,N_2-1);\r
-       b3 = x76 = ld32x(x,N_2-2);\r
-       b2 = x54 = ld32x(x,N_2-3);\r
-       b1 = x32 = ld32x(x,N_2-4);\r
-       b0 = x10 = ld32x(x,N_2-5);\r
-\r
-#if (TM_UNROLL && TM_UNROLL_FIR > 0)\r
-#pragma TCS_unroll=5\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-\r
-       for ( i=N-1 ; i >= 10 ; --i )\r
-       {\r
-               xi  = asri(16,x98);\r
-               x98 = funshift2(x98, x76);\r
-               x76 = funshift2(x76, x54);\r
-               x54 = funshift2(x54, x32);\r
-               x32 = funshift2(x32, x10);\r
-               x10 = pack16lsb(x10, (int)(x[i-10]));\r
-\r
-               r2 = iadd(ifir16(x10,c89),ifir16(x32,c67));\r
-               r3 = iadd(ifir16(x54,c45),ifir16(x76,c23));\r
-               r4 = ifir16(x98,c01);\r
-               r5 = iadd(r2,r3);\r
-               r1 = iadd(r4,r5);\r
-               \r
-               y[i] = iclipi(iadd(xi,PSHR32(r1,LPC_SHIFT)),32767);\r
-       }\r
-\r
-       for ( i=9,a =(Int16*)mem ; i>=0 ; --i )\r
-       {\r
-               xi  = asri(16,x98);\r
-               x98 = funshift2(x98, x76);\r
-               x76 = funshift2(x76, x54);\r
-               x54 = funshift2(x54, x32);\r
-               x32 = funshift2(x32, x10);\r
-               x10 = pack16lsb(x10, (int)(a[i]));\r
-\r
-               r2 = iadd(ifir16(x10,c89),ifir16(x32,c67));\r
-               r3 = iadd(ifir16(x54,c45),ifir16(x76,c23));\r
-               r4 = ifir16(x98,c01);\r
-               r5 = iadd(r2,r3);\r
-               r1 = iadd(r4,r5);\r
-               \r
-               y[i] = iclipi(iadd(xi,PSHR32(r1,LPC_SHIFT)),32767);\r
-       }\r
-\r
-#if (TM_UNROLL && TM_UNROLL_FIR > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-\r
-       mem[0] = b0;\r
-       mem[1] = b1;\r
-       mem[2] = b2;\r
-       mem[3] = b3;\r
-       mem[4] = b4;\r
-\r
-\r
-}\r
-\r
-#define OVERRIDE_FIR_MEM16\r
-void fir_mem16(const spx_word16_t *x, const Int16 *num, spx_word16_t *y, int N, int ord, Int32 *mem, char *stack)\r
-{\r
-       TMDEBUG_ALIGNMEM(x);\r
-       TMDEBUG_ALIGNMEM(y);\r
-       TMDEBUG_ALIGNMEM(num);\r
-\r
-       FIRMEM16_START();\r
-\r
-       if(ord==10)\r
-               fir_mem16_10(x, num, y, N, mem);\r
-       else if (ord==8)\r
-               fir_mem16_8(x, num, y, N, mem);\r
-\r
-#ifndef REMARK_ON\r
-       (void)stack;\r
-#endif\r
-\r
-       FIRMEM16_STOP();\r
-}\r
-\r
-\r
-\r
-#define OVERRIDE_SYN_PERCEP_ZERO16\r
-void syn_percep_zero16(const Int16 *xx, const Int16 *ak, const Int16 *awk1, const Int16 *awk2, Int16 *y, int N, int ord, char *stack)\r
-{\r
-       register int i,j;\r
-       VARDECL(Int32 *mem);\r
-       ALLOC(mem, ord, Int32);\r
-       \r
-       TMDEBUG_ALIGNMEM(mem);\r
-\r
-       for ( i=0,j=0 ; i<ord ; ++i,j+=4 )\r
-               st32d(j,mem,0);\r
-       iir_mem16(xx, ak, y, N, ord, mem, stack);\r
-       for ( i=0,j=0 ; i<ord ; ++i,j+=4 )\r
-               st32d(j,mem,0);\r
-       filter_mem16(y, awk1, awk2, y, N, ord, mem, stack);\r
-}\r
-\r
-\r
-#define OVERRIDE_RESIDUE_PERCEP_ZER016\r
-void residue_percep_zero16(const Int16 *xx, const Int16 *ak, const Int16 *awk1, const Int16 *awk2, Int16 *y, int N, int ord, char *stack)\r
-{\r
-       register int i,j;\r
-       VARDECL(Int32 *mem);\r
-       ALLOC(mem, ord, Int32);\r
-\r
-       TMDEBUG_ALIGNMEM(mem);\r
-\r
-       for ( i=0,j=0 ; i<ord ; ++i,j+=4 )\r
-               st32d(j,mem,0);\r
-       filter_mem16(xx, ak, awk1, y, N, ord, mem, stack);\r
-       for ( i=0,j=0 ; i<ord ; ++i,j+=4 )\r
-               st32d(j,mem,0);\r
-       fir_mem16(y, awk2, y, N, ord, mem, stack);\r
-}\r
-\r
-\r
-\r
-void compute_impulse_response_10(const Int16 *ak, const Int16 *awk1, const Int16 *awk2, Int16 *y, int N)\r
-{\r
-       register int awk_01, awk_23, awk_45, awk_67, awk_89;\r
-       register int y10, y32, y54, y76, y98, yi;\r
-       register int i, acc0, acc1, N_2;\r
-\r
-       N_2             = N << 1;\r
-\r
-       awk_01 = ld32(awk1); \r
-       awk_23 = ld32x(awk1,1); \r
-       awk_45 = ld32x(awk1,2); \r
-       awk_67 = ld32x(awk1,3); \r
-       awk_89 = ld32x(awk1,4);\r
-\r
-       y10 = funshift2(awk_01, LPC_SCALING << 16);\r
-       st32d(0, y, y10);\r
-       y32 = funshift2(awk_23, awk_01);\r
-       st32d(4, y, y32);\r
-       y54 = funshift2(awk_45, awk_23);\r
-       st32d(8, y, y54);\r
-       y76 = funshift2(awk_67, awk_45);\r
-       st32d(12, y, y76);\r
-       y98 = funshift2(awk_89, awk_67);\r
-       st32d(16, y, y98);\r
-       y10 = funshift2(0, awk_89);\r
-       st32d(20, y, y10);\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTEIMPULSERESPONSE > 0)\r
-#pragma TCS_unroll=2\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-       for ( i=24 ; i<N_2 ; i+=4 )\r
-       {       st32d(i, y, 0);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTEIMPULSERESPONSE > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-       y10 = y32 = y54 = y76 = y98 = 0;\r
-       awk_01 = ld32(awk2); \r
-       awk_23 = ld32x(awk2,1); \r
-       awk_45 = ld32x(awk2,2); \r
-       awk_67 = ld32x(awk2,3); \r
-       awk_89 = ld32x(awk2,4); \r
-       \r
-       awk_01 = funshift2(awk_01, awk_01);\r
-       awk_23 = funshift2(awk_23, awk_23);\r
-       awk_45 = funshift2(awk_45, awk_45);\r
-       awk_67 = funshift2(awk_67, awk_67);\r
-       awk_89 = funshift2(awk_89, awk_89);\r
-\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTEIMPULSERESPONSE > 0)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-       for ( i=0 ; i<N ; ++i )\r
-       {\r
-               yi      = y[i];\r
-\r
-               acc0 = ifir16(y10, awk_89) + ifir16(y32, awk_67);\r
-               acc1 = ifir16(y54, awk_45) + ifir16(y76, awk_23);\r
-               yi   += PSHR32(acc0 + acc1 + ifir16(y98, awk_01),LPC_SHIFT);\r
-               y[i] = yi;\r
-\r
-               y10 = funshift2(y32, y10);\r
-               y32 = funshift2(y54, y32);\r
-               y54 = funshift2(y76, y54);\r
-               y76 = funshift2(y98, y76);\r
-               y98 = funshift2(ineg(yi), y98);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTEIMPULSERESPONSE > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-       y10 = y32 = y54 = y76 = y98 = 0;\r
-       awk_01 = ld32(ak); \r
-       awk_23 = ld32x(ak,1); \r
-       awk_45 = ld32x(ak,2); \r
-       awk_67 = ld32x(ak,3); \r
-       awk_89 = ld32x(ak,4);\r
-       awk_01 = funshift2(awk_01, awk_01);\r
-       awk_23 = funshift2(awk_23, awk_23);\r
-       awk_45 = funshift2(awk_45, awk_45);\r
-       awk_67 = funshift2(awk_67, awk_67);\r
-       awk_89 = funshift2(awk_89, awk_89);\r
-       \r
-#if (TM_UNROLL && TM_UNROLL_COMPUTEIMPULSERESPONSE > 0)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-       for ( i=0 ; i<N ; ++i )\r
-       {\r
-               yi      = y[i];\r
-\r
-               acc0 = ifir16(y10, awk_89) + ifir16(y32, awk_67);\r
-               acc1 = ifir16(y54, awk_45) + ifir16(y76, awk_23);\r
-               yi   = PSHR32(SHL32(yi,LPC_SHIFT+1) + acc0 + acc1 + ifir16(y98, awk_01),LPC_SHIFT);\r
-               y[i] = yi;\r
-\r
-               y10 = funshift2(y32, y10);\r
-               y32 = funshift2(y54, y32);\r
-               y54 = funshift2(y76, y54);\r
-               y76 = funshift2(y98, y76);\r
-               y98 = funshift2(ineg(yi), y98);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTEIMPULSERESPONSE > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-}\r
-\r
-void compute_impulse_response_8(const Int16 *ak, const Int16 *awk1, const Int16 *awk2, Int16 *y, int N)\r
-{\r
-       register int awk_01, awk_23, awk_45, awk_67;\r
-       register int y10, y32, y54, y76, yi;\r
-       register int i, acc0, acc1, N_2;\r
-\r
-       N_2             = N << 1;\r
-\r
-       awk_01 = ld32(awk1); \r
-       awk_23 = ld32x(awk1,1); \r
-       awk_45 = ld32x(awk1,2); \r
-       awk_67 = ld32x(awk1,3);\r
-\r
-       y10 = funshift2(awk_01, LPC_SCALING << 16);\r
-       st32d(0, y, y10);\r
-       y32 = funshift2(awk_23, awk_01);\r
-       st32d(4, y, y32);\r
-       y54 = funshift2(awk_45, awk_23);\r
-       st32d(8, y, y54);\r
-       y76 = funshift2(awk_67, awk_45);\r
-       st32d(12, y, y76);\r
-       y10 = funshift2(0, awk_67);\r
-       st32d(16, y, y10);\r
-       st32d(20, y, 0);\r
-\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTEIMPULSERESPONSE > 0)\r
-#pragma TCS_unroll=2\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-       for ( i=24 ; i<N_2 ; i+=4 )\r
-       {       st32d(i, y, 0);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTEIMPULSERESPONSE > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-       y10 = y32 = y54 = y76 = 0;\r
-       awk_01 = ld32(awk2); \r
-       awk_23 = ld32x(awk2,1); \r
-       awk_45 = ld32x(awk2,2); \r
-       awk_67 = ld32x(awk2,3); \r
-       \r
-       awk_01 = funshift2(awk_01, awk_01);\r
-       awk_23 = funshift2(awk_23, awk_23);\r
-       awk_45 = funshift2(awk_45, awk_45);\r
-       awk_67 = funshift2(awk_67, awk_67);\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTEIMPULSERESPONSE > 0)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-       for ( i=0 ; i<N ; ++i )\r
-       {\r
-               yi      = y[i];\r
-\r
-               acc0 = ifir16(y10, awk_67) + ifir16(y32, awk_45);\r
-               acc1 = ifir16(y54, awk_23) + ifir16(y76, awk_01);\r
-               yi   += PSHR32(acc0 + acc1,LPC_SHIFT);\r
-               y[i] = yi;\r
-\r
-               y10 = funshift2(y32, y10);\r
-               y32 = funshift2(y54, y32);\r
-               y54 = funshift2(y76, y54);\r
-               y76 = funshift2(ineg(yi), y76);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTEIMPULSERESPONSE > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-       y10 = y32 = y54 = y76 = 0;\r
-       awk_01 = ld32(ak); \r
-       awk_23 = ld32x(ak,1); \r
-       awk_45 = ld32x(ak,2); \r
-       awk_67 = ld32x(ak,3);\r
-       awk_01 = funshift2(awk_01, awk_01);\r
-       awk_23 = funshift2(awk_23, awk_23);\r
-       awk_45 = funshift2(awk_45, awk_45);\r
-       awk_67 = funshift2(awk_67, awk_67);\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTEIMPULSERESPONSE > 0)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif \r
-       for ( i=0 ; i<N ; ++i )\r
-       {\r
-               yi      = y[i];\r
-\r
-               acc0 = ifir16(y10, awk_67) + ifir16(y32, awk_45);\r
-               acc1 = ifir16(y54, awk_23) + ifir16(y76, awk_01);\r
-               yi   = PSHR32(SHL32(yi,LPC_SHIFT+1) + acc0 + acc1,LPC_SHIFT);\r
-               y[i] = yi;\r
-\r
-               y10 = funshift2(y32, y10);\r
-               y32 = funshift2(y54, y32);\r
-               y54 = funshift2(y76, y54);\r
-               y76 = funshift2(ineg(yi), y76);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_COMPUTEIMPULSERESPONSE > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-}\r
-\r
-\r
-#define OVERRIDE_COMPUTE_IMPULSE_RESPONSE\r
-void compute_impulse_response(const Int16 *ak, const Int16 *awk1, const Int16 *awk2, Int16 *y, int N, int ord, char *stack)\r
-{\r
-       TMDEBUG_ALIGNMEM(ak);\r
-       TMDEBUG_ALIGNMEM(awk1);\r
-       TMDEBUG_ALIGNMEM(awk2);\r
-       TMDEBUG_ALIGNMEM(y);\r
-\r
-       COMPUTEIMPULSERESPONSE_START();\r
-       if ( ord == 10 )\r
-               compute_impulse_response_10(ak,awk1,awk2,y,N);\r
-       else\r
-               compute_impulse_response_8(ak,awk1,awk2,y,N);\r
-\r
-       (void)stack;\r
-\r
-       COMPUTEIMPULSERESPONSE_STOP();\r
-}\r
-\r
-\r
-#define OVERRIDE_QMFSYNTH\r
-void qmf_synth(const Int16 *x1, const Int16 *x2, const Int16 *a, Int16 *y, int N, int M, Int32 *mem1, Int32 *mem2, char *stack)\r
-   /* assumptions:\r
-      all odd x[i] are zero -- well, actually they are left out of the array now\r
-      N and M are multiples of 4 */\r
-{\r
-       register int i, j;\r
-       register int M2, N2;\r
-       VARDECL(int *x12);\r
-       M2 = M>>1;\r
-       N2 = N>>1;\r
-       ALLOC(x12, M2+N2, int);\r
-\r
-\r
-       TMDEBUG_ALIGNMEM(a);\r
-       TMDEBUG_ALIGNMEM(x12);\r
-       TMDEBUG_ALIGNMEM(mem1);\r
-       TMDEBUG_ALIGNMEM(mem2);\r
-\r
-       QMFSYNTH_START();\r
-   \r
-#if (TM_UNROLL && TM_UNROLL_QMFSYNTH > 0)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif \r
-       for ( i=0 ; i<N2 ; ++i )\r
-       {       register int index = N2-1-i;\r
-               x12[i] = pack16lsb(x1[index],x2[index]);\r
-       }\r
-\r
-       for ( j= 0; j<M2 ; ++j)\r
-       {       register int index = (j << 1) + 1;\r
-               x12[N2+j] = pack16lsb(mem1[index],mem2[index]);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_QMFSYNTH > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif  \r
-       for (i = 0; i < N2; i += 2) \r
-       {\r
-               register int y0, y1, y2, y3;\r
-               register int x12_0;\r
-\r
-               y0 = y1 = y2 = y3 = 0;\r
-               x12_0 = x12[N2-2-i];\r
-\r
-               for (j = 0; j < M2; j += 2) \r
-               {\r
-                       register int x12_1;\r
-                       register int a10, a11, a0_0;\r
-                       register int _a10, _a11, _a0_0;\r
-\r
-                       a10 = ld32x(a,j);\r
-                       a11 = pack16msb(a10,a10);\r
-                       a0_0= pack16lsb(a10,ineg(sex16(a10)));\r
-                       x12_1 = x12[N2-1+j-i];\r
-\r
-                       y0 += ifir16(a0_0,x12_1);\r
-                       y1 += ifir16(a11, x12_1);\r
-                       y2 += ifir16(a0_0,x12_0);\r
-                       y3 += ifir16(a11 ,x12_0);\r
-\r
-\r
-                       _a10   = ld32x(a,j+1);\r
-                       _a11   = pack16msb(_a10,_a10);\r
-                       _a0_0  = pack16lsb(_a10,ineg(sex16(_a10)));\r
-                       x12_0  = x12[N2+j-i];\r
-                       \r
-                       y0 += ifir16(_a0_0,x12_0);\r
-                       y1 += ifir16(_a11, x12_0);\r
-                       y2 += ifir16(_a0_0,x12_1);\r
-                       y3 += ifir16(_a11 ,x12_1);\r
-\r
-               }\r
-               y[2*i]   = EXTRACT16(SATURATE32(PSHR32(y0,15),32767));\r
-               y[2*i+1] = EXTRACT16(SATURATE32(PSHR32(y1,15),32767));\r
-               y[2*i+2] = EXTRACT16(SATURATE32(PSHR32(y2,15),32767));\r
-               y[2*i+3] = EXTRACT16(SATURATE32(PSHR32(y3,15),32767));\r
-       }\r
-\r
-#if (TM_UNROLL && TM_UNROLL_QMFSYNTH > 0)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif \r
-       for (i = 0; i < M2; ++i)\r
-       {       mem1[2*i+1] = asri(16,x12[i]);\r
-               mem2[2*i+1] = sex16(x12[i]);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_QMFSYNTH > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif  \r
-\r
-       QMFSYNTH_STOP();\r
-}\r
-\r
-\r
-#define OVERRIDE_QMFDECOMP\r
-void qmf_decomp(const Int16 *xx, const Int16 *aa, Int16 *y1, Int16 *y2, int N, int M, Int16 *mem, char *stack)\r
-{\r
-       VARDECL(int *_a);\r
-       VARDECL(int *_x);\r
-       register int i, j, k, MM, M2, N2;  \r
-       register int _xx10, _mm10;\r
-       register int *_x2;\r
-\r
-       M2=M>>1;\r
-       N2=N>>1;\r
-       MM=(M-2)<<1;\r
-\r
-       ALLOC(_a, M2, int);\r
-       ALLOC(_x, N2+M2, int);\r
-       _x2 = _x + M2 - 1;\r
-\r
-       TMDEBUG_ALIGNMEM(xx);\r
-       TMDEBUG_ALIGNMEM(aa);\r
-       TMDEBUG_ALIGNMEM(y1);\r
-       TMDEBUG_ALIGNMEM(y2);\r
-       TMDEBUG_ALIGNMEM(mem);\r
-       TMDEBUG_ALIGNMEM(_a);\r
-       TMDEBUG_ALIGNMEM(_x);\r
-\r
-       QMFDECOMP_START();\r
-\r
-       _xx10 = ld32(xx);\r
-       _xx10 = dualasr(_xx10,1);\r
-       _mm10 = ld32(mem);\r
-       _x2[0] = pack16lsb(_xx10,_mm10);\r
-\r
-#if (TM_UNROLL && TM_UNROLL_QMFSYNTH > 0)\r
-#pragma TCS_unroll=2\r
-#pragma TCS_unrollexact=1\r
-#endif \r
-       for ( i=0 ; i<M2 ; ++i )\r
-       {       register int a10;\r
-               \r
-               a10 = ld32x(aa,i);\r
-               a10 = funshift2(a10, a10);\r
-               _a[M2-i-1] = a10;               \r
-       }\r
-\r
-       for ( j=1 ; j<N2 ; ++j )\r
-       {       register int _xx32;\r
-\r
-               _xx32   = ld32x(xx,j);\r
-               _xx32   = dualasr(_xx32,1);\r
-               _x2[j]  = funshift2(_xx32, _xx10);\r
-               _xx10   = _xx32;\r
-       }\r
-\r
-       for ( k=1 ; k<M2; ++k )\r
-       {       register int _mm32;\r
-\r
-               _mm32   = ld32x(mem,k);\r
-               _mm10   = funshift2(_mm10,_mm10);\r
-               _x2[-k] = pack16lsb(_mm10,_mm32);\r
-               _mm10 = _mm32;\r
-       }\r
-\r
-\r
-       for ( i=N2-1,j=0 ; j<MM ; --i,j+=4 )\r
-       {       register int _xx;\r
-\r
-               _xx = ld32x(xx,i);\r
-               _xx = dualasr(_xx,1);\r
-               _xx = funshift2(_xx,_xx);\r
-               st32d(j, mem, _xx);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_QMFSYNTH > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-       mem[M-2] = xx[N-M+1] >> 1;\r
-\r
-\r
-       M2 >>= 1;\r
-       for ( i=0 ; i<N2 ; ++i )\r
-       {       register int y1k, y2k;\r
-\r
-               y1k = y2k = 0;\r
-\r
-               for ( j=0 ; j<M2 ; j+=2 )\r
-               {       register int _aa, _acc0, _acc1;\r
-                       register int __xx10, __mm10, __acc0, __acc1, __aa;\r
-                       register int _tmp0, _tmp1, _tmp2, _tmp3;\r
-\r
-                       _xx10 = ld32x(_x, i+j);\r
-                       _mm10 = ld32x(_x2,i-j);\r
-                       _aa       = ld32x(_a, j);\r
-                       _mm10 = funshift2(_mm10,_mm10);\r
-                       _acc0 = dspidualadd(_xx10, _mm10);\r
-                       _acc1 = dspidualsub(_xx10, _mm10);\r
-\r
-                       __xx10 = ld32x(_x, i+j+1);\r
-                       __mm10 = ld32x(_x2,i-j-1);\r
-                       __aa   = ld32x(_a, j+1);\r
-                       __mm10 = funshift2(__mm10,__mm10);\r
-                       __acc0 = dspidualadd(__xx10, __mm10);\r
-                       __acc1 = dspidualsub(__xx10, __mm10);\r
-\r
-                       y1k   += ifir16(_aa, _acc0);\r
-                       y1k   += ifir16(__aa, __acc0);\r
-\r
-                       _tmp0 = pack16lsb(_aa,__aa);\r
-                       _tmp1 = pack16msb(_aa,__aa);\r
-                       _tmp2 = pack16lsb(_acc1, __acc1);\r
-                       _tmp3 = pack16msb(_acc1, __acc1);\r
-\r
-                       y2k       -= ifir16(_tmp0, _tmp2);\r
-                       y2k       += ifir16(_tmp1, _tmp3);\r
-\r
-               }\r
-\r
-               y1[i] = iclipi(PSHR32(y1k,15),32767);\r
-               y2[i] = iclipi(PSHR32(y2k,15),32767);\r
-       }\r
-\r
-       QMFDECOMP_STOP();\r
-}\r
-\r
-#endif\r
-\r
diff --git a/tmv/lpc_tm.h b/tmv/lpc_tm.h
deleted file mode 100644 (file)
index f5e9bcd..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/* Copyright (C) 2007 Hong Zhiqian */\r
-/**\r
-   @file lpc_tm.h\r
-   @author Hong Zhiqian\r
-   @brief Various compatibility routines for Speex (TriMedia version)\r
-*/\r
-/*\r
-   Redistribution and use in source and binary forms, with or without\r
-   modification, are permitted provided that the following conditions\r
-   are met:\r
-   \r
-   - Redistributions of source code must retain the above copyright\r
-   notice, this list of conditions and the following disclaimer.\r
-   \r
-   - Redistributions in binary form must reproduce the above copyright\r
-   notice, this list of conditions and the following disclaimer in the\r
-   documentation and/or other materials provided with the distribution.\r
-   \r
-   - Neither the name of the Xiph.org Foundation nor the names of its\r
-   contributors may be used to endorse or promote products derived from\r
-   this software without specific prior written permission.\r
-   \r
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
-   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\r
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\r
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-*/\r
-\r
-#include <ops/custom_defs.h>\r
-#include "profile_tm.h"\r
-\r
-#ifdef FIXED_POINT\r
-\r
-#define OVERRIDE_SPEEX_AUTOCORR\r
-void _spx_autocorr(const Int16 *x, Int16 *ac, int lag, int n)\r
-{\r
-       register int i, j;\r
-       register int shift, ac_shift;\r
-       register int n_2;       \r
-       register int ac0;\r
-\r
-       TMDEBUG_ALIGNMEM(x);\r
-       TMDEBUG_ALIGNMEM(ac);\r
-\r
-       _SPX_AUTOCORR_START();\r
-\r
-       n_2             = n >> 1;\r
-       ac0             = n + 1;\r
-\r
-#if (TM_UNROLL && TM_UNROLL__SPXAUTOCORR)\r
-#pragma TCS_unroll=5\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-       for ( j=0 ; j<n_2 ; j+=4 )\r
-       {       register int x10, x32, x54, x76;\r
-               \r
-               x10 = ld32x(x,j);\r
-               x32 = ld32x(x,j+1);\r
-               x54 = ld32x(x,j+2);\r
-               x76 = ld32x(x,j+3);\r
-\r
-               ac0 += ifir16(x10, x10) >> 8;\r
-               ac0     += ifir16(x32, x32) >> 8;\r
-               ac0 += ifir16(x54, x54) >> 8;\r
-               ac0 += ifir16(x76, x76) >> 8;\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL__SPXAUTOCORR)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-\r
-       shift = 8;\r
-       while (shift && ac0<0x40000000)\r
-       {       shift--;\r
-               ac0 <<= 1;\r
-       }\r
-\r
-       ac_shift = 18;\r
-       while (ac_shift && ac0<0x40000000)\r
-       {       ac_shift--;\r
-               ac0 <<= 1;\r
-       }\r
-\r
-       if ( shift == 0 )\r
-       {\r
-               for ( i=0 ; i<lag ; ++i )\r
-               {\r
-                       register int acc0, acc1, acc2;\r
-                       register int k, l, m; \r
-                       register int x10, x32, y10, y32;\r
-                       \r
-                       acc2 = acc1 = acc0 = 0;\r
-\r
-                       for ( j=i ; j<16 ; ++j )\r
-                       {       acc0 += (x[j] * x[j-i]);\r
-                       }\r
-\r
-                       for ( k=16,l=8,m=16-i ; k<n ; k+=4,l+=2,m+=4 )\r
-                       {       \r
-                               x10  = ld32x(x,l);\r
-                               y10  = pack16lsb(x[m+1],x[m]);\r
-                               x32  = ld32x(x,l+1);\r
-                               y32  = pack16lsb(x[m+3],x[m+2]);\r
-                               \r
-                               acc1 += ifir16(x10,y10);\r
-                               acc2 += ifir16(x32,y32);\r
-                       }\r
-\r
-                       ac[i] = (acc0 + acc1 + acc2) >> ac_shift;\r
-               }\r
-       } else\r
-       {\r
-               for ( i=0 ; i<lag ; ++i )\r
-               {\r
-                       register int acc0, acc1, acc2;\r
-                       register int k, l, m; \r
-                       register int x10, x32, y10, y32;\r
-                       \r
-                       acc2 = acc1 = acc0 = 0;\r
-\r
-                       for ( j=i ; j<16 ; ++j )\r
-                       {       acc0 += (x[j] * x[j-i]) >> shift;\r
-                       }\r
-\r
-                       for ( k=16,l=8,m=16-i ; k<n ; k+=4,l+=2,m+=4 )\r
-                       {       \r
-                               x10  = ld32x(x,l);\r
-                               y10  = pack16lsb(x[m+1],x[m]);\r
-                               x32  = ld32x(x,l+1);\r
-                               y32  = pack16lsb(x[m+3],x[m+2]);\r
-                               \r
-                               acc1 += ifir16(x10,y10) >> shift;\r
-                               acc2 += ifir16(x32,y32) >> shift;\r
-                       }\r
-\r
-                       ac[i] = (acc0 + acc1 + acc2) >> ac_shift;\r
-               }\r
-       }\r
-       \r
-       _SPX_AUTOCORR_STOP();\r
-}\r
-\r
-#endif\r
diff --git a/tmv/lsp_tm.h b/tmv/lsp_tm.h
deleted file mode 100644 (file)
index acb0d91..0000000
+++ /dev/null
@@ -1,310 +0,0 @@
-/* Copyright (C) 2007 Hong Zhiqian */\r
-/**\r
-   @file lsp_tm.h\r
-   @author Hong Zhiqian\r
-   @brief Various compatibility routines for Speex (TriMedia version)\r
-*/\r
-/*\r
-   Redistribution and use in source and binary forms, with or without\r
-   modification, are permitted provided that the following conditions\r
-   are met:\r
-   \r
-   - Redistributions of source code must retain the above copyright\r
-   notice, this list of conditions and the following disclaimer.\r
-   \r
-   - Redistributions in binary form must reproduce the above copyright\r
-   notice, this list of conditions and the following disclaimer in the\r
-   documentation and/or other materials provided with the distribution.\r
-   \r
-   - Neither the name of the Xiph.org Foundation nor the names of its\r
-   contributors may be used to endorse or promote products derived from\r
-   this software without specific prior written permission.\r
-   \r
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
-   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\r
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\r
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-*/\r
-\r
-#include <ops/custom_defs.h>\r
-#include "profile_tm.h"\r
-\r
-\r
-#ifdef FIXED_POINT\r
-\r
-#define OVERRIDE_LSP_INTERPOLATE\r
-void lsp_interpolate(Int16 *old_lsp, Int16 *new_lsp, Int16 *interp_lsp, int len, int subframe, int nb_subframes)\r
-{\r
-       register int tmp  =  DIV32_16(SHL32(EXTEND32(1 + subframe),14),nb_subframes);\r
-       register int tmp2 =  16384-tmp;\r
-       register int in_0, in_1, factor, out_1, out_2, olsp, nlsp, ilsp;\r
-       register int i;\r
-\r
-       TMDEBUG_ALIGNMEM(old_lsp);\r
-       TMDEBUG_ALIGNMEM(new_lsp);\r
-       TMDEBUG_ALIGNMEM(interp_lsp);\r
-\r
-       LSPINTERPOLATE_START();\r
-\r
-       factor = pack16lsb(tmp,tmp2);\r
-\r
-       len >>= 1;\r
-       for ( i=0 ; i<len ; ++i )\r
-       {       \r
-               olsp = ld32x(old_lsp,i);                                                        // olsp[i+1],olsp[i]\r
-               nlsp = ld32x(new_lsp,i);                                                        // nlsp[i+1],nlsp[i]\r
-\r
-               in_0 = pack16lsb(nlsp,olsp);\r
-               in_1 = pack16msb(nlsp,olsp);\r
-         \r
-               out_1 = 8192 + ifir16(in_0,factor);\r
-               out_2 = 8192 + ifir16(in_1,factor);\r
-\r
-               ilsp = pack16lsb(out_2 >> 14, out_1 >> 14);\r
-               st32d(i << 2, interp_lsp, ilsp);\r
-\r
-       }\r
-\r
-       LSPINTERPOLATE_STOP();\r
-}\r
-\r
-\r
-#define OVERRIDE_CHEB_POLY_EVA\r
-static inline Int32 cheb_poly_eva(Int16 *coef, Int16 x, int m, char *stack)\r
-{\r
-       register int    c10, c32, c54;\r
-    register int       sum, b0, f0, f1, f2, f3;\r
-       register int    xx, f32, f10;\r
-\r
-       CHEBPOLYEVA_START();\r
-\r
-       xx = sex16(x);\r
-       b0 = iclipi(xx,16383);\r
-\r
-#if 0\r
-       c10 = ld32(coef);\r
-       c32 = ld32x(coef,1);\r
-       c54 = ld32x(coef,2);\r
-#else  \r
-       c10 = pack16lsb(coef[1],coef[0]);\r
-       c32 = pack16lsb(coef[3],coef[2]);\r
-       c54 = pack16lsb(coef[5],coef[4]);\r
-#endif\r
-\r
-       f0   = ((xx * b0) >> 13) - 16384;\r
-       f1   = ((xx * f0) >> 13) - b0;\r
-       f2   = ((xx * f1) >> 13) - f0;\r
-\r
-       if ( m == 4 )\r
-       {       sum = sex16(c54);\r
-               f32 = pack16lsb(xx,f0);\r
-               f10 = pack16lsb(f1,f2);\r
-\r
-       } else\r
-       {       sum =  asri(16,c54);\r
-               sum += ((sex16(c54) * xx) + 8192) >> 14;\r
-\r
-               f3   = ((xx * f2) >> 13) - f1;\r
-               f32 = pack16lsb(f0,f1);\r
-               f10 = pack16lsb(f2,f3);\r
-       }\r
-\r
-       sum += (ifir16(c32,f32) + 8192) >> 14;\r
-       sum += (ifir16(c10,f10) + 8192) >> 14;\r
-\r
-#ifndef REMARK_ON\r
-   (void)stack;\r
-#endif\r
-\r
-       CHEBPOLYEVA_STOP();\r
-    return sum;\r
-}\r
-\r
-\r
-#define OVERRIDE_LSP_ENFORCE_MARGIN\r
-void lsp_enforce_margin(Int16 *lsp, int len, Int16 margin)\r
-{\r
-       register int i;\r
-       register int m = margin;\r
-       register int m2 = 25736-margin;\r
-       register int lsp0, lsp1, lsp2;\r
-\r
-       TMDEBUG_ALIGNMEM(lsp);\r
-\r
-       LSPENFORCEMARGIN_START();\r
-\r
-       lsp0 = ld32(lsp);\r
-       lsp1 = asri(16,lsp0);\r
-       lsp0 = sex16(lsp0);\r
-       lsp2 = lsp[len-1];\r
-\r
-       if ( lsp0 < m )\r
-       {       lsp0 = m;\r
-               lsp[0] = m;\r
-       }\r
-\r
-       if ( lsp2 > m2 )\r
-       {       lsp2 = m2;\r
-               lsp[len-1] = m2;\r
-       }\r
-\r
-       for ( i=1 ; i<len-1 ; ++i )\r
-       {       \r
-               lsp0 += m;\r
-               lsp2 = lsp[i+1];\r
-               m2   = lsp2 - m;\r
-\r
-               if ( lsp1 < lsp0 )\r
-               {       lsp1   = lsp0;\r
-                       lsp[i] = lsp0;\r
-               }\r
-\r
-               if ( lsp1 > m2 )\r
-               {       lsp1    = (lsp1 >> 1) + (m2 >> 1);\r
-                       lsp[i]  = lsp1;                 \r
-               }\r
-\r
-               lsp0 = lsp1;\r
-               lsp1 = lsp2;\r
-       }\r
-\r
-       LSPENFORCEMARGIN_STOP();\r
-}\r
-\r
-\r
-#define OVERRIDE_LSP_TO_LPC\r
-void lsp_to_lpc(Int16 *freq, Int16 *ak,int lpcrdr, char *stack)\r
-{\r
-    VARDECL(Int16 *freqn);\r
-    VARDECL(int **xp);\r
-    VARDECL(int *xpmem);\r
-    VARDECL(int **xq);\r
-    VARDECL(int *xqmem);\r
-\r
-    register int i, j, k;\r
-    register int xout1,xout2,xin;\r
-    register int m;\r
-    \r
-       LSPTOLPC_START();\r
-\r
-       m = lpcrdr>>1;\r
-\r
-       /* \r
-    \r
-       Reconstruct P(z) and Q(z) by cascading second order polynomials\r
-       in form 1 - 2cos(w)z(-1) + z(-2), where w is the LSP frequency.\r
-       In the time domain this is:\r
-\r
-       y(n) = x(n) - 2cos(w)x(n-1) + x(n-2)\r
-    \r
-       This is what the ALLOCS below are trying to do:\r
-\r
-         int xp[m+1][lpcrdr+1+2]; // P matrix in QIMP\r
-         int xq[m+1][lpcrdr+1+2]; // Q matrix in QIMP\r
-\r
-       These matrices store the output of each stage on each row.  The\r
-       final (m-th) row has the output of the final (m-th) cascaded\r
-       2nd order filter.  The first row is the impulse input to the\r
-       system (not written as it is known).\r
-\r
-       The version below takes advantage of the fact that a lot of the\r
-       outputs are zero or known, for example if we put an inpulse\r
-       into the first section the "clock" it 10 times only the first 3\r
-       outputs samples are non-zero (it's an FIR filter).\r
-    */\r
-\r
-    ALLOC(xp, (m+1), int*);\r
-    ALLOC(xpmem, (m+1)*(lpcrdr+1+2), int);\r
-\r
-    ALLOC(xq, (m+1), int*);\r
-    ALLOC(xqmem, (m+1)*(lpcrdr+1+2), int);\r
-    \r
-    for ( i=0; i<=m; i++ ) \r
-       {       xp[i] = xpmem + i*(lpcrdr+1+2);\r
-               xq[i] = xqmem + i*(lpcrdr+1+2);\r
-    }\r
-\r
-    /* work out 2cos terms in Q14 */\r
-\r
-    ALLOC(freqn, lpcrdr, Int16);\r
-    for ( j=0,k=0 ; j<m ; ++j,k+=2 )\r
-       {       register int f;\r
-\r
-               f = ld32x(freq,j);\r
-\r
-               freqn[k] = ANGLE2X(sex16(f));\r
-               freqn[k+1] = ANGLE2X(asri(16,f));\r
-       }\r
-    \r
-       #define QIMP  21   /* scaling for impulse */\r
-    xin = SHL32(EXTEND32(1), (QIMP-1)); /* 0.5 in QIMP format */\r
-   \r
-    /* first col and last non-zero values of each row are trivial */\r
-    \r
-    for(i=0;i<=m;i++) \r
-       {       xp[i][1] = 0;\r
-               xp[i][2] = xin;\r
-               xp[i][2+2*i] = xin;\r
-               xq[i][1] = 0;\r
-               xq[i][2] = xin;\r
-               xq[i][2+2*i] = xin;\r
-    }\r
-\r
-    /* 2nd row (first output row) is trivial */\r
-\r
-    xp[1][3] = -MULT16_32_Q14(freqn[0],xp[0][2]);\r
-    xq[1][3] = -MULT16_32_Q14(freqn[1],xq[0][2]);\r
-\r
-    xout1 = xout2 = 0;\r
-\r
-    for( i=1 ; i<m ; ++i) \r
-       {       register int f, f0, f1, m0, m1;\r
-               \r
-               k  = 2*(i+1)-1;\r
-               f  = ld32x(freqn,i);\r
-               f0 = sex16(f);\r
-               f1 = asri(16,f);\r
-\r
-               for( j=1 ; j<k ; ++j) \r
-               {       register int _m0, _m1;  \r
-\r
-                       _m0 = MULT16_32_Q14(f0,xp[i][j+1]);\r
-                       xp[i+1][j+2] = ADD32(SUB32(xp[i][j+2], _m0), xp[i][j]);\r
-       \r
-                       _m1 = MULT16_32_Q14(f1,xq[i][j+1]);\r
-                       xq[i+1][j+2] = ADD32(SUB32(xq[i][j+2], _m1), xq[i][j]);\r
-               }\r
-\r
-      \r
-               m0 = MULT16_32_Q14(f0,xp[i][j+1]);\r
-               xp[i+1][j+2] = SUB32(xp[i][j], m0);\r
-               m1 = MULT16_32_Q14(f1,xq[i][j+1]);\r
-               xq[i+1][j+2] = SUB32(xq[i][j], m1);\r
-    }\r
-\r
-\r
-    for( i=0,j=3 ; i<lpcrdr ; ++j,++i ) \r
-       {       register int _a0, _xp0, _xq0;\r
-\r
-               _xp0 = xp[m][j];\r
-               _xq0 = xq[m][j];\r
-\r
-       _a0 = PSHR32(_xp0 + xout1 + _xq0 - xout2, QIMP-13); \r
-               xout1 = _xp0;\r
-               xout2 = _xq0;\r
-     \r
-               ak[i] = iclipi(_a0,32767); \r
-    }\r
-\r
-       LSPTOLPC_STOP();\r
-}\r
-\r
-\r
-#endif\r
diff --git a/tmv/ltp_tm.h b/tmv/ltp_tm.h
deleted file mode 100644 (file)
index eccd701..0000000
+++ /dev/null
@@ -1,479 +0,0 @@
-/* Copyright (C) 2007 Hong Zhiqian */\r
-/**\r
-   @file ltp_tm.h\r
-   @author Hong Zhiqian\r
-   @brief Various compatibility routines for Speex (TriMedia version)\r
-*/\r
-/*\r
-   Redistribution and use in source and binary forms, with or without\r
-   modification, are permitted provided that the following conditions\r
-   are met:\r
-   \r
-   - Redistributions of source code must retain the above copyright\r
-   notice, this list of conditions and the following disclaimer.\r
-   \r
-   - Redistributions in binary form must reproduce the above copyright\r
-   notice, this list of conditions and the following disclaimer in the\r
-   documentation and/or other materials provided with the distribution.\r
-   \r
-   - Neither the name of the Xiph.org Foundation nor the names of its\r
-   contributors may be used to endorse or promote products derived from\r
-   this software without specific prior written permission.\r
-   \r
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
-   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\r
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\r
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-*/\r
-#include <ops/custom_defs.h>\r
-#include "profile_tm.h"\r
-\r
-#ifdef FIXED_POINT\r
-\r
-#define OVERRIDE_INNER_PROD\r
-Int32 inner_prod(const Int16 * restrict x, const Int16 * restrict y, int len)\r
-{\r
-       register int sum = 0;\r
-\r
-       INNERPROD_START();\r
-\r
-       if ( (int)x & 0x03 == 0 && (int)y & 0x03 == 0 )\r
-       {\r
-               register int i;\r
-\r
-               len >>= 1;\r
-               for ( i=0 ; i<len ; i+=4 )\r
-               {\r
-                       register int x0, x1, y0, y1, x2, x3, y2, y3;\r
-\r
-                       x0 = ld32x(x,i);\r
-                       y0 = ld32x(x,i);\r
-                       x1 = ld32x(x,i+1);\r
-                       y1 = ld32x(y,i+1);\r
-                       sum += (ifir16(x0,y0) + ifir16(x1,y1)) >> 6;\r
-\r
-                       x2 = ld32x(x,i+2);\r
-                       y2 = ld32x(x,i+2);\r
-                       x3 = ld32x(x,i+3);\r
-                       y3 = ld32x(x,i+3);\r
-                       sum += (ifir16(x2,y2) + ifir16(x3,y3)) >> 6;\r
-\r
-               }\r
-       } else\r
-       {\r
-               len >>= 3;\r
-               while( len-- )\r
-               {\r
-                       register int x0, x1, x2, x3, y0, y1, y2, y3;\r
-\r
-                       x0 =    pack16lsb(x[0],x[1]);\r
-                       y0 =    pack16lsb(y[0],y[1]);\r
-                       x1 =    pack16lsb(x[2],x[3]);\r
-                       y1 =    pack16lsb(y[2],y[3]);\r
-                       sum     +=      (ifir16(x0,y0) + ifir16(x1,y1)) >> 6;\r
-\r
-                       x2 =    pack16lsb(x[4],x[5]);\r
-                       y2 =    pack16lsb(y[4],y[5]);\r
-                       x3 =    pack16lsb(x[6],x[7]);\r
-                       y3 =    pack16lsb(y[6],y[7]);\r
-                       sum     +=      (ifir16(x2,y2) + ifir16(x3,y3)) >> 6;\r
-\r
-                       x += 8;\r
-                       y += 8;\r
-               }\r
-       }\r
-\r
-       INNERPROD_STOP();\r
-       return sum;\r
-}\r
-\r
-#define OVERRIDE_PITCH_XCORR\r
-void pitch_xcorr(const Int16 *_x, const Int16 *_y, Int32 *corr, int len, int nb_pitch, char *stack)\r
-{\r
-       register int sum_1, sum_2, sum_3, sum_4;\r
-       register int y10, y32, y54, y76, y21, y43, y65;\r
-       register int x10, x32;\r
-       register int i, j, k, limit;\r
-       \r
-       TMDEBUG_ALIGNMEM(_x);\r
-       TMDEBUG_ALIGNMEM(_y);\r
-\r
-       PITCHXCORR_START();\r
-\r
-       limit   = nb_pitch >> 1;\r
-       len             >>= 1;\r
-\r
-       for (i=0 ; i<limit ; i+=2 )\r
-       {\r
-               sum_1 = sum_2 = sum_3 = sum_4 = 0;\r
-               \r
-               y10     = ld32x(_y,i);\r
-               y32     = ld32x(_y,i+1);\r
-               \r
-               for ( j=0 ; j<len ; j+=2 )\r
-               {\r
-                       x10 = ld32x(_x,j);\r
-                       x32 = ld32x(_x,j+1);\r
-                       y54 = ld32x(_y,i+j+2);\r
-                       y76 = ld32x(_y,i+j+3);\r
-                       \r
-                       sum_1 += (ifir16(x10,y10) + ifir16(x32,y32)) >> 6;\r
-                       sum_3 += (ifir16(x10,y32) + ifir16(x32,y54)) >> 6;\r
-\r
-                       y21 = funshift2(y32,y10);\r
-                       y43 = funshift2(y54,y32);\r
-                       y65 = funshift2(y76,y54);\r
-\r
-                       sum_2 += (ifir16(x10,y21) + ifir16(x32,y43)) >> 6;\r
-                       sum_4 += (ifir16(x10,y43) + ifir16(x32,y65)) >> 6;\r
-\r
-                       y10 = y54;\r
-                       y32 = y76;\r
-\r
-               }\r
-\r
-               k = i << 1;\r
-               corr[nb_pitch-1-k]=sum_1;\r
-               corr[nb_pitch-2-k]=sum_2;\r
-               corr[nb_pitch-3-k]=sum_3;\r
-               corr[nb_pitch-4-k]=sum_4;\r
-       }\r
-\r
-#ifndef REMARK_ON\r
-       (void)stack;\r
-#endif\r
-\r
-       PITCHXCORR_STOP();\r
-}\r
-\r
-#ifndef ttisim\r
-#define OVERRIDE_PITCH_GAIN_SEARCH_3TAP_VQ\r
-static int pitch_gain_search_3tap_vq\r
-(\r
-       const signed char       *gain_cdbk,\r
-       int                                     gain_cdbk_size,\r
-       Int16                           *C16,\r
-       Int16                           max_gain\r
-)\r
-{\r
-       register int    pp = 0x00400040, p=64;\r
-       register int    g10, g2, g20, g21, g02, g22, g01;\r
-       register int    cb0, cb1, cb2, cb5432;\r
-       register int    C10, C32, C54, C76, C98, C83, C2;\r
-       register int    acc0, acc1, acc2, acc3, sum, gsum, bsum=-VERY_LARGE32;\r
-       register int    i, best_cdbk=0;\r
-       register Int16  tmp;\r
-\r
-       TMDEBUG_ALIGNMEM(C16);\r
-       TMDEBUG_ALIGNMEM(gain_cdbk+2);\r
-\r
-       PITCHGAINSEARCH3TAPVQ_START();\r
-\r
-       tmp  = ild16(gain_cdbk);\r
-       C98      = ld32x(C16,4);\r
-       C32      = ld32x(C16,1);\r
-       C10  = ld32(C16);\r
-       C54      = ld32x(C16,2);\r
-       C76      = ld32x(C16,3);\r
-\r
-       cb0  = sex8(tmp);\r
-       cb1      = sex8(tmp>>8);\r
-       C83      = funshift2(C98,C32);\r
-       C2       = sex16(C32);\r
-       gain_cdbk += 2;\r
-\r
-\r
-#if (TM_UNROLL && TM_UNROLL_PITCHGAINSEARCH3TAPVQ > 0)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-       for ( i=0 ; i<gain_cdbk_size ; ++i ) \r
-       {\r
-         cb5432 = ld32x(gain_cdbk,i);\r
-                cb2    = sex8(cb5432);\r
-                gsum   = sex8(cb5432>>8);\r
-                sum    = 0;\r
-                \r
-                g10    =  pack16lsb(cb1 + 32, cb0 + 32);\r
-                g2             =  cb2 + 32;\r
-                g02    =  pack16lsb(g10, g2);\r
-                acc0   =  dspidualmul(g10,pp);\r
-                sum    += ifir16(acc0,C10);\r
-                sum    += p * g2 * C2;\r
-\r
-                g22    =  pack16lsb(g02, g02);\r
-                g01    =  funshift2(g10, g10);\r
-\r
-                acc1   =  dspidualmul(g22, g01);\r
-                sum    -= ifir16(acc1, C54);\r
-                acc2   =  dspidualmul(g10, g10);\r
-                sum    -= ifir16(acc2, C76);\r
-\r
-                g20    =  pack16lsb(g2, g10);\r
-                g21    =  funshift2(g2, g10);\r
-                acc3   =  dspidualmul(g20, g21);\r
-                sum    -= ifir16(acc3, C83);\r
-       \r
-\r
-               if ( sum>bsum && gsum<=max_gain ) \r
-               {       bsum = sum;\r
-                       best_cdbk=i;\r
-               }\r
-\r
-               cb0     = sex8(cb5432 >> 16);\r
-               cb1     = asri(24,cb5432);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_PITCHGAINSEARCH3TAPVQ > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-\r
-       PITCHGAINSEARCH3TAPVQ_STOP();\r
-       return best_cdbk;\r
-}\r
-#endif\r
-\r
-#define OVERRIDE_COMPUTE_PITCH_ERROR\r
-#ifndef OVERRIDE_PITCH_GAIN_SEARCH_3TAP_VQ\r
-inline Int32 compute_pitch_error(Int16 *C, Int16 *g, Int16 pitch_control)\r
-{\r
-       register int c10, c32, c54, c76, c98, c83;\r
-       register int g10, g32, g02, g22, g01, g21, g20;\r
-       register int pp, tmp0, tmp1, tmp2, tmp3;\r
-       register int sum = 0;\r
-\r
-       \r
-       COMPUTEPITCHERROR_START();\r
-\r
-       g10  =  ld32(g);\r
-       g32  =  ld32x(g,1);\r
-       pp   =  pack16lsb(pitch_control,pitch_control);\r
-       c10  =  ld32(C);\r
-       c32  =  ld32x(C,1);\r
-       g02  =  pack16lsb(g10,g32);\r
-       g22      =  pack16lsb(g32,g32);\r
-       g01  =  funshift2(g10,g10);\r
-       tmp0 =  dspidualmul(g10,pp);\r
-       sum  += ifir16(tmp0, c10);\r
-       sum  += pitch_control * sex16(g32) * sex16(c32);\r
-       c54  =  ld32x(C,2);\r
-       c76  =  ld32x(C,3);\r
-       c98  =  ld32x(C,4);\r
-       tmp1 =  dspidualmul(g22,g01);\r
-       sum  -= ifir16(tmp1, c54);\r
-       tmp2 =  dspidualmul(g10,g10);\r
-       sum  -= ifir16(tmp2,c76);\r
-       c83  =  funshift2(c98,c32);\r
-       g20      =  funshift2(g02,g02);\r
-       g21  =  funshift2(g02,g10);\r
-       tmp3 =  dspidualmul(g20,g21);\r
-       sum      -= ifir16(tmp3,c83);\r
-\r
-       COMPUTEPITCHERROR_STOP();\r
-    return sum;\r
-}\r
-#endif\r
-\r
-#define OVERRIDE_OPEN_LOOP_NBEST_PITCH\r
-void open_loop_nbest_pitch(Int16 *sw, int start, int end, int len, int *pitch, Int16 *gain, int N, char *stack)\r
-{\r
-       VARDECL(int *best_score);\r
-       VARDECL(int *best_ener);\r
-       VARDECL(Int32 *corr);\r
-       VARDECL(Int16 *corr16);\r
-       VARDECL(Int16 *ener16);\r
-       register int i, j, k, l, N4, N2;\r
-       register int _sw10, _sw32, _s0, _s2, limit;\r
-       register int *energy;\r
-       register int cshift=0, eshift=0;\r
-       register int scaledown = 0;\r
-       register int e0, _energy0;\r
-\r
-       ALLOC(corr16, end-start+1, Int16);\r
-       ALLOC(ener16, end-start+1, Int16);\r
-       ALLOC(corr, end-start+1, Int32);\r
-       ALLOC(best_score, N, int);\r
-       ALLOC(best_ener, N, int);\r
-       energy = corr;\r
-       N4 = N << 2;\r
-       N2 = N >> 1;\r
-\r
-       TMDEBUG_ALIGNMEM(sw);\r
-       TMDEBUG_ALIGNMEM(pitch);\r
-       TMDEBUG_ALIGNMEM(gain);\r
-       TMDEBUG_ALIGNMEM(best_score);\r
-       TMDEBUG_ALIGNMEM(best_ener);\r
-       TMDEBUG_ALIGNMEM(corr16);\r
-       TMDEBUG_ALIGNMEM(ener16);\r
-\r
-       OPENLOOPNBESTPITCH_START();\r
-\r
-       for ( i=0 ; i<N4 ; i+=4 )\r
-       {       st32d(i,best_score,-1);\r
-               st32d(i,best_ener,0);\r
-               st32d(i,pitch,start);\r
-       }\r
-\r
-       for ( j=asri(1,-end) ; j<N2 ; ++j )\r
-       {       register int _sw10;\r
-\r
-               _sw10 = ld32x(sw,j);\r
-               _sw10 = dspidualabs(_sw10);\r
-\r
-               if ( _sw10 & 0xC000C000 )\r
-               {       scaledown = 1;\r
-                       break;\r
-               }\r
-       }\r
-\r
-       if ( scaledown )\r
-       {\r
-               for ( j=asri(1,-end),k=asli(1,-end) ; j<N2 ; ++j,k+=4 )\r
-               {       register int _sw10;\r
-               \r
-                       _sw10 = ld32x(sw,j);\r
-                       _sw10 = dualasr(_sw10,1);\r
-                       st32d(k, sw, _sw10);\r
-               }\r
-       }      \r
-\r
-       energy[0] = _energy0 = inner_prod(sw-start, sw-start, len);\r
-       e0 = inner_prod(sw, sw, len);\r
-\r
-       j=asri(1,-start-1); k=j+20;\r
-       _sw10 = ld32x(sw,j);\r
-       _sw32 = ld32x(sw,k);\r
-       limit = end-1-start;\r
-\r
-       for ( i=1,--j,--k ; i<limit ; i+=2,--j,--k )\r
-       {       register int _energy1, __sw10, __sw32, __s0, __s2;\r
-      \r
-               _s0    = sex16(_sw10);\r
-               _s2        = sex16(_sw32);\r
-               _energy1 = (_energy0 + ((_s0 * _s0) >> 6)) -  ((_s2 * _s2) >> 6);\r
-               _energy0 = imax(0,_energy1);\r
-               energy[i] = _energy0;\r
-               __sw10 = ld32x(sw,j);\r
-               __sw32 = ld32x(sw,k);\r
-               __s0   = asri(16,__sw10);\r
-               __s2   = asri(16,__sw32);\r
-               _energy1 = (_energy0 + ((__s0 * __s0) >> 6)) -  ((__s2 * __s2) >> 6);\r
-               _energy0 = imax(0,_energy1);\r
-               energy[i+1] = _energy0;\r
-               _sw10 = __sw10;\r
-               _sw32 = __sw32;\r
-       }\r
-\r
-       _s0    = sex16(_sw10);\r
-       _s2        = sex16(_sw32);\r
-       _energy0 = imax(0,(_energy0 + ((_s0 * _s0) >> 6)) -  ((_s2 * _s2) >> 6));\r
-       energy[i] = _energy0;\r
-\r
-\r
-       eshift = normalize16(energy, ener16, 32766, end-start+1); \r
-       /* In fixed-point, this actually overrites the energy array (aliased to corr) */\r
-       pitch_xcorr(sw, sw-end, corr, len, end-start+1, stack);\r
-       /* Normalize to 180 so we can square it and it still fits in 16 bits */\r
-       cshift = normalize16(corr, corr16, 180, end-start+1);\r
-       /* If we scaled weighted input down, we need to scale it up again (OK, so we've just lost the LSB, who cares?) */\r
-   \r
-       if ( scaledown )\r
-       {\r
-               for ( j=asri(1,-end),k=asli(1,-end) ; j<N2 ; ++j,k+=4 )\r
-               {       register int _sw10;\r
-                       \r
-                       _sw10 = ld32x(sw,j);\r
-                       _sw10 = dualasl(_sw10,1);\r
-                       st32d(k, sw, _sw10);\r
-               }\r
-       }      \r
-\r
-       /* Search for the best pitch prediction gain */\r
-       for ( i=start,l=0 ; i<end ; i+=2,++l )\r
-       {       register int _corr16, _c0, _c1;\r
-               register int _ener16, _e0, _e1;\r
-\r
-               _corr16 = ld32x(corr16,l);\r
-               _corr16 = dspidualmul(_corr16,_corr16);\r
-               _c0     = sex16(_corr16);\r
-               _c1     = asri(16,_corr16);\r
-\r
-               _ener16 = ld32x(ener16,l);\r
-               _ener16 = dspidualadd(_ener16,0x00010001);\r
-               _e0         = sex16(_ener16);\r
-               _e1     = asri(16,_ener16);\r
-\r
-      /* Instead of dividing the tmp by the energy, we multiply on the other side */\r
-      \r
-               if ( (_c0 * best_ener[N-1]) > (best_score[N-1] * _e0) )\r
-               {       \r
-                       best_score[N-1] = _c0;\r
-                       best_ener[N-1] = _e0;\r
-                       pitch[N-1] = i;\r
-\r
-                       for( j=0 ; j<N-1 ; ++j )\r
-                       {       if ( (_c0 * best_ener[j]) > best_score[j] * _e0 )\r
-                               {       for( k=N-1 ; k>j ; --k )\r
-                                       {\r
-                                               best_score[k]=best_score[k-1];\r
-                                               best_ener[k]=best_ener[k-1];\r
-                                               pitch[k]=pitch[k-1];\r
-                                       }\r
-\r
-                               best_score[j]=_c0;\r
-                                       best_ener[j]=_e0;\r
-                                       pitch[j]=i;\r
-                                       break;\r
-                               }\r
-                       }\r
-               }\r
-\r
-               if ( (_c1 * best_ener[N-1]) > (best_score[N-1] * _e1) )\r
-               {       \r
-                       best_score[N-1] = _c1;\r
-                       best_ener[N-1] = _e1;\r
-                       pitch[N-1] = i+1;\r
-\r
-                       for( j=0 ; j<N-1 ; ++j )\r
-                       {       if ( (_c1 * best_ener[j]) > best_score[j] * _e1 )\r
-                               {       for( k=N-1 ; k>j ; --k )\r
-                                       {\r
-                                               best_score[k]=best_score[k-1];\r
-                                               best_ener[k]=best_ener[k-1];\r
-                                               pitch[k]=pitch[k-1];\r
-                                       }\r
-\r
-                               best_score[j]=_c1;\r
-                                       best_ener[j]=_e1;\r
-                                       pitch[j]=i+1;\r
-                                       break;\r
-                               }\r
-                       }\r
-               }\r
-   }\r
-   \r
-   /* Compute open-loop gain if necessary */\r
-   if (gain)\r
-   {\r
-               for (j=0;j<N;j++)\r
-               {\r
-                       spx_word16_t g;\r
-                       i=pitch[j];\r
-                       g = DIV32(SHL32(EXTEND32(corr16[i-start]),cshift), 10+SHR32(MULT16_16(spx_sqrt(e0),spx_sqrt(SHL32(EXTEND32(ener16[i-start]),eshift))),6));\r
-                       gain[j] = imax(0,g);\r
-               }\r
-       }\r
-\r
-       OPENLOOPNBESTPITCH_STOP();\r
-}\r
-\r
-\r
-#endif\r
-\r
diff --git a/tmv/quant_lsp_tm.h b/tmv/quant_lsp_tm.h
deleted file mode 100644 (file)
index e704eae..0000000
+++ /dev/null
@@ -1,448 +0,0 @@
-/* Copyright (C) 2007 Hong Zhiqian */\r
-/**\r
-   @file quant_lsp_tm.h\r
-   @author Hong Zhiqian\r
-   @brief Various compatibility routines for Speex (TriMedia version)\r
-*/\r
-/*\r
-   Redistribution and use in source and binary forms, with or without\r
-   modification, are permitted provided that the following conditions\r
-   are met:\r
-   \r
-   - Redistributions of source code must retain the above copyright\r
-   notice, this list of conditions and the following disclaimer.\r
-   \r
-   - Redistributions in binary form must reproduce the above copyright\r
-   notice, this list of conditions and the following disclaimer in the\r
-   documentation and/or other materials provided with the distribution.\r
-   \r
-   - Neither the name of the Xiph.org Foundation nor the names of its\r
-   contributors may be used to endorse or promote products derived from\r
-   this software without specific prior written permission.\r
-   \r
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
-   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\r
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\r
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-*/\r
-#include <ops/custom_defs.h>\r
-#include "profile_tm.h"\r
-\r
-#ifdef FIXED_POINT\r
-\r
-#define OVERRIDE_COMPUTE_QUANT_WEIGHTS\r
-static void compute_quant_weights(Int16 *qlsp, Int16 *qw, int order)\r
-{\r
-       int             qlspi, qlspii;\r
-       int             w1, w2;\r
-       int             i;\r
-\r
-       TMDEBUG_ALIGNMEM(qlsp);\r
-       TMDEBUG_ALIGNMEM(qw);\r
-\r
-       COMPUTEQUANTWEIGHTS_START();\r
-\r
-       --order;\r
-\r
-       qlspi   = (int)qlsp[0]; \r
-       qlspii  = (int)qlsp[1];\r
-       w1              = qlspi;        \r
-       w2              = qlspii - qlspi;\r
-\r
-       qw[0]   = 81920 / (300 + imin(w1,w2));\r
-\r
-       for ( i=1 ; i<order ; ++i )\r
-       {       qlspi   = qlspii;\r
-               qlspii  = qlsp[i+1];\r
-\r
-               w1 = w2;\r
-               w2 = qlspii - qlspi;\r
-\r
-               qw[i] = 81920 / (300 + imin(w1,w2));\r
-       }\r
-\r
-       w1 = LSP_PI - qlspii;\r
-       qw[i] = 81920 / (300 + imin(w1,w2));\r
-\r
-       COMPUTEQUANTWEIGHTS_STOP();\r
-}\r
-\r
-\r
-\r
-#define OVERRIDE_LSP_QUANT\r
-static int lsp_quant(Int16 *x, const signed char *cdbk, int nbVec, int nbDim)\r
-{\r
-       register int best_dist=VERY_LARGE32;\r
-       register int best_id=0;\r
-       register int i, j;\r
-       register int dt0, dt1, dt2, dt3;\r
-       register int cb0, cb1, cb2, cb3, xx;\r
-       register int ptr_inc = nbDim * 3;\r
-       register int five = 5;\r
-    const signed char *ptr;\r
-\r
-       TMDEBUG_ALIGNMEM(x);\r
-\r
-       LSPQUANT_START();\r
-\r
-       for ( i=0, ptr=cdbk ; i<nbVec ; i+=4, ptr += ptr_inc )\r
-       {       dt3 = dt2 = dt1 = dt0 = 0;\r
-\r
-               for ( j=0 ; j <nbDim ; j += 2 )\r
-               {\r
-                       xx        =  ld32x(x,j>>1);\r
-                       cb0       =  pack16lsb((int)ptr[1], (int)ptr[0]);\r
-                       cb0       =  dualasl(cb0,five);\r
-                       cb0       =  dspidualsub(xx,cb0);\r
-                       dt0       += ifir16(cb0,cb0);\r
-\r
-                       cb1       =      pack16lsb((int)ptr[nbDim+1], (int)ptr[nbDim]);\r
-                       cb1       =  dualasl(cb1,five);\r
-                       cb1   =  dspidualsub(xx,cb1);\r
-                       dt1   += ifir16(cb1, cb1);\r
-\r
-                       cb2       =      pack16lsb((int)ptr[nbDim*2+1], (int)ptr[nbDim*2]);\r
-                       cb2       =  dualasl(cb2,five);\r
-                       cb2       =  dspidualsub(xx,cb2);\r
-                       dt2   += ifir16(cb2, cb2);\r
-\r
-                       cb3       =      pack16lsb((int)ptr[nbDim*3+1], (int)ptr[nbDim*3]);\r
-                       cb3       =  dualasl(cb3,five);\r
-                       cb3       =  dspidualsub(xx,cb3);\r
-                       dt3   += ifir16(cb3, cb3);\r
-\r
-                       ptr += 2;\r
-               }\r
-\r
-               if ( dt0<best_dist )\r
-               {       best_dist       =       dt0;\r
-                       best_id         =       i;\r
-               }\r
-\r
-               if ( dt1<best_dist )\r
-               {       best_dist       =       dt1;\r
-                       best_id         =       i+1;\r
-               }\r
-               \r
-               if ( dt2<best_dist )\r
-               {       best_dist       =       dt2;\r
-                       best_id         =       i+2;\r
-               }\r
-\r
-               if ( dt3<best_dist )\r
-               {       best_dist       =       dt3;\r
-                       best_id         =       i+3;\r
-               }\r
-       }\r
-\r
-       for ( j=0,ptr=cdbk+best_id*nbDim ; j<nbDim ; j+=2 )\r
-       {       xx        =  ld32x(x,j>>1);\r
-               cb0       =  pack16lsb((int)ptr[j+1], (int)ptr[j]);\r
-               cb0       =  dualasl(cb0,five);\r
-               dt0       =  dspidualsub(xx,cb0);\r
-               st32d(j<<1, x, dt0);\r
-       }\r
-\r
-       LSPQUANT_STOP();\r
-       return best_id;\r
-}\r
-\r
-\r
-#define OVERRIDE_LSP_WEIGHT_QUANT\r
-static int lsp_weight_quant(Int16 *x, Int16 *weight, const signed char *cdbk, int nbVec, int nbDim)\r
-{\r
-       register int best_dist=VERY_LARGE32;\r
-       register int best_id=0;\r
-       register int i, j;\r
-       register int dt1, dt2, dt3, dt4;\r
-       register int cb1, cb2, cb3, cb4, wt, xx;\r
-       register int ptr_inc = nbDim * 3;\r
-       const signed char *ptr;\r
-\r
-       LSPWEIGHTQUANT_START();\r
-\r
-       for ( i=0, ptr=cdbk ; i<nbVec ; i+=4, ptr += ptr_inc )\r
-       {       dt4 = dt3 = dt2 = dt1 = 0;\r
-                       \r
-               for ( j=0 ; j<nbDim ; ++j )\r
-               {       wt        =  weight[j];\r
-                       xx        =  x[j];\r
-\r
-                       cb1       =  xx - (ptr[0]               << 5);\r
-                       cb2       =  xx - (ptr[nbDim]   << 5);\r
-                       cb3       =  xx - (ptr[nbDim*2] << 5);\r
-                       cb4       =  xx - (ptr[nbDim*3] << 5);\r
-\r
-                       ++ptr;\r
-\r
-                       cb1       *= cb1;\r
-                       cb2       *= cb2;\r
-                       cb3       *= cb3;\r
-                       cb4       *= cb4;\r
-\r
-                       dt1 += (wt * (cb1 >> 15)) + ((wt * (cb1 & 0x7fff)) >> 15);\r
-                       dt2 += (wt * (cb2 >> 15)) + ((wt * (cb2 & 0x7fff)) >> 15);\r
-                       dt3 += (wt * (cb3 >> 15)) + ((wt * (cb3 & 0x7fff)) >> 15);\r
-                       dt4 += (wt * (cb4 >> 15)) + ((wt * (cb4 & 0x7fff)) >> 15);\r
-\r
-               }\r
-\r
-               if ( dt1<best_dist )\r
-               {       best_dist       =       dt1;\r
-                       best_id         =       i;\r
-               }\r
-\r
-               if ( dt2<best_dist )\r
-               {       best_dist       =       dt2;\r
-                       best_id         =       i+1;\r
-               }\r
-               \r
-               if ( dt3<best_dist )\r
-               {       best_dist       =       dt3;\r
-                       best_id         =       i+2;\r
-               }\r
-\r
-               if ( dt4<best_dist )\r
-               {       best_dist       =       dt4;\r
-                       best_id         =       i+3;\r
-               }\r
-       }\r
-\r
-       for ( j=0 ; j<nbDim ; ++j )\r
-       {       x[j] = x[j] - ((Int16)cdbk[best_id*nbDim+j] << 5);\r
-       }\r
-\r
-       LSPWEIGHTQUANT_STOP();\r
-\r
-       return best_id;\r
-}\r
-\r
-#if 0\r
-// TODO: unroll loops\r
-#define OVERRIDE_LSP_QUANT_NB\r
-void lsp_quant_nb(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)\r
-{\r
-   int i;\r
-   int id;\r
-   spx_word16_t quant_weight[10];\r
-   \r
-   for (i=0;i<order;i++)\r
-      qlsp[i]=lsp[i];\r
-\r
-   compute_quant_weights(qlsp, quant_weight, order);\r
-\r
-   for (i=0;i<order;i++)\r
-      qlsp[i]=SUB16(qlsp[i],LSP_LINEAR(i));\r
-\r
-#ifndef FIXED_POINT\r
-   for (i=0;i<order;i++)\r
-      qlsp[i] = LSP_SCALE*qlsp[i];\r
-#endif\r
-   id = lsp_quant(qlsp, cdbk_nb, NB_CDBK_SIZE, order);\r
-   speex_bits_pack(bits, id, 6);\r
-\r
-   for (i=0;i<order;i++)\r
-      qlsp[i]*=2;\r
\r
-   id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low1, NB_CDBK_SIZE_LOW1, 5);\r
-   speex_bits_pack(bits, id, 6);\r
-\r
-   for (i=0;i<5;i++)\r
-      qlsp[i]*=2;\r
-\r
-   id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low2, NB_CDBK_SIZE_LOW2, 5);\r
-   speex_bits_pack(bits, id, 6);\r
-\r
-   id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high1, NB_CDBK_SIZE_HIGH1, 5);\r
-   speex_bits_pack(bits, id, 6);\r
-\r
-   for (i=5;i<10;i++)\r
-      qlsp[i]*=2;\r
-\r
-   id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high2, NB_CDBK_SIZE_HIGH2, 5);\r
-   speex_bits_pack(bits, id, 6);\r
-\r
-#ifdef FIXED_POINT\r
-   for (i=0;i<order;i++)\r
-      qlsp[i]=PSHR16(qlsp[i],2);\r
-#else\r
-   for (i=0;i<order;i++)\r
-      qlsp[i]=qlsp[i] * .00097656;\r
-#endif\r
-\r
-   for (i=0;i<order;i++)\r
-      qlsp[i]=lsp[i]-qlsp[i];\r
-}\r
-\r
-\r
-#define OVERRIDE_LSP_UNQUANT_NB\r
-void lsp_unquant_nb(spx_lsp_t *lsp, int order, SpeexBits *bits)\r
-{\r
-   int i, id;\r
-   for (i=0;i<order;i++)\r
-      lsp[i]=LSP_LINEAR(i);\r
-\r
-   id=speex_bits_unpack_unsigned(bits, 6);\r
-   for (i=0;i<10;i++)\r
-      lsp[i] = ADD32(lsp[i], LSP_DIV_256(cdbk_nb[id*10+i]));\r
-\r
-   id=speex_bits_unpack_unsigned(bits, 6);\r
-   for (i=0;i<5;i++)\r
-      lsp[i] = ADD16(lsp[i], LSP_DIV_512(cdbk_nb_low1[id*5+i]));\r
-\r
-   id=speex_bits_unpack_unsigned(bits, 6);\r
-   for (i=0;i<5;i++)\r
-      lsp[i] = ADD32(lsp[i], LSP_DIV_1024(cdbk_nb_low2[id*5+i]));\r
-\r
-   id=speex_bits_unpack_unsigned(bits, 6);\r
-   for (i=0;i<5;i++)\r
-      lsp[i+5] = ADD32(lsp[i+5], LSP_DIV_512(cdbk_nb_high1[id*5+i]));\r
-   \r
-   id=speex_bits_unpack_unsigned(bits, 6);\r
-   for (i=0;i<5;i++)\r
-      lsp[i+5] = ADD32(lsp[i+5], LSP_DIV_1024(cdbk_nb_high2[id*5+i]));\r
-}\r
-\r
-#define OVERRIDE_LSP_QUANT_LBR\r
-void lsp_quant_lbr(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)\r
-{\r
-   int i;\r
-   int id;\r
-   spx_word16_t quant_weight[10];\r
-\r
-   for (i=0;i<order;i++)\r
-      qlsp[i]=lsp[i];\r
-\r
-   compute_quant_weights(qlsp, quant_weight, order);\r
-\r
-   for (i=0;i<order;i++)\r
-      qlsp[i]=SUB16(qlsp[i],LSP_LINEAR(i));\r
-#ifndef FIXED_POINT\r
-   for (i=0;i<order;i++)\r
-      qlsp[i]=qlsp[i]*LSP_SCALE;\r
-#endif\r
-   id = lsp_quant(qlsp, cdbk_nb, NB_CDBK_SIZE, order);\r
-   speex_bits_pack(bits, id, 6);\r
-   \r
-   for (i=0;i<order;i++)\r
-      qlsp[i]*=2;\r
-   \r
-   id = lsp_weight_quant(qlsp, quant_weight, cdbk_nb_low1, NB_CDBK_SIZE_LOW1, 5);\r
-   speex_bits_pack(bits, id, 6);\r
-\r
-   id = lsp_weight_quant(qlsp+5, quant_weight+5, cdbk_nb_high1, NB_CDBK_SIZE_HIGH1, 5);\r
-   speex_bits_pack(bits, id, 6);\r
-\r
-#ifdef FIXED_POINT\r
-   for (i=0;i<order;i++)\r
-      qlsp[i] = PSHR16(qlsp[i],1);\r
-#else\r
-   for (i=0;i<order;i++)\r
-      qlsp[i] = qlsp[i]*0.0019531;\r
-#endif\r
-\r
-   for (i=0;i<order;i++)\r
-      qlsp[i]=lsp[i]-qlsp[i];\r
-}\r
-\r
-#define OVERRIDE_LSP_UNQUANT_LBR\r
-void lsp_unquant_lbr(spx_lsp_t *lsp, int order, SpeexBits *bits)\r
-{\r
-   int i, id;\r
-   for (i=0;i<order;i++)\r
-      lsp[i]=LSP_LINEAR(i);\r
-\r
-\r
-   id=speex_bits_unpack_unsigned(bits, 6);\r
-   for (i=0;i<10;i++)\r
-      lsp[i] += LSP_DIV_256(cdbk_nb[id*10+i]);\r
-\r
-   id=speex_bits_unpack_unsigned(bits, 6);\r
-   for (i=0;i<5;i++)\r
-      lsp[i] += LSP_DIV_512(cdbk_nb_low1[id*5+i]);\r
-\r
-   id=speex_bits_unpack_unsigned(bits, 6);\r
-   for (i=0;i<5;i++)\r
-      lsp[i+5] += LSP_DIV_512(cdbk_nb_high1[id*5+i]);\r
-   \r
-}\r
-\r
-extern const signed char high_lsp_cdbk[];\r
-extern const signed char high_lsp_cdbk2[];\r
-\r
-#define OVERRIDE_LSP_UNQUANT_HIGH\r
-void lsp_unquant_high(spx_lsp_t *lsp, int order, SpeexBits *bits)\r
-{\r
-\r
-   int i, id;\r
-   for (i=0;i<order;i++)\r
-      lsp[i]=LSP_LINEAR_HIGH(i);\r
-\r
-\r
-   id=speex_bits_unpack_unsigned(bits, 6);\r
-   for (i=0;i<order;i++)\r
-      lsp[i] += LSP_DIV_256(high_lsp_cdbk[id*order+i]);\r
-\r
-\r
-   id=speex_bits_unpack_unsigned(bits, 6);\r
-   for (i=0;i<order;i++)\r
-      lsp[i] += LSP_DIV_512(high_lsp_cdbk2[id*order+i]);\r
-}\r
-\r
-#define OVERRIDE_LSP_QUANT_HIGH\r
-void lsp_quant_high(spx_lsp_t *lsp, spx_lsp_t *qlsp, int order, SpeexBits *bits)\r
-{\r
-   int i;\r
-   int id;\r
-   spx_word16_t quant_weight[10];\r
-\r
-   for (i=0;i<order;i++)\r
-      qlsp[i]=lsp[i];\r
-\r
-   compute_quant_weights(qlsp, quant_weight, order);\r
-\r
-   /*   quant_weight[0] = 10/(qlsp[1]-qlsp[0]);\r
-   quant_weight[order-1] = 10/(qlsp[order-1]-qlsp[order-2]);\r
-   for (i=1;i<order-1;i++)\r
-   {\r
-      tmp1 = 10/(qlsp[i]-qlsp[i-1]);\r
-      tmp2 = 10/(qlsp[i+1]-qlsp[i]);\r
-      quant_weight[i] = tmp1 > tmp2 ? tmp1 : tmp2;\r
-      }*/\r
-\r
-   for (i=0;i<order;i++)\r
-      qlsp[i]=SUB16(qlsp[i],LSP_LINEAR_HIGH(i));\r
-#ifndef FIXED_POINT\r
-   for (i=0;i<order;i++)\r
-      qlsp[i] = qlsp[i]*LSP_SCALE;\r
-#endif\r
-   id = lsp_quant(qlsp, high_lsp_cdbk, 64, order);\r
-   speex_bits_pack(bits, id, 6);\r
-\r
-   for (i=0;i<order;i++)\r
-      qlsp[i]*=2;\r
-\r
-   id = lsp_weight_quant(qlsp, quant_weight, high_lsp_cdbk2, 64, order);\r
-   speex_bits_pack(bits, id, 6);\r
-\r
-#ifdef FIXED_POINT\r
-   for (i=0;i<order;i++)\r
-      qlsp[i] = PSHR16(qlsp[i],1);\r
-#else\r
-   for (i=0;i<order;i++)\r
-      qlsp[i] = qlsp[i]*0.0019531;\r
-#endif\r
-\r
-   for (i=0;i<order;i++)\r
-      qlsp[i]=lsp[i]-qlsp[i];\r
-}\r
-#endif\r
-\r
-#endif\r
diff --git a/tmv/vq_tm.h b/tmv/vq_tm.h
deleted file mode 100644 (file)
index c8c6109..0000000
+++ /dev/null
@@ -1,494 +0,0 @@
-/* Copyright (C) 2007 Hong Zhiqian */\r
-/**\r
-   @file vq_tm.h\r
-   @author Hong Zhiqian\r
-   @brief Various compatibility routines for Speex (TriMedia version)\r
-*/\r
-/*\r
-   Redistribution and use in source and binary forms, with or without\r
-   modification, are permitted provided that the following conditions\r
-   are met:\r
-   \r
-   - Redistributions of source code must retain the above copyright\r
-   notice, this list of conditions and the following disclaimer.\r
-   \r
-   - Redistributions in binary form must reproduce the above copyright\r
-   notice, this list of conditions and the following disclaimer in the\r
-   documentation and/or other materials provided with the distribution.\r
-   \r
-   - Neither the name of the Xiph.org Foundation nor the names of its\r
-   contributors may be used to endorse or promote products derived from\r
-   this software without specific prior written permission.\r
-   \r
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
-   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
-   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\r
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\r
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-*/\r
-#include <ops/custom_defs.h>\r
-#include "profile_tm.h"\r
-\r
-#ifdef FIXED_POINT\r
-\r
-inline void vq_nbest_dist(int i, int N, int dist, int *used, int *nbest, Int32 *best_dist)\r
-{\r
-       register int k;\r
-       \r
-       if (i<N || dist<best_dist[N-1])\r
-       {\r
-               for (k=N-1; (k >= 1) && (k > *used || dist < best_dist[k-1]); k--)\r
-               {       best_dist[k]=best_dist[k-1];\r
-                       nbest[k] = nbest[k-1];\r
-               }\r
-               \r
-               best_dist[k]=dist;\r
-               nbest[k]=i;\r
-               *used++;\r
-       }\r
-}\r
-\r
-void vq_nbest_5(Int16 *in, const Int16 *codebook, int entries, Int32 *E, int N, int *nbest, Int32 *best_dist)\r
-{\r
-       register int    i, j;\r
-       register int    in10, in32, in4;\r
-       int                     used = 0;\r
-       \r
-       in10 = pack16lsb(in[1],in[0]);                  /* Note: memory is not align here */\r
-       in32 = pack16lsb(in[3],in[2]);\r
-       in4 = sex16(in[4]);     \r
-\r
-#if (TM_UNROLL && TM_UNROLL_VQNBEST > 0)\r
-#pragma TCS_unroll=2\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-\r
-       for ( i=0,j=0 ; i<entries ; i+=2,j+=5 )\r
-       {\r
-               register int dist1, dist2;\r
-               register int cb10, cb32, cb54, cb76, cb98, cb87, cb65;\r
-               \r
-               cb10  =  ld32x(codebook,j);\r
-               cb32  =  ld32x(codebook,j+1);\r
-               cb54  =  ld32x(codebook,j+2);\r
-               cb76  =  ld32x(codebook,j+3);\r
-               cb98  =  ld32x(codebook,j+4);\r
-\r
-               dist1 = sex16(cb54) * in4;\r
-               dist1 += ifir16(in10,cb10) + ifir16(in32,cb32);\r
-               dist1 = (E[i] >> 1) - dist1;\r
-               \r
-               cb65  =  funshift2(cb76,cb54);\r
-               cb87  =  funshift2(cb98,cb76);\r
-               dist2 =  asri(16,cb98) * in4;\r
-               dist2 += ifir16(in10,cb65) + ifir16(in32,cb87);\r
-               dist2 = (E[i+1] >> 1) - dist2;\r
-\r
-               vq_nbest_dist(i,N,dist1,&used,nbest,best_dist);\r
-               vq_nbest_dist(i+1,N,dist2,&used,nbest,best_dist);\r
-       }\r
-\r
-#if (TM_UNROLL && TM_UNROLL_VQNBEST > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-}\r
-\r
-\r
-void vq_nbest_8(Int16 *in, const Int16 *codebook, int entries, Int32 *E, int N, int *nbest, Int32 *best_dist)\r
-{\r
-       register int    i, j;\r
-       register int    in10, in32, in54, in76;\r
-       int                     used = 0;\r
-       \r
-       in10 = pack16lsb(in[1],in[0]);                          /* Note: memory is not align here */\r
-       in32 = pack16lsb(in[3],in[2]);\r
-       in54 = pack16lsb(in[5],in[4]);  \r
-       in76 = pack16lsb(in[7],in[6]);  \r
-\r
-#if (TM_UNROLL && TM_UNROLL_VQNBEST > 0)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-       for ( i=0,j=0 ; i<entries ; ++i,j+=4 )\r
-       {\r
-               register int dist;\r
-               register int cb10, cb32, cb54, cb76;\r
-               \r
-               cb10  =  ld32x(codebook,j);\r
-               cb32  =  ld32x(codebook,j+1);\r
-               cb54  =  ld32x(codebook,j+2);\r
-               cb76  =  ld32x(codebook,j+3);\r
-               \r
-               dist  =  ifir16(in10,cb10) + ifir16(in32,cb32);\r
-               dist  += ifir16(in54,cb54) + ifir16(in76,cb76);\r
-               dist  =  (E[i] >> 1) - dist;\r
-         \r
-               vq_nbest_dist(i,N,dist,&used,nbest,best_dist);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_VQNBEST > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-\r
-}\r
-\r
-\r
-void vq_nbest_10(Int16 *in, const Int16 *codebook, int entries, Int32 *E, int N, int *nbest, Int32 *best_dist)\r
-{\r
-       register int    i, j;\r
-       register int    in10, in32, in54, in76, in98;\r
-       int                             used = 0;\r
-       \r
-       in10 = pack16lsb(in[1],in[0]);\r
-       in32 = pack16lsb(in[3],in[2]);\r
-       in54 = pack16lsb(in[5],in[4]);\r
-       in76 = pack16lsb(in[7],in[6]);\r
-       in98 = pack16lsb(in[9],in[8]);\r
-\r
-#if (TM_UNROLL && TM_UNROLL_VQNBEST > 0)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-       for ( i=0,j=0 ; i<entries ; ++i,j+=5 )\r
-       {\r
-               register int dist;\r
-               register int cb10, cb32, cb54, cb76, cb98;\r
-               \r
-               cb10  =  ld32x(codebook,j);\r
-               cb32  =  ld32x(codebook,j+1);\r
-               cb54  =  ld32x(codebook,j+2);\r
-               cb76  =  ld32x(codebook,j+3);\r
-               cb98  =  ld32x(codebook,j+4);\r
-\r
-               dist  =  ifir16(in10,cb10) + ifir16(in32,cb32);\r
-               dist  += ifir16(in54,cb54) + ifir16(in76,cb76);\r
-               dist  += ifir16(in98,cb98);\r
-               dist  =  (E[i] >> 1) - dist;\r
-         \r
-               vq_nbest_dist(i,N,dist,&used,nbest,best_dist);    \r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_VQNBEST > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-}\r
-\r
-void vq_nbest_20(Int16 *in, const Int16 *codebook, int entries, Int32 *E, int N, int *nbest, Int32 *best_dist)\r
-{\r
-       register int    i, j;\r
-       register int    in10, in32, in54, in76, in98, in_10, in_32, in_54, in_76, in_98;\r
-       int                     used = 0;\r
-       \r
-       in10  = pack16lsb(in[1],in[0]);                                 /* Note: memory is not align here */\r
-       in32  = pack16lsb(in[3],in[2]);\r
-       in54  = pack16lsb(in[5],in[4]);\r
-       in76  = pack16lsb(in[6],in[6]);\r
-       in98  = pack16lsb(in[9],in[8]);\r
-       in_10 = pack16lsb(in[11],in[10]);\r
-       in_32 = pack16lsb(in[13],in[12]);\r
-       in_54 = pack16lsb(in[15],in[14]);\r
-       in_76 = pack16lsb(in[17],in[16]);\r
-       in_98 = pack16lsb(in[19],in[18]);\r
-\r
-#if (TM_UNROLL && TM_UNROLL_VQNBEST > 0)\r
-#pragma TCS_unroll=2\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-       for ( i=0,j=0 ; i<entries ; ++i,j+=10 )\r
-       {\r
-               register int dist;\r
-               register int cb10, cb32, cb54, cb76, cb98, cb_10, cb_32, cb_54, cb_76, cb_98;\r
-               \r
-               cb10   =  ld32x(codebook,j);\r
-               cb32   =  ld32x(codebook,j+1);\r
-               cb54   =  ld32x(codebook,j+2);\r
-               cb76   =  ld32x(codebook,j+3);\r
-               cb98   =  ld32x(codebook,j+4);\r
-               cb_10  =  ld32x(codebook,j+5);\r
-               cb_32  =  ld32x(codebook,j+6);\r
-               cb_54  =  ld32x(codebook,j+7);\r
-               cb_76  =  ld32x(codebook,j+8);\r
-               cb_98  =  ld32x(codebook,j+9);\r
-\r
-               dist   =  ifir16(in10,cb10) + ifir16(in32,cb32);\r
-               dist   += ifir16(in54,cb54) + ifir16(in76,cb76);\r
-               dist   += ifir16(in98,cb98) + ifir16(in_10,cb_10);\r
-               dist   += ifir16(in_32,cb_32) + ifir16(in_54,cb_54);\r
-               dist   += ifir16(in_76,cb_76) + ifir16(in_98,cb_98);\r
-\r
-               dist   =  (E[i] >> 1) - dist;  \r
-               vq_nbest_dist(i,N,dist,&used,nbest,best_dist);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_VQNBEST > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-}\r
-\r
-\r
-#define OVERRIDE_VQ_NBEST\r
-void vq_nbest (Int16 *in, const Int16 *codebook, int len, int entries, Int32 *E, int N, int *nbest, Int32 *best_dist, char *stack)\r
-{\r
-       TMDEBUG_ALIGNMEM(codebook);\r
-\r
-       VQNBEST_START();\r
-       if( len==5 )\r
-               vq_nbest_5(in,codebook,entries,E,N,nbest,best_dist);\r
-       else if ( len==8 )\r
-               vq_nbest_8(in,codebook,entries,E,N,nbest,best_dist);\r
-       else if ( len==10 )\r
-               vq_nbest_10(in,codebook,entries,E,N,nbest,best_dist);\r
-       else if ( len==20 )\r
-               vq_nbest_20(in,codebook,entries,E,N,nbest,best_dist);\r
-\r
-#ifndef REMARK_ON\r
-       (void)stack;\r
-#endif\r
-\r
-       VQNBEST_STOP();\r
-}\r
-\r
-inline void vq_nbest_sign_dist(int i, int N, int dist, int sign, int entries, int *used, int *nbest, Int32 *best_dist)\r
-{\r
-       register int k;\r
-\r
-       if (i<N || dist<best_dist[N-1])\r
-       {       for (k=N-1; (k >= 1) && (k > *used || dist < best_dist[k-1]); k--)\r
-               {\r
-                       best_dist[k]=best_dist[k-1];\r
-                       nbest[k] = nbest[k-1];\r
-               }\r
-               \r
-               if ( sign ) i += entries;\r
-               best_dist[k]=dist;\r
-               *used++;\r
-               nbest[k] = i;\r
-       }\r
-}                                                                                      \r
-\r
-void vq_nbest_sign_5(Int16 *in, const Int16 *codebook, int entries, Int32 *E, int N, int *nbest, Int32 *best_dist)\r
-{\r
-       register int    i, j;\r
-       register int    in10, in32, in4;\r
-       int                             used = 0;\r
-       \r
-       in10 = ld32(in);\r
-       in32 = ld32x(in,1);\r
-       in4      = sex16(in[4]);\r
-\r
-#if (TM_UNROLL && TM_UNROLL_VQSIGNNBEST > 0)\r
-#pragma TCS_unroll=2\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-\r
-       for ( i=0,j=0 ; i<entries ; i+=2,j+=5 )\r
-       {\r
-               register int dist1, dist2, sign1, sign2;\r
-               register int cb10, cb32, cb54, cb76, cb98, cb87, cb65;\r
-               \r
-               cb10  =  ld32x(codebook,j);\r
-               cb32  =  ld32x(codebook,j+1);\r
-               cb54  =  ld32x(codebook,j+2);\r
-               cb76  =  ld32x(codebook,j+3);\r
-               cb98  =  ld32x(codebook,j+4);\r
-\r
-               dist1 = sex16(cb54) * in4;\r
-               dist1 += ifir16(in10,cb10) + ifir16(in32,cb32);\r
-               \r
-               sign1 = mux(dist1>0,0,1);       \r
-               dist1 = iflip(dist1>0,dist1);\r
-               dist1 =  (E[i] >> 1) + dist1;  \r
-               \r
-               cb65  =  funshift2(cb76,cb54);\r
-               cb87  =  funshift2(cb98,cb76);\r
-               dist2 =  asri(16,cb98) * in4;\r
-               dist2 += ifir16(in10,cb65) + ifir16(in32,cb87);\r
-               \r
-               sign2 = mux(dist2>0,0,1);       \r
-               dist2 = iflip(dist2>0,dist2);\r
-               dist2 =  (E[i] >> 1) + dist2;  \r
-               \r
-               vq_nbest_sign_dist(i,N,dist1,sign1,entries,&used,nbest,best_dist);\r
-               vq_nbest_sign_dist(i+1,N,dist2,sign2,entries,&used,nbest,best_dist);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_VQSIGNNBEST > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-}\r
-\r
-void vq_nbest_sign_8(Int16 *in, const Int16 *codebook, int entries, Int32 *E, int N, int *nbest, Int32 *best_dist)\r
-{\r
-       register int    i, j;\r
-       register int    sign;\r
-       register int    in10, in32, in54, in76;\r
-       int                             used = 0;\r
-\r
-       in10 = ld32(in);\r
-       in32 = ld32x(in,1);\r
-       in54 = ld32x(in,2);\r
-       in76 = ld32x(in,3);\r
-\r
-#if (TM_UNROLL && TM_UNROLL_VQSIGNNBEST > 0)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-\r
-       for ( i=0,j=0 ; i<entries ; ++i,j+=4 )\r
-       {\r
-               register int dist;\r
-               register int cb10, cb32, cb54, cb76;\r
-               \r
-               cb10  =  ld32x(codebook,j);\r
-               cb32  =  ld32x(codebook,j+1);\r
-               cb54  =  ld32x(codebook,j+2);\r
-               cb76  =  ld32x(codebook,j+3);\r
-               \r
-               dist  =  ifir16(in10,cb10) + ifir16(in32,cb32);\r
-               dist  += ifir16(in54,cb54) + ifir16(in76,cb76);\r
-               \r
-               sign = mux(dist>0,0,1); \r
-               dist = iflip(dist>0,dist);\r
-               dist =  (E[i] >> 1) + dist;  \r
-      \r
-               vq_nbest_sign_dist(i,N,dist,sign,entries,&used,nbest,best_dist);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_VQSIGNNBEST > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-}\r
-\r
-void vq_nbest_sign_10(Int16 *in, const Int16 *codebook, int entries, Int32 *E, int N, int *nbest, Int32 *best_dist)\r
-{\r
-       register int    i, j;\r
-       register int    sign;\r
-       register int    in10, in32, in54, in76, in98;\r
-       int                             used = 0;\r
-       \r
-       in10 = ld32(in);\r
-       in32 = ld32x(in,1);\r
-       in54 = ld32x(in,2);\r
-       in76 = ld32x(in,3);\r
-       in98 = ld32x(in,4);\r
-\r
-#if (TM_UNROLL && TM_UNROLL_VQSIGNNBEST > 0)\r
-#pragma TCS_unroll=4\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-       for ( i=0,j=0 ; i<entries ; ++i,j+=5 )\r
-       {\r
-               register int dist;\r
-               register int cb10, cb32, cb54, cb76, cb98;\r
-               \r
-               cb10  =  ld32x(codebook,j);\r
-               cb32  =  ld32x(codebook,j+1);\r
-               cb54  =  ld32x(codebook,j+2);\r
-               cb76  =  ld32x(codebook,j+3);\r
-               cb98  =  ld32x(codebook,j+4);\r
-               \r
-               dist  =  ifir16(in10,cb10) + ifir16(in32,cb32);\r
-               dist  += ifir16(in54,cb54) + ifir16(in76,cb76);\r
-               dist  += ifir16(in98,cb98);\r
-               \r
-               sign = mux(dist>0,0,1); \r
-               dist = iflip(dist>0,dist);\r
-               dist =  (E[i] >> 1) + dist;  \r
-      \r
-               vq_nbest_sign_dist(i,N,dist,sign,entries,&used,nbest,best_dist);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_VQSIGNNBEST > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-}\r
-\r
-void vq_nbest_sign_20(Int16 *in, const Int16 *codebook, int entries, Int32 *E, int N, int *nbest, Int32 *best_dist)\r
-{\r
-       register int    i, j;\r
-       register int    sign;\r
-       register int    in10, in32, in54, in76, in98, in_10, in_32, in_54, in_76, in_98;\r
-       int                             used = 0;\r
-       \r
-       in10  = ld32(in);\r
-       in32  = ld32x(in,1);\r
-       in54  = ld32x(in,2);\r
-       in76  = ld32x(in,3);\r
-       in98  = ld32x(in,4);\r
-       in_10 = ld32x(in,5); \r
-       in_32 = ld32x(in,6); \r
-       in_54 = ld32x(in,7); \r
-       in_76 = ld32x(in,8); \r
-       in_98 = ld32x(in,9); \r
-\r
-#if (TM_UNROLL && TM_UNROLL_VQSIGNNBEST > 0)\r
-#pragma TCS_unroll=2\r
-#pragma TCS_unrollexact=1\r
-#endif\r
-       for ( i=0,j=0 ; i<entries ; ++i,j+=10 )\r
-       {\r
-               register int dist;\r
-               register int cb10, cb32, cb54, cb76, cb98, cb_10, cb_32, cb_54, cb_76, cb_98;\r
-               \r
-               cb10   =  ld32x(codebook,j);\r
-               cb32   =  ld32x(codebook,j+1);\r
-               cb54   =  ld32x(codebook,j+2);\r
-               cb76   =  ld32x(codebook,j+3);\r
-               cb98   =  ld32x(codebook,j+4);\r
-               cb_10  =  ld32x(codebook,j+5);\r
-               cb_32  =  ld32x(codebook,j+6);\r
-               cb_54  =  ld32x(codebook,j+7);\r
-               cb_76  =  ld32x(codebook,j+8);\r
-               cb_98  =  ld32x(codebook,j+9);\r
-\r
-               dist   =  ifir16(in10,cb10) + ifir16(in32,cb32);\r
-               dist   += ifir16(in54,cb54) + ifir16(in76,cb76);\r
-               dist   += ifir16(in98,cb98) + ifir16(in_10,cb_10);\r
-               dist   += ifir16(in_32,cb_32) + ifir16(in_54,cb_54);\r
-               dist   += ifir16(in_76,cb_76) + ifir16(in_98,cb_98);\r
-                               \r
-               sign = mux(dist>0,0,1); \r
-               dist = iflip(dist>0,dist);\r
-               dist =  (E[i] >> 1) + dist;  \r
-      \r
-               vq_nbest_sign_dist(i,N,dist,sign,entries,&used,nbest,best_dist);\r
-       }\r
-#if (TM_UNROLL && TM_UNROLL_VQSIGNNBEST > 0)\r
-#pragma TCS_unrollexact=0\r
-#pragma TCS_unroll=0\r
-#endif\r
-}\r
-\r
-#define OVERRIDE_VQ_NBEST_SIGN\r
-void vq_nbest_sign (Int16 *in, const Int16 *codebook, int len, int entries, Int32 *E, int N, int *nbest, Int32 *best_dist, char *stack)\r
-{\r
-       TMDEBUG_ALIGNMEM(in);\r
-       TMDEBUG_ALIGNMEM(codebook);\r
-\r
-       VQNBESTSIGN_START();\r
-\r
-       if( len==5 )\r
-               vq_nbest_sign_5(in,codebook,entries,E,N,nbest,best_dist);\r
-       else if ( len==8 )\r
-               vq_nbest_sign_8(in,codebook,entries,E,N,nbest,best_dist);\r
-       else if ( len==10 )\r
-               vq_nbest_sign_10(in,codebook,entries,E,N,nbest,best_dist);\r
-       else if ( len==20 )\r
-               vq_nbest_sign_20(in,codebook,entries,E,N,nbest,best_dist);\r
-\r
-#ifndef REMARK_ON\r
-       (void)stack;\r
-#endif\r
-\r
-       VQNBESTSIGN_STOP();\r
-}\r
-\r
-#endif\r
-\r