4 * Description: TTAv1 filter functions
5 * Developed by: Alexander Djourik <ald@true-audio.com>
6 * Pavel Zhilin <pzh@true-audio.com>
8 * Copyright (c) 2004 True Audio Software. All rights reserved.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 * 3. Neither the name of the True Audio Software nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 ///////// Filter Settings //////////
43 static int flt_set
[3] = {10, 9, 10};
46 int hybrid_filter(fltst
*fs
, int *in
); /* implements in filter_arm.S */
51 memshl (register int *pA
) {
52 register int *pB
= pA
+ 16;
65 hybrid_filter (fltst
*fs
, int *in
) {
66 register int *pA
= fs
->dl
+ fs
->index
;
67 register int *pB
= fs
->qm
;
68 register int *pM
= fs
->dx
+ fs
->index
;
69 register int sum
= fs
->round
;
81 } else if (fs
->error
< 0) {
82 sum
+= *pA
++ * (*pB
++ -= *pM
++);
83 sum
+= *pA
++ * (*pB
++ -= *pM
++);
84 sum
+= *pA
++ * (*pB
++ -= *pM
++);
85 sum
+= *pA
++ * (*pB
++ -= *pM
++);
86 sum
+= *pA
++ * (*pB
++ -= *pM
++);
87 sum
+= *pA
++ * (*pB
++ -= *pM
++);
88 sum
+= *pA
++ * (*pB
++ -= *pM
++);
89 sum
+= *pA
* (*pB
-= *pM
++);
91 sum
+= *pA
++ * (*pB
++ += *pM
++);
92 sum
+= *pA
++ * (*pB
++ += *pM
++);
93 sum
+= *pA
++ * (*pB
++ += *pM
++);
94 sum
+= *pA
++ * (*pB
++ += *pM
++);
95 sum
+= *pA
++ * (*pB
++ += *pM
++);
96 sum
+= *pA
++ * (*pB
++ += *pM
++);
97 sum
+= *pA
++ * (*pB
++ += *pM
++);
98 sum
+= *pA
* (*pB
+= *pM
++);
103 *in
+= (sum
>> fs
->shift
);
106 *pM
-- = ((*pB
-- >> 30) | 1) << 2;
107 *pM
-- = ((*pB
-- >> 30) | 1) << 1;
108 *pM
-- = ((*pB
-- >> 30) | 1) << 1;
109 *pM
= ((*pB
>> 30) | 1);
111 *(pA
-1) = *(pA
-0) - *(pA
-1);
112 *(pA
-2) = *(pA
-1) - *(pA
-2);
113 *(pA
-3) = *(pA
-2) - *(pA
-3);
117 * in order to make speed up, memshl() is executed at the rate once every 16 times.
119 if (++fs
->index
== 16)
129 filter_init (fltst
*fs
, int shift
) {
130 ci
->memset (fs
, 0, sizeof(fltst
));
132 fs
->round
= 1 << (shift
- 1);
136 #endif /* FILTER_H */