rewrote and generalized ocl::threshold
Merge pull request #1708 from ilya-lavrenov:ocl_threshold