FreeRDP
clear.c File Reference
#include <freerdp/config.h>
#include <winpr/crt.h>
#include <winpr/print.h>
#include <winpr/bitstream.h>
#include <freerdp/codec/color.h>
#include <freerdp/codec/clear.h>
#include <freerdp/log.h>

Macros

#define TAG   FREERDP_TAG("codec.clear")
 
#define CLEARCODEC_FLAG_GLYPH_INDEX   0x01
 
#define CLEARCODEC_FLAG_GLYPH_HIT   0x02
 
#define CLEARCODEC_FLAG_CACHE_RESET   0x04
 
#define CLEARCODEC_VBAR_SIZE   32768
 
#define CLEARCODEC_VBAR_SHORT_SIZE   16384
 

Functions

static void clear_reset_vbar_storage (CLEAR_CONTEXT *WINPR_RESTRICT clear, BOOL zero)
 
static void clear_reset_glyph_cache (CLEAR_CONTEXT *WINPR_RESTRICT clear)
 
static BOOL convert_color (BYTE *WINPR_RESTRICT dst, UINT32 nDstStep, UINT32 DstFormat, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, const BYTE *WINPR_RESTRICT src, UINT32 nSrcStep, UINT32 SrcFormat, UINT32 nDstWidth, UINT32 nDstHeight, const gdiPalette *WINPR_RESTRICT palette)
 
static BOOL clear_decompress_nscodec (NSC_CONTEXT *WINPR_RESTRICT nsc, UINT32 width, UINT32 height, wStream *WINPR_RESTRICT s, UINT32 bitmapDataByteCount, BYTE *WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDstRel, UINT32 nYDstRel)
 
static BOOL clear_decompress_subcode_rlex (wStream *WINPR_RESTRICT s, UINT32 bitmapDataByteCount, UINT32 width, UINT32 height, BYTE *WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDstRel, UINT32 nYDstRel, UINT32 nDstWidth, UINT32 nDstHeight)
 
static BOOL clear_resize_buffer (CLEAR_CONTEXT *WINPR_RESTRICT clear, UINT32 width, UINT32 height)
 
static BOOL clear_decompress_residual_data (CLEAR_CONTEXT *WINPR_RESTRICT clear, wStream *WINPR_RESTRICT s, UINT32 residualByteCount, UINT32 nWidth, UINT32 nHeight, BYTE *WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight, const gdiPalette *WINPR_RESTRICT palette)
 
static BOOL clear_decompress_subcodecs_data (CLEAR_CONTEXT *WINPR_RESTRICT clear, wStream *WINPR_RESTRICT s, UINT32 subcodecByteCount, UINT32 nWidth, UINT32 nHeight, BYTE *WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight, const gdiPalette *WINPR_RESTRICT palette)
 
static BOOL resize_vbar_entry (CLEAR_CONTEXT *WINPR_RESTRICT clear, CLEAR_VBAR_ENTRY *WINPR_RESTRICT vBarEntry)
 
static BOOL clear_decompress_bands_data (CLEAR_CONTEXT *WINPR_RESTRICT clear, wStream *WINPR_RESTRICT s, UINT32 bandsByteCount, UINT32 nWidth, UINT32 nHeight, BYTE *WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight)
 
static BOOL clear_decompress_glyph_data (CLEAR_CONTEXT *WINPR_RESTRICT clear, wStream *WINPR_RESTRICT s, UINT32 glyphFlags, UINT32 nWidth, UINT32 nHeight, BYTE *WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight, const gdiPalette *WINPR_RESTRICT palette, BYTE **WINPR_RESTRICT ppGlyphData)
 
static INLINE BOOL updateContextFormat (CLEAR_CONTEXT *WINPR_RESTRICT clear, UINT32 DstFormat)
 
INT32 clear_decompress (CLEAR_CONTEXT *WINPR_RESTRICT clear, const BYTE *WINPR_RESTRICT pSrcData, UINT32 SrcSize, UINT32 nWidth, UINT32 nHeight, BYTE *WINPR_RESTRICT pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight, const gdiPalette *WINPR_RESTRICT palette)
 
int clear_compress (CLEAR_CONTEXT *WINPR_RESTRICT clear, const BYTE *WINPR_RESTRICT pSrcData, UINT32 SrcSize, BYTE **WINPR_RESTRICT ppDstData, UINT32 *WINPR_RESTRICT pDstSize)
 
BOOL clear_context_reset (CLEAR_CONTEXT *WINPR_RESTRICT clear)
 
CLEAR_CONTEXT * clear_context_new (BOOL Compressor)
 
void clear_context_free (CLEAR_CONTEXT *clear)
 

Variables

static const UINT32 CLEAR_LOG2_FLOOR [256]
 
static const BYTE CLEAR_8BIT_MASKS [9] = { 0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF }
 

Macro Definition Documentation

◆ CLEARCODEC_FLAG_CACHE_RESET

#define CLEARCODEC_FLAG_CACHE_RESET   0x04

◆ CLEARCODEC_FLAG_GLYPH_HIT

#define CLEARCODEC_FLAG_GLYPH_HIT   0x02

◆ CLEARCODEC_FLAG_GLYPH_INDEX

#define CLEARCODEC_FLAG_GLYPH_INDEX   0x01

◆ CLEARCODEC_VBAR_SHORT_SIZE

#define CLEARCODEC_VBAR_SHORT_SIZE   16384

◆ CLEARCODEC_VBAR_SIZE

#define CLEARCODEC_VBAR_SIZE   32768

◆ TAG

#define TAG   FREERDP_TAG("codec.clear")

FreeRDP: A Remote Desktop Protocol Implementation ClearCodec Bitmap Compression

Copyright 2014 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2016 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2016 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

◆ clear_compress()

int clear_compress ( CLEAR_CONTEXT *WINPR_RESTRICT  clear,
const BYTE *WINPR_RESTRICT  pSrcData,
UINT32  SrcSize,
BYTE **WINPR_RESTRICT  ppDstData,
UINT32 *WINPR_RESTRICT  pDstSize 
)

◆ clear_context_free()

void clear_context_free ( CLEAR_CONTEXT *  clear)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_context_new()

CLEAR_CONTEXT* clear_context_new ( BOOL  Compressor)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_context_reset()

BOOL clear_context_reset ( CLEAR_CONTEXT *WINPR_RESTRICT  clear)

The ClearCodec context is not bound to a particular surface, and its internal caches must NOT be reset on the ResetGraphics PDU.

Here is the caller graph for this function:

◆ clear_decompress()

INT32 clear_decompress ( CLEAR_CONTEXT *WINPR_RESTRICT  clear,
const BYTE *WINPR_RESTRICT  pSrcData,
UINT32  SrcSize,
UINT32  nWidth,
UINT32  nHeight,
BYTE *WINPR_RESTRICT  pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nDstWidth,
UINT32  nDstHeight,
const gdiPalette *WINPR_RESTRICT  palette 
)
Here is the call graph for this function:

◆ clear_decompress_bands_data()

static BOOL clear_decompress_bands_data ( CLEAR_CONTEXT *WINPR_RESTRICT  clear,
wStream *WINPR_RESTRICT  s,
UINT32  bandsByteCount,
UINT32  nWidth,
UINT32  nHeight,
BYTE *WINPR_RESTRICT  pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nDstWidth,
UINT32  nDstHeight 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_decompress_glyph_data()

static BOOL clear_decompress_glyph_data ( CLEAR_CONTEXT *WINPR_RESTRICT  clear,
wStream *WINPR_RESTRICT  s,
UINT32  glyphFlags,
UINT32  nWidth,
UINT32  nHeight,
BYTE *WINPR_RESTRICT  pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nDstWidth,
UINT32  nDstHeight,
const gdiPalette *WINPR_RESTRICT  palette,
BYTE **WINPR_RESTRICT  ppGlyphData 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_decompress_nscodec()

static BOOL clear_decompress_nscodec ( NSC_CONTEXT *WINPR_RESTRICT  nsc,
UINT32  width,
UINT32  height,
wStream *WINPR_RESTRICT  s,
UINT32  bitmapDataByteCount,
BYTE *WINPR_RESTRICT  pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nXDstRel,
UINT32  nYDstRel 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_decompress_residual_data()

static BOOL clear_decompress_residual_data ( CLEAR_CONTEXT *WINPR_RESTRICT  clear,
wStream *WINPR_RESTRICT  s,
UINT32  residualByteCount,
UINT32  nWidth,
UINT32  nHeight,
BYTE *WINPR_RESTRICT  pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nDstWidth,
UINT32  nDstHeight,
const gdiPalette *WINPR_RESTRICT  palette 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_decompress_subcode_rlex()

static BOOL clear_decompress_subcode_rlex ( wStream *WINPR_RESTRICT  s,
UINT32  bitmapDataByteCount,
UINT32  width,
UINT32  height,
BYTE *WINPR_RESTRICT  pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nXDstRel,
UINT32  nYDstRel,
UINT32  nDstWidth,
UINT32  nDstHeight 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_decompress_subcodecs_data()

static BOOL clear_decompress_subcodecs_data ( CLEAR_CONTEXT *WINPR_RESTRICT  clear,
wStream *WINPR_RESTRICT  s,
UINT32  subcodecByteCount,
UINT32  nWidth,
UINT32  nHeight,
BYTE *WINPR_RESTRICT  pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nDstWidth,
UINT32  nDstHeight,
const gdiPalette *WINPR_RESTRICT  palette 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_reset_glyph_cache()

static void clear_reset_glyph_cache ( CLEAR_CONTEXT *WINPR_RESTRICT  clear)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_reset_vbar_storage()

static void clear_reset_vbar_storage ( CLEAR_CONTEXT *WINPR_RESTRICT  clear,
BOOL  zero 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear_resize_buffer()

static BOOL clear_resize_buffer ( CLEAR_CONTEXT *WINPR_RESTRICT  clear,
UINT32  width,
UINT32  height 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ convert_color()

static BOOL convert_color ( BYTE *WINPR_RESTRICT  dst,
UINT32  nDstStep,
UINT32  DstFormat,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nWidth,
UINT32  nHeight,
const BYTE *WINPR_RESTRICT  src,
UINT32  nSrcStep,
UINT32  SrcFormat,
UINT32  nDstWidth,
UINT32  nDstHeight,
const gdiPalette *WINPR_RESTRICT  palette 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize_vbar_entry()

static BOOL resize_vbar_entry ( CLEAR_CONTEXT *WINPR_RESTRICT  clear,
CLEAR_VBAR_ENTRY *WINPR_RESTRICT  vBarEntry 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateContextFormat()

static INLINE BOOL updateContextFormat ( CLEAR_CONTEXT *WINPR_RESTRICT  clear,
UINT32  DstFormat 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ CLEAR_8BIT_MASKS

const BYTE CLEAR_8BIT_MASKS[9] = { 0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF }
static

◆ CLEAR_LOG2_FLOOR

const UINT32 CLEAR_LOG2_FLOOR[256]
static
Initial value:
= {
0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
}