Skip to content

imgproc: OCL_ImgProc/CvtColor8u.mRGBA2RGBA fails with NEON optimization #14982

@tomoaki0705

Description

@tomoaki0705
System information (version)
  • OpenCV => recent 3.4 ( 57fae4a )
  • Operating System / Platform => TinkerBoard (Armv7), Debian stretch
  • Compiler => GCC 6.3.0
Detailed description

Two tests fail in OCL_ImgProc/CvtColor8u.mRGBA2RGBA

[ RUN      ] OCL_ImgProc/CvtColor8u.mRGBA2RGBA/0, where GetParam() = (CV_8U, false)
/home/linaro/opencv-fork/modules/imgproc/test/ocl/test_color.cpp:89: Failure
Expected: (TestUtils::checkNorm2(dst_roi, udst_roi)) <= (threshold), actual: 1 vs 0.001
Size: [15 x 21]
[  FAILED  ] OCL_ImgProc/CvtColor8u.mRGBA2RGBA/0, where GetParam() = (CV_8U, false) (14 ms)
[ RUN      ] OCL_ImgProc/CvtColor8u.mRGBA2RGBA/1, where GetParam() = (CV_8U, true)
/home/linaro/opencv-fork/modules/imgproc/test/ocl/test_color.cpp:89: Failure
Expected: (TestUtils::checkNorm2(dst_roi, udst_roi)) <= (threshold), actual: 1 vs 0.001
Size: [15 x 21]
[  FAILED  ] OCL_ImgProc/CvtColor8u.mRGBA2RGBA/1, where GetParam() = (CV_8U, true) (2 ms)

Full log is available here
This seems to be a rounding error, since there is a float operation in the color conversion code.

v_float32 fd00, fd01, fd10, fd11;
fd00 = fs00/fa00;
fd01 = fs01/fa01;
fd10 = fs10/fa10;
fd11 = fs11/fa11;

If I disable the NEON feature, the test passes

[ RUN      ] OCL_ImgProc/CvtColor8u.mRGBA2RGBA/0, where GetParam() = (CV_8U, false)
[       OK ] OCL_ImgProc/CvtColor8u.mRGBA2RGBA/0 (260 ms)
[ RUN      ] OCL_ImgProc/CvtColor8u.mRGBA2RGBA/1, where GetParam() = (CV_8U, true)
[       OK ] OCL_ImgProc/CvtColor8u.mRGBA2RGBA/1 (3 ms)

I believe it's close enough to loosen the eps.

#ifdef HAVE_IPP
#define IPP_EPS depth <= CV_32S ? 1 : 1e-3
#else
#define IPP_EPS 1e-3
#endif
OCL_TEST_P(CvtColor8u, RGBA2mRGBA) { performTest(4, 4, CVTCODE(RGBA2mRGBA), IPP_EPS); }
OCL_TEST_P(CvtColor8u, mRGBA2RGBA) { performTest(4, 4, CVTCODE(mRGBA2RGBA)); }

One thing I'm not sure is how it behaves on aarch64.
At this moment, I don't have access to any of my Arm 64bit boards.
Let's just keep it for 32bit for now.

I'll send a patch later

Steps to reproduce

./opencv_test_imgproc --gtest_filter=*OCL*mRGBA2RGBA*

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions