MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / validate_results

Function validate_results

test_conformance/basic/test_image_param.cpp:38–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36"}\n" };
37
38int validate_results( size_t width, size_t height, cl_image_format &format, char *inputData, cl_float *actualResults )
39{
40 for( size_t i = 0; i < width * height; i++ )
41 {
42 cl_float expected[ 4 ], tolerance;
43
44 switch( format.image_channel_data_type )
45 {
46 case CL_UNORM_INT8:
47 {
48 cl_uchar *p = (cl_uchar *)inputData;
49 expected[ 0 ] = p[ 0 ] / 255.f;
50 expected[ 1 ] = p[ 1 ] / 255.f;
51 expected[ 2 ] = p[ 2 ] / 255.f;
52 expected[ 3 ] = p[ 3 ] / 255.f;
53 tolerance = 1.f / 255.f;
54 break;
55 }
56 case CL_SNORM_INT8:
57 {
58 cl_char *p = (cl_char *)inputData;
59 expected[ 0 ] = fmaxf( p[ 0 ] / 127.f, -1.f );
60 expected[ 1 ] = fmaxf( p[ 1 ] / 127.f, -1.f );
61 expected[ 2 ] = fmaxf( p[ 2 ] / 127.f, -1.f );
62 expected[ 3 ] = fmaxf( p[ 3 ] / 127.f, -1.f );
63 tolerance = 1.f / 127.f;
64 break;
65 }
66 case CL_UNSIGNED_INT8:
67 {
68 cl_uchar *p = (cl_uchar *)inputData;
69 expected[ 0 ] = p[ 0 ];
70 expected[ 1 ] = p[ 1 ];
71 expected[ 2 ] = p[ 2 ];
72 expected[ 3 ] = p[ 3 ];
73 tolerance = 1.f / 127.f;
74 break;
75 }
76 case CL_SIGNED_INT8:
77 {
78 cl_short *p = (cl_short *)inputData;
79 expected[ 0 ] = p[ 0 ];
80 expected[ 1 ] = p[ 1 ];
81 expected[ 2 ] = p[ 2 ];
82 expected[ 3 ] = p[ 3 ];
83 tolerance = 1.f / 127.f;
84 break;
85 }
86 case CL_UNORM_INT16:
87 {
88 cl_ushort *p = (cl_ushort *)inputData;
89 expected[ 0 ] = p[ 0 ] / 65535.f;
90 expected[ 1 ] = p[ 1 ] / 65535.f;
91 expected[ 2 ] = p[ 2 ] / 65535.f;
92 expected[ 3 ] = p[ 3 ] / 65535.f;
93 tolerance = 1.f / 65535.f;
94 break;
95 }

Callers 1

REGISTER_TESTFunction · 0.85

Calls 4

fmaxfFunction · 0.85
GetChannelOrderNameFunction · 0.85
GetChannelTypeNameFunction · 0.85
get_format_type_sizeFunction · 0.85

Tested by

no test coverage detected