1

I have a raw h264 stream, and would like to decode it using directx11.

I'm following these docs, and am the section to actually start decoding frames. (ie Calling BeginDecodeFrame())

I'm also following some advice from this question:

Which references an older verson of the same docs I linked previously. Anyway, it's saying that I need to fill some buffers:

D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS
D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX
D3D11_VIDEO_DECODER_BUFFER_BITSTREAM
D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL

I'm relatively familiar with h264, and understand I can get this information from parsing the NALU's. That being said, I don't want to manually parse the h264 packets themselves, It seems like there should be some kind of convenience method to do this for me.. So is there??

Coming from the Mac world, I can just call: CMVideoFormatDescriptionCreateFromH264ParameterSets with the PPS and SPS data and that'll handle it for me.

A follow up on that, how exactly do I "Fill These Buffers" ?

HRESULT GetDecoderBuffer(
  [in]  ID3D11VideoDecoder              *pDecoder,
  [in]  D3D11_VIDEO_DECODER_BUFFER_TYPE Type,
  [out] UINT                            *pBufferSize,
  [out] void                            **ppBuffer
);

The function signature expects an out param of (void**), so if I wanted to fill D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS, how do exactly to do I fill it with the parsed data? Do I need to assign a pointer to DXVA_PictureParameters and then cast it as a void** like: (void**)&myPictureParamets when I call the function?

The linked docs state:

Direct3D 11 uses the same data structures as DXVA 2.0 for decoding operations.

So I'm kind of guessing on DXVA_PictureParameters being the correct struct to use here.

I was expecting this to be easier than it has been! :P

luckybroma
  • 51
  • 3

0 Answers0