diff --git a/include/freerdp/codec/bulk.h b/include/freerdp/codec/bulk.h new file mode 100644 index 000000000..ccc6a4d85 --- /dev/null +++ b/include/freerdp/codec/bulk.h @@ -0,0 +1,40 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * Bulk Data Compression + * + * Copyright 2014 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FREERDP_CODEC_BULK_H +#define FREERDP_CODEC_BULK_H + +#include +#include + +/* Level-2 Compression Flags */ + +#define PACKET_COMPRESSED 0x20 +#define PACKET_AT_FRONT 0x40 +#define PACKET_FLUSHED 0x80 + +/* Level-1 Compression Flags */ + +#define L1_PACKET_AT_FRONT 0x04 +#define L1_NO_COMPRESSION 0x02 +#define L1_COMPRESSED 0x01 +#define L1_INNER_COMPRESSION 0x10 + +#endif /* FREERDP_CODEC_BULK_H */ + diff --git a/include/freerdp/codec/mppc.h b/include/freerdp/codec/mppc.h index 6577e6261..fabf63726 100644 --- a/include/freerdp/codec/mppc.h +++ b/include/freerdp/codec/mppc.h @@ -25,9 +25,7 @@ #include -#define PACKET_COMPRESSED 0x20 -#define PACKET_AT_FRONT 0x40 -#define PACKET_FLUSHED 0x80 +#include struct _MPPC_CONTEXT { diff --git a/include/freerdp/codec/xcrush.h b/include/freerdp/codec/xcrush.h new file mode 100644 index 000000000..4be6e2d9e --- /dev/null +++ b/include/freerdp/codec/xcrush.h @@ -0,0 +1,69 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * XCrush (RDP6.1) Bulk Data Compression + * + * Copyright 2014 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FREERDP_CODEC_XCRUSH_H +#define FREERDP_CODEC_XCRUSH_H + +#include +#include + +#include + +struct _RDP61_MATCH_DETAILS +{ + UINT16 MatchLength; + UINT16 MatchOutputOffset; + UINT32 MatchHistoryOffset; +}; +typedef struct _RDP61_MATCH_DETAILS RDP61_MATCH_DETAILS; + +struct _RDP61_COMPRESSED_DATA +{ + BYTE Level1ComprFlags; + BYTE Level2ComprFlags; + UINT16 MatchCount; + RDP61_MATCH_DETAILS* MatchDetails; + BYTE* Literals; +}; +typedef struct _RDP61_COMPRESSED_DATA RDP61_COMPRESSED_DATA; + +struct _XCRUSH_CONTEXT +{ + BOOL Compressor; +}; +typedef struct _XCRUSH_CONTEXT XCRUSH_CONTEXT; + +#ifdef __cplusplus +extern "C" { +#endif + +FREERDP_API int xcrush_compress(XCRUSH_CONTEXT* xcrush, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32* pFlags); +FREERDP_API int xcrush_decompress(XCRUSH_CONTEXT* xcrush, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32 flags); + +FREERDP_API void xcrush_context_reset(XCRUSH_CONTEXT* xcrush); + +FREERDP_API XCRUSH_CONTEXT* xcrush_context_new(BOOL Compressor); +FREERDP_API void xcrush_context_free(XCRUSH_CONTEXT* xcrush); + +#ifdef __cplusplus +} +#endif + +#endif /* FREERDP_CODEC_XCRUSH_H */ + diff --git a/libfreerdp/codec/CMakeLists.txt b/libfreerdp/codec/CMakeLists.txt index 873726542..f6e392f82 100644 --- a/libfreerdp/codec/CMakeLists.txt +++ b/libfreerdp/codec/CMakeLists.txt @@ -48,6 +48,7 @@ set(${MODULE_PREFIX}_SRCS nsc_encode.h nsc_types.h ncrush.c + xcrush.c mppc.c jpeg.c) diff --git a/libfreerdp/codec/test/CMakeLists.txt b/libfreerdp/codec/test/CMakeLists.txt index 0eeb205a0..b63feac4c 100644 --- a/libfreerdp/codec/test/CMakeLists.txt +++ b/libfreerdp/codec/test/CMakeLists.txt @@ -8,6 +8,7 @@ set(${MODULE_PREFIX}_TESTS TestFreeRDPRegion.c TestFreeRDPCodecMppc.c TestFreeRDPCodecNCrush.c + TestFreeRDPCodecXCrush.c TestFreeRDPCodecPlanar.c TestFreeRDPCodecRemoteFX.c) diff --git a/libfreerdp/codec/test/TestFreeRDPCodecXCrush.c b/libfreerdp/codec/test/TestFreeRDPCodecXCrush.c new file mode 100644 index 000000000..84b77b455 --- /dev/null +++ b/libfreerdp/codec/test/TestFreeRDPCodecXCrush.c @@ -0,0 +1,10 @@ +#include +#include + +#include + +int TestFreeRDPCodecXCrush(int argc, char* argv[]) +{ + return 0; +} + diff --git a/libfreerdp/codec/xcrush.c b/libfreerdp/codec/xcrush.c new file mode 100644 index 000000000..cda1d5083 --- /dev/null +++ b/libfreerdp/codec/xcrush.c @@ -0,0 +1,68 @@ +/** + * FreeRDP: A Remote Desktop Protocol Implementation + * XCrush (RDP6.1) Bulk Data Compression + * + * Copyright 2014 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include + +int xcrush_decompress(XCRUSH_CONTEXT* xcrush, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32 flags) +{ + return 1; +} + +int xcrush_compress(XCRUSH_CONTEXT* xcrush, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32* pFlags) +{ + return 1; +} + +void xcrush_context_reset(XCRUSH_CONTEXT* xcrush) +{ + +} + +XCRUSH_CONTEXT* xcrush_context_new(BOOL Compressor) +{ + XCRUSH_CONTEXT* xcrush; + + xcrush = (XCRUSH_CONTEXT*) calloc(1, sizeof(XCRUSH_CONTEXT)); + + if (xcrush) + { + xcrush->Compressor = Compressor; + + xcrush_context_reset(xcrush); + } + + return xcrush; +} + +void xcrush_context_free(XCRUSH_CONTEXT* xcrush) +{ + if (xcrush) + { + free(xcrush); + } +} +