[GIL] Help on rgba 10 bits views

Hi, I would like to know how can I create a 10 bits view that makes it possible to use interleaved_view. My data are described as follow: R10G10B10A10;R10G10B10A10;R10G10B10A10;R10G10B10A10;..... You understand easily that a rgba pixel is stored on 40 bits... I tried this: typedef bit_aligned_pixel_reference<uint64_t,
mpl::vector4_c<uint16_t, 10, 10, 10, 10>, rgba_layout_t, true> rgba10101010_ref_t; // A mutable iterator over RGB101010 pixels typedef bit_aligned_pixel_iterator<rgba10101010_ref_t> rgba10101010_ptr_t; typedef std::iterator_traits<rgba10101010_ptr_t>::value_type rgba10101010_pixel_t; // View type from pixel type typedef view_type_from_pixel<rgba10101010_pixel_t>::type rgba10101010_view_t;
rgba10101010_view_t src;
But it does a mess with my pixels... (and makes it impossible to use copy_and_convert_pixels(src, rgba16_view_t(view(img))); ) If anyone could help me, that would be great ! Thank you by advance, Eloi.

Hi Eloi, I'm doing some testing and indeed there is something wrong. The following test doesn't work for the alpha channel of the rgba10_pixel_t: #include <boost\gil\gil_all.hpp> using namespace boost; using namespace gil; int main() { typedef bit_aligned_pixel_reference< uint32_t , mpl::vector4_c<uint8_t, 7, 7, 7, 7> , rgba_layout_t , true > rgba7_ref_t; typedef bit_aligned_pixel_iterator< rgba7_ref_t > rgba7_ptr_t; typedef std::iterator_traits< rgba7_ptr_t >::value_type rgba7_pixel_t; typedef bit_aligned_pixel_reference< uint32_t , mpl::vector4_c<uint8_t, 8, 8, 8, 8> , rgba_layout_t , true > _rgba8_ref_t; typedef bit_aligned_pixel_iterator< _rgba8_ref_t > _rgba8_ptr_t; typedef std::iterator_traits< _rgba8_ptr_t >::value_type _rgba8_pixel_t; typedef bit_aligned_pixel_reference< uint64_t , mpl::vector4_c<uint16_t, 10, 10, 10, 10> , rgba_layout_t , true > rgba10_ref_t; // A mutable iterator over RGBA10 pixels typedef bit_aligned_pixel_iterator< rgba10_ref_t > rgba10_ptr_t; typedef std::iterator_traits< rgba10_ptr_t >::value_type rgba10_pixel_t; rgba7_pixel_t src_7( 20, 30, 40, 50 ); uint16_t r_7 = get_color( src_7, red_t() ); uint16_t g_7 = get_color( src_7, green_t() ); uint16_t b_7 = get_color( src_7, blue_t() ); uint16_t a_7 = get_color( src_7, alpha_t() ); _rgba8_pixel_t src_8( 20, 30, 40, 50 ); uint16_t r_8 = get_color( src_8, red_t() ); uint16_t g_8 = get_color( src_8, green_t() ); uint16_t b_8 = get_color( src_8, blue_t() ); uint16_t a_8 = get_color( src_8, alpha_t() ); rgba10_pixel_t src_10( 20, 30, 40, 50 ); uint16_t r_10 = get_color( src_10, red_t() ); uint16_t g_10 = get_color( src_10, green_t() ); uint16_t b_10 = get_color( src_10, blue_t() ); uint16_t a_10 = get_color( src_10, alpha_t() ); return 0; } Looking at the packed_pixel's _bitfield member reveals that the it's value is way off. I'll keep investigating the issue. Regards, Christian
participants (2)
-
Christian Henning
-
Eloi Du Bois