/* * Copyright (C) 2019-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ R"===( __kernel void CopyImage3dToBufferBytes(__read_only image3d_t input, __global uchar *dst, int4 srcOffset, offset_t dstOffset, coord2_t Pitch) { idx_t x = get_global_id(0); idx_t y = get_global_id(1); idx_t z = get_global_id(2); const int4 srcCoord = (int4)(x, y, z, 0) + srcOffset; offset_t DstOffset = dstOffset + (y * Pitch.x) + (z * Pitch.y); uint4 c = read_imageui(input, srcCoord); *(dst + DstOffset + x) = convert_uchar_sat(c.x); } __kernel void CopyImage3dToBuffer2Bytes(__read_only image3d_t input, __global uchar *dst, int4 srcOffset, offset_t dstOffset, coord2_t Pitch) { idx_t x = get_global_id(0); idx_t y = get_global_id(1); idx_t z = get_global_id(2); const int4 srcCoord = (int4)(x, y, z, 0) + srcOffset; offset_t DstOffset = dstOffset + (y * Pitch.x) + (z * Pitch.y); uint4 c = read_imageui(input, srcCoord); if(((ulong)(dst + dstOffset)) & 0x00000001){ *((__global uchar*)(dst + DstOffset + x * 2 + 1)) = convert_uchar_sat((c.x >> 8 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 2)) = convert_uchar_sat(c.x & 0xff); } else{ *((__global ushort*)(dst + DstOffset + x * 2)) = convert_ushort_sat(c.x); } } __kernel void CopyImage3dToBuffer3Bytes(__read_only image3d_t input, __global uchar *dst, int4 srcOffset, offset_t dstOffset, coord2_t Pitch) { idx_t x = get_global_id(0); idx_t y = get_global_id(1); idx_t z = get_global_id(2); const int4 srcCoord = (int4)(x, y, z, 0) + srcOffset; offset_t DstOffset = dstOffset + (y * Pitch.x) + (z * Pitch.y); uint4 c = read_imageui(input, srcCoord); *((__global uchar*)(dst + DstOffset + x * 3 + 2)) = convert_uchar_sat(c.z & 0xff); *((__global uchar*)(dst + DstOffset + x * 3 + 1)) = convert_uchar_sat(c.y & 0xff); *((__global uchar*)(dst + DstOffset + x * 3)) = convert_uchar_sat(c.x & 0xff); } __kernel void CopyImage3dToBuffer4Bytes(__read_only image3d_t input, __global uchar *dst, int4 srcOffset, offset_t dstOffset, coord2_t Pitch) { idx_t x = get_global_id(0); idx_t y = get_global_id(1); idx_t z = get_global_id(2); const int4 srcCoord = (int4)(x, y, z, 0) + srcOffset; offset_t DstOffset = dstOffset + (y * Pitch.x) + (z * Pitch.y); uint4 c = read_imageui(input, srcCoord); if(((ulong)(dst + dstOffset)) & 0x00000003){ *((__global uchar*)(dst + DstOffset + x * 4 + 3)) = convert_uchar_sat((c.x >> 24 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 4 + 2)) = convert_uchar_sat((c.x >> 16 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 4 + 1)) = convert_uchar_sat((c.x >> 8 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 4)) = convert_uchar_sat(c.x & 0xff); } else{ *((__global uint*)(dst + DstOffset + x * 4)) = c.x; } } __kernel void CopyImage3dToBuffer4To3Bytes(__read_only image3d_t input, __global uchar *dst, int4 srcOffset, offset_t dstOffset, coord2_t Pitch) { idx_t x = get_global_id(0); idx_t y = get_global_id(1); idx_t z = get_global_id(2); const int4 srcCoord = (int4)(x, y, z, 0) + srcOffset; offset_t DstOffset = dstOffset + (y * Pitch.x) + (z * Pitch.y); uint4 c = read_imageui(input, srcCoord); *((__global uchar*)(dst + DstOffset + x * 3 + 2)) = convert_uchar_sat((c.x >> 16 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 3 + 1)) = convert_uchar_sat((c.x >> 8 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 3)) = convert_uchar_sat(c.x & 0xff); } __kernel void CopyImage3dToBuffer6Bytes(__read_only image3d_t input, __global uchar *dst, int4 srcOffset, offset_t dstOffset, coord2_t Pitch) { idx_t x = get_global_id(0); idx_t y = get_global_id(1); idx_t z = get_global_id(2); const int4 srcCoord = (int4)(x, y, z, 0) + srcOffset; offset_t DstOffset = dstOffset + (y * Pitch.x) + (z * Pitch.y); uint4 c = read_imageui(input, srcCoord); *((__global uchar*)(dst + DstOffset + x * 6 + 1)) = convert_uchar_sat((c.x >> 8 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 6)) = convert_uchar_sat(c.x & 0xff); *((__global uchar*)(dst + DstOffset + x * 6 + 3)) = convert_uchar_sat((c.y >> 8 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 6 + 2)) = convert_uchar_sat(c.y & 0xff); *((__global uchar*)(dst + DstOffset + x * 6 + 5)) = convert_uchar_sat((c.z >> 8 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 6 + 4)) = convert_uchar_sat(c.z & 0xff); } __kernel void CopyImage3dToBuffer8Bytes(__read_only image3d_t input, __global uchar *dst, int4 srcOffset, offset_t dstOffset, coord2_t Pitch) { idx_t x = get_global_id(0); idx_t y = get_global_id(1); idx_t z = get_global_id(2); const int4 srcCoord = (int4)(x, y, z, 0) + srcOffset; offset_t DstOffset = dstOffset + (y * Pitch.x) + (z * Pitch.y); uint4 c = read_imageui(input, srcCoord); if(((ulong)(dst + dstOffset)) & 0x00000007){ *((__global uchar*)(dst + DstOffset + x * 8 + 3)) = convert_uchar_sat((c.x >> 24 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 8 + 2)) = convert_uchar_sat((c.x >> 16 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 8 + 1)) = convert_uchar_sat((c.x >> 8 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 8)) = convert_uchar_sat(c.x & 0xff); *((__global uchar*)(dst + DstOffset + x * 8 + 7)) = convert_uchar_sat((c.y >> 24 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 8 + 6)) = convert_uchar_sat((c.y >> 16 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 8 + 5)) = convert_uchar_sat((c.y >> 8 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 8 + 4)) = convert_uchar_sat(c.y & 0xff); } else{ uint2 d = (uint2)(c.x,c.y); *((__global uint2*)(dst + DstOffset + x * 8)) = d; } } __kernel void CopyImage3dToBuffer8To6Bytes(__read_only image3d_t input, __global uchar *dst, int4 srcOffset, offset_t dstOffset, coord2_t Pitch) { idx_t x = get_global_id(0); idx_t y = get_global_id(1); idx_t z = get_global_id(2); const int4 srcCoord = (int4)(x, y, z, 0) + srcOffset; offset_t DstOffset = dstOffset + (y * Pitch.x) + (z * Pitch.y); uint4 c = read_imageui(input, srcCoord); *((__global uchar*)(dst + DstOffset + x * 6 + 3)) = convert_uchar_sat((c.x >> 24 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 6 + 2)) = convert_uchar_sat((c.x >> 16 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 6 + 1)) = convert_uchar_sat((c.x >> 8 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 6)) = convert_uchar_sat(c.x & 0xff); *((__global uchar*)(dst + DstOffset + x * 6 + 5)) = convert_uchar_sat((c.y >> 8 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 6 + 4)) = convert_uchar_sat(c.y & 0xff); } __kernel void CopyImage3dToBuffer16Bytes(__read_only image3d_t input, __global uchar *dst, int4 srcOffset, offset_t dstOffset, coord2_t Pitch) { idx_t x = get_global_id(0); idx_t y = get_global_id(1); idx_t z = get_global_id(2); const int4 srcCoord = (int4)(x, y, z, 0) + srcOffset; offset_t DstOffset = dstOffset + (y * Pitch.x) + (z * Pitch.y); const uint4 c = read_imageui(input, srcCoord); *((__global uchar*)(dst + DstOffset + x * 16 + 3)) = convert_uchar_sat((c.x >> 24 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 16 + 2)) = convert_uchar_sat((c.x >> 16 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 16 + 1)) = convert_uchar_sat((c.x >> 8 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 16)) = convert_uchar_sat(c.x & 0xff); *((__global uchar*)(dst + DstOffset + x * 16 + 7)) = convert_uchar_sat((c.y >> 24 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 16 + 6)) = convert_uchar_sat((c.y >> 16 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 16 + 5)) = convert_uchar_sat((c.y >> 8 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 16 + 4)) = convert_uchar_sat(c.y & 0xff); *((__global uchar*)(dst + DstOffset + x * 16 + 11)) = convert_uchar_sat((c.z >> 24 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 16 + 10)) = convert_uchar_sat((c.z >> 16 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 16 + 9)) = convert_uchar_sat((c.z >> 8 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 16 + 8)) = convert_uchar_sat(c.z & 0xff); *((__global uchar*)(dst + DstOffset + x * 16 + 15)) = convert_uchar_sat((c.w >> 24 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 16 + 14)) = convert_uchar_sat((c.w >> 16 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 16 + 13)) = convert_uchar_sat((c.w >> 8 ) & 0xff); *((__global uchar*)(dst + DstOffset + x * 16 + 12)) = convert_uchar_sat(c.w & 0xff); } __kernel void CopyImage3dToBuffer16BytesAligned(__read_only image3d_t input, __global uint4 *dst, int4 srcOffset, offset_t dstOffset, coord2_t Pitch) { idx_t x = get_global_id(0); idx_t y = get_global_id(1); idx_t z = get_global_id(2); const int4 srcCoord = (int4)(x, y, z, 0) + srcOffset; offset_t DstOffset = dstOffset + (y * Pitch.x) + (z * Pitch.y); const uint4 c = read_imageui(input, srcCoord); dst[(DstOffset >> 4) + x] = c; } )==="