Merge branch 'master' of git://github.com/awakecoding/FreeRDP

This commit is contained in:
Benoît LeBlanc 2013-12-09 09:37:38 -05:00
commit cb46bbade0
8 changed files with 173 additions and 120 deletions

View File

@ -33,7 +33,17 @@ FREERDP_API BOOL bitmap_decompress(BYTE* srcData, BYTE* dstData, int width, int
FREERDP_API int freerdp_bitmap_compress(char* in_data, int width, int height, FREERDP_API int freerdp_bitmap_compress(char* in_data, int width, int height,
wStream* s, int bpp, int byte_limit, int start_line, wStream* temp_s, int e); wStream* s, int bpp, int byte_limit, int start_line, wStream* temp_s, int e);
FREERDP_API BYTE* freerdp_bitmap_compress_planar(BYTE* data, UINT32 format, int width, int height, #define PLANAR_FORMAT_HEADER_CS (1 << 3)
int scanline, BYTE* dstData, int* dstSize); #define PLANAR_FORMAT_HEADER_RLE (1 << 4)
#define PLANAR_FORMAT_HEADER_NA (1 << 5)
#define PLANAR_FORMAT_HEADER_CLL_MASK 0x07
typedef struct _BITMAP_PLANAR_CONTEXT BITMAP_PLANAR_CONTEXT;
FREERDP_API BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* context, BYTE* data, UINT32 format,
int width, int height, int scanline, BYTE* dstData, int* dstSize);
FREERDP_API BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(DWORD flags, int maxWidth, int maxHeight);
FREERDP_API void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT* context);
#endif /* FREERDP_CODEC_BITMAP_H */ #endif /* FREERDP_CODEC_BITMAP_H */

View File

@ -699,6 +699,7 @@ typedef struct _RDPDR_PARALLEL RDPDR_PARALLEL;
#define FreeRDP_CompDeskSupportLevel 3456 #define FreeRDP_CompDeskSupportLevel 3456
#define FreeRDP_SurfaceCommandsEnabled 3520 #define FreeRDP_SurfaceCommandsEnabled 3520
#define FreeRDP_FrameMarkerCommandEnabled 3521 #define FreeRDP_FrameMarkerCommandEnabled 3521
#define FreeRDP_SurfaceFrameMarkerEnabled 3522
#define FreeRDP_RemoteFxOnly 3648 #define FreeRDP_RemoteFxOnly 3648
#define FreeRDP_RemoteFxCodec 3649 #define FreeRDP_RemoteFxCodec 3649
#define FreeRDP_RemoteFxCodecId 3650 #define FreeRDP_RemoteFxCodecId 3650
@ -1175,7 +1176,8 @@ struct rdp_settings
/* Surface Commands Capabilities */ /* Surface Commands Capabilities */
ALIGN64 BOOL SurfaceCommandsEnabled; /* 3520 */ ALIGN64 BOOL SurfaceCommandsEnabled; /* 3520 */
ALIGN64 BOOL FrameMarkerCommandEnabled; /* 3521 */ ALIGN64 BOOL FrameMarkerCommandEnabled; /* 3521 */
UINT64 padding3584[3584 - 3522]; /* 3522 */ ALIGN64 BOOL SurfaceFrameMarkerEnabled; /* 3522 */
UINT64 padding3584[3584 - 3523]; /* 3523 */
UINT64 padding3648[3648 - 3584]; /* 3584 */ UINT64 padding3648[3648 - 3584]; /* 3584 */
/* /*

View File

@ -263,7 +263,7 @@ int freerdp_bitmap_planar_decompress(BYTE* srcData, BYTE* dstData, int width, in
return (size == (srcp - srcData)) ? 0 : -1; return (size == (srcp - srcData)) ? 0 : -1;
} }
int freerdp_split_color_planes(BYTE* data, UINT32 format, int width, int height, int scanline, BYTE* planes[5]) int freerdp_split_color_planes(BYTE* data, UINT32 format, int width, int height, int scanline, BYTE* planes[4])
{ {
int bpp; int bpp;
int i, j, k; int i, j, k;
@ -449,12 +449,9 @@ int freerdp_bitmap_planar_compress_plane_rle_segment(PLANAR_RLE_CONTEXT* rle)
*rle->output = PLANAR_CONTROL_BYTE(rle->nRunLength, rle->cRawBytes); *rle->output = PLANAR_CONTROL_BYTE(rle->nRunLength, rle->cRawBytes);
rle->output++; rle->output++;
if (rle->cRawBytes)
{
CopyMemory(rle->output, rle->rawValues, rle->cRawBytes); CopyMemory(rle->output, rle->rawValues, rle->cRawBytes);
rle->rawValues += (rle->cRawBytes + rle->nRunLength); rle->rawValues += (rle->cRawBytes + rle->nRunLength);
rle->output += rle->cRawBytes; rle->output += rle->cRawBytes;
}
rle->cRawBytes = 0; rle->cRawBytes = 0;
rle->nRunLength = 0; rle->nRunLength = 0;
@ -466,7 +463,7 @@ int freerdp_bitmap_planar_compress_plane_rle_segment(PLANAR_RLE_CONTEXT* rle)
{ {
if (rle->nRunLength > 15) if (rle->nRunLength > 15)
{ {
rle->nControlBytes = 2; rle->nControlBytes = 1;
rle->outSegmentSize = rle->cRawBytes + rle->nControlBytes; rle->outSegmentSize = rle->cRawBytes + rle->nControlBytes;
if (((rle->output - rle->outPlane) + rle->outSegmentSize) > rle->outPlaneSize) if (((rle->output - rle->outPlane) + rle->outSegmentSize) > rle->outPlaneSize)
@ -484,12 +481,9 @@ int freerdp_bitmap_planar_compress_plane_rle_segment(PLANAR_RLE_CONTEXT* rle)
*rle->output = PLANAR_CONTROL_BYTE(15, rle->cRawBytes); *rle->output = PLANAR_CONTROL_BYTE(15, rle->cRawBytes);
rle->output++; rle->output++;
if (rle->cRawBytes)
{
CopyMemory(rle->output, rle->rawValues, rle->cRawBytes); CopyMemory(rle->output, rle->rawValues, rle->cRawBytes);
rle->rawValues += (rle->cRawBytes + rle->nRunLength); rle->rawValues += (rle->cRawBytes + 15);
rle->output += rle->cRawBytes; rle->output += rle->cRawBytes;
}
rle->nRunLength -= 15; rle->nRunLength -= 15;
rle->cRawBytes = 0; rle->cRawBytes = 0;
@ -516,12 +510,9 @@ int freerdp_bitmap_planar_compress_plane_rle_segment(PLANAR_RLE_CONTEXT* rle)
*rle->output = PLANAR_CONTROL_BYTE(rle->nRunLength, rle->cRawBytes); *rle->output = PLANAR_CONTROL_BYTE(rle->nRunLength, rle->cRawBytes);
rle->output++; rle->output++;
if (rle->cRawBytes)
{
CopyMemory(rle->output, rle->rawValues, rle->cRawBytes); CopyMemory(rle->output, rle->rawValues, rle->cRawBytes);
rle->rawValues += (rle->cRawBytes + rle->nRunLength); rle->rawValues += (rle->cRawBytes + rle->nRunLength);
rle->output += rle->cRawBytes; rle->output += rle->cRawBytes;
}
rle->cRawBytes = 0; rle->cRawBytes = 0;
rle->nRunLength = 0; rle->nRunLength = 0;
@ -565,6 +556,8 @@ BYTE* freerdp_bitmap_planar_compress_plane_rle(BYTE* inPlane, int width, int hei
rle->rawScanline = &inPlane[i * width]; rle->rawScanline = &inPlane[i * width];
rle->rawValues = rle->rawScanline; rle->rawValues = rle->rawScanline;
//winpr_HexDump(rle->rawScanline, width);
for (j = 1; j < width; j++) for (j = 1; j < width; j++)
{ {
bSymbolMatch = FALSE; bSymbolMatch = FALSE;
@ -629,7 +622,7 @@ BYTE* freerdp_bitmap_planar_compress_plane_rle(BYTE* inPlane, int width, int hei
return outPlane; return outPlane;
} }
int freerdp_bitmap_planar_compress_planes_rle(BYTE* inPlanes[5], int width, int height, BYTE* outPlanes, int* dstSizes) int freerdp_bitmap_planar_compress_planes_rle(BYTE* inPlanes[4], int width, int height, BYTE* outPlanes, int* dstSizes)
{ {
int outPlanesSize = width * height * 4; int outPlanesSize = width * height * 4;
@ -713,7 +706,7 @@ BYTE* freerdp_bitmap_planar_delta_encode_plane(BYTE* inPlane, int width, int hei
return outPlane; return outPlane;
} }
int freerdp_bitmap_planar_delta_encode_planes(BYTE* inPlanes[5], int width, int height, BYTE* outPlanes[5]) int freerdp_bitmap_planar_delta_encode_planes(BYTE* inPlanes[4], int width, int height, BYTE* outPlanes[4])
{ {
freerdp_bitmap_planar_delta_encode_plane(inPlanes[0], width, height, outPlanes[0]); freerdp_bitmap_planar_delta_encode_plane(inPlanes[0], width, height, outPlanes[0]);
freerdp_bitmap_planar_delta_encode_plane(inPlanes[1], width, height, outPlanes[1]); freerdp_bitmap_planar_delta_encode_plane(inPlanes[1], width, height, outPlanes[1]);
@ -723,89 +716,48 @@ int freerdp_bitmap_planar_delta_encode_planes(BYTE* inPlanes[5], int width, int
return 0; return 0;
} }
//static int g_Count = 0; BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* context, BYTE* data, UINT32 format,
int width, int height, int scanline, BYTE* dstData, int* dstSize)
BYTE* freerdp_bitmap_compress_planar(BYTE* data, UINT32 format, int width, int height, int scanline, BYTE* dstData, int* dstSize)
{ {
int size; int size;
BYTE* dstp; BYTE* dstp;
int planeSize; int planeSize;
int dstSizes[4]; int dstSizes[4];
BYTE* planes[5];
BYTE* planesBuffer;
BYTE* deltaPlanes[5];
BYTE* deltaPlanesBuffer;
BYTE* rlePlanes[4];
BYTE* rlePlanesBuffer;
BYTE FormatHeader = 0; BYTE FormatHeader = 0;
if (context->AllowSkipAlpha)
FormatHeader |= PLANAR_FORMAT_HEADER_NA; FormatHeader |= PLANAR_FORMAT_HEADER_NA;
planeSize = width * height; planeSize = width * height;
planesBuffer = malloc(planeSize * 5); freerdp_split_color_planes(data, format, width, height, scanline, context->planes);
planes[0] = &planesBuffer[planeSize * 0];
planes[1] = &planesBuffer[planeSize * 1];
planes[2] = &planesBuffer[planeSize * 2];
planes[3] = &planesBuffer[planeSize * 3];
planes[4] = &planesBuffer[planeSize * 4];
deltaPlanesBuffer = malloc(planeSize * 5); if (context->AllowRunLengthEncoding)
deltaPlanes[0] = &deltaPlanesBuffer[planeSize * 0];
deltaPlanes[1] = &deltaPlanesBuffer[planeSize * 1];
deltaPlanes[2] = &deltaPlanesBuffer[planeSize * 2];
deltaPlanes[3] = &deltaPlanesBuffer[planeSize * 3];
deltaPlanes[4] = &deltaPlanesBuffer[planeSize * 4];
rlePlanesBuffer = malloc(planeSize * 4);
freerdp_split_color_planes(data, format, width, height, scanline, planes);
freerdp_bitmap_planar_delta_encode_planes(planes, width, height, deltaPlanes);
#if 0
{ {
g_Count++; freerdp_bitmap_planar_delta_encode_planes(context->planes, width, height, context->deltaPlanes);
BYTE* bitmap;
int bitmapLength;
bitmapLength = width * height * 4; if (freerdp_bitmap_planar_compress_planes_rle(context->deltaPlanes, width, height, context->rlePlanesBuffer, (int*) &dstSizes) > 0)
bitmap = malloc(width * height * 4);
ZeroMemory(bitmap, bitmapLength);
freerdp_bitmap_planar_decompress_plane_raw(planes[0], width, height, bitmap + 3, planeSize); /* A */
freerdp_bitmap_planar_decompress_plane_raw(planes[1], width, height, bitmap + 2, planeSize); /* R */
freerdp_bitmap_planar_decompress_plane_raw(planes[2], width, height, bitmap + 1, planeSize); /* G */
freerdp_bitmap_planar_decompress_plane_raw(planes[3], width, height, bitmap + 0, planeSize); /* B */
printf("Bitmap %02d\n", g_Count);
winpr_CArrayDump(bitmap, bitmapLength, 32);
free(bitmap);
}
#endif
if (freerdp_bitmap_planar_compress_planes_rle(deltaPlanes, width, height, rlePlanesBuffer, (int*) &dstSizes) > 0)
{ {
int offset = 0; int offset = 0;
FormatHeader |= PLANAR_FORMAT_HEADER_RLE; FormatHeader |= PLANAR_FORMAT_HEADER_RLE;
rlePlanes[0] = &rlePlanesBuffer[offset]; context->rlePlanes[0] = &context->rlePlanesBuffer[offset];
offset += dstSizes[0]; offset += dstSizes[0];
rlePlanes[1] = &rlePlanesBuffer[offset]; context->rlePlanes[1] = &context->rlePlanesBuffer[offset];
offset += dstSizes[1]; offset += dstSizes[1];
rlePlanes[2] = &rlePlanesBuffer[offset]; context->rlePlanes[2] = &context->rlePlanesBuffer[offset];
offset += dstSizes[2]; offset += dstSizes[2];
rlePlanes[3] = &rlePlanesBuffer[offset]; context->rlePlanes[3] = &context->rlePlanesBuffer[offset];
offset += dstSizes[3]; offset += dstSizes[3];
printf("R: [%d/%d] G: [%d/%d] B: [%d/%d]\n", printf("R: [%d/%d] G: [%d/%d] B: [%d/%d]\n",
dstSizes[1], planeSize, dstSizes[2], planeSize, dstSizes[3], planeSize); dstSizes[1], planeSize, dstSizes[2], planeSize, dstSizes[3], planeSize);
} }
}
if (!dstData) if (!dstData)
{ {
@ -842,12 +794,12 @@ BYTE* freerdp_bitmap_compress_planar(BYTE* data, UINT32 format, int width, int h
{ {
if (FormatHeader & PLANAR_FORMAT_HEADER_RLE) if (FormatHeader & PLANAR_FORMAT_HEADER_RLE)
{ {
CopyMemory(dstp, rlePlanes[0], dstSizes[0]); /* Alpha */ CopyMemory(dstp, context->rlePlanes[0], dstSizes[0]); /* Alpha */
dstp += dstSizes[0]; dstp += dstSizes[0];
} }
else else
{ {
CopyMemory(dstp, planes[0], planeSize); /* Alpha */ CopyMemory(dstp, context->planes[0], planeSize); /* Alpha */
dstp += planeSize; dstp += planeSize;
} }
} }
@ -856,12 +808,12 @@ BYTE* freerdp_bitmap_compress_planar(BYTE* data, UINT32 format, int width, int h
if (FormatHeader & PLANAR_FORMAT_HEADER_RLE) if (FormatHeader & PLANAR_FORMAT_HEADER_RLE)
{ {
CopyMemory(dstp, rlePlanes[1], dstSizes[1]); /* Red */ CopyMemory(dstp, context->rlePlanes[1], dstSizes[1]); /* Red */
dstp += dstSizes[1]; dstp += dstSizes[1];
} }
else else
{ {
CopyMemory(dstp, planes[1], planeSize); /* Red */ CopyMemory(dstp, context->planes[1], planeSize); /* Red */
dstp += planeSize; dstp += planeSize;
} }
@ -869,12 +821,12 @@ BYTE* freerdp_bitmap_compress_planar(BYTE* data, UINT32 format, int width, int h
if (FormatHeader & PLANAR_FORMAT_HEADER_RLE) if (FormatHeader & PLANAR_FORMAT_HEADER_RLE)
{ {
CopyMemory(dstp, rlePlanes[2], dstSizes[2]); /* Green */ CopyMemory(dstp, context->rlePlanes[2], dstSizes[2]); /* Green */
dstp += dstSizes[2]; dstp += dstSizes[2];
} }
else else
{ {
CopyMemory(dstp, planes[2], planeSize); /* Green */ CopyMemory(dstp, context->planes[2], planeSize); /* Green */
dstp += planeSize; dstp += planeSize;
} }
@ -882,12 +834,12 @@ BYTE* freerdp_bitmap_compress_planar(BYTE* data, UINT32 format, int width, int h
if (FormatHeader & PLANAR_FORMAT_HEADER_RLE) if (FormatHeader & PLANAR_FORMAT_HEADER_RLE)
{ {
CopyMemory(dstp, rlePlanes[3], dstSizes[3]); /* Blue */ CopyMemory(dstp, context->rlePlanes[3], dstSizes[3]); /* Blue */
dstp += dstSizes[3]; dstp += dstSizes[3];
} }
else else
{ {
CopyMemory(dstp, planes[3], planeSize); /* Blue */ CopyMemory(dstp, context->planes[3], planeSize); /* Blue */
dstp += planeSize; dstp += planeSize;
} }
@ -902,9 +854,63 @@ BYTE* freerdp_bitmap_compress_planar(BYTE* data, UINT32 format, int width, int h
size = (dstp - dstData); size = (dstp - dstData);
*dstSize = size; *dstSize = size;
free(rlePlanesBuffer);
free(deltaPlanesBuffer);
free(planesBuffer);
return dstData; return dstData;
} }
BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(DWORD flags, int maxWidth, int maxHeight)
{
BITMAP_PLANAR_CONTEXT* context;
context = (BITMAP_PLANAR_CONTEXT*) malloc(sizeof(BITMAP_PLANAR_CONTEXT));
if (!context)
return NULL;
ZeroMemory(context, sizeof(BITMAP_PLANAR_CONTEXT));
if (flags & PLANAR_FORMAT_HEADER_NA)
context->AllowSkipAlpha = TRUE;
if (flags & PLANAR_FORMAT_HEADER_RLE)
context->AllowRunLengthEncoding = TRUE;
if (flags & PLANAR_FORMAT_HEADER_CS)
context->AllowColorSubsampling = TRUE;
context->ColorLossLevel = flags & PLANAR_FORMAT_HEADER_CLL_MASK;
if (context->ColorLossLevel)
context->AllowDynamicColorFidelity = TRUE;
context->maxWidth = maxWidth;
context->maxHeight = maxHeight;
context->maxPlaneSize = context->maxWidth * context->maxHeight;
context->planesBuffer = malloc(context->maxPlaneSize * 4);
context->planes[0] = &context->planesBuffer[context->maxPlaneSize * 0];
context->planes[1] = &context->planesBuffer[context->maxPlaneSize * 1];
context->planes[2] = &context->planesBuffer[context->maxPlaneSize * 2];
context->planes[3] = &context->planesBuffer[context->maxPlaneSize * 3];
context->deltaPlanesBuffer = malloc(context->maxPlaneSize * 4);
context->deltaPlanes[0] = &context->deltaPlanesBuffer[context->maxPlaneSize * 0];
context->deltaPlanes[1] = &context->deltaPlanesBuffer[context->maxPlaneSize * 1];
context->deltaPlanes[2] = &context->deltaPlanesBuffer[context->maxPlaneSize * 2];
context->deltaPlanes[3] = &context->deltaPlanesBuffer[context->maxPlaneSize * 3];
context->rlePlanesBuffer = malloc(context->maxPlaneSize * 4);
return context;
}
void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT* context)
{
if (!context)
return;
free(context->planesBuffer);
free(context->deltaPlanesBuffer);
free(context->rlePlanesBuffer);
free(context);
}

View File

@ -23,6 +23,7 @@
#include <winpr/crt.h> #include <winpr/crt.h>
#include <freerdp/codec/color.h> #include <freerdp/codec/color.h>
#include <freerdp/codec/bitmap.h>
#define PLANAR_CONTROL_BYTE(_nRunLength, _cRawBytes) \ #define PLANAR_CONTROL_BYTE(_nRunLength, _cRawBytes) \
(_nRunLength & 0x0F) | ((_cRawBytes & 0x0F) << 4) (_nRunLength & 0x0F) | ((_cRawBytes & 0x0F) << 4)
@ -49,10 +50,6 @@ struct _RDP6_RLE_SEGMENTS
}; };
typedef struct _RDP6_RLE_SEGMENTS RDP6_RLE_SEGMENTS; typedef struct _RDP6_RLE_SEGMENTS RDP6_RLE_SEGMENTS;
#define PLANAR_FORMAT_HEADER_CS (1 << 3)
#define PLANAR_FORMAT_HEADER_RLE (1 << 4)
#define PLANAR_FORMAT_HEADER_NA (1 << 5)
struct _RDP6_BITMAP_STREAM struct _RDP6_BITMAP_STREAM
{ {
/** /**
@ -67,11 +64,34 @@ struct _RDP6_BITMAP_STREAM
}; };
typedef struct _RDP6_BITMAP_STREAM RDP6_BITMAP_STREAM; typedef struct _RDP6_BITMAP_STREAM RDP6_BITMAP_STREAM;
struct _BITMAP_PLANAR_CONTEXT
{
int maxWidth;
int maxHeight;
int maxPlaneSize;
BOOL AllowSkipAlpha;
BOOL AllowRunLengthEncoding;
BOOL AllowColorSubsampling;
BOOL AllowDynamicColorFidelity;
int ColorLossLevel;
BYTE* planes[4];
BYTE* planesBuffer;
BYTE* deltaPlanes[4];
BYTE* deltaPlanesBuffer;
BYTE* rlePlanes[4];
BYTE* rlePlanesBuffer;
};
int freerdp_bitmap_planar_decompress(BYTE* srcData, BYTE* dstData, int width, int height, int size); int freerdp_bitmap_planar_decompress(BYTE* srcData, BYTE* dstData, int width, int height, int size);
int freerdp_split_color_planes(BYTE* data, UINT32 format, int width, int height, int scanline, BYTE* planes[5]); int freerdp_split_color_planes(BYTE* data, UINT32 format, int width, int height, int scanline, BYTE* planes[4]);
BYTE* freerdp_bitmap_planar_compress_plane_rle(BYTE* plane, int width, int height, BYTE* outPlane, int* dstSize); BYTE* freerdp_bitmap_planar_compress_plane_rle(BYTE* plane, int width, int height, BYTE* outPlane, int* dstSize);
BYTE* freerdp_bitmap_planar_delta_encode_plane(BYTE* inPlane, int width, int height, BYTE* outPlane); BYTE* freerdp_bitmap_planar_delta_encode_plane(BYTE* inPlane, int width, int height, BYTE* outPlane);
int freerdp_bitmap_planar_delta_encode_planes(BYTE* inPlanes[5], int width, int height, BYTE* outPlanes[5]); int freerdp_bitmap_planar_delta_encode_planes(BYTE* inPlanes[4], int width, int height, BYTE* outPlanes[4]);
#endif /* FREERDP_CODEC_PLANAR_PRIVATE_H */ #endif /* FREERDP_CODEC_PLANAR_PRIVATE_H */

View File

@ -1858,6 +1858,7 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
int dstSize; int dstSize;
UINT32 format; UINT32 format;
HCLRCONV clrconv; HCLRCONV clrconv;
DWORD planarFlags;
BYTE* srcBitmap32; BYTE* srcBitmap32;
BYTE* srcBitmap16; BYTE* srcBitmap16;
int width, height; int width, height;
@ -1866,6 +1867,12 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
BYTE* randomBitmap; BYTE* randomBitmap;
BYTE* compressedBitmap; BYTE* compressedBitmap;
BYTE* decompressedBitmap; BYTE* decompressedBitmap;
BITMAP_PLANAR_CONTEXT* planar;
planarFlags = PLANAR_FORMAT_HEADER_NA;
//planarFlags |= PLANAR_FORMAT_HEADER_RLE;
planar = freerdp_bitmap_planar_context_new(planarFlags, 64, 64);
clrconv = freerdp_clrconv_new(0); clrconv = freerdp_clrconv_new(0);
srcBitmap16 = (BYTE*) TEST_RLE_UNCOMPRESSED_BITMAP_16BPP; srcBitmap16 = (BYTE*) TEST_RLE_UNCOMPRESSED_BITMAP_16BPP;
@ -1874,8 +1881,8 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
format = FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ARGB, FREERDP_PIXEL_FLIP_NONE); format = FREERDP_PIXEL_FORMAT(32, FREERDP_PIXEL_FORMAT_TYPE_ARGB, FREERDP_PIXEL_FLIP_NONE);
#if 0 #if 1
freerdp_bitmap_compress_planar(srcBitmap32, format, 32, 32, 32 * 4, NULL, &dstSize); freerdp_bitmap_compress_planar(planar, srcBitmap32, format, 32, 32, 32 * 4, NULL, &dstSize);
freerdp_bitmap_planar_compress_plane_rle((BYTE*) TEST_RLE_SCANLINE_UNCOMPRESSED, 12, 1, NULL, &dstSize); freerdp_bitmap_planar_compress_plane_rle((BYTE*) TEST_RLE_SCANLINE_UNCOMPRESSED, 12, 1, NULL, &dstSize);
@ -1892,7 +1899,7 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
FillMemory(whiteBitmap, width * height * 4, 0xFF); FillMemory(whiteBitmap, width * height * 4, 0xFF);
fill_bitmap_alpha_channel(whiteBitmap, width, height, 0x00); fill_bitmap_alpha_channel(whiteBitmap, width, height, 0x00);
compressedBitmap = freerdp_bitmap_compress_planar(whiteBitmap, format, width, height, width * 4, NULL, &dstSize); compressedBitmap = freerdp_bitmap_compress_planar(planar, whiteBitmap, format, width, height, width * 4, NULL, &dstSize);
decompressedBitmap = (BYTE*) malloc(width * height * 4); decompressedBitmap = (BYTE*) malloc(width * height * 4);
ZeroMemory(decompressedBitmap, width * height * 4); ZeroMemory(decompressedBitmap, width * height * 4);
@ -1932,7 +1939,7 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
ZeroMemory(blackBitmap, width * height * 4); ZeroMemory(blackBitmap, width * height * 4);
fill_bitmap_alpha_channel(blackBitmap, width, height, 0x00); fill_bitmap_alpha_channel(blackBitmap, width, height, 0x00);
compressedBitmap = freerdp_bitmap_compress_planar(blackBitmap, format, width, height, width * 4, NULL, &dstSize); compressedBitmap = freerdp_bitmap_compress_planar(planar, blackBitmap, format, width, height, width * 4, NULL, &dstSize);
decompressedBitmap = (BYTE*) malloc(width * height * 4); decompressedBitmap = (BYTE*) malloc(width * height * 4);
ZeroMemory(decompressedBitmap, width * height * 4); ZeroMemory(decompressedBitmap, width * height * 4);
@ -1977,7 +1984,7 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
fill_bitmap_alpha_channel(randomBitmap, width, height, 0x00); fill_bitmap_alpha_channel(randomBitmap, width, height, 0x00);
compressedBitmap = freerdp_bitmap_compress_planar(randomBitmap, format, width, height, width * 4, NULL, &dstSize); compressedBitmap = freerdp_bitmap_compress_planar(planar, randomBitmap, format, width, height, width * 4, NULL, &dstSize);
decompressedBitmap = (BYTE*) malloc(width * height * 4); decompressedBitmap = (BYTE*) malloc(width * height * 4);
ZeroMemory(decompressedBitmap, width * height * 4); ZeroMemory(decompressedBitmap, width * height * 4);
@ -2009,13 +2016,13 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
} }
#endif #endif
#if 0 #if 1
/* Experimental Case 01 */ /* Experimental Case 01 */
width = 64; width = 64;
height = 64; height = 64;
compressedBitmap = freerdp_bitmap_compress_planar((BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_01, compressedBitmap = freerdp_bitmap_compress_planar(planar, (BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_01,
format, width, height, width * 4, NULL, &dstSize); format, width, height, width * 4, NULL, &dstSize);
decompressedBitmap = (BYTE*) malloc(width * height * 4); decompressedBitmap = (BYTE*) malloc(width * height * 4);
@ -2052,13 +2059,13 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
free(decompressedBitmap); free(decompressedBitmap);
#endif #endif
#if 0 #if 1
/* Experimental Case 02 */ /* Experimental Case 02 */
width = 64; width = 64;
height = 64; height = 64;
compressedBitmap = freerdp_bitmap_compress_planar((BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_02, compressedBitmap = freerdp_bitmap_compress_planar(planar, (BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_02,
format, width, height, width * 4, NULL, &dstSize); format, width, height, width * 4, NULL, &dstSize);
decompressedBitmap = (BYTE*) malloc(width * height * 4); decompressedBitmap = (BYTE*) malloc(width * height * 4);
@ -2100,7 +2107,7 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
width = 64; width = 64;
height = 64; height = 64;
compressedBitmap = freerdp_bitmap_compress_planar((BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_03, compressedBitmap = freerdp_bitmap_compress_planar(planar, (BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_03,
format, width, height, width * 4, NULL, &dstSize); format, width, height, width * 4, NULL, &dstSize);
decompressedBitmap = (BYTE*) malloc(width * height * 4); decompressedBitmap = (BYTE*) malloc(width * height * 4);
@ -2139,5 +2146,7 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
freerdp_clrconv_free(clrconv); freerdp_clrconv_free(clrconv);
free(srcBitmap32); free(srcBitmap32);
freerdp_bitmap_planar_context_free(planar);
return 0; return 0;
} }

View File

@ -368,7 +368,8 @@ BOOL rdp_server_accept_client_font_list_pdu(rdpRdp* rdp, wStream* s)
if (!rdp_send_server_font_map_pdu(rdp)) if (!rdp_send_server_font_map_pdu(rdp))
return FALSE; return FALSE;
rdp_server_transition_to_state(rdp, CONNECTION_STATE_ACTIVE); if (rdp_server_transition_to_state(rdp, CONNECTION_STATE_ACTIVE) < 0)
return FALSE;
return TRUE; return TRUE;
} }

View File

@ -2387,13 +2387,15 @@ BOOL rdp_print_large_pointer_capability_set(wStream* s, UINT16 length)
BOOL rdp_read_surface_commands_capability_set(wStream* s, UINT16 length, rdpSettings* settings) BOOL rdp_read_surface_commands_capability_set(wStream* s, UINT16 length, rdpSettings* settings)
{ {
UINT32 cmdFlags;
if (length < 12) if (length < 12)
return FALSE; return FALSE;
Stream_Seek_UINT32(s); /* cmdFlags (4 bytes) */ Stream_Read_UINT32(s, cmdFlags); /* cmdFlags (4 bytes) */
Stream_Seek_UINT32(s); /* reserved (4 bytes) */ Stream_Seek_UINT32(s); /* reserved (4 bytes) */
settings->SurfaceCommandsEnabled = TRUE; settings->SurfaceCommandsEnabled = TRUE;
settings->SurfaceFrameMarkerEnabled = (cmdFlags & SURFCMDS_FRAME_MARKER);
return TRUE; return TRUE;
} }
@ -2414,9 +2416,10 @@ void rdp_write_surface_commands_capability_set(wStream* s, rdpSettings* settings
header = rdp_capability_set_start(s); header = rdp_capability_set_start(s);
cmdFlags = SURFCMDS_FRAME_MARKER | cmdFlags = SURFCMDS_SET_SURFACE_BITS |
SURFCMDS_SET_SURFACE_BITS |
SURFCMDS_STREAM_SURFACE_BITS; SURFCMDS_STREAM_SURFACE_BITS;
if (settings->SurfaceFrameMarkerEnabled)
cmdFlags |= SURFCMDS_FRAME_MARKER;
Stream_Write_UINT32(s, cmdFlags); /* cmdFlags (4 bytes) */ Stream_Write_UINT32(s, cmdFlags); /* cmdFlags (4 bytes) */
Stream_Write_UINT32(s, 0); /* reserved (4 bytes) */ Stream_Write_UINT32(s, 0); /* reserved (4 bytes) */

View File

@ -313,6 +313,7 @@ rdpSettings* freerdp_settings_new(DWORD flags)
settings->DrawGdiPlusEnabled = FALSE; settings->DrawGdiPlusEnabled = FALSE;
settings->FrameMarkerCommandEnabled = FALSE; settings->FrameMarkerCommandEnabled = FALSE;
settings->SurfaceFrameMarkerEnabled = TRUE;
settings->BitmapCacheV3Enabled = FALSE; settings->BitmapCacheV3Enabled = FALSE;
settings->BitmapCacheEnabled = TRUE; settings->BitmapCacheEnabled = TRUE;
@ -668,6 +669,7 @@ rdpSettings* freerdp_settings_clone(rdpSettings* settings)
_settings->SoundBeepsEnabled = settings->SoundBeepsEnabled; /* 2944 */ _settings->SoundBeepsEnabled = settings->SoundBeepsEnabled; /* 2944 */
_settings->SurfaceCommandsEnabled = settings->SurfaceCommandsEnabled; /* 3520 */ _settings->SurfaceCommandsEnabled = settings->SurfaceCommandsEnabled; /* 3520 */
_settings->FrameMarkerCommandEnabled = settings->FrameMarkerCommandEnabled; /* 3521 */ _settings->FrameMarkerCommandEnabled = settings->FrameMarkerCommandEnabled; /* 3521 */
_settings->SurfaceFrameMarkerEnabled = settings->SurfaceFrameMarkerEnabled; /* 3522 */
_settings->RemoteFxOnly = settings->RemoteFxOnly; /* 3648 */ _settings->RemoteFxOnly = settings->RemoteFxOnly; /* 3648 */
_settings->RemoteFxCodec = settings->RemoteFxCodec; /* 3649 */ _settings->RemoteFxCodec = settings->RemoteFxCodec; /* 3649 */
_settings->RemoteFxImageCodec = settings->RemoteFxImageCodec; /* 3652 */ _settings->RemoteFxImageCodec = settings->RemoteFxImageCodec; /* 3652 */