spandsp
0.0.6
|
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 00026 #if !defined(_SPANDSP_COMPLEX_VECTOR_INT_H_) 00027 #define _SPANDSP_COMPLEX_VECTOR_INT_H_ 00028 00029 #if defined(__cplusplus) 00030 extern "C" 00031 { 00032 #endif 00033 00034 static __inline__ void cvec_copyi(complexi_t z[], const complexi_t x[], int n) 00035 { 00036 memcpy(z, x, n*sizeof(z[0])); 00037 } 00038 /*- End of function --------------------------------------------------------*/ 00039 00040 static __inline__ void cvec_copyi16(complexi16_t z[], const complexi16_t x[], int n) 00041 { 00042 memcpy(z, x, n*sizeof(z[0])); 00043 } 00044 /*- End of function --------------------------------------------------------*/ 00045 00046 static __inline__ void cvec_copyi32(complexi32_t z[], const complexi32_t x[], int n) 00047 { 00048 memcpy(z, x, n*sizeof(z[0])); 00049 } 00050 /*- End of function --------------------------------------------------------*/ 00051 00052 static __inline__ void cvec_zeroi(complexi_t z[], int n) 00053 { 00054 memset(z, 0, n*sizeof(z[0])); 00055 } 00056 /*- End of function --------------------------------------------------------*/ 00057 00058 static __inline__ void cvec_zeroi16(complexi16_t z[], int n) 00059 { 00060 memset(z, 0, n*sizeof(z[0])); 00061 } 00062 /*- End of function --------------------------------------------------------*/ 00063 00064 static __inline__ void cvec_zeroi32(complexi32_t z[], int n) 00065 { 00066 memset(z, 0, n*sizeof(z[0])); 00067 } 00068 /*- End of function --------------------------------------------------------*/ 00069 00070 static __inline__ void cvec_seti(complexi_t z[], complexi_t *x, int n) 00071 { 00072 int i; 00073 00074 for (i = 0; i < n; i++) 00075 z[i] = *x; 00076 } 00077 /*- End of function --------------------------------------------------------*/ 00078 00079 static __inline__ void cvec_seti16(complexi16_t z[], complexi16_t *x, int n) 00080 { 00081 int i; 00082 00083 for (i = 0; i < n; i++) 00084 z[i] = *x; 00085 } 00086 /*- End of function --------------------------------------------------------*/ 00087 00088 static __inline__ void cvec_seti32(complexi32_t z[], complexi32_t *x, int n) 00089 { 00090 int i; 00091 00092 for (i = 0; i < n; i++) 00093 z[i] = *x; 00094 } 00095 /*- End of function --------------------------------------------------------*/ 00096 00097 /*! \brief Find the dot product of two complex int16_t vectors. 00098 \param x The first vector. 00099 \param y The first vector. 00100 \param n The number of elements in the vectors. 00101 \return The dot product of the two vectors. */ 00102 SPAN_DECLARE(complexi32_t) cvec_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n); 00103 00104 /*! \brief Find the dot product of two complex int32_t vectors. 00105 \param x The first vector. 00106 \param y The first vector. 00107 \param n The number of elements in the vectors. 00108 \return The dot product of the two vectors. */ 00109 SPAN_DECLARE(complexi32_t) cvec_dot_prodi32(const complexi32_t x[], const complexi32_t y[], int n); 00110 00111 /*! \brief Find the dot product of two complex int16_t vectors, where the first is a circular buffer 00112 with an offset for the starting position. 00113 \param x The first vector. 00114 \param y The first vector. 00115 \param n The number of elements in the vectors. 00116 \param pos The starting position in the x vector. 00117 \return The dot product of the two vectors. */ 00118 SPAN_DECLARE(complexi32_t) cvec_circular_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n, int pos); 00119 00120 SPAN_DECLARE(void) cvec_lmsi16(const complexi16_t x[], complexi16_t y[], int n, const complexi16_t *error); 00121 00122 SPAN_DECLARE(void) cvec_circular_lmsi16(const complexi16_t x[], complexi16_t y[], int n, int pos, const complexi16_t *error); 00123 00124 #if defined(__cplusplus) 00125 } 00126 #endif 00127 00128 #endif 00129 /*- End of file ------------------------------------------------------------*/