diff options
author | Sean Bartell <wingedtachikoma@gmail.com> | 2011-06-25 21:32:25 -0400 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2012-04-25 22:13:20 +0200 |
commit | f40bfc9267b13b54e6379dfe7539447662879d24 (patch) | |
tree | 9b20069d5e62809ff434061ad730096836f916f2 /lib/rbcodec/codecs/demac/libdemac/vector_math_generic.h | |
parent | a0009907de7a0107d49040d8a180f140e2eff299 (diff) | |
download | rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.tar.gz rockbox-f40bfc9267b13b54e6379dfe7539447662879d24.zip |
Add codecs to librbcodec.
Change-Id: Id7f4717d51ed02d67cb9f9cb3c0ada4a81843f97
Reviewed-on: http://gerrit.rockbox.org/137
Reviewed-by: Nils Wallménius <nils@rockbox.org>
Tested-by: Nils Wallménius <nils@rockbox.org>
Diffstat (limited to 'lib/rbcodec/codecs/demac/libdemac/vector_math_generic.h')
-rw-r--r-- | lib/rbcodec/codecs/demac/libdemac/vector_math_generic.h | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/demac/libdemac/vector_math_generic.h b/lib/rbcodec/codecs/demac/libdemac/vector_math_generic.h new file mode 100644 index 0000000000..00bf07a007 --- /dev/null +++ b/lib/rbcodec/codecs/demac/libdemac/vector_math_generic.h | |||
@@ -0,0 +1,160 @@ | |||
1 | /* | ||
2 | |||
3 | libdemac - A Monkey's Audio decoder | ||
4 | |||
5 | $Id$ | ||
6 | |||
7 | Copyright (C) Dave Chapman 2007 | ||
8 | |||
9 | This program is free software; you can redistribute it and/or modify | ||
10 | it under the terms of the GNU General Public License as published by | ||
11 | the Free Software Foundation; either version 2 of the License, or | ||
12 | (at your option) any later version. | ||
13 | |||
14 | This program is distributed in the hope that it will be useful, | ||
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | GNU General Public License for more details. | ||
18 | |||
19 | You should have received a copy of the GNU General Public License | ||
20 | along with this program; if not, write to the Free Software | ||
21 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA | ||
22 | |||
23 | */ | ||
24 | |||
25 | #include "demac_config.h" | ||
26 | |||
27 | static inline void vector_add(filter_int* v1, filter_int* v2) | ||
28 | { | ||
29 | #if ORDER > 32 | ||
30 | int order = (ORDER >> 5); | ||
31 | while (order--) | ||
32 | #endif | ||
33 | { | ||
34 | *v1++ += *v2++; | ||
35 | *v1++ += *v2++; | ||
36 | *v1++ += *v2++; | ||
37 | *v1++ += *v2++; | ||
38 | *v1++ += *v2++; | ||
39 | *v1++ += *v2++; | ||
40 | *v1++ += *v2++; | ||
41 | *v1++ += *v2++; | ||
42 | *v1++ += *v2++; | ||
43 | *v1++ += *v2++; | ||
44 | *v1++ += *v2++; | ||
45 | *v1++ += *v2++; | ||
46 | *v1++ += *v2++; | ||
47 | *v1++ += *v2++; | ||
48 | *v1++ += *v2++; | ||
49 | *v1++ += *v2++; | ||
50 | #if ORDER > 16 | ||
51 | *v1++ += *v2++; | ||
52 | *v1++ += *v2++; | ||
53 | *v1++ += *v2++; | ||
54 | *v1++ += *v2++; | ||
55 | *v1++ += *v2++; | ||
56 | *v1++ += *v2++; | ||
57 | *v1++ += *v2++; | ||
58 | *v1++ += *v2++; | ||
59 | *v1++ += *v2++; | ||
60 | *v1++ += *v2++; | ||
61 | *v1++ += *v2++; | ||
62 | *v1++ += *v2++; | ||
63 | *v1++ += *v2++; | ||
64 | *v1++ += *v2++; | ||
65 | *v1++ += *v2++; | ||
66 | *v1++ += *v2++; | ||
67 | #endif | ||
68 | } | ||
69 | } | ||
70 | |||
71 | static inline void vector_sub(filter_int* v1, filter_int* v2) | ||
72 | { | ||
73 | #if ORDER > 32 | ||
74 | int order = (ORDER >> 5); | ||
75 | while (order--) | ||
76 | #endif | ||
77 | { | ||
78 | *v1++ -= *v2++; | ||
79 | *v1++ -= *v2++; | ||
80 | *v1++ -= *v2++; | ||
81 | *v1++ -= *v2++; | ||
82 | *v1++ -= *v2++; | ||
83 | *v1++ -= *v2++; | ||
84 | *v1++ -= *v2++; | ||
85 | *v1++ -= *v2++; | ||
86 | *v1++ -= *v2++; | ||
87 | *v1++ -= *v2++; | ||
88 | *v1++ -= *v2++; | ||
89 | *v1++ -= *v2++; | ||
90 | *v1++ -= *v2++; | ||
91 | *v1++ -= *v2++; | ||
92 | *v1++ -= *v2++; | ||
93 | *v1++ -= *v2++; | ||
94 | #if ORDER > 16 | ||
95 | *v1++ -= *v2++; | ||
96 | *v1++ -= *v2++; | ||
97 | *v1++ -= *v2++; | ||
98 | *v1++ -= *v2++; | ||
99 | *v1++ -= *v2++; | ||
100 | *v1++ -= *v2++; | ||
101 | *v1++ -= *v2++; | ||
102 | *v1++ -= *v2++; | ||
103 | *v1++ -= *v2++; | ||
104 | *v1++ -= *v2++; | ||
105 | *v1++ -= *v2++; | ||
106 | *v1++ -= *v2++; | ||
107 | *v1++ -= *v2++; | ||
108 | *v1++ -= *v2++; | ||
109 | *v1++ -= *v2++; | ||
110 | *v1++ -= *v2++; | ||
111 | #endif | ||
112 | } | ||
113 | } | ||
114 | |||
115 | static inline int32_t scalarproduct(filter_int* v1, filter_int* v2) | ||
116 | { | ||
117 | int res = 0; | ||
118 | |||
119 | #if ORDER > 32 | ||
120 | int order = (ORDER >> 5); | ||
121 | while (order--) | ||
122 | #endif | ||
123 | { | ||
124 | res += *v1++ * *v2++; | ||
125 | res += *v1++ * *v2++; | ||
126 | res += *v1++ * *v2++; | ||
127 | res += *v1++ * *v2++; | ||
128 | res += *v1++ * *v2++; | ||
129 | res += *v1++ * *v2++; | ||
130 | res += *v1++ * *v2++; | ||
131 | res += *v1++ * *v2++; | ||
132 | res += *v1++ * *v2++; | ||
133 | res += *v1++ * *v2++; | ||
134 | res += *v1++ * *v2++; | ||
135 | res += *v1++ * *v2++; | ||
136 | res += *v1++ * *v2++; | ||
137 | res += *v1++ * *v2++; | ||
138 | res += *v1++ * *v2++; | ||
139 | res += *v1++ * *v2++; | ||
140 | #if ORDER > 16 | ||
141 | res += *v1++ * *v2++; | ||
142 | res += *v1++ * *v2++; | ||
143 | res += *v1++ * *v2++; | ||
144 | res += *v1++ * *v2++; | ||
145 | res += *v1++ * *v2++; | ||
146 | res += *v1++ * *v2++; | ||
147 | res += *v1++ * *v2++; | ||
148 | res += *v1++ * *v2++; | ||
149 | res += *v1++ * *v2++; | ||
150 | res += *v1++ * *v2++; | ||
151 | res += *v1++ * *v2++; | ||
152 | res += *v1++ * *v2++; | ||
153 | res += *v1++ * *v2++; | ||
154 | res += *v1++ * *v2++; | ||
155 | res += *v1++ * *v2++; | ||
156 | res += *v1++ * *v2++; | ||
157 | #endif | ||
158 | } | ||
159 | return res; | ||
160 | } | ||