2 * FreeRDP: A Remote Desktop Protocol client.
5 * Copyright 2011 Vic Lee
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
23 #include <freerdp/api.h>
24 #include <freerdp/types.h>
25 #include <freerdp/utils/stream.h>
36 typedef enum _RLGR_MODE RLGR_MODE;
38 enum _RFX_PIXEL_FORMAT
40 RFX_PIXEL_FORMAT_BGRA,
41 RFX_PIXEL_FORMAT_RGBA,
44 RFX_PIXEL_FORMAT_BGR565_LE,
45 RFX_PIXEL_FORMAT_RGB565_LE,
46 RFX_PIXEL_FORMAT_PALETTE4_PLANER,
47 RFX_PIXEL_FORMAT_PALETTE8
49 typedef enum _RFX_PIXEL_FORMAT RFX_PIXEL_FORMAT;
58 typedef struct _RFX_RECT RFX_RECT;
66 typedef struct _RFX_TILE RFX_TILE;
71 * The rects array represents the updated region of the frame. The UI
72 * requires to clip drawing destination base on the union of the rects.
78 * The tiles array represents the actual frame data. Each tile is always
79 * 64x64. Note that only pixels inside the updated region (represented as
80 * rects described above) are valid. Pixels outside of the region may
81 * contain arbitrary data.
86 typedef struct _RFX_MESSAGE RFX_MESSAGE;
88 typedef struct _RFX_CONTEXT_PRIV RFX_CONTEXT_PRIV;
100 RFX_PIXEL_FORMAT pixel_format;
101 uint8 bits_per_pixel;
103 /* color palette allocated by the application */
104 const uint8* palette;
106 /* temporary data within a frame */
108 boolean header_processed;
116 void (*decode_ycbcr_to_rgb)(sint16* y_r_buf, sint16* cb_g_buf, sint16* cr_b_buf);
117 void (*encode_rgb_to_ycbcr)(sint16* y_r_buf, sint16* cb_g_buf, sint16* cr_b_buf);
118 void (*quantization_decode)(sint16* buffer, const uint32* quantization_values);
119 void (*quantization_encode)(sint16* buffer, const uint32* quantization_values);
120 void (*dwt_2d_decode)(sint16* buffer, sint16* dwt_buffer);
121 void (*dwt_2d_encode)(sint16* buffer, sint16* dwt_buffer);
123 /* private definitions */
124 RFX_CONTEXT_PRIV* priv;
126 typedef struct _RFX_CONTEXT RFX_CONTEXT;
128 FREERDP_API RFX_CONTEXT* rfx_context_new(void);
129 FREERDP_API void rfx_context_free(RFX_CONTEXT* context);
130 FREERDP_API void rfx_context_set_cpu_opt(RFX_CONTEXT* context, uint32 cpu_opt);
131 FREERDP_API void rfx_context_set_pixel_format(RFX_CONTEXT* context, RFX_PIXEL_FORMAT pixel_format);
132 FREERDP_API void rfx_context_reset(RFX_CONTEXT* context);
134 FREERDP_API RFX_MESSAGE* rfx_process_message(RFX_CONTEXT* context, uint8* data, uint32 length);
135 FREERDP_API uint16 rfx_message_get_tile_count(RFX_MESSAGE* message);
136 FREERDP_API RFX_TILE* rfx_message_get_tile(RFX_MESSAGE* message, int index);
137 FREERDP_API uint16 rfx_message_get_rect_count(RFX_MESSAGE* message);
138 FREERDP_API RFX_RECT* rfx_message_get_rect(RFX_MESSAGE* message, int index);
139 FREERDP_API void rfx_message_free(RFX_CONTEXT* context, RFX_MESSAGE* message);
141 FREERDP_API void rfx_compose_message_header(RFX_CONTEXT* context, STREAM* s);
142 FREERDP_API void rfx_compose_message(RFX_CONTEXT* context, STREAM* s,
143 const RFX_RECT* rects, int num_rects, uint8* image_data, int width, int height, int rowstride);