summaryrefslogtreecommitdiff
path: root/apps/codecs
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs')
-rw-r--r--apps/codecs/libwmapro/wmapro_math.h47
1 files changed, 22 insertions, 25 deletions
diff --git a/apps/codecs/libwmapro/wmapro_math.h b/apps/codecs/libwmapro/wmapro_math.h
index 30b9a987ee..5220560998 100644
--- a/apps/codecs/libwmapro/wmapro_math.h
+++ b/apps/codecs/libwmapro/wmapro_math.h
@@ -95,37 +95,34 @@
95 /* Calculates: result = (X*Y)>>16 */ 95 /* Calculates: result = (X*Y)>>16 */
96 #define fixmul16(X,Y) \ 96 #define fixmul16(X,Y) \
97 ({ \ 97 ({ \
98 int32_t t1, t2; \ 98 int32_t t, x = (X); \
99 asm volatile ( \ 99 asm volatile ( \
100 "mac.l %[x],%[y],%%acc0\n\t" /* multiply */ \ 100 "mac.l %[x],%[y],%%acc0\n\t" /* multiply */ \
101 "mulu.l %[y],%[x] \n\t" /* get lower half, avoid emac stall */ \ 101 "mulu.l %[y],%[x] \n\t" /* get lower half, avoid emac stall */ \
102 "movclr.l %%acc0,%[t1] \n\t" /* get higher half */ \ 102 "movclr.l %%acc0,%[t] \n\t" /* get higher half */ \
103 "moveq.l #15,%[t2] \n\t" \ 103 "lsr.l #1,%[t] \n\t" /* hi >>= 1 to compensate emac shift */ \
104 "asl.l %[t2],%[t1] \n\t" /* hi <<= 15, plus one free */ \ 104 "move.w %[t],%[x] \n\t" /* combine halfwords */\
105 "moveq.l #16,%[t2] \n\t" \ 105 "swap %[x] \n\t" \
106 "lsr.l %[t2],%[x] \n\t" /* (unsigned)lo >>= 16 */ \ 106 : [t]"=&d"(t), [x] "+d" (x) \
107 "or.l %[x],%[t1] \n\t" /* combine result */ \ 107 : [y] "d" ((Y))); \
108 : [t1]"=&d"(t1), [t2]"=&d"(t2) \ 108 x; \
109 : [x] "d" ((X)), [y] "d" ((Y))); \
110 t1; \
111 }) 109 })
112 110
113 /* Calculates: result = (X*Y)>>24 */ 111 /* Calculates: result = (X*Y)>>24 */
114 #define fixmul24(X,Y) \ 112 #define fixmul24(X,Y) \
115 ({ \ 113 ({ \
116 int32_t t1, t2; \ 114 int32_t t, x = (X); \
117 asm volatile ( \ 115 asm volatile ( \
118 "mac.l %[x],%[y],%%acc0\n\t" /* multiply */ \ 116 "mac.l %[x],%[y],%%acc0\n\t" /* multiply */ \
119 "mulu.l %[y],%[x] \n\t" /* get lower half, avoid emac stall */ \ 117 "mulu.l %[y],%[x] \n\t" /* get lower half, avoid emac stall */ \
120 "movclr.l %%acc0,%[t1] \n\t" /* get higher half */ \ 118 "moveq.l #24,%[t] \n\t" \
121 "moveq.l #7,%[t2] \n\t" \ 119 "lsr.l %[t],%[x] \n\t" /* (unsigned)lo >>= 24 */ \
122 "asl.l %[t2],%[t1] \n\t" /* hi <<= 7, plus one free */ \ 120 "movclr.l %%acc0,%[t] \n\t" /* get higher half */ \
123 "moveq.l #24,%[t2] \n\t" \ 121 "asl.l #7,%[t] \n\t" /* hi <<= 7, plus one free */ \
124 "lsr.l %[t2],%[x] \n\t" /* (unsigned)lo >>= 24 */ \ 122 "or.l %[x],%[t] \n\t" /* combine result */ \
125 "or.l %[x],%[t1] \n\t" /* combine result */ \ 123 : [t]"=&d"(t), [x] "+d" (x) \
126 : [t1]"=&d"(t1), [t2]"=&d"(t2) \ 124 : [y] "d" ((Y))); \
127 : [x] "d" ((X)), [y] "d" ((Y))); \ 125 t; \
128 t1; \
129 }) 126 })
130 127
131 /* Calculates: result = (X*Y)>>32 */ 128 /* Calculates: result = (X*Y)>>32 */
@@ -239,7 +236,7 @@ static inline void vector_fixmul_scalar(int32_t *dst, const int32_t *src,
239{ 236{
240 int i; 237 int i;
241 for(i=0; i<len; i++) 238 for(i=0; i<len; i++)
242 dst[i] = fixmul24(src[i], mul); 239 dst[i] = fixmul24(src[i], mul);
243} 240}
244 241
245static inline int av_clip(int a, int amin, int amax) 242static inline int av_clip(int a, int amin, int amax)