Nikolay Sivov : mfplat: Fix buffer alignment calculation.

Alexandre Julliard julliard at winehq.org
Tue Mar 17 17:21:09 CDT 2020


Module: wine
Branch: master
Commit: 6450fb3bda5fcd6e38e5270fe1a6227b74fb49a1
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6450fb3bda5fcd6e38e5270fe1a6227b74fb49a1

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Mar 17 17:10:31 2020 +0300

mfplat: Fix buffer alignment calculation.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mfplat/buffer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c
index 7c123e3e65..323603cf21 100644
--- a/dlls/mfplat/buffer.c
+++ b/dlls/mfplat/buffer.c
@@ -24,7 +24,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
 
-#define ALIGN_SIZE(size, alignment) (((size) + (alignment - 1)) & ~((alignment - 1)))
+#define ALIGN_SIZE(size, alignment) (((size) + (alignment)) & ~((alignment)))
 
 struct memory_buffer
 {
@@ -262,7 +262,7 @@ static HRESULT WINAPI memory_1d_2d_buffer_Lock(IMFMediaBuffer *iface, BYTE **dat
         hr = MF_E_INVALIDREQUEST;
     else if (!buffer->_2d.linear_buffer)
     {
-        if (!(buffer->_2d.linear_buffer = heap_alloc(ALIGN_SIZE(buffer->_2d.plane_size, 64))))
+        if (!(buffer->_2d.linear_buffer = heap_alloc(ALIGN_SIZE(buffer->_2d.plane_size, MF_64_BYTE_ALIGNMENT))))
             hr = E_OUTOFMEMORY;
     }
 
@@ -575,7 +575,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo
     if (!object)
         return E_OUTOFMEMORY;
 
-    pitch = ALIGN_SIZE(width * bpp, 64);
+    pitch = ALIGN_SIZE(width * bpp, MF_64_BYTE_ALIGNMENT);
 
     switch (fourcc)
     {




More information about the wine-cvs mailing list