mirror of
https://github.com/sheumann/VNCviewGS.git
synced 2024-11-22 02:30:47 +00:00
Raw decoding optimization: Do operations using 16 bits where possible.
This saves a few instructions that were being used to switch to 8-bit mode or mask values down to 8 bits.
This commit is contained in:
parent
f810cb3799
commit
3c069bc35d
72
raw.cc
72
raw.cc
@ -108,28 +108,37 @@ void RawDraw (void) {
|
|||||||
if (hRez == 640) {
|
if (hRez == 640) {
|
||||||
initialLineDataPtr = lineDataPtr;
|
initialLineDataPtr = lineDataPtr;
|
||||||
while (destPtr + 7 < finalDestPtr) { /* Unrolled loop */
|
while (destPtr + 7 < finalDestPtr) { /* Unrolled loop */
|
||||||
*destPtr = bigcoltab640a[*(unsigned int*)lineDataPtr]
|
*(unsigned*)destPtr =
|
||||||
+ bigcoltab640b[((unsigned int*)lineDataPtr)[1]];
|
*(unsigned*)(bigcoltab640a + *(unsigned*)lineDataPtr)
|
||||||
destPtr[1] = bigcoltab640a[((unsigned int*)lineDataPtr)[2]]
|
+ *(unsigned*)(bigcoltab640b + ((unsigned*)lineDataPtr)[1]);
|
||||||
+ bigcoltab640b[((unsigned int*)lineDataPtr)[3]];
|
*(unsigned*)(destPtr+1) =
|
||||||
destPtr[2] = bigcoltab640a[((unsigned int*)lineDataPtr)[4]]
|
*(unsigned*)(bigcoltab640a + ((unsigned*)lineDataPtr)[2])
|
||||||
+ bigcoltab640b[((unsigned int*)lineDataPtr)[5]];
|
+ *(unsigned*)(bigcoltab640b + ((unsigned*)lineDataPtr)[3]);
|
||||||
destPtr[3] = bigcoltab640a[((unsigned int*)lineDataPtr)[6]]
|
*(unsigned*)(destPtr+2) =
|
||||||
+ bigcoltab640b[((unsigned int*)lineDataPtr)[7]];
|
*(unsigned*)(bigcoltab640a + ((unsigned*)lineDataPtr)[4])
|
||||||
destPtr[4] = bigcoltab640a[((unsigned int*)lineDataPtr)[8]]
|
+ *(unsigned*)(bigcoltab640b + ((unsigned*)lineDataPtr)[5]);
|
||||||
+ bigcoltab640b[((unsigned int*)lineDataPtr)[9]];
|
*(unsigned*)(destPtr+3) =
|
||||||
destPtr[5] = bigcoltab640a[((unsigned int*)lineDataPtr)[10]]
|
*(unsigned*)(bigcoltab640a + ((unsigned*)lineDataPtr)[6])
|
||||||
+ bigcoltab640b[((unsigned int*)lineDataPtr)[11]];
|
+ *(unsigned*)(bigcoltab640b + ((unsigned*)lineDataPtr)[7]);
|
||||||
destPtr[6] = bigcoltab640a[((unsigned int*)lineDataPtr)[12]]
|
*(unsigned*)(destPtr+4) =
|
||||||
+ bigcoltab640b[((unsigned int*)lineDataPtr)[13]];
|
*(unsigned*)(bigcoltab640a + ((unsigned*)lineDataPtr)[8])
|
||||||
destPtr[7] = bigcoltab640a[((unsigned int*)lineDataPtr)[14]]
|
+ *(unsigned*)(bigcoltab640b + ((unsigned*)lineDataPtr)[9]);
|
||||||
+ bigcoltab640b[((unsigned int*)lineDataPtr)[15]];
|
*(unsigned*)(destPtr+5) =
|
||||||
|
*(unsigned*)(bigcoltab640a + ((unsigned*)lineDataPtr)[10])
|
||||||
|
+ *(unsigned*)(bigcoltab640b + ((unsigned*)lineDataPtr)[11]);
|
||||||
|
*(unsigned*)(destPtr+6) =
|
||||||
|
*(unsigned*)(bigcoltab640a + ((unsigned*)lineDataPtr)[12])
|
||||||
|
+ *(unsigned*)(bigcoltab640b + ((unsigned*)lineDataPtr)[13]);
|
||||||
|
* (destPtr+7) =
|
||||||
|
*(unsigned*)(bigcoltab640a + ((unsigned*)lineDataPtr)[14])
|
||||||
|
+ *(unsigned*)(bigcoltab640b + ((unsigned*)lineDataPtr)[15]);
|
||||||
destPtr += 8;
|
destPtr += 8;
|
||||||
lineDataPtr += 32;
|
lineDataPtr += 32;
|
||||||
}
|
}
|
||||||
while (destPtr < finalDestPtr) {
|
while (destPtr < finalDestPtr) {
|
||||||
*(destPtr++) = bigcoltab640a[*(unsigned int*)lineDataPtr]
|
*(destPtr++) =
|
||||||
+ bigcoltab640b[((unsigned int*)lineDataPtr)[1]];
|
*(unsigned*)(bigcoltab640a + *(unsigned*)lineDataPtr)
|
||||||
|
+ *(unsigned*)(bigcoltab640b + ((unsigned*)lineDataPtr)[1]);
|
||||||
lineDataPtr += 4;
|
lineDataPtr += 4;
|
||||||
}
|
}
|
||||||
/* Final byte to produce */
|
/* Final byte to produce */
|
||||||
@ -149,19 +158,28 @@ void RawDraw (void) {
|
|||||||
}
|
}
|
||||||
else { /* 320 mode */
|
else { /* 320 mode */
|
||||||
while (destPtr + 7 < finalDestPtr) { /* Unrolled loop */
|
while (destPtr + 7 < finalDestPtr) { /* Unrolled loop */
|
||||||
*destPtr = bigcoltab320[*(unsigned int*)lineDataPtr];
|
*(unsigned*)destPtr =
|
||||||
destPtr[1] = bigcoltab320[((unsigned int*)lineDataPtr)[1]];
|
*(unsigned*)(bigcoltab320 + *(unsigned*)lineDataPtr);
|
||||||
destPtr[2] = bigcoltab320[((unsigned int*)lineDataPtr)[2]];
|
*(unsigned*)(destPtr+1) =
|
||||||
destPtr[3] = bigcoltab320[((unsigned int*)lineDataPtr)[3]];
|
*(unsigned*)(bigcoltab320 + ((unsigned*)lineDataPtr)[1]);
|
||||||
destPtr[4] = bigcoltab320[((unsigned int*)lineDataPtr)[4]];
|
*(unsigned*)(destPtr+2) =
|
||||||
destPtr[5] = bigcoltab320[((unsigned int*)lineDataPtr)[5]];
|
*(unsigned*)(bigcoltab320 + ((unsigned*)lineDataPtr)[2]);
|
||||||
destPtr[6] = bigcoltab320[((unsigned int*)lineDataPtr)[6]];
|
*(unsigned*)(destPtr+3) =
|
||||||
destPtr[7] = bigcoltab320[((unsigned int*)lineDataPtr)[7]];
|
*(unsigned*)(bigcoltab320 + ((unsigned*)lineDataPtr)[3]);
|
||||||
|
*(unsigned*)(destPtr+4) =
|
||||||
|
*(unsigned*)(bigcoltab320 + ((unsigned*)lineDataPtr)[4]);
|
||||||
|
*(unsigned*)(destPtr+5) =
|
||||||
|
*(unsigned*)(bigcoltab320 + ((unsigned*)lineDataPtr)[5]);
|
||||||
|
*(unsigned*)(destPtr+6) =
|
||||||
|
*(unsigned*)(bigcoltab320 + ((unsigned*)lineDataPtr)[6]);
|
||||||
|
* (destPtr+7) =
|
||||||
|
*(unsigned*)(bigcoltab320 + ((unsigned*)lineDataPtr)[7]);
|
||||||
destPtr += 8;
|
destPtr += 8;
|
||||||
lineDataPtr += 16;
|
lineDataPtr += 16;
|
||||||
}
|
}
|
||||||
while (destPtr < finalDestPtr) {
|
while (destPtr < finalDestPtr) {
|
||||||
*(destPtr++) = bigcoltab320[*(unsigned int*)lineDataPtr];
|
*(destPtr++) =
|
||||||
|
*(unsigned*)(bigcoltab320 + *(unsigned*)lineDataPtr);
|
||||||
lineDataPtr += 2;
|
lineDataPtr += 2;
|
||||||
}
|
}
|
||||||
/* Final byte to produce */
|
/* Final byte to produce */
|
||||||
|
Loading…
Reference in New Issue
Block a user