reverted to original plain C++ code
added ocl_** function
ported changes from PR #2867
optimized some operations
Merge pull request #2899 from ilya-lavrenov:tapi_ex