I maintain an image codec that requires post processing of the image with a varying number of simple pixel operations: for example, gain, colour transform, scaling, truncating. Some ops work on single channels, while others (colour transform) work on three channels at a time.
When an image is decoded, it is stored in planar format, one buffer per channel.
I want to design an efficient framework in c++ that can apply a specified series of pixel ops. Since this is the inner loop, I need it to be efficient - pixel ops should be inlined, with minimum branching.
Simplest approach is to have a fixed array of say 20 operands, and pass this array with the actual number of ops to the post-process method. Can someone suggest a more clever way ?
Edit: This would be a block operation, for efficiency, and I do plan on using SIMD to accelerate. So, for each pixel, I want to efficiently perform a configurable sequence of pixel ops, using SIMD instructions.