Question

I have to convert several full PAL videos (720x576@25) from YUV 4:2:2 to RGB, in real time, and probably a custom resize for each. I have thought of using the GPU, as I have seen some example that does just this (except that it's 4:4:4 so the bpp is the same in source and destiny)-- http://www.fourcc.org/source/YUV420P-OpenGL-GLSLang.c

However, I don't have any experience with using GPU's and I'm not sure of what can be done. The example, as I understand it, just converts the video frame to YUV and displays it in the screen.

Is it possible to get the processed frame instead? Would it be worth the effort to send it to the GPU, get it transformed, and sending it again to main memory, or would it kill performance?

Being a bit platform-specific, assuming I work on windows, is it possible to get an OpenGL or DirectDraw surface from a window so the GPU can draw directly to it?

Was it helpful?

Solution

The real question is, what do you hope to get out of this?

At the frame rate you are receiving video, you could use something like Intel Performance Primitives to do the couple of operations that you need and easily keep up with the stream.

If you want to learn how to do gpu programming, this is a nice easy problem that you could implement.

It is possible to get the processed frame by doing a readback from the gpu to memory. The actual mechanic will vary depending on what api you use (OpenGL, DirectX, CUDA, OpenCL). I've done it with much greater resolution video and still kept up with a 25fps stream. However, this all depends on the hardware that you will be using.

DirectX and OpenGL both have great tutorials on using windows surfaces as render targets.

OTHER TIPS

I have actually programmed this for CUDA in C, and a pthreads one in C. (just for fun, though, mind you.) And I found that the GPU works so fast that you spend 50-80% of your time sending data back and forth, even if you completely fill up the memory of the GPU every time. Due to this, the CPU did this work pretty much just as fast as the GPU could. This problem is extremely thread friendly as you may have figured out, so with modern hardware, memory bandwidth is the greatest issue.

I tested this with Core i7 as CPU, and GeForce 8800GT/GTX 285 as graphics card. The GTX285 processed afaik 1500fps of 1920x1080 video, so no matter what you choose, things will be blazingly fast.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top