提交 738c0fc1 authored 作者: Anthony Minessale's avatar Anthony Minessale

update to snapshot spandsp-20080920.tar.gz

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9771 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 2825fb6e
Tue Sep 30 23:59:24 EDT 2008
Wed Oct 1 00:06:28 EDT 2008
......@@ -16,7 +16,7 @@
## License along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Id: Makefile.am,v 1.40 2008/07/15 14:28:20 steveu Exp $
## $Id: Makefile.am,v 1.43 2008/09/20 15:44:40 steveu Exp $
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
......@@ -30,26 +30,10 @@ EXTRA_DIST = autogen.sh \
README.testdata \
spandsp.spec \
wrapper.xsl \
libspandsp.vcproj \
unpack_g722_data.sh \
unpack_g726_data.sh \
unpack_gsm0610_data.sh \
unpack_v56ter_data.sh \
doc/doxygen.in \
src/floating_fudge.h \
src/spandsp/version.h.in \
src/libspandsp.dsp \
src/libspandsp.sln \
src/msvc/gettimeofday.c \
src/msvc/inttypes.h \
src/msvc/tgmath.h \
src/msvc/unistd.h \
src/msvc/sys/time.h \
src/msvc/spandsp.def \
src/msvc/msvcproj.head \
src/msvc/msvcproj.foot \
src/msvc/vc8proj.head \
src/msvc/vc8proj.foot \
spandsp/global-tones.xml \
spandsp/tones.dtd \
spandsp/tsb85.xml \
......
......@@ -16,11 +16,12 @@
## License along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Id: Makefile.am,v 1.11 2008/06/21 10:28:34 steveu Exp $
## $Id: Makefile.am,v 1.12 2008/09/20 15:44:40 steveu Exp $
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = css.css \
doxygen.in \
t38-gateway.dia \
t38-terminal.dia \
t38_manual.xml \
......
......@@ -16,13 +16,29 @@
## License along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## $Id: Makefile.am,v 1.103 2008/09/19 14:02:05 steveu Exp $
## $Id: Makefile.am,v 1.104 2008/09/20 15:44:40 steveu Exp $
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = floating_fudge.h \
spandsp/version.h.in \
libspandsp.dsp \
libspandsp.sln \
libspandsp.vcproj \
msvc/gettimeofday.c \
msvc/inttypes.h \
msvc/tgmath.h \
msvc/unistd.h \
msvc/sys/time.h \
msvc/spandsp.def \
msvc/msvcproj.head \
msvc/msvcproj.foot \
msvc/vc8proj.head \
msvc/vc8proj.foot
INCLUDES = -I$(top_builddir)
lib_LTLIBRARIES = libspandsp.la
......
/*
* SpanDSP - a series of DSP components for telephony
*
* complex_vector_int.c - Integer complex vector arithmetic routines.
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2006 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: complex_vector_int.c,v 1.3 2008/09/18 13:54:32 steveu Exp $
*/
/*! \file */
#if defined(HAVE_CONFIG_H)
#include <config.h>
#endif
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "floating_fudge.h"
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#include <assert.h>
#include "spandsp/telephony.h"
#include "spandsp/logging.h"
#include "spandsp/complex.h"
#include "spandsp/vector_int.h"
#include "spandsp/complex_vector_int.h"
complexi32_t cvec_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n)
{
int i;
complexi32_t z;
z = complex_seti32(0, 0);
for (i = 0; i < n; i++)
{
z.re += ((int32_t) x[i].re*(int32_t) y[i].re - (int32_t) x[i].im*(int32_t) y[i].im);
z.im += ((int32_t) x[i].re*(int32_t) y[i].im + (int32_t) x[i].im*(int32_t) y[i].re);
}
return z;
}
/*- End of function --------------------------------------------------------*/
complexi32_t cvec_dot_prodi32(const complexi32_t x[], const complexi32_t y[], int n)
{
int i;
complexi32_t z;
z = complex_seti32(0, 0);
for (i = 0; i < n; i++)
{
z.re += (x[i].re*y[i].re - x[i].im*y[i].im);
z.im += (x[i].re*y[i].im + x[i].im*y[i].re);
}
return z;
}
/*- End of function --------------------------------------------------------*/
complexi32_t cvec_circular_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n, int pos)
{
complexi32_t z;
complexi32_t z1;
z = cvec_dot_prodi16(&x[pos], &y[0], n - pos);
z1 = cvec_dot_prodi16(&x[0], &y[n - pos], pos);
z = complex_addi32(&z, &z1);
return z;
}
/*- End of function --------------------------------------------------------*/
void cvec_lmsi16(const complexi16_t x[], complexi16_t y[], int n, const complexi16_t *error)
{
int i;
for (i = 0; i < n; i++)
{
y[i].re += ((int32_t) x[i].im*(int32_t) error->im + (int32_t) x[i].re*(int32_t) error->re) >> 12;
y[i].im += ((int32_t) x[i].re*(int32_t) error->im - (int32_t) x[i].im*(int32_t) error->re) >> 12;
}
}
/*- End of function --------------------------------------------------------*/
void cvec_circular_lmsi16(const complexi16_t x[], complexi16_t y[], int n, int pos, const complexi16_t *error)
{
cvec_lmsi16(&x[pos], &y[0], n - pos, error);
cvec_lmsi16(&x[0], &y[n - pos], pos, error);
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
差异被折叠。
差异被折叠。
......@@ -28,7 +28,7 @@
* Computer Science, Speech Group
* Chengxiang Lu and Alex Hauptmann
*
* $Id: g722.h,v 1.20 2008/09/19 14:02:05 steveu Exp $
* $Id: g722.h,v 1.21 2008/09/19 16:24:25 steveu Exp $
*/
......@@ -59,15 +59,15 @@ enum
/*! The per band parameters for both encoding and decoding G.722 */
typedef struct
{
int16_t nb;
int16_t det;
int16_t s;
int16_t sz;
int16_t r[3];
int16_t a[3];
int16_t p[3];
int16_t r;
int16_t p[2];
int16_t a[2];
int16_t b[6];
int16_t d[7];
int16_t b[7];
int16_t nb;
int16_t det;
} g722_band_t;
typedef struct
......
......@@ -30,8 +30,8 @@
/* The date and time of the version are in UTC form. */
#define SPANDSP_RELEASE_DATE 20080919
#define SPANDSP_RELEASE_TIME 142905
#define SPANDSP_RELEASE_DATE 20080920
#define SPANDSP_RELEASE_TIME 154737
#endif
/*- End of file ------------------------------------------------------------*/
/*
* SpanDSP - a series of DSP components for telephony
*
* complex.c
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2008 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: complex_tests.c,v 1.1 2008/09/18 12:09:51 steveu Exp $
*/
/*! \page complex_tests_page Complex arithmetic tests
\section complex_tests_page_sec_1 What does it do?
\section complex_tests_page_sec_2 How is it used?
*/
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include "floating_fudge.h"
#if defined(HAVE_TGMATH_H)
#include <tgmath.h>
#endif
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#include <assert.h>
#include "spandsp.h"
int main(int argc, char *argv[])
{
complexf_t fa;
complexf_t fb;
complexf_t fz;
complexi16_t i16a;
complexi16_t i16b;
complexi16_t i16z;
#if 0
complexi32_t i32a;
complexi32_t i32b;
complexi32_t i32z;
#endif
fa = complex_setf(0.5f, 0.25f);
fb = complex_setf(0.25f, 0.5f);
fz = complex_mulf(&fa, &fb);
printf("(%f, %f) * (%f, %f) => (%f, %f)\n", fa.re, fa.im, fb.re, fb.im, fz.re, fz.im);
i16a = complex_seti16(16383, 8191);
i16b = complex_seti16(8191, 16383);
i16z = complex_mul_q1_15(&i16a, &i16b);
printf("(%f, %f) * (%f, %f) => (%f, %f)\n", i16a.re/32768.0, i16a.im/32768.0, i16b.re/32768.0, i16b.im/32768.0, i16z.re/32768.0, i16z.im/32768.0);
printf("Tests passed.\n");
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
/*
* SpanDSP - a series of DSP components for telephony
*
* complex_vector_float_tests.c
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2006,2008 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: complex_vector_float_tests.c,v 1.1 2008/09/18 12:05:35 steveu Exp $
*/
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <audiofile.h>
#include "spandsp.h"
static complexf_t cvec_dot_prodf_dumb(const complexf_t x[], const complexf_t y[], int n)
{
int i;
complexf_t z;
complexf_t z1;
z = complex_setf(0.0f, 0.0f);
for (i = 0; i < n; i++)
{
z1 = complex_mulf(&x[i], &y[i]);
z = complex_addf(&z, &z1);
}
return z;
}
/*- End of function --------------------------------------------------------*/
static int test_cvec_dot_prodf(void)
{
int i;
complexf_t x[100];
complexf_t y[100];
complexf_t zsa;
complexf_t zsb;
complexf_t ratio;
for (i = 0; i < 99; i++)
{
x[i].re = rand();
x[i].im = rand();
y[i].re = rand();
y[i].im = rand();
}
for (i = 1; i < 99; i++)
{
zsa = cvec_dot_prodf(x, y, i);
zsb = cvec_dot_prodf_dumb(x, y, i);
ratio.re = zsa.re/zsb.re;
ratio.im = zsa.im/zsb.im;
if ((ratio.re < 0.9999 || ratio.re > 1.0001)
||
(ratio.im < 0.9999 || ratio.im > 1.0001))
{
printf("vec_dot_prod() - (%f,%f) (%f,%f)\n", zsa.re, zsa.im, zsb.re, zsb.im);
printf("Tests failed\n");
exit(2);
}
}
return 0;
}
/*- End of function --------------------------------------------------------*/
int main(int argc, char *argv[])
{
test_cvec_dot_prodf();
printf("Tests passed.\n");
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
/*
* SpanDSP - a series of DSP components for telephony
*
* complex_vector_int_tests.c
*
* Written by Steve Underwood <steveu@coppice.org>
*
* Copyright (C) 2006 Steve Underwood
*
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: complex_vector_int_tests.c,v 1.1 2008/09/18 12:05:35 steveu Exp $
*/
#if defined(HAVE_CONFIG_H)
#include "config.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <audiofile.h>
#include "spandsp.h"
static complexi32_t cvec_dot_prodi16_dumb(const complexi16_t x[], const complexi16_t y[], int n)
{
complexi32_t z;
int i;
z = complex_seti32(0, 0);
for (i = 0; i < n; i++)
{
z.re += ((int32_t) x[i].re*(int32_t) y[i].re - (int32_t) x[i].im*(int32_t) y[i].im);
z.im += ((int32_t) x[i].re*(int32_t) y[i].im + (int32_t) x[i].im*(int32_t) y[i].re);
}
return z;
}
/*- End of function --------------------------------------------------------*/
static int test_cvec_dot_prodi16(void)
{
int i;
complexi32_t za;
complexi32_t zb;
complexi16_t x[99];
complexi16_t y[99];
for (i = 0; i < 99; i++)
{
x[i].re = rand();
x[i].im = rand();
y[i].re = rand();
y[i].im = rand();
}
for (i = 1; i < 99; i++)
{
za = cvec_dot_prodi16(x, y, i);
zb = cvec_dot_prodi16_dumb(x, y, i);
if (za.re != zb.re || za.im != zb.im)
{
printf("Tests failed\n");
exit(2);
}
}
return 0;
}
/*- End of function --------------------------------------------------------*/
static int test_cvec_circular_dot_prodi16(void)
{
int i;
int j;
int pos;
int len;
complexi32_t za;
complexi32_t zb;
complexi16_t x[99];
complexi16_t y[99];
/* Verify that we can do circular sample buffer "dot" linear coefficient buffer
operations properly, by doing two sub-dot products. */
for (i = 0; i < 99; i++)
{
x[i].re = rand();
x[i].im = rand();
y[i].re = rand();
y[i].im = rand();
}
len = 95;
for (pos = 0; pos < len; pos++)
{
za = cvec_circular_dot_prodi16(x, y, len, pos);
zb = complex_seti32(0, 0);
for (i = 0; i < len; i++)
{
j = (pos + i) % len;
zb.re += ((int32_t) x[j].re*(int32_t) y[i].re - (int32_t) x[j].im*(int32_t) y[i].im);
zb.im += ((int32_t) x[j].re*(int32_t) y[i].im + (int32_t) x[j].im*(int32_t) y[i].re);
}
if (za.re != zb.re || za.im != zb.im)
{
printf("Tests failed\n");
exit(2);
}
}
return 0;
}
/*- End of function --------------------------------------------------------*/
int main(int argc, char *argv[])
{
test_cvec_dot_prodi16();
test_cvec_circular_dot_prodi16();
printf("Tests passed.\n");
return 0;
}
/*- End of function --------------------------------------------------------*/
/*- End of file ------------------------------------------------------------*/
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论