static void HFilter16iSSE2(uint8_t* p, int stride, int thresh, int ithresh, int hev_thresh) { int k; uint8_t* b; __m128i mask; __m128i t1, t2, p1, p0, q0, q1; for (k = 3; k > 0; --k) { b = p; Load16x4(b, b + 8 * stride, stride, &t2, &t1, &p1, &p0); // p3, p2, p1, p0 MAX_DIFF1(t2, t1, p1, p0, mask); b += 4; // beginning of q0 Load16x4(b, b + 8 * stride, stride, &q0, &q1, &t1, &t2); // q0, q1, q2, q3 MAX_DIFF2(t2, t1, q1, q0, mask); COMPLEX_FL_MASK(p1, p0, q0, q1, thresh, ithresh, mask); DoFilter4(&p1, &p0, &q0, &q1, &mask, hev_thresh); b -= 2; // beginning of p1 Store16x4(b, b + 8 * stride, stride, &p1, &p0, &q0, &q1); p += 4; } }
static void HFilter16i(uint8_t* p, int stride, int thresh, int ithresh, int hev_thresh) { int k; __m128i p3, p2, p1, p0; // loop invariants Load16x4(p, p + 8 * stride, stride, &p3, &p2, &p1, &p0); // prologue for (k = 3; k > 0; --k) { __m128i mask, tmp1, tmp2; uint8_t* const b = p + 2; // beginning of p1 p += 4; // beginning of q0 (and next span) MAX_DIFF1(p3, p2, p1, p0, mask); // compute partial mask Load16x4(p, p + 8 * stride, stride, &p3, &p2, &tmp1, &tmp2); MAX_DIFF2(p3, p2, tmp1, tmp2, mask); ComplexMask(&p1, &p0, &p3, &p2, thresh, ithresh, &mask); DoFilter4(&p1, &p0, &p3, &p2, &mask, hev_thresh); Store16x4(&p1, &p0, &p3, &p2, b, b + 8 * stride, stride); // rotate samples p1 = tmp1; p0 = tmp2; } }
static void HFilter16SSE2(uint8_t* p, int stride, int thresh, int ithresh, int hev_thresh) { __m128i mask; __m128i p3, p2, p1, p0, q0, q1, q2, q3; uint8_t* const b = p - 4; Load16x4(b, b + 8 * stride, stride, &p3, &p2, &p1, &p0); // p3, p2, p1, p0 MAX_DIFF1(p3, p2, p1, p0, mask); Load16x4(p, p + 8 * stride, stride, &q0, &q1, &q2, &q3); // q0, q1, q2, q3 MAX_DIFF2(q3, q2, q1, q0, mask); COMPLEX_FL_MASK(p1, p0, q0, q1, thresh, ithresh, mask); DoFilter6(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh); Store16x4(b, b + 8 * stride, stride, &p3, &p2, &p1, &p0); Store16x4(p, p + 8 * stride, stride, &q0, &q1, &q2, &q3); }
static void SimpleHFilter16SSE2(uint8_t* p, int stride, int thresh) { __m128i p1, p0, q0, q1; p -= 2; // beginning of p1 Load16x4(p, p + 8 * stride, stride, &p1, &p0, &q0, &q1); DoFilter2(&p1, &p0, &q0, &q1, thresh); Store16x4(p, p + 8 * stride, stride, &p1, &p0, &q0, &q1); }
static void HFilter8SSE2(uint8_t* u, uint8_t* v, int stride, int thresh, int ithresh, int hev_thresh) { __m128i mask; __m128i p3, p2, p1, p0, q0, q1, q2, q3; uint8_t* const tu = u - 4; uint8_t* const tv = v - 4; Load16x4(tu, tv, stride, &p3, &p2, &p1, &p0); // p3, p2, p1, p0 MAX_DIFF1(p3, p2, p1, p0, mask); Load16x4(u, v, stride, &q0, &q1, &q2, &q3); // q0, q1, q2, q3 MAX_DIFF2(q3, q2, q1, q0, mask); COMPLEX_FL_MASK(p1, p0, q0, q1, thresh, ithresh, mask); DoFilter6(&p2, &p1, &p0, &q0, &q1, &q2, &mask, hev_thresh); Store16x4(tu, tv, stride, &p3, &p2, &p1, &p0); Store16x4(u, v, stride, &q0, &q1, &q2, &q3); }
static void HFilter8iSSE2(uint8_t* u, uint8_t* v, int stride, int thresh, int ithresh, int hev_thresh) { __m128i mask; __m128i t1, t2, p1, p0, q0, q1; Load16x4(u, v, stride, &t2, &t1, &p1, &p0); // p3, p2, p1, p0 MAX_DIFF1(t2, t1, p1, p0, mask); u += 4; // beginning of q0 v += 4; Load16x4(u, v, stride, &q0, &q1, &t1, &t2); // q0, q1, q2, q3 MAX_DIFF2(t2, t1, q1, q0, mask); COMPLEX_FL_MASK(p1, p0, q0, q1, thresh, ithresh, mask); DoFilter4(&p1, &p0, &q0, &q1, &mask, hev_thresh); u -= 2; // beginning of p1 v -= 2; Store16x4(u, v, stride, &p1, &p0, &q0, &q1); }