mirror of https://github.com/FreeRDP/FreeRDP
Cleaned up rfx API
This commit is contained in:
parent
fa218f79c1
commit
25a8abc4eb
|
@ -183,16 +183,19 @@ extern "C"
|
||||||
FREERDP_API void rfx_message_free(RFX_CONTEXT* context, RFX_MESSAGE* message);
|
FREERDP_API void rfx_message_free(RFX_CONTEXT* context, RFX_MESSAGE* message);
|
||||||
|
|
||||||
FREERDP_API BOOL rfx_compose_message(RFX_CONTEXT* context, wStream* s, const RFX_RECT* rects,
|
FREERDP_API BOOL rfx_compose_message(RFX_CONTEXT* context, wStream* s, const RFX_RECT* rects,
|
||||||
int num_rects, BYTE* image_data, int width, int height,
|
size_t num_rects, const BYTE* image_data, UINT32 width,
|
||||||
int rowstride);
|
UINT32 height, UINT32 rowstride);
|
||||||
|
|
||||||
FREERDP_API RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* context, const RFX_RECT* rects,
|
FREERDP_API RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* context, const RFX_RECT* rects,
|
||||||
int numRects, BYTE* data, int width, int height,
|
size_t numRects, const BYTE* data, UINT32 width,
|
||||||
int scanline);
|
UINT32 height, size_t scanline);
|
||||||
|
|
||||||
FREERDP_API RFX_MESSAGE* rfx_encode_messages(RFX_CONTEXT* context, const RFX_RECT* rects,
|
FREERDP_API RFX_MESSAGE* rfx_encode_messages(RFX_CONTEXT* context, const RFX_RECT* rects,
|
||||||
int numRects, BYTE* data, int width, int height,
|
size_t numRects, const BYTE* data, UINT32 width,
|
||||||
int scanline, int* numMessages, int maxDataSize);
|
UINT32 height, UINT32 scanline,
|
||||||
FREERDP_API BOOL rfx_write_message(RFX_CONTEXT* context, wStream* s, RFX_MESSAGE* message);
|
size_t* numMessages, size_t maxDataSize);
|
||||||
|
FREERDP_API BOOL rfx_write_message(RFX_CONTEXT* context, wStream* s,
|
||||||
|
const RFX_MESSAGE* message);
|
||||||
|
|
||||||
FREERDP_API BOOL rfx_context_reset(RFX_CONTEXT* context, UINT32 width, UINT32 height);
|
FREERDP_API BOOL rfx_context_reset(RFX_CONTEXT* context, UINT32 width, UINT32 height);
|
||||||
|
|
||||||
|
|
|
@ -385,6 +385,11 @@ static RFX_TILE* rfx_message_get_tile(RFX_MESSAGE* message, UINT32 index)
|
||||||
return message->tiles[index];
|
return message->tiles[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const RFX_RECT* rfx_message_get_rect_const(const RFX_MESSAGE* message, UINT32 index)
|
||||||
|
{
|
||||||
|
return &message->rects[index];
|
||||||
|
}
|
||||||
|
|
||||||
static RFX_RECT* rfx_message_get_rect(RFX_MESSAGE* message, UINT32 index)
|
static RFX_RECT* rfx_message_get_rect(RFX_MESSAGE* message, UINT32 index)
|
||||||
{
|
{
|
||||||
return &message->rects[index];
|
return &message->rects[index];
|
||||||
|
@ -637,7 +642,7 @@ static BOOL rfx_process_message_frame_end(RFX_CONTEXT* context, RFX_MESSAGE* mes
|
||||||
static BOOL rfx_process_message_region(RFX_CONTEXT* context, RFX_MESSAGE* message, wStream* s,
|
static BOOL rfx_process_message_region(RFX_CONTEXT* context, RFX_MESSAGE* message, wStream* s,
|
||||||
UINT16* pExpectedBlockType)
|
UINT16* pExpectedBlockType)
|
||||||
{
|
{
|
||||||
int i;
|
UINT16 i;
|
||||||
UINT16 regionType;
|
UINT16 regionType;
|
||||||
UINT16 numTileSets;
|
UINT16 numTileSets;
|
||||||
RFX_RECT* tmpRects;
|
RFX_RECT* tmpRects;
|
||||||
|
@ -1428,8 +1433,8 @@ static BOOL setupWorkers(RFX_CONTEXT* context, int nbTiles)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* context, const RFX_RECT* rects, int numRects,
|
RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* context, const RFX_RECT* rects, size_t numRects,
|
||||||
BYTE* data, int w, int h, int s)
|
const BYTE* data, UINT32 w, UINT32 h, size_t s)
|
||||||
{
|
{
|
||||||
const UINT32 width = (UINT32)w;
|
const UINT32 width = (UINT32)w;
|
||||||
const UINT32 height = (UINT32)h;
|
const UINT32 height = (UINT32)h;
|
||||||
|
@ -1567,7 +1572,8 @@ RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* context, const RFX_RECT* rects, int
|
||||||
tile->allocated = FALSE;
|
tile->allocated = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
tile->data = &data[(ay * scanline) + (ax * bytesPerPixel)];
|
/* Cast away const */
|
||||||
|
tile->data = (BYTE*)&data[(ay * scanline) + (ax * bytesPerPixel)];
|
||||||
tile->quantIdxY = context->quantIdxY;
|
tile->quantIdxY = context->quantIdxY;
|
||||||
tile->quantIdxCb = context->quantIdxCb;
|
tile->quantIdxCb = context->quantIdxCb;
|
||||||
tile->quantIdxCr = context->quantIdxCr;
|
tile->quantIdxCr = context->quantIdxCr;
|
||||||
|
@ -1663,10 +1669,10 @@ skip_encoding_loop:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RFX_MESSAGE* rfx_split_message(RFX_CONTEXT* context, RFX_MESSAGE* message, int* numMessages,
|
static RFX_MESSAGE* rfx_split_message(RFX_CONTEXT* context, RFX_MESSAGE* message,
|
||||||
int maxDataSize)
|
size_t* numMessages, size_t maxDataSize)
|
||||||
{
|
{
|
||||||
int i, j;
|
size_t i, j;
|
||||||
UINT32 tileDataSize;
|
UINT32 tileDataSize;
|
||||||
RFX_MESSAGE* messages;
|
RFX_MESSAGE* messages;
|
||||||
maxDataSize -= 1024; /* reserve enough space for headers */
|
maxDataSize -= 1024; /* reserve enough space for headers */
|
||||||
|
@ -1716,9 +1722,9 @@ free_messages:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RFX_MESSAGE* rfx_encode_messages(RFX_CONTEXT* context, const RFX_RECT* rects, int numRects,
|
RFX_MESSAGE* rfx_encode_messages(RFX_CONTEXT* context, const RFX_RECT* rects, size_t numRects,
|
||||||
BYTE* data, int width, int height, int scanline, int* numMessages,
|
const BYTE* data, UINT32 width, UINT32 height, UINT32 scanline,
|
||||||
int maxDataSize)
|
size_t* numMessages, size_t maxDataSize)
|
||||||
{
|
{
|
||||||
RFX_MESSAGE* message;
|
RFX_MESSAGE* message;
|
||||||
RFX_MESSAGE* messageList;
|
RFX_MESSAGE* messageList;
|
||||||
|
@ -1737,7 +1743,7 @@ RFX_MESSAGE* rfx_encode_messages(RFX_CONTEXT* context, const RFX_RECT* rects, in
|
||||||
return messageList;
|
return messageList;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL rfx_write_message_tileset(RFX_CONTEXT* context, wStream* s, RFX_MESSAGE* message)
|
static BOOL rfx_write_message_tileset(RFX_CONTEXT* context, wStream* s, const RFX_MESSAGE* message)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
RFX_TILE* tile;
|
RFX_TILE* tile;
|
||||||
|
@ -1784,7 +1790,8 @@ static BOOL rfx_write_message_tileset(RFX_CONTEXT* context, wStream* s, RFX_MESS
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL rfx_write_message_frame_begin(RFX_CONTEXT* context, wStream* s, RFX_MESSAGE* message)
|
static BOOL rfx_write_message_frame_begin(RFX_CONTEXT* context, wStream* s,
|
||||||
|
const RFX_MESSAGE* message)
|
||||||
{
|
{
|
||||||
if (!Stream_EnsureRemainingCapacity(s, 14))
|
if (!Stream_EnsureRemainingCapacity(s, 14))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1798,7 +1805,7 @@ static BOOL rfx_write_message_frame_begin(RFX_CONTEXT* context, wStream* s, RFX_
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL rfx_write_message_region(RFX_CONTEXT* context, wStream* s, RFX_MESSAGE* message)
|
static BOOL rfx_write_message_region(RFX_CONTEXT* context, wStream* s, const RFX_MESSAGE* message)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
UINT32 blockLen;
|
UINT32 blockLen;
|
||||||
|
@ -1816,7 +1823,7 @@ static BOOL rfx_write_message_region(RFX_CONTEXT* context, wStream* s, RFX_MESSA
|
||||||
|
|
||||||
for (i = 0; i < message->numRects; i++)
|
for (i = 0; i < message->numRects; i++)
|
||||||
{
|
{
|
||||||
const RFX_RECT* rect = rfx_message_get_rect(message, i);
|
const RFX_RECT* rect = rfx_message_get_rect_const(message, i);
|
||||||
/* Clipping rectangles are relative to destLeft, destTop */
|
/* Clipping rectangles are relative to destLeft, destTop */
|
||||||
Stream_Write_UINT16(s, rect->x); /* x (2 bytes) */
|
Stream_Write_UINT16(s, rect->x); /* x (2 bytes) */
|
||||||
Stream_Write_UINT16(s, rect->y); /* y (2 bytes) */
|
Stream_Write_UINT16(s, rect->y); /* y (2 bytes) */
|
||||||
|
@ -1829,7 +1836,8 @@ static BOOL rfx_write_message_region(RFX_CONTEXT* context, wStream* s, RFX_MESSA
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL rfx_write_message_frame_end(RFX_CONTEXT* context, wStream* s, RFX_MESSAGE* message)
|
static BOOL rfx_write_message_frame_end(RFX_CONTEXT* context, wStream* s,
|
||||||
|
const RFX_MESSAGE* message)
|
||||||
{
|
{
|
||||||
if (!Stream_EnsureRemainingCapacity(s, 8))
|
if (!Stream_EnsureRemainingCapacity(s, 8))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1841,7 +1849,7 @@ static BOOL rfx_write_message_frame_end(RFX_CONTEXT* context, wStream* s, RFX_ME
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL rfx_write_message(RFX_CONTEXT* context, wStream* s, RFX_MESSAGE* message)
|
BOOL rfx_write_message(RFX_CONTEXT* context, wStream* s, const RFX_MESSAGE* message)
|
||||||
{
|
{
|
||||||
if (context->state == RFX_STATE_SEND_HEADERS)
|
if (context->state == RFX_STATE_SEND_HEADERS)
|
||||||
{
|
{
|
||||||
|
@ -1862,8 +1870,8 @@ BOOL rfx_write_message(RFX_CONTEXT* context, wStream* s, RFX_MESSAGE* message)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL rfx_compose_message(RFX_CONTEXT* context, wStream* s, const RFX_RECT* rects, int numRects,
|
BOOL rfx_compose_message(RFX_CONTEXT* context, wStream* s, const RFX_RECT* rects, size_t numRects,
|
||||||
BYTE* data, int width, int height, int scanline)
|
const BYTE* data, UINT32 width, UINT32 height, UINT32 scanline)
|
||||||
{
|
{
|
||||||
RFX_MESSAGE* message;
|
RFX_MESSAGE* message;
|
||||||
BOOL ret = TRUE;
|
BOOL ret = TRUE;
|
||||||
|
|
|
@ -62,7 +62,7 @@ static void rfx_decode_component(RFX_CONTEXT* context, const UINT32* quantizatio
|
||||||
/* rfx_decode_ycbcr_to_rgb code now resides in the primitives library. */
|
/* rfx_decode_ycbcr_to_rgb code now resides in the primitives library. */
|
||||||
|
|
||||||
/* stride is bytes between rows in the output buffer. */
|
/* stride is bytes between rows in the output buffer. */
|
||||||
BOOL rfx_decode_rgb(RFX_CONTEXT* context, RFX_TILE* tile, BYTE* rgb_buffer, int stride)
|
BOOL rfx_decode_rgb(RFX_CONTEXT* context, const RFX_TILE* tile, BYTE* rgb_buffer, UINT32 stride)
|
||||||
{
|
{
|
||||||
BOOL rc = TRUE;
|
BOOL rc = TRUE;
|
||||||
BYTE* pBuffer;
|
BYTE* pBuffer;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <freerdp/api.h>
|
#include <freerdp/api.h>
|
||||||
|
|
||||||
/* stride is bytes between rows in the output buffer. */
|
/* stride is bytes between rows in the output buffer. */
|
||||||
FREERDP_LOCAL BOOL rfx_decode_rgb(RFX_CONTEXT* context, RFX_TILE* tile, BYTE* rgb_buffer,
|
FREERDP_LOCAL BOOL rfx_decode_rgb(RFX_CONTEXT* context, const RFX_TILE* tile, BYTE* rgb_buffer,
|
||||||
int stride);
|
UINT32 stride);
|
||||||
|
|
||||||
#endif /* FREERDP_LIB_CODEC_RFX_DECODE_H */
|
#endif /* FREERDP_LIB_CODEC_RFX_DECODE_H */
|
||||||
|
|
Loading…
Reference in New Issue