mirror of
https://github.com/boostorg/gil.git
synced 2026-02-18 14:12:10 +00:00
* Exchanged GIL_FORCEINLINE with BOOST_FORCE_INLINE.
* Eliminated some useless warnings. [SVN r83577]
This commit is contained in:
committed by
Stefan Seefeld
parent
edeee14d4d
commit
2953f97bce
@@ -21,6 +21,7 @@
|
||||
#include <memory>
|
||||
#include <typeinfo>
|
||||
|
||||
#include <boost/config/suffix.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
@@ -99,12 +100,12 @@ template <typename Derived, typename Result=void>
|
||||
struct binary_operation_obj {
|
||||
typedef Result result_type;
|
||||
|
||||
template <typename V1, typename V2> GIL_FORCEINLINE
|
||||
template <typename V1, typename V2> BOOST_FORCEINLINE
|
||||
result_type operator()(const std::pair<const V1*,const V2*>& p) const {
|
||||
return apply(*p.first, *p.second, typename views_are_compatible<V1,V2>::type());
|
||||
}
|
||||
|
||||
template <typename V1, typename V2> GIL_FORCEINLINE
|
||||
template <typename V1, typename V2> BOOST_FORCEINLINE
|
||||
result_type operator()(const V1& v1, const V2& v2) const {
|
||||
return apply(v1, v2, typename views_are_compatible<V1,V2>::type());
|
||||
}
|
||||
@@ -114,19 +115,19 @@ private:
|
||||
|
||||
// dispatch from apply overload to a function with distinct name
|
||||
template <typename V1, typename V2>
|
||||
GIL_FORCEINLINE result_type apply(const V1& v1, const V2& v2, mpl::false_) const {
|
||||
BOOST_FORCEINLINE result_type apply(const V1& v1, const V2& v2, mpl::false_) const {
|
||||
return ((const Derived*)this)->apply_incompatible(v1,v2);
|
||||
}
|
||||
|
||||
// dispatch from apply overload to a function with distinct name
|
||||
template <typename V1, typename V2>
|
||||
GIL_FORCEINLINE result_type apply(const V1& v1, const V2& v2, mpl::true_) const {
|
||||
BOOST_FORCEINLINE result_type apply(const V1& v1, const V2& v2, mpl::true_) const {
|
||||
return ((const Derived*)this)->apply_compatible(v1,v2);
|
||||
}
|
||||
|
||||
// function with distinct name - it can be overloaded by subclasses
|
||||
template <typename V1, typename V2>
|
||||
GIL_FORCEINLINE result_type apply_incompatible(const V1& v1, const V2& v2) const {
|
||||
BOOST_FORCEINLINE result_type apply_incompatible(const V1& v1, const V2& v2) const {
|
||||
throw std::bad_cast();
|
||||
}
|
||||
};
|
||||
@@ -146,7 +147,7 @@ namespace std {
|
||||
/// \ingroup STLOptimizations
|
||||
/// \brief Copy when both src and dst are interleaved and of the same type can be just memmove
|
||||
template<typename T, typename Cs>
|
||||
GIL_FORCEINLINE boost::gil::pixel<T,Cs>*
|
||||
BOOST_FORCEINLINE boost::gil::pixel<T,Cs>*
|
||||
copy(boost::gil::pixel<T,Cs>* first, boost::gil::pixel<T,Cs>* last,
|
||||
boost::gil::pixel<T,Cs>* dst) {
|
||||
return (boost::gil::pixel<T,Cs>*)std::copy((unsigned char*)first,(unsigned char*)last, (unsigned char*)dst);
|
||||
@@ -155,7 +156,7 @@ copy(boost::gil::pixel<T,Cs>* first, boost::gil::pixel<T,Cs>* last,
|
||||
/// \ingroup STLOptimizations
|
||||
/// \brief Copy when both src and dst are interleaved and of the same type can be just memmove
|
||||
template<typename T, typename Cs>
|
||||
GIL_FORCEINLINE boost::gil::pixel<T,Cs>*
|
||||
BOOST_FORCEINLINE boost::gil::pixel<T,Cs>*
|
||||
copy(const boost::gil::pixel<T,Cs>* first, const boost::gil::pixel<T,Cs>* last,
|
||||
boost::gil::pixel<T,Cs>* dst) {
|
||||
return (boost::gil::pixel<T,Cs>*)std::copy((unsigned char*)first,(unsigned char*)last, (unsigned char*)dst);
|
||||
@@ -165,7 +166,7 @@ copy(const boost::gil::pixel<T,Cs>* first, const boost::gil::pixel<T,Cs>* last,
|
||||
namespace boost { namespace gil {
|
||||
namespace detail {
|
||||
template <typename I, typename O> struct copy_fn {
|
||||
GIL_FORCEINLINE I operator()(I first, I last, O dst) const { return std::copy(first,last,dst); }
|
||||
BOOST_FORCEINLINE I operator()(I first, I last, O dst) const { return std::copy(first,last,dst); }
|
||||
};
|
||||
} // namespace detail
|
||||
} } // namespace boost::gil
|
||||
@@ -173,7 +174,7 @@ template <typename I, typename O> struct copy_fn {
|
||||
namespace std {
|
||||
/// \ingroup STLOptimizations
|
||||
/// \brief Copy when both src and dst are planar pointers is copy for each channel
|
||||
template<typename Cs, typename IC1, typename IC2> GIL_FORCEINLINE
|
||||
template<typename Cs, typename IC1, typename IC2> BOOST_FORCEINLINE
|
||||
boost::gil::planar_pixel_iterator<IC2,Cs> copy(boost::gil::planar_pixel_iterator<IC1,Cs> first, boost::gil::planar_pixel_iterator<IC1,Cs> last, boost::gil::planar_pixel_iterator<IC2,Cs> dst) {
|
||||
boost::gil::gil_function_requires<boost::gil::ChannelsCompatibleConcept<typename std::iterator_traits<IC1>::value_type,typename std::iterator_traits<IC2>::value_type> >();
|
||||
static_for_each(first,last,dst,boost::gil::detail::copy_fn<IC1,IC2>());
|
||||
@@ -187,14 +188,14 @@ namespace detail {
|
||||
/// \ingroup CopyPixels
|
||||
template <typename I, typename O>
|
||||
struct copier_n {
|
||||
GIL_FORCEINLINE void operator()(I src, typename std::iterator_traits<I>::difference_type n, O dst) const { std::copy(src,src+n, dst); }
|
||||
BOOST_FORCEINLINE void operator()(I src, typename std::iterator_traits<I>::difference_type n, O dst) const { std::copy(src,src+n, dst); }
|
||||
};
|
||||
|
||||
/// Source range is delimited by image iterators
|
||||
template <typename IL, typename O> // IL Models ConstPixelLocatorConcept, O Models PixelIteratorConcept
|
||||
struct copier_n<iterator_from_2d<IL>,O> {
|
||||
typedef typename std::iterator_traits<iterator_from_2d<IL> >::difference_type diff_t;
|
||||
GIL_FORCEINLINE void operator()(iterator_from_2d<IL> src, diff_t n, O dst) const {
|
||||
BOOST_FORCEINLINE void operator()(iterator_from_2d<IL> src, diff_t n, O dst) const {
|
||||
gil_function_requires<PixelLocatorConcept<IL> >();
|
||||
gil_function_requires<MutablePixelIteratorConcept<O> >();
|
||||
while (n>0) {
|
||||
@@ -213,7 +214,7 @@ struct copier_n<iterator_from_2d<IL>,O> {
|
||||
template <typename I, typename OL> // I Models ConstPixelIteratorConcept, OL Models PixelLocatorConcept
|
||||
struct copier_n<I,iterator_from_2d<OL> > {
|
||||
typedef typename std::iterator_traits<I>::difference_type diff_t;
|
||||
GIL_FORCEINLINE void operator()(I src, diff_t n, iterator_from_2d<OL> dst) const {
|
||||
BOOST_FORCEINLINE void operator()(I src, diff_t n, iterator_from_2d<OL> dst) const {
|
||||
gil_function_requires<PixelIteratorConcept<I> >();
|
||||
gil_function_requires<MutablePixelLocatorConcept<OL> >();
|
||||
while (n>0) {
|
||||
@@ -231,7 +232,7 @@ struct copier_n<I,iterator_from_2d<OL> > {
|
||||
template <typename IL, typename OL>
|
||||
struct copier_n<iterator_from_2d<IL>,iterator_from_2d<OL> > {
|
||||
typedef typename iterator_from_2d<IL>::difference_type diff_t;
|
||||
GIL_FORCEINLINE void operator()(iterator_from_2d<IL> src, diff_t n, iterator_from_2d<OL> dst) const {
|
||||
BOOST_FORCEINLINE void operator()(iterator_from_2d<IL> src, diff_t n, iterator_from_2d<OL> dst) const {
|
||||
gil_function_requires<PixelLocatorConcept<IL> >();
|
||||
gil_function_requires<MutablePixelLocatorConcept<OL> >();
|
||||
if (src.x_pos()!=dst.x_pos() || src.width()!=dst.width()) {
|
||||
@@ -251,7 +252,7 @@ struct copier_n<iterator_from_2d<IL>,iterator_from_2d<OL> > {
|
||||
};
|
||||
|
||||
template <typename SrcIterator, typename DstIterator>
|
||||
GIL_FORCEINLINE DstIterator copy_with_2d_iterators(SrcIterator first, SrcIterator last, DstIterator dst) {
|
||||
BOOST_FORCEINLINE DstIterator copy_with_2d_iterators(SrcIterator first, SrcIterator last, DstIterator dst) {
|
||||
typedef typename SrcIterator::x_iterator src_x_iterator;
|
||||
typedef typename DstIterator::x_iterator dst_x_iterator;
|
||||
|
||||
@@ -277,7 +278,7 @@ namespace std {
|
||||
/// \ingroup STLOptimizations
|
||||
/// \brief std::copy(I1,I1,I2) with I1 and I2 being a iterator_from_2d
|
||||
template <typename IL, typename OL>
|
||||
GIL_FORCEINLINE boost::gil::iterator_from_2d<OL> copy1(boost::gil::iterator_from_2d<IL> first, boost::gil::iterator_from_2d<IL> last, boost::gil::iterator_from_2d<OL> dst) {
|
||||
BOOST_FORCEINLINE boost::gil::iterator_from_2d<OL> copy1(boost::gil::iterator_from_2d<IL> first, boost::gil::iterator_from_2d<IL> last, boost::gil::iterator_from_2d<OL> dst) {
|
||||
return boost::gil::detail::copy_with_2d_iterators(first,last,dst);
|
||||
}
|
||||
} // namespace std
|
||||
@@ -285,7 +286,7 @@ GIL_FORCEINLINE boost::gil::iterator_from_2d<OL> copy1(boost::gil::iterator_from
|
||||
namespace boost { namespace gil {
|
||||
/// \ingroup ImageViewSTLAlgorithmsCopyPixels
|
||||
/// \brief std::copy for image views
|
||||
template <typename View1, typename View2> GIL_FORCEINLINE
|
||||
template <typename View1, typename View2> BOOST_FORCEINLINE
|
||||
void copy_pixels(const View1& src, const View2& dst) {
|
||||
assert(src.dimensions()==dst.dimensions());
|
||||
detail::copy_with_2d_iterators(src.begin(),src.end(),dst.begin());
|
||||
@@ -313,13 +314,13 @@ public:
|
||||
copy_and_convert_pixels_fn() {}
|
||||
copy_and_convert_pixels_fn(CC cc_in) : _cc(cc_in) {}
|
||||
// when the two color spaces are incompatible, a color conversion is performed
|
||||
template <typename V1, typename V2> GIL_FORCEINLINE
|
||||
template <typename V1, typename V2> BOOST_FORCEINLINE
|
||||
result_type apply_incompatible(const V1& src, const V2& dst) const {
|
||||
copy_pixels(color_converted_view<typename V2::value_type>(src,_cc),dst);
|
||||
}
|
||||
|
||||
// If the two color spaces are compatible, copy_and_convert is just copy
|
||||
template <typename V1, typename V2> GIL_FORCEINLINE
|
||||
template <typename V1, typename V2> BOOST_FORCEINLINE
|
||||
result_type apply_compatible(const V1& src, const V2& dst) const {
|
||||
copy_pixels(src,dst);
|
||||
}
|
||||
@@ -328,7 +329,7 @@ public:
|
||||
|
||||
/// \ingroup ImageViewSTLAlgorithmsCopyAndConvertPixels
|
||||
template <typename V1, typename V2,typename CC>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void copy_and_convert_pixels(const V1& src, const V2& dst,CC cc) {
|
||||
detail::copy_and_convert_pixels_fn<CC> ccp(cc);
|
||||
ccp(src,dst);
|
||||
@@ -338,7 +339,7 @@ struct default_color_converter;
|
||||
|
||||
/// \ingroup ImageViewSTLAlgorithmsCopyAndConvertPixels
|
||||
template <typename View1, typename View2>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void copy_and_convert_pixels(const View1& src, const View2& dst) {
|
||||
detail::copy_and_convert_pixels_fn<default_color_converter> ccp;
|
||||
ccp(src,dst);
|
||||
@@ -393,13 +394,13 @@ struct std_fill_t {
|
||||
};
|
||||
/// std::fill for planar iterators
|
||||
template <typename It, typename P>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void fill_aux(It first, It last, const P& p, mpl::true_) {
|
||||
static_for_each(first,last,p,std_fill_t());
|
||||
}
|
||||
/// std::fill for interleaved iterators
|
||||
template <typename It, typename P>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void fill_aux(It first, It last, const P& p,mpl::false_) {
|
||||
std::fill(first,last,p);
|
||||
}
|
||||
@@ -407,7 +408,7 @@ void fill_aux(It first, It last, const P& p,mpl::false_) {
|
||||
|
||||
/// \ingroup ImageViewSTLAlgorithmsFillPixels
|
||||
/// \brief std::fill for image views
|
||||
template <typename View, typename Value> GIL_FORCEINLINE
|
||||
template <typename View, typename Value> BOOST_FORCEINLINE
|
||||
void fill_pixels(const View& img_view, const Value& val) {
|
||||
if (img_view.is_1d_traversable())
|
||||
detail::fill_aux(img_view.begin().x(), img_view.end().x(),
|
||||
@@ -429,7 +430,7 @@ void fill_pixels(const View& img_view, const Value& val) {
|
||||
/// \brief invokes the destructor on every pixel of an image view
|
||||
|
||||
namespace detail {
|
||||
template <typename It> GIL_FORCEINLINE
|
||||
template <typename It> BOOST_FORCEINLINE
|
||||
void destruct_range_impl( It first
|
||||
, It last
|
||||
, typename enable_if< mpl::and_< is_pointer< It >
|
||||
@@ -444,7 +445,7 @@ void destruct_range_impl( It first
|
||||
}
|
||||
}
|
||||
|
||||
template <typename It> GIL_FORCEINLINE
|
||||
template <typename It> BOOST_FORCEINLINE
|
||||
void destruct_range_impl( It
|
||||
, It
|
||||
, typename enable_if< mpl::or_< mpl::not_< is_pointer< It > >
|
||||
@@ -453,7 +454,7 @@ void destruct_range_impl( It
|
||||
>::type* /* ptr */ = 0)
|
||||
{}
|
||||
|
||||
template <typename It> GIL_FORCEINLINE
|
||||
template <typename It> BOOST_FORCEINLINE
|
||||
void destruct_range(It first, It last) {
|
||||
destruct_range_impl( first
|
||||
, last
|
||||
@@ -466,13 +467,13 @@ struct std_destruct_t {
|
||||
|
||||
/// destruct for planar iterators
|
||||
template <typename It>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void destruct_aux(It first, It last, mpl::true_) {
|
||||
static_for_each(first,last,std_destruct_t());
|
||||
}
|
||||
/// destruct for interleaved iterators
|
||||
template <typename It>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void destruct_aux(It first, It last, mpl::false_) {
|
||||
destruct_range(first,last);
|
||||
}
|
||||
@@ -480,7 +481,7 @@ void destruct_aux(It first, It last, mpl::false_) {
|
||||
|
||||
/// \ingroup ImageViewSTLAlgorithmsDestructPixels
|
||||
/// \brief Invokes the in-place destructor on every pixel of the view
|
||||
template <typename View> GIL_FORCEINLINE
|
||||
template <typename View> BOOST_FORCEINLINE
|
||||
void destruct_pixels(const View& img_view) {
|
||||
if (img_view.is_1d_traversable())
|
||||
detail::destruct_aux(img_view.begin().x(), img_view.end().x(),
|
||||
@@ -505,7 +506,7 @@ namespace detail {
|
||||
/// std::uninitialized_fill for planar iterators
|
||||
/// If an exception is thrown destructs any in-place copy-constructed objects
|
||||
template <typename It, typename P>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void uninitialized_fill_aux(It first, It last,
|
||||
const P& p, mpl::true_) {
|
||||
int channel=0;
|
||||
@@ -526,7 +527,7 @@ void uninitialized_fill_aux(It first, It last,
|
||||
/// std::uninitialized_fill for interleaved iterators
|
||||
/// If an exception is thrown destructs any in-place copy-constructed objects
|
||||
template <typename It, typename P>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void uninitialized_fill_aux(It first, It last,
|
||||
const P& p,mpl::false_) {
|
||||
std::uninitialized_fill(first,last,p);
|
||||
@@ -567,7 +568,7 @@ void uninitialized_fill_pixels(const View& img_view, const Value& val) {
|
||||
/// \brief invokes the default constructor on every pixel of an image view
|
||||
|
||||
namespace detail {
|
||||
template <typename It> GIL_FORCEINLINE
|
||||
template <typename It> BOOST_FORCEINLINE
|
||||
void default_construct_range_impl(It first, It last, mpl::true_) {
|
||||
typedef typename std::iterator_traits<It>::value_type value_t;
|
||||
It first1=first;
|
||||
@@ -582,15 +583,15 @@ void default_construct_range_impl(It first, It last, mpl::true_) {
|
||||
}
|
||||
}
|
||||
|
||||
template <typename It> GIL_FORCEINLINE
|
||||
template <typename It> BOOST_FORCEINLINE
|
||||
void default_construct_range_impl(It, It, mpl::false_) {}
|
||||
|
||||
template <typename It> GIL_FORCEINLINE
|
||||
template <typename It> BOOST_FORCEINLINE
|
||||
void default_construct_range(It first, It last) { default_construct_range_impl(first, last, typename is_pointer<It>::type()); }
|
||||
|
||||
/// uninitialized_default_construct for planar iterators
|
||||
template <typename It>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void default_construct_aux(It first, It last, mpl::true_) {
|
||||
int channel=0;
|
||||
try {
|
||||
@@ -608,7 +609,7 @@ void default_construct_aux(It first, It last, mpl::true_) {
|
||||
|
||||
/// uninitialized_default_construct for interleaved iterators
|
||||
template <typename It>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void default_construct_aux(It first, It last, mpl::false_) {
|
||||
default_construct_range(first,last);
|
||||
}
|
||||
@@ -620,7 +621,7 @@ struct has_trivial_pixel_constructor<View, true> : public boost::has_trivial_con
|
||||
} // namespace detail
|
||||
|
||||
namespace detail {
|
||||
template< typename View, bool B > GIL_FORCEINLINE
|
||||
template< typename View, bool B > BOOST_FORCEINLINE
|
||||
void default_construct_pixels_impl( const View& img_view
|
||||
, boost::enable_if< is_same< mpl::bool_< B >
|
||||
, mpl::false_
|
||||
@@ -689,7 +690,7 @@ void default_construct_pixels(const View& img_view) {
|
||||
namespace detail {
|
||||
/// std::uninitialized_copy for pairs of planar iterators
|
||||
template <typename It1, typename It2>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void uninitialized_copy_aux(It1 first1, It1 last1,
|
||||
It2 first2, mpl::true_) {
|
||||
int channel=0;
|
||||
@@ -709,7 +710,7 @@ void uninitialized_copy_aux(It1 first1, It1 last1,
|
||||
}
|
||||
/// std::uninitialized_copy for interleaved or mixed iterators
|
||||
template <typename It1, typename It2>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void uninitialized_copy_aux(It1 first1, It1 last1,
|
||||
It2 first2,mpl::false_) {
|
||||
std::uninitialized_copy(first1,last1,first2);
|
||||
@@ -818,19 +819,19 @@ void generate_pixels(const View& v, F fun) {
|
||||
/// \ingroup ImageViewSTLAlgorithms
|
||||
/// \brief std::equal for image views
|
||||
|
||||
template <typename I1, typename I2> GIL_FORCEINLINE bool equal_n(I1 i1, std::ptrdiff_t n, I2 i2);
|
||||
template <typename I1, typename I2> BOOST_FORCEINLINE bool equal_n(I1 i1, std::ptrdiff_t n, I2 i2);
|
||||
|
||||
namespace detail {
|
||||
template <typename I1, typename I2>
|
||||
struct equal_n_fn {
|
||||
GIL_FORCEINLINE bool operator()(I1 i1, std::ptrdiff_t n, I2 i2) const { return std::equal(i1,i1+n, i2); }
|
||||
BOOST_FORCEINLINE bool operator()(I1 i1, std::ptrdiff_t n, I2 i2) const { return std::equal(i1,i1+n, i2); }
|
||||
};
|
||||
|
||||
/// Equal when both ranges are interleaved and of the same type.
|
||||
/// GIL pixels are bitwise comparable, so memcmp is used. User-defined pixels that are not bitwise comparable need to provide an overload
|
||||
template<typename T, typename Cs>
|
||||
struct equal_n_fn<const pixel<T,Cs>*, const pixel<T,Cs>*> {
|
||||
GIL_FORCEINLINE bool operator()(const pixel<T,Cs>* i1, std::ptrdiff_t n, const pixel<T,Cs>* i2) const {
|
||||
BOOST_FORCEINLINE bool operator()(const pixel<T,Cs>* i1, std::ptrdiff_t n, const pixel<T,Cs>* i2) const {
|
||||
return memcmp(i1, i2, n*sizeof(pixel<T,Cs>))==0;
|
||||
}
|
||||
};
|
||||
@@ -842,7 +843,7 @@ struct equal_n_fn<pixel<T,Cs>*, pixel<T,Cs>*> : equal_n_fn<const pixel<T,Cs>*, c
|
||||
/// User-defined channels that are not bitwise comparable need to provide an overload
|
||||
template<typename IC, typename Cs>
|
||||
struct equal_n_fn<planar_pixel_iterator<IC,Cs>, planar_pixel_iterator<IC,Cs> > {
|
||||
GIL_FORCEINLINE bool operator()(const planar_pixel_iterator<IC,Cs> i1, std::ptrdiff_t n, const planar_pixel_iterator<IC,Cs> i2) const {
|
||||
BOOST_FORCEINLINE bool operator()(const planar_pixel_iterator<IC,Cs> i1, std::ptrdiff_t n, const planar_pixel_iterator<IC,Cs> i2) const {
|
||||
std::ptrdiff_t numBytes=n*sizeof(typename std::iterator_traits<IC>::value_type);
|
||||
|
||||
for (std::ptrdiff_t i=0; i<mpl::size<Cs>::value; ++i)
|
||||
@@ -855,7 +856,7 @@ struct equal_n_fn<planar_pixel_iterator<IC,Cs>, planar_pixel_iterator<IC,Cs> > {
|
||||
/// Source range is delimited by image iterators
|
||||
template <typename Loc, typename I2> // IL Models ConstPixelLocatorConcept, O Models PixelIteratorConcept
|
||||
struct equal_n_fn<boost::gil::iterator_from_2d<Loc>,I2> {
|
||||
GIL_FORCEINLINE bool operator()(boost::gil::iterator_from_2d<Loc> i1, std::ptrdiff_t n, I2 i2) const {
|
||||
BOOST_FORCEINLINE bool operator()(boost::gil::iterator_from_2d<Loc> i1, std::ptrdiff_t n, I2 i2) const {
|
||||
gil_function_requires<boost::gil::PixelLocatorConcept<Loc> >();
|
||||
gil_function_requires<boost::gil::PixelIteratorConcept<I2> >();
|
||||
while (n>0) {
|
||||
@@ -873,7 +874,7 @@ struct equal_n_fn<boost::gil::iterator_from_2d<Loc>,I2> {
|
||||
/// Destination range is delimited by image iterators
|
||||
template <typename I1, typename Loc> // I Models PixelIteratorConcept, OL Models PixelLocatorConcept
|
||||
struct equal_n_fn<I1,boost::gil::iterator_from_2d<Loc> > {
|
||||
GIL_FORCEINLINE bool operator()(I1 i1, std::ptrdiff_t n, boost::gil::iterator_from_2d<Loc> i2) const {
|
||||
BOOST_FORCEINLINE bool operator()(I1 i1, std::ptrdiff_t n, boost::gil::iterator_from_2d<Loc> i2) const {
|
||||
gil_function_requires<boost::gil::PixelIteratorConcept<I1> >();
|
||||
gil_function_requires<boost::gil::PixelLocatorConcept<Loc> >();
|
||||
while (n>0) {
|
||||
@@ -891,7 +892,7 @@ struct equal_n_fn<I1,boost::gil::iterator_from_2d<Loc> > {
|
||||
/// Both source and destination ranges are delimited by image iterators
|
||||
template <typename Loc1, typename Loc2>
|
||||
struct equal_n_fn<boost::gil::iterator_from_2d<Loc1>,boost::gil::iterator_from_2d<Loc2> > {
|
||||
GIL_FORCEINLINE bool operator()(boost::gil::iterator_from_2d<Loc1> i1, std::ptrdiff_t n, boost::gil::iterator_from_2d<Loc2> i2) const {
|
||||
BOOST_FORCEINLINE bool operator()(boost::gil::iterator_from_2d<Loc1> i1, std::ptrdiff_t n, boost::gil::iterator_from_2d<Loc2> i2) const {
|
||||
gil_function_requires<boost::gil::PixelLocatorConcept<Loc1> >();
|
||||
gil_function_requires<boost::gil::PixelLocatorConcept<Loc2> >();
|
||||
if (i1.x_pos()!=i2.x_pos() || i1.width()!=i2.width()) {
|
||||
@@ -912,7 +913,7 @@ struct equal_n_fn<boost::gil::iterator_from_2d<Loc1>,boost::gil::iterator_from_2
|
||||
};
|
||||
} // namespace detail
|
||||
|
||||
template <typename I1, typename I2> GIL_FORCEINLINE
|
||||
template <typename I1, typename I2> BOOST_FORCEINLINE
|
||||
bool equal_n(I1 i1, std::ptrdiff_t n, I2 i2) {
|
||||
return detail::equal_n_fn<I1,I2>()(i1,n,i2);
|
||||
}
|
||||
@@ -930,7 +931,7 @@ namespace std {
|
||||
/// pixel iterator that does not check for the end of rows. If the underlying pixel iterator
|
||||
/// happens to be a fundamental planar/interleaved pointer, the call may further resolve
|
||||
/// to memcmp. Otherwise it resolves to copying each row using the underlying pixel iterator
|
||||
template <typename Loc1, typename Loc2> GIL_FORCEINLINE
|
||||
template <typename Loc1, typename Loc2> BOOST_FORCEINLINE
|
||||
bool equal(boost::gil::iterator_from_2d<Loc1> first, boost::gil::iterator_from_2d<Loc1> last, boost::gil::iterator_from_2d<Loc2> first2) {
|
||||
boost::gil::gil_function_requires<boost::gil::PixelLocatorConcept<Loc1> >();
|
||||
boost::gil::gil_function_requires<boost::gil::PixelLocatorConcept<Loc2> >();
|
||||
@@ -952,7 +953,7 @@ bool equal(boost::gil::iterator_from_2d<Loc1> first, boost::gil::iterator_from_2
|
||||
namespace boost { namespace gil {
|
||||
/// \ingroup ImageViewSTLAlgorithmsEqualPixels
|
||||
/// \brief std::equal for image views
|
||||
template <typename View1, typename View2> GIL_FORCEINLINE
|
||||
template <typename View1, typename View2> BOOST_FORCEINLINE
|
||||
bool equal_pixels(const View1& v1, const View2& v2) {
|
||||
assert(v1.dimensions()==v2.dimensions());
|
||||
return std::equal(v1.begin(),v1.end(),v2.begin()); // std::equal has overloads with GIL iterators for optimal performance
|
||||
@@ -970,7 +971,7 @@ bool equal_pixels(const View1& v1, const View2& v2) {
|
||||
|
||||
/// \ingroup ImageViewSTLAlgorithmsTransformPixels
|
||||
/// \brief std::transform for image views
|
||||
template <typename View1, typename View2, typename F> GIL_FORCEINLINE
|
||||
template <typename View1, typename View2, typename F> BOOST_FORCEINLINE
|
||||
F transform_pixels(const View1& src,const View2& dst, F fun) {
|
||||
assert(src.dimensions()==dst.dimensions());
|
||||
for (std::ptrdiff_t y=0; y<src.height(); ++y) {
|
||||
@@ -984,7 +985,7 @@ F transform_pixels(const View1& src,const View2& dst, F fun) {
|
||||
|
||||
/// \ingroup ImageViewSTLAlgorithmsTransformPixels
|
||||
/// \brief transform_pixels with two sources
|
||||
template <typename View1, typename View2, typename View3, typename F> GIL_FORCEINLINE
|
||||
template <typename View1, typename View2, typename View3, typename F> BOOST_FORCEINLINE
|
||||
F transform_pixels(const View1& src1, const View2& src2,const View3& dst, F fun) {
|
||||
for (std::ptrdiff_t y=0; y<dst.height(); ++y) {
|
||||
typename View1::x_iterator srcIt1=src1.row_begin(y);
|
||||
@@ -1002,7 +1003,7 @@ F transform_pixels(const View1& src1, const View2& src2,const View3& dst, F fun)
|
||||
|
||||
/// \ingroup ImageViewSTLAlgorithmsTransformPixelPositions
|
||||
/// \brief Like transform_pixels but passes to the function object pixel locators instead of pixel references
|
||||
template <typename View1, typename View2, typename F> GIL_FORCEINLINE
|
||||
template <typename View1, typename View2, typename F> BOOST_FORCEINLINE
|
||||
F transform_pixel_positions(const View1& src,const View2& dst, F fun) {
|
||||
assert(src.dimensions()==dst.dimensions());
|
||||
typename View1::xy_locator loc=src.xy_at(0,0);
|
||||
@@ -1017,7 +1018,7 @@ F transform_pixel_positions(const View1& src,const View2& dst, F fun) {
|
||||
|
||||
/// \ingroup ImageViewSTLAlgorithmsTransformPixelPositions
|
||||
/// \brief transform_pixel_positions with two sources
|
||||
template <typename View1, typename View2, typename View3, typename F> GIL_FORCEINLINE
|
||||
template <typename View1, typename View2, typename View3, typename F> BOOST_FORCEINLINE
|
||||
F transform_pixel_positions(const View1& src1,const View2& src2,const View3& dst, F fun) {
|
||||
assert(src1.dimensions()==dst.dimensions());
|
||||
assert(src2.dimensions()==dst.dimensions());
|
||||
|
||||
@@ -23,7 +23,10 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <boost/config/suffix.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
|
||||
#include "gil_config.hpp"
|
||||
#include "bit_aligned_pixel_reference.hpp"
|
||||
#include "pixel_iterator.hpp"
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <boost/config/suffix.hpp>
|
||||
#include <boost/mpl/accumulate.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
@@ -30,6 +32,7 @@
|
||||
#include <boost/mpl/plus.hpp>
|
||||
#include <boost/mpl/push_back.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
|
||||
#include "gil_config.hpp"
|
||||
#include "pixel.hpp"
|
||||
#include "channel.hpp"
|
||||
|
||||
@@ -26,9 +26,12 @@
|
||||
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/config/suffix.hpp>
|
||||
#include <boost/integer/integer_mask.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
|
||||
#include "gil_config.hpp"
|
||||
#include "utilities.hpp"
|
||||
|
||||
@@ -317,10 +320,10 @@ public:
|
||||
Derived operator++(int) const { Derived tmp=derived(); this->operator++(); return tmp; }
|
||||
Derived operator--(int) const { Derived tmp=derived(); this->operator--(); return tmp; }
|
||||
|
||||
template <typename Scalar2> const Derived& operator+=(Scalar2 v) const { set(get()+v); return derived(); }
|
||||
template <typename Scalar2> const Derived& operator-=(Scalar2 v) const { set(get()-v); return derived(); }
|
||||
template <typename Scalar2> const Derived& operator*=(Scalar2 v) const { set(get()*v); return derived(); }
|
||||
template <typename Scalar2> const Derived& operator/=(Scalar2 v) const { set(get()/v); return derived(); }
|
||||
template <typename Scalar2> const Derived& operator+=(Scalar2 v) const { set( static_cast<integer_t>( get() + v )); return derived(); }
|
||||
template <typename Scalar2> const Derived& operator-=(Scalar2 v) const { set( static_cast<integer_t>( get() - v )); return derived(); }
|
||||
template <typename Scalar2> const Derived& operator*=(Scalar2 v) const { set( static_cast<integer_t>( get() * v )); return derived(); }
|
||||
template <typename Scalar2> const Derived& operator/=(Scalar2 v) const { set( static_cast<integer_t>( get() / v )); return derived(); }
|
||||
|
||||
operator integer_t() const { return get(); }
|
||||
data_ptr_t operator &() const {return _data_ptr;}
|
||||
|
||||
@@ -23,13 +23,15 @@
|
||||
///
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "gil_config.hpp"
|
||||
#include "channel.hpp"
|
||||
#include <boost/config/suffix.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
#include <boost/mpl/less.hpp>
|
||||
#include <boost/mpl/integral_c.hpp>
|
||||
#include <boost/mpl/greater.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
|
||||
#include "gil_config.hpp"
|
||||
#include "channel.hpp"
|
||||
|
||||
namespace boost { namespace gil {
|
||||
|
||||
|
||||
@@ -22,11 +22,14 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cstddef>
|
||||
#include "gil_config.hpp"
|
||||
#include "metafunctions.hpp"
|
||||
|
||||
#include <boost/config/suffix.hpp>
|
||||
#include <boost/mpl/range_c.hpp>
|
||||
#include <boost/mpl/vector_c.hpp>
|
||||
|
||||
#include "gil_config.hpp"
|
||||
#include "metafunctions.hpp"
|
||||
|
||||
namespace boost { namespace gil {
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <boost/config/suffix.hpp>
|
||||
#include <boost/mpl/range_c.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/mpl/vector_c.hpp>
|
||||
|
||||
@@ -23,10 +23,13 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/config/suffix.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/mpl/contains.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
|
||||
#include "gil_config.hpp"
|
||||
#include "gil_concept.hpp"
|
||||
#include "utilities.hpp"
|
||||
@@ -461,19 +464,19 @@ assert(pixel[2] == 10);
|
||||
*/
|
||||
|
||||
template <typename P>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
typename element_const_reference_type<P>::type static_max(const P& p) { return detail::min_max_recur<size<P>::value>::max_(p); }
|
||||
|
||||
template <typename P>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
typename element_reference_type<P>::type static_max( P& p) { return detail::min_max_recur<size<P>::value>::max_(p); }
|
||||
|
||||
template <typename P>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
typename element_const_reference_type<P>::type static_min(const P& p) { return detail::min_max_recur<size<P>::value>::min_(p); }
|
||||
|
||||
template <typename P>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
typename element_reference_type<P>::type static_min( P& p) { return detail::min_max_recur<size<P>::value>::min_(p); }
|
||||
/// \}
|
||||
|
||||
@@ -495,7 +498,7 @@ assert(rgb_red==bgr_red); // operator== invokes static_equal
|
||||
*/
|
||||
|
||||
template <typename P1,typename P2>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion<size<P1>::value>::static_equal(p1,p2); }
|
||||
|
||||
/// \}
|
||||
@@ -518,7 +521,7 @@ assert(rgb_red == bgr_red);
|
||||
*/
|
||||
|
||||
template <typename Src,typename Dst>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void static_copy(const Src& src, Dst& dst) { detail::element_recursion<size<Dst>::value>::static_copy(src,dst); }
|
||||
|
||||
/// \}
|
||||
@@ -537,7 +540,7 @@ assert(p == rgb8_pixel_t(10,10,10));
|
||||
\{
|
||||
*/
|
||||
template <typename P,typename V>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void static_fill(P& p, const V& v) { detail::element_recursion<size<P>::value>::static_fill(p,v); }
|
||||
/// \}
|
||||
|
||||
@@ -563,7 +566,7 @@ assert(p == rgb8_pixel_t(0,1,2));
|
||||
*/
|
||||
|
||||
template <typename P1,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void static_generate(P1& dst,Op op) { detail::element_recursion<size<P1>::value>::static_generate(dst,op); }
|
||||
/// \}
|
||||
|
||||
@@ -597,23 +600,23 @@ assert(result == rgb8_pixel_t(2,4,6));
|
||||
|
||||
//static_transform with one source
|
||||
template <typename Src,typename Dst,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion<size<Dst>::value>::static_transform(src,dst,op); }
|
||||
template <typename Src,typename Dst,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion<size<Dst>::value>::static_transform(src,dst,op); }
|
||||
//static_transform with two sources
|
||||
template <typename P2,typename P3,typename Dst,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion<size<Dst>::value>::static_transform(p2,p3,dst,op); }
|
||||
template <typename P2,typename P3,typename Dst,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion<size<Dst>::value>::static_transform(p2,p3,dst,op); }
|
||||
template <typename P2,typename P3,typename Dst,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion<size<Dst>::value>::static_transform(p2,p3,dst,op); }
|
||||
template <typename P2,typename P3,typename Dst,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion<size<Dst>::value>::static_transform(p2,p3,dst,op); }
|
||||
/// \}
|
||||
|
||||
@@ -646,48 +649,48 @@ assert(p1 == p2);
|
||||
|
||||
//static_for_each with one source
|
||||
template <typename P1,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_for_each( P1& p1, Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,op); }
|
||||
template <typename P1,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_for_each(const P1& p1, Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,op); }
|
||||
//static_for_each with two sources
|
||||
template <typename P1,typename P2,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_for_each(P1& p1, P2& p2, Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,op); }
|
||||
template <typename P1,typename P2,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_for_each(P1& p1,const P2& p2, Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,op); }
|
||||
template <typename P1,typename P2,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_for_each(const P1& p1, P2& p2, Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,op); }
|
||||
template <typename P1,typename P2,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_for_each(const P1& p1,const P2& p2, Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,op); }
|
||||
//static_for_each with three sources
|
||||
template <typename P1,typename P2,typename P3,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_for_each(P1& p1,P2& p2,P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
|
||||
template <typename P1,typename P2,typename P3,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_for_each(P1& p1,P2& p2,const P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
|
||||
template <typename P1,typename P2,typename P3,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_for_each(P1& p1,const P2& p2,P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
|
||||
template <typename P1,typename P2,typename P3,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_for_each(P1& p1,const P2& p2,const P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
|
||||
template <typename P1,typename P2,typename P3,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_for_each(const P1& p1,P2& p2,P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
|
||||
template <typename P1,typename P2,typename P3,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_for_each(const P1& p1,P2& p2,const P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
|
||||
template <typename P1,typename P2,typename P3,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_for_each(const P1& p1,const P2& p2,P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
|
||||
template <typename P1,typename P2,typename P3,typename Op>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
Op static_for_each(const P1& p1,const P2& p2,const P3& p3,Op op) { return detail::element_recursion<size<P1>::value>::static_for_each(p1,p2,p3,op); }
|
||||
///\}
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <boost/config/suffix.hpp>
|
||||
|
||||
#include "gil_config.hpp"
|
||||
#include "channel_algorithm.hpp"
|
||||
#include "pixel.hpp"
|
||||
|
||||
@@ -22,12 +22,15 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/config/suffix.hpp>
|
||||
#include <boost/mpl/range_c.hpp>
|
||||
#include <boost/mpl/vector_c.hpp>
|
||||
|
||||
#include "gil_config.hpp"
|
||||
#include "utilities.hpp"
|
||||
#include "metafunctions.hpp"
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/mpl/range_c.hpp>
|
||||
#include <boost/mpl/vector_c.hpp>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace boost { namespace gil {
|
||||
namespace detail {
|
||||
struct equal_pixels_fn : public binary_operation_obj<equal_pixels_fn,bool> {
|
||||
template <typename V1, typename V2>
|
||||
GIL_FORCEINLINE bool apply_compatible(const V1& v1, const V2& v2) const {
|
||||
BOOST_FORCEINLINE bool apply_compatible(const V1& v1, const V2& v2) const {
|
||||
return equal_pixels(v1,v2);
|
||||
}
|
||||
};
|
||||
@@ -60,7 +60,7 @@ bool equal_pixels(const any_image_view<Types1>& src, const any_image_view<Types2
|
||||
namespace detail {
|
||||
struct copy_pixels_fn : public binary_operation_obj<copy_pixels_fn> {
|
||||
template <typename View1, typename View2>
|
||||
GIL_FORCEINLINE void apply_compatible(const View1& src, const View2& dst) const {
|
||||
BOOST_FORCEINLINE void apply_compatible(const View1& src, const View2& dst) const {
|
||||
copy_pixels(src,dst);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -111,13 +111,13 @@ public:
|
||||
/// \ingroup ImageModel
|
||||
|
||||
/// \brief Returns the non-constant-pixel view of any image. The returned view is any view.
|
||||
template <typename Types> GIL_FORCEINLINE // Models ImageVectorConcept
|
||||
template <typename Types> BOOST_FORCEINLINE // Models ImageVectorConcept
|
||||
typename any_image<Types>::view_t view(any_image<Types>& anyImage) {
|
||||
return apply_operation(anyImage, detail::any_image_get_view<typename any_image<Types>::view_t>());
|
||||
}
|
||||
|
||||
/// \brief Returns the constant-pixel view of any image. The returned view is any view.
|
||||
template <typename Types> GIL_FORCEINLINE // Models ImageVectorConcept
|
||||
template <typename Types> BOOST_FORCEINLINE // Models ImageVectorConcept
|
||||
typename any_image<Types>::const_view_t const_view(const any_image<Types>& anyImage) {
|
||||
return apply_operation(anyImage, detail::any_image_get_const_view<typename any_image<Types>::const_view_t>());
|
||||
}
|
||||
|
||||
@@ -31,21 +31,21 @@ namespace boost { namespace gil {
|
||||
|
||||
/// \ingroup Variant
|
||||
/// \brief Invokes a generic mutable operation (represented as a unary function object) on a variant
|
||||
template <typename Types, typename UnaryOp> GIL_FORCEINLINE
|
||||
template <typename Types, typename UnaryOp> BOOST_FORCEINLINE
|
||||
typename UnaryOp::result_type apply_operation(variant<Types>& arg, UnaryOp op) {
|
||||
return apply_operation_base<Types>(arg._bits, arg._index ,op);
|
||||
}
|
||||
|
||||
/// \ingroup Variant
|
||||
/// \brief Invokes a generic constant operation (represented as a unary function object) on a variant
|
||||
template <typename Types, typename UnaryOp> GIL_FORCEINLINE
|
||||
template <typename Types, typename UnaryOp> BOOST_FORCEINLINE
|
||||
typename UnaryOp::result_type apply_operation(const variant<Types>& arg, UnaryOp op) {
|
||||
return apply_operation_basec<Types>(arg._bits, arg._index ,op);
|
||||
}
|
||||
|
||||
/// \ingroup Variant
|
||||
/// \brief Invokes a generic constant operation (represented as a binary function object) on two variants
|
||||
template <typename Types1, typename Types2, typename BinaryOp> GIL_FORCEINLINE
|
||||
template <typename Types1, typename Types2, typename BinaryOp> BOOST_FORCEINLINE
|
||||
typename BinaryOp::result_type apply_operation(const variant<Types1>& arg1, const variant<Types2>& arg2, BinaryOp op) {
|
||||
return apply_operation_base<Types1,Types2>(arg1._bits, arg1._index, arg2._bits, arg2._index, op);
|
||||
}
|
||||
|
||||
@@ -127,13 +127,13 @@ GIL_GENERATE_APPLY_FWD_OPS(99)
|
||||
|
||||
// unary application
|
||||
template <typename Types, typename Bits, typename Op>
|
||||
typename Op::result_type GIL_FORCEINLINE apply_operation_basec(const Bits& bits, std::size_t index, Op op) {
|
||||
typename Op::result_type BOOST_FORCEINLINE apply_operation_basec(const Bits& bits, std::size_t index, Op op) {
|
||||
return detail::apply_operation_fwd_fn<mpl::size<Types>::value>().template applyc<Types>(bits,index,op);
|
||||
}
|
||||
|
||||
// unary application
|
||||
template <typename Types, typename Bits, typename Op>
|
||||
typename Op::result_type GIL_FORCEINLINE apply_operation_base( Bits& bits, std::size_t index, Op op) {
|
||||
typename Op::result_type BOOST_FORCEINLINE apply_operation_base( Bits& bits, std::size_t index, Op op) {
|
||||
return detail::apply_operation_fwd_fn<mpl::size<Types>::value>().template apply<Types>(bits,index,op);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace detail {
|
||||
|
||||
reduce_bind1(const T2& t2, Op& op) : _t2(t2), _op(op) {}
|
||||
|
||||
template <typename T1> GIL_FORCEINLINE result_type operator()(const T1& t1) { return _op(t1, _t2); }
|
||||
template <typename T1> BOOST_FORCEINLINE result_type operator()(const T1& t1) { return _op(t1, _t2); }
|
||||
};
|
||||
|
||||
template <typename Types1, typename Bits1, typename Op>
|
||||
@@ -160,7 +160,7 @@ namespace detail {
|
||||
|
||||
reduce_bind2(const Bits1& bits1, std::size_t index1, Op& op) : _bits1(bits1), _index1(index1), _op(op) {}
|
||||
|
||||
template <typename T2> GIL_FORCEINLINE result_type operator()(const T2& t2) {
|
||||
template <typename T2> BOOST_FORCEINLINE result_type operator()(const T2& t2) {
|
||||
return apply_operation_basec<Types1>(_bits1, _index1, reduce_bind1<T2,Op>(t2, _op));
|
||||
}
|
||||
};
|
||||
@@ -168,7 +168,7 @@ namespace detail {
|
||||
|
||||
// Binary application by applying on each dimension separately
|
||||
template <typename Types1, typename Types2, typename Bits1, typename Bits2, typename Op>
|
||||
static typename Op::result_type GIL_FORCEINLINE apply_operation_base(const Bits1& bits1, std::size_t index1, const Bits2& bits2, std::size_t index2, Op op) {
|
||||
static typename Op::result_type BOOST_FORCEINLINE apply_operation_base(const Bits1& bits1, std::size_t index1, const Bits2& bits2, std::size_t index2, Op op) {
|
||||
return apply_operation_basec<Types2>(bits2,index2,detail::reduce_bind2<Types1,Bits1,Op>(bits1,index1,op));
|
||||
}
|
||||
|
||||
|
||||
@@ -147,11 +147,11 @@ struct unary_reduce : public unary_reduce_impl<Types,Op> {
|
||||
typedef typename mpl::mapping_vector<reduced_t, unique_t> indices_t;
|
||||
return gil::at_c<indices_t, unsigned short>(index);
|
||||
}
|
||||
template <typename Bits> GIL_FORCEINLINE static typename Op::result_type applyc(const Bits& bits, std::size_t index, Op op) {
|
||||
template <typename Bits> BOOST_FORCEINLINE static typename Op::result_type applyc(const Bits& bits, std::size_t index, Op op) {
|
||||
return apply_operation_basec<unique_t>(bits,map_index(index),op);
|
||||
}
|
||||
|
||||
template <typename Bits> GIL_FORCEINLINE static typename Op::result_type apply(Bits& bits, std::size_t index, Op op) {
|
||||
template <typename Bits> BOOST_FORCEINLINE static typename Op::result_type apply(Bits& bits, std::size_t index, Op op) {
|
||||
return apply_operation_base<unique_t>(bits,map_index(index),op);
|
||||
}
|
||||
};
|
||||
@@ -161,11 +161,11 @@ struct unary_reduce<Types,Op,true> : public unary_reduce_impl<Types,Op> {
|
||||
typedef typename unary_reduce_impl<Types,Op>::unique_t unique_t;
|
||||
static unsigned short inline map_index(std::size_t index) { return 0; }
|
||||
|
||||
template <typename Bits> GIL_FORCEINLINE static typename Op::result_type applyc(const Bits& bits, std::size_t index, Op op) {
|
||||
template <typename Bits> BOOST_FORCEINLINE static typename Op::result_type applyc(const Bits& bits, std::size_t index, Op op) {
|
||||
return op(*gil_reinterpret_cast_c<const typename mpl::front<unique_t>::type*>(&bits));
|
||||
}
|
||||
|
||||
template <typename Bits> GIL_FORCEINLINE static typename Op::result_type apply(Bits& bits, std::size_t index, Op op) {
|
||||
template <typename Bits> BOOST_FORCEINLINE static typename Op::result_type apply(Bits& bits, std::size_t index, Op op) {
|
||||
return op(*gil_reinterpret_cast<typename mpl::front<unique_t>::type*>(&bits));
|
||||
}
|
||||
};
|
||||
@@ -245,17 +245,17 @@ public:
|
||||
};
|
||||
|
||||
template <typename Types, typename UnaryOp>
|
||||
GIL_FORCEINLINE typename UnaryOp::result_type apply_operation(variant<Types>& arg, UnaryOp op) {
|
||||
BOOST_FORCEINLINE typename UnaryOp::result_type apply_operation(variant<Types>& arg, UnaryOp op) {
|
||||
return unary_reduce<Types,UnaryOp>::template apply(arg._bits, arg._index ,op);
|
||||
}
|
||||
|
||||
template <typename Types, typename UnaryOp>
|
||||
GIL_FORCEINLINE typename UnaryOp::result_type apply_operation(const variant<Types>& arg, UnaryOp op) {
|
||||
BOOST_FORCEINLINE typename UnaryOp::result_type apply_operation(const variant<Types>& arg, UnaryOp op) {
|
||||
return unary_reduce<Types,UnaryOp>::template applyc(arg._bits, arg._index ,op);
|
||||
}
|
||||
|
||||
template <typename Types1, typename Types2, typename BinaryOp>
|
||||
GIL_FORCEINLINE typename BinaryOp::result_type apply_operation(const variant<Types1>& arg1, const variant<Types2>& arg2, BinaryOp op) {
|
||||
BOOST_FORCEINLINE typename BinaryOp::result_type apply_operation(const variant<Types1>& arg1, const variant<Types2>& arg2, BinaryOp op) {
|
||||
return binary_reduce<Types1,Types2,BinaryOp>::template apply(arg1._bits, arg1._index, arg2._bits, arg2._index, op);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
T a,b,c,d,e,f;
|
||||
};
|
||||
|
||||
template <typename T> GIL_FORCEINLINE
|
||||
template <typename T> BOOST_FORCEINLINE
|
||||
matrix3x2<T> operator*(const matrix3x2<T>& m1, const matrix3x2<T>& m2) {
|
||||
return matrix3x2<T>(
|
||||
m1.a * m2.a + m1.b * m2.c,
|
||||
@@ -60,7 +60,7 @@ matrix3x2<T> operator*(const matrix3x2<T>& m1, const matrix3x2<T>& m2) {
|
||||
m1.e * m2.b + m1.f * m2.d + m2.f );
|
||||
}
|
||||
|
||||
template <typename T, typename F> GIL_FORCEINLINE
|
||||
template <typename T, typename F> BOOST_FORCEINLINE
|
||||
point2<F> operator*(const point2<T>& p, const matrix3x2<F>& m) {
|
||||
return point2<F>(m.a*p.x + m.c*p.y + m.e, m.b*p.x + m.d*p.y + m.f);
|
||||
}
|
||||
@@ -85,7 +85,7 @@ struct mapping_traits<matrix3x2<F> > {
|
||||
typedef point2<F> result_type;
|
||||
};
|
||||
|
||||
template <typename F, typename F2> GIL_FORCEINLINE
|
||||
template <typename F, typename F2> BOOST_FORCEINLINE
|
||||
point2<F> transform(const matrix3x2<F>& mat, const point2<F2>& src) { return src * mat; }
|
||||
|
||||
} } // namespace boost::gil
|
||||
|
||||
@@ -83,7 +83,7 @@ struct inner_product_k_t<0> {
|
||||
template <std::size_t Size,
|
||||
class _InputIterator1, class _InputIterator2, class _Tp,
|
||||
class _BinaryOperation1, class _BinaryOperation2>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
_Tp inner_product_k(_InputIterator1 __first1,
|
||||
_InputIterator2 __first2,
|
||||
_Tp __init,
|
||||
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
/// \ingroup ImageAlgorithms
|
||||
///correlate a 1D variable-size kernel along the rows of an image
|
||||
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void correlate_rows(const SrcView& src, const Kernel& ker, const DstView& dst,
|
||||
convolve_boundary_option option=convolve_option_extend_zero) {
|
||||
detail::correlate_rows_imp<PixelAccum>(src,ker,dst,option,detail::correlator_n<PixelAccum>(ker.size()));
|
||||
@@ -153,7 +153,7 @@ void correlate_rows(const SrcView& src, const Kernel& ker, const DstView& dst,
|
||||
/// \ingroup ImageAlgorithms
|
||||
///correlate a 1D variable-size kernel along the columns of an image
|
||||
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void correlate_cols(const SrcView& src, const Kernel& ker, const DstView& dst,
|
||||
convolve_boundary_option option=convolve_option_extend_zero) {
|
||||
correlate_rows<PixelAccum>(transposed_view(src),ker,transposed_view(dst),option);
|
||||
@@ -162,7 +162,7 @@ void correlate_cols(const SrcView& src, const Kernel& ker, const DstView& dst,
|
||||
/// \ingroup ImageAlgorithms
|
||||
///convolve a 1D variable-size kernel along the rows of an image
|
||||
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void convolve_rows(const SrcView& src, const Kernel& ker, const DstView& dst,
|
||||
convolve_boundary_option option=convolve_option_extend_zero) {
|
||||
correlate_rows<PixelAccum>(src,reverse_kernel(ker),dst,option);
|
||||
@@ -171,7 +171,7 @@ void convolve_rows(const SrcView& src, const Kernel& ker, const DstView& dst,
|
||||
/// \ingroup ImageAlgorithms
|
||||
///convolve a 1D variable-size kernel along the columns of an image
|
||||
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void convolve_cols(const SrcView& src, const Kernel& ker, const DstView& dst,
|
||||
convolve_boundary_option option=convolve_option_extend_zero) {
|
||||
convolve_rows<PixelAccum>(transposed_view(src),ker,transposed_view(dst),option);
|
||||
@@ -180,7 +180,7 @@ void convolve_cols(const SrcView& src, const Kernel& ker, const DstView& dst,
|
||||
/// \ingroup ImageAlgorithms
|
||||
///correlate a 1D fixed-size kernel along the rows of an image
|
||||
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void correlate_rows_fixed(const SrcView& src, const Kernel& ker, const DstView& dst,
|
||||
convolve_boundary_option option=convolve_option_extend_zero) {
|
||||
detail::correlate_rows_imp<PixelAccum>(src,ker,dst,option,detail::correlator_k<Kernel::static_size,PixelAccum>());
|
||||
@@ -189,7 +189,7 @@ void correlate_rows_fixed(const SrcView& src, const Kernel& ker, const DstView&
|
||||
/// \ingroup ImageAlgorithms
|
||||
///correlate a 1D fixed-size kernel along the columns of an image
|
||||
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void correlate_cols_fixed(const SrcView& src, const Kernel& ker, const DstView& dst,
|
||||
convolve_boundary_option option=convolve_option_extend_zero) {
|
||||
correlate_rows_fixed<PixelAccum>(transposed_view(src),ker,transposed_view(dst),option);
|
||||
@@ -198,7 +198,7 @@ void correlate_cols_fixed(const SrcView& src, const Kernel& ker, const DstView&
|
||||
/// \ingroup ImageAlgorithms
|
||||
///convolve a 1D fixed-size kernel along the rows of an image
|
||||
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void convolve_rows_fixed(const SrcView& src, const Kernel& ker, const DstView& dst,
|
||||
convolve_boundary_option option=convolve_option_extend_zero) {
|
||||
correlate_rows_fixed<PixelAccum>(src,reverse_kernel(ker),dst,option);
|
||||
@@ -207,7 +207,7 @@ void convolve_rows_fixed(const SrcView& src, const Kernel& ker, const DstView& d
|
||||
/// \ingroup ImageAlgorithms
|
||||
///convolve a 1D fixed-size kernel along the columns of an image
|
||||
template <typename PixelAccum,typename SrcView,typename Kernel,typename DstView>
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
void convolve_cols_fixed(const SrcView& src, const Kernel& ker, const DstView& dst,
|
||||
convolve_boundary_option option=convolve_option_extend_zero) {
|
||||
convolve_rows_fixed<PixelAccum>(transposed_view(src),ker,transposed_view(dst),option);
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace detail {
|
||||
Sampler _sampler;
|
||||
resample_pixels_fn(const MapFn& dst_to_src, const Sampler& sampler) : _dst_to_src(dst_to_src), _sampler(sampler) {}
|
||||
|
||||
template <typename SrcView, typename DstView> GIL_FORCEINLINE void apply_compatible(const SrcView& src, const DstView& dst) const {
|
||||
template <typename SrcView, typename DstView> BOOST_FORCEINLINE void apply_compatible(const SrcView& src, const DstView& dst) const {
|
||||
resample_pixels(src, dst, _dst_to_src, _sampler);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -84,7 +84,7 @@ struct default_color_converter_impl< xyz_t, lab_t >
|
||||
{
|
||||
private:
|
||||
/// \ref http://www.brucelindbloom.com/index.html?Eqn_XYZ_to_Lab.html
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
bits32f forward_companding(bits32f value) const
|
||||
{
|
||||
if (value > 216.f/24389.f)
|
||||
|
||||
@@ -55,7 +55,7 @@ template <>
|
||||
struct default_color_converter_impl< rgb_t, xyz_t >
|
||||
{
|
||||
private:
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
bits32f inverse_companding(bits32f sample) const
|
||||
{
|
||||
if ( sample > 0.04045f )
|
||||
@@ -111,7 +111,7 @@ template <>
|
||||
struct default_color_converter_impl<xyz_t,rgb_t>
|
||||
{
|
||||
private:
|
||||
GIL_FORCEINLINE
|
||||
BOOST_FORCEINLINE
|
||||
bits32f companding(bits32f sample) const
|
||||
{
|
||||
if ( sample > 0.0031308f )
|
||||
|
||||
@@ -34,7 +34,7 @@ typedef boost::gil::point2< std::ptrdiff_t > point_t;
|
||||
template< typename Locator >
|
||||
struct subsampled_image_deref_fn
|
||||
{
|
||||
typedef Locator plane_locator_t;
|
||||
typedef gray8_view_t::locator plane_locator_t;
|
||||
|
||||
typedef subsampled_image_deref_fn const_t;
|
||||
typedef typename Locator::value_type value_type;
|
||||
@@ -49,33 +49,56 @@ struct subsampled_image_deref_fn
|
||||
subsampled_image_deref_fn() {}
|
||||
|
||||
/// constructor
|
||||
subsampled_image_deref_fn( const Locator& y_locator
|
||||
, const Locator& v_locator
|
||||
, const Locator& u_locator
|
||||
subsampled_image_deref_fn( const plane_locator_t& y_locator
|
||||
, const plane_locator_t& v_locator
|
||||
, const plane_locator_t& u_locator
|
||||
, const std::size_t ux_ssfactor
|
||||
, const std::size_t uy_ssfactor
|
||||
, const std::size_t vx_ssfactor
|
||||
, const std::size_t vy_ssfactor
|
||||
)
|
||||
: _y_locator( y_locator )
|
||||
, _v_locator( v_locator )
|
||||
, _u_locator( u_locator )
|
||||
: _y_locator ( y_locator )
|
||||
, _v_locator ( v_locator )
|
||||
, _u_locator ( u_locator )
|
||||
, _ux_ssfactor( ux_ssfactor )
|
||||
, _uy_ssfactor( uy_ssfactor )
|
||||
, _vx_ssfactor( vx_ssfactor )
|
||||
, _vy_ssfactor( vy_ssfactor )
|
||||
{}
|
||||
|
||||
/// operator()
|
||||
typename result_type operator()( const point_t& p ) const
|
||||
{
|
||||
boost::uint8 y = _y_locator.xy_at( p );
|
||||
auto y = *_y_locator.xy_at( p );
|
||||
auto v = *_v_locator.xy_at( p.x / _ux_ssfactor, p.y / _uy_ssfactor );
|
||||
auto u = *_u_locator.xy_at( p.x / _vx_ssfactor, p.y / _vy_ssfactor );
|
||||
|
||||
return value_type();
|
||||
return value_type( at_c<0>( y )
|
||||
, at_c<0>( v )
|
||||
, at_c<0>( u )
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
const Locator& y_locator() const { return _y_locator; }
|
||||
const Locator& v_locator() const { return _v_locator; }
|
||||
const Locator& u_locator() const { return _u_locator; }
|
||||
const plane_locator_t& y_locator() const { return _y_locator; }
|
||||
const plane_locator_t& v_locator() const { return _v_locator; }
|
||||
const plane_locator_t& u_locator() const { return _u_locator; }
|
||||
|
||||
const std::size_t ux_ssfactor() const { return ux_ssfactor; }
|
||||
const std::size_t uy_ssfactor() const { return uy_ssfactor; }
|
||||
const std::size_t vx_ssfactor() const { return vx_ssfactor; }
|
||||
const std::size_t vy_ssfactor() const { return vy_ssfactor; }
|
||||
|
||||
private:
|
||||
|
||||
Locator _y_locator;
|
||||
Locator _v_locator;
|
||||
Locator _u_locator;
|
||||
plane_locator_t _y_locator;
|
||||
plane_locator_t _v_locator;
|
||||
plane_locator_t _u_locator;
|
||||
|
||||
std::size_t _ux_ssfactor;
|
||||
std::size_t _uy_ssfactor;
|
||||
std::size_t _vx_ssfactor;
|
||||
std::size_t _vy_ssfactor;
|
||||
};
|
||||
|
||||
|
||||
@@ -135,6 +158,9 @@ public:
|
||||
: image_view< locator_t >( 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() ); }
|
||||
|
||||
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; }
|
||||
@@ -185,7 +211,8 @@ public:
|
||||
typedef typename plane_image_t::const_view_t plane_const_view_t;
|
||||
typedef typename plane_view_t::locator plane_locator_t;
|
||||
|
||||
typedef typename subsampled_image_locator< plane_locator_t >::type locator_t;
|
||||
typedef typename view_type_from_pixel< Pixel >::type pixel_view_t;
|
||||
typedef typename subsampled_image_locator< typename pixel_view_t::locator >::type locator_t;
|
||||
|
||||
typedef typename plane_image_t::coord_t x_coord_t;
|
||||
typedef typename plane_image_t::coord_t y_coord_t;
|
||||
@@ -197,21 +224,20 @@ public:
|
||||
/// constructor
|
||||
subsampled_image( const x_coord_t y_width
|
||||
, const y_coord_t y_height
|
||||
, const x_coord_t v_width
|
||||
, const y_coord_t v_height
|
||||
, const x_coord_t u_width
|
||||
, const y_coord_t u_height
|
||||
, const std::size_t y_alignment = 0
|
||||
, const std::size_t v_alignment = 0
|
||||
, const std::size_t u_alignment = 0
|
||||
)
|
||||
: _y_plane( y_width, y_height, y_alignment, Allocator() )
|
||||
, _v_plane( v_width, v_height, v_alignment, Allocator() )
|
||||
, _u_plane( u_width, u_height, u_alignment, Allocator() )
|
||||
, const std::size_t vx_ssfactor = 2
|
||||
, const std::size_t vy_ssfactor = 2
|
||||
, const std::size_t ux_ssfactor = 2
|
||||
, const std::size_t uy_ssfactor = 2
|
||||
)
|
||||
: _y_plane( y_width, y_height, 0, Allocator() )
|
||||
, _v_plane( y_width / vx_ssfactor, y_height / vy_ssfactor, 0, Allocator() )
|
||||
, _u_plane( y_width / ux_ssfactor, y_height / uy_ssfactor, 0, Allocator() )
|
||||
{
|
||||
init( point_t( y_width, y_height )
|
||||
, point_t( v_width, v_height )
|
||||
, point_t( u_width, u_height )
|
||||
, vx_ssfactor
|
||||
, vy_ssfactor
|
||||
, ux_ssfactor
|
||||
, uy_ssfactor
|
||||
);
|
||||
}
|
||||
|
||||
@@ -221,16 +247,22 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
void init( const point_t& y_dimensions
|
||||
, const point_t& v_dimensions
|
||||
, const point_t& u_dimensions
|
||||
void init( const point_t& y_dimensions
|
||||
, const std::size_t vx_ssfactor
|
||||
, const std::size_t vy_ssfactor
|
||||
, const std::size_t ux_ssfactor
|
||||
, const std::size_t uy_ssfactor
|
||||
)
|
||||
{
|
||||
typedef subsampled_image_deref_fn< plane_locator_t > defer_fn_t;
|
||||
typedef subsampled_image_deref_fn< locator_t > defer_fn_t;
|
||||
|
||||
defer_fn_t deref_fn( view( _y_plane ).xy_at( 0, 0 )
|
||||
, view( _v_plane ).xy_at( 0, 0 )
|
||||
, view( _u_plane ).xy_at( 0, 0 )
|
||||
, vx_ssfactor
|
||||
, vy_ssfactor
|
||||
, ux_ssfactor
|
||||
, uy_ssfactor
|
||||
);
|
||||
|
||||
// init a virtual_2d_locator
|
||||
@@ -239,9 +271,9 @@ private:
|
||||
, deref_fn
|
||||
);
|
||||
|
||||
_view = view_t( y_dimensions
|
||||
, v_dimensions
|
||||
, u_dimensions
|
||||
_view = view_t( _y_plane.dimensions()
|
||||
, _v_plane.dimensions()
|
||||
, _u_plane.dimensions()
|
||||
, locator
|
||||
);
|
||||
}
|
||||
@@ -292,6 +324,71 @@ void fill_pixels( const subsampled_image_view< Locator >& view
|
||||
fill_pixels( view.u_plane_view(), channel_t( at_c<2>( value )));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// \ingroup ImageViewConstructors
|
||||
/// \brief Creates a subsampled view from a raw memory
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
//template< typename Pixel >
|
||||
//typename subsampled_image< Pixel >::view_t subsampled_view( std::size_t y_width
|
||||
// , std::size_t y_height
|
||||
// , unsigned char* y_base
|
||||
// , std::size_t vx_ssfactor = 2
|
||||
// , std::size_t vy_ssfactor = 2
|
||||
// , std::size_t ux_ssfactor = 2
|
||||
// , std::size_t uy_ssfactor = 2
|
||||
// )
|
||||
//{
|
||||
// std::size_t y_channel_size = 1;
|
||||
// std::size_t u_channel_size = 1;
|
||||
//
|
||||
// unsigned char* u_base = y_base + ( y_width * y_height * y_channel_size );
|
||||
// unsigned char* v_base = u_base + ( y_width / ux_ssfactor ) * ( y_height / uy_ssfactor ) * u_channel_size;
|
||||
//
|
||||
// typedef subsampled_image< Pixel >::plane_view_t plane_view_t;
|
||||
//
|
||||
// plane_view_t y_plane = interleaved_view( y_width
|
||||
// , y_height
|
||||
// , (plane_view_t::value_type*) y_base // pixels
|
||||
// , y_width // rowsize_in_bytes
|
||||
// );
|
||||
//
|
||||
// plane_view_t v_plane = interleaved_view( y_width / vx_ssfactor
|
||||
// , y_height / vy_ssfactor
|
||||
// , (plane_view_t::value_type*) v_base // pixels
|
||||
// , y_width // rowsize_in_bytes
|
||||
// );
|
||||
//
|
||||
// plane_view_t u_plane = interleaved_view( y_width / ux_ssfactor
|
||||
// , y_height / uy_ssfactor
|
||||
// , (plane_view_t::value_type*) u_base // pixels
|
||||
// , y_width // rowsize_in_bytes
|
||||
// );
|
||||
//
|
||||
// typedef subsampled_image_deref_fn< subsampled_image< Pixel >::locator_t > defer_fn_t;
|
||||
// defer_fn_t deref_fn( y_plane.xy_at( 0, 0 )
|
||||
// , v_plane.xy_at( 0, 0 )
|
||||
// , u_plane.xy_at( 0, 0 )
|
||||
// , vx_ssfactor
|
||||
// , vy_ssfactor
|
||||
// , ux_ssfactor
|
||||
// , uy_ssfactor
|
||||
// );
|
||||
//
|
||||
//
|
||||
// typedef subsampled_image< Pixel >::locator_t locator_t;
|
||||
// locator_t locator( point_t( 0, 0 ) // p
|
||||
// , point_t( 1, 1 ) // step
|
||||
// , deref_fn
|
||||
// );
|
||||
//
|
||||
// typedef subsampled_image< Pixel >::view_t view_t;
|
||||
// return view_t( point_t( y_width, y_height )
|
||||
// , point_t( y_width / vx_ssfactor, y_height / vy_ssfactor )
|
||||
// , point_t( y_width / ux_ssfactor, y_height / uy_ssfactor )
|
||||
// , locator
|
||||
// );
|
||||
//}
|
||||
|
||||
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
|
||||
@@ -32,6 +32,14 @@
|
||||
#include <boost/mpl/size.hpp>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4510) //default constructor could not be generated
|
||||
#pragma warning(disable:4512) //assignment operator could not be generated
|
||||
#pragma warning(disable:4610) //can never be instantiated - user defined constructor required
|
||||
#endif
|
||||
|
||||
template <typename T> struct channel_traits;
|
||||
template <typename P> struct is_pixel;
|
||||
template <typename dstT, typename srcT>
|
||||
@@ -2183,6 +2191,10 @@ struct ImageConcept {
|
||||
Img img;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
||||
} } // namespace boost::gil
|
||||
|
||||
|
||||
@@ -25,22 +25,6 @@
|
||||
|
||||
#define GIL_VERSION "2.1.2"
|
||||
|
||||
#ifdef _DEBUG
|
||||
# define GIL_FORCEINLINE inline
|
||||
#else
|
||||
#ifdef NDEBUG
|
||||
#if defined(_MSC_VER)
|
||||
# define GIL_FORCEINLINE __forceinline
|
||||
#elif defined(__GNUC__) && __GNUC__ > 3
|
||||
# define GIL_FORCEINLINE inline __attribute__ ((always_inline))
|
||||
#else
|
||||
# define GIL_FORCEINLINE inline
|
||||
#endif
|
||||
#else
|
||||
# define GIL_FORCEINLINE inline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Enable GIL_NONWORD_POINTER_ALIGNMENT_SUPPORTED if your platform supports dereferencing on non-word memory boundary.
|
||||
// Enabling the flag results in performance improvement
|
||||
#if !defined(__hpux) && !defined(sun) && !defined(__sun) && !defined(__osf__)
|
||||
|
||||
@@ -105,7 +105,7 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
GIL_FORCEINLINE void advance(difference_type d) {
|
||||
BOOST_FORCEINLINE void advance(difference_type d) {
|
||||
if (_width==0) return; // unfortunately we need to check for that. Default-constructed images have width of 0 and the code below will throw if executed.
|
||||
point_t delta;
|
||||
if (_coords.x+d>=0) { // not going back to a previous row?
|
||||
|
||||
@@ -81,7 +81,9 @@ struct packed_pixel {
|
||||
}
|
||||
packed_pixel(int chan0, int chan1, int chan2) : _bitfield(0) {
|
||||
BOOST_STATIC_ASSERT((num_channels<packed_pixel>::value==3));
|
||||
gil::at_c<0>(*this)=chan0; gil::at_c<1>(*this)=chan1; gil::at_c<2>(*this)=chan2;
|
||||
gil::at_c<0>(*this) = chan0;
|
||||
gil::at_c<1>(*this) = chan1;
|
||||
gil::at_c<2>(*this) = chan2;
|
||||
}
|
||||
packed_pixel(int chan0, int chan1, int chan2, int chan3) : _bitfield(0) {
|
||||
BOOST_STATIC_ASSERT((num_channels<packed_pixel>::value==4));
|
||||
|
||||
@@ -96,36 +96,36 @@ template <typename T>
|
||||
T point2<T>::* const point2<T>::mem_array[point2<T>::num_dimensions] = { &point2<T>::x, &point2<T>::y };
|
||||
|
||||
/// \ingroup PointModel
|
||||
template <typename T> GIL_FORCEINLINE
|
||||
template <typename T> BOOST_FORCEINLINE
|
||||
bool operator==(const point2<T>& p1, const point2<T>& p2) { return (p1.x==p2.x && p1.y==p2.y); }
|
||||
/// \ingroup PointModel
|
||||
template <typename T> GIL_FORCEINLINE
|
||||
template <typename T> BOOST_FORCEINLINE
|
||||
bool operator!=(const point2<T>& p1, const point2<T>& p2) { return p1.x!=p2.x || p1.y!=p2.y; }
|
||||
/// \ingroup PointModel
|
||||
template <typename T> GIL_FORCEINLINE
|
||||
template <typename T> BOOST_FORCEINLINE
|
||||
point2<T> operator+(const point2<T>& p1, const point2<T>& p2) { return point2<T>(p1.x+p2.x,p1.y+p2.y); }
|
||||
/// \ingroup PointModel
|
||||
template <typename T> GIL_FORCEINLINE
|
||||
template <typename T> BOOST_FORCEINLINE
|
||||
point2<T> operator-(const point2<T>& p) { return point2<T>(-p.x,-p.y); }
|
||||
/// \ingroup PointModel
|
||||
template <typename T> GIL_FORCEINLINE
|
||||
template <typename T> BOOST_FORCEINLINE
|
||||
point2<T> operator-(const point2<T>& p1, const point2<T>& p2) { return point2<T>(p1.x-p2.x,p1.y-p2.y); }
|
||||
/// \ingroup PointModel
|
||||
template <typename T> GIL_FORCEINLINE
|
||||
template <typename T> BOOST_FORCEINLINE
|
||||
point2<double> operator/(const point2<T>& p, double t) { return t==0 ? point2<double>(0,0):point2<double>(p.x/t,p.y/t); }
|
||||
/// \ingroup PointModel
|
||||
template <typename T> GIL_FORCEINLINE
|
||||
template <typename T> BOOST_FORCEINLINE
|
||||
point2<T> operator*(const point2<T>& p, std::ptrdiff_t t) { return point2<T>(p.x*t,p.y*t); }
|
||||
/// \ingroup PointModel
|
||||
template <typename T> GIL_FORCEINLINE
|
||||
template <typename T> BOOST_FORCEINLINE
|
||||
point2<T> operator*(std::ptrdiff_t t, const point2<T>& p) { return point2<T>(p.x*t,p.y*t); }
|
||||
|
||||
/// \ingroup PointModel
|
||||
template <std::size_t K, typename T> GIL_FORCEINLINE
|
||||
template <std::size_t K, typename T> BOOST_FORCEINLINE
|
||||
const T& axis_value(const point2<T>& p) { return p[K]; }
|
||||
|
||||
/// \ingroup PointModel
|
||||
template <std::size_t K, typename T> GIL_FORCEINLINE
|
||||
template <std::size_t K, typename T> BOOST_FORCEINLINE
|
||||
T& axis_value( point2<T>& p) { return p[K]; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -213,10 +213,10 @@ public:
|
||||
};
|
||||
|
||||
// reinterpret_cast is implementation-defined. Static cast is not.
|
||||
template <typename OutPtr, typename In> GIL_FORCEINLINE
|
||||
template <typename OutPtr, typename In> BOOST_FORCEINLINE
|
||||
OutPtr gil_reinterpret_cast( In* p) { return static_cast<OutPtr>(static_cast<void*>(p)); }
|
||||
|
||||
template <typename OutPtr, typename In> GIL_FORCEINLINE
|
||||
template <typename OutPtr, typename In> BOOST_FORCEINLINE
|
||||
const OutPtr gil_reinterpret_cast_c(const In* p) { return static_cast<const OutPtr>(static_cast<const void*>(p)); }
|
||||
|
||||
namespace detail {
|
||||
|
||||
Reference in New Issue
Block a user