Applied fix suggested in bug 3282 and shortened code
Copied errorCovPre to errorCovPost. This allows the correct behaviour of the uncertainty to grow when there is missing data for each predict step.
1. Let btvRegWeights to be constant per `process` call.
2. Let Farneback to be the default optical flow method.
3. Fix a timing method bug for ocl path.
4. Remove useless finish operation in farneback
5. Refactor buffer usage.
Added few opencl optimizations (as Intel platform codepath):

1. HaarDetetctor: repack nodes to reduce memory footprint
2. cornerMinEigVal: 4 ocl kernels are fused into 1 for sobel calculation
try to fix build error
try to made compatible with mac
ocl: show diff
Update imgproc_canny.cl

Reordering condition checking.
fix CUDA 5.5 support (npp, arm cross compilation) in CMake scripts:

The patch was submitted to CMake and might be available
in the next CMake release.

But until we have the fix in CMake we should add workaround in our scripts.
fix the bug of ocl::bruteForceMatcher
Merge pull request #1683 from alalek:ocl_restore_showdiff
enabled ocl::bilateralFilter ROI testing
Removed a stray comma in the Android toolchain file.

It was actually acting as an additional argument, breaking the error message.
Replaced our usage of LINK_PRIVATE with that of LINK_INTERFACE_LIBRARIES.

The reasons for that are twofold:

1) LINK_PRIVATE is only available since CMake 2.8.7.
2) The way it was used generated a warning because of CMake policy CMP0023:

   http://www.cmake.org/cmake/help/v2.8.12/cmake.html#policy:CMP0023

Using LINK_INTERFACE_LIBRARIES actually causes another warning - this time
because of CMake policy CMP0022:

   http://www.cmake.org/cmake/help/v2.8.12/cmake.html#policy:CMP0022

I set the policy to OLD, because NEW means subtle changes when compiling
with CMake 2.8.12, and I don't want to research that this close to release.
:-)

I also removed the setting of CMP0003, because it's set by
cmake_minimal_version anyway.
Added the missing setting of HAVE_FFMPEG to true on Windows.

While the FFmpeg video IO backend gets compiled even without it,
the tests (for both FFmpeg and video IO) don't. This should fix
that.
Decoupled test_ffmpeg.cpp from ffmpeg_codecs.hpp.

(cherry picked from commit 3f3ae33327270de87768a80a339b746441db6fec)
Changed MPEG-2 resolution in the FFmpeg test.

Newer FFmpeg prohibits 4096x4096 MPEG-2, presumably because it violates
the standard.

http://git.videolan.org/gitweb.cgi/ffmpeg.git/?p=ffmpeg.git;a=commit;h=7fb87bc5f24b1be13269109506c05e4c54695b5e

(cherry picked from commit 424a7b0ab0cf7da591f7f15fbd15b2fee8c84a41)

Conflicts:
	modules/highgui/test/test_ffmpeg.cpp
Added stupid hacks to make the video tests pass with FFmpeg 2.0.2.

Need to go back at some point and fix this for real.

(cherry picked from commit dfe07df87ba82216a6ed1b6677f4f525c851ec03)
Fixed indentation in CV_FFmpegWriteBigVideoTest::run.
Rewrite distanceToCenters.
It supports NORM_L1 distance types now and can
use user provided indices.
Also fixed a bug of kmeans where distance pointers should be float instead
 of double.

NORM_L2 changed to NORM_L2SQR, Accuracy and Perf tests are added

added ROI support in accuracy test of distanceToCenters