TuttleOFX
1
|
00001 #ifndef _GIL_EXTENSION_TYPEDEFS_HPP_ 00002 #define _GIL_EXTENSION_TYPEDEFS_HPP_ 00003 00004 #include <boost/integer.hpp> // for boost::uint_t 00005 #include <boost/gil/channel_algorithm.hpp> // force to use the boostHack version first 00006 #include <boost/gil/gil_all.hpp> 00007 #include <boost/type_traits.hpp> 00008 00009 #define I10_MIN 0 // 0 00010 #define I10_MAX 1023 // 2^10 - 1 00011 00012 namespace boost { 00013 namespace gil { 00014 00015 /////////////////////////////////////////// 00016 //// 00017 //// Add built-in channel models for 64bits 00018 //// 00019 /////////////////////////////////////////// 00020 00021 /// \defgroup bits64 bits64 00022 /// \ingroup ChannelModel 00023 /// \brief 64-bit unsigned integral channel type (typedef from uint64_t). Models ChannelValueConcept 00024 00025 /// \ingroup bits64 00026 typedef uint64_t bits64; 00027 00028 /// \defgroup bits64s bits64s 00029 /// \ingroup ChannelModel 00030 /// \brief 64-bit signed integral channel type (typedef from int64_t). Models ChannelValueConcept 00031 00032 /// \ingroup bits64s 00033 typedef int64_t bits64s; 00034 00035 struct double_zero 00036 { 00037 static double apply() { return 0.0; } 00038 }; 00039 struct double_one 00040 { 00041 static double apply() { return 1.0; } 00042 }; 00043 00044 /// \defgroup bits64f bits64f 00045 /// \ingroup ChannelModel 00046 /// \brief 64-bit floating point channel type with range [0.0f ... 1.0f]. Models ChannelValueConcept 00047 00048 /// \ingroup bits64f 00049 typedef scoped_channel_value<double, double_zero, double_one> bits64f; 00050 00051 GIL_DEFINE_BASE_TYPEDEFS( 64, gray ) 00052 GIL_DEFINE_BASE_TYPEDEFS( 64s, gray ) 00053 GIL_DEFINE_BASE_TYPEDEFS( 64f, gray ) 00054 GIL_DEFINE_BASE_TYPEDEFS( 64, bgr ) 00055 GIL_DEFINE_BASE_TYPEDEFS( 64s, bgr ) 00056 GIL_DEFINE_BASE_TYPEDEFS( 64f, bgr ) 00057 GIL_DEFINE_BASE_TYPEDEFS( 64, argb ) 00058 GIL_DEFINE_BASE_TYPEDEFS( 64s, argb ) 00059 GIL_DEFINE_BASE_TYPEDEFS( 64f, argb ) 00060 GIL_DEFINE_BASE_TYPEDEFS( 64, abgr ) 00061 GIL_DEFINE_BASE_TYPEDEFS( 64s, abgr ) 00062 GIL_DEFINE_BASE_TYPEDEFS( 64f, abgr ) 00063 GIL_DEFINE_BASE_TYPEDEFS( 64, bgra ) 00064 GIL_DEFINE_BASE_TYPEDEFS( 64s, bgra ) 00065 GIL_DEFINE_BASE_TYPEDEFS( 64f, bgra ) 00066 00067 GIL_DEFINE_ALL_TYPEDEFS( 64, rgb ) 00068 GIL_DEFINE_ALL_TYPEDEFS( 64s, rgb ) 00069 GIL_DEFINE_ALL_TYPEDEFS( 64f, rgb ) 00070 GIL_DEFINE_ALL_TYPEDEFS( 64, rgba ) 00071 GIL_DEFINE_ALL_TYPEDEFS( 64s, rgba ) 00072 GIL_DEFINE_ALL_TYPEDEFS( 64f, rgba ) 00073 GIL_DEFINE_ALL_TYPEDEFS( 64, cmyk ) 00074 GIL_DEFINE_ALL_TYPEDEFS( 64s, cmyk ) 00075 GIL_DEFINE_ALL_TYPEDEFS( 64f, cmyk ) 00076 00077 template <int N> 00078 struct devicen_t; 00079 template <int N> 00080 struct devicen_layout_t; 00081 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 64, dev2n, devicen_t<2>, devicen_layout_t<2>) 00082 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 64s, dev2n, devicen_t<2>, devicen_layout_t<2>) 00083 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 64f, dev2n, devicen_t<2>, devicen_layout_t<2>) 00084 00085 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 64, dev3n, devicen_t<3>, devicen_layout_t<3>) 00086 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 64s, dev3n, devicen_t<3>, devicen_layout_t<3>) 00087 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 64f, dev3n, devicen_t<3>, devicen_layout_t<3>) 00088 00089 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 64, dev4n, devicen_t<4>, devicen_layout_t<4>) 00090 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 64s, dev4n, devicen_t<4>, devicen_layout_t<4>) 00091 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 64f, dev4n, devicen_t<4>, devicen_layout_t<4>) 00092 00093 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 64, dev5n, devicen_t<5>, devicen_layout_t<5>) 00094 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 64s, dev5n, devicen_t<5>, devicen_layout_t<5>) 00095 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 64f, dev5n, devicen_t<5>, devicen_layout_t<5>) 00096 00097 00098 /****************************************************************************** 00099 * Bit stream 00100 *****************************************************************************/ 00101 typedef uint16_t uint10_t; 00102 typedef uint16_t uint12_t; 00103 00104 /// 10 bits rgb bit stream 00105 typedef bit_aligned_pixel_reference< uint32_t, 00106 mpl::vector3_c<uint10_t, 10, 10, 10>, 00107 rgb_layout_t, 00108 true 00109 > rgb10_stream_ref_t; 00110 typedef bit_aligned_pixel_iterator<rgb10_stream_ref_t> rgb10_stream_ptr_t; 00111 typedef std::iterator_traits<rgb10_stream_ptr_t>::value_type rgb10_stream_pixel_t; 00112 typedef view_type_from_pixel<rgb10_stream_pixel_t>::type rgb10_stream_view_t; 00113 00114 /// 10 bits rgba bit stream 00115 typedef bit_aligned_pixel_reference< uint64_t, 00116 mpl::vector4_c<uint10_t, 10, 10, 10, 10>, 00117 rgba_layout_t, 00118 true 00119 > rgba10_stream_ref_t; 00120 typedef bit_aligned_pixel_iterator<rgba10_stream_ref_t> rgba10_stream_ptr_t; 00121 typedef std::iterator_traits<rgba10_stream_ptr_t>::value_type rgba10_stream_pixel_t; 00122 typedef view_type_from_pixel<rgba10_stream_pixel_t>::type rgba10_stream_view_t; 00123 00124 /// 10 bits abgr bit stream 00125 typedef bit_aligned_pixel_reference< uint64_t, 00126 mpl::vector4_c<uint10_t, 10, 10, 10, 10>, 00127 abgr_layout_t, 00128 true 00129 > abgr10_stream_ref_t; 00130 typedef bit_aligned_pixel_iterator<abgr10_stream_ref_t> abgr10_stream_ptr_t; 00131 typedef std::iterator_traits<abgr10_stream_ptr_t>::value_type abgr10_stream_pixel_t; 00132 typedef view_type_from_pixel<abgr10_stream_pixel_t>::type abgr10_stream_view_t; 00133 00134 /// 12 bits rgb bit stream 00135 typedef bit_aligned_pixel_reference< uint64_t, 00136 mpl::vector3_c<uint12_t, 12, 12, 12>, 00137 rgb_layout_t, 00138 true 00139 > rgb12_stream_ref_t; 00140 typedef bit_aligned_pixel_iterator<rgb12_stream_ref_t> rgb12_stream_ptr_t; 00141 typedef std::iterator_traits<rgb12_stream_ptr_t>::value_type rgb12_stream_pixel_t; 00142 typedef view_type_from_pixel<rgb12_stream_pixel_t>::type rgb12_stream_view_t; 00143 00144 /// 12 bits rgba bit stream 00145 typedef bit_aligned_pixel_reference< uint64_t, 00146 mpl::vector4_c<uint12_t, 12, 12, 12, 12>, 00147 rgba_layout_t, 00148 true 00149 > rgba12_stream_ref_t; 00150 typedef bit_aligned_pixel_iterator<rgba12_stream_ref_t> rgba12_stream_ptr_t; 00151 typedef std::iterator_traits<rgba12_stream_ptr_t>::value_type rgba12_stream_pixel_t; 00152 typedef view_type_from_pixel<rgba12_stream_pixel_t>::type rgba12_stream_view_t; 00153 00154 /// 12 bits abgr bit stream 00155 typedef bit_aligned_pixel_reference< uint64_t, 00156 mpl::vector4_c<uint12_t, 12, 12, 12, 12>, 00157 abgr_layout_t, 00158 true 00159 > abgr12_stream_ref_t; 00160 typedef bit_aligned_pixel_iterator<abgr12_stream_ref_t> abgr12_stream_ptr_t; 00161 typedef std::iterator_traits<abgr12_stream_ptr_t>::value_type abgr12_stream_pixel_t; 00162 typedef view_type_from_pixel<abgr12_stream_pixel_t>::type abgr12_stream_view_t; 00163 00164 /// 12 bits rgba packed to short 00165 typedef const packed_channel_reference<uint64_t, 04, 12, true> rgba12_packed_channel0_t; 00166 typedef const packed_channel_reference<uint64_t, 20, 12, true> rgba12_packed_channel1_t; 00167 typedef const packed_channel_reference<uint64_t, 36, 12, true> rgba12_packed_channel2_t; 00168 typedef const packed_channel_reference<uint64_t, 52, 12, true> rgba12_packed_channel3_t; 00169 typedef mpl::vector4<rgba12_packed_channel0_t, rgba12_packed_channel1_t, 00170 rgba12_packed_channel2_t, rgba12_packed_channel3_t> rgba12_packed_channels_t; 00171 typedef packed_pixel<uint64_t, rgba12_packed_channels_t, rgba_layout_t> rgba12_packed_pixel_t; 00172 typedef view_type_from_pixel<rgba12_packed_pixel_t>::type rgba12_packed_view_t; 00173 typedef image<rgba12_packed_pixel_t, false> rgba12_packed_image_t; 00174 00175 /// 12 bits abgr packed to short 00176 typedef const packed_channel_reference<uint64_t, 04, 12, true> abgr12_packed_channel0_t; 00177 typedef const packed_channel_reference<uint64_t, 20, 12, true> abgr12_packed_channel1_t; 00178 typedef const packed_channel_reference<uint64_t, 36, 12, true> abgr12_packed_channel2_t; 00179 typedef const packed_channel_reference<uint64_t, 52, 12, true> abgr12_packed_channel3_t; 00180 typedef mpl::vector4<abgr12_packed_channel0_t, abgr12_packed_channel1_t, 00181 abgr12_packed_channel2_t, abgr12_packed_channel3_t> abgr12_packed_channels_t; 00182 typedef packed_pixel<uint64_t, abgr12_packed_channels_t, abgr_layout_t> abgr12_packed_pixel_t; 00183 typedef view_type_from_pixel<abgr12_packed_pixel_t>::type abgr12_packed_view_t; 00184 typedef image<abgr12_packed_pixel_t, false> abgr12_packed_image_t; 00185 00186 /// 12 bits rgb packed to 6 bytes 00187 typedef const packed_channel_reference<uint64_t, 04, 12, true> rgb12_packed_channel0_t; 00188 typedef const packed_channel_reference<uint64_t, 20, 12, true> rgb12_packed_channel1_t; 00189 typedef const packed_channel_reference<uint64_t, 36, 12, true> rgb12_packed_channel2_t; 00190 typedef mpl::vector3<rgb12_packed_channel0_t, rgb12_packed_channel1_t, rgb12_packed_channel2_t> rgb12_packed_channels_t; 00191 typedef packed_pixel<packed_channel_value<48>, rgb12_packed_channels_t, rgb_layout_t> rgb12_packed_pixel_t; 00192 typedef view_type_from_pixel<rgb12_packed_pixel_t>::type rgb12_packed_view_t; 00193 typedef image<rgb12_packed_pixel_t, false> rgb12_packed_image_t; 00194 00195 /// 10 bits rgb packed to uint32_t 00196 typedef const packed_channel_reference<uint32_t, 22, 10, true> rgb10_packed_channel0_t; 00197 typedef const packed_channel_reference<uint32_t, 12, 10, true> rgb10_packed_channel1_t; 00198 typedef const packed_channel_reference<uint32_t, 02, 10, true> rgb10_packed_channel2_t; 00199 typedef mpl::vector3<rgb10_packed_channel0_t, rgb10_packed_channel1_t, rgb10_packed_channel2_t> rgb10_packed_channels_t; 00200 typedef packed_pixel<uint32_t, rgb10_packed_channels_t, rgb_layout_t> rgb10_packed_pixel_t; 00201 typedef view_type_from_pixel<rgb10_packed_pixel_t>::type rgb10_packed_view_t; 00202 typedef image<rgb10_packed_pixel_t, false> rgb10_packed_image_t; 00203 00204 /// 10 bits rgba packed to short 00205 typedef const packed_channel_reference<uint64_t, 22, 10, true> rgba10_packed_channel0_t; 00206 typedef const packed_channel_reference<uint64_t, 12, 10, true> rgba10_packed_channel1_t; 00207 typedef const packed_channel_reference<uint64_t, 02, 10, true> rgba10_packed_channel2_t; 00208 typedef const packed_channel_reference<uint64_t, 54, 10, true> rgba10_packed_channel3_t; 00209 typedef mpl::vector4<rgba10_packed_channel0_t, rgba10_packed_channel1_t, 00210 rgba10_packed_channel2_t, rgba10_packed_channel3_t> rgba10_packed_channels_t; 00211 typedef packed_pixel<uint64_t, rgba10_packed_channels_t, rgba_layout_t> rgba10_packed_pixel_t; 00212 typedef view_type_from_pixel<rgba10_packed_pixel_t>::type rgba10_packed_view_t; 00213 typedef image<rgba10_packed_pixel_t, false> rgba10_packed_image_t; 00214 00215 /// 10 bits abgr packed to short 00216 typedef const packed_channel_reference<uint64_t, 4, 10, true> abgr10_packed_channel0_t; 00217 typedef const packed_channel_reference<uint64_t, 20, 10, true> abgr10_packed_channel1_t; 00218 typedef const packed_channel_reference<uint64_t, 36, 10, true> abgr10_packed_channel2_t; 00219 typedef const packed_channel_reference<uint64_t, 52, 10, true> abgr10_packed_channel3_t; 00220 typedef mpl::vector4<abgr10_packed_channel0_t, abgr10_packed_channel1_t, 00221 abgr10_packed_channel2_t, abgr10_packed_channel3_t> abgr10_packed_channels_t; 00222 typedef packed_pixel<uint64_t, abgr10_packed_channels_t, abgr_layout_t> abgr10_packed_pixel_t; 00223 typedef view_type_from_pixel<abgr10_packed_pixel_t>::type abgr10_packed_view_t; 00224 typedef image<abgr10_packed_pixel_t, false> abgr10_packed_image_t; 00225 00226 /****************************************************************************** 00227 * Packed on bytes view types 00228 *****************************************************************************/ 00229 typedef packed_channel_value<10> bits10; 00230 typedef packed_channel_value<12> bits12; 00231 00232 GIL_DEFINE_BASE_TYPEDEFS( 10, gray ) 00233 GIL_DEFINE_BASE_TYPEDEFS( 10, bgr ) 00234 GIL_DEFINE_BASE_TYPEDEFS( 10, argb ) 00235 GIL_DEFINE_BASE_TYPEDEFS( 10, bgra ) 00236 GIL_DEFINE_BASE_TYPEDEFS( 10, abgr ) 00237 GIL_DEFINE_ALL_TYPEDEFS( 10, rgb ) 00238 GIL_DEFINE_ALL_TYPEDEFS( 10, rgba ) 00239 GIL_DEFINE_ALL_TYPEDEFS( 10, cmyk ) 00240 00241 GIL_DEFINE_BASE_TYPEDEFS( 12, gray ) 00242 GIL_DEFINE_BASE_TYPEDEFS( 12, bgr ) 00243 GIL_DEFINE_BASE_TYPEDEFS( 12, argb ) 00244 GIL_DEFINE_BASE_TYPEDEFS( 12, bgra ) 00245 GIL_DEFINE_BASE_TYPEDEFS( 12, abgr ) 00246 GIL_DEFINE_ALL_TYPEDEFS( 12, rgb ) 00247 GIL_DEFINE_ALL_TYPEDEFS( 12, rgba ) 00248 GIL_DEFINE_ALL_TYPEDEFS( 12, cmyk ) 00249 00250 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 10, dev2n, devicen_t<2>, devicen_layout_t<2>) 00251 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 10, dev3n, devicen_t<3>, devicen_layout_t<3>) 00252 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 10, dev4n, devicen_t<4>, devicen_layout_t<4>) 00253 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 10, dev5n, devicen_t<5>, devicen_layout_t<5>) 00254 00255 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 12, dev2n, devicen_t<2>, devicen_layout_t<2>) 00256 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 12, dev3n, devicen_t<3>, devicen_layout_t<3>) 00257 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 12, dev4n, devicen_t<4>, devicen_layout_t<4>) 00258 GIL_DEFINE_ALL_TYPEDEFS_INTERNAL( 12, dev5n, devicen_t<5>, devicen_layout_t<5>) 00259 00260 } 00261 } 00262 00263 #endif 00264