I'm writing a C# windows form application that provide end-to-end image processing system. The system consists of many image processing blocks (i.e, scaler, noise reduction,...), each block is a algorithm that is written in C, and I've built the each of them into DLLs and call them from my C# application.
My system is something like this:
(main) input1 -> block1 -> block2
(ig) input2 -> block3 -> block4 -> MUX -> output
(pg) input3 -> block5 -> block6
At the moment, the code I'm using is look like this:
Task.Factory.StartNew(() => Parallel.For(0, loop_num, i =>
{
Parallel.Invoke(
() =>
{
main(i);
},
() =>
{
ig(i);
},
() =>
{
pg(i);
}
);
mux(i);
}), TaskCreationOptions.LongRunning);
But I see that the application is taking very long time to complete just few images. Actually I'm not good at C# and just self study about parallel and task via some examples.
I don't know if my code is good enough on handle multiple processing, or is there a better way? So I start this thread to look for help/suggest.