summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mathops.h9
-rw-r--r--libavcodec/x86/mathops.h12
2 files changed, 21 insertions, 0 deletions
diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index 4e24350ef2..5782459080 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -116,5 +116,14 @@ static inline av_const int sign_extend(int val, unsigned bits)
}
#endif
+#ifndef COPY3_IF_LT
+#define COPY3_IF_LT(x, y, a, b, c, d)\
+if ((y) < (x)) {\
+ (x) = (y);\
+ (a) = (b);\
+ (c) = (d);\
+}
+#endif
+
#endif /* AVCODEC_MATHOPS_H */
diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h
index a66c601878..691a200fd4 100644
--- a/libavcodec/x86/mathops.h
+++ b/libavcodec/x86/mathops.h
@@ -66,4 +66,16 @@ static inline av_const int mid_pred(int a, int b, int c)
}
#endif
+#if HAVE_CMOV
+#define COPY3_IF_LT(x, y, a, b, c, d)\
+__asm__ volatile(\
+ "cmpl %0, %3 \n\t"\
+ "cmovl %3, %0 \n\t"\
+ "cmovl %4, %1 \n\t"\
+ "cmovl %5, %2 \n\t"\
+ : "+&r" (x), "+&r" (a), "+r" (c)\
+ : "r" (y), "r" (b), "r" (d)\
+);
+#endif
+
#endif /* AVCODEC_X86_MATHOPS_H */