3/3 fixes the March of Empires intro video rendering bug (Bug 24114).
1/3 and 2/3 are basically 60794728697 and df9bdcfdc10 but for VMR7 which was missing.
From: Francisco Casas fcasas@codeweavers.com
This change was previously introduced for vmr9.c but not for vmr7.c. --- dlls/quartz/vmr7.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/quartz/vmr7.c b/dlls/quartz/vmr7.c index 2a077f266ab..dc1a614e2c1 100644 --- a/dlls/quartz/vmr7.c +++ b/dlls/quartz/vmr7.c @@ -196,6 +196,12 @@ static HRESULT vmr_render(struct strmbase_renderer *iface, IMediaSample *sample) return hr; }
+ if (width > surface_desc.dwWidth || abs(height) > surface_desc.dwHeight) + { + FIXME("src surface (%ux%u) larger than rendering surface (%lux%lu).\n", width, height, + surface_desc.dwWidth, surface_desc.dwHeight); + } + if (height > 0 && bitmap_header->biCompression == BI_RGB) { BYTE *dst = (BYTE *)surface_desc.lpSurface + (height * surface_desc.lPitch);
From: Francisco Casas fcasas@codeweavers.com
These changes were previously introduced for vmr9.c but were missing for vmr7.c. --- dlls/quartz/vmr7.c | 74 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 17 deletions(-)
diff --git a/dlls/quartz/vmr7.c b/dlls/quartz/vmr7.c index dc1a614e2c1..7d29e38b14a 100644 --- a/dlls/quartz/vmr7.c +++ b/dlls/quartz/vmr7.c @@ -125,6 +125,42 @@ static struct vmr7 *impl_from_IBaseFilter(IBaseFilter *iface) return CONTAINING_RECORD(iface, struct vmr7, renderer.filter.IBaseFilter_iface); }
+static void copy_plane(BYTE **dstp, unsigned int dst_pitch, unsigned int dst_height, + const BYTE **srcp, unsigned int src_pitch, int src_height) +{ + size_t copy_size = min(src_pitch, dst_pitch); + const BYTE *src = *srcp; + BYTE *dst = *dstp; + unsigned int i; + + if (src_height < 0) + { + TRACE("Inverting image.\n"); + + src_height = -src_height; + src += src_height * src_pitch; + + for (i = 0; i < src_height; ++i) + { + src -= src_pitch; + memcpy(dst, src, copy_size); + dst += dst_pitch; + } + } + else + { + for (i = 0; i < src_height; ++i) + { + memcpy(dst, src, copy_size); + dst += dst_pitch; + src += src_pitch; + } + } + + *srcp += src_pitch * src_height; + *dstp += dst_pitch * dst_height; +} + static HRESULT vmr_render(struct strmbase_renderer *iface, IMediaSample *sample) { struct vmr7 *filter = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface); @@ -202,36 +238,40 @@ static HRESULT vmr_render(struct strmbase_renderer *iface, IMediaSample *sample) surface_desc.dwWidth, surface_desc.dwHeight); }
- if (height > 0 && bitmap_header->biCompression == BI_RGB) + if (bitmap_header->biCompression == mmioFOURCC('N','V','1','2')) + { + BYTE *dst = surface_desc.lpSurface; + const BYTE *src = data; + + copy_plane(&dst, surface_desc.lPitch, surface_desc.dwHeight, &src, src_pitch, height); + copy_plane(&dst, surface_desc.lPitch, surface_desc.dwHeight / 2, &src, src_pitch, height / 2); + } + else if (bitmap_header->biCompression == mmioFOURCC('Y','V','1','2')) { - BYTE *dst = (BYTE *)surface_desc.lpSurface + (height * surface_desc.lPitch); + BYTE *dst = surface_desc.lpSurface; const BYTE *src = data;
- TRACE("Inverting image.\n"); + copy_plane(&dst, surface_desc.lPitch, surface_desc.dwHeight, &src, src_pitch, height); + copy_plane(&dst, surface_desc.lPitch / 2, surface_desc.dwHeight / 2, &src, src_pitch / 2, height / 2); + copy_plane(&dst, surface_desc.lPitch / 2, surface_desc.dwHeight / 2, &src, src_pitch / 2, height / 2); + } + else if (height > 0 && bitmap_header->biCompression == BI_RGB) + { + BYTE *dst = surface_desc.lpSurface; + const BYTE *src = data;
- while (height--) - { - dst -= surface_desc.lPitch; - memcpy(dst, src, width * depth / 8); - src += src_pitch; - } + copy_plane(&dst, surface_desc.lPitch, surface_desc.dwHeight, &src, src_pitch, -height); } else if (surface_desc.lPitch != src_pitch) { BYTE *dst = surface_desc.lpSurface; const BYTE *src = data;
- height = abs(height); - TRACE("Source pitch %u does not match dest pitch %lu; copying manually.\n", src_pitch, surface_desc.lPitch);
- while (height--) - { - memcpy(dst, src, width * depth / 8); - src += src_pitch; - dst += surface_desc.lPitch; - } + height = abs(height); + copy_plane(&dst, surface_desc.lPitch, surface_desc.dwHeight, &src, src_pitch, height); } else {
From: Francisco Casas fcasas@codeweavers.com
Not doing this results in misaligned video scan lines on videos whose width is not multiple of 4. --- dlls/quartz/vmr7.c | 2 +- dlls/quartz/vmr9.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/quartz/vmr7.c b/dlls/quartz/vmr7.c index 7d29e38b14a..83f8b1d62d3 100644 --- a/dlls/quartz/vmr7.c +++ b/dlls/quartz/vmr7.c @@ -209,7 +209,7 @@ static HRESULT vmr_render(struct strmbase_renderer *iface, IMediaSample *sample) depth = bitmap_header->biBitCount; if (bitmap_header->biCompression == mmioFOURCC('N','V','1','2') || bitmap_header->biCompression == mmioFOURCC('Y','V','1','2')) - src_pitch = width; + src_pitch = (width + 3) & ~3; else /* packed YUV (UYVY or YUY2) or RGB */ src_pitch = ((width * depth / 8) + 3) & ~3;
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index ef8c78951c8..611a1256b0e 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -267,7 +267,7 @@ static HRESULT vmr_render(struct strmbase_renderer *iface, IMediaSample *sample) depth = bitmap_header->biBitCount; if (bitmap_header->biCompression == mmioFOURCC('N','V','1','2') || bitmap_header->biCompression == mmioFOURCC('Y','V','1','2')) - src_pitch = width; + src_pitch = (width + 3) & ~3; else /* packed YUV (UYVY or YUY2) or RGB */ src_pitch = ((width * depth / 8) + 3) & ~3;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=148328
Your paranoid android.
=== debian11b (64 bit WoW report) ===
Report validation errors: dxgi:dxgi has unaccounted for todo messages dxgi:dxgi has unaccounted for skip messages The report seems to have been truncated
This merge request was approved by Elizabeth Figura.