[vlc-commits] commit: Used vlc_memalign for vaapi/dxva2 copy buffer (Laurent Aimar )

git at videolan.org git at videolan.org
Sun May 9 16:19:00 CEST 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun May  9 16:02:31 2010 +0200| [e5058da0987ac1db0570434fe10023b06ef51e08] | committer: Laurent Aimar 

Used vlc_memalign for vaapi/dxva2 copy buffer

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e5058da0987ac1db0570434fe10023b06ef51e08
---

 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 6bc0d82..4375c97 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 312bf4c..93d246a 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;



More information about the vlc-commits mailing list