Improve high bitdepth CLPF SIMD
The high bitdepth was a direct translation of the low bit code, but
the tricks to keep 9 bit differences saturated within 8 bit are
redundant in high bitdepth, so the these were replaced with simpler
and more readable code.
Change-Id: I0710a1f1b9dcde8039d3dfa0f74cd2ea2b3bae27
diff --git a/av1/common/clpf_simd.h b/av1/common/clpf_simd.h
index 4a0b220..eb81a25 100644
--- a/av1/common/clpf_simd.h
+++ b/av1/common/clpf_simd.h
@@ -209,8 +209,9 @@
// strength + (abs(a - b) >> (dmp - log2(s)))))
SIMD_INLINE v128 constrain_hbd(v128 a, v128 b, unsigned int strength,
unsigned int dmp) {
- const v128 diff = v128_sub_16(v128_max_s16(a, b), v128_min_s16(a, b));
- const v128 sign = v128_cmpeq_16(v128_min_s16(a, b), a); // -(a <= b)
+ v128 diff = v128_sub_16(a, b);
+ const v128 sign = v128_shr_n_s16(diff, 15);
+ diff = v128_abs_s16(diff);
const v128 zero = v128_zero();
const v128 s = v128_max_s16(
zero, v128_sub_16(v128_dup_16(strength),