Hi Nathan, I have reviewed your patch and it looks good. Thanks for
your work. I got rid of the base_channel meta_function and just
introduced a dst_integer_t typedef instead. Please review below:
template
struct channel_converter_unsigned_integral_nondivisible
{
DstChannelV operator()(SrcChannelV src) const {
typedef typename detail::unsigned_integral_max_value<
SrcChannelV >::value_type src_integer_t;
typedef typename detail::unsigned_integral_max_value<
DstChannelV >::value_type dst_integer_t;
//typedef typename
unsigned_integral_max_value<SrcChannelV>::value_type integer_t;
static const double div =
unsigned_integral_max_value<SrcChannelV>::value
/
double(unsigned_integral_max_value<DstChannelV>::value);
static const src_integer_t div2 = static_cast< src_integer_t
( div / 2 );
return static_cast< dst_integer_t >(( static_cast< double >(
src + div2 ) / div ));
}
};
template <typename DstChannelV> struct
channel_converter_unsigned : public
std::unary_function {
DstChannelV operator()(bits32f x) const
{
typedef typename detail::unsigned_integral_max_value<
DstChannelV >::value_type dst_integer_t;
return static_cast< dst_integer_t
(x*channel_traits<DstChannelV>::max_value()+0.5f);
}
};
Regards,
Christian