cleanup of extras

git-svn-id: svn://192.168.202.10@17 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2006-07-07 15:44:57 +00:00
parent 3716a7fea9
commit 93b5fa1e52
558 changed files with 224656 additions and 307 deletions
@@ -0,0 +1,7 @@
/misc.c/1.1/Thu Mar 25 15:10:17 2004//
/misc.h/1.1/Thu Mar 25 15:10:17 2004//
/preprocess.c/1.4/Fri Mar 25 20:26:26 2005//
/smallft.c/1.3/Fri Mar 25 20:26:26 2005//
/smallft.h/1.2/Wed Jul 7 13:39:42 2004//
/speex_preprocess.h/1.1/Thu Mar 25 15:10:17 2004//
D
@@ -0,0 +1 @@
app_conference/libspeex
@@ -0,0 +1 @@
:pserver:anonymous@iaxclient.cvs.sourceforge.net:/cvsroot/iaxclient
@@ -0,0 +1,145 @@
/* Copyright (C) 2002 Jean-Marc Valin
File: mics.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.
*/
#include "misc.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#ifndef RELEASE
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
unsigned int be_int(unsigned int i)
{
unsigned int ret=i;
#ifndef WORDS_BIGENDIAN
ret = i>>24;
ret += (i>>8)&0x0000ff00;
ret += (i<<8)&0x00ff0000;
ret += (i<<24);
#endif
return ret;
}
unsigned int le_int(unsigned int i)
{
unsigned int ret=i;
#ifdef WORDS_BIGENDIAN
ret = i>>24;
ret += (i>>8)&0x0000ff00;
ret += (i<<8)&0x00ff0000;
ret += (i<<24);
#endif
return ret;
}
unsigned short be_short(unsigned short s)
{
unsigned short ret=s;
#ifndef WORDS_BIGENDIAN
ret = s>>8;
ret += s<<8;
#endif
return ret;
}
unsigned short le_short(unsigned short s)
{
unsigned short ret=s;
#ifdef WORDS_BIGENDIAN
ret = s>>8;
ret += s<<8;
#endif
return ret;
}
void *speex_alloc (int size)
{
return calloc(size,1);
}
void *speex_realloc (void *ptr, int size)
{
return realloc(ptr, size);
}
void speex_free (void *ptr)
{
free(ptr);
}
void *speex_move (void *dest, void *src, int n)
{
return memmove(dest,src,n);
}
void speex_error(char *str)
{
fprintf (stderr, "Fatal error: %s\n", str);
exit(1);
}
void speex_warning(char *str)
{
fprintf (stderr, "warning: %s\n", str);
}
void speex_warning_int(char *str, int val)
{
fprintf (stderr, "warning: %s %d\n", str, val);
}
void speex_rand_vec(float std, spx_sig_t *data, int len)
{
int i;
for (i=0;i<len;i++)
data[i]+=SIG_SCALING*3*std*((((float)rand())/RAND_MAX)-.5);
}
float speex_rand(float std)
{
return 3*std*((((float)rand())/RAND_MAX)-.5);
}
void _speex_putc(int ch, void *file)
{
FILE *f = (FILE *)file;
fputc(ch, f);
}
@@ -0,0 +1,147 @@
/* Copyright (C) 2002 Jean-Marc Valin */
/**
@file misc.h
@brief Various compatibility 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.
*/
#ifndef MISC_H
#define MISC_H
#ifndef VERSION
#define VERSION "speex-1.1"
#endif
#ifdef FIXED_POINT
typedef signed short spx_word16_t;
typedef signed int spx_word32_t;
typedef spx_word32_t spx_mem_t;
typedef spx_word16_t spx_coef_t;
typedef spx_word16_t spx_lsp_t;
typedef spx_word32_t spx_sig_t;
#define LPC_SCALING 8192.
#define SIG_SCALING 16384
#define LSP_SCALING 8192.
#define LPC_SHIFT 13
#define SIG_SHIFT 14
#define PSHR(a,shift) (((a)+(1<<((shift)-1))) >> (shift))
#define SHR(a,shift) ((a) >> (shift))
#define SHL(a,shift) ((a) << (shift))
/* result fits in 16 bits */
#define MULT16_16_16(a,b) (((short)(a))*(b))
#define MULT16_16(a,b) (((signed int)(a))*(b))
#define MULT16_32_Q13(a,b) (((a)*((b)>>13)) + ((a)*((signed int)((b)&0x00001fff))>>13))
#define MULT16_32_Q14(a,b) (((a)*((b)>>14)) + ((a)*((signed int)((b)&0x00003fff))>>14))
#define MULT16_32_Q15(a,b) (((a)*((b)>>15)) + ((a)*((signed int)((b)&0x00007fff))>>15))
#define MULT16_16_Q13(a,b) (((signed int)(a))*(b)>>13)
#define MULT16_16_Q14(a,b) (((signed int)(a))*(b)>>14)
#define MULT16_16_Q15(a,b) (((signed int)(a))*(b)>>15)
#define MULT16_16_P14(a,b) ((8192+((signed int)(a))*(b))>>14)
#define DIV32_16(a,b) (((signed int)(a))/(b))
#else
typedef float spx_mem_t;
typedef float spx_coef_t;
typedef float spx_lsp_t;
typedef float spx_sig_t;
typedef float spx_word16_t;
typedef float spx_word32_t;
#define LPC_SCALING 1.
#define SIG_SCALING 1.
#define LSP_SCALING 1.
#define LPC_SHIFT 0
#define SIG_SHIFT 0
#define PSHR(a,shift) (a)
#define SHR(a,shift) (a)
#define SHL(a,shift) (a)
#define MULT16_16_16(a,b) ((a)*(b))
#define MULT16_16(a,b) ((a)*(b))
#define MULT16_32_Q13(a,b) ((a)*(b))
#define MULT16_32_Q14(a,b) ((a)*(b))
#define MULT16_32_Q15(a,b) ((a)*(b))
#define MULT16_16_Q13(a,b) ((a)*(b))
#define MULT16_16_Q14(a,b) ((a)*(b))
#define MULT16_16_Q15(a,b) ((a)*(b))
#endif
#ifndef RELEASE
void print_vec(float *vec, int len, char *name);
#endif
unsigned int be_int(unsigned int i);
unsigned int le_int(unsigned int i);
unsigned short be_short(unsigned short s);
unsigned short le_short(unsigned short s);
/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free */
void *speex_alloc (int size);
/** Speex wrapper for realloc. To do your own dynamic allocation, all you need to do is replace this function, speex_alloc and speex_free */
void *speex_realloc (void *ptr, int size);
/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_alloc */
void speex_free (void *ptr);
/** Speex wrapper for mem_move */
void *speex_move (void *dest, void *src, int n);
void speex_error(char *str);
void speex_warning(char *str);
void speex_warning_int(char *str, int val);
void speex_rand_vec(float std, spx_sig_t *data, int len);
float speex_rand(float std);
void _speex_putc(int ch, void *file);
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,42 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: fft transform
last mod: $Id: smallft.h,v 1.2 2004/07/07 13:39:42 stevek Exp $
********************************************************************/
#ifndef _V_SMFT_H_
#define _V_SMFT_H_
/*#include "vorbis/codec.h"*/
#ifdef __cplusplus
extern "C" {
#endif
struct drft_lookup{
int n;
float *trigcache;
int *splitcache;
};
extern void drft_forward(struct drft_lookup *l,float *data);
extern void drft_backward(struct drft_lookup *l,float *data);
extern void drft_init(struct drft_lookup *l,int n);
extern void drft_clear(struct drft_lookup *l);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,139 @@
/* Copyright (C) 2003 Epic Games
Written by Jean-Marc Valin
File: speex_preprocess.h
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. 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.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 __cplusplus
extern "C" {
#endif
struct drft_lookup;
typedef struct SpeexPreprocessState {
int frame_size; /**< Number of samples processed each time */
int ps_size; /**< Number of points in the power spectrum */
int sampling_rate; /**< Sampling rate of the input/output */
/* parameters */
int denoise_enabled;
int agc_enabled;
float agc_level;
int vad_enabled;
// probabilities to check speech_prob against
float speech_prob_start ;
float speech_prob_continue ;
float *frame; /**< Processing frame (2*ps_size) */
float *ps; /**< Current power spectrum */
float *gain2; /**< Adjusted gains */
float *window; /**< Analysis/Synthesis window */
float *noise; /**< Noise estimate */
float *old_ps; /**< Power spectrum for last frame */
float *gain; /**< Ephraim Malah gain */
float *prior; /**< A-priori SNR */
float *post; /**< A-posteriori SNR */
float *S; /**< Smoothed power spectrum */
float *Smin; /**< See Cohen paper */
float *Stmp; /**< See Cohen paper */
float *update_prob; /**< Propability of speech presence for noise update */
float *zeta; /**< Smoothed a priori SNR */
float Zpeak;
float Zlast;
float *loudness_weight; /**< Perceptual loudness curve */
float *echo_noise;
float *noise_bands;
float *noise_bands2;
int noise_bandsN;
float *speech_bands;
float *speech_bands2;
int speech_bandsN;
float *inbuf; /**< Input buffer (overlapped analysis) */
float *outbuf; /**< Output buffer (for overlap and add) */
float speech_prob;
int last_speech;
float loudness; /**< loudness estimate */
float loudness2; /**< loudness estimate */
int nb_adapt; /**< Number of frames used for adaptation so far */
int nb_loudness_adapt; /**< Number of frames used for loudness adaptation so far */
int consec_noise; /**< Number of consecutive noise frames */
int nb_preprocess; /**< Number of frames processed so far */
struct drft_lookup *fft_lookup; /**< Lookup table for the FFT */
} SpeexPreprocessState;
/** Creates a new preprocessing state */
SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate);
/** Destroys a denoising state */
void speex_preprocess_state_destroy(SpeexPreprocessState *st);
/** Preprocess a frame */
int speex_preprocess(SpeexPreprocessState *st, short *x, float *noise);
/** Preprocess a frame */
void speex_preprocess_estimate_update(SpeexPreprocessState *st, short *x, float *noise);
/** Used like the ioctl function to control the preprocessor parameters */
int speex_preprocess_ctl(SpeexPreprocessState *st, int request, void *ptr);
#define SPEEX_PROB_START 0.35
#define SPEEX_PROB_CONTINUE 0.1
#define SPEEX_PREPROCESS_SET_DENOISE 0
#define SPEEX_PREPROCESS_GET_DENOISE 1
#define SPEEX_PREPROCESS_SET_AGC 2
#define SPEEX_PREPROCESS_GET_AGC 3
#define SPEEX_PREPROCESS_SET_VAD 4
#define SPEEX_PREPROCESS_GET_VAD 5
#define SPEEX_PREPROCESS_SET_AGC_LEVEL 6
#define SPEEX_PREPROCESS_GET_AGC_LEVEL 7
#define SPEEX_PREPROCESS_SET_PROB_START 8
#define SPEEX_PREPROCESS_GET_PROB_START 9
#define SPEEX_PREPROCESS_SET_PROB_CONTINUE 10
#define SPEEX_PREPROCESS_GET_PROB_CONTINUE 11
#ifdef __cplusplus
}
#endif