-
-
Save rcombs/e5c55681a10f59ec192f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/libavutil/arm/intmath.h b/libavutil/arm/intmath.h | |
index 65e42c5..ef0889a 100644 | |
--- a/libavutil/arm/intmath.h | |
+++ b/libavutil/arm/intmath.h | |
@@ -73,9 +73,14 @@ static av_always_inline av_const int av_clip_intp2_arm(int a, int p) | |
#define av_clip_uintp2 av_clip_uintp2_arm | |
static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p) | |
{ | |
- unsigned x; | |
- __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p)); | |
- return x; | |
+ if (av_builtin_constant_p(p)) { | |
+ unsigned x; | |
+ __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p)); | |
+ return x; | |
+ } else { | |
+ if (a & ~((1<<p) - 1)) return -a >> 31 & ((1<<p) - 1); | |
+ else return a; | |
+ } | |
} | |
#define av_sat_add32 av_sat_add32_arm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment