When comparing scanlines for SNORM images, take into account that -1.0
can be exactly represented in two different ways.

---------

Co-authored-by: Ben Ashbaugh <ben.ashbaugh@intel.com>
This commit is contained in:
joshqti
2024-11-26 09:24:35 -08:00
committed by GitHub
parent feca4c6354
commit 1102e0bccf

View File

@@ -490,6 +490,32 @@ size_t compare_scanlines(const image_descriptor *imageInfo, const char *aPtr,
} }
break; break;
case CL_SNORM_INT8: {
cl_uchar aPixel = *(cl_uchar *)aPtr;
cl_uchar bPixel = *(cl_uchar *)bPtr;
// -1.0 is defined as 0x80 and 0x81
aPixel = (aPixel == 0x80) ? 0x81 : aPixel;
bPixel = (bPixel == 0x80) ? 0x81 : bPixel;
if (aPixel != bPixel)
{
return column;
}
}
break;
case CL_SNORM_INT16: {
cl_ushort aPixel = *(cl_ushort *)aPtr;
cl_ushort bPixel = *(cl_ushort *)bPtr;
// -1.0 is defined as 0x8000 and 0x8001
aPixel = (aPixel == 0x8000) ? 0x8001 : aPixel;
bPixel = (bPixel == 0x8000) ? 0x8001 : bPixel;
if (aPixel != bPixel)
{
return column;
}
}
break;
default: default:
if (memcmp(aPtr, bPtr, pixel_size) != 0) return column; if (memcmp(aPtr, bPtr, pixel_size) != 0) return column;
break; break;