Commit bf9fe01b authored by jm's avatar jm
Browse files

TI DSP (C5x and C6x) patch by Jim Crichton


git-svn-id: http://svn.xiph.org/trunk/speex@10312 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 8fabdc9d
These are all of the changes and additions necessary to build a loopback application for the
TI C6415, C5509A, or C5416 simulators using the TI Code Composer Studio (CCS) development system.
A trial version of the tools can be downloaded from the TI website.
This build runs 8kbps narrowband, with minimum complexity.
Several changes are introduced in Speex 1.1.11 which are used in these applications:
arch.h: Added switch for compilers not supporting "long long" (C55x does, C54x, CCS 2.x C64x does not)
bits.c: Allow external definition for max buffer size, changed MAX_BYTES_PER_FRAME
to MAX_CHARS_PER_FRAME for consistency
misc.c: Added override switches to alloc routines, conditional include of user file "user_misc.h".
These changes allow manual memory allocation rather than using heap
The arch.h change allows operation with 2.x versions of Code Composer Studio.
The bits.c change reduces the data memory usage.
The misc.c change allows private memory allocation, for cases where it is not
desirable to use the normal heap.
Added files:
testenc-TI-C5x.c (For C54x and C55x builds, derived from testenc.c,
manual alloc, byte packing/unpacking added)
testenc-TI-C64x.c (For C64x builds, derived from testenc.c, manual alloc, byte packing/unpacking added)
config.h (not automatically generated, sets memory sizes, enables/disables manual alloc)
user_misc.h (contains the manual memory alloc routines, with debug code to display mem usage)
speex\speex_config_types.h (match Speex types to compiler types, not generated from types.in)
speex_c54_test\speex_c54_test.cmd (C5416 linker command file)
speex_c54_test\speex_c54_test.pjt (Code Composer Studio Project File )
speex_c55_test\speex_c55_test.cmd (C5509A linker command file)
speex_c55_test\speex_c55_test.pjt (Code Composer Studio Project File )
speex_c64_test\speex_c64_test.cmd (C6415 linker command file)
speex_c64_test\speex_c64_test.pjt (Code Composer Studio Project File )
samples\male.snd
Usage:
1. Create a Speex 1.1.11 (or later) source tree.
2. Edit the files testenc-TI-C5x.c and/or testenc-TI-C64x.c to change the hard-coded path
for the test audio and data files.
This build uses the file e:\speextrunktest\samples\male.snd.
Note: This is a headerless 16-bit stereo audio file derived from the male.wav test file
http://www.speex.org/samples/male.wav
3. Edit the .pjt file with a text editor and change projdir or projectdir to the correct path
(one place near the top of the file).
4. Edit config.h if desired, to change the memory allocation method (calloc or manual),
and to enable/disable debug prints for the memory allocation
(this makes it easier to determine the required size).
5. Run Code Composer Studio, and open the project for the desired target (e.g. speex_c55_test).
Note that the correct simulator must be selected (in CCS Setup) before starting CCS.
6. Build and run the simulation.
Note that assembly optimizations will be required to run C54x in real time.
There are no assembly optimizations in any of these builds.
/* Copyright (C) 2005 Psi Systems, Inc.
File: config.h
Main Speex option include file for TI C64xx, C54xx and C55xx processors
for use with TI Code Composer (TM) DSP development tools.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define FIXED_POINT
#define FRAME_SIZE 160
#define DISABLE_WIDEBAND
/* Allow for 2 20ms narrowband blocks per frame, plus a couple of bytes */
#define MAX_CHARS_PER_FRAME (42/BYTES_PER_CHAR)
/* for debug */
#undef DECODE_ONLY
/* EITHER Allocate from fixed array (C heap not used) */
/* Enable VERBOSE_ALLOC to see how much is used */
#define MANUAL_ALLOC
#define USER_MISC
#define VERBOSE_ALLOC
/* OR Use CALLOC (heap size must be increased in linker command file) */
//#undef MANUAL_ALLOC
//#undef USER_MISC
#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
//#define PRECISION16
// These values determined by analysis for 8kbps narrowband
#define SPEEXENC_PERSIST_STACK_SIZE 5000
#define SPEEXENC_SCRATCH_STACK_SIZE 3000
#define SPEEXDEC_PERSIST_STACK_SIZE 2500
#define SPEEXDEC_SCRATCH_STACK_SIZE 1000
#else /* C6X */
#define NO_LONGLONG
#define SPEEXENC_PERSIST_STACK_SIZE 10000
#define SPEEXENC_SCRATCH_STACK_SIZE 6000
#define SPEEXDEC_PERSIST_STACK_SIZE 5000
#define SPEEXDEC_SCRATCH_STACK_SIZE 2000
#endif
#define SPEEX_PERSIST_STACK_SIZE (SPEEXENC_PERSIST_STACK_SIZE + SPEEXDEC_PERSIST_STACK_SIZE)
#define SPEEX_SCRATCH_STACK_SIZE SPEEXENC_SCRATCH_STACK_SIZE
#define NB_ENC_STACK SPEEXENC_SCRATCH_STACK_SIZE
#define NB_DEC_STACK SPEEXDEC_SCRATCH_STACK_SIZE
/* Copyright (C) 2005 Psi Systems, Inc.
File: speex_C54_test.cmd
Linker command file with memory allocation for TI TMS320VC5416 processor
for use with TI Code Composer (TM) DSP development tools.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-c
-stack 0x2000
-heap 0x1000 /* If private memory allocation is used for Speex */
/*-heap 0x6000 /* If calloc is used for Speex */
-lrts_ext.lib
MEMORY
{
/* PAGE 0: P_DARAM03: origin = 0x80, len = 0x7f00*/
PAGE 0: P_DARAM03: origin = 0x5000, len = 0x2f80
PAGE 0: VECT: origin = 0x7f80, len = 0x80
PAGE 0: P_DARAM47: origin = 0x18000, len = 0x8000
PAGE 0: SARAM03: origin = 0x28000, len = 0x8000
PAGE 0: SARAM47: origin = 0x38000, len = 0x8000
PAGE 1: USERREGS: origin = 0x60, len = 0x1a
PAGE 1: BIOSREGS: origin = 0x7c, len = 0x4
PAGE 1: CSLREGS: origin = 0x7a, len = 0x2
D_DARAM03: origin = 0x80, len = 0x4f80
D_DARAM47: origin = 0x8000, len = 0x8000
}
SECTIONS
{
.vectors: {} > VECT PAGE 0
.bootmem: {rts_ext.lib (.text)} > P_DARAM03 PAGE 0
/* .bootmem: {} > P_DARAM03 PAGE 0 */
.text: {} > SARAM03 PAGE 0
.cinit: {} > SARAM03 PAGE 0
.switch: {} > SARAM03 PAGE 0
.bss: {} > D_DARAM03 | D_DARAM47 PAGE 1
.far: {} > D_DARAM03 | D_DARAM47 PAGE 1
.const: {} > D_DARAM03 | D_DARAM47 PAGE 1
.sysmem: {} > D_DARAM47 PAGE 1
.cio: {} > D_DARAM03 | D_DARAM47 PAGE 1
.stack: {} > D_DARAM03 | D_DARAM47 PAGE 1
.myheap: {} > D_DARAM47 PAGE 1
}
; Code Composer Project File, Version 2.0 (do not modify or remove this line)
[Project Settings]
ProjectDir="C:\speextrunktest\ti\speex_C54_test\"
ProjectType=Executable
CPUFamily=TMS320C54XX
Tool="Compiler"
Tool="DspBiosBuilder"
Tool="Linker"
Config="Debug"
Config="Release"
[Source Files]
Source="..\..\libspeex\bits.c"
Source="..\..\libspeex\cb_search.c"
Source="..\..\libspeex\exc_10_16_table.c"
Source="..\..\libspeex\exc_10_32_table.c"
Source="..\..\libspeex\exc_20_32_table.c"
Source="..\..\libspeex\exc_5_256_table.c"
Source="..\..\libspeex\exc_5_64_table.c"
Source="..\..\libspeex\exc_8_128_table.c"
Source="..\..\libspeex\filters.c"
Source="..\..\libspeex\gain_table.c"
Source="..\..\libspeex\gain_table_lbr.c"
Source="..\..\libspeex\lpc.c"
Source="..\..\libspeex\lsp.c"
Source="..\..\libspeex\lsp_tables_nb.c"
Source="..\..\libspeex\ltp.c"
Source="..\..\libspeex\math_approx.c"
Source="..\..\libspeex\misc.c"
Source="..\..\libspeex\modes.c"
Source="..\..\libspeex\nb_celp.c"
Source="..\..\libspeex\quant_lsp.c"
Source="..\..\libspeex\sb_celp.c"
Source="..\..\libspeex\speex.c"
Source="..\..\libspeex\speex_callbacks.c"
Source="..\..\libspeex\vbr.c"
Source="..\..\libspeex\vq.c"
Source="..\..\ti\testenc-TI-C5x.c"
Source="speex_C54_test.cmd"
["Compiler" Settings: "Debug"]
Options=-g -q -o3 -fr"..\ti\speex_C54_test\Debug" -i"..\ti" -i"..\include" -d"_DEBUG" -d"CONFIG_TI_C55X" -d"CONFIG_TI_C54X" -d"HAVE_CONFIG_H" -d"NO_LONGLONG" -mf -ms
["Compiler" Settings: "Release"]
Options=-q -o2 -fr"..\ti\speex_C54_test\Release" -i"..\ti" -i"..\include" -d"CONFIG_TI_C55X" -d"HAVE_CONFIG_H" -d"NO_LONGLONG" -mf -ms
["DspBiosBuilder" Settings: "Debug"]
Options=-v54
["DspBiosBuilder" Settings: "Release"]
Options=-v54
["Linker" Settings: "Debug"]
Options=-q -c -heap4096 -m".\Debug\speex_C54_test.map" -o".\Debug\speex_C54_test.out" -stack4096 -w -x
["Linker" Settings: "Release"]
Options=-q -c -m".\Release\speex_C54_test.map" -o".\Release\speex_C54_test.out" -w -x
/* Copyright (C) 2005 Psi Systems, Inc.
File: speex_C55_test.cmd
Linker command file with memory allocation for TI TMS320VC5509A processor
for use with TI Code Composer (TM) DSP development tools.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-c
-stack 0x1c00
-heap 0x1000 /* If private memory allocation is used for Speex */
/*-heap 0x6000 / * If calloc is used for Speex */
-sysstack 0x200
-lrts55.lib
MEMORY
{
DARAM: origin = 0x200, len = 0x7e00
DARAM_B: origin = 0x8000, len = 0x8000
VECT: origin = 0x100, len = 0x100
SARAM_A: origin = 0x10000, len = 0x10000
SARAM_B: origin = 0x20000, len = 0x20000
}
SECTIONS
{
.vectors: {} > VECT
.bootmem: {} > DARAM
.text: {} > SARAM_B
.cinit: {} > SARAM_B
.switch: {} > SARAM_B
.bss: {} > DARAM
/* .far: {} > DARAM*/
.const: {} > DARAM
.sysmem: {} > DARAM_B
.cio: {} > DARAM
.stack: {} > DARAM
.sysstack: {} > DARAM
.myheap: {} > SARAM_A
}
; Code Composer Project File, Version 2.0 (do not modify or remove this line)
[Project Settings]
ProjectDir="C:\speextrunktest\ti\speex_C55_test\"
ProjectType=Executable
CPUFamily=TMS320C55XX
Tool="Compiler"
Tool="DspBiosBuilder"
Tool="Linker"
Config="Debug"
Config="Release"
[Source Files]
Source="..\..\libspeex\bits.c"
Source="..\..\libspeex\cb_search.c"
Source="..\..\libspeex\exc_10_16_table.c"
Source="..\..\libspeex\exc_10_32_table.c"
Source="..\..\libspeex\exc_20_32_table.c"
Source="..\..\libspeex\exc_5_256_table.c"
Source="..\..\libspeex\exc_5_64_table.c"
Source="..\..\libspeex\exc_8_128_table.c"
Source="..\..\libspeex\filters.c"
Source="..\..\libspeex\gain_table.c"
Source="..\..\libspeex\gain_table_lbr.c"
Source="..\..\libspeex\lpc.c"
Source="..\..\libspeex\lsp.c"
Source="..\..\libspeex\lsp_tables_nb.c"
Source="..\..\libspeex\ltp.c"
Source="..\..\libspeex\math_approx.c"
Source="..\..\libspeex\misc.c"
Source="..\..\libspeex\modes.c"
Source="..\..\libspeex\nb_celp.c"
Source="..\..\libspeex\quant_lsp.c"
Source="..\..\libspeex\sb_celp.c"
Source="..\..\libspeex\speex.c"
Source="..\..\libspeex\speex_callbacks.c"
Source="..\..\libspeex\vbr.c"
Source="..\..\libspeex\vq.c"
Source="..\..\ti\testenc-TI-C5x.c"
Source="speex_C55_test.cmd"
["Compiler" Settings: "Debug"]
Options=-g -q -o3 -fr"..\ti\speex_C55_test\Debug" -i"..\ti" -i"..\include" -d"_DEBUG" -d"CONFIG_TI_C55X" -d"HAVE_CONFIG_H" -mn
["Compiler" Settings: "Release"]
Options=-q -o2 -fr"..\ti\speex_C55_test\Release" -i"..\ti" -i"..\include" -d"CONFIG_TI_C55X" -d"HAVE_CONFIG_H" -mn
["DspBiosBuilder" Settings: "Debug"]
Options=-v55
["DspBiosBuilder" Settings: "Release"]
Options=-v55
["Linker" Settings: "Debug"]
Options=-q -c -m".\Debug\speex_C55_test.map" -o".\Debug\speex_C55_test.out" -w -x
["Linker" Settings: "Release"]
Options=-q -c -m".\Release\speex_C55_test.map" -o".\Release\speex_C55_test.out" -w -x
/* Copyright (C) 2005 Psi Systems, Inc.
File: speex_C64_test.cmd
Linker command file with memory allocation for TI TMS320C6415 processor
for use with TI Code Composer (TM) DSP development tools.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-stack 0x10000
-heap 0x10000
MEMORY
{
VECRAM : origin = 0x0, len = 0x200
IPRAM : origin = 0x200, len = 0x40000
IDRAM : origin = 0x80000, len = 0x70000
}
SECTIONS
{
.vectors > VECRAM
.text > IPRAM
.bss > IDRAM
.cinit > IDRAM
.const > IDRAM
.far > IDRAM
.stack > IDRAM
.cio > IDRAM
.sysmem > IDRAM
.switch > IDRAM
.myheap > IDRAM
}
; Code Composer Project File, Version 2.0 (do not modify or remove this line)
[Project Settings]
ProjectDir="E:\speextrunktest\ti\speex_C64_test\"
ProjectType=Executable
CPUFamily=TMS320C64XX
Tool="Compiler"
Tool="DspBiosBuilder"
Tool="Linker"
Config="Debug"
Config="Release"
[Source Files]
Source="..\..\libspeex\bits.c"
Source="..\..\libspeex\cb_search.c"
Source="..\..\libspeex\exc_10_16_table.c"
Source="..\..\libspeex\exc_10_32_table.c"
Source="..\..\libspeex\exc_20_32_table.c"
Source="..\..\libspeex\exc_5_256_table.c"
Source="..\..\libspeex\exc_5_64_table.c"
Source="..\..\libspeex\exc_8_128_table.c"
Source="..\..\libspeex\filters.c"
Source="..\..\libspeex\gain_table.c"
Source="..\..\libspeex\gain_table_lbr.c"
Source="..\..\libspeex\lpc.c"
Source="..\..\libspeex\lsp.c"
Source="..\..\libspeex\lsp_tables_nb.c"
Source="..\..\libspeex\ltp.c"
Source="..\..\libspeex\math_approx.c"
Source="..\..\libspeex\misc.c"
Source="..\..\libspeex\modes.c"
Source="..\..\libspeex\nb_celp.c"
Source="..\..\libspeex\quant_lsp.c"
Source="..\..\libspeex\sb_celp.c"
Source="..\..\libspeex\speex.c"
Source="..\..\libspeex\speex_callbacks.c"
Source="..\..\libspeex\vbr.c"
Source="..\..\libspeex\vq.c"
Source="..\testenc-TI-C64x.c"
Source="C:\ti\c6000\cgtools\lib\rts6400.lib"
Source="speex_C64_test.cmd"
["Compiler" Settings: "Debug"]
Options=-g -o3 -fr"$(Proj_dir)\Debug" -i"..\ti" -i"..\include" -d"_DEBUG" -d"HAVE_CONFIG_H" -mv6400
["Compiler" Settings: "Release"]
Options=-o3 -fr"$(Proj_dir)\Release" -i"..\ti" -i"..\include" -i"..\" -i"..\..\include" -d"HAVE_CONFIG_H" -mv6400
["DspBiosBuilder" Settings: "Debug"]
Options=-v6x
["DspBiosBuilder" Settings: "Release"]
Options=-v6x
["Linker" Settings: "Debug"]
Options=-c -m".\Debug\speex_C64_test.map" -o".\Debug\speex_C64_test.out" -w -x
["Linker" Settings: "Release"]
Options=-c -m".\Release\speex_C64_test.map" -o".\Release\speex_C64_test.out" -w -x
/* Copyright (C) 2005 Psi Systems, Inc.
File: testenc-TI-C5x.c
Encoder/Decoder Loop Main file for TI C54xx and C55xx processors
for use with TI Code Composer (TM) DSP development tools.
Modified from speexlib/testenc.c
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* Modified from speexlib/testenc.c for Code Composer simulator */
#include <speex/speex.h>
#include <stdio.h>
#include <stdlib.h>
#include <speex/speex_callbacks.h>
#include <..\libspeex\arch.h>
#undef DECODE_ONLY
#ifdef FIXED_DEBUG
extern long long spx_mips;
#endif
#include <math.h>
#ifdef MANUAL_ALLOC
#pragma DATA_SECTION(spxHeap, ".myheap");
static char spxHeap[SPEEX_PERSIST_STACK_SIZE];
#pragma DATA_SECTION(spxScratch, ".myheap");
static char spxScratch[SPEEX_SCRATCH_STACK_SIZE];
char *spxGlobalHeapPtr, *spxGlobalHeapEnd;
char *spxGlobalScratchPtr, *spxGlobalScratchEnd;
#endif
void byte2word(short* pInBuf, short* pOutBuf, int nWords)
{
short *pIn, *pOut, sNext;
int i;
pIn = pInBuf;
pOut = pOutBuf;
for(i=0;i<nWords;i++)
{
sNext = *pIn++; // Get low byte
*pOut++ = (sNext & 0x00ff) | (*pIn++ << 8); // insert high byte
}
}
void word2byte(short* pInBuf, short* pOutBuf, int nWords)
{
short *pIn, *pOut;
int i;
pIn = pInBuf;
pOut = pOutBuf;
for(i=0;i<nWords;i++)
{
*pOut++ = *pIn & 0x00ff; // Get low byte
*pOut++ = (short) ((unsigned short) *pIn++ >> 8);
}
}
void main()
{
char *outFile, *bitsFile;
FILE *fout, *fbits=NULL;
#ifndef DECODE_ONLY
char *inFile;
FILE *fin;
#endif
short out_short[FRAME_SIZE];
short inout_byte[2*FRAME_SIZE];
#ifndef DECODE_ONLY
short in_short[FRAME_SIZE];
float sigpow,errpow,snr, seg_snr=0;
int snr_frames = 0;
int nbChars;
int i;