summaryrefslogtreecommitdiffstats
path: root/third_party/aom/av1/common/clpf_simd.h
diff options
context:
space:
mode:
authortrav90 <travawine@palemoon.org>2018-10-18 21:53:44 -0500
committertrav90 <travawine@palemoon.org>2018-10-18 21:53:44 -0500
commitec910d81405c736a4490383a250299a7837c2e64 (patch)
tree4f27cc226f93a863121aef6c56313e4153a69b3e /third_party/aom/av1/common/clpf_simd.h
parent01eb57073ba97b2d6cbf20f745dfcc508197adc3 (diff)
downloadUXP-ec910d81405c736a4490383a250299a7837c2e64.tar
UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.gz
UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.lz
UXP-ec910d81405c736a4490383a250299a7837c2e64.tar.xz
UXP-ec910d81405c736a4490383a250299a7837c2e64.zip
Update aom to commit id e87fb2378f01103d5d6e477a4ef6892dc714e614
Diffstat (limited to 'third_party/aom/av1/common/clpf_simd.h')
-rw-r--r--third_party/aom/av1/common/clpf_simd.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/third_party/aom/av1/common/clpf_simd.h b/third_party/aom/av1/common/clpf_simd.h
index a615b5ed3..c7ffc569a 100644
--- a/third_party/aom/av1/common/clpf_simd.h
+++ b/third_party/aom/av1/common/clpf_simd.h
@@ -10,10 +10,20 @@
*/
#include "./av1_rtcd.h"
-#include "./cdef_simd.h"
#include "aom_ports/bitops.h"
#include "aom_ports/mem.h"
+// sign(a-b) * min(abs(a-b), max(0, threshold - (abs(a-b) >> adjdamp)))
+SIMD_INLINE v128 constrain16(v128 a, v128 b, unsigned int threshold,
+ unsigned int adjdamp) {
+ v128 diff = v128_sub_16(a, b);
+ const v128 sign = v128_shr_n_s16(diff, 15);
+ diff = v128_abs_s16(diff);
+ const v128 s =
+ v128_ssub_u16(v128_dup_16(threshold), v128_shr_u16(diff, adjdamp));
+ return v128_xor(v128_add_16(sign, v128_min_s16(diff, s)), sign);
+}
+
// sign(a - b) * min(abs(a - b), max(0, strength - (abs(a - b) >> adjdamp)))
SIMD_INLINE v128 constrain(v256 a, v256 b, unsigned int strength,
unsigned int adjdamp) {