GPUOpen-LibrariesAndSDKs / AMF

The Advanced Media Framework (AMF) SDK provides developers with optimal access to AMD devices for multimedia processing
Other
583 stars 149 forks source link

[Question]: What are the maximum specifications for the MJPEG decoder? #477

Open nuket opened 1 month ago

nuket commented 1 month ago

Question

What are the maximum specifications for the UVD MJPEG hardware decode engine, i.e. maximum frame width x height and maximum bytes per frame?

Observation

Passing compressed frames larger than ~3.7 MiB in size causes the following error traces:

2024 - 05 - 04 21 : 53 : 52.426    17B84[AMFDecodeEngineImplDX11]   Error : ..\..\..\..\private\impl\components\DecoderUVD\DecodeEngines\DirectX\DirectX11\DecodeEngineDX11.cpp(1262) :Assertion failed : LoadCompressedBufferFromMemory() GetDecoderBuffer() failed
2024 - 05 - 04 21 : 53 : 52.427    17B84[AMFDecodeEngineImplDX11]   Error : ..\..\..\..\private\impl\components\DecoderUVD\DecodeEngines\DirectX\DirectX11\DecodeEngineDX11.cpp(1012) :ERROR: LoadCompressedBufferFromMemory() failed
2024 - 05 - 04 21 : 53 : 52.427    17B84[AMFDecoderUVDImpl]   Error : ..\..\..\..\private\impl\components\DecoderUVD\DecoderUVDImpl.cpp(1172) :AMF_ERROR 1 : AMF_FAIL : DecodeFrame() - Prepare<>DecodeBuffers failed
2024 - 05 - 04 21 : 53 : 52.427    17B84[AMF MFT AMFEngine]   Error : ..\..\..\..\private\impl\mft\mft - framework\Engine.cpp(343) :AMFEngine(0)::SubmitInput() : SubmitInput() failed, AMF_RESULT(AMF_FAIL)
2024 - 05 - 04 21 : 53 : 52.427    17B84[AMFAsyncMFTBase]   Error : ..\..\..\..\private\impl\mft\mft - framework\AsyncMFTBase.cpp(1103) :AsyncMFTBase(0)::ProcessInput() : SubmitInput() failed, AMF_RESULT(AMF_FAIL)

This happens with both the native AMF SDK using calls derived from SimpleDecoder, as well as with Media Foundation components which seem to call into the same code.

In my case, the frame dimensions were ~4000 x 3000px, but this doesn't seem like it should be unreasonable for modern hardware.

Hardware

MikhailAMD commented 1 month ago

Regarding maximum resolution: it depends on HW. Please check CapabilityManager sample that shows how to use AMFCaps interface and get maximum resolution. Usually it is 7680x4320. Regarding failure with large buffers: can you share the video file?

nuket commented 1 month ago

Ok, I'll check the AMFCaps, thanks for the suggestion.

Regarding large buffers: I've attached the file, it is a single frame. 4032x3024-4MiB-test.zip

I think somewhere in the private implementation of DecodeEngineDX11.cpp it's allocating at most a 4MB buffer for the compressed data and this frame doesn't fit.

rhutsAMD commented 1 month ago

With your provided MJPEG file, I have reproduced the issue and created a corresponding internal ticket. We will notify of its status.

nuket commented 1 month ago

Thanks for the quick investigation. For a detailed 8K frame, I estimate that the compressed buffer could be around 16 - 32 MB in size.

rhutsAMD commented 2 weeks ago

The issue has been fixed internally and the fix will be available in a future public driver release. We will notify when the release is made publicly available.