ComputeLibrary icon indicating copy to clipboard operation
ComputeLibrary copied to clipboard

CLColorConvert and NEColorConvert output does not match for some input-output combinations

Open rohit-unnimadhavan opened this issue 8 years ago • 12 comments

Hi,

The outputs for NEColorConvert and CLColorConvert do not match when trying to convert a YUV image to RGB space. This is observed for conversions from UYVY422/YUYV422/IYUV/NV12/NV21 to RGB888/RGBA888.

A sample code illustrating the mismatch for conversion from UYVY422 image to RGB888 is attached here. From the log, it can be seen that some bytes are 255 in NEON while the corresponding CL output is some other number. Similar mismatch happens for other combinations also.

Is this a known issue? Is there a overflow handling parameter for these classes? Kindly help to resolve this.

Thanks, Rohit

acl_colorconvert.txt colorConvert_CL_and_NEON_mismatch.txt

rohit-unnimadhavan avatar Dec 26 '17 14:12 rohit-unnimadhavan

RGB888->RGBA8888 and RGBA8888->RGB888 conversions seem to be proper on both CL and NEON.

rohit-unnimadhavan avatar Dec 26 '17 14:12 rohit-unnimadhavan

Facing the following issues also in ColorConvert kernels on NEON and CL.

  1. RGB888 => YUV444 : For some input pixels, output chroma pixels from NEON and CL mismatches.
  • For example, for R= 33, G = 81, B = 46, output pixels are Y = 68, U = 115, V = 105 on NEON but Y = 68, U = 117, V = 106 on CL. Note that there is a difference of 2 in U data.
  • Another example: R = 37, G = 126, B = 246 gives Y = 115, U = 198, V = 77 on NEON and Y = 115, U = 198, V = 79 on CL, a difference of 2 in V data.

In both above examples, CL seems to be giving the proper pixels. Could you please look into this and confirm whether there's an issue on NEON (or CL) side?

  1. RGBA8888 => YUV444 on NEON: Here also, on NEON side there is a difference of 2 in U/V data.

  2. RGBA8888 => YUV444 on CL: Here, unlike RGB888 => YUV444 CL output is not at all proper. I am attaching both CL and NEON outputs here for different resolutions. While there is a difference of +/-2 from the expected output on NEON side (No.3 above), certain pixels in CL side differs from the expected output by a large margin.

Request to look into these also and resolve the concerns.

Thanks, Rohit

Log files: colorConvert_CL_and_NEON_RGB_to_YUV4_mismatch_8x8.txt colorConvert_CL_and_NEON_RGBA_to_YUV4_issue_8x8.txt colorConvert_CL_and_NEON_RGBA_to_YUV4_issue_16x8.txt

rohit-unnimadhavan avatar Dec 27 '17 12:12 rohit-unnimadhavan

Hi Rohit,

I've run the code provided on different devices with different configurations and I was not able to reproduce the issue.

In order to help you further with this issue, can you please provide the Scons build parameters and the device (OS, Arch) you are using to test? Also, are you using the latest ACL version (17.12)? If you are running on an Android device, can you provide the NDK revision you've used?

Kind regards, Chris

ghost avatar Dec 28 '17 11:12 ghost

Hi Chris,

We are not using Scons to build the compute library. We are using a proprietary tool chain to build the compute library on an Ubuntu machine. We are using ACL version 17.10 currently. Are there any fixes for color convert kernels in 17.12? We are also not running on Android device but a Linux device. We can't share more details about the device as of now.

Please let me know if you need more information from our side.

Thanks, Rohit

rohit-unnimadhavan avatar Dec 29 '17 06:12 rohit-unnimadhavan

Hi Rohit,

Yes, there's been several bug fixes in v17.12 so it's worth of a try. If this doesn't solve your problem I'm afraid there isn't much more we can do to help if we can't reproduce the error on our side with the recommended toolchains.

AnthonyBarbier avatar Jan 03 '18 09:01 AnthonyBarbier

@rohit-unnimadhavan is this resolved in v17.12?

GeorgeARM avatar Jan 18 '18 17:01 GeorgeARM

Hi,

I was just about to get back to you regarding this. The issue persists for me.

I have now compiled the latest version of Compute Library (v17.12) using one of your recommended toolchains (gcc-linaro-4.9-2016.02-x86_64_aarch64-linux-gnu - Downloaded from https://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/aarch64-linux-gnu/) and scons utility. I am building it on an Ubuntu 14.04 64-bit machine. The device I am running this on is also a Linux device.

The scons parameters I use to build the library is as follows. scons Werror=1 -j8 debug=0 neon=1 opencl=1 os=linux arch=arm64-v8a build=cross_compile

I am building the application as follows: aarch64-linux-gnu-g++ examples/acl_colorconvert_1.cpp utils/Utils.cpp -I. -Iinclude -std=c++11 -L. -Lbuild -Lbuild/opencl-1.2-stubs -larm_compute -larm_compute_core -lOpenCL -o acl_colorConvert -DARM_COMPUTE_CL

Now, with this also I am able to see the reported issue. The code (acl_colorconvert_1.txt) and log (acl_colorConvert_log.txt) are attached here for recreating the issue at your end.

acl_colorconvert_1.txt acl_colorConvert_log.txt

Please let me know how this can be resolved.

Thanks, Rohit

rohit-unnimadhavan avatar Jan 19 '18 11:01 rohit-unnimadhavan

Hi Rohit,

I've tested your code on v17.12 on multiple 64-bit Linux platforms and I was not able to reproduce the issue. In fact, I do not see any mismatches between NEON and CL outputs.

Also, it's not clear to me how you can test cases 2), 3) and 4) given that both NEON and CL ColorConvert kernels do not support those conversions. How do you run those?

Another question would be, what version of the OpenCL library are you using?

mdigiorgio avatar Feb 15 '18 11:02 mdigiorgio

Hi @mdigiorgio Thank you for the response. According to the available documentation, void configure(const IImage * input, IMultiImage * output) function in NEColorConvert supports RGB888/RGBA8888 => YUV444 on neon (cases 2 and 3). Similarly void configure(const ICLImage *input, ICLMultiImage * output) in CLColorConvert supports RGBA8888 => YUV444 conversion (case 4). We will get back with the OpenCL version.

manjunathahg avatar Jun 29 '18 10:06 manjunathahg

Hi @mdigiorgio the OpenCL version we are using is 1.2

manjunathahg avatar Jul 04 '18 12:07 manjunathahg

Hi @manjunathahg,

Thanks for the information. Two points:

  • in the code you have provided, you are using format UYVY422, not YUV444.
  • The configure methods you mentioned are not the ones that get called in your examples. In fact, in the example you declare srcImage and dstImage as Image / CLImage objects, whereas the ones you mentioned are called when you use an IMultiImage / ICLMultiImage object as destination. This makes sense because you want a conversion to a planar format, so the output should be a multi planar image.

Hope this helps.

mdigiorgio avatar Aug 22 '18 17:08 mdigiorgio

Closing, reopen if needed

mpekatsoula avatar Sep 17 '18 13:09 mpekatsoula