summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/codecs/lib/asm_arm.h103
-rw-r--r--apps/codecs/lib/asm_mcf5249.h6
-rw-r--r--apps/codecs/lib/codeclib_misc.h29
-rw-r--r--apps/codecs/libcook/cook_fixpoint.h2
4 files changed, 72 insertions, 68 deletions
diff --git a/apps/codecs/lib/asm_arm.h b/apps/codecs/lib/asm_arm.h
index 4f31f80c3e..627f4afd78 100644
--- a/apps/codecs/lib/asm_arm.h
+++ b/apps/codecs/lib/asm_arm.h
@@ -33,9 +33,9 @@ static inline int32_t MULT31(int32_t x, int32_t y) {
33 33
34static inline int32_t MULT31_SHIFT15(int32_t x, int32_t y) { 34static inline int32_t MULT31_SHIFT15(int32_t x, int32_t y) {
35 int lo,hi; 35 int lo,hi;
36 asm volatile("smull %0, %1, %2, %3\n\t" 36 asm volatile("smull %0, %1, %2, %3\n\t"
37 "movs %0, %0, lsr #15\n\t" 37 "movs %0, %0, lsr #15\n\t"
38 "adc %1, %0, %1, lsl #17\n\t" 38 "adc %1, %0, %1, lsl #17\n\t"
39 : "=&r"(lo),"=&r"(hi) 39 : "=&r"(lo),"=&r"(hi)
40 : "r"(x),"r"(y) 40 : "r"(x),"r"(y)
41 : "cc" ); 41 : "cc" );
@@ -45,43 +45,43 @@ static inline int32_t MULT31_SHIFT15(int32_t x, int32_t y) {
45#define XPROD32(a, b, t, v, x, y) \ 45#define XPROD32(a, b, t, v, x, y) \
46{ \ 46{ \
47 long l; \ 47 long l; \
48 asm( "smull %0, %1, %3, %5\n\t" \ 48 asm( "smull %0, %1, %3, %5\n\t" \
49 "rsb %2, %6, #0\n\t" \ 49 "rsb %2, %6, #0\n\t" \
50 "smlal %0, %1, %4, %6\n\t" \ 50 "smlal %0, %1, %4, %6\n\t" \
51 "smull %0, %2, %3, %2\n\t" \ 51 "smull %0, %2, %3, %2\n\t" \
52 "smlal %0, %2, %4, %5" \ 52 "smlal %0, %2, %4, %5" \
53 : "=&r" (l), "=&r" (x), "=&r" (y) \ 53 : "=&r" (l), "=&r" (x), "=&r" (y) \
54 : "r" ((a)), "r" ((b)), "r" ((t)), "r" ((v)) ); \ 54 : "r" ((a)), "r" ((b)), "r" ((t)), "r" ((v)) ); \
55} 55}
56 56
57static inline void XPROD31(int32_t a, int32_t b, 57static inline void XPROD31(int32_t a, int32_t b,
58 int32_t t, int32_t v, 58 int32_t t, int32_t v,
59 int32_t *x, int32_t *y) 59 int32_t *x, int32_t *y)
60{ 60{
61 int x1, y1, l; 61 int x1, y1, l;
62 asm( "smull %0, %1, %3, %5\n\t" 62 asm( "smull %0, %1, %3, %5\n\t"
63 "rsb %2, %6, #0\n\t" 63 "rsb %2, %6, #0\n\t"
64 "smlal %0, %1, %4, %6\n\t" 64 "smlal %0, %1, %4, %6\n\t"
65 "smull %0, %2, %3, %2\n\t" 65 "smull %0, %2, %3, %2\n\t"
66 "smlal %0, %2, %4, %5" 66 "smlal %0, %2, %4, %5"
67 : "=&r" (l), "=&r" (x1), "=&r" (y1) 67 : "=&r" (l), "=&r" (x1), "=&r" (y1)
68 : "r" (a), "r" (b), "r" (t), "r" (v) ); 68 : "r" (a), "r" (b), "r" (t), "r" (v) );
69 *x = x1 << 1; 69 *x = x1 << 1;
70 *y = y1 << 1; 70 *y = y1 << 1;
71} 71}
72 72
73static inline void XNPROD31(int32_t a, int32_t b, 73static inline void XNPROD31(int32_t a, int32_t b,
74 int32_t t, int32_t v, 74 int32_t t, int32_t v,
75 int32_t *x, int32_t *y) 75 int32_t *x, int32_t *y)
76{ 76{
77 int x1, y1, l; 77 int x1, y1, l;
78 asm( "smull %0, %1, %3, %5\n\t" 78 asm( "smull %0, %1, %3, %5\n\t"
79 "rsb %2, %4, #0\n\t" 79 "rsb %2, %4, #0\n\t"
80 "smlal %0, %1, %2, %6\n\t" 80 "smlal %0, %1, %2, %6\n\t"
81 "smull %0, %2, %4, %5\n\t" 81 "smull %0, %2, %4, %5\n\t"
82 "smlal %0, %2, %3, %6" 82 "smlal %0, %2, %3, %6"
83 : "=&r" (l), "=&r" (x1), "=&r" (y1) 83 : "=&r" (l), "=&r" (x1), "=&r" (y1)
84 : "r" (a), "r" (b), "r" (t), "r" (v) ); 84 : "r" (a), "r" (b), "r" (t), "r" (v) );
85 *x = x1 << 1; 85 *x = x1 << 1;
86 *y = y1 << 1; 86 *y = y1 << 1;
87} 87}
@@ -89,13 +89,13 @@ static inline void XNPROD31(int32_t a, int32_t b,
89#define XPROD31_R(_a, _b, _t, _v, _x, _y)\ 89#define XPROD31_R(_a, _b, _t, _v, _x, _y)\
90{\ 90{\
91 int x1, y1, l;\ 91 int x1, y1, l;\
92 asm( "smull %0, %1, %5, %3\n\t"\ 92 asm( "smull %0, %1, %5, %3\n\t"\
93 "rsb %2, %3, #0\n\t"\ 93 "rsb %2, %3, #0\n\t"\
94 "smlal %0, %1, %6, %4\n\t"\ 94 "smlal %0, %1, %6, %4\n\t"\
95 "smull %0, %2, %6, %2\n\t"\ 95 "smull %0, %2, %6, %2\n\t"\
96 "smlal %0, %2, %5, %4"\ 96 "smlal %0, %2, %5, %4"\
97 : "=&r" (l), "=&r" (x1), "=&r" (y1)\ 97 : "=&r" (l), "=&r" (x1), "=&r" (y1)\
98 : "r" (_a), "r" (_b), "r" (_t), "r" (_v) );\ 98 : "r" (_a), "r" (_b), "r" (_t), "r" (_v) );\
99 _x = x1 << 1;\ 99 _x = x1 << 1;\
100 _y = y1 << 1;\ 100 _y = y1 << 1;\
101} 101}
@@ -103,13 +103,13 @@ static inline void XNPROD31(int32_t a, int32_t b,
103#define XNPROD31_R(_a, _b, _t, _v, _x, _y)\ 103#define XNPROD31_R(_a, _b, _t, _v, _x, _y)\
104{\ 104{\
105 int x1, y1, l;\ 105 int x1, y1, l;\
106 asm( "smull %0, %1, %5, %3\n\t"\ 106 asm( "smull %0, %1, %5, %3\n\t"\
107 "rsb %2, %4, #0\n\t"\ 107 "rsb %2, %4, #0\n\t"\
108 "smlal %0, %1, %6, %2\n\t"\ 108 "smlal %0, %1, %6, %2\n\t"\
109 "smull %0, %2, %5, %4\n\t"\ 109 "smull %0, %2, %5, %4\n\t"\
110 "smlal %0, %2, %6, %3"\ 110 "smlal %0, %2, %6, %3"\
111 : "=&r" (l), "=&r" (x1), "=&r" (y1)\ 111 : "=&r" (l), "=&r" (x1), "=&r" (y1)\
112 : "r" (_a), "r" (_b), "r" (_t), "r" (_v) );\ 112 : "r" (_a), "r" (_b), "r" (_t), "r" (_v) );\
113 _x = x1 << 1;\ 113 _x = x1 << 1;\
114 _y = y1 << 1;\ 114 _y = y1 << 1;\
115} 115}
@@ -221,25 +221,26 @@ void vect_mult_bw(int32_t *data, int32_t *window, int n)
221#endif 221#endif
222 222
223#endif 223#endif
224 224/* not used anymore */
225/*
225#ifndef _V_CLIP_MATH 226#ifndef _V_CLIP_MATH
226#define _V_CLIP_MATH 227#define _V_CLIP_MATH
227 228
228static inline int32_t CLIP_TO_15(int32_t x) { 229static inline int32_t CLIP_TO_15(int32_t x) {
229 int tmp; 230 int tmp;
230 asm volatile("subs %1, %0, #32768\n\t" 231 asm volatile("subs %1, %0, #32768\n\t"
231 "movpl %0, #0x7f00\n\t" 232 "movpl %0, #0x7f00\n\t"
232 "orrpl %0, %0, #0xff\n" 233 "orrpl %0, %0, #0xff\n"
233 "adds %1, %0, #32768\n\t" 234 "adds %1, %0, #32768\n\t"
234 "movmi %0, #0x8000" 235 "movmi %0, #0x8000"
235 : "+r"(x),"=r"(tmp) 236 : "+r"(x),"=r"(tmp)
236 : 237 :
237 : "cc"); 238 : "cc");
238 return(x); 239 return(x);
239} 240}
240 241
241#endif 242#endif
242 243*/
243#ifndef _V_LSP_MATH_ASM 244#ifndef _V_LSP_MATH_ASM
244#define _V_LSP_MATH_ASM 245#define _V_LSP_MATH_ASM
245 246
diff --git a/apps/codecs/lib/asm_mcf5249.h b/apps/codecs/lib/asm_mcf5249.h
index 2888f6dc54..f103e78769 100644
--- a/apps/codecs/lib/asm_mcf5249.h
+++ b/apps/codecs/lib/asm_mcf5249.h
@@ -325,17 +325,19 @@ void vect_mult_bw(int32_t *data, int32_t *window, int n)
325#endif 325#endif
326 326
327#endif 327#endif
328 328/* not used anymore */
329/*
329#ifndef _V_CLIP_MATH 330#ifndef _V_CLIP_MATH
330#define _V_CLIP_MATH 331#define _V_CLIP_MATH
331 332
332/* this is portable C and simple; why not use this as default? */ 333* this is portable C and simple; why not use this as default?
333static inline int32_t CLIP_TO_15(register int32_t x) { 334static inline int32_t CLIP_TO_15(register int32_t x) {
334 register int32_t hi=32767, lo=-32768; 335 register int32_t hi=32767, lo=-32768;
335 return (x>=hi ? hi : (x<=lo ? lo : x)); 336 return (x>=hi ? hi : (x<=lo ? lo : x));
336} 337}
337 338
338#endif 339#endif
340*/
339#else 341#else
340#define LINE_ATTR 342#define LINE_ATTR
341#endif 343#endif
diff --git a/apps/codecs/lib/codeclib_misc.h b/apps/codecs/lib/codeclib_misc.h
index 6749231ebb..0d560755d7 100644
--- a/apps/codecs/lib/codeclib_misc.h
+++ b/apps/codecs/lib/codeclib_misc.h
@@ -116,18 +116,18 @@ static inline int32_t MULT31_SHIFT15(int32_t x, int32_t y) {
116 116
117/* replaced XPROD32 with a macro to avoid memory reference 117/* replaced XPROD32 with a macro to avoid memory reference
118 _x, _y are the results (must be l-values) */ 118 _x, _y are the results (must be l-values) */
119#define XPROD32(_a, _b, _t, _v, _x, _y) \ 119#define XPROD32(_a, _b, _t, _v, _x, _y) \
120 { (_x)=MULT32(_a,_t)+MULT32(_b,_v); \ 120 { (_x)=MULT32(_a,_t)+MULT32(_b,_v); \
121 (_y)=MULT32(_b,_t)-MULT32(_a,_v); } 121 (_y)=MULT32(_b,_t)-MULT32(_a,_v); }
122 122
123 123
124#ifdef __i386__ 124#ifdef __i386__
125 125
126#define XPROD31(_a, _b, _t, _v, _x, _y) \ 126#define XPROD31(_a, _b, _t, _v, _x, _y) \
127 { *(_x)=MULT31(_a,_t)+MULT31(_b,_v); \ 127 { *(_x)=MULT31(_a,_t)+MULT31(_b,_v); \
128 *(_y)=MULT31(_b,_t)-MULT31(_a,_v); } 128 *(_y)=MULT31(_b,_t)-MULT31(_a,_v); }
129#define XNPROD31(_a, _b, _t, _v, _x, _y) \ 129#define XNPROD31(_a, _b, _t, _v, _x, _y) \
130 { *(_x)=MULT31(_a,_t)-MULT31(_b,_v); \ 130 { *(_x)=MULT31(_a,_t)-MULT31(_b,_v); \
131 *(_y)=MULT31(_b,_t)+MULT31(_a,_v); } 131 *(_y)=MULT31(_b,_t)+MULT31(_a,_v); }
132 132
133#else 133#else
@@ -207,7 +207,8 @@ void vect_mult_bw(int32_t *data, int32_t *window, int n)
207#endif 207#endif
208 208
209#endif 209#endif
210 210/* not used anymore */
211/*
211#ifndef _V_CLIP_MATH 212#ifndef _V_CLIP_MATH
212#define _V_CLIP_MATH 213#define _V_CLIP_MATH
213 214
@@ -219,10 +220,10 @@ static inline int32_t CLIP_TO_15(int32_t x) {
219} 220}
220 221
221#endif 222#endif
222 223*/
223static inline int32_t VFLOAT_MULT(int32_t a,int32_t ap, 224static inline int32_t VFLOAT_MULT(int32_t a,int32_t ap,
224 int32_t b,int32_t bp, 225 int32_t b,int32_t bp,
225 int32_t *p){ 226 int32_t *p){
226 if(a && b){ 227 if(a && b){
227#ifndef _LOW_ACCURACY_ 228#ifndef _LOW_ACCURACY_
228 *p=ap+bp+32; 229 *p=ap+bp+32;
@@ -236,16 +237,16 @@ static inline int32_t VFLOAT_MULT(int32_t a,int32_t ap,
236} 237}
237 238
238/*static inline int32_t VFLOAT_MULTI(int32_t a,int32_t ap, 239/*static inline int32_t VFLOAT_MULTI(int32_t a,int32_t ap,
239 int32_t i, 240 int32_t i,
240 int32_t *p){ 241 int32_t *p){
241 242
242 int ip=_ilog(abs(i))-31; 243 int ip=_ilog(abs(i))-31;
243 return VFLOAT_MULT(a,ap,i<<-ip,ip,p); 244 return VFLOAT_MULT(a,ap,i<<-ip,ip,p);
244} 245}
245*/ 246*/
246static inline int32_t VFLOAT_ADD(int32_t a,int32_t ap, 247static inline int32_t VFLOAT_ADD(int32_t a,int32_t ap,
247 int32_t b,int32_t bp, 248 int32_t b,int32_t bp,
248 int32_t *p){ 249 int32_t *p){
249 250
250 if(!a){ 251 if(!a){
251 *p=bp; 252 *p=bp;
diff --git a/apps/codecs/libcook/cook_fixpoint.h b/apps/codecs/libcook/cook_fixpoint.h
index 1d8b3ffa2f..faa86dc77a 100644
--- a/apps/codecs/libcook/cook_fixpoint.h
+++ b/apps/codecs/libcook/cook_fixpoint.h
@@ -36,7 +36,7 @@
36 */ 36 */
37 37
38#ifdef ROCKBOX 38#ifdef ROCKBOX
39/* get definitions of MULT31, MULT31_SHIFT15, CLIP_TO_15, vect_add, from codelib */ 39/* get definitions of MULT31, MULT31_SHIFT15, vect_add, from codelib */
40#include "asm_arm.h" 40#include "asm_arm.h"
41#include "asm_mcf5249.h" 41#include "asm_mcf5249.h"
42#include "codeclib_misc.h" 42#include "codeclib_misc.h"