FreeRDP
interleaved.c File Reference

Macros

#define TAG   FREERDP_TAG("codec")
 
#define UNROLL_BODY(_exp, _count)
 
#define UNROLL_MULTIPLE(_condition, _exp, _count)
 
#define UNROLL(_condition, _exp)
 
#define REGULAR_BG_RUN   0x00
 
#define MEGA_MEGA_BG_RUN   0xF0
 
#define REGULAR_FG_RUN   0x01
 
#define MEGA_MEGA_FG_RUN   0xF1
 
#define LITE_SET_FG_FG_RUN   0x0C
 
#define MEGA_MEGA_SET_FG_RUN   0xF6
 
#define LITE_DITHERED_RUN   0x0E
 
#define MEGA_MEGA_DITHERED_RUN   0xF8
 
#define REGULAR_COLOR_RUN   0x03
 
#define MEGA_MEGA_COLOR_RUN   0xF3
 
#define REGULAR_FGBG_IMAGE   0x02
 
#define MEGA_MEGA_FGBG_IMAGE   0xF2
 
#define LITE_SET_FG_FGBG_IMAGE   0x0D
 
#define MEGA_MEGA_SET_FGBG_IMAGE   0xF7
 
#define REGULAR_COLOR_IMAGE   0x04
 
#define MEGA_MEGA_COLOR_IMAGE   0xF4
 
#define SPECIAL_FGBG_1   0xF9
 
#define SPECIAL_FGBG_2   0xFA
 
#define SPECIAL_WHITE   0xFD
 
#define SPECIAL_BLACK   0xFE
 
#define BLACK_PIXEL   0x000000
 
#define WHITE_PIXEL   0xFF
 
#define DESTWRITEPIXEL(_buf, _pix)   write_pixel_8(_buf, _pix)
 
#define DESTREADPIXEL(_pix, _buf)   _pix = (_buf)[0]
 
#define SRCREADPIXEL(_pix, _buf)   _pix = (_buf)[0]
 
#define DESTNEXTPIXEL(_buf)   _buf += 1
 
#define SRCNEXTPIXEL(_buf)   _buf += 1
 
#define WRITEFGBGIMAGE   WriteFgBgImage8to8
 
#define WRITEFIRSTLINEFGBGIMAGE   WriteFirstLineFgBgImage8to8
 
#define RLEDECOMPRESS   RleDecompress8to8
 
#define RLEEXTRA
 
#define ENSURE_CAPACITY(_start, _end, _size)   ensure_capacity(_start, _end, _size, 1)
 
#define WHITE_PIXEL   0xFFFF
 
#define DESTWRITEPIXEL(_buf, _pix)   write_pixel_16(_buf, _pix)
 
#define DESTREADPIXEL(_pix, _buf)   _pix = ((UINT16*)(_buf))[0]
 
#define SRCREADPIXEL(_pix, _buf)   _pix = ((UINT16*)(_buf))[0]
 
#define DESTNEXTPIXEL(_buf)   _buf += 2
 
#define SRCNEXTPIXEL(_buf)   _buf += 2
 
#define WRITEFGBGIMAGE   WriteFgBgImage16to16
 
#define WRITEFIRSTLINEFGBGIMAGE   WriteFirstLineFgBgImage16to16
 
#define RLEDECOMPRESS   RleDecompress16to16
 
#define RLEEXTRA
 
#define ENSURE_CAPACITY(_start, _end, _size)   ensure_capacity(_start, _end, _size, 2)
 
#define WHITE_PIXEL   0xFFFFFF
 
#define DESTWRITEPIXEL(_buf, _pix)   write_pixel_24(_buf, _pix)
 
#define DESTREADPIXEL(_pix, _buf)
 
#define SRCREADPIXEL(_pix, _buf)
 
#define DESTNEXTPIXEL(_buf)   _buf += 3
 
#define SRCNEXTPIXEL(_buf)   _buf += 3
 
#define WRITEFGBGIMAGE   WriteFgBgImage24to24
 
#define WRITEFIRSTLINEFGBGIMAGE   WriteFirstLineFgBgImage24to24
 
#define RLEDECOMPRESS   RleDecompress24to24
 
#define RLEEXTRA
 
#define ENSURE_CAPACITY(_start, _end, _size)   ensure_capacity(_start, _end, _size, 3)
 

Typedefs

typedef UINT32 PIXEL
 

Functions

static INLINE UINT32 ExtractCodeId (BYTE bOrderHdr)
 
static INLINE UINT32 ExtractRunLength (UINT32 code, const BYTE *pbOrderHdr, UINT32 *advance)
 
static INLINE BOOL ensure_capacity (const BYTE *start, const BYTE *end, size_t size, size_t base)
 
static INLINE void write_pixel_8 (BYTE *_buf, BYTE _pix)
 
static INLINE void write_pixel_24 (BYTE *_buf, UINT32 _pix)
 
static INLINE void write_pixel_16 (BYTE *_buf, UINT16 _pix)
 
BOOL interleaved_decompress (BITMAP_INTERLEAVED_CONTEXT *interleaved, const BYTE *pSrcData, UINT32 SrcSize, UINT32 nSrcWidth, UINT32 nSrcHeight, UINT32 bpp, BYTE *pDstData, UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight, const gdiPalette *palette)
 
BOOL interleaved_compress (BITMAP_INTERLEAVED_CONTEXT *interleaved, BYTE *pDstData, UINT32 *pDstSize, UINT32 nWidth, UINT32 nHeight, const BYTE *pSrcData, UINT32 SrcFormat, UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, const gdiPalette *palette, UINT32 bpp)
 
BOOL bitmap_interleaved_context_reset (BITMAP_INTERLEAVED_CONTEXT *interleaved)
 
BITMAP_INTERLEAVED_CONTEXT * bitmap_interleaved_context_new (BOOL Compressor)
 
void bitmap_interleaved_context_free (BITMAP_INTERLEAVED_CONTEXT *interleaved)
 

Variables

static const BYTE g_MaskSpecialFgBg1 = 0x03
 
static const BYTE g_MaskSpecialFgBg2 = 0x05
 
static const BYTE g_MaskRegularRunLength = 0x1F
 
static const BYTE g_MaskLiteRunLength = 0x0F
 

Macro Definition Documentation

#define BLACK_PIXEL   0x000000
#define DESTNEXTPIXEL (   _buf)    _buf += 1
#define DESTNEXTPIXEL (   _buf)    _buf += 2
#define DESTNEXTPIXEL (   _buf)    _buf += 3
#define DESTREADPIXEL (   _pix,
  _buf 
)    _pix = (_buf)[0]
#define DESTREADPIXEL (   _pix,
  _buf 
)    _pix = ((UINT16*)(_buf))[0]
#define DESTREADPIXEL (   _pix,
  _buf 
)
Value:
_pix = (_buf)[0] | ((_buf)[1] << 8) | \
((_buf)[2] << 16)
#define DESTWRITEPIXEL (   _buf,
  _pix 
)    write_pixel_8(_buf, _pix)
#define DESTWRITEPIXEL (   _buf,
  _pix 
)    write_pixel_16(_buf, _pix)
#define DESTWRITEPIXEL (   _buf,
  _pix 
)    write_pixel_24(_buf, _pix)
#define ENSURE_CAPACITY (   _start,
  _end,
  _size 
)    ensure_capacity(_start, _end, _size, 1)
#define ENSURE_CAPACITY (   _start,
  _end,
  _size 
)    ensure_capacity(_start, _end, _size, 2)
#define ENSURE_CAPACITY (   _start,
  _end,
  _size 
)    ensure_capacity(_start, _end, _size, 3)
#define LITE_DITHERED_RUN   0x0E
#define LITE_SET_FG_FG_RUN   0x0C
#define LITE_SET_FG_FGBG_IMAGE   0x0D
#define MEGA_MEGA_BG_RUN   0xF0
#define MEGA_MEGA_COLOR_IMAGE   0xF4
#define MEGA_MEGA_COLOR_RUN   0xF3
#define MEGA_MEGA_DITHERED_RUN   0xF8
#define MEGA_MEGA_FG_RUN   0xF1
#define MEGA_MEGA_FGBG_IMAGE   0xF2
#define MEGA_MEGA_SET_FG_RUN   0xF6
#define MEGA_MEGA_SET_FGBG_IMAGE   0xF7
#define REGULAR_BG_RUN   0x00
#define REGULAR_COLOR_IMAGE   0x04
#define REGULAR_COLOR_RUN   0x03
#define REGULAR_FG_RUN   0x01
#define REGULAR_FGBG_IMAGE   0x02
#define RLEDECOMPRESS   RleDecompress8to8
#define RLEDECOMPRESS   RleDecompress16to16
#define RLEDECOMPRESS   RleDecompress24to24
#define RLEEXTRA
#define RLEEXTRA
#define RLEEXTRA
#define SPECIAL_BLACK   0xFE
#define SPECIAL_FGBG_1   0xF9
#define SPECIAL_FGBG_2   0xFA
#define SPECIAL_WHITE   0xFD
#define SRCNEXTPIXEL (   _buf)    _buf += 1
#define SRCNEXTPIXEL (   _buf)    _buf += 2
#define SRCNEXTPIXEL (   _buf)    _buf += 3
#define SRCREADPIXEL (   _pix,
  _buf 
)    _pix = (_buf)[0]
#define SRCREADPIXEL (   _pix,
  _buf 
)    _pix = ((UINT16*)(_buf))[0]
#define SRCREADPIXEL (   _pix,
  _buf 
)
Value:
_pix = (_buf)[0] | ((_buf)[1] << 8) | \
((_buf)[2] << 16)
#define TAG   FREERDP_TAG("codec")

FreeRDP: A Remote Desktop Protocol Implementation Interleaved RLE Bitmap Codec

Copyright 2014 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2015 Thincast Technologies GmbH Copyright 2015 DI (FH) Martin Haimberger marti.nosp@m.n.ha.nosp@m.imber.nosp@m.ger@.nosp@m.thinc.nosp@m.ast..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.

#define UNROLL (   _condition,
  _exp 
)
Value:
do \
{ \
UNROLL_MULTIPLE(_condition, _exp, 16); \
UNROLL_MULTIPLE(_condition, _exp, 4); \
UNROLL_MULTIPLE(_condition, _exp, 1); \
} \
while (FALSE)
#define UNROLL_MULTIPLE(_condition, _exp, _count)
Definition: interleaved.c:43
#define FALSE
Definition: trio.c:209
#define UNROLL_BODY (   _exp,
  _count 
)
Value:
do \
{ \
size_t x; \
for (x=0; x<(_count); x++) \
{ \
do _exp while(FALSE); \
} \
} \
while (FALSE)
UINT16 x
Definition: event.h:103
#define FALSE
Definition: trio.c:209
#define UNROLL_MULTIPLE (   _condition,
  _exp,
  _count 
)
Value:
do \
{ \
while ((_condition) >= _count) \
{ \
UNROLL_BODY(_exp, _count); \
(_condition) -= _count; \
} \
} \
while (FALSE)
#define FALSE
Definition: trio.c:209
#define UNROLL_BODY(_exp, _count)
Definition: interleaved.c:33
#define WHITE_PIXEL   0xFF
#define WHITE_PIXEL   0xFFFF
#define WHITE_PIXEL   0xFFFFFF
#define WRITEFGBGIMAGE   WriteFgBgImage8to8
#define WRITEFGBGIMAGE   WriteFgBgImage16to16
#define WRITEFGBGIMAGE   WriteFgBgImage24to24
#define WRITEFIRSTLINEFGBGIMAGE   WriteFirstLineFgBgImage8to8
#define WRITEFIRSTLINEFGBGIMAGE   WriteFirstLineFgBgImage16to16
#define WRITEFIRSTLINEFGBGIMAGE   WriteFirstLineFgBgImage24to24

Typedef Documentation

typedef UINT32 PIXEL

Function Documentation

void bitmap_interleaved_context_free ( BITMAP_INTERLEAVED_CONTEXT *  interleaved)

Here is the call graph for this function:

Here is the caller graph for this function:

BITMAP_INTERLEAVED_CONTEXT* bitmap_interleaved_context_new ( BOOL  Compressor)

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL bitmap_interleaved_context_reset ( BITMAP_INTERLEAVED_CONTEXT *  interleaved)

Here is the caller graph for this function:

static INLINE BOOL ensure_capacity ( const BYTE start,
const BYTE end,
size_t  size,
size_t  base 
)
static
static INLINE UINT32 ExtractCodeId ( BYTE  bOrderHdr)
static

Reads the supplied order header and extracts the compression order code ID.

Here is the caller graph for this function:

static INLINE UINT32 ExtractRunLength ( UINT32  code,
const BYTE pbOrderHdr,
UINT32 advance 
)
static

Extract the run length of a compression order.

Here is the caller graph for this function:

BOOL interleaved_compress ( BITMAP_INTERLEAVED_CONTEXT *  interleaved,
BYTE pDstData,
UINT32 pDstSize,
UINT32  nWidth,
UINT32  nHeight,
const BYTE pSrcData,
UINT32  SrcFormat,
UINT32  nSrcStep,
UINT32  nXSrc,
UINT32  nYSrc,
const gdiPalette *  palette,
UINT32  bpp 
)

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL interleaved_decompress ( BITMAP_INTERLEAVED_CONTEXT *  interleaved,
const BYTE pSrcData,
UINT32  SrcSize,
UINT32  nSrcWidth,
UINT32  nSrcHeight,
UINT32  bpp,
BYTE pDstData,
UINT32  DstFormat,
UINT32  nDstStep,
UINT32  nXDst,
UINT32  nYDst,
UINT32  nDstWidth,
UINT32  nDstHeight,
const gdiPalette *  palette 
)

Here is the call graph for this function:

Here is the caller graph for this function:

static INLINE void write_pixel_16 ( BYTE _buf,
UINT16  _pix 
)
static
static INLINE void write_pixel_24 ( BYTE _buf,
UINT32  _pix 
)
static
static INLINE void write_pixel_8 ( BYTE _buf,
BYTE  _pix 
)
static

Variable Documentation

const BYTE g_MaskLiteRunLength = 0x0F
static
const BYTE g_MaskRegularRunLength = 0x1F
static
const BYTE g_MaskSpecialFgBg1 = 0x03
static
const BYTE g_MaskSpecialFgBg2 = 0x05
static