2011-08-10 11:13:39 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-10-03 05:07:07 +04:00
|
|
|
* RemoteFX Codec
|
2011-08-10 11:13:39 +04:00
|
|
|
*
|
|
|
|
* Copyright 2011 Vic Lee
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2012-12-14 09:25:48 +04:00
|
|
|
#ifndef FREERDP_CODEC_REMOTEFX_H
|
|
|
|
#define FREERDP_CODEC_REMOTEFX_H
|
2011-08-10 11:13:39 +04:00
|
|
|
|
2014-09-10 08:42:41 +04:00
|
|
|
typedef struct _RFX_RECT RFX_RECT;
|
|
|
|
typedef struct _RFX_TILE RFX_TILE;
|
|
|
|
typedef struct _RFX_MESSAGE RFX_MESSAGE;
|
|
|
|
typedef struct _RFX_CONTEXT RFX_CONTEXT;
|
|
|
|
|
2011-08-17 07:54:42 +04:00
|
|
|
#include <freerdp/api.h>
|
2011-08-10 11:13:39 +04:00
|
|
|
#include <freerdp/types.h>
|
2013-08-13 17:34:15 +04:00
|
|
|
#include <freerdp/freerdp.h>
|
2012-03-13 15:02:19 +04:00
|
|
|
#include <freerdp/constants.h>
|
2013-03-22 00:45:25 +04:00
|
|
|
|
|
|
|
#include <winpr/stream.h>
|
2011-08-10 11:13:39 +04:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
enum _RLGR_MODE
|
|
|
|
{
|
|
|
|
RLGR1,
|
|
|
|
RLGR3
|
|
|
|
};
|
2014-09-25 22:15:57 +04:00
|
|
|
typedef enum _RLGR_MODE RLGR_MODE;
|
2011-08-10 11:13:39 +04:00
|
|
|
|
|
|
|
struct _RFX_RECT
|
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 x;
|
|
|
|
UINT16 y;
|
|
|
|
UINT16 width;
|
|
|
|
UINT16 height;
|
2011-08-10 11:13:39 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _RFX_TILE
|
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 x;
|
|
|
|
UINT16 y;
|
2013-08-13 18:30:22 +04:00
|
|
|
int width;
|
|
|
|
int height;
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE* data;
|
2013-08-13 21:45:28 +04:00
|
|
|
int scanline;
|
2013-09-03 16:27:08 +04:00
|
|
|
BOOL allocated;
|
2013-08-13 18:09:32 +04:00
|
|
|
BYTE quantIdxY;
|
|
|
|
BYTE quantIdxCb;
|
|
|
|
BYTE quantIdxCr;
|
|
|
|
UINT16 xIdx;
|
|
|
|
UINT16 yIdx;
|
|
|
|
UINT16 YLen;
|
|
|
|
UINT16 CbLen;
|
|
|
|
UINT16 CrLen;
|
|
|
|
BYTE* YData;
|
|
|
|
BYTE* CbData;
|
|
|
|
BYTE* CrData;
|
2013-08-20 02:39:19 +04:00
|
|
|
BYTE* YCbCrData;
|
2011-08-10 11:13:39 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _RFX_MESSAGE
|
|
|
|
{
|
2013-08-14 01:50:05 +04:00
|
|
|
UINT32 frameIdx;
|
|
|
|
|
2011-08-10 11:13:39 +04:00
|
|
|
/**
|
|
|
|
* The rects array represents the updated region of the frame. The UI
|
|
|
|
* requires to clip drawing destination base on the union of the rects.
|
|
|
|
*/
|
2013-08-14 01:18:59 +04:00
|
|
|
UINT16 numRects;
|
2011-08-10 11:13:39 +04:00
|
|
|
RFX_RECT* rects;
|
2013-08-14 18:14:47 +04:00
|
|
|
BOOL freeRects;
|
2011-08-10 11:13:39 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The tiles array represents the actual frame data. Each tile is always
|
|
|
|
* 64x64. Note that only pixels inside the updated region (represented as
|
|
|
|
* rects described above) are valid. Pixels outside of the region may
|
|
|
|
* contain arbitrary data.
|
|
|
|
*/
|
2013-08-14 01:18:59 +04:00
|
|
|
UINT16 numTiles;
|
2011-08-10 11:13:39 +04:00
|
|
|
RFX_TILE** tiles;
|
2013-08-14 01:18:59 +04:00
|
|
|
|
|
|
|
UINT16 numQuant;
|
|
|
|
UINT32* quantVals;
|
|
|
|
|
|
|
|
UINT32 tilesDataSize;
|
2013-08-14 21:19:01 +04:00
|
|
|
|
|
|
|
BOOL freeArray;
|
2011-08-10 11:13:39 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _RFX_CONTEXT_PRIV RFX_CONTEXT_PRIV;
|
|
|
|
|
2013-08-14 01:18:59 +04:00
|
|
|
enum _RFX_STATE
|
|
|
|
{
|
|
|
|
RFX_STATE_INITIAL,
|
|
|
|
RFX_STATE_SERVER_UNINITIALIZED,
|
|
|
|
RFX_STATE_SEND_HEADERS,
|
|
|
|
RFX_STATE_SEND_FRAME_DATA,
|
|
|
|
RFX_STATE_FRAME_DATA_SENT,
|
|
|
|
RFX_STATE_FINAL
|
|
|
|
};
|
|
|
|
typedef enum _RFX_STATE RFX_STATE;
|
|
|
|
|
2011-08-10 11:13:39 +04:00
|
|
|
struct _RFX_CONTEXT
|
|
|
|
{
|
2013-08-14 01:18:59 +04:00
|
|
|
RFX_STATE state;
|
|
|
|
|
2013-08-17 00:46:47 +04:00
|
|
|
BOOL encoder;
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 flags;
|
|
|
|
UINT16 properties;
|
|
|
|
UINT16 width;
|
|
|
|
UINT16 height;
|
2011-08-10 11:13:39 +04:00
|
|
|
RLGR_MODE mode;
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 version;
|
|
|
|
UINT32 codec_id;
|
|
|
|
UINT32 codec_version;
|
2012-03-13 15:02:19 +04:00
|
|
|
RDP_PIXEL_FORMAT pixel_format;
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE bits_per_pixel;
|
2011-09-14 21:48:08 +04:00
|
|
|
|
|
|
|
/* color palette allocated by the application */
|
2012-10-09 11:01:37 +04:00
|
|
|
const BYTE* palette;
|
2011-08-10 11:13:39 +04:00
|
|
|
|
|
|
|
/* temporary data within a frame */
|
2013-08-14 01:18:59 +04:00
|
|
|
UINT32 frameIdx;
|
2013-08-13 19:09:54 +04:00
|
|
|
BYTE numQuant;
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32* quants;
|
2013-08-13 19:09:54 +04:00
|
|
|
BYTE quantIdxY;
|
|
|
|
BYTE quantIdxCb;
|
|
|
|
BYTE quantIdxCr;
|
2011-08-10 11:13:39 +04:00
|
|
|
|
|
|
|
/* routines */
|
2012-10-09 11:26:39 +04:00
|
|
|
void (*quantization_decode)(INT16* buffer, const UINT32* quantization_values);
|
|
|
|
void (*quantization_encode)(INT16* buffer, const UINT32* quantization_values);
|
2012-10-09 11:01:37 +04:00
|
|
|
void (*dwt_2d_decode)(INT16* buffer, INT16* dwt_buffer);
|
|
|
|
void (*dwt_2d_encode)(INT16* buffer, INT16* dwt_buffer);
|
2011-08-10 11:13:39 +04:00
|
|
|
|
|
|
|
/* private definitions */
|
|
|
|
RFX_CONTEXT_PRIV* priv;
|
|
|
|
};
|
|
|
|
|
2012-03-13 15:02:19 +04:00
|
|
|
FREERDP_API void rfx_context_set_pixel_format(RFX_CONTEXT* context, RDP_PIXEL_FORMAT pixel_format);
|
2011-08-10 11:13:39 +04:00
|
|
|
|
2014-08-06 05:41:58 +04:00
|
|
|
FREERDP_API int rfx_rlgr_decode(const BYTE* pSrcData, UINT32 SrcSize, INT16* pDstData, UINT32 DstSize, int mode);
|
|
|
|
|
2012-10-09 11:26:39 +04:00
|
|
|
FREERDP_API RFX_MESSAGE* rfx_process_message(RFX_CONTEXT* context, BYTE* data, UINT32 length);
|
2012-10-09 11:01:37 +04:00
|
|
|
FREERDP_API UINT16 rfx_message_get_tile_count(RFX_MESSAGE* message);
|
2011-09-19 06:34:19 +04:00
|
|
|
FREERDP_API RFX_TILE* rfx_message_get_tile(RFX_MESSAGE* message, int index);
|
2012-10-09 11:01:37 +04:00
|
|
|
FREERDP_API UINT16 rfx_message_get_rect_count(RFX_MESSAGE* message);
|
2011-09-19 06:34:19 +04:00
|
|
|
FREERDP_API RFX_RECT* rfx_message_get_rect(RFX_MESSAGE* message, int index);
|
2011-08-17 07:54:42 +04:00
|
|
|
FREERDP_API void rfx_message_free(RFX_CONTEXT* context, RFX_MESSAGE* message);
|
2011-08-10 11:13:39 +04:00
|
|
|
|
2013-03-21 23:19:33 +04:00
|
|
|
FREERDP_API void rfx_compose_message_header(RFX_CONTEXT* context, wStream* s);
|
|
|
|
FREERDP_API void rfx_compose_message(RFX_CONTEXT* context, wStream* s,
|
2012-10-09 11:01:37 +04:00
|
|
|
const RFX_RECT* rects, int num_rects, BYTE* image_data, int width, int height, int rowstride);
|
2011-08-10 11:13:39 +04:00
|
|
|
|
2013-08-14 18:14:47 +04:00
|
|
|
FREERDP_API RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* context, const RFX_RECT* rects,
|
|
|
|
int numRects, BYTE* data, int width, int height, int scanline);
|
2013-08-14 21:19:01 +04:00
|
|
|
FREERDP_API RFX_MESSAGE* rfx_encode_messages(RFX_CONTEXT* context, const RFX_RECT* rects, int numRects,
|
|
|
|
BYTE* data, int width, int height, int scanline, int* numMessages, int maxDataSize);
|
2013-08-14 18:14:47 +04:00
|
|
|
FREERDP_API void rfx_write_message(RFX_CONTEXT* context, wStream* s, RFX_MESSAGE* message);
|
|
|
|
|
2014-09-12 22:57:44 +04:00
|
|
|
FREERDP_API int rfx_context_reset(RFX_CONTEXT* context);
|
|
|
|
|
|
|
|
FREERDP_API RFX_CONTEXT* rfx_context_new(BOOL encoder);
|
|
|
|
FREERDP_API void rfx_context_free(RFX_CONTEXT* context);
|
|
|
|
|
2011-08-10 11:13:39 +04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-12-14 09:25:48 +04:00
|
|
|
#endif /* FREERDP_CODEC_REMOTEFX_H */
|