As I mentioned in my last blog post, I've been working on getting H.264/AVC acceleration enabled. This project was started by a post by one of the community members:
Over the last month, "casimier666" and I have been adding the acceleration code to Media Player Classic - Home Cinema. Its been quite an education for me, and I owe much thanks to him for his help throughout the process. I am happy to say that as of today, the player can now use the Intel Clear Video™ hardware to offload the processing to the hardware!
The code has been checked into sourceforge here: http://mpc-hc.svn.sourceforge.net/viewvc/mpc-hc/trunk/.
While it can play most clips we through at it - there are still a few that it can not. Video clips with multiple slices per frame still have some corruption, but we are working on it and will update the code base when its fixed.
I wanted to let you all know what the next steps are for this project. I am currently writing a whitepaper that goes over the unique aspects of the DXVA2 interface on the G45. It will contain some sample code and a bit of tutorial information on how DXVA2 works. If you have suggestions on what should be in the paper, please drop me a note.
The following is a preview of the information in the paper:
- Intel Clear Video™ for the G45 supports VLD mode acceleration for H.264/AVC content via the following GUID:
While there are additional modes of acceleration available, we are not going to focus on them. VLD mode is an end-to-end acceleration path that yields the best performance - and it’s the easiest to enable.
One of the key enabling items for the G45 is when dealing with slices in the content. The G45 chipset requires that the host send down the slice data in the DXVA_Slice_H264_Long structure, and does not support the DXVA_Slice_H264_Short version.
The DXVA_Slice_H264_Long structure is where "casimier666" and I spent the most time working to get correct. This mode of operation requires the host application to keep track of the reference pictures in the decoded picture buffer, and then send the correct references so that the hardware will decode the picture. The host controls the management of the list, with short and long term pictures being added/removed via commands in the bit stream itself. I don’t have much experience with the short structure - but I bet its easier then the long version!
Another challenge with the DXVA_Slice_H264_Long structure is the management of the offsets into the slice data. The long version requires that each slice pass the "SliceBytesInBuffer", and the "BitOffSetToSliceData". These offsets can be calculated as the bitstream gets parsed. There's a few special rules that the host must be aware of when setting the offsets. I'll go over more of those in the whitepaper.
This project has been a great example of the community members and us at Intel working together to do something great. If you would like to contribute to this effort, download the code and check it out!
I'll make sure to update everyone when the paper is done, and the code is 100%.
Thanks for Reading!