How can I get the best performance out of my CPU?

michaelpromeo's icon

Hello,
I cannot for the life of me figure out how to keep the integrity of my video/image files while simultaneously getting the best performance out of my CPU. I have attached the program I'm working on. Currently, I am strictly concerned with the video portion of the program. I am using a jit.qt.movie object to bang through images as if they were frames of a movie. I'm using 'loadram' to read the images from memory as opposed to disk, but I'm using a high resolution because I do not want grainy images. Is there a way keep resolution without killing the CPU? Thanks for all the help!

--
Mike

Michael_Romeo_AUDIO_VISUAL_PERFORMANCE.maxpat
Max Patch
michaelpromeo's icon

If anyone is having the same problem I think I found a cure. Using Jpeg files that are 720 X 480 resolution on a Macbook Pro (2.53 Ghz Intel, 4GB memory), I have achieved 8% - 11% CPU usage on my activity monitor by using jit.gl.slab. Have a look at the patch I've attached. See if you get the same results.

--
Mike

Romeo_Audio_Visual_2013_LowCPU.maxpat
Max Patch
LSka's icon
Max Patch
Copy patch and select New From Clipboard in Max.

There's something you can try to optimize your patch.
First of all, you should try using a single [qmetro] object, using [send] and [receive] to route the bangs, and [speedlim] to change speed where you need.
I also noticed you (correctly) use uyvy as colormode. The highest quality method (according to what you read here:https://cycling74.com/forums/slab-compositing-and-colormodes/) to send uyvy video to GPU is using the "cc.uyvy2rgba.jxs" shader, adding "@dest_dim 2 1" in jit.gl.slab (see below)

Also, I'm wondering if using the photo-jpeg codec for your videos in combination with the "frame" message to jit.qt.movie would be more efficient than loading a different files for every frame...you should have a try.

Or you can try using jit.gl.hap https://cycling74.com/tools/jit-gl-hap/, which seems to give better performance than jit.qt.movie, even with non-HAP videos (don't know about stability and reliability, though).

And, last but not least, have you checked the classic Vade's optimization hints?
http://abstrakt.vade.info/?p=147

michaelpromeo's icon

Wow, great tips! I successfully routed my videos to the video card GPU. I'm now down to a little over 10% CPU processing while running two quicktime videos. Thanks so much for your help!

--
Mike
www.michaelpromeo.com