diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/codecs/lib/codeclib.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/codecs/lib/codeclib.h b/apps/codecs/lib/codeclib.h index f4fe0a9ea0..4f30b306e3 100644 --- a/apps/codecs/lib/codeclib.h +++ b/apps/codecs/lib/codeclib.h | |||
@@ -76,12 +76,24 @@ unsigned udiv32_arm(unsigned a, unsigned b); | |||
76 | 76 | ||
77 | /* TODO figure out if we really need to care about calculating | 77 | /* TODO figure out if we really need to care about calculating |
78 | av_log2(0) */ | 78 | av_log2(0) */ |
79 | #if (defined(CPU_ARM) && (ARM_ARCH > 4)) | 79 | #ifdef CPU_ARM |
80 | #if ARM_ARCH > 5 | ||
81 | static inline unsigned int av_log2(uint32_t v) | ||
82 | { | ||
83 | unsigned int r; | ||
84 | asm volatile("clz %[r], %[v]\n\t" /* count leading zeroes */ | ||
85 | "rsb %[r], %[r], #31\n\t" /* r = 31 - leading zeroes */ | ||
86 | "usat %[r], #5, %[r]\n\t" /* unsigned saturate r so -1 -> 0 */ | ||
87 | :[r] "=r" (r) : [v] "r" (v)); | ||
88 | return(r); | ||
89 | } | ||
90 | #elif ARM_ARCH > 4 | ||
80 | static inline unsigned int av_log2(uint32_t v) | 91 | static inline unsigned int av_log2(uint32_t v) |
81 | { | 92 | { |
82 | return v ? 31 - __builtin_clz(v) : 0; | 93 | return v ? 31 - __builtin_clz(v) : 0; |
83 | } | 94 | } |
84 | #else | 95 | #endif |
96 | #else /* CPU_ARM */ | ||
85 | /* From libavutil/common.h */ | 97 | /* From libavutil/common.h */ |
86 | extern const uint8_t ff_log2_tab[256] ICONST_ATTR; | 98 | extern const uint8_t ff_log2_tab[256] ICONST_ATTR; |
87 | 99 | ||