mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
Merge "GetResidualCostSSE2: simplify abs calculation"
This commit is contained in:
commit
9287761d95
@ -68,12 +68,10 @@ static int GetResidualCostSSE2(int ctx0, const VP8Residual* const res) {
|
||||
const __m128i kCst67 = _mm_set1_epi8(MAX_VARIABLE_LEVEL);
|
||||
const __m128i c0 = _mm_loadu_si128((const __m128i*)&res->coeffs[0]);
|
||||
const __m128i c1 = _mm_loadu_si128((const __m128i*)&res->coeffs[8]);
|
||||
const __m128i D0_m = _mm_min_epi16(c0, zero);
|
||||
const __m128i D0_p = _mm_max_epi16(c0, zero);
|
||||
const __m128i D1_m = _mm_min_epi16(c1, zero);
|
||||
const __m128i D1_p = _mm_max_epi16(c1, zero);
|
||||
const __m128i E0 = _mm_sub_epi16(D0_p, D0_m); // abs(v), 16b
|
||||
const __m128i E1 = _mm_sub_epi16(D1_p, D1_m);
|
||||
const __m128i D0 = _mm_sub_epi16(zero, c0);
|
||||
const __m128i D1 = _mm_sub_epi16(zero, c1);
|
||||
const __m128i E0 = _mm_max_epi16(c0, D0); // abs(v), 16b
|
||||
const __m128i E1 = _mm_max_epi16(c1, D1);
|
||||
const __m128i F = _mm_packs_epi16(E0, E1);
|
||||
const __m128i G = _mm_min_epu8(F, kCst2); // context = 0,1,2
|
||||
const __m128i H = _mm_min_epu8(F, kCst67); // clamp_level in [0..67]
|
||||
|
Loading…
Reference in New Issue
Block a user