Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53810
This bug is marked as a regression, however I don't see it crashing on my system, with current wine. I do however get a black screen instead of the intro video. This fix helps.
I think it's fine to wait for 9.0 without this MR, but also might be nice to get it working.
From: Nikolay Sivov nsivov@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53810 Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/evr.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/evr/evr.c b/dlls/evr/evr.c index 803c1d2dff9..516427c5fff 100644 --- a/dlls/evr/evr.c +++ b/dlls/evr/evr.c @@ -344,7 +344,7 @@ static void evr_destroy(struct strmbase_renderer *iface) free(filter); }
-static HRESULT evr_copy_sample_buffer(struct evr *filter, IMediaSample *input_sample, IMFSample **sample) +static HRESULT evr_copy_sample_buffer(struct evr *filter, const GUID *subtype, IMediaSample *input_sample, IMFSample **sample) { IDirect3DSurface9 *surface; D3DLOCKED_RECT locked_rect; @@ -364,6 +364,15 @@ static HRESULT evr_copy_sample_buffer(struct evr *filter, IMediaSample *input_sa width = frame_size >> 32; lines = frame_size;
+ if (IsEqualGUID(subtype, &MFVideoFormat_YUY2)) + { + width = (3 * width + 3) & ~3; + } + else + { + width *= 4; + } + if (FAILED(hr = IMediaSample_GetPointer(input_sample, &src))) { WARN("Failed to get pointer to sample data, hr %#lx.\n", hr); @@ -383,7 +392,7 @@ static HRESULT evr_copy_sample_buffer(struct evr *filter, IMediaSample *input_sa if (SUCCEEDED(hr = IDirect3DSurface9_LockRect(surface, &locked_rect, NULL, D3DLOCK_DISCARD))) { if (src_stride < 0) src += (-src_stride) * (lines - 1); - MFCopyImage(locked_rect.pBits, locked_rect.Pitch, src, src_stride, width * 4, lines); + MFCopyImage(locked_rect.pBits, locked_rect.Pitch, src, src_stride, width, lines); IDirect3DSurface9_UnlockRect(surface); }
@@ -417,9 +426,10 @@ static HRESULT evr_render(struct strmbase_renderer *iface, IMediaSample *input_s IMFMediaType_GetGUID(filter->media_type, &MF_MT_SUBTYPE, &subtype);
if (IsEqualGUID(&subtype, &MFVideoFormat_ARGB32) - || IsEqualGUID(&subtype, &MFVideoFormat_RGB32)) + || IsEqualGUID(&subtype, &MFVideoFormat_RGB32) + || IsEqualGUID(&subtype, &MFVideoFormat_YUY2)) { - if (SUCCEEDED(hr = evr_copy_sample_buffer(filter, input_sample, &sample))) + if (SUCCEEDED(hr = evr_copy_sample_buffer(filter, &subtype, input_sample, &sample))) { if (SUCCEEDED(IMFTransform_ProcessInput(filter->mixer, 0, sample, 0))) IMFVideoPresenter_ProcessMessage(filter->presenter, MFVP_MESSAGE_PROCESSINPUTNOTIFY, 0);
Shouldn't that be 2 * width, not 3 * width?
On Wed Dec 20 20:55:27 2023 +0000, Zebediah Figura wrote:
Shouldn't that be 2 * width, not 3 * width?
I was using https://learn.microsoft.com/en-us/windows/win32/medfound/recommended-8-bit-y.... It's 1 byte per YUV component, but going as Y0-U0-Y1-V0-... but still 3 bytes per sample. Also since this is used as a stride, I'd expect to get artifacts if it wasn't right.
On Wed Dec 20 20:55:27 2023 +0000, Nikolay Sivov wrote:
I was using https://learn.microsoft.com/en-us/windows/win32/medfound/recommended-8-bit-y.... It's 1 byte per YUV component, but going as Y0-U0-Y1-V0-... but still 3 bytes per sample. Also since this is used as a stride, I'd expect to get artifacts if it wasn't right.
YUY2 is 4:2:2, so chroma is subsampled at one-half the normal rate, i.e. one byte per 2x1 block per channel. Each 4-byte sequence represents exactly 2 pixels.