FreeRDP
planar.h
1 
22 #ifndef FREERDP_CODEC_PLANAR_H
23 #define FREERDP_CODEC_PLANAR_H
24 
25 #include <winpr/crt.h>
26 
27 #include <freerdp/codec/color.h>
28 #include <freerdp/codec/bitmap.h>
29 
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
34 
35 #define PLANAR_CONTROL_BYTE(_nRunLength, _cRawBytes) \
36  (_nRunLength & 0x0F) | ((_cRawBytes & 0x0F) << 4)
37 
38 #define PLANAR_CONTROL_BYTE_RUN_LENGTH(_controlByte) (_controlByte & 0x0F)
39 #define PLANAR_CONTROL_BYTE_RAW_BYTES(_controlByte) ((_controlByte >> 4) & 0x0F)
40 
41 #ifdef __cplusplus
42 extern "C"
43 {
44 #endif
45 
46  typedef struct S_BITMAP_PLANAR_CONTEXT BITMAP_PLANAR_CONTEXT;
47 
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);
53 
54  FREERDP_API BOOL freerdp_bitmap_planar_context_reset(
55  BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT context, UINT32 width, UINT32 height);
56 
57  FREERDP_API void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT* context);
58 
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,
61  UINT32 height);
62 
63  FREERDP_API void freerdp_planar_switch_bgr(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
64  BOOL bgr);
65  FREERDP_API void freerdp_planar_topdown_image(BITMAP_PLANAR_CONTEXT* WINPR_RESTRICT planar,
66  BOOL topdown);
67 
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);
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #endif /* FREERDP_CODEC_PLANAR_H */