#include "cl_viv_vx_ext.h"

__kernel void vxcExtra_ending_i16(
    __read_only image2d_array_t   input0,
    __read_only image2d_array_t   input,
    __write_only image2d_array_t  output)
{
    int4 coord = (int4)(get_global_id(0), get_global_id(1), get_global_id(2), 0);

    vxc_short8 data;
    VXC_ReadImage2DArray(data, input, coord, VXC_5BITOFFSET_XY(0, 0),\
        VXC_MODIFIER(0, 7, 0, VXC_RM_TowardZero, 0));

    VXC_WriteImage2DArray(output, coord, data, VXC_MODIFIER(0, 7, 0, VXC_RM_TowardZero, 0));
}

__kernel void vxcExtra_ending_i8(
    __read_only image2d_array_t   input0,
    __read_only image2d_array_t   input,
    __write_only image2d_array_t  output)
{
    int4 coord = (int4)(get_global_id(0), get_global_id(1), get_global_id(2), 0);

    vxc_char8 data;
    VXC_ReadImage2DArray(data, input, coord, VXC_5BITOFFSET_XY(0, 0),\
        VXC_MODIFIER(0, 7, 0, VXC_RM_TowardZero, 0));

    VXC_WriteImage2DArray(output, coord, data, VXC_MODIFIER(0, 7, 0, VXC_RM_TowardZero, 0));
}

__kernel void vxcExtra_ending_u8(
    __read_only image2d_array_t   input0,
    __read_only image2d_array_t   input,
    __write_only image2d_array_t  output)
{
    int4 coord = (int4)(get_global_id(0), get_global_id(1), get_global_id(2), 0);

    vxc_uchar8 data;
    VXC_ReadImage2DArray(data, input, coord, VXC_5BITOFFSET_XY(0, 0),\
        VXC_MODIFIER(0, 7, 0, VXC_RM_TowardZero, 0));

    VXC_WriteImage2DArray(output, coord, data, VXC_MODIFIER(0, 7, 0, VXC_RM_TowardZero, 0));
}
