Boost logo

Boost :

From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2020-01-18 23:02:14


Hi,

I've got a quiz for detectives keen in GIL code history :-)

There was this change

- typedef typename detail::min_fast_uint<bit_size>::type bitfield_t;
+ typedef typename detail::min_fast_uint<bit_size+7>::type bitfield_t;

committed in long time ago
https://github.com/boostorg/gil/commit/77b9620a8b86598780e445fec3999267a14f8d33#diff-6fc5a534ad0eb2369c09bff568415232R341

Long time ago, the min_fast_uint metafunction was defined as this

https://github.com/boostorg/gil/blame/6ba113bbb4d4ef19b6d9ef7d6dd37cc0c8b1d535/include/boost/gil/channel.hpp#L169-L174

Later, it was re-defined

https://github.com/boostorg/gil/blame/4f74f6e3650bc68a816f11100479f1ade77f8072/include/boost/gil/channel.hpp#L215-L224

Hint: Operator < vs <=

Question:

Given the current definition of the min_fast_uint metafunction,
why min_fast_uint needs to round up adding +7 in bit_aligned_image_type?

https://github.com/boostorg/gil/blob/5611bd58071873d6346fe3cc05fe86c72f697717/include/boost/gil/metafunctions.hpp#L455

In other words, why this pixel_t needs 32-bit, as per the current
implementation with +7 above, instead of 16-bit?

using image_t = gil::bit_aligned_image3_type<5, 6, 5, gil::rgb_layout_t>::type;
using pixel_t = i_t::view_t::value_type;

Please, feel free to brainstorm :-)

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net

Boost list run by Boost-Gil-Owners