mirror of
https://salsa.debian.org/xorg-team/lib/pixman
synced 2025-09-01 02:10:49 +00:00
Make pix_add_mul() in pixman-mmx.c produce exact results.
Previously this routine would compute (x * a + y * b) / 255. Now it computes (x * a) / 255 + (y * b) / 255, so that the results are bitwise equivalent to the non-mmx versions.
This commit is contained in:
parent
f7463ffafb
commit
a075a870fd
@ -400,25 +400,18 @@ pack_565 (__m64 pixel, __m64 target, int pos)
|
|||||||
static force_inline __m64
|
static force_inline __m64
|
||||||
pix_add_mul (__m64 x, __m64 a, __m64 y, __m64 b)
|
pix_add_mul (__m64 x, __m64 a, __m64 y, __m64 b)
|
||||||
{
|
{
|
||||||
x = _mm_mullo_pi16 (x, a);
|
x = pix_multiply (x, a);
|
||||||
y = _mm_mullo_pi16 (y, b);
|
y = pix_multiply (y, b);
|
||||||
x = _mm_adds_pu16 (x, MC (4x0080));
|
|
||||||
x = _mm_adds_pu16 (x, y);
|
|
||||||
x = _mm_adds_pu16 (x, _mm_srli_pi16 (x, 8));
|
|
||||||
x = _mm_srli_pi16 (x, 8);
|
|
||||||
|
|
||||||
return x;
|
return pix_add (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define pix_add_mul(x, a, y, b) \
|
#define pix_add_mul(x, a, y, b) \
|
||||||
( x = _mm_mullo_pi16 (x, a), \
|
( x = pix_multiply (x, a), \
|
||||||
y = _mm_mullo_pi16 (y, b), \
|
y = pix_multiply (y, a), \
|
||||||
x = _mm_adds_pu16 (x, MC (4x0080)), \
|
pix_add (x, y) )
|
||||||
x = _mm_adds_pu16 (x, y), \
|
|
||||||
x = _mm_adds_pu16 (x, _mm_srli_pi16 (x, 8)), \
|
|
||||||
_mm_srli_pi16 (x, 8) )
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user