Hi all,
Sorry to bother you with my problems but I am experiencing a new probable bug:
I am trying to manage with data that are set as follow:
P;P;P;P;......
Where P is a rgb pixel (10 bits per components) packed on an uint32 as follow:
00RGB;00RGB;00RGB;00RGB........
I mean there is two bits unused on each 32 bits pixel.
So I tried to set up a view using packed_pixel and a bug occurs when using copy_and_convert_pixels...
The very strange thing is that it is working when using color_convert on two pixels...
I think there may exist something I didn't understood... Anyway, I give you the buggy code:
/// 10 bits rgb packed to uint32_t starting at the 2nd bitHope this will help,
typedef const packed_channel_reference<uint32_t, 22, 10, true> rgb10_packed_channel0_t;
typedef const packed_channel_reference<uint32_t, 12, 10, true> rgb10_packed_channel1_t;
typedef const packed_channel_reference<uint32_t, 02, 10, true> rgb10_packed_channel2_t;
typedef mpl::vector3<rgb10_packed_channel0_t, rgb10_packed_channel1_t, rgb10_packed_channel2_t> rgb10_packed_channels_t;
typedef packed_pixel<uint32_t, rgb10_packed_channels_t, rgb_layout_t> rgb10_packed_pixel_t;
typedef view_type_from_pixel<rgb10_packed_pixel_t>::type rgb10_packed_view_t;
// image data of dimension: {w,h} = {1,0}
uint32_t *data=new uint32_t[1];
data[0] = 0xFFFFF00C;
rgb10_packed_view_t vw10 =
interleaved_view( 1, 0, (rgb10_packed_pixel_t*)( data ), sizeof( uint32_t ) );
rgb10_packed_pixel_t pix10 = *vw10.row_begin(0);
rgb16_pixel_t pix16;
// This is working
color_convert(pix10, pix16);
std::cout << "Right {R,G,B}={" << get_color(pix16, red_t()) << ","
<< get_color(pix16, green_t()) << ","
<< get_color(pix16, blue_t()) << "}"
<< std::endl;
// Assert that are ok
assert( get_color( pix16, red_t() ) == 0xFFFF );
assert( get_color( pix16, green_t() ) == 0xFFFF );
assert( get_color( pix16, blue_t() ) == 0x00C0 );
rgb16_image_t img16(vw10.width(), vw10.height());
rgb16_view_t vw16(view(img16));
// This isn't working with packed_view
copy_and_convert_pixels(vw10, vw16);
pix16 = *vw16.row_begin(0);
std::cout << "Wrong {R,G,B}={" << get_color(pix16, red_t()) << ","
<< get_color(pix16, green_t()) << ","
<< get_color(pix16, blue_t()) << "}"
<< std::endl;
// Assert that doesn't pass
assert( get_color( pix16, red_t() ) == 0xFFFF );
assert( get_color( pix16, green_t() ) == 0xFFFF );
assert( get_color( pix16, blue_t() ) == 0x00C0 );