in cpp/spectrum/core/proc/ScanlinePump.cpp [20:53]
void ScanlinePump::pumpAll() {
for (std::size_t i = 0; i < numInputScanlines; i++) {
// generate one input scanline
auto scanline = scanlineGenerator();
SPECTRUM_ENFORCE_IF_NOT(scanline);
// execute processing blocks and consumer while there's actual processing
// happening in any of the processing steps
bool change;
do {
change = false;
for (auto& block : processingBlocks) {
// consume scanline of previous block (possible from input block)
if (scanline) {
block->consume(std::move(scanline));
}
// set current scanline to output of this block
SPECTRUM_ENFORCE_IF_NOT(!scanline);
scanline = block->produce();
if (scanline) {
change = true;
}
}
// the scanlineConsumer behaves as a last block that does not produce
if (scanline) {
scanlineConsumer(std::move(scanline));
}
} while (change);
}
}