21 #include <freerdp/config.h>
27 #include <winpr/stream.h>
28 #include <freerdp/primitives.h>
30 #include "rfx_types.h"
32 #include "rfx_differential.h"
33 #include "rfx_quantization.h"
36 #include "rfx_decode.h"
38 static INLINE
void rfx_decode_component(RFX_CONTEXT* WINPR_RESTRICT context,
39 const UINT32* WINPR_RESTRICT quantization_values,
40 const BYTE* WINPR_RESTRICT data,
size_t size,
41 INT16* WINPR_RESTRICT buffer)
43 INT16* dwt_buffer = NULL;
44 dwt_buffer = BufferPool_Take(context->priv->BufferPool, -1);
45 PROFILER_ENTER(context->priv->prof_rfx_decode_component)
46 PROFILER_ENTER(context->priv->prof_rfx_rlgr_decode)
47 WINPR_ASSERT(size <= UINT32_MAX);
48 context->rlgr_decode(context->mode, data, (UINT32)size, buffer, 4096);
49 PROFILER_EXIT(context->priv->prof_rfx_rlgr_decode)
50 PROFILER_ENTER(context->priv->prof_rfx_differential_decode)
51 rfx_differential_decode(buffer + 4032, 64);
52 PROFILER_EXIT(context->priv->prof_rfx_differential_decode)
53 PROFILER_ENTER(context->priv->prof_rfx_quantization_decode)
54 context->quantization_decode(buffer, quantization_values);
55 PROFILER_EXIT(context->priv->prof_rfx_quantization_decode)
56 PROFILER_ENTER(context->priv->prof_rfx_dwt_2d_decode)
57 context->dwt_2d_decode(buffer, dwt_buffer);
58 PROFILER_EXIT(context->priv->prof_rfx_dwt_2d_decode)
59 PROFILER_EXIT(context->priv->prof_rfx_decode_component)
60 BufferPool_Return(context->priv->BufferPool, dwt_buffer);
66 BOOL rfx_decode_rgb(RFX_CONTEXT* WINPR_RESTRICT context, const
RFX_TILE* WINPR_RESTRICT tile,
67 BYTE* WINPR_RESTRICT rgb_buffer, UINT32 stride)
77 UINT32* y_quants = NULL;
78 UINT32* cb_quants = NULL;
79 UINT32* cr_quants = NULL;
82 PROFILER_ENTER(context->priv->prof_rfx_decode_rgb)
83 y_quants = context->quants + (10ULL * tile->quantIdxY);
84 cb_quants = context->quants + (10ULL * tile->quantIdxCb);
85 cr_quants = context->quants + (10ULL * tile->quantIdxCr);
86 pBuffer = (BYTE*)BufferPool_Take(context->priv->BufferPool, -1);
87 pSrcDst[0] = (INT16*)((&pBuffer[((8192ULL + 32ULL) * 0ULL) + 16ULL]));
88 pSrcDst[1] = (INT16*)((&pBuffer[((8192ULL + 32ULL) * 1ULL) + 16ULL]));
89 pSrcDst[2] = (INT16*)((&pBuffer[((8192ULL + 32ULL) * 2ULL) + 16ULL]));
90 rfx_decode_component(context, y_quants, tile->YData, tile->YLen, pSrcDst[0]);
91 rfx_decode_component(context, cb_quants, tile->CbData, tile->CbLen, pSrcDst[1]);
92 rfx_decode_component(context, cr_quants, tile->CrData, tile->CrLen, pSrcDst[2]);
93 PROFILER_ENTER(context->priv->prof_rfx_ycbcr_to_rgb)
96 if (prims->yCbCrToRGB_16s8u_P3AC4R(cnv.cpv, 64 * sizeof(INT16), rgb_buffer, stride,
97 context->pixel_format, &roi_64x64) != PRIMITIVES_SUCCESS)
100 PROFILER_EXIT(context->priv->prof_rfx_ycbcr_to_rgb)
101 PROFILER_EXIT(context->priv->prof_rfx_decode_rgb)
102 BufferPool_Return(context->priv->BufferPool, pBuffer);