update boost

This commit is contained in:
2023-11-24 12:56:13 -06:00
parent cfc99971af
commit 19d727037a
9260 changed files with 849256 additions and 299957 deletions

View File

@@ -12,24 +12,23 @@
#include <boost/gil/color_convert.hpp>
#include <boost/gil/rgba.hpp>
#include <boost/gil/typedefs.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/gil/detail/mp11.hpp>
namespace boost{ namespace gil {
/// \ingroup ColorSpaceModel
using cmyka_t = mpl::vector5<cyan_t, magenta_t, yellow_t, black_t, alpha_t>;
using cmyka_t = mp11::mp_list<cyan_t, magenta_t, yellow_t, black_t, alpha_t>;
/// \ingroup LayoutModel
using cmyka_layout_t = layout<cmyka_t>;
GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, cmyka)
GIL_DEFINE_ALL_TYPEDEFS(8s, int8_t, cmyka)
GIL_DEFINE_ALL_TYPEDEFS(16, uint16_t, cmyka)
GIL_DEFINE_ALL_TYPEDEFS(16s, int16_t, cmyka)
GIL_DEFINE_ALL_TYPEDEFS(32, uint32_t, cmyka)
GIL_DEFINE_ALL_TYPEDEFS(32s, int32_t, cmyka)
GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, cmyka)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, cmyka)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(8s, int8_t, cmyka)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(16, uint16_t, cmyka)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(16s, int16_t, cmyka)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(32, uint32_t, cmyka)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(32s, int32_t, cmyka)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, cmyka)
///// \ingroup ColorConvert
///// \brief Converting CMYKA to any pixel type. Note: Supports homogeneous pixels only.

View File

@@ -12,31 +12,30 @@
#include <boost/gil/gray.hpp>
#include <boost/gil/typedefs.hpp>
#include <boost/mpl/contains.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/gil/detail/mp11.hpp>
namespace boost{ namespace gil {
using gray_alpha_t = mpl::vector2<gray_color_t,alpha_t>;
using gray_alpha_t = mp11::mp_list<gray_color_t,alpha_t>;
using gray_alpha_layout_t = layout<gray_alpha_t>;
using alpha_gray_layout_t = layout<gray_alpha_layout_t, mpl::vector2_c<int,1,0>>;
using alpha_gray_layout_t = layout<gray_alpha_layout_t, mp11::mp_list_c<int,1,0>>;
GIL_DEFINE_BASE_TYPEDEFS(8, uint8_t, alpha_gray)
GIL_DEFINE_BASE_TYPEDEFS(8s, int8_t, alpha_gray)
GIL_DEFINE_BASE_TYPEDEFS(16, uint16_t, alpha_gray)
GIL_DEFINE_BASE_TYPEDEFS(16s, int16_t, alpha_gray)
GIL_DEFINE_BASE_TYPEDEFS(32, uint32_t, alpha_gray)
GIL_DEFINE_BASE_TYPEDEFS(32s, int32_t, alpha_gray)
GIL_DEFINE_BASE_TYPEDEFS(32f, float32_t, alpha_gray)
BOOST_GIL_DEFINE_BASE_TYPEDEFS(8, uint8_t, alpha_gray)
BOOST_GIL_DEFINE_BASE_TYPEDEFS(8s, int8_t, alpha_gray)
BOOST_GIL_DEFINE_BASE_TYPEDEFS(16, uint16_t, alpha_gray)
BOOST_GIL_DEFINE_BASE_TYPEDEFS(16s, int16_t, alpha_gray)
BOOST_GIL_DEFINE_BASE_TYPEDEFS(32, uint32_t, alpha_gray)
BOOST_GIL_DEFINE_BASE_TYPEDEFS(32s, int32_t, alpha_gray)
BOOST_GIL_DEFINE_BASE_TYPEDEFS(32f, float32_t, alpha_gray)
GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, gray_alpha)
GIL_DEFINE_ALL_TYPEDEFS(8s, int8_t, gray_alpha)
GIL_DEFINE_ALL_TYPEDEFS(16, uint16_t, gray_alpha)
GIL_DEFINE_ALL_TYPEDEFS(16s, int16_t, gray_alpha)
GIL_DEFINE_ALL_TYPEDEFS(32, uint32_t, gray_alpha)
GIL_DEFINE_ALL_TYPEDEFS(32s, int32_t, gray_alpha)
GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, gray_alpha)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, gray_alpha)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(8s, int8_t, gray_alpha)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(16, uint16_t, gray_alpha)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(16s, int16_t, gray_alpha)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(32, uint32_t, gray_alpha)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(32s, int32_t, gray_alpha)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, gray_alpha)
/// \ingroup ColorConvert
/// \brief Gray Alpha to RGBA

View File

@@ -10,6 +10,7 @@
#include <boost/gil/color_convert.hpp>
#include <boost/gil/typedefs.hpp>
#include <boost/gil/detail/mp11.hpp>
namespace boost{ namespace gil {
@@ -27,18 +28,18 @@ struct lightness_t {};
/// \}
/// \ingroup ColorSpaceModel
using hsl_t = mpl::vector3
<
hsl_color_space::hue_t,
hsl_color_space::saturation_t,
hsl_color_space::lightness_t
>;
using hsl_t = mp11::mp_list
<
hsl_color_space::hue_t,
hsl_color_space::saturation_t,
hsl_color_space::lightness_t
>;
/// \ingroup LayoutModel
using hsl_layout_t = layout<hsl_t>;
GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, hsl)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, hsl)
/// \ingroup ColorConvert
/// \brief RGB to HSL
@@ -74,6 +75,7 @@ struct default_color_converter_impl< rgb_t, hsl_t >
{
float32_t diff = max_color - min_color;
float32_t sum = max_color + min_color;
// lightness calculation
@@ -83,13 +85,11 @@ struct default_color_converter_impl< rgb_t, hsl_t >
if( lightness < 0.5f )
{
saturation = diff
/ ( min_color + max_color );
saturation = diff / ( sum );
}
else
{
saturation = ( max_color - min_color )
/ ( 2.f - diff );
saturation = diff / ( 2.f - sum );
}
@@ -114,7 +114,7 @@ struct default_color_converter_impl< rgb_t, hsl_t >
{
// max_color is blue
hue = 4.f
+ ( temp_red - temp_blue )
+ ( temp_red - temp_green )
/ diff;
}

View File

@@ -8,12 +8,9 @@
#ifndef BOOST_GIL_EXTENSION_TOOLBOX_COLOR_SPACES_HSV_HPP
#define BOOST_GIL_EXTENSION_TOOLBOX_COLOR_SPACES_HSV_HPP
#include <boost/numeric/conversion/cast.hpp>
#include <boost/gil/color_convert.hpp>
#include <boost/gil/typedefs.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/gil/detail/mp11.hpp>
#include <algorithm>
#include <cmath>
@@ -34,17 +31,17 @@ struct value_t {};
/// \}
/// \ingroup ColorSpaceModel
using hsv_t = mpl::vector3
<
hsv_color_space::hue_t,
hsv_color_space::saturation_t,
hsv_color_space::value_t
>;
using hsv_t = mp11::mp_list
<
hsv_color_space::hue_t,
hsv_color_space::saturation_t,
hsv_color_space::value_t
>;
/// \ingroup LayoutModel
using hsv_layout_t = layout<hsv_t>;
GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, hsv)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, hsv)
/// \ingroup ColorConvert
/// \brief RGB to HSV
@@ -87,7 +84,7 @@ struct default_color_converter_impl< rgb_t, hsv_t >
}
else
{
if( (std::abs)( boost::numeric_cast<float32_t>(temp_red - max_color) ) < 0.0001f )
if( (std::abs)( temp_red - max_color ) < 0.0001f )
{
hue = ( temp_green - temp_blue )
/ diff;
@@ -131,7 +128,7 @@ struct default_color_converter_impl<hsv_t,rgb_t>
float32_t red, green, blue;
//If saturation is 0, the color is a shade of gray
if( abs( get_color( src, saturation_t() )) < 0.0001f )
if (std::abs(get_color(src, saturation_t())) < 0.0001f)
{
// If saturation is 0, the color is a shade of gray
red = get_color( src, value_t() );

View File

@@ -12,8 +12,7 @@
#include <boost/gil/color_convert.hpp>
#include <boost/gil.hpp> // FIXME: Include what you use, not everything, even in extensions!
#include <boost/mpl/vector.hpp>
#include <boost/gil/detail/mp11.hpp>
namespace boost{ namespace gil {
@@ -31,17 +30,17 @@ struct b_color_opponent_t {};
/// \}
/// \ingroup ColorSpaceModel
using lab_t = mpl::vector3
<
lab_color_space::luminance_t,
lab_color_space::a_color_opponent_t,
lab_color_space::b_color_opponent_t
>;
using lab_t = mp11::mp_list
<
lab_color_space::luminance_t,
lab_color_space::a_color_opponent_t,
lab_color_space::b_color_opponent_t
>;
/// \ingroup LayoutModel
using lab_layout_t = layout<lab_t>;
GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, lab)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, lab)
/// \ingroup ColorConvert
/// \brief LAB to XYZ

View File

@@ -10,8 +10,7 @@
#include <boost/gil/color_convert.hpp>
#include <boost/gil/typedefs.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/gil/detail/mp11.hpp>
namespace boost{ namespace gil {
@@ -29,17 +28,17 @@ struct z_t {};
/// \}
/// \ingroup ColorSpaceModel
using xyz_t = mpl::vector3
<
xyz_color_space::x_t,
xyz_color_space::y_t,
xyz_color_space::z_t
>;
using xyz_t = mp11::mp_list
<
xyz_color_space::x_t,
xyz_color_space::y_t,
xyz_color_space::z_t
>;
/// \ingroup LayoutModel
using xyz_layout_t = layout<xyz_t>;
GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, xyz)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(32f, float32_t, xyz)
/// \ingroup ColorConvert
/// \brief RGB to XYZ

View File

@@ -12,16 +12,14 @@
#include <boost/gil/color_convert.hpp>
#include <boost/gil.hpp> // FIXME: Include what you use!
#include <boost/gil/detail/mp11.hpp>
#include <boost/config.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/range_c.hpp>
#include <boost/mpl/vector_c.hpp>
#include <cstdint>
#include <type_traits>
namespace boost{ namespace gil {
namespace boost { namespace gil {
/// \addtogroup ColorNameModel
/// \{
@@ -47,36 +45,38 @@ struct cr_t {};
/// \}
/// \ingroup ColorSpaceModel
using ycbcr_601__t = boost::mpl::vector3
<
ycbcr_601_color_space::y_t,
ycbcr_601_color_space::cb_t,
ycbcr_601_color_space::cr_t>
;
using ycbcr_601__t = mp11::mp_list
<
ycbcr_601_color_space::y_t,
ycbcr_601_color_space::cb_t,
ycbcr_601_color_space::cr_t
>;
/// \ingroup ColorSpaceModel
using ycbcr_709__t = boost::mpl::vector3
<
ycbcr_709_color_space::y_t,
ycbcr_709_color_space::cb_t,
ycbcr_709_color_space::cr_t
>;
using ycbcr_709__t = mp11::mp_list
<
ycbcr_709_color_space::y_t,
ycbcr_709_color_space::cb_t,
ycbcr_709_color_space::cr_t
>;
/// \ingroup LayoutModel
using ycbcr_601__layout_t = boost::gil::layout<ycbcr_601__t>;
using ycbcr_709__layout_t = boost::gil::layout<ycbcr_709__t>;
//The channel depth is ALWAYS 8bits ofr YCbCr!
GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, ycbcr_601_)
GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, ycbcr_709_)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, ycbcr_601_)
BOOST_GIL_DEFINE_ALL_TYPEDEFS(8, uint8_t, ycbcr_709_)
namespace detail {
// Source:boost/algorithm/clamp.hpp
template<typename T>
BOOST_CXX14_CONSTEXPR T const& clamp(T const& val,
typename boost::mpl::identity<T>::type const & lo,
typename boost::mpl::identity<T>::type const & hi)
BOOST_CXX14_CONSTEXPR
T const& clamp(
T const& val,
typename boost::mp11::mp_identity<T>::type const & lo,
typename boost::mp11::mp_identity<T>::type const & hi)
{
// assert ( !p ( hi, lo )); // Can't assert p ( lo, hi ) b/c they might be equal
auto const p = std::less<T>();
@@ -105,8 +105,8 @@ struct default_color_converter_impl<ycbcr_601__t, rgb_t>
using dst_channel_t = typename channel_type<DSTP>::type;
convert(src, dst, typename std::is_same
<
typename mpl::int_<sizeof(dst_channel_t)>::type,
typename mpl::int_<1>::type
std::integral_constant<int, sizeof(dst_channel_t)>,
std::integral_constant<int, 1>
>::type());
}
@@ -118,7 +118,7 @@ private:
>
void convert( const Src_Pixel& src
, Dst_Pixel& dst
, mpl::true_ // is 8 bit channel
, std::true_type // is 8 bit channel
) const
{
using namespace ycbcr_601_color_space;
@@ -149,7 +149,7 @@ private:
>
void convert( const Src_Pixel& src
, Dst_Pixel& dst
, mpl::false_ // is 8 bit channel
, std::false_type // is 8 bit channel
) const
{
using namespace ycbcr_601_color_space;

View File

@@ -10,9 +10,6 @@
#include <boost/gil/extension/dynamic_image/dynamic_image_all.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/size.hpp>
namespace boost { namespace gil {
// need this for various meta functions.

View File

@@ -13,20 +13,24 @@
#include <boost/gil/image.hpp>
#include <boost/gil/point.hpp>
#include <boost/gil/virtual_locator.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/gil/detail/is_channel_integral.hpp>
#include <boost/gil/detail/mp11.hpp>
#include <cstddef>
#include <memory>
namespace boost{ namespace gil {
namespace boost { namespace gil {
template< typename Locator >
struct get_pixel_type_locator : mpl::if_< typename is_bit_aligned< typename Locator::value_type >::type
, typename Locator::reference
, typename Locator::value_type
> {};
struct get_pixel_type_locator
{
using type = mp11::mp_if
<
typename is_bit_aligned<typename Locator::value_type>::type,
typename Locator::reference,
typename Locator::value_type
>;
};
// used for virtual locator
template< typename IndicesLoc
@@ -96,7 +100,7 @@ struct indexed_image_deref_fn : indexed_image_deref_fn_base< IndicesLoc
)
{}
typename base_t::result_type operator()( const point_t& p ) const
typename base_t::result_type operator()( point_t const& p ) const
{
return * this->_palette_loc.xy_at( at_c<0>( *this->_indices_loc.xy_at( p )), 0 );
}
@@ -110,7 +114,7 @@ struct indexed_image_deref_fn
PaletteLoc,
typename std::enable_if
<
std::is_integral<typename IndicesLoc::value_type>::value
detail::is_channel_integral<typename IndicesLoc::value_type>::value
>::type
> : indexed_image_deref_fn_base<IndicesLoc, PaletteLoc>
{
@@ -162,7 +166,7 @@ public:
, _num_colors( 0 )
{}
indexed_image_view( const point_t& dimensions
indexed_image_view( point_t const& dimensions
, std::size_t num_colors
, const Locator& locator
)
@@ -276,7 +280,7 @@ public:
init( point_t( width, height ), num_colors );
}
indexed_image( const point_t& dimensions
indexed_image( point_t const& dimensions
, const std::size_t num_colors = 1
, const std::size_t indices_alignment = 0
, const std::size_t palette_alignment = 0
@@ -319,7 +323,7 @@ public:
private:
void init( const point_t& dimensions
void init( point_t const& dimensions
, const std::size_t num_colors
)
{

View File

@@ -13,17 +13,11 @@
#include <boost/gil/image_view.hpp>
#include <boost/gil/point.hpp>
#include <boost/gil/virtual_locator.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/divides.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/or.hpp>
#include <boost/mpl/vector_c.hpp>
#include <boost/gil/detail/mp11.hpp>
#include <cstddef>
#include <memory>
#include <type_traits>
namespace boost { namespace gil {
@@ -32,41 +26,36 @@ namespace detail {
template< int J, int A, int B>
struct scaling_factors
{
static_assert(mpl::equal_to< mpl::int_< J >, mpl::int_< 4 > >::value, "");
static_assert(std::integral_constant<int, J>::value == 4, "");
static_assert(mpl::or_<mpl::equal_to< mpl::int_<A>, mpl::int_< 4 > >
, mpl::or_< mpl::equal_to< mpl::int_<A>, mpl::int_< 2 > >
, mpl::equal_to< mpl::int_<A>, mpl::int_< 1 > >
>
>::value, "");
static_assert(
std::integral_constant<int, A>::value == 4 ||
std::integral_constant<int, A>::value == 2 ||
std::integral_constant<int, A>::value == 1,
"");
static_assert(mpl::or_< mpl::equal_to< mpl::int_<B>, mpl::int_< 4 > >
, mpl::or_< mpl::equal_to< mpl::int_<B>, mpl::int_< 2 > >
, mpl::or_< mpl::equal_to< mpl::int_<B>, mpl::int_< 1 > >
, mpl::equal_to< mpl::int_<B>, mpl::int_< 0 > >
>
>
>::value, "");
static_assert(
std::integral_constant<int, B>::value == 4 ||
std::integral_constant<int, B>::value == 2 ||
std::integral_constant<int, B>::value == 1 ||
std::integral_constant<int, B>::value == 0,
"");
static constexpr int ss_X =
mpl::divides
<
mpl::int_<J>,
mpl::int_<A>
>::value;
std::integral_constant<int, J>::value / std::integral_constant<int, A>::value;
static constexpr int ss_Y =
mpl::if_
mp11::mp_if_c
<
mpl::equal_to<mpl::int_<B>, mpl::int_<0>>,
mpl::int_<2>,
typename mpl::if_
std::integral_constant<int, B>::value == 0,
std::integral_constant<int, 2>,
mp11::mp_if_c
<
mpl::equal_to<mpl::int_<A>, mpl::int_<B>>,
mpl::int_<1>,
mpl::int_<4>
>::type
>::type::value;
std::integral_constant<int, A>::value == std::integral_constant<int, B>::value,
std::integral_constant<int, 1>,
std::integral_constant<int, 4>
>
>::value;
};
} // namespace detail
@@ -107,13 +96,13 @@ struct subchroma_image_deref_fn
{}
/// operator()
result_type operator()( const point_t& p ) const
result_type operator()( point_t const& p ) const
{
using scaling_factors_t = detail::scaling_factors
<
mpl::at_c<Factors, 0>::type::value,
mpl::at_c<Factors, 1>::type::value,
mpl::at_c<Factors, 2>::type::value
mp11::mp_at_c<Factors, 0>::value,
mp11::mp_at_c<Factors, 1>::value,
mp11::mp_at_c<Factors, 2>::value
>;
plane_locator_t y = _y_locator.xy_at( p );
@@ -215,10 +204,12 @@ struct transposed_type< subchroma_image_locator< Locator, Factors > >
/// \brief A lightweight object that interprets a subchroma image.
///
////////////////////////////////////////////////////////////////////////////////////////
template< typename Locator
, typename Factors = mpl::vector_c< int, 4, 4, 4 >
>
class subchroma_image_view : public image_view< Locator >
template
<
typename Locator,
typename Factors = mp11::mp_list_c<int, 4, 4, 4>
>
class subchroma_image_view : public image_view<Locator>
{
public:
@@ -237,9 +228,9 @@ public:
{}
/// constructor
subchroma_image_view( const point_t& y_dimensions
, const point_t& v_dimensions
, const point_t& u_dimensions
subchroma_image_view( point_t const& y_dimensions
, point_t const& v_dimensions
, point_t const& u_dimensions
, const Locator& locator
)
: image_view< Locator >( y_dimensions, locator )
@@ -254,20 +245,20 @@ public:
: image_view< locator >( v )
{}
const point_t& v_ssfactors() const { return point_t( get_deref_fn().vx_ssfactor(), get_deref_fn().vx_ssfactor() ); }
const point_t& u_ssfactors() const { return point_t( get_deref_fn().ux_ssfactor(), get_deref_fn().ux_ssfactor() ); }
point_t v_ssfactors() const { return point_t( get_deref_fn().vx_ssfactor(), get_deref_fn().vx_ssfactor() ); }
point_t u_ssfactors() const { return point_t( get_deref_fn().ux_ssfactor(), get_deref_fn().ux_ssfactor() ); }
const point_t& y_dimension() const { return _y_dimensions; }
const point_t& v_dimension() const { return _v_dimensions; }
const point_t& u_dimension() const { return _u_dimensions; }
point_t const& y_dimension() const { return _y_dimensions; }
point_t const& v_dimension() const { return _v_dimensions; }
point_t const& u_dimension() const { return _u_dimensions; }
const plane_locator_t& y_plane() const { return get_deref_fn().y_locator(); }
const plane_locator_t& v_plane() const { return get_deref_fn().v_locator(); }
const plane_locator_t& u_plane() const { return get_deref_fn().u_locator(); }
const plane_view_t y_plane_view() const { return plane_view_t( _y_dimensions, y_plane() ); }
const plane_view_t v_plane_view() const { return plane_view_t( _v_dimensions, v_plane() ); }
const plane_view_t u_plane_view() const { return plane_view_t( _u_dimensions, u_plane() ); }
plane_view_t y_plane_view() const { return plane_view_t( _y_dimensions, y_plane() ); }
plane_view_t v_plane_view() const { return plane_view_t( _v_dimensions, v_plane() ); }
plane_view_t u_plane_view() const { return plane_view_t( _u_dimensions, u_plane() ); }
private:
@@ -339,21 +330,27 @@ struct transposed_type< subchroma_image_view< Locator, Factors > >
/// A subchroma image holds a bunch of planes which don't need to have the same resolution.
///
////////////////////////////////////////////////////////////////////////////////////////
template< typename Pixel
, typename Factors = mpl::vector_c< int, 4, 4, 4 >
, typename Allocator = std::allocator< unsigned char >
>
class subchroma_image : public detail::scaling_factors< mpl::at_c< Factors, 0 >::type::value
, mpl::at_c< Factors, 1 >::type::value
, mpl::at_c< Factors, 2 >::type::value
>
template
<
typename Pixel,
typename Factors = mp11::mp_list_c<int, 4, 4, 4>,
typename Allocator = std::allocator<unsigned char>
>
class subchroma_image : public detail::scaling_factors
<
mp11::mp_at_c<Factors, 0>::value,
mp11::mp_at_c<Factors, 1>::value,
mp11::mp_at_c<Factors, 2>::value
>
{
private:
using parent_t = detail::scaling_factors< mpl::at_c< Factors, 0 >::type::value
, mpl::at_c< Factors, 1 >::type::value
, mpl::at_c< Factors, 2 >::type::value
>;
using parent_t = detail::scaling_factors
<
mp11::mp_at_c<Factors, 0>::value,
mp11::mp_at_c<Factors, 1>::value,
mp11::mp_at_c<Factors, 2>::value
>;
public:
@@ -436,19 +433,20 @@ private:
template < typename Pixel, typename Factors, typename Alloc >
struct channel_type< subchroma_image< Pixel, Factors, Alloc > >
: public channel_type< Pixel > {};
: channel_type< Pixel > {};
template < typename Pixel, typename Factors, typename Alloc >
struct color_space_type< subchroma_image< Pixel, Factors, Alloc > >
: public color_space_type< Pixel > {};
: color_space_type< Pixel > {};
template < typename Pixel, typename Factors, typename Alloc >
struct channel_mapping_type< subchroma_image< Pixel, Factors, Alloc > >
: public channel_mapping_type< Pixel > {};
: channel_mapping_type< Pixel > {};
template < typename Pixel, typename Factors, typename Alloc >
struct is_planar< subchroma_image< Pixel, Factors, Alloc > >
: public mpl::bool_< false > {};
: std::integral_constant<bool, false>
{};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -514,9 +512,9 @@ typename subchroma_image< Pixel
{
using scaling_factors_t = detail::scaling_factors
<
mpl::at_c<Factors, 0>::type::value,
mpl::at_c<Factors, 1>::type::value,
mpl::at_c<Factors, 2>::type::value
mp11::mp_at_c<Factors, 0>::type::value,
mp11::mp_at_c<Factors, 1>::type::value,
mp11::mp_at_c<Factors, 2>::type::value
>;
std::size_t y_channel_size = 1;
@@ -527,23 +525,24 @@ typename subchroma_image< Pixel
* u_channel_size;
using plane_view_t = typename subchroma_image<Pixel, Factors>::plane_view_t;
using plane_value_t = typename plane_view_t::value_type;
plane_view_t y_plane = interleaved_view( y_width
, y_height
, (typename plane_view_t::value_type*) y_base // pixels
, y_width // rowsize_in_bytes
, (plane_value_t*) y_base // pixels
, y_width // rowsize_in_bytes
);
plane_view_t v_plane = interleaved_view( y_width / scaling_factors_t::ss_X
, y_height / scaling_factors_t::ss_Y
, (typename plane_view_t::value_type*) v_base // pixels
, y_width // rowsize_in_bytes
, (plane_value_t*) v_base // pixels
, y_width // rowsize_in_bytes
);
plane_view_t u_plane = interleaved_view( y_width / scaling_factors_t::ss_X
, y_height / scaling_factors_t::ss_Y
, (typename plane_view_t::value_type*) u_base // pixels
, y_width // rowsize_in_bytes
, (plane_value_t*) u_base // pixels
, y_width // rowsize_in_bytes
);
using defer_fn_t = subchroma_image_deref_fn

View File

@@ -14,8 +14,8 @@
#include <boost/gil/bit_aligned_pixel_reference.hpp>
#include <boost/gil/channel.hpp>
#include <boost/gil/detail/mp11.hpp>
#include <boost/mpl/at.hpp>
#include <boost/utility/enable_if.hpp> // boost::lazy_enable_if
namespace boost{ namespace gil {
@@ -29,7 +29,7 @@ struct gen_chan_ref
using type = packed_dynamic_channel_reference
<
B,
mpl::at_c<C, 0>::type::value,
mp11::mp_at_c<C, 0>::value,
M
>;
};
@@ -58,27 +58,27 @@ struct gen_chan_ref_p
using type = packed_dynamic_channel_reference
<
B,
get_num_bits<typename mpl::at_c<C, 0>::type>::value,
get_num_bits<mp11::mp_at_c<C, 0>>::value,
true
>;
};
// packed_pixel
template < typename BitField
, typename ChannelRefVec
, typename ChannelRefs
, typename Layout
>
struct channel_type< packed_pixel< BitField
, ChannelRefVec
, ChannelRefs
, Layout
>
> : lazy_enable_if< is_homogeneous< packed_pixel< BitField
, ChannelRefVec
, ChannelRefs
, Layout
>
>
, gen_chan_ref_p< BitField
, ChannelRefVec
, ChannelRefs
, Layout
>
> {};

View File

@@ -13,28 +13,28 @@
namespace boost {
namespace gil {
template < typename Channel
, typename View
>
template <typename Channel, typename View>
struct channel_type_to_index
{
static const int value = detail::type_to_index< typename color_space_type< View >::type // color (mpl::vector)
, Channel // channel type
>::value; //< index of the channel in the color (mpl::vector)
static constexpr int value = detail::type_to_index
<
typename color_space_type<View>::type, // color (Boost.MP11-compatible list)
Channel // channel type
>::value; // index of the channel in the color (Boost.MP11-compatible list)
};
template< typename Channel
, typename View
>
struct channel_view_type : public kth_channel_view_type< channel_type_to_index< Channel
, View
>::value
, View
>
template<typename Channel, typename View>
struct channel_view_type : kth_channel_view_type
<
channel_type_to_index<Channel, View>::value,
View
>
{
static const int index = channel_type_to_index< Channel
, View
>::value;
static constexpr int index = channel_type_to_index
<
Channel,
View
>::value;
using parent_t = kth_channel_view_type<index, View>;
using type = typename parent_t::type;
@@ -46,19 +46,13 @@ struct channel_view_type : public kth_channel_view_type< channel_type_to_index<
};
/// \ingroup ImageViewTransformationsKthChannel
template< typename Channel
, typename View
>
typename channel_view_type< Channel
, View
>::type channel_view( const View& src )
template<typename Channel, typename View>
auto channel_view(View const& src)
-> typename channel_view_type<Channel, View>::type
{
return channel_view_type< Channel
, View
>::make( src );
return channel_view_type<Channel, View>::make(src);
}
} // namespace gil
} // namespace boost
}} // namespace boost::gil
#endif

View File

@@ -9,13 +9,8 @@
#define BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_GET_NUM_BITS_HPP
#include <boost/gil/channel.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/size_t.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/gil/detail/is_channel_integral.hpp>
#include <boost/gil/detail/mp11.hpp>
#include <type_traits>
@@ -24,50 +19,53 @@ namespace boost{ namespace gil {
/// get_num_bits metafunctions
/// \brief Determines the numbers of bits for the given channel type.
template <typename T, class = void >
template <typename T, class = void>
struct get_num_bits;
template< typename B, int I, int S, bool M >
struct get_num_bits< packed_channel_reference< B, I, S, M > > : mpl::int_< S >
template<typename B, int I, int S, bool M>
struct get_num_bits<packed_channel_reference<B, I, S, M>>
: std::integral_constant<int, S>
{};
template< typename B, int I, int S, bool M >
struct get_num_bits< const packed_channel_reference< B, I, S, M > > : mpl::int_< S >
template<typename B, int I, int S, bool M>
struct get_num_bits<packed_channel_reference<B, I, S, M> const>
: std::integral_constant<int, S>
{};
template<typename B, int I, bool M>
struct get_num_bits< packed_dynamic_channel_reference< B, I, M > > : mpl::int_< I >
struct get_num_bits<packed_dynamic_channel_reference<B, I, M>>
: std::integral_constant<int, I>
{};
template<typename B, int I, bool M>
struct get_num_bits< const packed_dynamic_channel_reference< B, I, M > > : mpl::int_< I >
struct get_num_bits<packed_dynamic_channel_reference<B, I, M> const>
: std::integral_constant<int, I>
{};
template< int N >
struct get_num_bits< packed_channel_value< N > > : mpl::int_< N >
template<int N>
struct get_num_bits<packed_channel_value<N>> : std::integral_constant<int, N>
{};
template< int N >
struct get_num_bits< const packed_channel_value< N > > : mpl::int_< N >
template<int N>
struct get_num_bits<packed_channel_value<N> const> : std::integral_constant<int, N>
{};
template <typename T>
struct get_num_bits
<
T,
typename std::enable_if
<
mpl::and_
T,
typename std::enable_if
<
is_integral<T>,
mpl::not_<is_class<T>>
>::value
>::type
> : mpl::size_t<sizeof(T) * 8>
{
};
mp11::mp_and
<
detail::is_channel_integral<T>,
mp11::mp_not<std::is_class<T>>
>::value
>::type
>
: std::integral_constant<std::size_t, sizeof(T) * 8>
{};
} // namespace gil
} // namespace boost
}} // namespace boost::gil
#endif

View File

@@ -11,25 +11,31 @@
#include <boost/gil/extension/toolbox/dynamic_images.hpp>
#include <boost/gil/extension/toolbox/metafunctions/is_bit_aligned.hpp>
#include <boost/gil/detail/mp11.hpp>
namespace boost{ namespace gil {
/// get_pixel_type metafunction
/// \brief Depending on Image this function generates either
/// the pixel type or the reference type in case
/// the image is bit_aligned.
template< typename View >
struct get_pixel_type : mpl::if_< typename is_bit_aligned< typename View::value_type >::type
, typename View::reference
, typename View::value_type
> {};
template<typename View>
struct get_pixel_type
{
using type = mp11::mp_if
<
is_bit_aligned<typename View::value_type>,
typename View::reference,
typename View::value_type
>;
};
template< typename ImageViewTypes >
struct get_pixel_type< any_image_view< ImageViewTypes > >
template<typename ...Views>
struct get_pixel_type<any_image_view<Views...>>
{
using type = any_image_pixel_t;
};
} // namespace gil
} // namespace boost
}} // namespace boost::gil
#endif

View File

@@ -10,27 +10,28 @@
#include <boost/gil/bit_aligned_pixel_reference.hpp>
#include <type_traits>
namespace boost{ namespace gil {
/// is_bit_aligned metafunctions
/// \brief Determines whether the given type is bit_aligned.
template< typename PixelRef >
struct is_bit_aligned : mpl::false_{};
struct is_bit_aligned : std::false_type {};
template <typename B, typename C, typename L, bool M>
struct is_bit_aligned<bit_aligned_pixel_reference<B,C,L,M> > : mpl::true_{};
struct is_bit_aligned<bit_aligned_pixel_reference<B, C, L, M>> : std::true_type {};
template <typename B, typename C, typename L, bool M>
struct is_bit_aligned<const bit_aligned_pixel_reference<B,C,L,M> > : mpl::true_{};
struct is_bit_aligned<bit_aligned_pixel_reference<B, C, L, M> const> : std::true_type {};
template <typename B, typename C, typename L>
struct is_bit_aligned<packed_pixel<B,C,L> > : mpl::true_{};
struct is_bit_aligned<packed_pixel<B, C, L>> : std::true_type {};
template <typename B, typename C, typename L>
struct is_bit_aligned<const packed_pixel<B,C,L> > : mpl::true_{};
struct is_bit_aligned<packed_pixel<B, C, L> const> : std::true_type {};
} // namespace gil
} // namespace boost
}} // namespace boost::gil
#endif

View File

@@ -9,74 +9,91 @@
#define BOOST_GIL_EXTENSION_TOOLBOX_METAFUNCTIONS_IS_HOMOGENEOUS_HPP
#include <boost/gil/pixel.hpp>
#include <boost/gil/detail/mp11.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/at.hpp>
#include <type_traits>
namespace boost{ namespace gil {
/// is_homogeneous metafunctions
/// \brief Determines if a pixel types are homogeneous.
template<typename C,typename CMP, int Next, int Last> struct is_homogeneous_impl;
template<typename C,typename CMP, int Last>
struct is_homogeneous_impl<C,CMP,Last,Last> : mpl::true_{};
template<typename C,typename CMP, int Next, int Last>
struct is_homogeneous_impl : mpl::and_< is_homogeneous_impl< C, CMP,Next + 1, Last >
, is_same< CMP, typename mpl::at_c<C,Next>::type
> > {};
struct is_homogeneous_impl;
template < typename P > struct is_homogeneous : mpl::false_ {};
template<typename C, typename CMP, int Last>
struct is_homogeneous_impl<C, CMP, Last, Last> : std::true_type {};
template<typename C, typename CMP, int Next, int Last>
struct is_homogeneous_impl
: mp11::mp_and
<
is_homogeneous_impl<C, CMP, Next + 1, Last>,
std::is_same<CMP, mp11::mp_at_c<C, Next>>
>
{};
template <typename P>
struct is_homogeneous : std::false_type {};
// pixel
template < typename C, typename L > struct is_homogeneous< pixel<C,L> > : mpl::true_ {};
template < typename C, typename L > struct is_homogeneous<const pixel<C,L> > : mpl::true_ {};
template < typename C, typename L > struct is_homogeneous< pixel<C,L>& > : mpl::true_ {};
template < typename C, typename L > struct is_homogeneous<const pixel<C,L>& > : mpl::true_ {};
template <typename C, typename L>
struct is_homogeneous<pixel<C, L>> : std::true_type {};
template <typename C, typename L >
struct is_homogeneous<pixel<C, L> const> : std::true_type {};
template <typename C, typename L>
struct is_homogeneous<pixel<C, L>&> : std::true_type {};
template <typename C, typename L>
struct is_homogeneous<pixel<C, L> const&> : std::true_type {};
// planar pixel reference
template <typename Channel, typename ColorSpace>
struct is_homogeneous< planar_pixel_reference< Channel, ColorSpace > > : mpl::true_ {};
template <typename Channel, typename ColorSpace>
struct is_homogeneous< const planar_pixel_reference< Channel, ColorSpace > > : mpl::true_ {};
struct is_homogeneous<planar_pixel_reference<Channel, ColorSpace>> : std::true_type {};
template<typename C,typename CMP, int I,int Last>
template <typename Channel, typename ColorSpace>
struct is_homogeneous<planar_pixel_reference<Channel, ColorSpace> const> : std::true_type {};
template<typename C, typename CMP, int I, int Last>
struct is_homogeneous_impl_p {};
// for packed_pixel
template <typename B, typename C, typename L >
struct is_homogeneous<packed_pixel< B, C, L > >
: is_homogeneous_impl_p< C
, typename mpl::at_c< C, 0 >::type
, 1
, mpl::size< C >::value
> {};
template <typename B, typename C, typename L>
struct is_homogeneous<packed_pixel<B, C, L>>
: is_homogeneous_impl_p
<
C,
mp11::mp_at_c<C, 0>,
1,
mp11::mp_size<C>::value
> {};
template< typename B
, typename C
, typename L
>
struct is_homogeneous< const packed_pixel< B, C, L > >
: is_homogeneous_impl_p< C
, typename mpl::at_c<C,0>::type
, 1
, mpl::size< C >::value
> {};
struct is_homogeneous<packed_pixel<B, C, L> const>
: is_homogeneous_impl_p
<
C,
mp11::mp_at_c<C, 0>,
1,
mp11::mp_size<C>::value
> {};
// for bit_aligned_pixel_reference
template <typename B, typename C, typename L, bool M>
struct is_homogeneous<bit_aligned_pixel_reference<B,C,L,M> >
: is_homogeneous_impl<C,typename mpl::at_c<C,0>::type,1,mpl::size<C>::value>
struct is_homogeneous<bit_aligned_pixel_reference<B, C, L, M>>
: is_homogeneous_impl<C, mp11::mp_at_c<C, 0>, 1, mp11::mp_size<C>::value>
{};
template <typename B, typename C, typename L, bool M>
struct is_homogeneous<const bit_aligned_pixel_reference<B,C,L,M> >
: is_homogeneous_impl<C,typename mpl::at_c<C,0>::type,1,mpl::size<C>::value>
struct is_homogeneous<const bit_aligned_pixel_reference<B, C, L, M> >
: is_homogeneous_impl<C, mp11::mp_at_c<C, 0>, 1, mp11::mp_size<C>::value>
{};
} // namespace gil
} // namespace boost
}} // namespace boost::gil
#endif

View File

@@ -10,23 +10,26 @@
#include <boost/gil/channel.hpp>
#include <type_traits>
namespace boost{ namespace gil {
/// is_similar metafunctions
/// \brief Determines if two pixel types are similar.
template< typename A, typename B >
struct is_similar : mpl::false_ {};
template<typename A, typename B>
struct is_similar : std::false_type {};
template<typename A>
struct is_similar< A, A > : mpl::true_ {};
struct is_similar<A, A> : std::true_type {};
template<typename B,int I, int S, bool M, int I2>
struct is_similar< packed_channel_reference< B, I, S, M >
, packed_channel_reference< B, I2, S, M >
> : mpl::true_ {};
struct is_similar
<
packed_channel_reference<B, I, S, M>,
packed_channel_reference<B, I2, S, M>
> : std::true_type {};
} // namespace gil
} // namespace boost
}} // namespace boost::gil
#endif

View File

@@ -11,9 +11,6 @@
#include <boost/gil/bit_aligned_pixel_reference.hpp>
#include <boost/gil/packed_pixel.hpp>
#include <boost/mpl/accumulate.hpp>
#include <boost/mpl/int.hpp>
namespace boost{ namespace gil {
/// pixel_bit_size metafunctions
@@ -23,22 +20,50 @@ namespace boost{ namespace gil {
/// using image_t = bit_aligned_image5_type<16, 16, 16, 8, 8, devicen_layout_t<5>>::type;
/// const int size = pixel_bit_size<image_t::view_t::reference>::value;
/// \endcode
template< typename PixelRef >
struct pixel_bit_size : mpl::int_<0> {};
template< typename PixelRef>
struct pixel_bit_size : std::integral_constant<int, 0> {};
template <typename B, typename C, typename L, bool M>
struct pixel_bit_size<bit_aligned_pixel_reference<B,C,L,M> > : mpl::int_< mpl::accumulate< C, mpl::int_<0>, mpl::plus<mpl::_1, mpl::_2> >::type::value >{};
struct pixel_bit_size<bit_aligned_pixel_reference<B, C, L, M>>
: mp11::mp_fold
<
C,
std::integral_constant<int, 0>,
mp11::mp_plus
>
{};
template <typename B, typename C, typename L, bool M>
struct pixel_bit_size<const bit_aligned_pixel_reference<B,C,L,M> > : mpl::int_< mpl::accumulate< C, mpl::int_<0>, mpl::plus<mpl::_1, mpl::_2> >::type::value >{};
struct pixel_bit_size<bit_aligned_pixel_reference<B, C, L, M> const>
: mp11::mp_fold
<
C,
std::integral_constant<int, 0>,
mp11::mp_plus
>
{};
template <typename B, typename C, typename L>
struct pixel_bit_size<packed_pixel<B,C,L> > : mpl::int_< mpl::accumulate< C, mpl::int_<0>, mpl::plus<mpl::_1, mpl::_2> >::type::value >{};
struct pixel_bit_size<packed_pixel<B, C, L>>
: mp11::mp_fold
<
C,
std::integral_constant<int, 0>,
mp11::mp_plus
>
{};
template <typename B, typename C, typename L>
struct pixel_bit_size<const packed_pixel<B,C,L> > : mpl::int_< mpl::accumulate< C, mpl::int_<0>, mpl::plus<mpl::_1, mpl::_2> >::type::value >{};
struct pixel_bit_size<const packed_pixel<B,C,L> >
: mp11::mp_fold
<
C,
std::integral_constant<int, 0>,
mp11::mp_plus
>
{};
} // namespace gil
} // namespace boost
}} // namespace boost::gil
#endif