comparison spandsp-0.0.6pre17/src/spandsp/complex_vector_int.h @ 4:26cd8f1ef0b1

import spandsp-0.0.6pre17
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Fri, 25 Jun 2010 15:50:58 +0200
parents
children
comparison
equal deleted inserted replaced
3:c6c5a16ce2f2 4:26cd8f1ef0b1
1 /*
2 * SpanDSP - a series of DSP components for telephony
3 *
4 * complex_vector_int.h
5 *
6 * Written by Steve Underwood <steveu@coppice.org>
7 *
8 * Copyright (C) 2003 Steve Underwood
9 *
10 * All rights reserved.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 2.1,
14 * as published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 * $Id: complex_vector_int.h,v 1.4 2009/01/31 08:48:11 steveu Exp $
26 */
27
28 #if !defined(_SPANDSP_COMPLEX_VECTOR_INT_H_)
29 #define _SPANDSP_COMPLEX_VECTOR_INT_H_
30
31 #if defined(__cplusplus)
32 extern "C"
33 {
34 #endif
35
36 static __inline__ void cvec_copyi(complexi_t z[], const complexi_t x[], int n)
37 {
38 memcpy(z, x, n*sizeof(z[0]));
39 }
40 /*- End of function --------------------------------------------------------*/
41
42 static __inline__ void cvec_copyi16(complexi16_t z[], const complexi16_t x[], int n)
43 {
44 memcpy(z, x, n*sizeof(z[0]));
45 }
46 /*- End of function --------------------------------------------------------*/
47
48 static __inline__ void cvec_copyi32(complexi32_t z[], const complexi32_t x[], int n)
49 {
50 memcpy(z, x, n*sizeof(z[0]));
51 }
52 /*- End of function --------------------------------------------------------*/
53
54 static __inline__ void cvec_zeroi(complexi_t z[], int n)
55 {
56 memset(z, 0, n*sizeof(z[0]));
57 }
58 /*- End of function --------------------------------------------------------*/
59
60 static __inline__ void cvec_zeroi16(complexi16_t z[], int n)
61 {
62 memset(z, 0, n*sizeof(z[0]));
63 }
64 /*- End of function --------------------------------------------------------*/
65
66 static __inline__ void cvec_zeroi32(complexi32_t z[], int n)
67 {
68 memset(z, 0, n*sizeof(z[0]));
69 }
70 /*- End of function --------------------------------------------------------*/
71
72 static __inline__ void cvec_seti(complexi_t z[], complexi_t *x, int n)
73 {
74 int i;
75
76 for (i = 0; i < n; i++)
77 z[i] = *x;
78 }
79 /*- End of function --------------------------------------------------------*/
80
81 static __inline__ void cvec_seti16(complexi16_t z[], complexi16_t *x, int n)
82 {
83 int i;
84
85 for (i = 0; i < n; i++)
86 z[i] = *x;
87 }
88 /*- End of function --------------------------------------------------------*/
89
90 static __inline__ void cvec_seti32(complexi32_t z[], complexi32_t *x, int n)
91 {
92 int i;
93
94 for (i = 0; i < n; i++)
95 z[i] = *x;
96 }
97 /*- End of function --------------------------------------------------------*/
98
99 /*! \brief Find the dot product of two complex int16_t vectors.
100 \param x The first vector.
101 \param y The first vector.
102 \param n The number of elements in the vectors.
103 \return The dot product of the two vectors. */
104 SPAN_DECLARE(complexi32_t) cvec_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n);
105
106 /*! \brief Find the dot product of two complex int32_t vectors.
107 \param x The first vector.
108 \param y The first vector.
109 \param n The number of elements in the vectors.
110 \return The dot product of the two vectors. */
111 SPAN_DECLARE(complexi32_t) cvec_dot_prodi32(const complexi32_t x[], const complexi32_t y[], int n);
112
113 /*! \brief Find the dot product of two complex int16_t vectors, where the first is a circular buffer
114 with an offset for the starting position.
115 \param x The first vector.
116 \param y The first vector.
117 \param n The number of elements in the vectors.
118 \param pos The starting position in the x vector.
119 \return The dot product of the two vectors. */
120 SPAN_DECLARE(complexi32_t) cvec_circular_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n, int pos);
121
122 SPAN_DECLARE(void) cvec_lmsi16(const complexi16_t x[], complexi16_t y[], int n, const complexi16_t *error);
123
124 SPAN_DECLARE(void) cvec_circular_lmsi16(const complexi16_t x[], complexi16_t y[], int n, int pos, const complexi16_t *error);
125
126 #if defined(__cplusplus)
127 }
128 #endif
129
130 #endif
131 /*- End of file ------------------------------------------------------------*/

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.