FreeRDP
rfx_types.h
1 
20 #ifndef FREERDP_LIB_CODEC_RFX_TYPES_H
21 #define FREERDP_LIB_CODEC_RFX_TYPES_H
22 
23 #include <freerdp/config.h>
24 
25 #include <winpr/crt.h>
26 #include <winpr/pool.h>
27 #include <winpr/wlog.h>
28 #include <winpr/collections.h>
29 
30 #include <freerdp/codec/rfx.h>
31 #include <freerdp/log.h>
32 #include <freerdp/utils/profiler.h>
33 
34 #define RFX_TAG FREERDP_TAG("codec.rfx")
35 #ifdef WITH_DEBUG_RFX
36 #define DEBUG_RFX(...) WLog_DBG(RFX_TAG, __VA_ARGS__)
37 #else
38 #define DEBUG_RFX(...) \
39  do \
40  { \
41  } while (0)
42 #endif
43 
44 #define RFX_DECODED_SYNC 0x00000001
45 #define RFX_DECODED_CONTEXT 0x00000002
46 #define RFX_DECODED_VERSIONS 0x00000004
47 #define RFX_DECODED_CHANNELS 0x00000008
48 #define RFX_DECODED_HEADERS 0x0000000F
49 
50 typedef enum
51 {
52  RFX_STATE_INITIAL,
53  RFX_STATE_SERVER_UNINITIALIZED,
54  RFX_STATE_SEND_HEADERS,
55  RFX_STATE_SEND_FRAME_DATA,
56  RFX_STATE_FRAME_DATA_SENT,
57  RFX_STATE_FINAL
58 } RFX_STATE;
59 
60 typedef struct S_RFX_TILE_COMPOSE_WORK_PARAM RFX_TILE_COMPOSE_WORK_PARAM;
61 
62 typedef struct S_RFX_CONTEXT_PRIV RFX_CONTEXT_PRIV;
64 {
65  wLog* log;
66  wObjectPool* TilePool;
67 
68  BOOL UseThreads;
69  PTP_WORK* workObjects;
70  RFX_TILE_COMPOSE_WORK_PARAM* tileWorkParams;
71 
72  DWORD MinThreadCount;
73  DWORD MaxThreadCount;
74 
75  PTP_POOL ThreadPool;
76  TP_CALLBACK_ENVIRON ThreadPoolEnv;
77 
78  wBufferPool* BufferPool;
79 
80  /* profilers */
81  PROFILER_DEFINE(prof_rfx_decode_rgb)
82  PROFILER_DEFINE(prof_rfx_decode_component)
83  PROFILER_DEFINE(prof_rfx_rlgr_decode)
84  PROFILER_DEFINE(prof_rfx_differential_decode)
85  PROFILER_DEFINE(prof_rfx_quantization_decode)
86  PROFILER_DEFINE(prof_rfx_dwt_2d_decode)
87  PROFILER_DEFINE(prof_rfx_ycbcr_to_rgb)
88 
89  PROFILER_DEFINE(prof_rfx_encode_rgb)
90  PROFILER_DEFINE(prof_rfx_encode_component)
91  PROFILER_DEFINE(prof_rfx_rlgr_encode)
92  PROFILER_DEFINE(prof_rfx_differential_encode)
93  PROFILER_DEFINE(prof_rfx_quantization_encode)
94  PROFILER_DEFINE(prof_rfx_dwt_2d_encode)
95  PROFILER_DEFINE(prof_rfx_rgb_to_ycbcr)
96  PROFILER_DEFINE(prof_rfx_encode_format_rgb)
97 };
98 
100 {
101  UINT32 frameIdx;
102 
107  UINT16 numRects;
108  RFX_RECT* rects;
109 
116  UINT16 numTiles;
117  size_t allocatedTiles;
118  RFX_TILE** tiles;
119 
120  UINT16 numQuant;
121  UINT32* quantVals;
122 
123  UINT32 tilesDataSize;
124 
125  BOOL freeArray;
126 };
127 
129 {
130  struct S_RFX_MESSAGE* list;
131  size_t count;
132  RFX_CONTEXT* context;
133 };
134 
136 {
137  RFX_STATE state;
138 
139  BOOL encoder;
140  UINT16 flags;
141  UINT16 properties;
142  UINT16 width;
143  UINT16 height;
144  RLGR_MODE mode;
145  UINT32 version;
146  UINT32 codec_id;
147  UINT32 codec_version;
148  UINT32 pixel_format;
149  BYTE bits_per_pixel;
150 
151  /* color palette allocated by the application */
152  const BYTE* palette;
153 
154  /* temporary data within a frame */
155  UINT32 frameIdx;
156  BYTE numQuant;
157  UINT32* quants;
158  BYTE quantIdxY;
159  BYTE quantIdxCb;
160  BYTE quantIdxCr;
161 
162  /* decoded header blocks */
163  UINT32 decodedHeaderBlocks;
164  UINT16 expectedDataBlockType;
165  struct S_RFX_MESSAGE currentMessage;
166 
167  /* routines */
168  void (*quantization_decode)(INT16* WINPR_RESTRICT buffer,
169  const UINT32* WINPR_RESTRICT quantization_values);
170  void (*quantization_encode)(INT16* WINPR_RESTRICT buffer,
171  const UINT32* WINPR_RESTRICT quantization_values);
172  void (*dwt_2d_decode)(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT dwt_buffer);
173  void (*dwt_2d_extrapolate_decode)(INT16* WINPR_RESTRICT src, INT16* WINPR_RESTRICT temp);
174  void (*dwt_2d_encode)(INT16* WINPR_RESTRICT buffer, INT16* WINPR_RESTRICT dwt_buffer);
175  int (*rlgr_decode)(RLGR_MODE mode, const BYTE* WINPR_RESTRICT data, UINT32 data_size,
176  INT16* WINPR_RESTRICT buffer, UINT32 buffer_size);
177  int (*rlgr_encode)(RLGR_MODE mode, const INT16* WINPR_RESTRICT data, UINT32 data_size,
178  BYTE* WINPR_RESTRICT buffer, UINT32 buffer_size);
179 
180  /* private definitions */
181  RFX_CONTEXT_PRIV* priv;
182 };
183 
184 #endif /* FREERDP_LIB_CODEC_RFX_TYPES_H */
Definition: rfx.h:44
Definition: rfx.h:52
UINT16 numTiles
Definition: rfx_types.h:116
UINT16 numRects
Definition: rfx_types.h:107