forked from len0rd/rockbox
Sync with Speex SVN. Syntactic change in filters_cf.S.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15310 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
14da611cd3
commit
fa971b142d
28 changed files with 375 additions and 484 deletions
|
@ -1,4 +1,4 @@
|
||||||
Library: libspeex-1.2beta2 (SVN version 14014)
|
Library: libspeex-1.2beta3 (SVN version 14054)
|
||||||
Imported: 2007-03-12 by Dan Everton
|
Imported: 2007-03-12 by Dan Everton
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,9 @@ lpc.c
|
||||||
lsp.c
|
lsp.c
|
||||||
lsp_tables_nb.c
|
lsp_tables_nb.c
|
||||||
ltp.c
|
ltp.c
|
||||||
math_approx.c
|
|
||||||
mdf.c
|
mdf.c
|
||||||
medfilter.c
|
|
||||||
misc.c
|
|
||||||
modes.c
|
modes.c
|
||||||
|
modes_wb.c
|
||||||
nb_celp.c
|
nb_celp.c
|
||||||
oggframing.c
|
oggframing.c
|
||||||
preprocess.c
|
preprocess.c
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#include <speex/speex_bits.h>
|
#include <speex/speex_bits.h>
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
/* Maximum size of the bit-stream (for fixed-size allocation) */
|
/* Maximum size of the bit-stream (for fixed-size allocation) */
|
||||||
#ifndef MAX_CHARS_PER_FRAME
|
#ifndef MAX_CHARS_PER_FRAME
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
#include "stack_alloc.h"
|
#include "stack_alloc.h"
|
||||||
#include "vq.h"
|
#include "vq.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "math_approx.h"
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
#ifdef _USE_SSE
|
#ifdef _USE_SSE
|
||||||
#include "cb_search_sse.h"
|
#include "cb_search_sse.h"
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
#define MAX_FFT_SIZE 2048
|
#define MAX_FFT_SIZE 2048
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "math_approx.h"
|
#include "math_approx.h"
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
|
|
||||||
|
|
|
@ -245,25 +245,25 @@ qmf_synth:
|
||||||
1: | Innerloop
|
1: | Innerloop
|
||||||
move.w (%a0)+, %d3 | d3 = x11
|
move.w (%a0)+, %d3 | d3 = x11
|
||||||
move.w (%a1)+, %d5 | d5 = x21
|
move.w (%a1)+, %d5 | d5 = x21
|
||||||
mac.w %d6u, %d3l, #1, %acc0 | acc0 += a0*x11
|
mac.w %d6u, %d3l, <<, %acc0 | acc0 += a0*x11
|
||||||
msac.w %d6u, %d5l, #1, %acc0 | acc0 -= a0*x21
|
msac.w %d6u, %d5l, <<, %acc0 | acc0 -= a0*x21
|
||||||
mac.w %d6l, %d3l, #1, %acc1 | acc1 += a1*x11
|
mac.w %d6l, %d3l, <<, %acc1 | acc1 += a1*x11
|
||||||
mac.w %d6l, %d5l, #1, %acc1 | acc1 += a1*x21
|
mac.w %d6l, %d5l, <<, %acc1 | acc1 += a1*x21
|
||||||
mac.w %d6u, %d2l, #1, %acc2 | acc2 += a0*x10
|
mac.w %d6u, %d2l, <<, %acc2 | acc2 += a0*x10
|
||||||
msac.w %d6u, %d4l, #1, %acc2 | acc2 -= a0*x20
|
msac.w %d6u, %d4l, <<, %acc2 | acc2 -= a0*x20
|
||||||
mac.w %d6l, %d2l, #1, %acc3 | acc3 += a1*x10
|
mac.w %d6l, %d2l, <<, %acc3 | acc3 += a1*x10
|
||||||
mac.w %d6l, %d4l, #1, (%a2)+, %d6, %acc3 | acc3 += a1*x20
|
mac.w %d6l, %d4l, <<, (%a2)+, %d6, %acc3 | acc3 += a1*x20
|
||||||
|
|
||||||
move.w (%a0)+, %d2 | d2 = x10
|
move.w (%a0)+, %d2 | d2 = x10
|
||||||
move.w (%a1)+, %d4 | d4 = x20
|
move.w (%a1)+, %d4 | d4 = x20
|
||||||
mac.w %d6u, %d2l, #1, %acc0 | acc0 += a0*x10
|
mac.w %d6u, %d2l, <<, %acc0 | acc0 += a0*x10
|
||||||
msac.w %d6u, %d4l, #1, %acc0 | acc0 -= a0*x20
|
msac.w %d6u, %d4l, <<, %acc0 | acc0 -= a0*x20
|
||||||
mac.w %d6l, %d2l, #1, %acc1 | acc1 += a1*x10
|
mac.w %d6l, %d2l, <<, %acc1 | acc1 += a1*x10
|
||||||
mac.w %d6l, %d4l, #1, %acc1 | acc1 += a1*x20
|
mac.w %d6l, %d4l, <<, %acc1 | acc1 += a1*x20
|
||||||
mac.w %d6u, %d3l, #1, %acc2 | acc2 += a0*x11
|
mac.w %d6u, %d3l, <<, %acc2 | acc2 += a0*x11
|
||||||
msac.w %d6u, %d5l, #1, %acc2 | acc2 -= a0*x21
|
msac.w %d6u, %d5l, <<, %acc2 | acc2 -= a0*x21
|
||||||
mac.w %d6l, %d3l, #1, %acc3 | acc3 += a1*x11
|
mac.w %d6l, %d3l, <<, %acc3 | acc3 += a1*x11
|
||||||
mac.w %d6l, %d5l, #1, (%a2)+, %d6, %acc3 | acc3 += a1*x21
|
mac.w %d6l, %d5l, <<, (%a2)+, %d6, %acc3 | acc3 += a1*x21
|
||||||
subq.l #2, %d1
|
subq.l #2, %d1
|
||||||
jne 1b
|
jne 1b
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include <speex/speex.h>
|
#include <speex/speex.h>
|
||||||
#include <speex/speex_bits.h>
|
#include <speex/speex_bits.h>
|
||||||
#include <speex/speex_jitter.h>
|
#include <speex/speex_jitter.h>
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
|
|
|
@ -20,6 +20,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
|
||||||
#include "_kiss_fft_guts.h"
|
#include "_kiss_fft_guts.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
/* The guts header contains all the multiplication and addition macros that are defined for
|
/* The guts header contains all the multiplication and addition macros that are defined for
|
||||||
fixed or floating point complex numbers. It also delares the kf_ internal functions.
|
fixed or floating point complex numbers. It also delares the kf_ internal functions.
|
||||||
|
|
|
@ -16,6 +16,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
#include "config-speex.h"
|
#include "config-speex.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "os_support.h"
|
||||||
#include "kiss_fftr.h"
|
#include "kiss_fftr.h"
|
||||||
#include "_kiss_fft_guts.h"
|
#include "_kiss_fft_guts.h"
|
||||||
|
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
/* Copyright (C) 2002 Jean-Marc Valin
|
|
||||||
File: math_approx.c
|
|
||||||
Various math approximation functions for Speex
|
|
||||||
|
|
||||||
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-speex.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "math_approx.h"
|
|
||||||
#include "misc.h"
|
|
|
@ -45,9 +45,21 @@
|
||||||
#define spx_cos_norm(x) (cos((.5f*M_PI)*(x)))
|
#define spx_cos_norm(x) (cos((.5f*M_PI)*(x)))
|
||||||
#define spx_atan atan
|
#define spx_atan atan
|
||||||
|
|
||||||
#endif
|
/** Generate a pseudo-random number */
|
||||||
|
static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
|
||||||
|
{
|
||||||
|
const unsigned int jflone = 0x3f800000;
|
||||||
|
const unsigned int jflmsk = 0x007fffff;
|
||||||
|
union {int i; float f;} ran;
|
||||||
|
*seed = 1664525 * *seed + 1013904223;
|
||||||
|
ran.i = jflone | (jflmsk & *seed);
|
||||||
|
ran.f -= 1.5;
|
||||||
|
return 3.4642*std*ran.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static inline spx_int16_t spx_ilog2(spx_uint32_t x)
|
static inline spx_int16_t spx_ilog2(spx_uint32_t x)
|
||||||
{
|
{
|
||||||
|
@ -106,6 +118,15 @@ static inline spx_int16_t spx_ilog4(spx_uint32_t x)
|
||||||
|
|
||||||
#ifdef FIXED_POINT
|
#ifdef FIXED_POINT
|
||||||
|
|
||||||
|
/** Generate a pseudo-random number */
|
||||||
|
static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
|
||||||
|
{
|
||||||
|
spx_word32_t res;
|
||||||
|
*seed = 1664525 * *seed + 1013904223;
|
||||||
|
res = MULT16_16(EXTRACT16(SHR32(*seed,16)),std);
|
||||||
|
return EXTRACT16(PSHR32(SUB32(res, SHR32(res, 3)),14));
|
||||||
|
}
|
||||||
|
|
||||||
/* sqrt(x) ~= 0.22178 + 1.29227*x - 0.77070*x^2 + 0.25723*x^3 (for .25 < x < 1) */
|
/* sqrt(x) ~= 0.22178 + 1.29227*x - 0.77070*x^2 + 0.25723*x^3 (for .25 < x < 1) */
|
||||||
/*#define C0 3634
|
/*#define C0 3634
|
||||||
#define C1 21173
|
#define C1 21173
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
#include "fftwrap.h"
|
#include "fftwrap.h"
|
||||||
#include "pseudofloat.h"
|
#include "pseudofloat.h"
|
||||||
#include "math_approx.h"
|
#include "math_approx.h"
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
#define M_PI 3.14159265358979323846
|
#define M_PI 3.14159265358979323846
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
/* Copyright (C) 2002-2005 Jean-Marc Valin
|
|
||||||
File: misc.c
|
|
||||||
Various utility routines for Speex
|
|
||||||
|
|
||||||
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-speex.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "misc.h"
|
|
||||||
|
|
||||||
#ifdef USER_MISC
|
|
||||||
#include "user_misc.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BFIN_ASM
|
|
||||||
#include "misc_bfin.h"
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -40,9 +40,9 @@
|
||||||
#ifndef SPEEX_VERSION
|
#ifndef SPEEX_VERSION
|
||||||
#define SPEEX_MAJOR_VERSION 1 /**< Major Speex version. */
|
#define SPEEX_MAJOR_VERSION 1 /**< Major Speex version. */
|
||||||
#define SPEEX_MINOR_VERSION 1 /**< Minor Speex version. */
|
#define SPEEX_MINOR_VERSION 1 /**< Minor Speex version. */
|
||||||
#define SPEEX_MICRO_VERSION 14 /**< Micro Speex version. */
|
#define SPEEX_MICRO_VERSION 15 /**< Micro Speex version. */
|
||||||
#define SPEEX_EXTRA_VERSION "" /**< Extra Speex version. */
|
#define SPEEX_EXTRA_VERSION "" /**< Extra Speex version. */
|
||||||
#define SPEEX_VERSION "speex-1.2beta2" /**< Speex version string. */
|
#define SPEEX_VERSION "speex-1.2beta3" /**< Speex version string. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* A couple test to catch stupid option combinations */
|
/* A couple test to catch stupid option combinations */
|
||||||
|
@ -71,7 +71,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "arch.h"
|
#include "arch.h"
|
||||||
#include "rockbox.h"
|
|
||||||
|
|
||||||
/** Convert little endian */
|
/** Convert little endian */
|
||||||
static inline spx_int32_t le_int(spx_int32_t i)
|
static inline spx_int32_t le_int(spx_int32_t i)
|
||||||
|
@ -91,138 +90,10 @@ static inline spx_int32_t le_int(spx_int32_t i)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define speex_fatal(str) _speex_fatal(str, __FILE__, __LINE__);
|
|
||||||
#define speex_assert(cond) {if (!(cond)) {speex_fatal("assertion failed: " #cond);}}
|
|
||||||
|
|
||||||
#ifndef RELEASE
|
|
||||||
static void print_vec(float *vec, int len, char *name)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
printf ("%s ", name);
|
|
||||||
for (i=0;i<len;i++)
|
|
||||||
printf (" %f", vec[i]);
|
|
||||||
printf ("\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FIXED_DEBUG
|
#ifdef FIXED_DEBUG
|
||||||
long long spx_mips=0;
|
long long spx_mips=0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free */
|
|
||||||
#ifndef OVERRIDE_SPEEX_ALLOC
|
|
||||||
static inline void *speex_alloc (int size)
|
|
||||||
{
|
|
||||||
return calloc(size,1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Same as speex_alloc, except that the area is only needed inside a Speex call (might cause problem with wideband though) */
|
|
||||||
#ifndef OVERRIDE_SPEEX_ALLOC_SCRATCH
|
|
||||||
static inline void *speex_alloc_scratch (int size)
|
|
||||||
{
|
|
||||||
return calloc(size,1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Speex wrapper for realloc. To do your own dynamic allocation, all you need to do is replace this function, speex_alloc and speex_free */
|
|
||||||
#ifndef OVERRIDE_SPEEX_REALLOC
|
|
||||||
static inline void *speex_realloc (void *ptr, int size)
|
|
||||||
{
|
|
||||||
return realloc(ptr, size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_alloc */
|
|
||||||
#ifndef OVERRIDE_SPEEX_FREE
|
|
||||||
static inline void speex_free (void *ptr)
|
|
||||||
{
|
|
||||||
free(ptr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Same as speex_free, except that the area is only needed inside a Speex call (might cause problem with wideband though) */
|
|
||||||
#ifndef OVERRIDE_SPEEX_FREE_SCRATCH
|
|
||||||
static inline void speex_free_scratch (void *ptr)
|
|
||||||
{
|
|
||||||
free(ptr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Print warning message with integer argument to stderr */
|
|
||||||
#ifndef OVERRIDE_SPEEX_MOVE
|
|
||||||
static inline void *speex_move (void *dest, void *src, int n)
|
|
||||||
{
|
|
||||||
return memmove(dest,src,n);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef OVERRIDE_SPEEX_FATAL
|
|
||||||
static inline void _speex_fatal(const char *str, const char *file, int line)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef OVERRIDE_SPEEX_WARNING
|
|
||||||
static inline void speex_warning(const char *str)
|
|
||||||
{
|
|
||||||
#ifndef DISABLE_WARNINGS
|
|
||||||
fprintf (stderr, "warning: %s\n", str);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef OVERRIDE_SPEEX_WARNING_INT
|
|
||||||
static inline void speex_warning_int(const char *str, int val)
|
|
||||||
{
|
|
||||||
#ifndef DISABLE_WARNINGS
|
|
||||||
fprintf (stderr, "warning: %s %d\n", str, val);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef OVERRIDE_SPEEX_NOTIFY
|
|
||||||
static inline void speex_notify(const char *str)
|
|
||||||
{
|
|
||||||
#ifndef DISABLE_NOTIFICATIONS
|
|
||||||
fprintf (stderr, "notification: %s\n", str);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef FIXED_POINT
|
|
||||||
/** Generate a pseudo-random number */
|
|
||||||
static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
|
|
||||||
{
|
|
||||||
spx_word32_t res;
|
|
||||||
*seed = 1664525 * *seed + 1013904223;
|
|
||||||
res = MULT16_16(EXTRACT16(SHR32(*seed,16)),std);
|
|
||||||
return EXTRACT16(PSHR32(SUB32(res, SHR32(res, 3)),14));
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
/** Generate a pseudo-random number */
|
|
||||||
static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed)
|
|
||||||
{
|
|
||||||
const unsigned int jflone = 0x3f800000;
|
|
||||||
const unsigned int jflmsk = 0x007fffff;
|
|
||||||
union {int i; float f;} ran;
|
|
||||||
*seed = 1664525 * *seed + 1013904223;
|
|
||||||
ran.i = jflone | (jflmsk & *seed);
|
|
||||||
ran.f -= 1.5;
|
|
||||||
return 3.4642*std*ran.f;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef OVERRIDE_SPEEX_PUTC
|
|
||||||
/** Speex wrapper for putc */
|
|
||||||
static inline void _speex_putc(int ch, void *file)
|
|
||||||
{
|
|
||||||
FILE *f = (FILE *)file;
|
|
||||||
fprintf(f, "%c", ch);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -50,21 +50,16 @@
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_IN_SAMPLES 640
|
|
||||||
|
|
||||||
const SpeexMode * const speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode};
|
|
||||||
|
|
||||||
/* Extern declarations for all codebooks we use here */
|
/* Extern declarations for all codebooks we use here */
|
||||||
extern const signed char gain_cdbk_nb[];
|
extern const signed char gain_cdbk_nb[];
|
||||||
extern const signed char gain_cdbk_lbr[];
|
extern const signed char gain_cdbk_lbr[];
|
||||||
extern const signed char hexc_table[];
|
|
||||||
extern const signed char exc_5_256_table[];
|
extern const signed char exc_5_256_table[];
|
||||||
extern const signed char exc_5_64_table[];
|
extern const signed char exc_5_64_table[];
|
||||||
extern const signed char exc_8_128_table[];
|
extern const signed char exc_8_128_table[];
|
||||||
extern const signed char exc_10_32_table[];
|
extern const signed char exc_10_32_table[];
|
||||||
extern const signed char exc_10_16_table[];
|
extern const signed char exc_10_16_table[];
|
||||||
extern const signed char exc_20_32_table[];
|
extern const signed char exc_20_32_table[];
|
||||||
extern const signed char hexc_10_32_table[];
|
|
||||||
|
|
||||||
|
|
||||||
/* Parameters for Long-Term Prediction (LTP)*/
|
/* Parameters for Long-Term Prediction (LTP)*/
|
||||||
|
@ -150,28 +145,7 @@ static const split_cb_params split_cb_sb = {
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef DISABLE_WIDEBAND
|
|
||||||
|
|
||||||
/* Split-VQ innovation for high-band wideband */
|
|
||||||
static const split_cb_params split_cb_high = {
|
|
||||||
8, /*subvect_size*/
|
|
||||||
5, /*nb_subvect*/
|
|
||||||
hexc_table, /*shape_cb*/
|
|
||||||
7, /*shape_bits*/
|
|
||||||
1,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Split-VQ innovation for high-band wideband */
|
|
||||||
static const split_cb_params split_cb_high_lbr = {
|
|
||||||
10, /*subvect_size*/
|
|
||||||
4, /*nb_subvect*/
|
|
||||||
hexc_10_32_table, /*shape_cb*/
|
|
||||||
5, /*shape_bits*/
|
|
||||||
0,
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* 2150 bps "vocoder-like" mode for comfort noise */
|
/* 2150 bps "vocoder-like" mode for comfort noise */
|
||||||
static const SpeexSubmode nb_submode1 = {
|
static const SpeexSubmode nb_submode1 = {
|
||||||
|
@ -386,189 +360,6 @@ const SpeexMode speex_nb_mode = {
|
||||||
|
|
||||||
/* Wideband part */
|
/* Wideband part */
|
||||||
|
|
||||||
static const SpeexSubmode wb_submode1 = {
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
/*LSP quantization*/
|
|
||||||
lsp_quant_high,
|
|
||||||
lsp_unquant_high,
|
|
||||||
/*Pitch quantization*/
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
/*No innovation quantization*/
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
-1,
|
|
||||||
36
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static const SpeexSubmode wb_submode2 = {
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
/*LSP quantization*/
|
|
||||||
lsp_quant_high,
|
|
||||||
lsp_unquant_high,
|
|
||||||
/*Pitch quantization*/
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
/*Innovation quantization*/
|
|
||||||
split_cb_search_shape_sign,
|
|
||||||
split_cb_shape_sign_unquant,
|
|
||||||
#ifdef DISABLE_WIDEBAND
|
|
||||||
NULL,
|
|
||||||
#else
|
|
||||||
&split_cb_high_lbr,
|
|
||||||
#endif
|
|
||||||
-1,
|
|
||||||
112
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static const SpeexSubmode wb_submode3 = {
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
/*LSP quantization*/
|
|
||||||
lsp_quant_high,
|
|
||||||
lsp_unquant_high,
|
|
||||||
/*Pitch quantization*/
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
/*Innovation quantization*/
|
|
||||||
split_cb_search_shape_sign,
|
|
||||||
split_cb_shape_sign_unquant,
|
|
||||||
#ifdef DISABLE_WIDEBAND
|
|
||||||
NULL,
|
|
||||||
#else
|
|
||||||
&split_cb_high,
|
|
||||||
#endif
|
|
||||||
-1,
|
|
||||||
192
|
|
||||||
};
|
|
||||||
|
|
||||||
static const SpeexSubmode wb_submode4 = {
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
/*LSP quantization*/
|
|
||||||
lsp_quant_high,
|
|
||||||
lsp_unquant_high,
|
|
||||||
/*Pitch quantization*/
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
/*Innovation quantization*/
|
|
||||||
split_cb_search_shape_sign,
|
|
||||||
split_cb_shape_sign_unquant,
|
|
||||||
#ifdef DISABLE_WIDEBAND
|
|
||||||
NULL,
|
|
||||||
#else
|
|
||||||
&split_cb_high,
|
|
||||||
#endif
|
|
||||||
-1,
|
|
||||||
352
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Split-band wideband CELP mode*/
|
|
||||||
static const SpeexSBMode sb_wb_mode = {
|
|
||||||
&speex_nb_mode,
|
|
||||||
160, /*frameSize*/
|
|
||||||
40, /*subframeSize*/
|
|
||||||
8, /*lpcSize*/
|
|
||||||
640, /*bufSize*/
|
|
||||||
#ifdef FIXED_POINT
|
|
||||||
29491, 19661, /* gamma1, gamma2 */
|
|
||||||
#else
|
|
||||||
0.9, 0.6, /* gamma1, gamma2 */
|
|
||||||
#endif
|
|
||||||
.012, /*lag_factor*/
|
|
||||||
QCONST16(.0002,15), /*lpc_floor*/
|
|
||||||
QCONST16(0.9f,15),
|
|
||||||
{NULL, &wb_submode1, &wb_submode2, &wb_submode3, &wb_submode4, NULL, NULL, NULL},
|
|
||||||
3,
|
|
||||||
{1, 8, 2, 3, 4, 5, 5, 6, 6, 7, 7},
|
|
||||||
{1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4},
|
|
||||||
vbr_hb_thresh,
|
|
||||||
5
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const SpeexMode speex_wb_mode = {
|
|
||||||
&sb_wb_mode,
|
|
||||||
wb_mode_query,
|
|
||||||
"wideband (sub-band CELP)",
|
|
||||||
1,
|
|
||||||
4,
|
|
||||||
&sb_encoder_init,
|
|
||||||
&sb_encoder_destroy,
|
|
||||||
&sb_encode,
|
|
||||||
&sb_decoder_init,
|
|
||||||
&sb_decoder_destroy,
|
|
||||||
&sb_decode,
|
|
||||||
&sb_encoder_ctl,
|
|
||||||
&sb_decoder_ctl,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* "Ultra-wideband" mode stuff */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Split-band "ultra-wideband" (32 kbps) CELP mode*/
|
|
||||||
static const SpeexSBMode sb_uwb_mode = {
|
|
||||||
&speex_wb_mode,
|
|
||||||
320, /*frameSize*/
|
|
||||||
80, /*subframeSize*/
|
|
||||||
8, /*lpcSize*/
|
|
||||||
1280, /*bufSize*/
|
|
||||||
#ifdef FIXED_POINT
|
|
||||||
29491, 19661, /* gamma1, gamma2 */
|
|
||||||
#else
|
|
||||||
0.9, 0.6, /* gamma1, gamma2 */
|
|
||||||
#endif
|
|
||||||
.012, /*lag_factor*/
|
|
||||||
QCONST16(.0002,15), /*lpc_floor*/
|
|
||||||
QCONST16(0.7f,15),
|
|
||||||
{NULL, &wb_submode1, NULL, NULL, NULL, NULL, NULL, NULL},
|
|
||||||
1,
|
|
||||||
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
|
|
||||||
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
|
||||||
vbr_uhb_thresh,
|
|
||||||
2
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const SpeexMode speex_uwb_mode = {
|
|
||||||
&sb_uwb_mode,
|
|
||||||
wb_mode_query,
|
|
||||||
"ultra-wideband (sub-band CELP)",
|
|
||||||
2,
|
|
||||||
4,
|
|
||||||
&sb_encoder_init,
|
|
||||||
&sb_encoder_destroy,
|
|
||||||
&sb_encode,
|
|
||||||
&sb_decoder_init,
|
|
||||||
&sb_decoder_destroy,
|
|
||||||
&sb_decode,
|
|
||||||
&sb_encoder_ctl,
|
|
||||||
&sb_decoder_ctl,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef EPIC_48K
|
#ifdef EPIC_48K
|
||||||
|
|
||||||
|
@ -656,13 +447,3 @@ int speex_mode_query(const SpeexMode *mode, int request, void *ptr)
|
||||||
return mode->query(mode->mode, request, ptr);
|
return mode->query(mode->mode, request, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const SpeexMode * speex_lib_get_mode (int mode)
|
|
||||||
{
|
|
||||||
#ifdef EPIC_48K
|
|
||||||
if (mode == SPEEX_MODEID_NB_48K) return &speex_nb_48k_mode;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mode < 0 || mode >= SPEEX_NB_MODES) return NULL;
|
|
||||||
|
|
||||||
return speex_mode_list[mode];
|
|
||||||
}
|
|
||||||
|
|
304
apps/codecs/libspeex/modes_wb.c
Normal file
304
apps/codecs/libspeex/modes_wb.c
Normal file
|
@ -0,0 +1,304 @@
|
||||||
|
/* Copyright (C) 2002-2007 Jean-Marc Valin
|
||||||
|
File: modes.c
|
||||||
|
|
||||||
|
Describes the wideband modes of the codec
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
- Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
- Neither the name of the Xiph.org Foundation nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
||||||
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config-speex.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "modes.h"
|
||||||
|
#include "ltp.h"
|
||||||
|
#include "quant_lsp.h"
|
||||||
|
#include "cb_search.h"
|
||||||
|
#include "sb_celp.h"
|
||||||
|
#include "nb_celp.h"
|
||||||
|
#include "vbr.h"
|
||||||
|
#include "misc.h"
|
||||||
|
#include <math.h>
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef NULL
|
||||||
|
#define NULL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const SpeexMode * const speex_mode_list[SPEEX_NB_MODES] = {&speex_nb_mode, &speex_wb_mode, &speex_uwb_mode};
|
||||||
|
|
||||||
|
extern const signed char hexc_table[];
|
||||||
|
extern const signed char hexc_10_32_table[];
|
||||||
|
|
||||||
|
#ifndef DISABLE_WIDEBAND
|
||||||
|
|
||||||
|
/* Split-VQ innovation for high-band wideband */
|
||||||
|
static const split_cb_params split_cb_high = {
|
||||||
|
8, /*subvect_size*/
|
||||||
|
5, /*nb_subvect*/
|
||||||
|
hexc_table, /*shape_cb*/
|
||||||
|
7, /*shape_bits*/
|
||||||
|
1,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Split-VQ innovation for high-band wideband */
|
||||||
|
static const split_cb_params split_cb_high_lbr = {
|
||||||
|
10, /*subvect_size*/
|
||||||
|
4, /*nb_subvect*/
|
||||||
|
hexc_10_32_table, /*shape_cb*/
|
||||||
|
5, /*shape_bits*/
|
||||||
|
0,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static const SpeexSubmode wb_submode1 = {
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
/*LSP quantization*/
|
||||||
|
lsp_quant_high,
|
||||||
|
lsp_unquant_high,
|
||||||
|
/*Pitch quantization*/
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
/*No innovation quantization*/
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
-1,
|
||||||
|
36
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const SpeexSubmode wb_submode2 = {
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
/*LSP quantization*/
|
||||||
|
lsp_quant_high,
|
||||||
|
lsp_unquant_high,
|
||||||
|
/*Pitch quantization*/
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
/*Innovation quantization*/
|
||||||
|
split_cb_search_shape_sign,
|
||||||
|
split_cb_shape_sign_unquant,
|
||||||
|
#ifdef DISABLE_WIDEBAND
|
||||||
|
NULL,
|
||||||
|
#else
|
||||||
|
&split_cb_high_lbr,
|
||||||
|
#endif
|
||||||
|
-1,
|
||||||
|
112
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static const SpeexSubmode wb_submode3 = {
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
/*LSP quantization*/
|
||||||
|
lsp_quant_high,
|
||||||
|
lsp_unquant_high,
|
||||||
|
/*Pitch quantization*/
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
/*Innovation quantization*/
|
||||||
|
split_cb_search_shape_sign,
|
||||||
|
split_cb_shape_sign_unquant,
|
||||||
|
#ifdef DISABLE_WIDEBAND
|
||||||
|
NULL,
|
||||||
|
#else
|
||||||
|
&split_cb_high,
|
||||||
|
#endif
|
||||||
|
-1,
|
||||||
|
192
|
||||||
|
};
|
||||||
|
|
||||||
|
static const SpeexSubmode wb_submode4 = {
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
/*LSP quantization*/
|
||||||
|
lsp_quant_high,
|
||||||
|
lsp_unquant_high,
|
||||||
|
/*Pitch quantization*/
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
/*Innovation quantization*/
|
||||||
|
split_cb_search_shape_sign,
|
||||||
|
split_cb_shape_sign_unquant,
|
||||||
|
#ifdef DISABLE_WIDEBAND
|
||||||
|
NULL,
|
||||||
|
#else
|
||||||
|
&split_cb_high,
|
||||||
|
#endif
|
||||||
|
-1,
|
||||||
|
352
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Split-band wideband CELP mode*/
|
||||||
|
static const SpeexSBMode sb_wb_mode = {
|
||||||
|
&speex_nb_mode,
|
||||||
|
160, /*frameSize*/
|
||||||
|
40, /*subframeSize*/
|
||||||
|
8, /*lpcSize*/
|
||||||
|
640, /*bufSize*/
|
||||||
|
#ifdef FIXED_POINT
|
||||||
|
29491, 19661, /* gamma1, gamma2 */
|
||||||
|
#else
|
||||||
|
0.9, 0.6, /* gamma1, gamma2 */
|
||||||
|
#endif
|
||||||
|
.012, /*lag_factor*/
|
||||||
|
QCONST16(.0002,15), /*lpc_floor*/
|
||||||
|
QCONST16(0.9f,15),
|
||||||
|
{NULL, &wb_submode1, &wb_submode2, &wb_submode3, &wb_submode4, NULL, NULL, NULL},
|
||||||
|
3,
|
||||||
|
{1, 8, 2, 3, 4, 5, 5, 6, 6, 7, 7},
|
||||||
|
{1, 1, 1, 1, 1, 1, 2, 2, 3, 3, 4},
|
||||||
|
vbr_hb_thresh,
|
||||||
|
5
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const SpeexMode speex_wb_mode = {
|
||||||
|
&sb_wb_mode,
|
||||||
|
wb_mode_query,
|
||||||
|
"wideband (sub-band CELP)",
|
||||||
|
1,
|
||||||
|
4,
|
||||||
|
&sb_encoder_init,
|
||||||
|
&sb_encoder_destroy,
|
||||||
|
&sb_encode,
|
||||||
|
&sb_decoder_init,
|
||||||
|
&sb_decoder_destroy,
|
||||||
|
&sb_decode,
|
||||||
|
&sb_encoder_ctl,
|
||||||
|
&sb_decoder_ctl,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* "Ultra-wideband" mode stuff */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Split-band "ultra-wideband" (32 kbps) CELP mode*/
|
||||||
|
static const SpeexSBMode sb_uwb_mode = {
|
||||||
|
&speex_wb_mode,
|
||||||
|
320, /*frameSize*/
|
||||||
|
80, /*subframeSize*/
|
||||||
|
8, /*lpcSize*/
|
||||||
|
1280, /*bufSize*/
|
||||||
|
#ifdef FIXED_POINT
|
||||||
|
29491, 19661, /* gamma1, gamma2 */
|
||||||
|
#else
|
||||||
|
0.9, 0.6, /* gamma1, gamma2 */
|
||||||
|
#endif
|
||||||
|
.012, /*lag_factor*/
|
||||||
|
QCONST16(.0002,15), /*lpc_floor*/
|
||||||
|
QCONST16(0.7f,15),
|
||||||
|
{NULL, &wb_submode1, NULL, NULL, NULL, NULL, NULL, NULL},
|
||||||
|
1,
|
||||||
|
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
|
||||||
|
{0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
|
||||||
|
vbr_uhb_thresh,
|
||||||
|
2
|
||||||
|
};
|
||||||
|
|
||||||
|
int wb_mode_query(const void *mode, int request, void *ptr)
|
||||||
|
{
|
||||||
|
const SpeexSBMode *m = (const SpeexSBMode*)mode;
|
||||||
|
|
||||||
|
switch (request)
|
||||||
|
{
|
||||||
|
case SPEEX_MODE_FRAME_SIZE:
|
||||||
|
*((int*)ptr)=2*m->frameSize;
|
||||||
|
break;
|
||||||
|
case SPEEX_SUBMODE_BITS_PER_FRAME:
|
||||||
|
if (*((int*)ptr)==0)
|
||||||
|
*((int*)ptr) = SB_SUBMODE_BITS+1;
|
||||||
|
else if (m->submodes[*((int*)ptr)]==NULL)
|
||||||
|
*((int*)ptr) = -1;
|
||||||
|
else
|
||||||
|
*((int*)ptr) = m->submodes[*((int*)ptr)]->bits_per_frame;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
speex_warning_int("Unknown wb_mode_query request: ", request);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const SpeexMode speex_uwb_mode = {
|
||||||
|
&sb_uwb_mode,
|
||||||
|
wb_mode_query,
|
||||||
|
"ultra-wideband (sub-band CELP)",
|
||||||
|
2,
|
||||||
|
4,
|
||||||
|
&sb_encoder_init,
|
||||||
|
&sb_encoder_destroy,
|
||||||
|
&sb_encode,
|
||||||
|
&sb_decoder_init,
|
||||||
|
&sb_decoder_destroy,
|
||||||
|
&sb_decode,
|
||||||
|
&sb_encoder_ctl,
|
||||||
|
&sb_decoder_ctl,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* We have defined speex_lib_get_mode() as a macro in speex.h */
|
||||||
|
#undef speex_lib_get_mode
|
||||||
|
|
||||||
|
const SpeexMode * speex_lib_get_mode (int mode)
|
||||||
|
{
|
||||||
|
#ifdef EPIC_48K
|
||||||
|
if (mode == SPEEX_MODEID_NB_48K) return &speex_nb_48k_mode;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (mode < 0 || mode >= SPEEX_NB_MODES) return NULL;
|
||||||
|
|
||||||
|
return speex_mode_list[mode];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "vbr.h"
|
#include "vbr.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "math_approx.h"
|
#include "math_approx.h"
|
||||||
|
#include "os_support.h"
|
||||||
#include <speex/speex_callbacks.h>
|
#include <speex/speex_callbacks.h>
|
||||||
|
|
||||||
#ifdef VORBIS_PSYCHO
|
#ifdef VORBIS_PSYCHO
|
||||||
|
@ -1207,6 +1208,8 @@ static void nb_decode_lost(DecState *st, spx_word16_t *out, char *stack)
|
||||||
st->pitch_gain_buf_idx = 0;
|
st->pitch_gain_buf_idx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Just so we don't need to carry the complete wideband mode information */
|
||||||
|
static const int wb_skip_table[8] = {0, 36, 112, 192, 352, 0, 0, 0};
|
||||||
|
|
||||||
int nb_decode(void *state, SpeexBits *bits, void *vout)
|
int nb_decode(void *state, SpeexBits *bits, void *vout)
|
||||||
{
|
{
|
||||||
|
@ -1266,7 +1269,8 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
|
||||||
int submode;
|
int submode;
|
||||||
int advance;
|
int advance;
|
||||||
advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
|
advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
|
||||||
speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);
|
/*speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);*/
|
||||||
|
advance = wb_skip_table[submode];
|
||||||
if (advance < 0)
|
if (advance < 0)
|
||||||
{
|
{
|
||||||
speex_notify("Invalid mode encountered. The stream is corrupted.");
|
speex_notify("Invalid mode encountered. The stream is corrupted.");
|
||||||
|
@ -1281,7 +1285,8 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
|
||||||
if (wideband)
|
if (wideband)
|
||||||
{
|
{
|
||||||
advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
|
advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
|
||||||
speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);
|
/*speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);*/
|
||||||
|
advance = wb_skip_table[submode];
|
||||||
if (advance < 0)
|
if (advance < 0)
|
||||||
{
|
{
|
||||||
speex_notify("Invalid mode encountered. The stream is corrupted.");
|
speex_notify("Invalid mode encountered. The stream is corrupted.");
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
#include "fftwrap.h"
|
#include "fftwrap.h"
|
||||||
#include "filterbank.h"
|
#include "filterbank.h"
|
||||||
#include "math_approx.h"
|
#include "math_approx.h"
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
#define M_PI 3.14159263
|
#define M_PI 3.14159263
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#define PSEUDOFLOAT_H
|
#define PSEUDOFLOAT_H
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "os_support.h"
|
||||||
#include "math_approx.h"
|
#include "math_approx.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "quant_lsp.h"
|
#include "quant_lsp.h"
|
||||||
|
#include "os_support.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
#define M_PI 3.14159265358979323846
|
#define M_PI 3.14159265358979323846
|
||||||
|
|
|
@ -71,6 +71,7 @@ static void speex_free (void *ptr) {free(ptr);}
|
||||||
|
|
||||||
#include "speex/speex_resampler.h"
|
#include "speex/speex_resampler.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "os_support.h"
|
||||||
#endif /* OUTSIDE_SPEEX */
|
#endif /* OUTSIDE_SPEEX */
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "ltp.h"
|
#include "ltp.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "math_approx.h"
|
#include "math_approx.h"
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "smallft.h"
|
#include "smallft.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
static void drfti1(int n, float *wa, int *ifac){
|
static void drfti1(int n, float *wa, int *ifac){
|
||||||
static int ntryh[4] = { 4,2,3,5 };
|
static int ntryh[4] = { 4,2,3,5 };
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#include "modes.h"
|
#include "modes.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
|
@ -208,29 +209,6 @@ int nb_mode_query(const void *mode, int request, void *ptr)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wb_mode_query(const void *mode, int request, void *ptr)
|
|
||||||
{
|
|
||||||
const SpeexSBMode *m = (const SpeexSBMode*)mode;
|
|
||||||
|
|
||||||
switch (request)
|
|
||||||
{
|
|
||||||
case SPEEX_MODE_FRAME_SIZE:
|
|
||||||
*((int*)ptr)=2*m->frameSize;
|
|
||||||
break;
|
|
||||||
case SPEEX_SUBMODE_BITS_PER_FRAME:
|
|
||||||
if (*((int*)ptr)==0)
|
|
||||||
*((int*)ptr) = SB_SUBMODE_BITS+1;
|
|
||||||
else if (m->submodes[*((int*)ptr)]==NULL)
|
|
||||||
*((int*)ptr) = -1;
|
|
||||||
else
|
|
||||||
*((int*)ptr) = m->submodes[*((int*)ptr)]->bits_per_frame;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
speex_warning_int("Unknown wb_mode_query request: ", request);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int speex_lib_ctl(int request, void *ptr)
|
int speex_lib_ctl(int request, void *ptr)
|
||||||
|
|
|
@ -421,6 +421,9 @@ extern const SpeexMode * const speex_mode_list[SPEEX_NB_MODES];
|
||||||
/** Obtain one of the modes available */
|
/** Obtain one of the modes available */
|
||||||
const SpeexMode * speex_lib_get_mode (int mode);
|
const SpeexMode * speex_lib_get_mode (int mode);
|
||||||
|
|
||||||
|
/* We actually override the fucntion in the narrowband case so that we can avoid linking in the wideband stuff */
|
||||||
|
#define speex_lib_get_mode(mode) ((mode)==SPEEX_MODEID_NB ? &speex_nb_mode : speex_lib_get_mode (mode))
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#include <speex/speex_callbacks.h>
|
#include <speex/speex_callbacks.h>
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state)
|
int speex_inband_handler(SpeexBits *bits, SpeexCallback *callback_list, void *state)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include <speex/speex_header.h>
|
#include <speex/speex_header.h>
|
||||||
#include <speex/speex.h>
|
#include <speex/speex.h>
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
#ifndef NULL
|
#ifndef NULL
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue