FreeRDP
bitmap_decode.c File Reference
#include <winpr/crt.h>
#include <winpr/stream.h>
#include "planar.h"
#include <freerdp/codec/color.h>
#include <freerdp/codec/bitmap.h>
#include "include/bitmap.c"

Defines

#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   0xFFFFFF
#define UNROLL_COUNT   4
#define UNROLL(_exp)   do { _exp _exp _exp _exp } while (0)
#define DESTWRITEPIXEL(_buf, _pix)   (_buf)[0] = (BYTE)(_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 DESTWRITEPIXEL(_buf, _pix)   ((UINT16*)(_buf))[0] = (UINT16)(_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 DESTWRITEPIXEL(_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

Typedefs

typedef UINT32 PIXEL

Functions

static INLINE UINT32 ExtractCodeId (BYTE bOrderHdr)
static INLINE UINT32 ExtractRunLength (UINT32 code, BYTE *pbOrderHdr, UINT32 *advance)
BOOL bitmap_decompress (BYTE *srcData, BYTE *dstData, int width, int height, int size, int srcBpp, int dstBpp)

Variables

static const BYTE g_MaskBit0 = 0x01
static const BYTE g_MaskBit1 = 0x02
static const BYTE g_MaskBit2 = 0x04
static const BYTE g_MaskBit3 = 0x08
static const BYTE g_MaskBit4 = 0x10
static const BYTE g_MaskBit5 = 0x20
static const BYTE g_MaskBit6 = 0x40
static const BYTE g_MaskBit7 = 0x80
static const BYTE g_MaskSpecialFgBg1 = 0x03
static const BYTE g_MaskSpecialFgBg2 = 0x05
static const BYTE g_MaskRegularRunLength = 0x1F
static const BYTE g_MaskLiteRunLength = 0x0F

Define 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 
)    (_buf)[0] = (BYTE)(_pix)
#define DESTWRITEPIXEL (   _buf,
  _pix 
)    ((UINT16*)(_buf))[0] = (UINT16)(_pix)
#define DESTWRITEPIXEL (   _buf,
  _pix 
)
Value:
do { (_buf)[0] = (BYTE)(_pix);  \
  (_buf)[1] = (BYTE)((_pix) >> 8); (_buf)[2] = (BYTE)((_pix) >> 16); } while (0)
#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

FreeRDP: A Remote Desktop Protocol Implementation Bitmap Decompression

Copyright 2011 Jay Sorg <jay.sorg@gmail.com>

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 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 UNROLL (   _exp)    do { _exp _exp _exp _exp } while (0)
#define UNROLL_COUNT   4
#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

BOOL bitmap_decompress ( BYTE srcData,
BYTE dstData,
int  width,
int  height,
int  size,
int  srcBpp,
int  dstBpp 
)

bitmap decompression routine

Here is the call graph for this function:

Here is the caller graph for this function:

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,
BYTE pbOrderHdr,
UINT32 advance 
) [static]

Extract the run length of a compression order.

Here is the caller graph for this function:


Variable Documentation

const BYTE g_MaskBit0 = 0x01 [static]
const BYTE g_MaskBit1 = 0x02 [static]
const BYTE g_MaskBit2 = 0x04 [static]
const BYTE g_MaskBit3 = 0x08 [static]
const BYTE g_MaskBit4 = 0x10 [static]
const BYTE g_MaskBit5 = 0x20 [static]
const BYTE g_MaskBit6 = 0x40 [static]
const BYTE g_MaskBit7 = 0x80 [static]
const BYTE g_MaskLiteRunLength = 0x0F [static]
const BYTE g_MaskRegularRunLength = 0x1F [static]
const BYTE g_MaskSpecialFgBg1 = 0x03 [static]
const BYTE g_MaskSpecialFgBg2 = 0x05 [static]
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines