From b74d324592b1d02ff745c53821098568f8a6df18 Mon Sep 17 00:00:00 2001 From: Vic Lee Date: Tue, 13 Mar 2012 19:02:19 +0800 Subject: [PATCH] rfx: rename pixel format constants. --- cunit/test_rfx.c | 6 +++--- include/freerdp/codec/rfx.h | 18 +++--------------- include/freerdp/constants.h | 16 ++++++++++++++++ libfreerdp-codec/rfx.c | 20 ++++++++++---------- libfreerdp-codec/rfx_decode.c | 10 +++++----- libfreerdp-codec/rfx_encode.c | 18 +++++++++--------- server/X11/xf_peer.c | 2 +- server/test/tfreerdp.c | 2 +- 8 files changed, 48 insertions(+), 44 deletions(-) diff --git a/cunit/test_rfx.c b/cunit/test_rfx.c index 9fdc6cbf1661..b361cc900f4c 100644 --- a/cunit/test_rfx.c +++ b/cunit/test_rfx.c @@ -306,7 +306,7 @@ void test_decode(void) context = rfx_context_new(); context->mode = RLGR3; - rfx_context_set_pixel_format(context, RFX_PIXEL_FORMAT_RGB); + rfx_context_set_pixel_format(context, RDP_PIXEL_FORMAT_R8G8B8); rfx_decode_rgb(context, s, sizeof(y_data), test_quantization_values, sizeof(cb_data), test_quantization_values, @@ -336,7 +336,7 @@ void test_encode(void) context = rfx_context_new(); context->mode = RLGR3; - rfx_context_set_pixel_format(context, RFX_PIXEL_FORMAT_RGB); + rfx_context_set_pixel_format(context, RDP_PIXEL_FORMAT_R8G8B8); rfx_encode_rgb(context, rgb_data, 64, 64, 64 * 3, test_quantization_values, test_quantization_values, test_quantization_values, @@ -382,7 +382,7 @@ void test_message(void) context->mode = RLGR3; context->width = 800; context->height = 600; - rfx_context_set_pixel_format(context, RFX_PIXEL_FORMAT_RGB); + rfx_context_set_pixel_format(context, RDP_PIXEL_FORMAT_R8G8B8); for (i = 0; i < 1000; i++) { diff --git a/include/freerdp/codec/rfx.h b/include/freerdp/codec/rfx.h index 2d6a0fe38216..084693be1332 100644 --- a/include/freerdp/codec/rfx.h +++ b/include/freerdp/codec/rfx.h @@ -22,6 +22,7 @@ #include #include +#include #include #ifdef __cplusplus @@ -35,19 +36,6 @@ enum _RLGR_MODE }; typedef enum _RLGR_MODE RLGR_MODE; -enum _RFX_PIXEL_FORMAT -{ - RFX_PIXEL_FORMAT_BGRA, - RFX_PIXEL_FORMAT_RGBA, - RFX_PIXEL_FORMAT_BGR, - RFX_PIXEL_FORMAT_RGB, - RFX_PIXEL_FORMAT_BGR565_LE, - RFX_PIXEL_FORMAT_RGB565_LE, - RFX_PIXEL_FORMAT_PALETTE4_PLANER, - RFX_PIXEL_FORMAT_PALETTE8 -}; -typedef enum _RFX_PIXEL_FORMAT RFX_PIXEL_FORMAT; - struct _RFX_RECT { uint16 x; @@ -97,7 +85,7 @@ struct _RFX_CONTEXT uint32 version; uint32 codec_id; uint32 codec_version; - RFX_PIXEL_FORMAT pixel_format; + RDP_PIXEL_FORMAT pixel_format; uint8 bits_per_pixel; /* color palette allocated by the application */ @@ -128,7 +116,7 @@ typedef struct _RFX_CONTEXT RFX_CONTEXT; FREERDP_API RFX_CONTEXT* rfx_context_new(void); FREERDP_API void rfx_context_free(RFX_CONTEXT* context); FREERDP_API void rfx_context_set_cpu_opt(RFX_CONTEXT* context, uint32 cpu_opt); -FREERDP_API void rfx_context_set_pixel_format(RFX_CONTEXT* context, RFX_PIXEL_FORMAT pixel_format); +FREERDP_API void rfx_context_set_pixel_format(RFX_CONTEXT* context, RDP_PIXEL_FORMAT pixel_format); FREERDP_API void rfx_context_reset(RFX_CONTEXT* context); FREERDP_API RFX_MESSAGE* rfx_process_message(RFX_CONTEXT* context, uint8* data, uint32 length); diff --git a/include/freerdp/constants.h b/include/freerdp/constants.h index 6f481714c07a..88b3c321f342 100644 --- a/include/freerdp/constants.h +++ b/include/freerdp/constants.h @@ -78,6 +78,22 @@ enum RDP_SVC_CHANNEL_EVENT CHANNEL_EVENT_USER = 1000 }; +/** + * Pixel format + */ +enum RDP_PIXEL_FORMAT +{ + RDP_PIXEL_FORMAT_B8G8R8A8, + RDP_PIXEL_FORMAT_R8G8B8A8, + RDP_PIXEL_FORMAT_B8G8R8, + RDP_PIXEL_FORMAT_R8G8B8, + RDP_PIXEL_FORMAT_B5G6R5_LE, + RDP_PIXEL_FORMAT_R5G6B5_LE, + RDP_PIXEL_FORMAT_P4_PLANER, + RDP_PIXEL_FORMAT_P8 +}; +typedef enum RDP_PIXEL_FORMAT RDP_PIXEL_FORMAT; + /** * Virtual Channel Constants */ diff --git a/libfreerdp-codec/rfx.c b/libfreerdp-codec/rfx.c index 9a62ddbe7f3e..45ce680aeaeb 100644 --- a/libfreerdp-codec/rfx.c +++ b/libfreerdp-codec/rfx.c @@ -138,7 +138,7 @@ RFX_CONTEXT* rfx_context_new(void) context->priv->pool = rfx_pool_new(); /* initialize the default pixel format */ - rfx_context_set_pixel_format(context, RFX_PIXEL_FORMAT_BGRA); + rfx_context_set_pixel_format(context, RDP_PIXEL_FORMAT_B8G8R8A8); /* align buffers to 16 byte boundary (needed for SSE/SSE2 instructions) */ context->priv->y_r_buffer = (sint16*)(((uintptr_t)context->priv->y_r_mem + 16) & ~ 0x0F); @@ -181,27 +181,27 @@ void rfx_context_free(RFX_CONTEXT* context) xfree(context); } -void rfx_context_set_pixel_format(RFX_CONTEXT* context, RFX_PIXEL_FORMAT pixel_format) +void rfx_context_set_pixel_format(RFX_CONTEXT* context, RDP_PIXEL_FORMAT pixel_format) { context->pixel_format = pixel_format; switch (pixel_format) { - case RFX_PIXEL_FORMAT_BGRA: - case RFX_PIXEL_FORMAT_RGBA: + case RDP_PIXEL_FORMAT_B8G8R8A8: + case RDP_PIXEL_FORMAT_R8G8B8A8: context->bits_per_pixel = 32; break; - case RFX_PIXEL_FORMAT_BGR: - case RFX_PIXEL_FORMAT_RGB: + case RDP_PIXEL_FORMAT_B8G8R8: + case RDP_PIXEL_FORMAT_R8G8B8: context->bits_per_pixel = 24; break; - case RFX_PIXEL_FORMAT_BGR565_LE: - case RFX_PIXEL_FORMAT_RGB565_LE: + case RDP_PIXEL_FORMAT_B5G6R5_LE: + case RDP_PIXEL_FORMAT_R5G6B5_LE: context->bits_per_pixel = 16; break; - case RFX_PIXEL_FORMAT_PALETTE4_PLANER: + case RDP_PIXEL_FORMAT_P4_PLANER: context->bits_per_pixel = 4; break; - case RFX_PIXEL_FORMAT_PALETTE8: + case RDP_PIXEL_FORMAT_P8: context->bits_per_pixel = 8; break; default: diff --git a/libfreerdp-codec/rfx_decode.c b/libfreerdp-codec/rfx_decode.c index f77866114ed3..22cd4cd928a8 100644 --- a/libfreerdp-codec/rfx_decode.c +++ b/libfreerdp-codec/rfx_decode.c @@ -31,7 +31,7 @@ #include "rfx_decode.h" static void rfx_decode_format_rgb(sint16* r_buf, sint16* g_buf, sint16* b_buf, - RFX_PIXEL_FORMAT pixel_format, uint8* dst_buf) + RDP_PIXEL_FORMAT pixel_format, uint8* dst_buf) { sint16* r = r_buf; sint16* g = g_buf; @@ -41,7 +41,7 @@ static void rfx_decode_format_rgb(sint16* r_buf, sint16* g_buf, sint16* b_buf, switch (pixel_format) { - case RFX_PIXEL_FORMAT_BGRA: + case RDP_PIXEL_FORMAT_B8G8R8A8: for (i = 0; i < 4096; i++) { *dst++ = (uint8) (*b++); @@ -50,7 +50,7 @@ static void rfx_decode_format_rgb(sint16* r_buf, sint16* g_buf, sint16* b_buf, *dst++ = 0xFF; } break; - case RFX_PIXEL_FORMAT_RGBA: + case RDP_PIXEL_FORMAT_R8G8B8A8: for (i = 0; i < 4096; i++) { *dst++ = (uint8) (*r++); @@ -59,7 +59,7 @@ static void rfx_decode_format_rgb(sint16* r_buf, sint16* g_buf, sint16* b_buf, *dst++ = 0xFF; } break; - case RFX_PIXEL_FORMAT_BGR: + case RDP_PIXEL_FORMAT_B8G8R8: for (i = 0; i < 4096; i++) { *dst++ = (uint8) (*b++); @@ -67,7 +67,7 @@ static void rfx_decode_format_rgb(sint16* r_buf, sint16* g_buf, sint16* b_buf, *dst++ = (uint8) (*r++); } break; - case RFX_PIXEL_FORMAT_RGB: + case RDP_PIXEL_FORMAT_R8G8B8: for (i = 0; i < 4096; i++) { *dst++ = (uint8) (*r++); diff --git a/libfreerdp-codec/rfx_encode.c b/libfreerdp-codec/rfx_encode.c index 578866d0fd9d..451188ed8075 100644 --- a/libfreerdp-codec/rfx_encode.c +++ b/libfreerdp-codec/rfx_encode.c @@ -32,7 +32,7 @@ #define MINMAX(_v,_l,_h) ((_v) < (_l) ? (_l) : ((_v) > (_h) ? (_h) : (_v))) static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, int rowstride, - RFX_PIXEL_FORMAT pixel_format, const uint8* palette, sint16* r_buf, sint16* g_buf, sint16* b_buf) + RDP_PIXEL_FORMAT pixel_format, const uint8* palette, sint16* r_buf, sint16* g_buf, sint16* b_buf) { int x, y; int x_exceed; @@ -50,7 +50,7 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, switch (pixel_format) { - case RFX_PIXEL_FORMAT_BGRA: + case RDP_PIXEL_FORMAT_B8G8R8A8: for (x = 0; x < width; x++) { *b_buf++ = (sint16) (*src++); @@ -59,7 +59,7 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, src++; } break; - case RFX_PIXEL_FORMAT_RGBA: + case RDP_PIXEL_FORMAT_R8G8B8A8: for (x = 0; x < width; x++) { *r_buf++ = (sint16) (*src++); @@ -68,7 +68,7 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, src++; } break; - case RFX_PIXEL_FORMAT_BGR: + case RDP_PIXEL_FORMAT_B8G8R8: for (x = 0; x < width; x++) { *b_buf++ = (sint16) (*src++); @@ -76,7 +76,7 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, *r_buf++ = (sint16) (*src++); } break; - case RFX_PIXEL_FORMAT_RGB: + case RDP_PIXEL_FORMAT_R8G8B8: for (x = 0; x < width; x++) { *r_buf++ = (sint16) (*src++); @@ -84,7 +84,7 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, *b_buf++ = (sint16) (*src++); } break; - case RFX_PIXEL_FORMAT_BGR565_LE: + case RDP_PIXEL_FORMAT_B5G6R5_LE: for (x = 0; x < width; x++) { *b_buf++ = (sint16) (((*(src + 1)) & 0xF8) | ((*(src + 1)) >> 5)); @@ -93,7 +93,7 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, src += 2; } break; - case RFX_PIXEL_FORMAT_RGB565_LE: + case RDP_PIXEL_FORMAT_R5G6B5_LE: for (x = 0; x < width; x++) { *r_buf++ = (sint16) (((*(src + 1)) & 0xF8) | ((*(src + 1)) >> 5)); @@ -102,7 +102,7 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, src += 2; } break; - case RFX_PIXEL_FORMAT_PALETTE4_PLANER: + case RDP_PIXEL_FORMAT_P4_PLANER: if (!palette) break; for (x = 0; x < width; x++) @@ -123,7 +123,7 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height, src += 4; } break; - case RFX_PIXEL_FORMAT_PALETTE8: + case RDP_PIXEL_FORMAT_P8: if (!palette) break; for (x = 0; x < width; x++) diff --git a/server/X11/xf_peer.c b/server/X11/xf_peer.c index 5a988a2fb348..fb9658ce8088 100644 --- a/server/X11/xf_peer.c +++ b/server/X11/xf_peer.c @@ -262,7 +262,7 @@ void xf_peer_context_new(freerdp_peer* client, xfPeerContext* context) context->rfx_context->width = context->info->width; context->rfx_context->height = context->info->height; - rfx_context_set_pixel_format(context->rfx_context, RFX_PIXEL_FORMAT_BGRA); + rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_B8G8R8A8); context->s = stream_new(65536); } diff --git a/server/test/tfreerdp.c b/server/test/tfreerdp.c index 354836043ace..9e2a14c1a046 100644 --- a/server/test/tfreerdp.c +++ b/server/test/tfreerdp.c @@ -67,7 +67,7 @@ void test_peer_context_new(freerdp_peer* client, testPeerContext* context) context->rfx_context->mode = RLGR3; context->rfx_context->width = client->settings->width; context->rfx_context->height = client->settings->height; - rfx_context_set_pixel_format(context->rfx_context, RFX_PIXEL_FORMAT_RGB); + rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_R8G8B8); context->s = stream_new(65536);