summaryrefslogtreecommitdiff
path: root/libavutil/arm/intmath.h
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2012-08-11 01:15:19 +0100
committerMans Rullgard <mans@mansr.com>2012-08-13 01:03:10 +0100
commit6c4975eaafd7f8f91e81ad8d6be744a434241fd3 (patch)
tree9edb4f8cc534f15a876d417ab310468e43f26c1c /libavutil/arm/intmath.h
parent17c11cef9f99d31e31dd9176ee2f26bdf6e5d351 (diff)
downloadffmpeg-6c4975eaafd7f8f91e81ad8d6be744a434241fd3.tar.gz
libavutil: add saturating addition functions
Fixed-point audio codecs often use saturating arithmetic, and special instructions for these operations are common. Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavutil/arm/intmath.h')
-rw-r--r--libavutil/arm/intmath.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavutil/arm/intmath.h b/libavutil/arm/intmath.h
index ce73404b37..d5a343c95f 100644
--- a/libavutil/arm/intmath.h
+++ b/libavutil/arm/intmath.h
@@ -83,6 +83,21 @@ static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p)
return x;
}
+#define av_sat_add32 av_sat_add32_arm
+static av_always_inline int av_sat_add32_arm(int a, int b)
+{
+ int r;
+ __asm__ ("qadd %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
+ return r;
+}
+
+#define av_sat_dadd32 av_sat_dadd32_arm
+static av_always_inline int av_sat_dadd32_arm(int a, int b)
+{
+ int r;
+ __asm__ ("qdadd %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
+ return r;
+}
#else /* HAVE_ARMV6 */