```/* <![CDATA[ */
function get_sym_list(){return [["Macro","xm",[["UNUSED",28]]],["Function","xf",[["Convolve",30]]]];} /* ]]> */1/*
2 ** Copyright 2003-2010, VisualOn, Inc.
3 **
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
9 **
10 ** Unless required by applicable law or agreed to in writing, software
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16
17/***********************************************************************
18       File: convolve.c
19
20	   Description:Perform the convolution between two vectors x[] and h[]
21	               and write the result in the vector y[]
22
23************************************************************************/
24
25#include "typedef.h"
26#include "basic_op.h"
27
28#define UNUSED(x) (void)(x)
29
30void Convolve (
31		Word16 x[],        /* (i)     : input vector                           */
32		Word16 h[],        /* (i)     : impulse response                       */
33		Word16 y[],        /* (o)     : output vector                          */
34		Word16 L           /* (i)     : vector size                            */
35	      )
36{
37	Word32  i, n;
38	Word16 *tmpH,*tmpX;
39	Word32 s;
40        UNUSED(L);
41
42	for (n = 0; n < 64;)
43	{
44		tmpH = h+n;
45		tmpX = x;
46		i=n+1;
47		s = vo_mult32((*tmpX++), (*tmpH--));i--;
48		while(i>0)
49		{
50			s += vo_mult32((*tmpX++), (*tmpH--));
51			s += vo_mult32((*tmpX++), (*tmpH--));
52			s += vo_mult32((*tmpX++), (*tmpH--));
53			s += vo_mult32((*tmpX++), (*tmpH--));
54			i -= 4;
55		}
56		y[n] = ((s<<1) + 0x8000)>>16;
57		n++;
58
59		tmpH = h+n;
60		tmpX = x;
61		i=n+1;
62		s =  vo_mult32((*tmpX++), (*tmpH--));i--;
63		s += vo_mult32((*tmpX++), (*tmpH--));i--;
64
65		while(i>0)
66		{
67			s += vo_mult32((*tmpX++), (*tmpH--));
68			s += vo_mult32((*tmpX++), (*tmpH--));
69			s += vo_mult32((*tmpX++), (*tmpH--));
70			s += vo_mult32((*tmpX++), (*tmpH--));
71			i -= 4;
72		}
73		y[n] = ((s<<1) + 0x8000)>>16;
74		n++;
75
76		tmpH = h+n;
77		tmpX = x;
78		i=n+1;
79		s =  vo_mult32((*tmpX++), (*tmpH--));i--;
80		s += vo_mult32((*tmpX++), (*tmpH--));i--;
81		s += vo_mult32((*tmpX++), (*tmpH--));i--;
82
83		while(i>0)
84		{
85			s += vo_mult32((*tmpX++), (*tmpH--));
86			s += vo_mult32((*tmpX++), (*tmpH--));
87			s += vo_mult32((*tmpX++), (*tmpH--));
88			s += vo_mult32((*tmpX++), (*tmpH--));
89			i -= 4;
90		}
91		y[n] = ((s<<1) + 0x8000)>>16;
92		n++;
93
94		s = 0;
95		tmpH = h+n;
96		tmpX = x;
97		i=n+1;
98		while(i>0)
99		{
100			s += vo_mult32((*tmpX++), (*tmpH--));
101			s += vo_mult32((*tmpX++), (*tmpH--));
102			s += vo_mult32((*tmpX++), (*tmpH--));
103			s += vo_mult32((*tmpX++), (*tmpH--));
104			i -= 4;
105		}
106		y[n] = ((s<<1) + 0x8000)>>16;
107		n++;
108	}
109	return;
110}
111
112
113
114```