View Full Version : Hardware accelerated video stream decoding in OpenGL
10-16-2007, 01:25 AM
Some of the modern graphics cards have hardware accelerated decoding of MPEG-2, MPEG-4 (H.264), I think nVidia calls this "PureVideo". I would like to utilize this hardware decoding instead of doing the decoding on the CPU. I believe that MS DirectShow utilizes this hardware decoders, but is possible to access this from OpenGL?
I have worked with OpenGL for many years now, but I have not seen any extension that will do this. My gut feeling is that this is not possible from OpenGL, but maybe someone knows some trick to make it work?
Thank you in advance.
10-16-2007, 04:08 AM
Look into OpenML at khronos.org
10-16-2007, 05:57 AM
Thank you V-man for your suggestion.
I've briefly looked at OpenML previously, and it looks quite interesting. But I'm not sure how alive that project is, do you have any information on if there are (commercial) users of OpenML? I really need something that is supported and can be depended on. Seems that no one has answered question on the OpenML forum for over 1 year, guess that is a sign?
10-16-2007, 06:02 AM
you can use dshow filter graphs which will use hardware acceleration to decode the frames, all you need to do is add your own render filter which will take the decoded frame and upload it to your texture. Obviously this involves a readback from the graphics card, then an upload back to the gl texture.
Just read a bit about OpenML and it seems as if it never really took off, when the spec was presented 6 years ago. Seems not to be a save choice.
10-16-2007, 07:04 PM
It is possible to use shader or to accelerate a videostream decoding. Some examples:
The motion compensation is very easy to implement. Only the previous frame have to be used as texture for rendering.
YUV -> RGB is a simple shader with a few multiplications
IDCT: It is possible to implement the butterfly to transform the DCT encoded blocks with some passes.
Things that won't run well with shaders:
* Parsing the input stream
* Huffmann decompression
* RLE decompression
10-16-2007, 07:31 PM
I'm with V-man on the OpenML. Looks top notch, and it's open source to boot.
If the sea looks calm and withdrawn it's probably an indication of an impending tsunami, and this one looks gnarly. Get on board and ride the wave, just try to keep your Gimbals about you while all are losing theirs...
Edit: I need one of those context sensitive spell checkers...
10-16-2007, 11:31 PM
Have a look at this old thread:
10-18-2007, 03:08 AM
Thank you all for feedback. I've tried to contact Khronos about OpenML, will report back if I get an answer.
I'm aware of the possibility of building a dshow filter graph, but the challenge is to write a custom renderer that can output the decoded frame. Afaik, this is not trivial. "knackered": Have you done this? I probably can live with a read-back from the graphics memory, as this is quite fast on modern graphics card.
I've put a lot of thought into writing my own GPU-based encoder/decoder, as "oc2k1" suggests. Thank you for sorting out what is possible or not. The ting that worries me is; how much job is it to write a GPU-based encoder and will I (and my team) be able to produce a encoder that can be comparable with modern encoders? I've not seen any papers or articles describing GPU-based video compression. We are passing the video on the network, so I really would like to keep the video steam size low.
Thank you for the thread-link sqrt[1-], but I think that it describes software decoding, right? Sadly the code source mentioned in the thread is no longer available, so I cannot be sure.
10-18-2007, 04:41 AM
I think most of the examples were ways of hooking up DirectShow into OpenGL.
10-18-2007, 05:27 AM
Just looked at my old dshow filter graph code....heck you're right, it is not trivial - but I managed to do it. If I can do it, any old fool can do it.
10-18-2007, 06:38 AM
Doing YUV to RGB conversion in shaders or displaying directshow buffers with OpenGL is all nice, but the heavy work is in decoding. I wonder how one can utilize things like the dulcet sounding "PureVideo HD" to do H264 decoding on the GPU.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.