mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-15 13:58:32 +00:00
update speex to 1.2rc1
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11979 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
d885488f15
commit
4ee40ddc34
181 files changed
+24290
-5292
No files matched your search
@@ -5,5 +5,5 @@
|
||||
|
||||
SUBDIRS = speex_C54_test speex_C55_test speex_C64_test
|
||||
|
||||
EXTRA_DIST = config.h testenc-TI-C5x.c user_misc.h testenc-TI-C64x.c
|
||||
EXTRA_DIST = config.h testenc-TI-C5x.c os_support_custom.h testenc-TI-C64x.c
|
||||
|
||||
+11
-7
@@ -35,35 +35,39 @@
|
||||
#define FRAME_SIZE 160
|
||||
#define DISABLE_WIDEBAND
|
||||
|
||||
/* Disable DC block if doing SNR testing */
|
||||
#define DISABLE_HIGHPASS
|
||||
|
||||
/* 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
|
||||
#define VERBOSE_ALLOC
|
||||
|
||||
/* 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
|
||||
#define OS_SUPPORT_CUSTOM
|
||||
|
||||
/* OR Use CALLOC (heap size must be increased in linker command file) */
|
||||
//#undef MANUAL_ALLOC
|
||||
//#undef USER_MISC
|
||||
//#undef OS_SUPPORT_CUSTOM
|
||||
|
||||
#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_PERSIST_STACK_SIZE 1000
|
||||
#define SPEEXENC_SCRATCH_STACK_SIZE 3000
|
||||
#define SPEEXDEC_PERSIST_STACK_SIZE 2500
|
||||
#define SPEEXDEC_PERSIST_STACK_SIZE 1000
|
||||
#define SPEEXDEC_SCRATCH_STACK_SIZE 1000
|
||||
#else /* C6X */
|
||||
#define NO_LONGLONG
|
||||
|
||||
#define SPEEXENC_PERSIST_STACK_SIZE 10000
|
||||
#define SPEEXENC_PERSIST_STACK_SIZE 2000
|
||||
#define SPEEXENC_SCRATCH_STACK_SIZE 6000
|
||||
#define SPEEXDEC_PERSIST_STACK_SIZE 5000
|
||||
#define SPEEXDEC_PERSIST_STACK_SIZE 2000
|
||||
#define SPEEXDEC_SCRATCH_STACK_SIZE 2000
|
||||
#endif
|
||||
#define SPEEX_PERSIST_STACK_SIZE (SPEEXENC_PERSIST_STACK_SIZE + SPEEXDEC_PERSIST_STACK_SIZE)
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
/* Copyright (C) 2007 Psi Systems, Inc.
|
||||
Author: Jean-Marc Valin
|
||||
File: os_support_custom.h
|
||||
Memory Allocation overrides to allow user control rather than C alloc/free.
|
||||
|
||||
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 MANUAL_ALLOC
|
||||
|
||||
/* To avoid changing the Speex call model, this file relies on four static variables
|
||||
The user main creates two linear buffers, and initializes spxGlobalHeap/ScratchPtr
|
||||
to point to the start of the two buffers, and initializes spxGlobalHeap/ScratchEnd
|
||||
to point to the first address following the last byte of the two buffers.
|
||||
|
||||
This mechanism allows, for example, data caching for multichannel applications,
|
||||
where the Speex state is swapped from a large slow memory to a small fast memory
|
||||
each time the codec runs.
|
||||
|
||||
Persistent data is allocated in spxGlobalHeap (instead of calloc), while scratch
|
||||
data is allocated in spxGlobalScratch.
|
||||
*/
|
||||
|
||||
extern char *spxGlobalHeapPtr, *spxGlobalHeapEnd;
|
||||
extern char *spxGlobalScratchPtr, *spxGlobalScratchEnd;
|
||||
|
||||
/* Make sure that all structures are aligned to largest type */
|
||||
#define BLOCK_MASK (sizeof(long double)-1)
|
||||
extern inline void speex_warning(const char *str);
|
||||
|
||||
#define OVERRIDE_SPEEX_ALLOC
|
||||
static inline void *speex_alloc (int size)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = (void *) (((int)spxGlobalHeapPtr + BLOCK_MASK) & ~BLOCK_MASK); //Start on 8 boundary
|
||||
|
||||
spxGlobalHeapPtr = (char *)((int)ptr + size); // Update pointer to next free location
|
||||
|
||||
if (spxGlobalHeapPtr > spxGlobalHeapEnd )
|
||||
{
|
||||
#ifdef VERBOSE_ALLOC
|
||||
fprintf (stderr, "insufficient space for persistent alloc request %d bytes\n", size);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE_ALLOC
|
||||
fprintf (stderr, "Persist Allocated %d chars at %x, %d remaining\n", size, ptr, ((int)spxGlobalHeapEnd - (int)spxGlobalHeapPtr));
|
||||
#endif
|
||||
memset(ptr, 0, size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#define OVERRIDE_SPEEX_ALLOC_SCRATCH
|
||||
static inline void *speex_alloc_scratch (int size)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = (void *) (((int)spxGlobalScratchPtr + BLOCK_MASK) & ~BLOCK_MASK); //Start on 8 boundary
|
||||
|
||||
spxGlobalScratchPtr = (char *)((int)ptr + size); // Update pointer to next free location
|
||||
|
||||
if (spxGlobalScratchPtr > spxGlobalScratchEnd )
|
||||
{
|
||||
#ifdef VERBOSE_ALLOC
|
||||
fprintf (stderr, "insufficient space for scratch alloc request %d bytes\n", size);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE_ALLOC
|
||||
fprintf (stderr, "Scratch Allocated %d chars at %x, %d remaining\n", size, ptr, ((int)spxGlobalScratchEnd - (int)spxGlobalScratchPtr));
|
||||
#endif
|
||||
memset(ptr, 0, size);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#define OVERRIDE_SPEEX_REALLOC
|
||||
static inline void *speex_realloc (void *ptr, int size)
|
||||
{
|
||||
#ifdef VERBOSE_ALLOC
|
||||
speex_warning("realloc attempted, not allowed");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define OVERRIDE_SPEEX_FREE
|
||||
static inline void speex_free (void *ptr)
|
||||
{
|
||||
#ifdef VERBOSE_ALLOC
|
||||
speex_warning("at speex_free");
|
||||
#endif
|
||||
}
|
||||
#define OVERRIDE_SPEEX_FREE_SCRATCH
|
||||
static inline void speex_free_scratch (void *ptr)
|
||||
{
|
||||
#ifdef VERBOSE_ALLOC
|
||||
speex_warning("at speex_free_scratch");
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* !MANUAL_ALLOC */
|
||||
@@ -1,7 +1,7 @@
|
||||
; Code Composer Project File, Version 2.0 (do not modify or remove this line)
|
||||
|
||||
[Project Settings]
|
||||
ProjectDir="C:\speex_11234\ti\speex_C54_test\"
|
||||
ProjectDir="C:\Speex\speex_14274\ti\speex_C54_test\"
|
||||
ProjectType=Executable
|
||||
CPUFamily=TMS320C54XX
|
||||
Tool="Compiler"
|
||||
@@ -27,8 +27,6 @@ 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"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
; Code Composer Project File, Version 2.0 (do not modify or remove this line)
|
||||
|
||||
[Project Settings]
|
||||
ProjectDir="C:\speex_11234\ti\speex_C55_test\"
|
||||
ProjectDir="C:\Speex\speex_14274\ti\speex_C55_test\"
|
||||
ProjectType=Executable
|
||||
CPUFamily=TMS320C55XX
|
||||
Tool="Compiler"
|
||||
@@ -27,8 +27,6 @@ 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"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
; Code Composer Project File, Version 2.0 (do not modify or remove this line)
|
||||
|
||||
[Project Settings]
|
||||
ProjectDir="C:\speex_11234\ti\speex_C64_test\"
|
||||
ProjectDir="C:\Speex\speex_14274\ti\speex_C64_test\"
|
||||
ProjectType=Executable
|
||||
CPUFamily=TMS320C64XX
|
||||
Tool="Compiler"
|
||||
@@ -12,7 +12,7 @@ Config="Debug"
|
||||
Config="Release"
|
||||
|
||||
[Source Files]
|
||||
Source="..\..\..\CCStudio_v3.1\C6000\cgtools\lib\rts6400.lib"
|
||||
Source="..\..\..\..\CCStudio_v3.1\C6000\cgtools\lib\rts6400.lib"
|
||||
Source="..\..\libspeex\bits.c"
|
||||
Source="..\..\libspeex\cb_search.c"
|
||||
Source="..\..\libspeex\exc_10_16_table.c"
|
||||
@@ -28,8 +28,6 @@ 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"
|
||||
|
||||
@@ -184,10 +184,17 @@ void main()
|
||||
tmp=1; /* Lowest */
|
||||
speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);
|
||||
|
||||
#ifdef DISABLE_HIGHPASS
|
||||
/* Turn this off if you want to measure SNR (on by default) */
|
||||
tmp=0;
|
||||
speex_encoder_ctl(st, SPEEX_SET_HIGHPASS, &tmp);
|
||||
speex_decoder_ctl(dec, SPEEX_SET_HIGHPASS, &tmp);
|
||||
#endif
|
||||
|
||||
speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay);
|
||||
speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp);
|
||||
skip_group_delay += tmp;
|
||||
fprintf (stderr, "decoder lookahead = %d\n", skip_group_delay);
|
||||
fprintf (stderr, "decoder lookahead = %ld\n", skip_group_delay);
|
||||
|
||||
#ifdef DECODE_ONLY
|
||||
bitsFile = "c:\\speextrunktest\\samples\\malebitsin.dat";
|
||||
|
||||
@@ -146,6 +146,13 @@ void main()
|
||||
tmp=1; /* Lowest */
|
||||
speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp);
|
||||
|
||||
#ifdef DISABLE_HIGHPASS
|
||||
/* Turn this off if you want to measure SNR (on by default) */
|
||||
tmp=0;
|
||||
speex_encoder_ctl(st, SPEEX_SET_HIGHPASS, &tmp);
|
||||
speex_decoder_ctl(dec, SPEEX_SET_HIGHPASS, &tmp);
|
||||
#endif
|
||||
|
||||
speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay);
|
||||
speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp);
|
||||
skip_group_delay += tmp;
|
||||
|
||||
Reference in new issue
Block a user