Boost logo

Boost Users :

Subject: Re: [Boost-users] [GIL] Help on rgba 10 bits views
From: Christian Henning (chhenning_at_[hidden])
Date: 2009-11-25 11:39:20


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


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