Optflow merge

Please do not merge yet. This brings the optical flow WIP changes to master. Compiles fine, needs first a bunch of bench testing for validation.