Skip to content

Commit

Permalink
Fix 64-bit bilinear scaled image sampling
Browse files Browse the repository at this point in the history
A constraint ensuring we do not sample beyond the current scan-line
was missing in the SSE2 optimized sampling.

Discovered with lancelot.

Change-Id: Ib0ece8f8bfaa034733873dc5b8baaaad5d4c0380
Reviewed-by: Erik Verbruggen <[email protected]>
  • Loading branch information
carewolf authored and Allan Sandfeld Jensen committed Aug 4, 2016
1 parent bc4ce55 commit b643d6f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/gui/painting/qdrawhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2815,10 +2815,16 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
sbuf2[i * 2 + 1] = ((const uint*)s2)[x2];
fx += fdx;
}
int fastLen;
if (fdx > 0)
fastLen = qMin(len, int((image_x2 - (fx >> 16)) / data->m11));
else
fastLen = qMin(len, int((image_x1 - (fx >> 16)) / data->m11));
fastLen -= 3;

const __m128i v_fdx = _mm_set1_epi32(fdx*4);
__m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx);
for (; i < len-3; i+=4) {
for (; i < fastLen; i += 4) {
int offset = _mm_extract_epi16(v_fx, 1);
sbuf1[i * 2 + 0] = ((const uint*)s1)[offset];
sbuf1[i * 2 + 1] = ((const uint*)s1)[offset + 1];
Expand Down

0 comments on commit b643d6f

Please sign in to comment.