[GIL] How to read fixed point channel ?
Hi, I have a stream with 8.8 (16b) channels encoded with fixed point arithmetics (http://knol.google.com/k/anonymous/fixed-point-arithmetic/1b19ktdbl6g9q/2#) and I need to create a rgb16 view that can hold my image... I tried with interleaved_view but this makes wrong values. I don't know how to manage with this... How must be encoded the shorts in a rgb16_image_t ? If anyone could help me, that would be great. Thanks, Eloi.
Eloi,
maybe you have to create new channel type which represents a fixed
point value. A good starting point might be scoped_channel_value in
channel.hpp. I'm thinking something like this:
template< typename BaseChannelValue >
class fixed_point
{
typedef fixed_point value_type;
typedef value_type& reference;
typedef value_type* pointer;
typedef const value_type& const_reference;
typedef const value_type* const_pointer;
BOOST_STATIC_CONSTANT(bool,
is_mutable=channel_traits<BaseChannelValue>::is_mutable);
static value_type min_value() { return ; }
static value_type max_value() { return ; }
fixed_point() {}
fixed_point(const fixed_point& c) : _value(c._value) {}
fixed_point(BaseChannelValue val) : _value(val) {}
fixed_point& operator++() { /*todo*/; return *this; }
fixed_point& operator--() { /*todo*/; return *this; }
fixed_point operator++(int) { fixed_point tmp=*this;
this->operator++(); return tmp; }
fixed_point operator--(int) { fixed_point tmp=*this;
this->operator--(); return tmp; }
template <typename Scalar2> fixed_point& operator+=(Scalar2 v) {
/*todo*/; return *this; }
template <typename Scalar2> fixed_point& operator-=(Scalar2 v) {
/*todo*/; return *this; }
template <typename Scalar2> fixed_point& operator*=(Scalar2 v) {
/*todo*/; return *this; }
template <typename Scalar2> fixed_point& operator/=(Scalar2 v) {
/*todo*/; return *this; }
fixed_point& operator=(BaseChannelValue v) { _value=v; return *this; }
operator BaseChannelValue() const { return _value; }
private:
BaseChannelValue _value;
};
Does that goes in your direction?
Regards,
Christian
On Thu, Nov 26, 2009 at 5:24 AM, Eloi Du Bois
Hi,
I have a stream with 8.8 (16b) channels encoded with fixed point arithmetics (http://knol.google.com/k/anonymous/fixed-point-arithmetic/1b19ktdbl6g9q/2#) and I need to create a rgb16 view that can hold my image... I tried with interleaved_view but this makes wrong values. I don't know how to manage with this... How must be encoded the shorts in a rgb16_image_t ?
If anyone could help me, that would be great.
Thanks, Eloi.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Christian Henning
-
Eloi Du Bois