/usr/include/boost/gil/io
NameSizeModeActions
base.hpp27990644editdlrm
bit_operations.hpp37640644editdlrm
conversion_policies.hpp29580644editdlrm
device.hpp166890644editdlrm
dynamic_io_new.hpp30790644editdlrm
error.hpp5790644editdlrm
get_reader.hpp39320644editdlrm
get_read_device.hpp14030644editdlrm
get_writer.hpp24520644editdlrm
get_write_device.hpp13350644editdlrm
io.hpp36350644editdlrm
make_backend.hpp36060644editdlrm
make_dynamic_image_reader.hpp44360644editdlrm
make_dynamic_image_writer.hpp53760644editdlrm
make_reader.hpp56700644editdlrm
make_scanline_reader.hpp31080644editdlrm
make_writer.hpp45650644editdlrm
path_spec.hpp39400644editdlrm
reader_base.hpp33230644editdlrm
read_and_convert_image.hpp100300644editdlrm
read_and_convert_view.hpp100670644editdlrm
read_image.hpp100900644editdlrm
read_image_info.hpp38300644editdlrm
read_view.hpp59930644editdlrm
row_buffer_helper.hpp51720644editdlrm
scanline_read_iterator.hpp23330644editdlrm
typedefs.hpp29800644editdlrm
write_view.hpp70950644editdlrm
Edit: /usr/include/boost/gil/io/bit_operations.hpp (3764B)
// // Copyright 2007-2008 Christian Henning, Andreas Pokorny, Lubomir Bourdev // // Distributed under the Boost Software License, Version 1.0 // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt // #ifndef BOOST_GIL_IO_BIT_OPERATIONS_HPP #define BOOST_GIL_IO_BIT_OPERATIONS_HPP #include #include #include #include namespace boost { namespace gil { namespace detail { // 1110 1100 -> 0011 0111 template struct mirror_bits { mirror_bits(bool) {}; void operator()(Buffer&) {} void operator()(byte_t*, std::size_t){} }; // The functor will generate a lookup table since the // mirror operation is quite costly. template struct mirror_bits { mirror_bits(bool apply_operation = true) : apply_operation_(apply_operation) { if(apply_operation_) { byte_t i = 0; do { lookup_[i] = mirror(i); } while (i++ != 255); } } void operator()(Buffer& buffer) { if (apply_operation_) for_each(buffer.begin(), buffer.end(), [this](byte_t& c) { lookup(c); }); } void operator()(byte_t *dst, std::size_t size) { for (std::size_t i = 0; i < size; ++i) { lookup(*dst); ++dst; } } private: void lookup(byte_t& c) { c = lookup_[c]; } static byte_t mirror(byte_t c) { byte_t result = 0; for (int i = 0; i < 8; ++i) { result = result << 1; result |= (c & 1); c = c >> 1; } return result; } std::array lookup_; bool apply_operation_; }; // 0011 1111 -> 1100 0000 template struct negate_bits { void operator()(Buffer&) {}; }; template struct negate_bits { void operator()(Buffer& buffer) { for_each(buffer.begin(), buffer.end(), negate_bits::negate); } void operator()(byte_t* dst, std::size_t size) { for (std::size_t i = 0; i < size; ++i) { negate(*dst); ++dst; } } private: static void negate(byte_t& b) { b = ~b; } }; // 11101100 -> 11001110 template struct swap_half_bytes { void operator()(Buffer&) {}; }; template struct swap_half_bytes { void operator()(Buffer& buffer) { for_each(buffer.begin(), buffer.end(), swap_half_bytes::swap); } void operator()(byte_t* dst, std::size_t size) { for (std::size_t i = 0; i < size; ++i) { swap(*dst); ++dst; } } private: static void swap(byte_t& c) { c = ((c << 4) & 0xF0) | ((c >> 4) & 0x0F); } }; template struct do_nothing { do_nothing() = default; void operator()(Buffer&) {} }; /// Count consecutive zeros on the right template inline unsigned int trailing_zeros(T x) noexcept { unsigned int n = 0; x = ~x & (x - 1); while (x) { n = n + 1; x = x >> 1; } return n; } /// Counts ones in a bit-set template inline unsigned int count_ones(T x) noexcept { unsigned int n = 0; while (x) { // clear the least significant bit set x &= x - 1; ++n; } return n; } }}} // namespace boost::gil::detail #endif