Revision 75fb5c24 libavutil/internal.h
libavutil/internal.h | ||
---|---|---|
120 | 120 |
|
121 | 121 |
/* math */ |
122 | 122 |
|
123 |
extern const uint32_t ff_inverse[257]; |
|
124 |
|
|
125 |
#if ARCH_X86 |
|
126 |
# define FASTDIV(a,b) \ |
|
127 |
({\ |
|
128 |
int ret, dmy;\ |
|
129 |
__asm__ volatile(\ |
|
130 |
"mull %3"\ |
|
131 |
:"=d"(ret), "=a"(dmy)\ |
|
132 |
:"1"(a), "g"(ff_inverse[b])\ |
|
133 |
);\ |
|
134 |
ret;\ |
|
135 |
}) |
|
136 |
#elif HAVE_ARMV6 && HAVE_INLINE_ASM |
|
137 |
static inline av_const int FASTDIV(int a, int b) |
|
138 |
{ |
|
139 |
int r, t; |
|
140 |
__asm__ volatile("cmp %3, #2 \n\t" |
|
141 |
"ldr %1, [%4, %3, lsl #2] \n\t" |
|
142 |
"lsrle %0, %2, #1 \n\t" |
|
143 |
"smmulgt %0, %1, %2 \n\t" |
|
144 |
: "=&r"(r), "=&r"(t) : "r"(a), "r"(b), "r"(ff_inverse)); |
|
145 |
return r; |
|
146 |
} |
|
147 |
#elif ARCH_ARM && HAVE_INLINE_ASM |
|
148 |
static inline av_const int FASTDIV(int a, int b) |
|
149 |
{ |
|
150 |
int r, t; |
|
151 |
__asm__ volatile("umull %1, %0, %2, %3" |
|
152 |
: "=&r"(r), "=&r"(t) : "r"(a), "r"(ff_inverse[b])); |
|
153 |
return r; |
|
154 |
} |
|
155 |
#elif CONFIG_FASTDIV |
|
156 |
# define FASTDIV(a,b) ((uint32_t)((((uint64_t)a) * ff_inverse[b]) >> 32)) |
|
157 |
#else |
|
158 |
# define FASTDIV(a,b) ((a) / (b)) |
|
159 |
#endif |
|
160 |
|
|
161 | 123 |
extern const uint8_t ff_sqrt_tab[256]; |
162 | 124 |
|
163 | 125 |
static inline av_const unsigned int ff_sqrt(unsigned int a) |
Also available in: Unified diff