Itseez/opencv — pull request #1345 by pengx17 (2013-08-27 03:50:32+00:00)
Title: Optimize ocl::tvl1flow

Sum issues a buffer read from device to host at end and is a very costy operation.
Thus we make some tweaks to make `sum` operations less frequently. It achieves 20% overall performance gain.

Details:
Based on the fact that in loops of estimate the error output will always be declining, we implement a new strategy that the sum of error will not be recalculated in every round of iteration; instead the error will be summed every 2nd times or more if the previous sum of error is too far away from threshold.