splitting for loop into separate threads to increase CPU usage

Hello,

in particular my task is to accelerate saving an AVI file with OpenCV. Inside the for loop each pixel of the current frame is altered and then put into a new image (via cvSet2D), then saved via cvWriteFrame to the AVI. I thought that if I let one thread process every 2nd pixel and let the other thread do the same - being 1 pixel ahead - that this could possibly increase saving speed. So I would have two threads, i.e. two for-loops with +=2 increments.

The point is, so far CPU usage was around 50% (dual core) during the saving process and I tried programming two threads (with _beginthread) with IplImages inside the void functions but somehow it won't work as 1. I'm a newbie in regard to threads and 2. I don't know if it's even feasible.

Any suggestions how to accomplish that task or would it be too complicated for a newbie. Perhaps there's 'just a few lines solution' ?

Best
dude

Can you post the loop? Maybe you can use #pragma omp parallel for ?



Last edited on
I've tried OpenMP already and I got a message that told me that some test for the loop was not successful, i.e. the for loop didn't meet the requirements for that command.
Topic archived. No new replies allowed.