diff options
Diffstat (limited to 'apps/codecs/libtremor/misc.h')
-rw-r--r-- | apps/codecs/libtremor/misc.h | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/apps/codecs/libtremor/misc.h b/apps/codecs/libtremor/misc.h index 39f67057ab..0b0ff4d3a7 100644 --- a/apps/codecs/libtremor/misc.h +++ b/apps/codecs/libtremor/misc.h | |||
@@ -22,6 +22,8 @@ | |||
22 | #include "ivorbiscodec.h" | 22 | #include "ivorbiscodec.h" |
23 | #include "os_types.h" | 23 | #include "os_types.h" |
24 | 24 | ||
25 | #include "codeclib_misc.h" | ||
26 | |||
25 | #include "asm_arm.h" | 27 | #include "asm_arm.h" |
26 | #include "asm_mcf5249.h" | 28 | #include "asm_mcf5249.h" |
27 | 29 | ||
@@ -37,7 +39,7 @@ extern int _ilog(unsigned int v); | |||
37 | #ifndef _LOW_ACCURACY_ | 39 | #ifndef _LOW_ACCURACY_ |
38 | /* 64 bit multiply */ | 40 | /* 64 bit multiply */ |
39 | /* #include <sys/types.h> */ | 41 | /* #include <sys/types.h> */ |
40 | 42 | #if 0 | |
41 | #if BYTE_ORDER==LITTLE_ENDIAN | 43 | #if BYTE_ORDER==LITTLE_ENDIAN |
42 | union magic { | 44 | union magic { |
43 | struct { | 45 | struct { |
@@ -70,7 +72,7 @@ static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) { | |||
70 | magic.whole = (ogg_int64_t)x * y; | 72 | magic.whole = (ogg_int64_t)x * y; |
71 | return ((ogg_uint32_t)(magic.halves.lo)>>15) | ((magic.halves.hi)<<17); | 73 | return ((ogg_uint32_t)(magic.halves.lo)>>15) | ((magic.halves.hi)<<17); |
72 | } | 74 | } |
73 | 75 | #endif | |
74 | #else | 76 | #else |
75 | /* 32 bit multiply, more portable but less accurate */ | 77 | /* 32 bit multiply, more portable but less accurate */ |
76 | 78 | ||
@@ -119,10 +121,11 @@ static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) { | |||
119 | 121 | ||
120 | /* replaced XPROD32 with a macro to avoid memory reference | 122 | /* replaced XPROD32 with a macro to avoid memory reference |
121 | _x, _y are the results (must be l-values) */ | 123 | _x, _y are the results (must be l-values) */ |
124 | /* | ||
122 | #define XPROD32(_a, _b, _t, _v, _x, _y) \ | 125 | #define XPROD32(_a, _b, _t, _v, _x, _y) \ |
123 | { (_x)=MULT32(_a,_t)+MULT32(_b,_v); \ | 126 | { (_x)=MULT32(_a,_t)+MULT32(_b,_v); \ |
124 | (_y)=MULT32(_b,_t)-MULT32(_a,_v); } | 127 | (_y)=MULT32(_b,_t)-MULT32(_a,_v); } |
125 | 128 | */ | |
126 | 129 | ||
127 | #ifdef __i386__ | 130 | #ifdef __i386__ |
128 | 131 | ||
@@ -134,7 +137,7 @@ static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) { | |||
134 | *(_y)=MULT31(_b,_t)+MULT31(_a,_v); } | 137 | *(_y)=MULT31(_b,_t)+MULT31(_a,_v); } |
135 | 138 | ||
136 | #else | 139 | #else |
137 | 140 | /* | |
138 | static inline void XPROD31(ogg_int32_t a, ogg_int32_t b, | 141 | static inline void XPROD31(ogg_int32_t a, ogg_int32_t b, |
139 | ogg_int32_t t, ogg_int32_t v, | 142 | ogg_int32_t t, ogg_int32_t v, |
140 | ogg_int32_t *x, ogg_int32_t *y) | 143 | ogg_int32_t *x, ogg_int32_t *y) |
@@ -150,8 +153,36 @@ static inline void XNPROD31(ogg_int32_t a, ogg_int32_t b, | |||
150 | *x = MULT31(a, t) - MULT31(b, v); | 153 | *x = MULT31(a, t) - MULT31(b, v); |
151 | *y = MULT31(b, t) + MULT31(a, v); | 154 | *y = MULT31(b, t) + MULT31(a, v); |
152 | } | 155 | } |
156 | */ | ||
157 | #endif | ||
158 | #ifndef _TREMOR_VECT_OPS | ||
159 | #define _TREMOR_VECT_OPS | ||
160 | static inline | ||
161 | void vect_add_left_right(ogg_int32_t *x, const ogg_int32_t *y, int n) | ||
162 | { | ||
163 | vect_add(x, y, n ); | ||
164 | } | ||
165 | |||
166 | static inline | ||
167 | void vect_add_right_left(ogg_int32_t *x, const ogg_int32_t *y, int n) | ||
168 | { | ||
169 | vect_add(x, y, n ); | ||
170 | } | ||
171 | |||
172 | static inline | ||
173 | void ogg_vect_mult_fw(int32_t *data, const int32_t *window, int n) | ||
174 | { | ||
175 | vect_mult_fw(data, window, n); | ||
176 | } | ||
177 | |||
178 | static inline | ||
179 | void ogg_vect_mult_bw(int32_t *data, const int32_t *window, int n) | ||
180 | { | ||
181 | vect_mult_bw(data, window, n); | ||
182 | } | ||
153 | #endif | 183 | #endif |
154 | 184 | ||
185 | #if 0 | ||
155 | #ifndef _V_VECT_OPS | 186 | #ifndef _V_VECT_OPS |
156 | #define _V_VECT_OPS | 187 | #define _V_VECT_OPS |
157 | 188 | ||
@@ -174,7 +205,7 @@ void vect_add_left_right(ogg_int32_t *x, const ogg_int32_t *y, int n) | |||
174 | } | 205 | } |
175 | 206 | ||
176 | static inline | 207 | static inline |
177 | void vect_mult_fw(ogg_int32_t *data, LOOKUP_T *window, int n) | 208 | void ogg_vect_mult_fw(ogg_int32_t *data, LOOKUP_T *window, int n) |
178 | { | 209 | { |
179 | while(n>0) { | 210 | while(n>0) { |
180 | *data = MULT31(*data, *window); | 211 | *data = MULT31(*data, *window); |
@@ -185,7 +216,7 @@ void vect_mult_fw(ogg_int32_t *data, LOOKUP_T *window, int n) | |||
185 | } | 216 | } |
186 | 217 | ||
187 | static inline | 218 | static inline |
188 | void vect_mult_bw(ogg_int32_t *data, LOOKUP_T *window, int n) | 219 | void ogg_vect_mult_bw(ogg_int32_t *data, LOOKUP_T *window, int n) |
189 | { | 220 | { |
190 | while(n>0) { | 221 | while(n>0) { |
191 | *data = MULT31(*data, *window); | 222 | *data = MULT31(*data, *window); |
@@ -202,8 +233,6 @@ static inline void vect_copy(ogg_int32_t *x, const ogg_int32_t *y, int n) | |||
202 | } | 233 | } |
203 | #endif | 234 | #endif |
204 | 235 | ||
205 | #endif | ||
206 | |||
207 | static inline ogg_int32_t VFLOAT_MULT(ogg_int32_t a,ogg_int32_t ap, | 236 | static inline ogg_int32_t VFLOAT_MULT(ogg_int32_t a,ogg_int32_t ap, |
208 | ogg_int32_t b,ogg_int32_t bp, | 237 | ogg_int32_t b,ogg_int32_t bp, |
209 | ogg_int32_t *p){ | 238 | ogg_int32_t *p){ |
@@ -218,7 +247,8 @@ static inline ogg_int32_t VFLOAT_MULT(ogg_int32_t a,ogg_int32_t ap, | |||
218 | }else | 247 | }else |
219 | return 0; | 248 | return 0; |
220 | } | 249 | } |
221 | 250 | #endif | |
251 | #endif | ||
222 | static inline ogg_int32_t VFLOAT_MULTI(ogg_int32_t a,ogg_int32_t ap, | 252 | static inline ogg_int32_t VFLOAT_MULTI(ogg_int32_t a,ogg_int32_t ap, |
223 | ogg_int32_t i, | 253 | ogg_int32_t i, |
224 | ogg_int32_t *p){ | 254 | ogg_int32_t *p){ |
@@ -226,7 +256,7 @@ static inline ogg_int32_t VFLOAT_MULTI(ogg_int32_t a,ogg_int32_t ap, | |||
226 | int ip=_ilog(abs(i))-31; | 256 | int ip=_ilog(abs(i))-31; |
227 | return VFLOAT_MULT(a,ap,i<<-ip,ip,p); | 257 | return VFLOAT_MULT(a,ap,i<<-ip,ip,p); |
228 | } | 258 | } |
229 | 259 | #if 0 | |
230 | static inline ogg_int32_t VFLOAT_ADD(ogg_int32_t a,ogg_int32_t ap, | 260 | static inline ogg_int32_t VFLOAT_ADD(ogg_int32_t a,ogg_int32_t ap, |
231 | ogg_int32_t b,ogg_int32_t bp, | 261 | ogg_int32_t b,ogg_int32_t bp, |
232 | ogg_int32_t *p){ | 262 | ogg_int32_t *p){ |
@@ -268,6 +298,6 @@ static inline ogg_int32_t VFLOAT_ADD(ogg_int32_t a,ogg_int32_t ap, | |||
268 | } | 298 | } |
269 | return(a); | 299 | return(a); |
270 | } | 300 | } |
271 | 301 | #endif | |
272 | #endif | 302 | #endif |
273 | 303 | ||