From b9c8ac652796b869992c1e60f9be3b1372aaab67 Mon Sep 17 00:00:00 2001 From: Norbert Federa Date: Wed, 10 Jul 2013 07:14:26 +0200 Subject: [PATCH] codec/rfx: use function pointer for rlgr codec Option to switch the rlgr implementation during runtime - exactly like we do it with the ycbcr, dwt and quantization functions. --- include/freerdp/codec/rfx.h | 2 ++ libfreerdp/codec/rfx.c | 3 +++ libfreerdp/codec/rfx_decode.c | 2 +- libfreerdp/codec/rfx_encode.c | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/freerdp/codec/rfx.h b/include/freerdp/codec/rfx.h index d3ba0536a5df..97f5763d9332 100644 --- a/include/freerdp/codec/rfx.h +++ b/include/freerdp/codec/rfx.h @@ -106,6 +106,8 @@ struct _RFX_CONTEXT void (*quantization_encode)(INT16* buffer, const UINT32* quantization_values); void (*dwt_2d_decode)(INT16* buffer, INT16* dwt_buffer); void (*dwt_2d_encode)(INT16* buffer, INT16* dwt_buffer); + int (*rlgr_decode)(RLGR_MODE mode, const BYTE* data, int data_size, INT16* buffer, int buffer_size); + int (*rlgr_encode)(RLGR_MODE mode, const INT16* data, int data_size, BYTE* buffer, int buffer_size); /* private definitions */ RFX_CONTEXT_PRIV* priv; diff --git a/libfreerdp/codec/rfx.c b/libfreerdp/codec/rfx.c index b007ea21fa46..49a81d26f9df 100644 --- a/libfreerdp/codec/rfx.c +++ b/libfreerdp/codec/rfx.c @@ -45,6 +45,7 @@ #include "rfx_encode.h" #include "rfx_quantization.h" #include "rfx_dwt.h" +#include "rfx_rlgr.h" #include "rfx_sse2.h" #include "rfx_neon.h" @@ -240,6 +241,8 @@ RFX_CONTEXT* rfx_context_new(void) context->quantization_encode = rfx_quantization_encode; context->dwt_2d_decode = rfx_dwt_2d_decode; context->dwt_2d_encode = rfx_dwt_2d_encode; + context->rlgr_decode = rfx_rlgr_decode; + context->rlgr_encode = rfx_rlgr_encode; RFX_INIT_SIMD(context); diff --git a/libfreerdp/codec/rfx_decode.c b/libfreerdp/codec/rfx_decode.c index 051a44b20f06..ff616159044f 100644 --- a/libfreerdp/codec/rfx_decode.c +++ b/libfreerdp/codec/rfx_decode.c @@ -103,7 +103,7 @@ static void rfx_decode_component(RFX_CONTEXT* context, const UINT32* quantizatio PROFILER_ENTER(context->priv->prof_rfx_decode_component); PROFILER_ENTER(context->priv->prof_rfx_rlgr_decode); - rfx_rlgr_decode(context->mode, data, size, buffer, 4096); + context->rlgr_decode(context->mode, data, size, buffer, 4096); PROFILER_EXIT(context->priv->prof_rfx_rlgr_decode); PROFILER_ENTER(context->priv->prof_rfx_differential_decode); diff --git a/libfreerdp/codec/rfx_encode.c b/libfreerdp/codec/rfx_encode.c index b59570bec151..2b758988f348 100644 --- a/libfreerdp/codec/rfx_encode.c +++ b/libfreerdp/codec/rfx_encode.c @@ -209,7 +209,7 @@ static void rfx_encode_component(RFX_CONTEXT* context, const UINT32* quantizatio PROFILER_EXIT(context->priv->prof_rfx_differential_encode); PROFILER_ENTER(context->priv->prof_rfx_rlgr_encode); - *size = rfx_rlgr_encode(context->mode, data, 4096, buffer, buffer_size); + *size = context->rlgr_encode(context->mode, data, 4096, buffer, buffer_size); PROFILER_EXIT(context->priv->prof_rfx_rlgr_encode); PROFILER_EXIT(context->priv->prof_rfx_encode_component);