CRC optimize
This commit is contained in:
parent
f17692adaa
commit
4a66be133f
@ -2091,6 +2091,25 @@ xrdp_orders_send_raw_bitmap2(struct xrdp_orders *self,
|
||||
i = cache_idx & 0xff;
|
||||
out_uint8(self->out_s, i);
|
||||
|
||||
if (1 && Bpp == 3)
|
||||
{
|
||||
for (i = height - 1; i >= 0; i--)
|
||||
{
|
||||
for (j = 0; j < width; j++)
|
||||
{
|
||||
pixel = GETPIXEL32(data, j, i, width);
|
||||
out_uint8(self->out_s, pixel);
|
||||
out_uint8(self->out_s, pixel >> 8);
|
||||
out_uint8(self->out_s, pixel >> 16);
|
||||
}
|
||||
for (j = 0; j < e; j++)
|
||||
{
|
||||
out_uint8s(self->out_s, Bpp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = height - 1; i >= 0; i--)
|
||||
{
|
||||
for (j = 0; j < width; j++)
|
||||
@ -2120,6 +2139,7 @@ xrdp_orders_send_raw_bitmap2(struct xrdp_orders *self,
|
||||
out_uint8s(self->out_s, Bpp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -821,6 +821,8 @@ xrdp_bitmap_copy_box_with_crc(struct xrdp_bitmap *self,
|
||||
unsigned char *d8 = (unsigned char *)NULL;
|
||||
unsigned short *s16 = (unsigned short *)NULL;
|
||||
unsigned short *d16 = (unsigned short *)NULL;
|
||||
unsigned int *s32;
|
||||
unsigned int *d32;
|
||||
|
||||
if (self == 0)
|
||||
{
|
||||
@ -864,16 +866,65 @@ xrdp_bitmap_copy_box_with_crc(struct xrdp_bitmap *self,
|
||||
|
||||
if (self->bpp == 24)
|
||||
{
|
||||
s32 = ((unsigned int *)(self->data)) + (self->width * y + x);
|
||||
d32 = ((unsigned int *)(dest->data)) + (dest->width * desty + destx);
|
||||
incs = self->width - cx;
|
||||
incd = dest->width - cx;
|
||||
|
||||
for (i = 0; i < cy; i++)
|
||||
{
|
||||
for (j = 0; j < cx; j++)
|
||||
j = 0;
|
||||
while (j < cx - 4)
|
||||
{
|
||||
pixel = GETPIXEL32(self->data, j + x, i + y, self->width);
|
||||
pixel = *s32;
|
||||
CRC_PASS(pixel, crc);
|
||||
CRC_PASS(pixel >> 8, crc);
|
||||
CRC_PASS(pixel >> 16, crc);
|
||||
SETPIXEL32(dest->data, j + destx, i + desty, dest->width, pixel);
|
||||
*d32 = pixel;
|
||||
s32++;
|
||||
d32++;
|
||||
|
||||
pixel = *s32;
|
||||
CRC_PASS(pixel, crc);
|
||||
CRC_PASS(pixel >> 8, crc);
|
||||
CRC_PASS(pixel >> 16, crc);
|
||||
*d32 = pixel;
|
||||
s32++;
|
||||
d32++;
|
||||
|
||||
pixel = *s32;
|
||||
CRC_PASS(pixel, crc);
|
||||
CRC_PASS(pixel >> 8, crc);
|
||||
CRC_PASS(pixel >> 16, crc);
|
||||
*d32 = pixel;
|
||||
s32++;
|
||||
d32++;
|
||||
|
||||
pixel = *s32;
|
||||
CRC_PASS(pixel, crc);
|
||||
CRC_PASS(pixel >> 8, crc);
|
||||
CRC_PASS(pixel >> 16, crc);
|
||||
*d32 = pixel;
|
||||
s32++;
|
||||
d32++;
|
||||
|
||||
j += 4;
|
||||
}
|
||||
while (j < cx)
|
||||
{
|
||||
pixel = *s32;
|
||||
CRC_PASS(pixel, crc);
|
||||
CRC_PASS(pixel >> 8, crc);
|
||||
CRC_PASS(pixel >> 16, crc);
|
||||
*d32 = pixel;
|
||||
s32++;
|
||||
d32++;
|
||||
|
||||
j += 1;
|
||||
}
|
||||
|
||||
s32 += incs;
|
||||
d32 += incd;
|
||||
}
|
||||
}
|
||||
else if (self->bpp == 15 || self->bpp == 16)
|
||||
|
@ -136,6 +136,10 @@ xrdp_cache_reset(struct xrdp_cache *self,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define COMPARE_WITH_CRC(_b1, _b2) \
|
||||
_b1 != 0 && _b2 != 0 && _b1->crc == _b2->crc && _b1->bpp == _b2->bpp && \
|
||||
_b1->width == _b1->width && _b1->height == _b2->height
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns cache id */
|
||||
int APP_CC
|
||||
@ -171,7 +175,8 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap,
|
||||
{
|
||||
#ifdef USE_CRC
|
||||
|
||||
if (xrdp_bitmap_compare_with_crc(self->bitmap_items[i][j].bitmap, bitmap))
|
||||
//if (xrdp_bitmap_compare_with_crc(self->bitmap_items[i][j].bitmap, bitmap))
|
||||
if (COMPARE_WITH_CRC(self->bitmap_items[i][j].bitmap, bitmap))
|
||||
#else
|
||||
if (xrdp_bitmap_compare(self->bitmap_items[i][j].bitmap, bitmap))
|
||||
#endif
|
||||
@ -191,7 +196,8 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap,
|
||||
{
|
||||
#ifdef USE_CRC
|
||||
|
||||
if (xrdp_bitmap_compare_with_crc(self->bitmap_items[i][j].bitmap, bitmap))
|
||||
//if (xrdp_bitmap_compare_with_crc(self->bitmap_items[i][j].bitmap, bitmap))
|
||||
if (COMPARE_WITH_CRC(self->bitmap_items[i][j].bitmap, bitmap))
|
||||
#else
|
||||
if (xrdp_bitmap_compare(self->bitmap_items[i][j].bitmap, bitmap))
|
||||
#endif
|
||||
@ -211,7 +217,8 @@ xrdp_cache_add_bitmap(struct xrdp_cache *self, struct xrdp_bitmap *bitmap,
|
||||
{
|
||||
#ifdef USE_CRC
|
||||
|
||||
if (xrdp_bitmap_compare_with_crc(self->bitmap_items[i][j].bitmap, bitmap))
|
||||
//if (xrdp_bitmap_compare_with_crc(self->bitmap_items[i][j].bitmap, bitmap))
|
||||
if (COMPARE_WITH_CRC(self->bitmap_items[i][j].bitmap, bitmap))
|
||||
#else
|
||||
if (xrdp_bitmap_compare(self->bitmap_items[i][j].bitmap, bitmap))
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user