Implemented Kullback-Leibler divergence
SSE2 optimization of magnitude calculation
Added call to clone() to avoid unexpected change to external data.
- Fix both stitching_detailed.cpp sample and cv::Stitcher.
Fixed test errors, added support for C data types.
Fixed truncation warning
Changed cv::log to std::log
Merge pull request #2939 from adishavit:sample-fix_stitching_pipeline
Merge pull request #2765 from pradeep-pyro:kullback_leibler
Merge pull request #2910 from ilya-lavrenov:sse2_canny
fix incorrect barrier() usage in kernel lkSparse().

According to OpenCL spec 1.2 6.12.8 Synchronization Functions:
  All work-items in a work-group executing the
  kernel on a processor must execute this function
  before any are allowed to continue execution
  beyond the barrier. This function must be
  encountered by all work-items in a work-group
  executing the kernel.
  If barrier is inside a conditional statement, then
  all work-items must enter the conditional if any
  work-item enters the conditional statement and
  executes the barrier.
  If barrier is inside a loop, all work-items must
  execute the barrier for each iteration of the loop
  before any are allowed to continue execution
  beyond the barrier.

In function lkSparse, there are some barrie() in a loop and
in that loop there are some break conditions which break the above
spec.

This fix may not be the best fix, as I haven't dig into the algorithm.
I just keep the original logic and only make the barrier call to comply
with the spec, and it will cause a effect that even if all channels are
in skip mode, the loop will still continue to reach the last item.
Actually, OpenCL doesn't provilde an any() or all() builtin functions,
IMO, we really can't break earlier from the loop which has barrier() in it.

v2: fixed one bug pointed by Vladimir.

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>