Boost Users :
Subject: Re: [Boost-users] [GIL] Packing to 6 bytes
From: Christian Henning (chhenning_at_[hidden])
Date: 2009-12-16 11:19:54
Hi Eloi, I'm not sure if I can following here. How many channels do
you have? How big is the channel size including the the 4 bits?
Couldn't you just create a 64bit ( assuming 4 channels by ( 12 + 4
bits ) per channels ) pixel type and when looping through all channels
per pixel you blend out ( using & operator with 0x0FFF ) the unwanted
Sorry, when my explanation is a bit cryptic. Kinda busy right now.
On Wed, Dec 16, 2009 at 5:17 AM, Eloi Du Bois <eloi.du.bois_at_[hidden]> wrote:
> 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 mailing list
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net