complex_vector_int.h

00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * complex_vector_int.h
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2003 Steve Underwood
00009  *
00010  * All rights reserved.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU Lesser General Public License version 2.1,
00014  * as published by the Free Software Foundation.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024  *
00025  * $Id: complex_vector_int.h,v 1.3 2008/09/18 13:16:49 steveu Exp $
00026  */
00027 
00028 #if !defined(_SPANDSP_COMPLEX_VECTOR_INT_H_)
00029 #define _SPANDSP_COMPLEX_VECTOR_INT_H_
00030 
00031 #if defined(__cplusplus)
00032 extern "C"
00033 {
00034 #endif
00035 
00036 static __inline__ void cvec_copyi(complexi_t z[], const complexi_t x[], int n)
00037 {
00038     memcpy(z, x, n*sizeof(z[0]));
00039 }
00040 /*- End of function --------------------------------------------------------*/
00041 
00042 static __inline__ void cvec_copyi16(complexi16_t z[], const complexi16_t x[], int n)
00043 {
00044     memcpy(z, x, n*sizeof(z[0]));
00045 }
00046 /*- End of function --------------------------------------------------------*/
00047 
00048 static __inline__ void cvec_copyi32(complexi32_t z[], const complexi32_t x[], int n)
00049 {
00050     memcpy(z, x, n*sizeof(z[0]));
00051 }
00052 /*- End of function --------------------------------------------------------*/
00053 
00054 static __inline__ void cvec_zeroi(complexi_t z[], int n)
00055 {
00056     memset(z, 0, n*sizeof(z[0]));
00057 }
00058 /*- End of function --------------------------------------------------------*/
00059 
00060 static __inline__ void cvec_zeroi16(complexi16_t z[], int n)
00061 {
00062     memset(z, 0, n*sizeof(z[0]));
00063 }
00064 /*- End of function --------------------------------------------------------*/
00065 
00066 static __inline__ void cvec_zeroi32(complexi32_t z[], int n)
00067 {
00068     memset(z, 0, n*sizeof(z[0]));
00069 }
00070 /*- End of function --------------------------------------------------------*/
00071 
00072 static __inline__ void cvec_seti(complexi_t z[], complexi_t *x, int n)
00073 {
00074     int i;
00075     
00076     for (i = 0;  i < n;  i++)
00077         z[i] = *x;
00078 }
00079 /*- End of function --------------------------------------------------------*/
00080 
00081 static __inline__ void cvec_seti16(complexi16_t z[], complexi16_t *x, int n)
00082 {
00083     int i;
00084     
00085     for (i = 0;  i < n;  i++)
00086         z[i] = *x;
00087 }
00088 /*- End of function --------------------------------------------------------*/
00089 
00090 static __inline__ void cvec_seti32(complexi32_t z[], complexi32_t *x, int n)
00091 {
00092     int i;
00093     
00094     for (i = 0;  i < n;  i++)
00095         z[i] = *x;
00096 }
00097 /*- End of function --------------------------------------------------------*/
00098 
00099 /*! \brief Find the dot product of two complex int16_t vectors.
00100     \param x The first vector.
00101     \param y The first vector.
00102     \param n The number of elements in the vectors.
00103     \return The dot product of the two vectors. */
00104 complexi32_t cvec_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n);
00105 
00106 /*! \brief Find the dot product of two complex int32_t vectors.
00107     \param x The first vector.
00108     \param y The first vector.
00109     \param n The number of elements in the vectors.
00110     \return The dot product of the two vectors. */
00111 complexi32_t cvec_dot_prodi32(const complexi32_t x[], const complexi32_t y[], int n);
00112 
00113 /*! \brief Find the dot product of two complex int16_t vectors, where the first is a circular buffer
00114            with an offset for the starting position.
00115     \param x The first vector.
00116     \param y The first vector.
00117     \param n The number of elements in the vectors.
00118     \param pos The starting position in the x vector.
00119     \return The dot product of the two vectors. */
00120 complexi32_t cvec_circular_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n, int pos);
00121 
00122 void cvec_lmsi16(const complexi16_t x[], complexi16_t y[], int n, const complexi16_t *error);
00123 
00124 void cvec_circular_lmsi16(const complexi16_t x[], complexi16_t y[], int n, int pos, const complexi16_t *error);
00125 
00126 #if defined(__cplusplus)
00127 }
00128 #endif
00129 
00130 #endif
00131 /*- End of file ------------------------------------------------------------*/

Generated on Tue Oct 7 20:25:45 2008 for spandsp by  doxygen 1.5.6