Optimize the core loops for decoding raw pixels a little, in particular deferring increments to the end.

This commit is contained in:
Stephen Heumann 2015-09-26 14:26:05 -05:00
parent 59a3bf938c
commit f810cb3799
3 changed files with 32 additions and 43 deletions

BIN
._README

Binary file not shown.

1
README
View File

@ -64,6 +64,7 @@ First open source release
Can display the mouse cursor from the server locally on the IIgs
Detects some errors more quickly, avoiding long periods of unresponsiveness
Mapping of OA and Option keys reversed to match Mac VNC implementations
Raw pixel decoding performance improved slightly
1.0b1
Faster display updates when using Raw encoding

74
raw.cc
View File

@ -108,34 +108,28 @@ void RawDraw (void) {
if (hRez == 640) {
initialLineDataPtr = lineDataPtr;
while (destPtr + 7 < finalDestPtr) { /* Unrolled loop */
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
lineDataPtr += 4;
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
lineDataPtr += 4;
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
lineDataPtr += 4;
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
lineDataPtr += 4;
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
lineDataPtr += 4;
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
lineDataPtr += 4;
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
lineDataPtr += 4;
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
lineDataPtr += 4;
*destPtr = bigcoltab640a[*(unsigned int*)lineDataPtr]
+ bigcoltab640b[((unsigned int*)lineDataPtr)[1]];
destPtr[1] = bigcoltab640a[((unsigned int*)lineDataPtr)[2]]
+ bigcoltab640b[((unsigned int*)lineDataPtr)[3]];
destPtr[2] = bigcoltab640a[((unsigned int*)lineDataPtr)[4]]
+ bigcoltab640b[((unsigned int*)lineDataPtr)[5]];
destPtr[3] = bigcoltab640a[((unsigned int*)lineDataPtr)[6]]
+ bigcoltab640b[((unsigned int*)lineDataPtr)[7]];
destPtr[4] = bigcoltab640a[((unsigned int*)lineDataPtr)[8]]
+ bigcoltab640b[((unsigned int*)lineDataPtr)[9]];
destPtr[5] = bigcoltab640a[((unsigned int*)lineDataPtr)[10]]
+ bigcoltab640b[((unsigned int*)lineDataPtr)[11]];
destPtr[6] = bigcoltab640a[((unsigned int*)lineDataPtr)[12]]
+ bigcoltab640b[((unsigned int*)lineDataPtr)[13]];
destPtr[7] = bigcoltab640a[((unsigned int*)lineDataPtr)[14]]
+ bigcoltab640b[((unsigned int*)lineDataPtr)[15]];
destPtr += 8;
lineDataPtr += 32;
}
while (destPtr < finalDestPtr) {
*(destPtr++) = bigcoltab640a[*(unsigned int*)(void*)lineDataPtr]
+ bigcoltab640b[*(unsigned int*)(void*)(lineDataPtr+2)];
*(destPtr++) = bigcoltab640a[*(unsigned int*)lineDataPtr]
+ bigcoltab640b[((unsigned int*)lineDataPtr)[1]];
lineDataPtr += 4;
}
/* Final byte to produce */
@ -155,25 +149,19 @@ void RawDraw (void) {
}
else { /* 320 mode */
while (destPtr + 7 < finalDestPtr) { /* Unrolled loop */
*(destPtr++) = bigcoltab320[*(unsigned int*)(void*)lineDataPtr];
lineDataPtr += 2;
*(destPtr++) = bigcoltab320[*(unsigned int*)(void*)lineDataPtr];
lineDataPtr += 2;
*(destPtr++) = bigcoltab320[*(unsigned int*)(void*)lineDataPtr];
lineDataPtr += 2;
*(destPtr++) = bigcoltab320[*(unsigned int*)(void*)lineDataPtr];
lineDataPtr += 2;
*(destPtr++) = bigcoltab320[*(unsigned int*)(void*)lineDataPtr];
lineDataPtr += 2;
*(destPtr++) = bigcoltab320[*(unsigned int*)(void*)lineDataPtr];
lineDataPtr += 2;
*(destPtr++) = bigcoltab320[*(unsigned int*)(void*)lineDataPtr];
lineDataPtr += 2;
*(destPtr++) = bigcoltab320[*(unsigned int*)(void*)lineDataPtr];
lineDataPtr += 2;
*destPtr = bigcoltab320[*(unsigned int*)lineDataPtr];
destPtr[1] = bigcoltab320[((unsigned int*)lineDataPtr)[1]];
destPtr[2] = bigcoltab320[((unsigned int*)lineDataPtr)[2]];
destPtr[3] = bigcoltab320[((unsigned int*)lineDataPtr)[3]];
destPtr[4] = bigcoltab320[((unsigned int*)lineDataPtr)[4]];
destPtr[5] = bigcoltab320[((unsigned int*)lineDataPtr)[5]];
destPtr[6] = bigcoltab320[((unsigned int*)lineDataPtr)[6]];
destPtr[7] = bigcoltab320[((unsigned int*)lineDataPtr)[7]];
destPtr += 8;
lineDataPtr += 16;
}
while (destPtr < finalDestPtr) {
*(destPtr++) = bigcoltab320[*(unsigned int*)(void*)lineDataPtr];
*(destPtr++) = bigcoltab320[*(unsigned int*)lineDataPtr];
lineDataPtr += 2;
}
/* Final byte to produce */