spandsp: complex_vector_int.h Source File

spandsp 0.0.6

complex_vector_int.h
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
26#if !defined(_SPANDSP_COMPLEX_VECTOR_INT_H_)
27#define _SPANDSP_COMPLEX_VECTOR_INT_H_
28
29#if defined(__cplusplus)
30extern "C"
31{
32#endif
33
34static __inline__ void cvec_copyi(complexi_t z[], const complexi_t x[], int n)
35{
36 memcpy(z, x, n*sizeof(z[0]));
37}
38/*- End of function --------------------------------------------------------*/
39
40static __inline__ void cvec_copyi16(complexi16_t z[], const complexi16_t x[], int n)
41{
42 memcpy(z, x, n*sizeof(z[0]));
43}
44/*- End of function --------------------------------------------------------*/
45
46static __inline__ void cvec_copyi32(complexi32_t z[], const complexi32_t x[], int n)
47{
48 memcpy(z, x, n*sizeof(z[0]));
49}
50/*- End of function --------------------------------------------------------*/
51
52static __inline__ void cvec_zeroi(complexi_t z[], int n)
53{
54 memset(z, 0, n*sizeof(z[0]));
55}
56/*- End of function --------------------------------------------------------*/
57
58static __inline__ void cvec_zeroi16(complexi16_t z[], int n)
59{
60 memset(z, 0, n*sizeof(z[0]));
61}
62/*- End of function --------------------------------------------------------*/
63
64static __inline__ void cvec_zeroi32(complexi32_t z[], int n)
65{
66 memset(z, 0, n*sizeof(z[0]));
67}
68/*- End of function --------------------------------------------------------*/
69
70static __inline__ void cvec_seti(complexi_t z[], complexi_t *x, int n)
71{
72 int i;
73
74 for (i = 0; i < n; i++)
75 z[i] = *x;
76}
77/*- End of function --------------------------------------------------------*/
78
79static __inline__ void cvec_seti16(complexi16_t z[], complexi16_t *x, int n)
80{
81 int i;
82
83 for (i = 0; i < n; i++)
84 z[i] = *x;
85}
86/*- End of function --------------------------------------------------------*/
87
88static __inline__ void cvec_seti32(complexi32_t z[], complexi32_t *x, int n)
89{
90 int i;
91
92 for (i = 0; i < n; i++)
93 z[i] = *x;
94}
95/*- End of function --------------------------------------------------------*/
96
97/*! \brief Find the dot product of two complex int16_t vectors.
98 \param x The first vector.
99 \param y The first vector.
100 \param n The number of elements in the vectors.
101 \return The dot product of the two vectors. */
102SPAN_DECLARE(complexi32_t) cvec_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n);
103
104/*! \brief Find the dot product of two complex int32_t vectors.
105 \param x The first vector.
106 \param y The first vector.
107 \param n The number of elements in the vectors.
108 \return The dot product of the two vectors. */
109SPAN_DECLARE(complexi32_t) cvec_dot_prodi32(const complexi32_t x[], const complexi32_t y[], int n);
110
111/*! \brief Find the dot product of two complex int16_t vectors, where the first is a circular buffer
112 with an offset for the starting position.
113 \param x The first vector.
114 \param y The first vector.
115 \param n The number of elements in the vectors.
116 \param pos The starting position in the x vector.
117 \return The dot product of the two vectors. */
118SPAN_DECLARE(complexi32_t) cvec_circular_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n, int pos);
119
120SPAN_DECLARE(void) cvec_lmsi16(const complexi16_t x[], complexi16_t y[], int n, const complexi16_t *error);
121
122SPAN_DECLARE(void) cvec_circular_lmsi16(const complexi16_t x[], complexi16_t y[], int n, int pos, const complexi16_t *error);
123
124#if defined(__cplusplus)
125}
126#endif
127
128#endif
129/*- End of file ------------------------------------------------------------*/
cvec_dot_prodi32
complexi32_t cvec_dot_prodi32(const complexi32_t x[], const complexi32_t y[], int n)
Find the dot product of two complex int32_t vectors.
Definition complex_vector_int.c:68
cvec_dot_prodi16
complexi32_t cvec_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n)
Find the dot product of two complex int16_t vectors.
Definition complex_vector_int.c:53
cvec_circular_dot_prodi16
complexi32_t cvec_circular_dot_prodi16(const complexi16_t x[], const complexi16_t y[], int n, int pos)
Find the dot product of two complex int16_t vectors, where the first is a circular buffer with an off...
Definition complex_vector_int.c:83
complexi16_t
Definition complex.h:89
complexi32_t
Definition complex.h:100
complexi_t
Definition complex.h:78