codec: Revamp of rfx rlgr API
This PR contains following changes: - Give rlgr encode/decode APIs a similar interface - Make rlgr encode API accessible again - Make it possible to exchange rlgr functions - Make use of RLGR1/3 defines instead of 0/1 in decoding
This commit is contained in:
parent
3f39dc435a
commit
6c9df44846
@ -161,6 +161,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, UINT32 data_size, INT16* buffer, UINT32 buffer_size);
|
||||
int (*rlgr_encode)(RLGR_MODE mode, const INT16* data, UINT32 data_size, BYTE* buffer, UINT32 buffer_size);
|
||||
|
||||
/* private definitions */
|
||||
RFX_CONTEXT_PRIV* priv;
|
||||
@ -169,9 +171,6 @@ struct _RFX_CONTEXT
|
||||
FREERDP_API void rfx_context_set_pixel_format(RFX_CONTEXT* context,
|
||||
UINT32 pixel_format);
|
||||
|
||||
FREERDP_API int rfx_rlgr_decode(const BYTE* pSrcData, UINT32 SrcSize,
|
||||
INT16* pDstData, UINT32 DstSize, int mode);
|
||||
|
||||
FREERDP_API BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data,
|
||||
UINT32 format, UINT32 length,
|
||||
UINT32 left, UINT32 top,
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "rfx_differential.h"
|
||||
#include "rfx_quantization.h"
|
||||
#include "rfx_rlgr.h"
|
||||
|
||||
#define TAG FREERDP_TAG("codec.progressive")
|
||||
|
||||
@ -707,7 +708,7 @@ static int progressive_rfx_decode_component(PROGRESSIVE_CONTEXT* progressive,
|
||||
int status;
|
||||
INT16* temp;
|
||||
const primitives_t* prims = primitives_get();
|
||||
status = rfx_rlgr_decode(data, length, buffer, 4096, 1);
|
||||
status = rfx_rlgr_decode(RLGR1, data, length, buffer, 4096);
|
||||
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
@ -337,6 +337,8 @@ RFX_CONTEXT* rfx_context_new(BOOL encoder)
|
||||
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);
|
||||
context->state = RFX_STATE_SEND_HEADERS;
|
||||
return context;
|
||||
|
@ -65,7 +65,7 @@ static void rfx_decode_component(RFX_CONTEXT* context,
|
||||
dwt_buffer = BufferPool_Take(context->priv->BufferPool, -1); /* dwt_buffer */
|
||||
PROFILER_ENTER(context->priv->prof_rfx_decode_component);
|
||||
PROFILER_ENTER(context->priv->prof_rfx_rlgr_decode);
|
||||
rfx_rlgr_decode(data, size, buffer, 4096, (context->mode == RLGR1) ? 1 : 3);
|
||||
rfx_rlgr_decode(context->mode, data, size, buffer, 4096);
|
||||
PROFILER_EXIT(context->priv->prof_rfx_rlgr_decode);
|
||||
PROFILER_ENTER(context->priv->prof_rfx_differential_decode);
|
||||
rfx_differential_decode(buffer + 4032, 64);
|
||||
|
@ -96,7 +96,7 @@ static INLINE UINT32 lzcnt_s(UINT32 x)
|
||||
return __lzcnt(x);
|
||||
}
|
||||
|
||||
int rfx_rlgr_decode(const BYTE* pSrcData, UINT32 SrcSize, INT16* pDstData, UINT32 DstSize, int mode)
|
||||
int rfx_rlgr_decode(RLGR_MODE mode, const BYTE* pSrcData, UINT32 SrcSize, INT16* pDstData, UINT32 DstSize)
|
||||
{
|
||||
int vk;
|
||||
int run;
|
||||
@ -124,8 +124,8 @@ int rfx_rlgr_decode(const BYTE* pSrcData, UINT32 SrcSize, INT16* pDstData, UINT3
|
||||
kr = 1;
|
||||
krp = kr << LSGR;
|
||||
|
||||
if ((mode != 1) && (mode != 3))
|
||||
mode = 1;
|
||||
if ((mode != RLGR1) && (mode != RLGR3))
|
||||
mode = RLGR1;
|
||||
|
||||
if (!pSrcData || !SrcSize)
|
||||
return -1;
|
||||
@ -387,7 +387,7 @@ int rfx_rlgr_decode(const BYTE* pSrcData, UINT32 SrcSize, INT16* pDstData, UINT3
|
||||
kr = krp >> LSGR;
|
||||
}
|
||||
|
||||
if (mode == 1) /* RLGR1 */
|
||||
if (mode == RLGR1) /* RLGR1 */
|
||||
{
|
||||
if (!code)
|
||||
{
|
||||
@ -430,7 +430,7 @@ int rfx_rlgr_decode(const BYTE* pSrcData, UINT32 SrcSize, INT16* pDstData, UINT3
|
||||
pOutput++;
|
||||
}
|
||||
}
|
||||
else if (mode == 3) /* RLGR3 */
|
||||
else if (mode == RLGR3) /* RLGR3 */
|
||||
{
|
||||
nIdx = 0;
|
||||
|
||||
@ -573,7 +573,7 @@ static void rfx_rlgr_code_gr(RFX_BITSTREAM* bs, int* krp, UINT32 val)
|
||||
}
|
||||
}
|
||||
|
||||
int rfx_rlgr_encode(RLGR_MODE mode, const INT16* data, int data_size, BYTE* buffer, int buffer_size)
|
||||
int rfx_rlgr_encode(RLGR_MODE mode, const INT16* data, UINT32 data_size, BYTE* buffer, UINT32 buffer_size)
|
||||
{
|
||||
int k;
|
||||
int kp;
|
||||
|
@ -24,6 +24,9 @@
|
||||
#include <freerdp/api.h>
|
||||
|
||||
FREERDP_LOCAL int rfx_rlgr_encode(RLGR_MODE mode, const INT16* data,
|
||||
int data_size, BYTE* buffer, int buffer_size);
|
||||
UINT32 data_size, BYTE* buffer, UINT32 buffer_size);
|
||||
|
||||
FREERDP_LOCAL int rfx_rlgr_decode(RLGR_MODE mode, const BYTE* pSrcData, UINT32 SrcSize,
|
||||
INT16* pDstData, UINT32 DstSize);
|
||||
|
||||
#endif /* __RFX_RLGR_H */
|
||||
|
Loading…
Reference in New Issue
Block a user