FreeRDP
rfx_rlgr.c File Reference
#include <freerdp/config.h>
#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 *WINPR_RESTRICT pSrcData, UINT32 SrcSize, INT16 *WINPR_RESTRICT pDstData, UINT32 rDstSize)
 
static void rfx_rlgr_code_gr (RFX_BITSTREAM *bs, int *krp, UINT32 val)
 
int rfx_rlgr_encode (RLGR_MODE mode, const INT16 *WINPR_RESTRICT data, UINT32 data_size, BYTE *WINPR_RESTRICT buffer, UINT32 buffer_size)
 

Variables

static BOOL g_LZCNT = FALSE
 
static INIT_ONCE rfx_rlgr_init_once = INIT_ONCE_STATIC_INIT
 

Macro Definition Documentation

◆ CodeGR

#define CodeGR (   krp,
  val 
)    rfx_rlgr_code_gr(bs, krp, val)

◆ DN_GR

#define DN_GR   (6) /* decrease in kp after a nonzero symbol in RL mode */

◆ DQ_GR

#define DQ_GR   (3) /* decrease in kp after zero symbol in GR mode */

◆ Get2MagSign

#define Get2MagSign (   input)    ((input) >= 0 ? 2 * (input) : -2 * (input)-1)

◆ GetMinBits

#define GetMinBits (   _val,
  _nbits 
)
Value:
do \
{ \
UINT32 _v = (_val); \
(_nbits) = 0; \
while (_v) \
{ \
_v >>= 1; \
(_nbits)++; \
} \
} while (0)

◆ GetNextInput

#define GetNextInput (   _n)
Value:
do \
{ \
if (data_size > 0) \
{ \
(_n) = *data++; \
data_size--; \
} \
else \
{ \
(_n) = 0; \
} \
} while (0)
audin data
Definition: audin_main.c:1025

◆ KPMAX

#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

◆ LSGR

#define LSGR   (3) /* shift count to convert kp to k */

◆ OutputBit

#define OutputBit (   count,
  bit 
)
Value:
do \
{ \
UINT16 _b = ((bit) ? 0xFFFF : 0); \
int _c = (count); \
for (; _c > 0; _c -= 16) \
rfx_bitstream_put_bits(bs, _b, (_c > 16 ? 16 : _c)); \
} while (0)
static LONG count
Definition: TestPoolWork.c:7
#define rfx_bitstream_put_bits(bs, _bits, _nbits)
Definition: rfx_bitstream.h:67

◆ OutputBits

#define OutputBits (   numBits,
  bitPattern 
)    rfx_bitstream_put_bits(bs, bitPattern, numBits)

◆ UP_GR

#define UP_GR   (4) /* increase in kp after a zero run in RL mode */

◆ UpdateParam

#define UpdateParam (   _param,
  _deltaP,
  _k 
)
Value:
do \
{ \
(_param) += (_deltaP); \
if ((_param) > KPMAX) \
(_param) = KPMAX; \
if ((_param) < 0) \
(_param) = 0; \
(_k) = ((_param) >> LSGR); \
} while (0)
#define KPMAX
Definition: rfx_rlgr.c:42
#define LSGR
Definition: rfx_rlgr.c:43

◆ UQ_GR

#define UQ_GR   (3) /* increase in kp after nonzero symbol in GR mode */

Function Documentation

◆ lzcnt_s()

static INLINE UINT32 lzcnt_s ( UINT32  x)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rfx_rlgr_code_gr()

static void rfx_rlgr_code_gr ( RFX_BITSTREAM bs,
int *  krp,
UINT32  val 
)
static

◆ rfx_rlgr_decode()

int rfx_rlgr_decode ( RLGR_MODE  mode,
const BYTE *WINPR_RESTRICT  pSrcData,
UINT32  SrcSize,
INT16 *WINPR_RESTRICT  pDstData,
UINT32  rDstSize 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rfx_rlgr_encode()

int rfx_rlgr_encode ( RLGR_MODE  mode,
const INT16 *WINPR_RESTRICT  data,
UINT32  data_size,
BYTE *WINPR_RESTRICT  buffer,
UINT32  buffer_size 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rfx_rlgr_init()

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

◆ g_LZCNT

BOOL g_LZCNT = FALSE
static

◆ rfx_rlgr_init_once

INIT_ONCE rfx_rlgr_init_once = INIT_ONCE_STATIC_INIT
static