FreeRDP
rfx_rlgr.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#include <winpr/print.h>
#include <winpr/sysinfo.h>
#include <winpr/bitstream.h>
#include <winpr/intrin.h>
#include "rfx_bitstream.h"
#include "rfx_rlgr.h"

Macros

#define KPMAX   (80) /* max value for kp or krp */
 
#define LSGR   (3) /* shift count to convert kp to k */
 
#define UP_GR   (4) /* increase in kp after a zero run in RL mode */
 
#define DN_GR   (6) /* decrease in kp after a nonzero symbol in RL mode */
 
#define UQ_GR   (3) /* increase in kp after nonzero symbol in GR mode */
 
#define DQ_GR   (3) /* decrease in kp after zero symbol in GR mode */
 
#define GetMinBits(_val, _nbits)
 
#define UpdateParam(_param, _deltaP, _k)
 
#define GetNextInput(_n)
 
#define OutputBits(numBits, bitPattern)   rfx_bitstream_put_bits(bs, bitPattern, numBits)
 
#define OutputBit(count, bit)
 
#define Get2MagSign(input)   ((input) >= 0 ? 2 * (input) : -2 * (input) - 1)
 
#define CodeGR(krp, val)   rfx_rlgr_code_gr(bs, krp, val)
 

Functions

static BOOL CALLBACK rfx_rlgr_init (PINIT_ONCE once, PVOID param, PVOID *context)
 
static INLINE UINT32 lzcnt_s (UINT32 x)
 
int rfx_rlgr_decode (RLGR_MODE mode, const BYTE *pSrcData, UINT32 SrcSize, INT16 *pDstData, UINT32 DstSize)
 
static void rfx_rlgr_code_gr (RFX_BITSTREAM *bs, int *krp, UINT32 val)
 
int rfx_rlgr_encode (RLGR_MODE mode, const INT16 *data, UINT32 data_size, BYTE *buffer, UINT32 buffer_size)
 

Variables

static BOOL g_LZCNT = FALSE
 
static INIT_ONCE rfx_rlgr_init_once = INIT_ONCE_STATIC_INIT
 

Macro Definition Documentation

#define CodeGR (   krp,
  val 
)    rfx_rlgr_code_gr(bs, krp, val)
#define DN_GR   (6) /* decrease in kp after a nonzero symbol in RL mode */
#define DQ_GR   (3) /* decrease in kp after zero symbol in GR mode */
#define Get2MagSign (   input)    ((input) >= 0 ? 2 * (input) : -2 * (input) - 1)
#define GetMinBits (   _val,
  _nbits 
)
Value:
{ \
UINT32 _v = _val; \
_nbits = 0; \
while (_v) \
{ \
_v >>= 1; \
_nbits++; \
} \
}
typedef UINT32
Definition: wf_interface.h:116
#define GetNextInput (   _n)
Value:
{ \
if (data_size > 0) \
{ \
_n = *data++; \
data_size--; \
} \
{ \
_n = 0; \
} \
}
GIT_REVISION else() git_get_exact_tag(GIT_REVISION--tags--always) if($
Definition: CMakeLists.txt:146
winpr freerdp if(WITH_DEBUG_SYMBOLS AND MSVC AND NOT BUILTIN_CHANNELS AND BUILD_SHARED_LIBS) install(FILES $
Definition: channels/drive/client/CMakeLists.txt:32
#define KPMAX   (80) /* max value for kp or krp */

FreeRDP: A Remote Desktop Protocol Implementation RemoteFX Codec Library - RLGR

Copyright 2011 Vic Lee

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. This implementation of RLGR refers to [MS-RDPRFX] 3.1.8.1.7.3 RLGR1/RLGR3 Pseudocode

#define LSGR   (3) /* shift count to convert kp to k */
#define OutputBit (   count,
  bit 
)
Value:
{ \
UINT16 _b = (bit ? 0xFFFF : 0); \
int _c = (count); \
for (; _c > 0; _c -= 16) \
rfx_bitstream_put_bits(bs, _b, (_c > 16 ? 16 : _c)); \
}
unsigned short UINT16
Definition: LECHash.c:2
static LONG count
Definition: TestPoolWork.c:6
#define rfx_bitstream_put_bits(bs, _bits, _nbits)
Definition: rfx_bitstream.h:62
#define OutputBits (   numBits,
  bitPattern 
)    rfx_bitstream_put_bits(bs, bitPattern, numBits)
#define UP_GR   (4) /* increase in kp after a zero run in RL mode */
#define UpdateParam (   _param,
  _deltaP,
  _k 
)
Value:
{ \
_param += _deltaP; \
if (_param > KPMAX) \
_param = KPMAX; \
if (_param < 0) \
_param = 0; \
_k = (_param >> LSGR); \
}
#define LSGR
Definition: rfx_rlgr.c:45
#define KPMAX
Definition: rfx_rlgr.c:44
winpr freerdp if(WITH_DEBUG_SYMBOLS AND MSVC AND NOT BUILTIN_CHANNELS AND BUILD_SHARED_LIBS) install(FILES $
Definition: channels/drive/client/CMakeLists.txt:32
#define UQ_GR   (3) /* increase in kp after nonzero symbol in GR mode */

Function Documentation

static INLINE UINT32 lzcnt_s ( UINT32  x)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void rfx_rlgr_code_gr ( RFX_BITSTREAM *  bs,
int *  krp,
UINT32  val 
)
static
int rfx_rlgr_decode ( RLGR_MODE  mode,
const BYTE pSrcData,
UINT32  SrcSize,
INT16 *  pDstData,
UINT32  DstSize 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int rfx_rlgr_encode ( RLGR_MODE  mode,
const INT16 *  data,
UINT32  data_size,
BYTE buffer,
UINT32  buffer_size 
)

FreeRDP: A Remote Desktop Protocol Implementation RemoteFX Codec Library - RLGR

Copyright 2011 Vic Lee

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.

Here is the caller graph for this function:

static BOOL CALLBACK rfx_rlgr_init ( PINIT_ONCE  once,
PVOID  param,
PVOID *  context 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

BOOL g_LZCNT = FALSE
static
INIT_ONCE rfx_rlgr_init_once = INIT_ONCE_STATIC_INIT
static