mfplat: Fix packed byte width calculation for 2D buffer.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Nikolay Sivov 2020-03-19 15:07:40 +03:00 committed by Alexandre Julliard
parent 5adb32f8b3
commit 2863eb0251
3 changed files with 7 additions and 7 deletions

View File

@ -544,7 +544,7 @@ static HRESULT create_1d_buffer(DWORD max_length, DWORD alignment, IMFMediaBuffe
static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bottom_up, IMFMediaBuffer **buffer)
{
unsigned int bpp, max_length, plane_size;
unsigned int stride, max_length, plane_size;
struct memory_buffer *object;
unsigned int row_alignment;
GUID subtype;
@ -560,7 +560,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo
memcpy(&subtype, &MFVideoFormat_Base, sizeof(subtype));
subtype.Data1 = fourcc;
if (!(bpp = mf_format_get_bpp(&subtype, &is_yuv)))
if (!(stride = mf_format_get_stride(&subtype, width, &is_yuv)))
return MF_E_INVALIDMEDIATYPE;
if (is_yuv && bottom_up)
@ -586,7 +586,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo
row_alignment = MF_64_BYTE_ALIGNMENT;
}
pitch = ALIGN_SIZE(width * bpp, row_alignment);
pitch = ALIGN_SIZE(stride, row_alignment);
switch (fourcc)
{
@ -610,7 +610,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo
object->IMF2DBuffer2_iface.lpVtbl = &memory_2d_buffer_vtbl;
object->_2d.plane_size = plane_size;
object->_2d.width = width * bpp;
object->_2d.width = stride;
object->_2d.height = height;
object->_2d.pitch = bottom_up ? -pitch : pitch;
object->_2d.scanline0 = bottom_up ? object->data + pitch * (object->_2d.height - 1) : object->data;

View File

@ -1815,14 +1815,14 @@ static unsigned int mf_get_stride_for_format(const struct uncompressed_video_for
return (width * format->bytes_per_pixel + format->alignment) & ~format->alignment;
}
unsigned int mf_format_get_bpp(const GUID *subtype, BOOL *is_yuv)
unsigned int mf_format_get_stride(const GUID *subtype, unsigned int width, BOOL *is_yuv)
{
struct uncompressed_video_format *format = mf_get_video_format(subtype);
if (format)
{
*is_yuv = format->yuv;
return format->bytes_per_pixel;
return mf_get_stride_for_format(format, width);
}
return 0;

View File

@ -115,7 +115,7 @@ static inline BOOL mf_array_reserve(void **elements, size_t *capacity, size_t co
return TRUE;
}
extern unsigned int mf_format_get_bpp(const GUID *subtype, BOOL *is_yuv) DECLSPEC_HIDDEN;
extern unsigned int mf_format_get_stride(const GUID *subtype, unsigned int width, BOOL *is_yuv) DECLSPEC_HIDDEN;
static inline const char *debugstr_propvar(const PROPVARIANT *v)
{