libfreerdp-codec: use _aligned_free for RemoteFX buffers

This commit is contained in:
Marc-André Moreau 2013-01-22 18:32:17 -05:00
parent 438a727c6b
commit 37a59efbe3
2 changed files with 10 additions and 11 deletions

View File

@ -163,11 +163,10 @@ RFX_CONTEXT* rfx_context_new(void)
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 = (INT16*)(((uintptr_t)context->priv->y_r_mem + 16) & ~ 0x0F);
context->priv->cb_g_buffer = (INT16*)(((uintptr_t)context->priv->cb_g_mem + 16) & ~ 0x0F);
context->priv->cr_b_buffer = (INT16*)(((uintptr_t)context->priv->cr_b_mem + 16) & ~ 0x0F);
context->priv->dwt_buffer = (INT16*)(((uintptr_t)context->priv->dwt_mem + 16) & ~ 0x0F);
context->priv->y_r_buffer = _aligned_malloc(4096 * 4, 16); /* 4096 = 64x64 */
context->priv->cb_g_buffer = _aligned_malloc(4096 * 4, 16); /* 4096 = 64x64 */
context->priv->cr_b_buffer = _aligned_malloc(4096 * 4, 16); /* 4096 = 64x64 */
context->priv->dwt_buffer = _aligned_malloc(32 * 32 * 4 * 2 * 2, 16); /* maximum sub-band width is 32 */
/* create profilers for default decoding routines */
rfx_profiler_create(context);
@ -204,6 +203,12 @@ void rfx_context_free(RFX_CONTEXT* context)
DestroyThreadpoolEnvironment(&context->priv->ThreadPoolEnv);
}
_aligned_free(context->priv->y_r_buffer);
_aligned_free(context->priv->cb_g_buffer);
_aligned_free(context->priv->cr_b_buffer);
_aligned_free(context->priv->dwt_buffer);
free(context->priv);
free(context);
}

View File

@ -47,16 +47,10 @@ struct _RFX_CONTEXT_PRIV
BOOL parallel;
PTP_POOL ThreadPool;
TP_CALLBACK_ENVIRON ThreadPoolEnv;
INT16 y_r_mem[4096 + 8]; /* 4096 = 64x64 (+ 8x2 = 16 for mem align) */
INT16 cb_g_mem[4096 + 8]; /* 4096 = 64x64 (+ 8x2 = 16 for mem align) */
INT16 cr_b_mem[4096 + 8]; /* 4096 = 64x64 (+ 8x2 = 16 for mem align) */
INT16* y_r_buffer;
INT16* cb_g_buffer;
INT16* cr_b_buffer;
INT16 dwt_mem[32 * 32 * 2 * 2 + 8]; /* maximum sub-band width is 32 */
INT16* dwt_buffer;