FreeRDP
ncrush.c File Reference
#include <winpr/assert.h>
#include <freerdp/config.h>
#include <winpr/crt.h>
#include <winpr/print.h>
#include <winpr/bitstream.h>
#include <freerdp/log.h>
#include <freerdp/types.h>
#include "ncrush.h"

Macros

#define TAG   FREERDP_TAG("codec")
 

Functions

static INLINE UINT16 get_word (const BYTE *data)
 
static INLINE UINT32 get_dword (const BYTE *data)
 
static INLINE BOOL NCrushFetchBits (const BYTE **SrcPtr, const BYTE **SrcEnd, INT32 *nbits, UINT32 *bits)
 
static INLINE void NCrushWriteStart (UINT32 *bits, UINT32 *offset, UINT32 *accumulator)
 
static INLINE void NCrushWriteBits (BYTE **DstPtr, UINT32 *accumulator, UINT32 *offset, UINT32 _bits, UINT32 _nbits)
 
static INLINE void NCrushWriteFinish (BYTE **DstPtr, UINT32 accumulator)
 
int ncrush_decompress (NCRUSH_CONTEXT *ncrush, const BYTE *pSrcData, UINT32 SrcSize, const BYTE **ppDstData, UINT32 *pDstSize, UINT32 flags)
 
static int ncrush_hash_table_add (NCRUSH_CONTEXT *ncrush, const BYTE *pSrcData, UINT32 SrcSize, UINT32 HistoryOffset)
 
static int ncrush_find_match_length (const BYTE *Ptr1, const BYTE *Ptr2, BYTE *HistoryPtr)
 
static int ncrush_find_best_match (NCRUSH_CONTEXT *ncrush, UINT16 HistoryOffset, UINT32 *pMatchOffset)
 
static int ncrush_move_encoder_windows (NCRUSH_CONTEXT *ncrush, BYTE *HistoryPtr)
 
int ncrush_compress (NCRUSH_CONTEXT *ncrush, const BYTE *pSrcData, UINT32 SrcSize, BYTE *pDstBuffer, const BYTE **ppDstData, UINT32 *pDstSize, UINT32 *pFlags)
 
static int ncrush_generate_tables (NCRUSH_CONTEXT *context)
 
void ncrush_context_reset (NCRUSH_CONTEXT *ncrush, BOOL flush)
 
NCRUSH_CONTEXT * ncrush_context_new (BOOL Compressor)
 
void ncrush_context_free (NCRUSH_CONTEXT *ncrush)
 

Variables

static const UINT16 HuffTableLEC [8192]
 
static const UINT16 HuffTableLOM [512]
 
static const BYTE HuffTableMask [39]
 
static const BYTE HuffLengthLEC [294]
 
static const BYTE HuffCodeLEC [588]
 
static const BYTE HuffLengthLOM [32]
 
static const UINT16 HuffCodeLOM [32]
 
static const UINT32 CopyOffsetBitsLUT [32]
 
static const UINT32 CopyOffsetBaseLUT [32]
 
static const UINT32 LOMBitsLUT [30]
 
static const UINT32 LOMBaseLUT [30]
 

Macro Definition Documentation

◆ TAG

#define TAG   FREERDP_TAG("codec")

FreeRDP: A Remote Desktop Protocol Implementation NCrush (RDP6) Bulk Data Compression

Copyright 2014 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2017 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2017 Thincast Technologies GmbH

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.

Function Documentation

◆ get_dword()

static INLINE UINT32 get_dword ( const BYTE data)
static
Here is the caller graph for this function:

◆ get_word()

static INLINE UINT16 get_word ( const BYTE data)
static
Here is the caller graph for this function:

◆ ncrush_compress()

int ncrush_compress ( NCRUSH_CONTEXT *  ncrush,
const BYTE pSrcData,
UINT32  SrcSize,
BYTE pDstBuffer,
const BYTE **  ppDstData,
UINT32 *  pDstSize,
UINT32 *  pFlags 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncrush_context_free()

void ncrush_context_free ( NCRUSH_CONTEXT *  ncrush)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncrush_context_new()

NCRUSH_CONTEXT* ncrush_context_new ( BOOL  Compressor)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncrush_context_reset()

void ncrush_context_reset ( NCRUSH_CONTEXT *  ncrush,
BOOL  flush 
)
Here is the caller graph for this function:

◆ ncrush_decompress()

int ncrush_decompress ( NCRUSH_CONTEXT *  ncrush,
const BYTE pSrcData,
UINT32  SrcSize,
const BYTE **  ppDstData,
UINT32 *  pDstSize,
UINT32  flags 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncrush_find_best_match()

static int ncrush_find_best_match ( NCRUSH_CONTEXT *  ncrush,
UINT16  HistoryOffset,
UINT32 *  pMatchOffset 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncrush_find_match_length()

static int ncrush_find_match_length ( const BYTE Ptr1,
const BYTE Ptr2,
BYTE HistoryPtr 
)
static
Here is the caller graph for this function:

◆ ncrush_generate_tables()

static int ncrush_generate_tables ( NCRUSH_CONTEXT *  context)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncrush_hash_table_add()

static int ncrush_hash_table_add ( NCRUSH_CONTEXT *  ncrush,
const BYTE pSrcData,
UINT32  SrcSize,
UINT32  HistoryOffset 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncrush_move_encoder_windows()

static int ncrush_move_encoder_windows ( NCRUSH_CONTEXT *  ncrush,
BYTE HistoryPtr 
)
static
Here is the caller graph for this function:

◆ NCrushFetchBits()

static INLINE BOOL NCrushFetchBits ( const BYTE **  SrcPtr,
const BYTE **  SrcEnd,
INT32 *  nbits,
UINT32 *  bits 
)
static
Here is the caller graph for this function:

◆ NCrushWriteBits()

static INLINE void NCrushWriteBits ( BYTE **  DstPtr,
UINT32 *  accumulator,
UINT32 *  offset,
UINT32  _bits,
UINT32  _nbits 
)
static
Here is the caller graph for this function:

◆ NCrushWriteFinish()

static INLINE void NCrushWriteFinish ( BYTE **  DstPtr,
UINT32  accumulator 
)
static
Here is the caller graph for this function:

◆ NCrushWriteStart()

static INLINE void NCrushWriteStart ( UINT32 *  bits,
UINT32 *  offset,
UINT32 *  accumulator 
)
static
Here is the caller graph for this function:

Variable Documentation

◆ CopyOffsetBaseLUT

const UINT32 CopyOffsetBaseLUT[32]
static

◆ CopyOffsetBitsLUT

const UINT32 CopyOffsetBitsLUT[32]
static

◆ HuffCodeLEC

const BYTE HuffCodeLEC[588]
static

◆ HuffCodeLOM

const UINT16 HuffCodeLOM[32]
static

◆ HuffLengthLEC

const BYTE HuffLengthLEC[294]
static

◆ HuffLengthLOM

const BYTE HuffLengthLOM[32]
static

◆ HuffTableLEC

const UINT16 HuffTableLEC[8192]
static

◆ HuffTableLOM

const UINT16 HuffTableLOM[512]
static

◆ HuffTableMask

const BYTE HuffTableMask[39]
static

◆ LOMBaseLUT

const UINT32 LOMBaseLUT[30]
static

◆ LOMBitsLUT

const UINT32 LOMBitsLUT[30]
static