Merge "wasm: Add VFilter8i and HFilter8i" into portable-intrinsics

This commit is contained in:
Scott LaVarnway 2017-07-11 18:53:51 +00:00 committed by Gerrit Code Review
commit 28fbe808b9

View File

@ -597,8 +597,8 @@ static WEBP_INLINE void DoFilter4(int8x16* const p1, int8x16* const p0,
const int16x8 t2_hi = (int16x8)_unpackhi_epi8(t2, zero);
const int16x8 a = (t2_lo + one) >> one;
const int16x8 b = (t2_hi + one) >> one;
t3 = __builtin_shufflevector((int8x16)a, (int8x16)b,
0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30);
t3 = __builtin_shufflevector((int8x16)a, (int8x16)b, 0, 2, 4, 6, 8, 10, 12,
14, 16, 18, 20, 22, 24, 26, 28, 30);
}
#endif
t3 = t3 - k64;
@ -894,8 +894,8 @@ static void HFilter16(uint8_t* p, int stride, int thresh, int ithresh,
}
// on three inner edges
static void VFilter16i(uint8_t* p, int stride,
int thresh, int ithresh, int hev_thresh) {
static void VFilter16i(uint8_t* p, int stride, int thresh, int ithresh,
int hev_thresh) {
int k;
int8x16 p3, p2, p1, p0; // loop invariants
@ -927,8 +927,8 @@ static void VFilter16i(uint8_t* p, int stride,
}
}
static void HFilter16i(uint8_t* p, int stride,
int thresh, int ithresh, int hev_thresh) {
static void HFilter16i(uint8_t* p, int stride, int thresh, int ithresh,
int hev_thresh) {
int k;
int8x16 p3, p2, p1, p0; // loop invariants
@ -1001,6 +1001,52 @@ static void HFilter8(uint8_t* u, uint8_t* v, int stride, int thresh,
Store16x4(&q0, &q1, &q2, &q3, u, v, stride);
}
static void VFilter8i(uint8_t* u, uint8_t* v, int stride, int thresh,
int ithresh, int hev_thresh) {
int8x16 mask;
int8x16 t1, t2, p1, p0, q0, q1;
// Load p3, p2, p1, p0
LOADUV_H_EDGES4(u, v, stride, t2, t1, p1, p0);
MAX_DIFF1(t2, t1, p1, p0, mask);
u += 4 * stride;
v += 4 * stride;
// Load q0, q1, q2, q3
LOADUV_H_EDGES4(u, v, stride, q0, q1, t1, t2);
MAX_DIFF2(t2, t1, q1, q0, mask);
ComplexMask(&p1, &p0, &q0, &q1, thresh, ithresh, &mask);
DoFilter4(&p1, &p0, &q0, &q1, &mask, hev_thresh);
// Store
STOREUV(p1, u, v, -2 * stride);
STOREUV(p0, u, v, -1 * stride);
STOREUV(q0, u, v, 0 * stride);
STOREUV(q1, u, v, 1 * stride);
}
static void HFilter8i(uint8_t* u, uint8_t* v, int stride, int thresh,
int ithresh, int hev_thresh) {
int8x16 mask;
int8x16 t1, t2, p1, p0, q0, q1;
Load16x4(u, v, stride, &t2, &t1, &p1, &p0);
MAX_DIFF1(t2, t1, p1, p0, mask);
u += 4; // beginning of q0
v += 4;
Load16x4(u, v, stride, &q0, &q1, &t1, &t2);
MAX_DIFF2(t2, t1, q1, q0, mask);
ComplexMask(&p1, &p0, &q0, &q1, thresh, ithresh, &mask);
DoFilter4(&p1, &p0, &q0, &q1, &mask, hev_thresh);
u -= 2; // beginning of p1
v -= 2;
Store16x4(&p1, &p0, &q0, &q1, u, v, stride);
}
//------------------------------------------------------------------------------
// 4x4 predictions
@ -1402,6 +1448,8 @@ WEBP_TSAN_IGNORE_FUNCTION void VP8DspInitWASM(void) {
VP8HFilter8 = HFilter8;
VP8VFilter16i = VFilter16i;
VP8HFilter16i = HFilter16i;
VP8VFilter8i = VFilter8i;
VP8HFilter8i = HFilter8i;
VP8PredLuma4[1] = TM4;
VP8PredLuma4[2] = VE4;