summaryrefslogtreecommitdiff
path: root/apps/codecs/libwma/wmafixed.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libwma/wmafixed.h')
-rw-r--r--apps/codecs/libwma/wmafixed.h45
1 files changed, 6 insertions, 39 deletions
diff --git a/apps/codecs/libwma/wmafixed.h b/apps/codecs/libwma/wmafixed.h
index 6b5137e044..0ecdc5cfbc 100644
--- a/apps/codecs/libwma/wmafixed.h
+++ b/apps/codecs/libwma/wmafixed.h
@@ -52,10 +52,10 @@ fixed64 fixdiv64(fixed64 x, fixed64 y);
52fixed32 fixsqrt32(fixed32 x); 52fixed32 fixsqrt32(fixed32 x);
53long fsincos(unsigned long phase, fixed32 *cos); 53long fsincos(unsigned long phase, fixed32 *cos);
54 54
55
55#ifdef CPU_ARM 56#ifdef CPU_ARM
56 57
57/*Sign-15.16 format */ 58/*Sign-15.16 format */
58
59#define fixmul32(x, y) \ 59#define fixmul32(x, y) \
60 ({ int32_t __hi; \ 60 ({ int32_t __hi; \
61 uint32_t __lo; \ 61 uint32_t __lo; \
@@ -70,18 +70,6 @@ long fsincos(unsigned long phase, fixed32 *cos);
70 __result; \ 70 __result; \
71 }) 71 })
72 72
73#define fixmul32b(x, y) \
74 ({ int32_t __hi; \
75 uint32_t __lo; \
76 int32_t __result; \
77 asm ("smull %0, %1, %3, %4\n\t" \
78 "movs %2, %1, lsl #1" \
79 : "=&r" (__lo), "=&r" (__hi), "=r" (__result) \
80 : "%r" (x), "r" (y) \
81 : "cc"); \
82 __result; \
83 })
84
85#elif defined(CPU_COLDFIRE) 73#elif defined(CPU_COLDFIRE)
86 74
87static inline int32_t fixmul32(int32_t x, int32_t y) 75static inline int32_t fixmul32(int32_t x, int32_t y)
@@ -91,9 +79,9 @@ static inline int32_t fixmul32(int32_t x, int32_t y)
91#endif 79#endif
92 int32_t t1; 80 int32_t t1;
93 asm ( 81 asm (
94 "mac.l %[x], %[y], %%acc0 \n" /* multiply */ 82 "mac.l %[x], %[y], %%acc0 \n" // multiply
95 "mulu.l %[y], %[x] \n" /* get lower half, avoid emac stall */ 83 "mulu.l %[y], %[x] \n" // get lower half, avoid emac stall
96 "movclr.l %%acc0, %[t1] \n" /* get higher half */ 84 "movclr.l %%acc0, %[t1] \n" // get higher half
97 "lsr.l #1, %[t1] \n" 85 "lsr.l #1, %[t1] \n"
98 "move.w %[t1], %[x] \n" 86 "move.w %[t1], %[x] \n"
99 "swap %[x] \n" 87 "swap %[x] \n"
@@ -103,17 +91,6 @@ static inline int32_t fixmul32(int32_t x, int32_t y)
103 return x; 91 return x;
104} 92}
105 93
106static inline int32_t fixmul32b(int32_t x, int32_t y)
107{
108 asm (
109 "mac.l %[x], %[y], %%acc0 \n" /* multiply */
110 "movclr.l %%acc0, %[x] \n" /* get higher half */
111 : [x] "+d" (x)
112 : [y] "d" (y)
113 );
114 return x;
115}
116
117#else 94#else
118 95
119static inline fixed32 fixmul32(fixed32 x, fixed32 y) 96static inline fixed32 fixmul32(fixed32 x, fixed32 y)
@@ -127,17 +104,7 @@ static inline fixed32 fixmul32(fixed32 x, fixed32 y)
127 return (fixed32)temp; 104 return (fixed32)temp;
128} 105}
129 106
130static inline fixed32 fixmul32b(fixed32 x, fixed32 y)
131{
132 fixed64 temp;
133
134 temp = x;
135 temp *= y;
136
137 temp >>= 31; //16+31-16 = 31 bits
138
139 return (fixed32)temp;
140}
141
142#endif 107#endif
143 108
109
110/* get fixmul32b from codeclib */