[codec,planar] use aligned allocation
This commit is contained in:
parent
0297a58638
commit
4795ee5eac
@ -1586,18 +1586,26 @@ BOOL freerdp_bitmap_planar_context_reset(BITMAP_PLANAR_CONTEXT* context, UINT32
|
||||
context->maxHeight = PLANAR_ALIGN(height, 4);
|
||||
context->maxPlaneSize = context->maxWidth * context->maxHeight;
|
||||
context->nTempStep = context->maxWidth * 4;
|
||||
free(context->planesBuffer);
|
||||
free(context->pTempData);
|
||||
free(context->deltaPlanesBuffer);
|
||||
free(context->rlePlanesBuffer);
|
||||
context->planesBuffer = calloc(context->maxPlaneSize, 4);
|
||||
context->pTempData = calloc(context->maxPlaneSize, 6);
|
||||
context->deltaPlanesBuffer = calloc(context->maxPlaneSize, 4);
|
||||
context->rlePlanesBuffer = calloc(context->maxPlaneSize, 4);
|
||||
|
||||
if (!context->planesBuffer || !context->pTempData || !context->deltaPlanesBuffer ||
|
||||
!context->rlePlanesBuffer)
|
||||
void* tmp = winpr_aligned_recalloc(context->planesBuffer, context->maxPlaneSize, 4, 32);
|
||||
if (!tmp)
|
||||
return FALSE;
|
||||
context->planesBuffer = tmp;
|
||||
|
||||
tmp = winpr_aligned_recalloc(context->pTempData, context->maxPlaneSize, 6, 32);
|
||||
if (!tmp)
|
||||
return FALSE;
|
||||
context->pTempData = tmp;
|
||||
|
||||
tmp = winpr_aligned_recalloc(context->deltaPlanesBuffer, context->maxPlaneSize, 4, 32);
|
||||
if (!tmp)
|
||||
return FALSE;
|
||||
context->deltaPlanesBuffer = tmp;
|
||||
|
||||
tmp = winpr_aligned_recalloc(context->rlePlanesBuffer, context->maxPlaneSize, 4, 32);
|
||||
if (!tmp)
|
||||
return FALSE;
|
||||
context->rlePlanesBuffer = tmp;
|
||||
|
||||
context->planes[0] = &context->planesBuffer[context->maxPlaneSize * 0];
|
||||
context->planes[1] = &context->planesBuffer[context->maxPlaneSize * 1];
|
||||
@ -1613,8 +1621,8 @@ BOOL freerdp_bitmap_planar_context_reset(BITMAP_PLANAR_CONTEXT* context, UINT32
|
||||
BITMAP_PLANAR_CONTEXT* freerdp_bitmap_planar_context_new(DWORD flags, UINT32 maxWidth,
|
||||
UINT32 maxHeight)
|
||||
{
|
||||
BITMAP_PLANAR_CONTEXT* context;
|
||||
context = (BITMAP_PLANAR_CONTEXT*)calloc(1, sizeof(BITMAP_PLANAR_CONTEXT));
|
||||
BITMAP_PLANAR_CONTEXT* context =
|
||||
(BITMAP_PLANAR_CONTEXT*)winpr_aligned_calloc(1, sizeof(BITMAP_PLANAR_CONTEXT), 32);
|
||||
|
||||
if (!context)
|
||||
return NULL;
|
||||
@ -1647,11 +1655,11 @@ void freerdp_bitmap_planar_context_free(BITMAP_PLANAR_CONTEXT* context)
|
||||
if (!context)
|
||||
return;
|
||||
|
||||
free(context->pTempData);
|
||||
free(context->planesBuffer);
|
||||
free(context->deltaPlanesBuffer);
|
||||
free(context->rlePlanesBuffer);
|
||||
free(context);
|
||||
winpr_aligned_free(context->pTempData);
|
||||
winpr_aligned_free(context->planesBuffer);
|
||||
winpr_aligned_free(context->deltaPlanesBuffer);
|
||||
winpr_aligned_free(context->rlePlanesBuffer);
|
||||
winpr_aligned_free(context);
|
||||
}
|
||||
|
||||
void freerdp_planar_switch_bgr(BITMAP_PLANAR_CONTEXT* planar, BOOL bgr)
|
||||
|
Loading…
x
Reference in New Issue
Block a user