When present, the aperture indicates the area of the sample's buffers to display. The frame size instead includes some undesired padding. This is the case when color planes are aligned, such as with YUV output from a decoder MFT.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/evr/mixer.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c index 222fc538fec..263230d8263 100644 --- a/dlls/evr/mixer.c +++ b/dlls/evr/mixer.c @@ -45,7 +45,7 @@ struct input_stream IMFMediaType *media_type; MFVideoNormalizedRect rect; unsigned int zorder; - SIZE frame_size; + MFVideoArea aperture; IMFSample *sample; unsigned int sample_requested : 1; }; @@ -851,6 +851,7 @@ static HRESULT WINAPI video_mixer_transform_SetInputType(IMFTransform *iface, DW DXVA2_VideoDesc video_desc; HRESULT hr = E_NOTIMPL; unsigned int count; + UINT32 size; GUID *guids;
TRACE("%p, %lu, %p, %#lx.\n", iface, id, media_type, flags); @@ -884,8 +885,15 @@ static HRESULT WINAPI video_mixer_transform_SetInputType(IMFTransform *iface, DW if (mixer->inputs[0].media_type) IMFMediaType_Release(mixer->inputs[0].media_type); mixer->inputs[0].media_type = media_type; - mixer->inputs[0].frame_size.cx = video_desc.SampleWidth; - mixer->inputs[0].frame_size.cy = video_desc.SampleHeight; + + if (FAILED(IMFMediaType_GetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, + (BYTE *)&mixer->inputs[0].aperture, sizeof(mixer->inputs[0].aperture), &size))) + { + memset(&mixer->inputs[0].aperture, 0, sizeof(mixer->inputs[0].aperture)); + mixer->inputs[0].aperture.Area.cx = video_desc.SampleWidth; + mixer->inputs[0].aperture.Area.cy = video_desc.SampleHeight; + } + IMFMediaType_AddRef(mixer->inputs[0].media_type); } CoTaskMemFree(guids); @@ -1326,7 +1334,8 @@ static void video_mixer_render(struct video_mixer *mixer, IDirect3DSurface9 *rt)
/* Full input frame corrected to full destination rectangle. */
- video_mixer_scale_rect(&sample->SrcRect, stream->frame_size.cx, stream->frame_size.cy, &zoom_rect); + video_mixer_scale_rect(&sample->SrcRect, stream->aperture.Area.cx, stream->aperture.Area.cy, &zoom_rect); + OffsetRect(&sample->SrcRect, stream->aperture.OffsetX.value, stream->aperture.OffsetY.value); CopyRect(&sample->DstRect, &dst); video_mixer_correct_aspect_ratio(&sample->SrcRect, &sample->DstRect);
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=144025
Your paranoid android.
=== debian11b (64 bit WoW report) ===
d3dx10_34: d3dx10.c:4380: Test succeeded inside todo block: Got unexpected effect 00000000011A4A60. d3dx10.c:4470: Test succeeded inside todo block: Got unexpected effect 0000000001194020. d3dx10.c:4480: Test succeeded inside todo block: Got unexpected effect 00000000011941F0. d3dx10.c:4589: Test succeeded inside todo block: Got unexpected effect 00000000011959D0. d3dx10.c:4599: Test succeeded inside todo block: Got unexpected effect 00000000011B5D90.
d3dx10_35: d3dx10.c:4380: Test succeeded inside todo block: Got unexpected effect 0000000001230410. d3dx10.c:4470: Test succeeded inside todo block: Got unexpected effect 00000000011C3C20. d3dx10.c:4480: Test succeeded inside todo block: Got unexpected effect 0000000001230410. d3dx10.c:4589: Test succeeded inside todo block: Got unexpected effect 00000000011C3C20. d3dx10.c:4599: Test succeeded inside todo block: Got unexpected effect 0000000001194B40.
d3dx10_36: d3dx10.c:4380: Test succeeded inside todo block: Got unexpected effect 00000000011D3F10. d3dx10.c:4470: Test succeeded inside todo block: Got unexpected effect 00000000011BB620. d3dx10.c:4480: Test succeeded inside todo block: Got unexpected effect 00000000011BB7F0. d3dx10.c:4589: Test succeeded inside todo block: Got unexpected effect 00000000011BB7F0. d3dx10.c:4599: Test succeeded inside todo block: Got unexpected effect 00000000011D3BC0.
d3dx10_37: d3dx10.c:4380: Test succeeded inside todo block: Got unexpected effect 00000000011C18F0. d3dx10.c:4470: Test succeeded inside todo block: Got unexpected effect 00000000011A4A80. d3dx10.c:4480: Test succeeded inside todo block: Got unexpected effect 00000000011A4A80. d3dx10.c:4589: Test succeeded inside todo block: Got unexpected effect 00000000011C3690. d3dx10.c:4599: Test succeeded inside todo block: Got unexpected effect 00000000011C1820.
d3dx10_38: d3dx10.c:4380: Test succeeded inside todo block: Got unexpected effect 0000000001239DA0. d3dx10.c:4470: Test succeeded inside todo block: Got unexpected effect 0000000001195B70. d3dx10.c:4480: Test succeeded inside todo block: Got unexpected effect 00000000011929A0. d3dx10.c:4589: Test succeeded inside todo block: Got unexpected effect 0000000001195B70. d3dx10.c:4599: Test succeeded inside todo block: Got unexpected effect 00000000011E35E0.
d3dx10_39: d3dx10.c:4380: Test succeeded inside todo block: Got unexpected effect 0000000001239EC0. d3dx10.c:4470: Test succeeded inside todo block: Got unexpected effect 0000000001239EC0. d3dx10.c:4480: Test succeeded inside todo block: Got unexpected effect 00000000011D56C0. d3dx10.c:4589: Test succeeded inside todo block: Got unexpected effect 0000000001239EC0. d3dx10.c:4599: Test succeeded inside todo block: Got unexpected effect 00000000011B5A20.
d3dx10_40: d3dx10.c:4380: Test succeeded inside todo block: Got unexpected effect 0000000001239EB0. d3dx10.c:4470: Test succeeded inside todo block: Got unexpected effect 0000000001239EB0. d3dx10.c:4480: Test succeeded inside todo block: Got unexpected effect 00000000011B4EC0. d3dx10.c:4589: Test succeeded inside todo block: Got unexpected effect 00000000011B1FA0. d3dx10.c:4599: Test succeeded inside todo block: Got unexpected effect 00000000011BBB50.
d3dx10_41: d3dx10.c:4380: Test succeeded inside todo block: Got unexpected effect 0000000001195A50. d3dx10.c:4470: Test succeeded inside todo block: Got unexpected effect 00000000011A49E0. d3dx10.c:4480: Test succeeded inside todo block: Got unexpected effect 00000000011B6010. d3dx10.c:4589: Test succeeded inside todo block: Got unexpected effect 00000000011E3A60. d3dx10.c:4599: Test succeeded inside todo block: Got unexpected effect 00000000011E3C30.
d3dx10_42: d3dx10.c:4380: Test succeeded inside todo block: Got unexpected effect 00000000011BB9A0. d3dx10.c:4470: Test succeeded inside todo block: Got unexpected effect 00000000011BB9A0. d3dx10.c:4480: Test succeeded inside todo block: Got unexpected effect 00000000011A4920. d3dx10.c:4589: Test succeeded inside todo block: Got unexpected effect 00000000011E3910. d3dx10.c:4599: Test succeeded inside todo block: Got unexpected effect 00000000011BB620.
d3dx10_43: d3dx10.c:4380: Test succeeded inside todo block: Got unexpected effect 00000000011D55C0. d3dx10.c:4470: Test succeeded inside todo block: Got unexpected effect 0000000001195850. d3dx10.c:4480: Test succeeded inside todo block: Got unexpected effect 0000000001195850. d3dx10.c:4589: Test succeeded inside todo block: Got unexpected effect 00000000011D55B0. d3dx10.c:4599: Test succeeded inside todo block: Got unexpected effect 00000000011E36E0.
I realize it's not trivial for a standalone test, but have you verified this somehow on Windows? I mean visually, with this attribute and without.
I have not, this fixes however the playback in games when decoders transforms are used. The game uses MF session with the following pipeline: `source > decoder > copier > evr`. The decoder outputs NV12 with planes aligned on 16 bytes which causes some visible green band when the padding is included.
I will try to write some test, making sure this is evr responsibility but I find it likely reading from the documentation (https://learn.microsoft.com/en-us/windows/win32/medfound/how-to-write-an-evr... though this only mention the other aperture attributes).