AMF icon indicating copy to clipboard operation
AMF copied to clipboard

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

Open nuket opened this issue 1 year ago • 5 comments

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

  • Windows 11
  • Driver 24.4.1
  • AMD Radeon 780M

nuket avatar May 05 '24 09:05 nuket

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?

MikhailAMD avatar May 06 '24 14:05 MikhailAMD

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.

nuket avatar May 06 '24 15:05 nuket

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

rhutsAMD avatar May 07 '24 05:05 rhutsAMD

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

nuket avatar May 07 '24 07:05 nuket

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.

rhutsAMD avatar Jun 14 '24 20:06 rhutsAMD

Verified fixed with public driver version 24.12.1. Provided input is able to be decoded.

rhutsAMD avatar Dec 18 '24 21:12 rhutsAMD