Boost logo

Boost Users :

Subject: [Boost-users] [GIL] Packing to 6 bytes
From: Eloi Du Bois (eloi.du.bois_at_[hidden])
Date: 2009-12-16 05:17:56


I have a question:
I need to create a view that hold 12 bit channel data packed as follow:

Meaning that each channel is shifted by 4 bits.
The pixel is holden on 48 bits = 6 bytes.

I have created my view like as follow:
/// My 12 bits special rgb packed to 6 bytes
typedef const packed_channel_reference<uint64_t, 04, 12, true>
typedef const packed_channel_reference<uint64_t, 20, 12, true>
typedef const packed_channel_reference<uint64_t, 36, 12, true>
typedef mpl::vector3<rgb12_packed_channel0_t, rgb12_packed_channel1_t,
rgb12_packed_channel2_t> rgb12_packed_channels_t;
typedef packed_pixel<packed_channel_value<48>, rgb12_packed_channels_t,
rgb_layout_t> rgb12_packed_pixel_t;
typedef view_type_from_pixel<rgb12_packed_pixel_t>::type

The thing is that I would now like to copy data to another rgb16_view_t...
But this is not working because, in my opinion, 48 bits is between 32 and
I have been thinking of the solution that Christian gave me and that consist
on doing something like this:
    T p( pData, 0 );

    for( typename DST_V::y_coord_t y = 0; y < height; ++y )
        typename DST_V::x_iterator it = dst.row_begin( y );

        for( typename DST_V::x_coord_t x = 0; x < width; ++x )
            color_convert( *p, *it );

where T is a bit_aligned_pixel_iterator and DST_V=rgb16_view_t but this
can't be working on my case because channels are shifted by 4 bits !

If you could help me, I would really appreciate.
I think all those cases are a good robustness test for gil.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at