File indexing completed on 2025-01-18 09:30:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_COMPUTE_IMAGE_IMAGE_FORMAT_HPP
0012 #define BOOST_COMPUTE_IMAGE_IMAGE_FORMAT_HPP
0013
0014 #include <boost/compute/cl.hpp>
0015
0016 namespace boost {
0017 namespace compute {
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 class image_format
0039 {
0040 public:
0041 enum channel_order {
0042 r = CL_R,
0043 a = CL_A,
0044 intensity = CL_INTENSITY,
0045 luminance = CL_LUMINANCE,
0046 rg = CL_RG,
0047 ra = CL_RA,
0048 rgb = CL_RGB,
0049 rgba = CL_RGBA,
0050 argb = CL_ARGB,
0051 bgra = CL_BGRA
0052 };
0053
0054 enum channel_data_type {
0055 snorm_int8 = CL_SNORM_INT8,
0056 snorm_int16 = CL_SNORM_INT16,
0057 unorm_int8 = CL_UNORM_INT8,
0058 unorm_int16 = CL_UNORM_INT16,
0059 unorm_short_565 = CL_UNORM_SHORT_565,
0060 unorm_short_555 = CL_UNORM_SHORT_555,
0061 unorm_int_101010 = CL_UNORM_INT_101010,
0062 signed_int8 = CL_SIGNED_INT8,
0063 signed_int16 = CL_SIGNED_INT16,
0064 signed_int32 = CL_SIGNED_INT32,
0065 unsigned_int8 = CL_UNSIGNED_INT8,
0066 unsigned_int16 = CL_UNSIGNED_INT16,
0067 unsigned_int32 = CL_UNSIGNED_INT32,
0068 float16 = CL_HALF_FLOAT,
0069 float32 = CL_FLOAT
0070 };
0071
0072
0073 explicit image_format(cl_channel_order order, cl_channel_type type)
0074 {
0075 m_format.image_channel_order = order;
0076 m_format.image_channel_data_type = type;
0077 }
0078
0079
0080 explicit image_format(const cl_image_format &format)
0081 {
0082 m_format.image_channel_order = format.image_channel_order;
0083 m_format.image_channel_data_type = format.image_channel_data_type;
0084 }
0085
0086
0087 image_format(const image_format &other)
0088 : m_format(other.m_format)
0089 {
0090 }
0091
0092
0093 image_format& operator=(const image_format &other)
0094 {
0095 if(this != &other){
0096 m_format = other.m_format;
0097 }
0098
0099 return *this;
0100 }
0101
0102
0103 ~image_format()
0104 {
0105 }
0106
0107
0108 const cl_image_format* get_format_ptr() const
0109 {
0110 return &m_format;
0111 }
0112
0113
0114 bool operator==(const image_format &other) const
0115 {
0116 return m_format.image_channel_order ==
0117 other.m_format.image_channel_order &&
0118 m_format.image_channel_data_type ==
0119 other.m_format.image_channel_data_type;
0120 }
0121
0122
0123 bool operator!=(const image_format &other) const
0124 {
0125 return !(*this == other);
0126 }
0127
0128 private:
0129 cl_image_format m_format;
0130 };
0131
0132 }
0133 }
0134
0135 #endif