Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GPU memory allocation for video

Is it possible to allocate some memory on the GPU without cuda?

i'm adding some more details... i need to get the video frame decoded from VLC and have some compositing functions on the video; I'm doing so using the new SDL rendering capabilities. All works fine until i have to send the decoded data to the sdl texture... that part of code is handled by standard malloc which is slow for video operations.

Right now i'm not even sure that using gpu video will actually help me

like image 252
koda Avatar asked Sep 04 '26 16:09

koda


2 Answers

Let's be clear: are you are trying to accomplish real time video processing? Since your latest update changed the problem considerably, I'm adding another answer.

The "slowness" you are experiencing could be due to several reasons. In order get the "real-time" effect (in the perceptual sense), you must be able to process the frame and display it withing 33ms (approximately, for a 30fps video). This means you must decode the frame, run the compositing functions (as you call) on it, and display it on the screen within this time frame.

If the compositing functions are too CPU intensive, then you might consider writing a GPU program to speed up this task. But the first thing you should do is determine where the bottleneck of your application is exactly. You could strip your application momentarily to let it decode the frames and display them on the screen (do not execute the compositing functions), just to see how it goes. If its slow, then the decoding process could be using too much CPU/RAM resources (maybe a bug on your side?).

I have used FFMPEG and SDL for a similar project once and I was very happy with the result. This tutorial shows to do a basic video player using both libraries. Basically, it opens a video file, decodes the frames and renders them on a surface for displaying.

like image 115
karlphillip Avatar answered Sep 07 '26 11:09

karlphillip


You can do this via Direct3D 11 Compute Shaders or OpenCL. These are similar in spirit to CUDA.

like image 34
Reed Copsey Avatar answered Sep 07 '26 11:09

Reed Copsey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!