Hello, I have some code that encodes PCM data into a vorbis stream, using the workflow shown in http://www.xiph.org/vorbis/doc/libvorbis/overview.html. By analyzing that process with valgrind/cachegrind I found out that 95% of the time used for encoding is spent in the function "vorbis_analysis(&vb, 0)". My question now is: would it be technically possible to parallelize this? I think about using multiple worker threads for the vorbis_analysis calls, especiall on multi core systems this would be a big benefit. => Are the blocks passed as "vb" independent from each other, so that I can encode them in parallel? regards, Thomas -- ______________________________________________________________________ Thomas Eschenbacher <Thomas.Eschenbacher at gmx.de>
> By analyzing that process with valgrind/cachegrind I found out that 95% > of the time used for encoding is spent in the function > "vorbis_analysis(&vb, 0)".Yes, it's the top-level wrapper for most processing.> My question now is: would it be technically possible to parallelize this?You can parallelize some, but a call to vorbis_analysis() requires state from a previous call to vorbis_analysis. There is some interframe analysis happening.> I think about using multiple worker threads for the vorbis_analysis calls, > especiall on multi core systems this would be a big benefit. > > => Are the blocks passed as "vb" independent from each other, > ? so that I can encode them in parallel?The 'vb' wraps internal dsp state that is not independent from block to block. Monty