libfreerdp-codec: stub ncrush bulk compression

This commit is contained in:
Marc-André Moreau 2014-03-15 14:03:05 -04:00
parent ac1d819608
commit 47ed6002f6
5 changed files with 137 additions and 0 deletions

View File

@ -0,0 +1,56 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* NCrush (RDP6) Bulk Data Compression
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* 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_NCRUSH_H
#define FREERDP_CODEC_NCRUSH_H
#include <freerdp/api.h>
#include <freerdp/types.h>
#include <freerdp/codec/mppc.h>
#include <winpr/bitstream.h>
struct _NCRUSH_CONTEXT
{
wBitStream* bs;
BOOL Compressor;
BYTE* HistoryPtr;
UINT32 HistoryOffset;
UINT32 HistoryBufferSize;
BYTE HistoryBuffer[65536];
};
typedef struct _NCRUSH_CONTEXT NCRUSH_CONTEXT;
#ifdef __cplusplus
extern "C" {
#endif
FREERDP_API int ncrush_compress(NCRUSH_CONTEXT* ncrush, BYTE* pSrcData, UINT32 SrcSize, BYTE* pDstData, UINT32* pDstSize, UINT32* pFlags);
FREERDP_API int ncrush_decompress(NCRUSH_CONTEXT* ncrush, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32 flags);
FREERDP_API NCRUSH_CONTEXT* ncrush_context_new(BOOL Compressor);
FREERDP_API void ncrush_context_free(NCRUSH_CONTEXT* ncrush);
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_CODEC_NCRUSH_H */

View File

@ -47,6 +47,7 @@ set(${MODULE_PREFIX}_SRCS
nsc_encode.c
nsc_encode.h
nsc_types.h
ncrush.c
mppc.c
mppc_dec.c
mppc_enc.c

70
libfreerdp/codec/ncrush.c Normal file
View File

@ -0,0 +1,70 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* NCrush (RDP6) Bulk Data Compression
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* 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 <winpr/crt.h>
#include <winpr/print.h>
#include <winpr/bitstream.h>
#include <freerdp/codec/ncrush.h>
int ncrush_compress(NCRUSH_CONTEXT* ncrush, BYTE* pSrcData, UINT32 SrcSize, BYTE* pDstData, UINT32* pDstSize, UINT32* pFlags)
{
return 1;
}
int ncrush_decompress(NCRUSH_CONTEXT* ncrush, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32 flags)
{
return 1;
}
NCRUSH_CONTEXT* ncrush_context_new(BOOL Compressor)
{
NCRUSH_CONTEXT* ncrush;
ncrush = (NCRUSH_CONTEXT*) calloc(1, sizeof(NCRUSH_CONTEXT));
if (ncrush)
{
ncrush->Compressor = Compressor;
ncrush->bs = BitStream_New();
ncrush->HistoryBufferSize = 65536;
ZeroMemory(&(ncrush->HistoryBuffer), sizeof(ncrush->HistoryBuffer));
ncrush->HistoryOffset = 0;
ncrush->HistoryPtr = &(ncrush->HistoryBuffer[ncrush->HistoryOffset]);
}
return ncrush;
}
void ncrush_context_free(NCRUSH_CONTEXT* ncrush)
{
if (ncrush)
{
BitStream_Free(ncrush->bs);
free(ncrush);
}
}

View File

@ -7,6 +7,7 @@ set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
TestFreeRDPRegion.c
TestFreeRDPCodecMppc.c
TestFreeRDPCodecNCrush.c
TestFreeRDPCodecPlanar.c
TestFreeRDPCodecRemoteFX.c)

View File

@ -0,0 +1,9 @@
#include <winpr/crt.h>
#include <winpr/print.h>
#include <freerdp/codec/ncrush.h>
int TestFreeRDPCodecNCrush(int argc, char* argv[])
{
return 0;
}