Hi Christian,
On Tue, Nov 2, 2010 at 9:38 AM, Christian Henning wrote:
Hi Nate, good to hear from you!
Likewise.
Two things:
1. What version of boost are you using? There have some changes in the
current trunk and release branch which should appear in boost 1.45.
I've reproduced the issues with both boost 1.44 and the current trunk
using VC8 (VS2005). Interestingly, the issues don't appear with VC10
nor with g++.
2. Could you send me a small test code that exhibits your problem?
I should have done this initially. The following code gives me
warnings when compiled with cl.exe /EHsc /W4 <filename>
/I<path-to-boost>
/////////BEGIN CODE////////////
#include
#include <iostream>
namespace boost { namespace gil {
//////////////////////////////////////////////////////////////////////////
// Byte-aligned 12 bit grayscale
//////////////////////////////////////////////////////////////////////////
const uint16_t bits12_max_val = 0xFFF;
struct bits12_min { static uint16_t apply() { return 0; } };
struct bits12_max { static uint16_t apply() { return bits12_max_val; } };
typedef scoped_channel_value bits12;
namespace detail
{
template <>
struct unsigned_integral_max_value<bits12>
: public mpl::integral_c {};
template <>
struct unsigned_integral_num_bits<bits12> : public mpl::int_<12> {};
}//end detail
GIL_DEFINE_BASE_TYPEDEFS(12, gray)
} }//end boost::gil
namespace gil = boost::gil;
int main()
{
gil::gray12_pixel_t g14(100);
gil::rgb8_pixel_t rgb8;
color_convert(g14, rgb8);
color_convert(rgb8, g14);
return 0;
}
/////////END CODE////////////
The problem appears to that the scoped_channel_value constructor
expects either a scoped_channel_value object or an object of type
base_channel_t. While the channel conversion code ensures the output
will be valid (assuming valid input), it doesn't cast it to the type
the channel is expecting.
A small warning snippet:
c:\cygwin\home\ncrookston\boost_trunk\boost\gil\channel_algorithm.hpp(230)
: warning C4244: 'argument' : conversion from 'integer_t' to
'boost::uint16_t', possible loss of data
NOTE: The patch I sent earlier has an error -- in copying my changes
from 1.44 to the trunk I failed to replace value_type with type in a
couple places. The patch attached to this email corrects that.
Thanks,
Nate