Draw: Minify fix

git-svn-id: svn://ultimatepp.org/upp/trunk@14627 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-06-23 07:59:57 +00:00
parent efbc9e0a44
commit 4b10a3f80c
2 changed files with 10 additions and 9 deletions

View file

@ -27,13 +27,12 @@ Image Minify(const Image& img, int nx, int ny, bool co)
__m128 *d = div;
while(s < e) {
__m128 px = _mm_setzero_ps();
__m128 dv = _mm_setzero_ps();
for(int n = nx; n--;) {
for(int n = nx; n--;)
px = _mm_add_ps(px, LoadRGBAF(s++));
dv = _mm_add_ps(dv, v1);
}
*t++ = px;
*d++ = dv;
*t = _mm_add_ps(*t, px);
*d = _mm_add_ps(*d, vnx);
t++;
d++;
}
if(s < e2) {
__m128 px = _mm_setzero_ps();
@ -42,8 +41,10 @@ Image Minify(const Image& img, int nx, int ny, bool co)
px = _mm_add_ps(px, LoadRGBAF(s++));
dv = _mm_add_ps(px, v1);
}
*t++ = px;
*d++ = dv;
*t = _mm_add_ps(*t, px);
*d = _mm_add_ps(*d, dv);
t++;
d++;
}
ASSERT(t == b + tsz.cx);
}

View file

@ -22,7 +22,7 @@ __m128i BroadcastAlpha(__m128i x)
force_inline
__m128i Mul8(__m128i x, int alpha)
{
return _mm_srli_epi16(_mm_mullo_epi16(_mm_set1_epi16(alpha), x), 8); // int a = c.a * cover >> 8;
return _mm_srli_epi16(_mm_mullo_epi16(_mm_set1_epi16(alpha), x), 8); // c.a * alpha >> 8;
}
force_inline