From e5058da0987ac1db0570434fe10023b06ef51e08 Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Sun, 9 May 2010 16:02:31 +0200 Subject: [PATCH] Used vlc_memalign for vaapi/dxva2 copy buffer --- modules/codec/avcodec/copy.c | 7 ++----- modules/codec/avcodec/copy.h | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/codec/avcodec/copy.c b/modules/codec/avcodec/copy.c index 6bc0d8207c..4375c971a5 100644 --- a/modules/codec/avcodec/copy.c +++ b/modules/codec/avcodec/copy.c @@ -297,12 +297,9 @@ static void SplitPlanes(uint8_t *dstu, size_t dstu_pitch, int CopyInitCache(copy_cache_t *cache, unsigned width) { cache->size = __MAX((width + 0x0f) & ~ 0x0f, 4096); - cache->base = malloc(16 + cache->size); - if (cache->base == NULL) { - cache->buffer = NULL; + cache->buffer = vlc_memalign(&cache->base, 16, cache->size); + if (!cache->base) return VLC_EGENERIC; - } - cache->buffer = &cache->base[16 - ((intptr_t)cache->base & 0x0f)]; return VLC_SUCCESS; } void CopyCleanCache(copy_cache_t *cache) diff --git a/modules/codec/avcodec/copy.h b/modules/codec/avcodec/copy.h index 312bf4c4f3..93d246af5a 100644 --- a/modules/codec/avcodec/copy.h +++ b/modules/codec/avcodec/copy.h @@ -25,7 +25,7 @@ #define _VLC_AVCODEC_COPY_H 1 typedef struct { - uint8_t *base; + void *base; uint8_t *buffer; size_t size; } copy_cache_t; -- 2.39.2