22 #ifndef FREERDP_CODEC_PLANAR_H
23 #define FREERDP_CODEC_PLANAR_H
25 #include <winpr/crt.h>
27 #include <freerdp/codec/color.h>
28 #include <freerdp/codec/bitmap.h>
30 #define PLANAR_FORMAT_HEADER_CS (1 << 3)
31 #define PLANAR_FORMAT_HEADER_RLE (1 << 4)
32 #define PLANAR_FORMAT_HEADER_NA (1 << 5)
33 #define PLANAR_FORMAT_HEADER_CLL_MASK 0x07
35 #define PLANAR_CONTROL_BYTE(_nRunLength, _cRawBytes) \
36 (_nRunLength & 0x0F) | ((_cRawBytes & 0x0F) << 4)
38 #define PLANAR_CONTROL_BYTE_RUN_LENGTH(_controlByte) (_controlByte & 0x0F)
39 #define PLANAR_CONTROL_BYTE_RAW_BYTES(_controlByte) ((_controlByte >> 4) & 0x0F)
46 typedef struct S_BITMAP_PLANAR_CONTEXT BITMAP_PLANAR_CONTEXT;
48 FREERDP_API BYTE* freerdp_bitmap_compress_planar(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT context,
49 const BYTE* WINPR_RESTRICT data, UINT32 format,
50 UINT32 width, UINT32 height, UINT32 scanline,
51 BYTE* WINPR_RESTRICT dstData,
52 UINT32* WINPR_RESTRICT pDstSize);
54 FREERDP_API BOOL freerdp_bitmap_planar_context_reset(
55 BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT context, UINT32 width, UINT32 height);
57 FREERDP_API
void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT* context);
59 WINPR_ATTR_MALLOC(freerdp_bitmap_planar_context_free, 1)
60 FREERDP_API BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(DWORD flags, UINT32 width,
63 FREERDP_API
void freerdp_planar_switch_bgr(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
65 FREERDP_API
void freerdp_planar_topdown_image(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
68 FREERDP_API BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
69 const BYTE* WINPR_RESTRICT pSrcData, UINT32 SrcSize,
70 UINT32 nSrcWidth, UINT32 nSrcHeight,
71 BYTE* WINPR_RESTRICT pDstData, UINT32 DstFormat,
72 UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
73 UINT32 nDstWidth, UINT32 nDstHeight, BOOL vFlip);