mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
inital checkin of spandsp from http://www.soft-switch.org/downloads/snapshots/spandsp/spandsp-20080829.tar.gz
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9425 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
107
libs/spandsp/src/lpc10_encdecs.h
Normal file
107
libs/spandsp/src/lpc10_encdecs.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* SpanDSP - a series of DSP components for telephony
|
||||
*
|
||||
* lpc10_encdecs.h - LPC10 low bit rate speech codec.
|
||||
*
|
||||
* 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: lpc10_encdecs.h,v 1.11 2008/04/17 14:26:56 steveu Exp $
|
||||
*/
|
||||
|
||||
#define LPC10_ORDER 10
|
||||
|
||||
#if !defined(min)
|
||||
#define min(a,b) ((a) <= (b) ? (a) : (b))
|
||||
#endif
|
||||
#if !defined(max)
|
||||
#define max(a,b) ((a) >= (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
void lpc10_placea(int32_t *ipitch,
|
||||
int32_t voibuf[4][2],
|
||||
int32_t *obound,
|
||||
int32_t af,
|
||||
int32_t vwin[3][2],
|
||||
int32_t awin[3][2],
|
||||
int32_t ewin[3][2],
|
||||
int32_t lframe,
|
||||
int32_t maxwin);
|
||||
|
||||
void lpc10_placev(int32_t *osbuf,
|
||||
int32_t *osptr,
|
||||
int32_t oslen,
|
||||
int32_t *obound,
|
||||
int32_t vwin[3][2],
|
||||
int32_t af,
|
||||
int32_t lframe,
|
||||
int32_t minwin,
|
||||
int32_t maxwin,
|
||||
int32_t dvwinl,
|
||||
int32_t dvwinh);
|
||||
|
||||
void lpc10_voicing(lpc10_encode_state_t *st,
|
||||
int32_t *vwin,
|
||||
float *inbuf,
|
||||
float *lpbuf,
|
||||
const int32_t buflim[],
|
||||
int32_t half,
|
||||
float *minamd,
|
||||
float *maxamd,
|
||||
int32_t *mintau,
|
||||
float *ivrc,
|
||||
int32_t *obound);
|
||||
|
||||
void lpc10_analyse(lpc10_encode_state_t *st, float *speech, int32_t *voice, int32_t *pitch, float *rms, float rc[]);
|
||||
|
||||
static __inline__ int32_t pow_ii(int32_t x, int32_t n)
|
||||
{
|
||||
int32_t pow;
|
||||
uint32_t u;
|
||||
|
||||
if (n <= 0)
|
||||
{
|
||||
if (n == 0 || x == 1)
|
||||
return 1;
|
||||
if (x != -1)
|
||||
return (x == 0) ? 1/x : 0;
|
||||
n = -n;
|
||||
}
|
||||
u = n;
|
||||
for (pow = 1; ; )
|
||||
{
|
||||
if ((u & 1))
|
||||
pow *= x;
|
||||
if ((u >>= 1) == 0)
|
||||
break;
|
||||
x *= x;
|
||||
}
|
||||
return pow;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
static __inline__ float r_sign(float a, float b)
|
||||
{
|
||||
float x;
|
||||
|
||||
x = fabsf(a);
|
||||
return (b >= 0.0f) ? x : -x;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
/*- End of file ------------------------------------------------------------*/
|
Reference in New Issue
Block a user