SFML community forums

General => General discussions => Topic started by: jshanab on February 03, 2011, 01:20:58 am

Title: OpenCL (not openGL)
Post by: jshanab on February 03, 2011, 01:20:58 am
I have spent this snowbound day researching using the graphics processor to help out the main CPU on decoding H264.

I also am using SFML in my browser plugin for displaying H264 video. I am currently using avcodec from ffmpeg, but it is cpu intensive.

So...Since OpenCL is sanctioned by the same body as openGL, it is cross platform and cross GPU, and apple is pushing it and it is very openGL compatible, Are there any plans to integrate OpenCL into SFML?  

ONe thing bugged me about SFML when I switched from SDL, I was forced to use RGBA because of the openGL, This blows my 2 bytes per pixel up to 4.  :-(
Title: OpenCL (not openGL)
Post by: tntexplosivesltd on February 03, 2011, 01:48:32 am
How were you forced to use RGBA? What do you mean?
Also, OpenCL looks like it could be a good feature, but wouldn't it be a lot of work for a little gain?
And since Apple is pushing it, we should all adopt it? I don't like the idea of that.
Title: OpenCL (not openGL)
Post by: Laurent on February 03, 2011, 07:33:55 am
How would OpenCL be integrated to SFML?

Quote
ONe thing bugged me about SFML when I switched from SDL, I was forced to use RGBA because of the openGL, This blows my 2 bytes per pixel up to 4.

Yep, sorry about that. But you can still handle textures directly instead of using sf::Image, if you want to get rid of this limitation.
Title: OpenCL (not openGL)
Post by: Ceylo on February 03, 2011, 12:32:28 pm
OpenCL could help you at decoding the video, but not at displaying it. Thus what could be improved through OpenCL is in the FFmpeg library source code.

Depending on your needs, you can also consider using an OS specific API to display movies. Thereby you could probably take advantage of the hardware acceleration (provided by the underlying OS API).
Title: Found a little help
Post by: jshanab on February 14, 2011, 01:05:53 am
Found on line a great little compromize that would fit in well.
A script in cg language that compiles to the machine lang of the card for both opengl and directX cards with the same compiler. THis is a "fragment pixel shader" and would let us send the 2 byte/pixel yuv to the card and let the card do the conversion to RGBA.   This looks to be eaisly available on most cards.  I don't have teh exact link on this computer, but just google it, there are lots.

most seem to be from NVIDIA developer zone.

As for the Apple comment. THat is NOT why I would choose it, I would choose it because apple worked with NVIDIA and THe standards commitee behind openGL to make a well integrated and open system.  Microsoft has there own BTW. and ATI has changed the meaning of iStream to match that of OpenCF.
Title: OpenCL (not openGL)
Post by: devlin on February 14, 2011, 08:21:12 am
Or you could use the VDPAU/DXVA stuff already present within FFMPEG in order to get hardware acceleration? (just like for instance xbmc does)

You don't have to use the software decoder.
Title: OpenCL (not openGL)
Post by: Ceylo on February 14, 2011, 08:48:48 am
Just a little post to fix what I've previously said. OpenCL actually seems to be able to work closely with OpenGL, and may be used to convert your data and send it directly to a texture.
Title: OpenCL (not openGL)
Post by: Groogy on February 14, 2011, 08:50:14 am
Quote from: "Ceylo"
Just a little post to fix what I've previously said. OpenCL actually seems to be able to work closely with OpenGL, and may be used to convert your data and send it directly to a texture.


Actually, as it seems, they've tried to make it easier to use them together in OpenGL 4.x