Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

medianBlur slowness with grayscale images #7199

Open
sbaush opened this issue Aug 30, 2016 · 11 comments
Open

medianBlur slowness with grayscale images #7199

sbaush opened this issue Aug 30, 2016 · 11 comments

Comments

@sbaush
Copy link

sbaush commented Aug 30, 2016

System information (version)
  • OpenCV => 3.1
  • Operating System / Platform => Windows 64 Bit
  • Compiler => Visual Studio 2015
Detailed description

src image: 2000x2000 bmp color image
median blur with ksize = 5
time elapsed ~70ms

src image: 2000x2000 bmp grayscale image
median blur with ksize = 5
time elapsed ~3700ms

Steps to reproduce
    // C++ code example
        Mat src = imread(imageFileName);
        Mat out;
        medianBlur(src, out, 5); //70ms

        Mat src2 = imread(imageFileName, IMREAD_GRAYSCALE);
        medianBlur(src2, out, 5); //3700ms

        Mat src3 = imread(imageFileName, IMREAD_GRAYSCALE);
        cvtColor(src3, src3, CV_GRAY2BGR);
        medianBlur(src3, out, 5); //70ms
        cvtColor(out, out, CV_BGR2GRAY); //total process ~100ms 
@mshabunin
Copy link
Contributor

Actually I get ~200x faster processing in second case (with this sample):

  • for small image:
584 x 388 (0, 3): 198.722 ms
584 x 388 (0, 1): 0.499693 ms
584 x 388 (0, 3): 122.65 ms
  • for big image:
5442 x 3061 (0, 3): 6154.63 ms
5442 x 3061 (0, 1): 30.1436 ms
5442 x 3061 (0, 3): 6279.92 ms

Windows 10 - 64 bit, VS2015 - 64 bit, latest OpenCV version.

Please try to reproduce the issue with latest version. Add more information about your OpenCV compilation environment (getBuildInformation function).

@sbaush
Copy link
Author

sbaush commented Sep 5, 2016

Thank you for your reply @mshabunin
I already tested with the latest windows version (windows version downloaded from http://opencv.org/downloads.html). I have Windows 7 64 bit and Windows 10 64bit and the issue is the same in both systems.
Are you using a custom build?
Thanks for the help,
Marco.

@mshabunin
Copy link
Contributor

@sbaush , yes, I'm using custom build. When I wrote "latest version" I meant latest commit from GitHub. Can you check it?
Please post more details about your system configuration (from cv::getBuildInformation). How do you measure execution time?

I tried to reproduce with 3.1 - similar results:

3000 x 3000 (0, 3): 141.325 ms
3000 x 3000 (0, 1): 17.7715 ms
3000 x 3000 (0, 3): 112.548 ms

General configuration for OpenCV 3.1.0 =====================================
  Version control:               3.1.0

  Platform:
    Host:                        Windows 6.1 AMD64
    CMake:                       3.3.1
    CMake generator:             Visual Studio 14 2015 Win64
    CMake build tool:            C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
    MSVC:                        1900

And latest commit (release version, I used debug in previous post):

3000 x 3000 (0, 3): 149.903 ms
3000 x 3000 (0, 1): 19.8531 ms
3000 x 3000 (0, 3): 122.774 ms

General configuration for OpenCV 3.1.0-dev =====================================
  Version control:               3.1.0-1256-gc62931f

  Platform:
    Timestamp:                   2016-09-05T10:49:53Z
    Host:                        Windows 10.0.10586 AMD64
    CMake:                       3.6.1
    CMake generator:             NMake Makefiles
    CMake build tool:            nmake
    MSVC:                        1900
    Configuration:               Release

One more thought: try to disable OpenCL by setting environment variable OPENCV_OPENCL_DEVICE=disabled.

@sbaush
Copy link
Author

sbaush commented Sep 5, 2016

@mshabunin I measure time using getTickCount

I have another question: how is it possible that your third time is faster than the first?

Here you can check my output:


2000 x 2000 (0, 3): 55.069948 ms
2000 x 2000 (0, 1): 3622.418069 ms
2000 x 2000 (0, 3): 60.850399 ms

General configuration for OpenCV 3.1.0 =====================================
  Version control:               3.1.0

  Platform:
    Host:                        Windows 6.1 AMD64
    CMake:                       3.3.1
    CMake generator:             Visual Studio 14 2015 Win64
    CMake build tool:            C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
    MSVC:                        1900

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe  (ver 19.0.23506.0)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP8  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP8  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP8  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP8  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    Linker flags (Release):      /machine:x64  /INCREMENTAL:NO  /debug
    Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL 
    Precompiled headers:         YES
    Extra dependencies:
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres features2d calib3d stitching videostab world
    Disabled:                    -
    Disabled by dependency:      -
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 ts viz

  Windows RT support:            NO

  GUI: 
    QT:                          NO
    Win32 UI:                    YES
    OpenGL support:              NO
    VTK support:                 NO

  Media I/O: 
    ZLib:                        build (ver 1.2.8)
    JPEG:                        build (ver 90)
    WEBP:                        build (ver 0.3.1)
    PNG:                         build (ver 1.6.19)
    TIFF:                        build (ver 42 - 4.0.2)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)
    GDAL:                        NO

  Video I/O:
    Video for Windows:           YES
    DC1394 1.x:                  NO
    DC1394 2.x:                  NO
    FFMPEG:                      YES (prebuilt binaries)
      codec:                     YES (ver 56.41.100)
      format:                    YES (ver 56.36.101)
      util:                      YES (ver 54.27.100)
      swscale:                   YES (ver 3.1.101)
      resample:                  NO
      gentoo-style:              YES
    GStreamer:                   NO
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    OpenNI2:                     NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    DirectShow:                  YES
    Media Foundation:            NO
    XIMEA:                       NO
    Intel PerC:                  NO

  Parallel framework:            Concurrency

  Other third-party libraries:
    Use IPP:                     9.0.1 [9.0.1]
         at:                     C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/opencv/3rdparty/ippicv/unpack/ippicv_win
    Use IPP Async:               NO
    Use Eigen:                   NO
    Use Cuda:                    NO
    Use OpenCL:                  YES
    Use custom HAL:              NO

  OpenCL:
    Version:                     dynamic
    Include path:                C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/opencv/3rdparty/include/opencl/1.2 C:/Program Files (x86)/AMD/clAmdFft/include C:/Program Files (x86)/AMD/clAmdBlas/include
    Use AMDFFT:                  YES
    Use AMDBLAS:                 YES

  Python 2:
    Interpreter:                 c:/python27_x64/python.exe (ver 2.7.5)

  Python 3:
    Interpreter:                 NO

  Python (for build):            c:/python27_x64/python.exe

  Java:
    ant:                         C:/Program Files (x86)/apache-ant/bin/ant.bat (ver 1.9.2)
    JNI:                         C:/Program Files/Java/jdk1.6.0_45/include C:/Program Files/Java/jdk1.6.0_45/include/win32 C:/Program Files/Java/jdk1.6.0_45/include
    Java wrappers:               NO
    Java tests:                  NO

  Matlab:                        Matlab not found or implicitly disabled

  Tests and samples:
    Tests:                       NO
    Performance tests:           NO
    C/C++ Examples:              NO

  Install path:                  C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/build/install

  cvconfig.h is in:              C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/build/opencv_build
-----------------------------------------------------------------


The output with OPENCV_OPENCL_DEVICE=disabled is (in my opinion it is the same as before):


2000 x 2000 (0, 3): 56.207703 ms
2000 x 2000 (0, 1): 3632.429551 ms
2000 x 2000 (0, 3): 64.470804 ms

General configuration for OpenCV 3.1.0 =====================================
  Version control:               3.1.0

  Platform:
    Host:                        Windows 6.1 AMD64
    CMake:                       3.3.1
    CMake generator:             Visual Studio 14 2015 Win64
    CMake build tool:            C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
    MSVC:                        1900

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe  (ver 19.0.23506.0)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP8  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP8  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP8  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP8  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    Linker flags (Release):      /machine:x64  /INCREMENTAL:NO  /debug
    Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL 
    Precompiled headers:         YES
    Extra dependencies:
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres features2d calib3d stitching videostab world
    Disabled:                    -
    Disabled by dependency:      -
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 ts viz

  Windows RT support:            NO

  GUI: 
    QT:                          NO
    Win32 UI:                    YES
    OpenGL support:              NO
    VTK support:                 NO

  Media I/O: 
    ZLib:                        build (ver 1.2.8)
    JPEG:                        build (ver 90)
    WEBP:                        build (ver 0.3.1)
    PNG:                         build (ver 1.6.19)
    TIFF:                        build (ver 42 - 4.0.2)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)
    GDAL:                        NO

  Video I/O:
    Video for Windows:           YES
    DC1394 1.x:                  NO
    DC1394 2.x:                  NO
    FFMPEG:                      YES (prebuilt binaries)
      codec:                     YES (ver 56.41.100)
      format:                    YES (ver 56.36.101)
      util:                      YES (ver 54.27.100)
      swscale:                   YES (ver 3.1.101)
      resample:                  NO
      gentoo-style:              YES
    GStreamer:                   NO
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    OpenNI2:                     NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    DirectShow:                  YES
    Media Foundation:            NO
    XIMEA:                       NO
    Intel PerC:                  NO

  Parallel framework:            Concurrency

  Other third-party libraries:
    Use IPP:                     9.0.1 [9.0.1]
         at:                     C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/opencv/3rdparty/ippicv/unpack/ippicv_win
    Use IPP Async:               NO
    Use Eigen:                   NO
    Use Cuda:                    NO
    Use OpenCL:                  YES
    Use custom HAL:              NO

  OpenCL:
    Version:                     dynamic
    Include path:                C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/opencv/3rdparty/include/opencl/1.2 C:/Program Files (x86)/AMD/clAmdFft/include C:/Program Files (x86)/AMD/clAmdBlas/include
    Use AMDFFT:                  YES
    Use AMDBLAS:                 YES

  Python 2:
    Interpreter:                 c:/python27_x64/python.exe (ver 2.7.5)

  Python 3:
    Interpreter:                 NO

  Python (for build):            c:/python27_x64/python.exe

  Java:
    ant:                         C:/Program Files (x86)/apache-ant/bin/ant.bat (ver 1.9.2)
    JNI:                         C:/Program Files/Java/jdk1.6.0_45/include C:/Program Files/Java/jdk1.6.0_45/include/win32 C:/Program Files/Java/jdk1.6.0_45/include
    Java wrappers:               NO
    Java tests:                  NO

  Matlab:                        Matlab not found or implicitly disabled

  Tests and samples:
    Tests:                       NO
    Performance tests:           NO
    C/C++ Examples:              NO

  Install path:                  C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/build/install

  cvconfig.h is in:              C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/build/opencv_build
-----------------------------------------------------------------

Obviously I tested also with other images, and the behavior is always the same.
Thanks again.

@mshabunin
Copy link
Contributor

how is it possible that your third time is faster than the first?

That's because first result was measured in Debug build.

This is strange, please provide information about your hardware (CPU, RAM). Try to run with disabled IPPICV: it can be turned off by setting environment variable: OPENCV_IPP=disabled.

@sbaush
Copy link
Author

sbaush commented Sep 5, 2016

With the environment variable: OPENCV_IPP=disabled it works as expected.
Here you can see my PC configuration: Dropbok link - PC Configuration
@mshabunin what do you think about these results? Do you suggest me to keep IPP disabled?

Here you can find the output of this test:

2000 x 2000 (0, 3): 64.325597 ms
2000 x 2000 (0, 1): 21.751924 ms
2000 x 2000 (0, 3): 68.000174 ms

General configuration for OpenCV 3.1.0 =====================================
  Version control:               3.1.0

  Platform:
    Host:                        Windows 6.1 AMD64
    CMake:                       3.3.1
    CMake generator:             Visual Studio 14 2015 Win64
    CMake build tool:            C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
    MSVC:                        1900

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe  (ver 19.0.23506.0)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP8  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP8  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP8  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP8  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    Linker flags (Release):      /machine:x64  /INCREMENTAL:NO  /debug
    Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL 
    Precompiled headers:         YES
    Extra dependencies:
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres features2d calib3d stitching videostab world
    Disabled:                    -
    Disabled by dependency:      -
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 ts viz

  Windows RT support:            NO

  GUI: 
    QT:                          NO
    Win32 UI:                    YES
    OpenGL support:              NO
    VTK support:                 NO

  Media I/O: 
    ZLib:                        build (ver 1.2.8)
    JPEG:                        build (ver 90)
    WEBP:                        build (ver 0.3.1)
    PNG:                         build (ver 1.6.19)
    TIFF:                        build (ver 42 - 4.0.2)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)
    GDAL:                        NO

  Video I/O:
    Video for Windows:           YES
    DC1394 1.x:                  NO
    DC1394 2.x:                  NO
    FFMPEG:                      YES (prebuilt binaries)
      codec:                     YES (ver 56.41.100)
      format:                    YES (ver 56.36.101)
      util:                      YES (ver 54.27.100)
      swscale:                   YES (ver 3.1.101)
      resample:                  NO
      gentoo-style:              YES
    GStreamer:                   NO
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    OpenNI2:                     NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    DirectShow:                  YES
    Media Foundation:            NO
    XIMEA:                       NO
    Intel PerC:                  NO

  Parallel framework:            Concurrency

  Other third-party libraries:
    Use IPP:                     9.0.1 [9.0.1]
         at:                     C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/opencv/3rdparty/ippicv/unpack/ippicv_win
    Use IPP Async:               NO
    Use Eigen:                   NO
    Use Cuda:                    NO
    Use OpenCL:                  YES
    Use custom HAL:              NO

  OpenCL:
    Version:                     dynamic
    Include path:                C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/opencv/3rdparty/include/opencl/1.2 C:/Program Files (x86)/AMD/clAmdFft/include C:/Program Files (x86)/AMD/clAmdBlas/include
    Use AMDFFT:                  YES
    Use AMDBLAS:                 YES

  Python 2:
    Interpreter:                 c:/python27_x64/python.exe (ver 2.7.5)

  Python 3:
    Interpreter:                 NO

  Python (for build):            c:/python27_x64/python.exe

  Java:
    ant:                         C:/Program Files (x86)/apache-ant/bin/ant.bat (ver 1.9.2)
    JNI:                         C:/Program Files/Java/jdk1.6.0_45/include C:/Program Files/Java/jdk1.6.0_45/include/win32 C:/Program Files/Java/jdk1.6.0_45/include
    Java wrappers:               NO
    Java tests:                  NO

  Matlab:                        Matlab not found or implicitly disabled

  Tests and samples:
    Tests:                       NO
    Performance tests:           NO
    C/C++ Examples:              NO

  Install path:                  C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/build/install

  cvconfig.h is in:              C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/build/opencv_build
-----------------------------------------------------------------

@mshabunin
Copy link
Contributor

@sbaush , yes probably you should turn IPP off.

I'd recommend you to build OpenCV and run performance test with IPP turned off and on and compare results to investigate the issue. There can be a problem with system configuration, conflict with some components etc..

I checked master version on OSX on Xeon E5426 with IPP enabled and it works well:

2592 x 1944 (0, 3): 110.769 ms
2592 x 1944 (0, 1): 19.1469 ms
2592 x 1944 (0, 3): 158.311 ms

cc @lupustr3

@sbaush
Copy link
Author

sbaush commented Sep 7, 2016

@mshabunin I tested the executable with the median test in another 2 PC.
In one PC the slowness is comparable to the test in my PC.
In the other one the test is similar to the your.
I hope that these results will be helpful for you.
In all the PCs OpenCV is installed from windows exe downloader from opencv download page.

PC with bug

2000 x 2000 (0, 3): 59.640531 ms
2000 x 2000 (0, 1): 4009.094953 ms
2000 x 2000 (0, 3): 66.665669 ms

General configuration for OpenCV 3.1.0 =====================================
  Version control:               3.1.0

  Platform:
    Host:                        Windows 6.1 AMD64
    CMake:                       3.3.1
    CMake generator:             Visual Studio 14 2015 Win64
    CMake build tool:            C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
    MSVC:                        1900

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe  (ver 19.0.23506.0)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP8  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP8  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP8  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP8  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    Linker flags (Release):      /machine:x64  /INCREMENTAL:NO  /debug
    Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL 
    Precompiled headers:         YES
    Extra dependencies:
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres features2d calib3d stitching videostab world
    Disabled:                    -
    Disabled by dependency:      -
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 ts viz

  Windows RT support:            NO

  GUI: 
    QT:                          NO
    Win32 UI:                    YES
    OpenGL support:              NO
    VTK support:                 NO

  Media I/O: 
    ZLib:                        build (ver 1.2.8)
    JPEG:                        build (ver 90)
    WEBP:                        build (ver 0.3.1)
    PNG:                         build (ver 1.6.19)
    TIFF:                        build (ver 42 - 4.0.2)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)
    GDAL:                        NO

  Video I/O:
    Video for Windows:           YES
    DC1394 1.x:                  NO
    DC1394 2.x:                  NO
    FFMPEG:                      YES (prebuilt binaries)
      codec:                     YES (ver 56.41.100)
      format:                    YES (ver 56.36.101)
      util:                      YES (ver 54.27.100)
      swscale:                   YES (ver 3.1.101)
      resample:                  NO
      gentoo-style:              YES
    GStreamer:                   NO
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    OpenNI2:                     NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    DirectShow:                  YES
    Media Foundation:            NO
    XIMEA:                       NO
    Intel PerC:                  NO

  Parallel framework:            Concurrency

  Other third-party libraries:
    Use IPP:                     9.0.1 [9.0.1]
         at:                     C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/opencv/3rdparty/ippicv/unpack/ippicv_win
    Use IPP Async:               NO
    Use Eigen:                   NO
    Use Cuda:                    NO
    Use OpenCL:                  YES
    Use custom HAL:              NO

  OpenCL:
    Version:                     dynamic
    Include path:                C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/opencv/3rdparty/include/opencl/1.2 C:/Program Files (x86)/AMD/clAmdFft/include C:/Program Files (x86)/AMD/clAmdBlas/include
    Use AMDFFT:                  YES
    Use AMDBLAS:                 YES

  Python 2:
    Interpreter:                 c:/python27_x64/python.exe (ver 2.7.5)

  Python 3:
    Interpreter:                 NO

  Python (for build):            c:/python27_x64/python.exe

  Java:
    ant:                         C:/Program Files (x86)/apache-ant/bin/ant.bat (ver 1.9.2)
    JNI:                         C:/Program Files/Java/jdk1.6.0_45/include C:/Program Files/Java/jdk1.6.0_45/include/win32 C:/Program Files/Java/jdk1.6.0_45/include
    Java wrappers:               NO
    Java tests:                  NO

  Matlab:                        Matlab not found or implicitly disabled

  Tests and samples:
    Tests:                       NO
    Performance tests:           NO
    C/C++ Examples:              NO

  Install path:                  C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/build/install

  cvconfig.h is in:              C:/buildslave64/win64_amdocl/master_PackSlave-win64-vc14-shared/build/opencv_build
-----------------------------------------------------------------

PC without bug

2000 x 2000 (0, 3): 38.046535 ms
2000 x 2000 (0, 1): 6.526405 ms
2000 x 2000 (0, 3): 45.021975 ms

General configuration for OpenCV 3.1.0 =====================================
  Version control:               3.1.0

  Platform:
    Host:                        Windows 6.1 AMD64
    CMake:                       3.3.1
    CMake generator:             Visual Studio 12 2013 Win64
    CMake build tool:            C:/Program Files (x86)/MSBuild/12.0/bin/MSBuild.exe
    MSVC:                        1800

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe  (ver 18.0.21005.1)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP4  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP4  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP4  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi    /MP4  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    Linker flags (Release):      /machine:x64  /INCREMENTAL:NO  /debug
    Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL 
    Precompiled headers:         YES
    Extra dependencies:
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres features2d calib3d stitching videostab world
    Disabled:                    -
    Disabled by dependency:      -
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 ts viz

  Windows RT support:            NO

  GUI: 
    QT:                          NO
    Win32 UI:                    YES
    OpenGL support:              NO
    VTK support:                 NO

  Media I/O: 
    ZLib:                        build (ver 1.2.8)
    JPEG:                        build (ver 90)
    WEBP:                        build (ver 0.3.1)
    PNG:                         build (ver 1.6.19)
    TIFF:                        build (ver 42 - 4.0.2)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)
    GDAL:                        NO

  Video I/O:
    Video for Windows:           YES
    DC1394 1.x:                  NO
    DC1394 2.x:                  NO
    FFMPEG:                      YES (prebuilt binaries)
      codec:                     YES (ver 56.41.100)
      format:                    YES (ver 56.36.101)
      util:                      YES (ver 54.27.100)
      swscale:                   YES (ver 3.1.101)
      resample:                  NO
      gentoo-style:              YES
    GStreamer:                   NO
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    OpenNI2:                     NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    DirectShow:                  YES
    Media Foundation:            NO
    XIMEA:                       NO
    Intel PerC:                  NO

  Parallel framework:            Concurrency

  Other third-party libraries:
    Use IPP:                     9.0.1 [9.0.1]
         at:                     C:/builds/master_PackSlave-win64-vc12-shared/opencv/3rdparty/ippicv/unpack/ippicv_win
    Use IPP Async:               NO
    Use Eigen:                   NO
    Use Cuda:                    NO
    Use OpenCL:                  YES
    Use custom HAL:              NO

  OpenCL:
    Version:                     dynamic
    Include path:                C:/builds/master_PackSlave-win64-vc12-shared/opencv/3rdparty/include/opencl/1.2 C:/Program Files (x86)/AMD/clAmdFft/include C:/Program Files (x86)/AMD/clAmdBlas/include
    Use AMDFFT:                  YES
    Use AMDBLAS:                 YES

  Python 2:
    Interpreter:                 c:/python27-x64/python.exe (ver 2.7.5)

  Python 3:
    Interpreter:                 NO

  Python (for build):            c:/python27-x64/python.exe

  Java:
    ant:                         C:/Program Files (x86)/apache-ant/bin/ant.bat (ver 1.9.2)
    JNI:                         C:/Program Files/Java/jdk1.6.0_45/include C:/Program Files/Java/jdk1.6.0_45/include/win32 C:/Program Files/Java/jdk1.6.0_45/include
    Java wrappers:               NO
    Java tests:                  NO

  Matlab:                        Matlab not found or implicitly disabled

  Tests and samples:
    Tests:                       NO
    Performance tests:           NO
    C/C++ Examples:              NO

  Install path:                  C:/builds/master_PackSlave-win64-vc12-shared/build/install

  cvconfig.h is in:              C:/builds/master_PackSlave-win64-vc12-shared/build/opencv_build
-----------------------------------------------------------------

@mshabunin
Copy link
Contributor

@sbaush , thank you for investigation. What CPUs are installed in these machines?

@sbaush
Copy link
Author

sbaush commented Sep 8, 2016

@mshabunin here you can find all the info about the 3 PC that I tested.

PC with slow median blur
PC with fast median blur
My PC, with slow median blur

@lupustr3
Copy link
Contributor

@sbaush Thank you for your investigation! From the fist look it seems like IPP-ICV package flaw. I will escalate this with IPP team and we will try to find appropriate solution for such problems.

I cannot check this right now, but here are my thoughts:
Slow PC doesn't have AVX. Looks like IPP function doesn't have SSE4.2 optimizations and uses C code inside, which is pretty slow. You can try to download full IPP package here https://registrationcenter.intel.com/en/forms/?productid=2558&licensetype=2 and check performance with it (set IPPROOT in cmake to the package folder with include and libs directories). I suspect that full IPP package will contain optimized code which IPP-ICV package lacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants