I am writing a de- and encoder for a custom video format (QTC). The decoding process consists of multiple stages, where the output of each stage is passed to the next stage:
Steps three and four take up almost all of the processing time, step three takes roughly 35% and step four takes about 60%, the first and the last step are rather trivial.
What is the recommend and ideomatic way to runs the four steps in parallel? I am mostly interested in how to handle the communication between the parts. I plan to use one Goroutine for step two and one for step three, the routines are connected with a buffered channel. Is this the right way?
For some tasks having a "shared" data structure "protected" by careful use of mutexes is easier, but a buffered channel would be the "standard" way to do this in Go and for your task it sounds like the right solution, too.
Are you running into any problems with it since you are asking here?