From 2953f97bce1083dbfe2a9c1981c3a90e900d2f99 Mon Sep 17 00:00:00 2001 From: Christian Henning Date: Tue, 26 Mar 2013 00:58:48 +0000 Subject: [PATCH] * Exchanged GIL_FORCEINLINE with BOOST_FORCE_INLINE. * Eliminated some useless warnings. [SVN r83577] --- include/boost/gil/algorithm.hpp | 107 +++++------ .../boost/gil/bit_aligned_pixel_iterator.hpp | 3 + .../boost/gil/bit_aligned_pixel_reference.hpp | 3 + include/boost/gil/channel.hpp | 11 +- include/boost/gil/channel_algorithm.hpp | 8 +- include/boost/gil/cmyk.hpp | 7 +- include/boost/gil/color_base.hpp | 2 + include/boost/gil/color_base_algorithm.hpp | 59 +++--- include/boost/gil/color_convert.hpp | 3 + include/boost/gil/device_n.hpp | 9 +- .../gil/extension/dynamic_image/algorithm.hpp | 4 +- .../gil/extension/dynamic_image/any_image.hpp | 4 +- .../dynamic_image/apply_operation.hpp | 6 +- .../dynamic_image/apply_operation_base.hpp | 10 +- .../gil/extension/dynamic_image/reduce.hpp | 14 +- .../boost/gil/extension/numeric/affine.hpp | 6 +- .../boost/gil/extension/numeric/algorithm.hpp | 2 +- .../boost/gil/extension/numeric/convolve.hpp | 16 +- .../boost/gil/extension/numeric/resample.hpp | 2 +- .../extension/toolbox/color_spaces/lab.hpp | 2 +- .../extension/toolbox/color_spaces/xyz.hpp | 4 +- .../toolbox/image_types/subsampled_image.hpp | 169 ++++++++++++++---- include/boost/gil/gil_concept.hpp | 12 ++ include/boost/gil/gil_config.hpp | 16 -- include/boost/gil/iterator_from_2d.hpp | 2 +- include/boost/gil/packed_pixel.hpp | 4 +- include/boost/gil/utilities.hpp | 24 +-- 27 files changed, 315 insertions(+), 194 deletions(-) diff --git a/include/boost/gil/algorithm.hpp b/include/boost/gil/algorithm.hpp index 119e50a4e..d2c12124a 100644 --- a/include/boost/gil/algorithm.hpp +++ b/include/boost/gil/algorithm.hpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -99,12 +100,12 @@ template struct binary_operation_obj { typedef Result result_type; - template GIL_FORCEINLINE + template BOOST_FORCEINLINE result_type operator()(const std::pair& p) const { return apply(*p.first, *p.second, typename views_are_compatible::type()); } - template GIL_FORCEINLINE + template BOOST_FORCEINLINE result_type operator()(const V1& v1, const V2& v2) const { return apply(v1, v2, typename views_are_compatible::type()); } @@ -114,19 +115,19 @@ private: // dispatch from apply overload to a function with distinct name template - 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 - 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 - 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 -GIL_FORCEINLINE boost::gil::pixel* +BOOST_FORCEINLINE boost::gil::pixel* copy(boost::gil::pixel* first, boost::gil::pixel* last, boost::gil::pixel* dst) { return (boost::gil::pixel*)std::copy((unsigned char*)first,(unsigned char*)last, (unsigned char*)dst); @@ -155,7 +156,7 @@ copy(boost::gil::pixel* first, boost::gil::pixel* last, /// \ingroup STLOptimizations /// \brief Copy when both src and dst are interleaved and of the same type can be just memmove template -GIL_FORCEINLINE boost::gil::pixel* +BOOST_FORCEINLINE boost::gil::pixel* copy(const boost::gil::pixel* first, const boost::gil::pixel* last, boost::gil::pixel* dst) { return (boost::gil::pixel*)std::copy((unsigned char*)first,(unsigned char*)last, (unsigned char*)dst); @@ -165,7 +166,7 @@ copy(const boost::gil::pixel* first, const boost::gil::pixel* last, namespace boost { namespace gil { namespace detail { template 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 struct copy_fn { namespace std { /// \ingroup STLOptimizations /// \brief Copy when both src and dst are planar pointers is copy for each channel -template GIL_FORCEINLINE +template BOOST_FORCEINLINE boost::gil::planar_pixel_iterator copy(boost::gil::planar_pixel_iterator first, boost::gil::planar_pixel_iterator last, boost::gil::planar_pixel_iterator dst) { boost::gil::gil_function_requires::value_type,typename std::iterator_traits::value_type> >(); static_for_each(first,last,dst,boost::gil::detail::copy_fn()); @@ -187,14 +188,14 @@ namespace detail { /// \ingroup CopyPixels template struct copier_n { - GIL_FORCEINLINE void operator()(I src, typename std::iterator_traits::difference_type n, O dst) const { std::copy(src,src+n, dst); } + BOOST_FORCEINLINE void operator()(I src, typename std::iterator_traits::difference_type n, O dst) const { std::copy(src,src+n, dst); } }; /// Source range is delimited by image iterators template // IL Models ConstPixelLocatorConcept, O Models PixelIteratorConcept struct copier_n,O> { typedef typename std::iterator_traits >::difference_type diff_t; - GIL_FORCEINLINE void operator()(iterator_from_2d src, diff_t n, O dst) const { + BOOST_FORCEINLINE void operator()(iterator_from_2d src, diff_t n, O dst) const { gil_function_requires >(); gil_function_requires >(); while (n>0) { @@ -213,7 +214,7 @@ struct copier_n,O> { template // I Models ConstPixelIteratorConcept, OL Models PixelLocatorConcept struct copier_n > { typedef typename std::iterator_traits::difference_type diff_t; - GIL_FORCEINLINE void operator()(I src, diff_t n, iterator_from_2d
    dst) const { + BOOST_FORCEINLINE void operator()(I src, diff_t n, iterator_from_2d
      dst) const { gil_function_requires >(); gil_function_requires >(); while (n>0) { @@ -231,7 +232,7 @@ struct copier_n > { template struct copier_n,iterator_from_2d
        > { typedef typename iterator_from_2d::difference_type diff_t; - GIL_FORCEINLINE void operator()(iterator_from_2d src, diff_t n, iterator_from_2d
          dst) const { + BOOST_FORCEINLINE void operator()(iterator_from_2d src, diff_t n, iterator_from_2d
            dst) const { gil_function_requires >(); gil_function_requires >(); if (src.x_pos()!=dst.x_pos() || src.width()!=dst.width()) { @@ -251,7 +252,7 @@ struct copier_n,iterator_from_2d
              > { }; template -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 -GIL_FORCEINLINE boost::gil::iterator_from_2d
                copy1(boost::gil::iterator_from_2d first, boost::gil::iterator_from_2d last, boost::gil::iterator_from_2d
                  dst) { +BOOST_FORCEINLINE boost::gil::iterator_from_2d
                    copy1(boost::gil::iterator_from_2d first, boost::gil::iterator_from_2d last, boost::gil::iterator_from_2d
                      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
                        copy1(boost::gil::iterator_from namespace boost { namespace gil { /// \ingroup ImageViewSTLAlgorithmsCopyPixels /// \brief std::copy for image views -template GIL_FORCEINLINE +template 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 GIL_FORCEINLINE + template BOOST_FORCEINLINE result_type apply_incompatible(const V1& src, const V2& dst) const { copy_pixels(color_converted_view(src,_cc),dst); } // If the two color spaces are compatible, copy_and_convert is just copy - template GIL_FORCEINLINE + template 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 -GIL_FORCEINLINE +BOOST_FORCEINLINE void copy_and_convert_pixels(const V1& src, const V2& dst,CC cc) { detail::copy_and_convert_pixels_fn ccp(cc); ccp(src,dst); @@ -338,7 +339,7 @@ struct default_color_converter; /// \ingroup ImageViewSTLAlgorithmsCopyAndConvertPixels template -GIL_FORCEINLINE +BOOST_FORCEINLINE void copy_and_convert_pixels(const View1& src, const View2& dst) { detail::copy_and_convert_pixels_fn ccp; ccp(src,dst); @@ -393,13 +394,13 @@ struct std_fill_t { }; /// std::fill for planar iterators template -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 -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 GIL_FORCEINLINE +template 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 GIL_FORCEINLINE +template 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 GIL_FORCEINLINE +template 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 GIL_FORCEINLINE +template 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 -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 -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 GIL_FORCEINLINE +template 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 -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 -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 GIL_FORCEINLINE +template BOOST_FORCEINLINE void default_construct_range_impl(It first, It last, mpl::true_) { typedef typename std::iterator_traits::value_type value_t; It first1=first; @@ -582,15 +583,15 @@ void default_construct_range_impl(It first, It last, mpl::true_) { } } -template GIL_FORCEINLINE +template BOOST_FORCEINLINE void default_construct_range_impl(It, It, mpl::false_) {} -template GIL_FORCEINLINE +template BOOST_FORCEINLINE void default_construct_range(It first, It last) { default_construct_range_impl(first, last, typename is_pointer::type()); } /// uninitialized_default_construct for planar iterators template -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 -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 : 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 -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 -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 GIL_FORCEINLINE bool equal_n(I1 i1, std::ptrdiff_t n, I2 i2); +template BOOST_FORCEINLINE bool equal_n(I1 i1, std::ptrdiff_t n, I2 i2); namespace detail { template 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 struct equal_n_fn*, const pixel*> { - GIL_FORCEINLINE bool operator()(const pixel* i1, std::ptrdiff_t n, const pixel* i2) const { + BOOST_FORCEINLINE bool operator()(const pixel* i1, std::ptrdiff_t n, const pixel* i2) const { return memcmp(i1, i2, n*sizeof(pixel))==0; } }; @@ -842,7 +843,7 @@ struct equal_n_fn*, pixel*> : equal_n_fn*, c /// User-defined channels that are not bitwise comparable need to provide an overload template struct equal_n_fn, planar_pixel_iterator > { - GIL_FORCEINLINE bool operator()(const planar_pixel_iterator i1, std::ptrdiff_t n, const planar_pixel_iterator i2) const { + BOOST_FORCEINLINE bool operator()(const planar_pixel_iterator i1, std::ptrdiff_t n, const planar_pixel_iterator i2) const { std::ptrdiff_t numBytes=n*sizeof(typename std::iterator_traits::value_type); for (std::ptrdiff_t i=0; i::value; ++i) @@ -855,7 +856,7 @@ struct equal_n_fn, planar_pixel_iterator > { /// Source range is delimited by image iterators template // IL Models ConstPixelLocatorConcept, O Models PixelIteratorConcept struct equal_n_fn,I2> { - GIL_FORCEINLINE bool operator()(boost::gil::iterator_from_2d i1, std::ptrdiff_t n, I2 i2) const { + BOOST_FORCEINLINE bool operator()(boost::gil::iterator_from_2d i1, std::ptrdiff_t n, I2 i2) const { gil_function_requires >(); gil_function_requires >(); while (n>0) { @@ -873,7 +874,7 @@ struct equal_n_fn,I2> { /// Destination range is delimited by image iterators template // I Models PixelIteratorConcept, OL Models PixelLocatorConcept struct equal_n_fn > { - GIL_FORCEINLINE bool operator()(I1 i1, std::ptrdiff_t n, boost::gil::iterator_from_2d i2) const { + BOOST_FORCEINLINE bool operator()(I1 i1, std::ptrdiff_t n, boost::gil::iterator_from_2d i2) const { gil_function_requires >(); gil_function_requires >(); while (n>0) { @@ -891,7 +892,7 @@ struct equal_n_fn > { /// Both source and destination ranges are delimited by image iterators template struct equal_n_fn,boost::gil::iterator_from_2d > { - GIL_FORCEINLINE bool operator()(boost::gil::iterator_from_2d i1, std::ptrdiff_t n, boost::gil::iterator_from_2d i2) const { + BOOST_FORCEINLINE bool operator()(boost::gil::iterator_from_2d i1, std::ptrdiff_t n, boost::gil::iterator_from_2d i2) const { gil_function_requires >(); gil_function_requires >(); if (i1.x_pos()!=i2.x_pos() || i1.width()!=i2.width()) { @@ -912,7 +913,7 @@ struct equal_n_fn,boost::gil::iterator_from_2 }; } // namespace detail -template GIL_FORCEINLINE +template BOOST_FORCEINLINE bool equal_n(I1 i1, std::ptrdiff_t n, I2 i2) { return detail::equal_n_fn()(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 GIL_FORCEINLINE +template BOOST_FORCEINLINE bool equal(boost::gil::iterator_from_2d first, boost::gil::iterator_from_2d last, boost::gil::iterator_from_2d first2) { boost::gil::gil_function_requires >(); boost::gil::gil_function_requires >(); @@ -952,7 +953,7 @@ bool equal(boost::gil::iterator_from_2d first, boost::gil::iterator_from_2 namespace boost { namespace gil { /// \ingroup ImageViewSTLAlgorithmsEqualPixels /// \brief std::equal for image views -template GIL_FORCEINLINE +template 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 GIL_FORCEINLINE +template 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 GIL_FORCEINLINE +template BOOST_FORCEINLINE F transform_pixels(const View1& src1, const View2& src2,const View3& dst, F fun) { for (std::ptrdiff_t y=0; y GIL_FORCEINLINE +template 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 GIL_FORCEINLINE +template 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()); diff --git a/include/boost/gil/bit_aligned_pixel_iterator.hpp b/include/boost/gil/bit_aligned_pixel_iterator.hpp index fd2df7e44..9a960b3f4 100644 --- a/include/boost/gil/bit_aligned_pixel_iterator.hpp +++ b/include/boost/gil/bit_aligned_pixel_iterator.hpp @@ -23,7 +23,10 @@ //////////////////////////////////////////////////////////////////////////////////////// #include + +#include #include + #include "gil_config.hpp" #include "bit_aligned_pixel_reference.hpp" #include "pixel_iterator.hpp" diff --git a/include/boost/gil/bit_aligned_pixel_reference.hpp b/include/boost/gil/bit_aligned_pixel_reference.hpp index a1582a072..b1ffc827b 100644 --- a/include/boost/gil/bit_aligned_pixel_reference.hpp +++ b/include/boost/gil/bit_aligned_pixel_reference.hpp @@ -23,6 +23,8 @@ //////////////////////////////////////////////////////////////////////////////////////// #include + +#include #include #include #include @@ -30,6 +32,7 @@ #include #include #include + #include "gil_config.hpp" #include "pixel.hpp" #include "channel.hpp" diff --git a/include/boost/gil/channel.hpp b/include/boost/gil/channel.hpp index f55be3bed..d0af40440 100644 --- a/include/boost/gil/channel.hpp +++ b/include/boost/gil/channel.hpp @@ -26,9 +26,12 @@ #include #include + #include +#include #include #include + #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 const Derived& operator+=(Scalar2 v) const { set(get()+v); return derived(); } - template const Derived& operator-=(Scalar2 v) const { set(get()-v); return derived(); } - template const Derived& operator*=(Scalar2 v) const { set(get()*v); return derived(); } - template const Derived& operator/=(Scalar2 v) const { set(get()/v); return derived(); } + template const Derived& operator+=(Scalar2 v) const { set( static_cast( get() + v )); return derived(); } + template const Derived& operator-=(Scalar2 v) const { set( static_cast( get() - v )); return derived(); } + template const Derived& operator*=(Scalar2 v) const { set( static_cast( get() * v )); return derived(); } + template const Derived& operator/=(Scalar2 v) const { set( static_cast( get() / v )); return derived(); } operator integer_t() const { return get(); } data_ptr_t operator &() const {return _data_ptr;} diff --git a/include/boost/gil/channel_algorithm.hpp b/include/boost/gil/channel_algorithm.hpp index 1f4a2e2cd..c1b23591d 100644 --- a/include/boost/gil/channel_algorithm.hpp +++ b/include/boost/gil/channel_algorithm.hpp @@ -23,13 +23,15 @@ /// //////////////////////////////////////////////////////////////////////////////////////// -#include "gil_config.hpp" -#include "channel.hpp" +#include +#include #include #include #include #include -#include + +#include "gil_config.hpp" +#include "channel.hpp" namespace boost { namespace gil { diff --git a/include/boost/gil/cmyk.hpp b/include/boost/gil/cmyk.hpp index 06757b027..7c3b1d169 100644 --- a/include/boost/gil/cmyk.hpp +++ b/include/boost/gil/cmyk.hpp @@ -22,11 +22,14 @@ //////////////////////////////////////////////////////////////////////////////////////// #include -#include "gil_config.hpp" -#include "metafunctions.hpp" + +#include #include #include +#include "gil_config.hpp" +#include "metafunctions.hpp" + namespace boost { namespace gil { diff --git a/include/boost/gil/color_base.hpp b/include/boost/gil/color_base.hpp index 028d38fc9..851ccc1bf 100644 --- a/include/boost/gil/color_base.hpp +++ b/include/boost/gil/color_base.hpp @@ -23,6 +23,8 @@ //////////////////////////////////////////////////////////////////////////////////////// #include + +#include #include #include #include diff --git a/include/boost/gil/color_base_algorithm.hpp b/include/boost/gil/color_base_algorithm.hpp index 8b28a595f..170235247 100644 --- a/include/boost/gil/color_base_algorithm.hpp +++ b/include/boost/gil/color_base_algorithm.hpp @@ -23,10 +23,13 @@ //////////////////////////////////////////////////////////////////////////////////////// #include + +#include #include #include #include #include + #include "gil_config.hpp" #include "gil_concept.hpp" #include "utilities.hpp" @@ -461,19 +464,19 @@ assert(pixel[2] == 10); */ template -GIL_FORCEINLINE +BOOST_FORCEINLINE typename element_const_reference_type

                        ::type static_max(const P& p) { return detail::min_max_recur::value>::max_(p); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE typename element_reference_type

                        ::type static_max( P& p) { return detail::min_max_recur::value>::max_(p); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE typename element_const_reference_type

                        ::type static_min(const P& p) { return detail::min_max_recur::value>::min_(p); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE typename element_reference_type

                        ::type static_min( P& p) { return detail::min_max_recur::value>::min_(p); } /// \} @@ -495,7 +498,7 @@ assert(rgb_red==bgr_red); // operator== invokes static_equal */ template -GIL_FORCEINLINE +BOOST_FORCEINLINE bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } /// \} @@ -518,7 +521,7 @@ assert(rgb_red == bgr_red); */ template -GIL_FORCEINLINE +BOOST_FORCEINLINE void static_copy(const Src& src, Dst& dst) { detail::element_recursion::value>::static_copy(src,dst); } /// \} @@ -537,7 +540,7 @@ assert(p == rgb8_pixel_t(10,10,10)); \{ */ template -GIL_FORCEINLINE +BOOST_FORCEINLINE void static_fill(P& p, const V& v) { detail::element_recursion::value>::static_fill(p,v); } /// \} @@ -563,7 +566,7 @@ assert(p == rgb8_pixel_t(0,1,2)); */ template -GIL_FORCEINLINE +BOOST_FORCEINLINE void static_generate(P1& dst,Op op) { detail::element_recursion::value>::static_generate(dst,op); } /// \} @@ -597,23 +600,23 @@ assert(result == rgb8_pixel_t(2,4,6)); //static_transform with one source template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_transform(Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_transform(const Src& src,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(src,dst,op); } //static_transform with two sources template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_transform(P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_transform(P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_transform(const P2& p2,P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_transform(const P2& p2,const P3& p3,Dst& dst,Op op) { return detail::element_recursion::value>::static_transform(p2,p3,dst,op); } /// \} @@ -646,48 +649,48 @@ assert(p1 == p2); //static_for_each with one source template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_for_each( P1& p1, Op op) { return detail::element_recursion::value>::static_for_each(p1,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_for_each(const P1& p1, Op op) { return detail::element_recursion::value>::static_for_each(p1,op); } //static_for_each with two sources template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_for_each(P1& p1, P2& p2, Op op) { return detail::element_recursion::value>::static_for_each(p1,p2,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_for_each(P1& p1,const P2& p2, Op op) { return detail::element_recursion::value>::static_for_each(p1,p2,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_for_each(const P1& p1, P2& p2, Op op) { return detail::element_recursion::value>::static_for_each(p1,p2,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_for_each(const P1& p1,const P2& p2, Op op) { return detail::element_recursion::value>::static_for_each(p1,p2,op); } //static_for_each with three sources template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_for_each(P1& p1,P2& p2,P3& p3,Op op) { return detail::element_recursion::value>::static_for_each(p1,p2,p3,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_for_each(P1& p1,P2& p2,const P3& p3,Op op) { return detail::element_recursion::value>::static_for_each(p1,p2,p3,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_for_each(P1& p1,const P2& p2,P3& p3,Op op) { return detail::element_recursion::value>::static_for_each(p1,p2,p3,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_for_each(P1& p1,const P2& p2,const P3& p3,Op op) { return detail::element_recursion::value>::static_for_each(p1,p2,p3,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_for_each(const P1& p1,P2& p2,P3& p3,Op op) { return detail::element_recursion::value>::static_for_each(p1,p2,p3,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_for_each(const P1& p1,P2& p2,const P3& p3,Op op) { return detail::element_recursion::value>::static_for_each(p1,p2,p3,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_for_each(const P1& p1,const P2& p2,P3& p3,Op op) { return detail::element_recursion::value>::static_for_each(p1,p2,p3,op); } template -GIL_FORCEINLINE +BOOST_FORCEINLINE Op static_for_each(const P1& p1,const P2& p2,const P3& p3,Op op) { return detail::element_recursion::value>::static_for_each(p1,p2,p3,op); } ///\} diff --git a/include/boost/gil/color_convert.hpp b/include/boost/gil/color_convert.hpp index 5d1da3fcb..0742cc39a 100644 --- a/include/boost/gil/color_convert.hpp +++ b/include/boost/gil/color_convert.hpp @@ -25,6 +25,9 @@ //////////////////////////////////////////////////////////////////////////////////////// #include + +#include + #include "gil_config.hpp" #include "channel_algorithm.hpp" #include "pixel.hpp" diff --git a/include/boost/gil/device_n.hpp b/include/boost/gil/device_n.hpp index cf1233430..e9b5ffdc8 100644 --- a/include/boost/gil/device_n.hpp +++ b/include/boost/gil/device_n.hpp @@ -22,12 +22,15 @@ //////////////////////////////////////////////////////////////////////////////////////// #include + +#include +#include +#include +#include + #include "gil_config.hpp" #include "utilities.hpp" #include "metafunctions.hpp" -#include -#include -#include namespace boost { namespace gil { diff --git a/include/boost/gil/extension/dynamic_image/algorithm.hpp b/include/boost/gil/extension/dynamic_image/algorithm.hpp index dffd39991..90048730f 100644 --- a/include/boost/gil/extension/dynamic_image/algorithm.hpp +++ b/include/boost/gil/extension/dynamic_image/algorithm.hpp @@ -30,7 +30,7 @@ namespace boost { namespace gil { namespace detail { struct equal_pixels_fn : public binary_operation_obj { template - 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& src, const any_image_view { template - 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); } }; diff --git a/include/boost/gil/extension/dynamic_image/any_image.hpp b/include/boost/gil/extension/dynamic_image/any_image.hpp index 18e36797e..3c4445ff1 100644 --- a/include/boost/gil/extension/dynamic_image/any_image.hpp +++ b/include/boost/gil/extension/dynamic_image/any_image.hpp @@ -111,13 +111,13 @@ public: /// \ingroup ImageModel /// \brief Returns the non-constant-pixel view of any image. The returned view is any view. -template GIL_FORCEINLINE // Models ImageVectorConcept +template BOOST_FORCEINLINE // Models ImageVectorConcept typename any_image::view_t view(any_image& anyImage) { return apply_operation(anyImage, detail::any_image_get_view::view_t>()); } /// \brief Returns the constant-pixel view of any image. The returned view is any view. -template GIL_FORCEINLINE // Models ImageVectorConcept +template BOOST_FORCEINLINE // Models ImageVectorConcept typename any_image::const_view_t const_view(const any_image& anyImage) { return apply_operation(anyImage, detail::any_image_get_const_view::const_view_t>()); } diff --git a/include/boost/gil/extension/dynamic_image/apply_operation.hpp b/include/boost/gil/extension/dynamic_image/apply_operation.hpp index ed2571391..beb79bad7 100644 --- a/include/boost/gil/extension/dynamic_image/apply_operation.hpp +++ b/include/boost/gil/extension/dynamic_image/apply_operation.hpp @@ -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 GIL_FORCEINLINE +template BOOST_FORCEINLINE typename UnaryOp::result_type apply_operation(variant& arg, UnaryOp op) { return apply_operation_base(arg._bits, arg._index ,op); } /// \ingroup Variant /// \brief Invokes a generic constant operation (represented as a unary function object) on a variant -template GIL_FORCEINLINE +template BOOST_FORCEINLINE typename UnaryOp::result_type apply_operation(const variant& arg, UnaryOp op) { return apply_operation_basec(arg._bits, arg._index ,op); } /// \ingroup Variant /// \brief Invokes a generic constant operation (represented as a binary function object) on two variants -template GIL_FORCEINLINE +template BOOST_FORCEINLINE typename BinaryOp::result_type apply_operation(const variant& arg1, const variant& arg2, BinaryOp op) { return apply_operation_base(arg1._bits, arg1._index, arg2._bits, arg2._index, op); } diff --git a/include/boost/gil/extension/dynamic_image/apply_operation_base.hpp b/include/boost/gil/extension/dynamic_image/apply_operation_base.hpp index e9b1c5a89..2204a93b0 100644 --- a/include/boost/gil/extension/dynamic_image/apply_operation_base.hpp +++ b/include/boost/gil/extension/dynamic_image/apply_operation_base.hpp @@ -127,13 +127,13 @@ GIL_GENERATE_APPLY_FWD_OPS(99) // unary application template -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::value>().template applyc(bits,index,op); } // unary application template -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::value>().template apply(bits,index,op); } @@ -147,7 +147,7 @@ namespace detail { reduce_bind1(const T2& t2, Op& op) : _t2(t2), _op(op) {} - template GIL_FORCEINLINE result_type operator()(const T1& t1) { return _op(t1, _t2); } + template BOOST_FORCEINLINE result_type operator()(const T1& t1) { return _op(t1, _t2); } }; template @@ -160,7 +160,7 @@ namespace detail { reduce_bind2(const Bits1& bits1, std::size_t index1, Op& op) : _bits1(bits1), _index1(index1), _op(op) {} - template GIL_FORCEINLINE result_type operator()(const T2& t2) { + template BOOST_FORCEINLINE result_type operator()(const T2& t2) { return apply_operation_basec(_bits1, _index1, reduce_bind1(t2, _op)); } }; @@ -168,7 +168,7 @@ namespace detail { // Binary application by applying on each dimension separately template -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(bits2,index2,detail::reduce_bind2(bits1,index1,op)); } diff --git a/include/boost/gil/extension/dynamic_image/reduce.hpp b/include/boost/gil/extension/dynamic_image/reduce.hpp index 0c0a5f80a..35cf02670 100644 --- a/include/boost/gil/extension/dynamic_image/reduce.hpp +++ b/include/boost/gil/extension/dynamic_image/reduce.hpp @@ -147,11 +147,11 @@ struct unary_reduce : public unary_reduce_impl { typedef typename mpl::mapping_vector indices_t; return gil::at_c(index); } - template GIL_FORCEINLINE static typename Op::result_type applyc(const Bits& bits, std::size_t index, Op op) { + template BOOST_FORCEINLINE static typename Op::result_type applyc(const Bits& bits, std::size_t index, Op op) { return apply_operation_basec(bits,map_index(index),op); } - template GIL_FORCEINLINE static typename Op::result_type apply(Bits& bits, std::size_t index, Op op) { + template BOOST_FORCEINLINE static typename Op::result_type apply(Bits& bits, std::size_t index, Op op) { return apply_operation_base(bits,map_index(index),op); } }; @@ -161,11 +161,11 @@ struct unary_reduce : public unary_reduce_impl { typedef typename unary_reduce_impl::unique_t unique_t; static unsigned short inline map_index(std::size_t index) { return 0; } - template GIL_FORCEINLINE static typename Op::result_type applyc(const Bits& bits, std::size_t index, Op op) { + template BOOST_FORCEINLINE static typename Op::result_type applyc(const Bits& bits, std::size_t index, Op op) { return op(*gil_reinterpret_cast_c::type*>(&bits)); } - template GIL_FORCEINLINE static typename Op::result_type apply(Bits& bits, std::size_t index, Op op) { + template BOOST_FORCEINLINE static typename Op::result_type apply(Bits& bits, std::size_t index, Op op) { return op(*gil_reinterpret_cast::type*>(&bits)); } }; @@ -245,17 +245,17 @@ public: }; template -GIL_FORCEINLINE typename UnaryOp::result_type apply_operation(variant& arg, UnaryOp op) { +BOOST_FORCEINLINE typename UnaryOp::result_type apply_operation(variant& arg, UnaryOp op) { return unary_reduce::template apply(arg._bits, arg._index ,op); } template -GIL_FORCEINLINE typename UnaryOp::result_type apply_operation(const variant& arg, UnaryOp op) { +BOOST_FORCEINLINE typename UnaryOp::result_type apply_operation(const variant& arg, UnaryOp op) { return unary_reduce::template applyc(arg._bits, arg._index ,op); } template -GIL_FORCEINLINE typename BinaryOp::result_type apply_operation(const variant& arg1, const variant& arg2, BinaryOp op) { +BOOST_FORCEINLINE typename BinaryOp::result_type apply_operation(const variant& arg1, const variant& arg2, BinaryOp op) { return binary_reduce::template apply(arg1._bits, arg1._index, arg2._bits, arg2._index, op); } diff --git a/include/boost/gil/extension/numeric/affine.hpp b/include/boost/gil/extension/numeric/affine.hpp index 6aea7baa7..6a7707006 100644 --- a/include/boost/gil/extension/numeric/affine.hpp +++ b/include/boost/gil/extension/numeric/affine.hpp @@ -49,7 +49,7 @@ public: T a,b,c,d,e,f; }; -template GIL_FORCEINLINE +template BOOST_FORCEINLINE matrix3x2 operator*(const matrix3x2& m1, const matrix3x2& m2) { return matrix3x2( m1.a * m2.a + m1.b * m2.c, @@ -60,7 +60,7 @@ matrix3x2 operator*(const matrix3x2& m1, const matrix3x2& m2) { m1.e * m2.b + m1.f * m2.d + m2.f ); } -template GIL_FORCEINLINE +template BOOST_FORCEINLINE point2 operator*(const point2& p, const matrix3x2& m) { return point2(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 > { typedef point2 result_type; }; -template GIL_FORCEINLINE +template BOOST_FORCEINLINE point2 transform(const matrix3x2& mat, const point2& src) { return src * mat; } } } // namespace boost::gil diff --git a/include/boost/gil/extension/numeric/algorithm.hpp b/include/boost/gil/extension/numeric/algorithm.hpp index 413a9c156..b7c175985 100644 --- a/include/boost/gil/extension/numeric/algorithm.hpp +++ b/include/boost/gil/extension/numeric/algorithm.hpp @@ -83,7 +83,7 @@ struct inner_product_k_t<0> { template -GIL_FORCEINLINE +BOOST_FORCEINLINE _Tp inner_product_k(_InputIterator1 __first1, _InputIterator2 __first2, _Tp __init, diff --git a/include/boost/gil/extension/numeric/convolve.hpp b/include/boost/gil/extension/numeric/convolve.hpp index 5b65cbfc1..9210cf81b 100644 --- a/include/boost/gil/extension/numeric/convolve.hpp +++ b/include/boost/gil/extension/numeric/convolve.hpp @@ -144,7 +144,7 @@ public: /// \ingroup ImageAlgorithms ///correlate a 1D variable-size kernel along the rows of an image template -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(src,ker,dst,option,detail::correlator_n(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 -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(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 -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(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 -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(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 -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(src,ker,dst,option,detail::correlator_k()); @@ -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 -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(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 -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(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 -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(transposed_view(src),ker,transposed_view(dst),option); diff --git a/include/boost/gil/extension/numeric/resample.hpp b/include/boost/gil/extension/numeric/resample.hpp index 9e8556d00..ec619d57a 100644 --- a/include/boost/gil/extension/numeric/resample.hpp +++ b/include/boost/gil/extension/numeric/resample.hpp @@ -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 GIL_FORCEINLINE void apply_compatible(const SrcView& src, const DstView& dst) const { + template BOOST_FORCEINLINE void apply_compatible(const SrcView& src, const DstView& dst) const { resample_pixels(src, dst, _dst_to_src, _sampler); } }; diff --git a/include/boost/gil/extension/toolbox/color_spaces/lab.hpp b/include/boost/gil/extension/toolbox/color_spaces/lab.hpp index 17087e737..18e7bd8ea 100644 --- a/include/boost/gil/extension/toolbox/color_spaces/lab.hpp +++ b/include/boost/gil/extension/toolbox/color_spaces/lab.hpp @@ -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) diff --git a/include/boost/gil/extension/toolbox/color_spaces/xyz.hpp b/include/boost/gil/extension/toolbox/color_spaces/xyz.hpp index 2977c739b..019d9e2a5 100644 --- a/include/boost/gil/extension/toolbox/color_spaces/xyz.hpp +++ b/include/boost/gil/extension/toolbox/color_spaces/xyz.hpp @@ -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 { private: - GIL_FORCEINLINE + BOOST_FORCEINLINE bits32f companding(bits32f sample) const { if ( sample > 0.0031308f ) diff --git a/include/boost/gil/extension/toolbox/image_types/subsampled_image.hpp b/include/boost/gil/extension/toolbox/image_types/subsampled_image.hpp index 6c26d79ae..79a54c279 100644 --- a/include/boost/gil/extension/toolbox/image_types/subsampled_image.hpp +++ b/include/boost/gil/extension/toolbox/image_types/subsampled_image.hpp @@ -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 diff --git a/include/boost/gil/gil_concept.hpp b/include/boost/gil/gil_concept.hpp index 61ae6e926..6862fd713 100644 --- a/include/boost/gil/gil_concept.hpp +++ b/include/boost/gil/gil_concept.hpp @@ -32,6 +32,14 @@ #include 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 struct channel_traits; template struct is_pixel; template @@ -2183,6 +2191,10 @@ struct ImageConcept { Img img; }; +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + } } // namespace boost::gil diff --git a/include/boost/gil/gil_config.hpp b/include/boost/gil/gil_config.hpp index 9e20b2f1c..a005e8a26 100644 --- a/include/boost/gil/gil_config.hpp +++ b/include/boost/gil/gil_config.hpp @@ -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__) diff --git a/include/boost/gil/iterator_from_2d.hpp b/include/boost/gil/iterator_from_2d.hpp index a4b234b86..767ad699d 100644 --- a/include/boost/gil/iterator_from_2d.hpp +++ b/include/boost/gil/iterator_from_2d.hpp @@ -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? diff --git a/include/boost/gil/packed_pixel.hpp b/include/boost/gil/packed_pixel.hpp index 2297ab89c..0087e2729 100644 --- a/include/boost/gil/packed_pixel.hpp +++ b/include/boost/gil/packed_pixel.hpp @@ -81,7 +81,9 @@ struct packed_pixel { } packed_pixel(int chan0, int chan1, int chan2) : _bitfield(0) { BOOST_STATIC_ASSERT((num_channels::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::value==4)); diff --git a/include/boost/gil/utilities.hpp b/include/boost/gil/utilities.hpp index a07ffb960..0ccdae7fb 100644 --- a/include/boost/gil/utilities.hpp +++ b/include/boost/gil/utilities.hpp @@ -96,36 +96,36 @@ template T point2::* const point2::mem_array[point2::num_dimensions] = { &point2::x, &point2::y }; /// \ingroup PointModel -template GIL_FORCEINLINE +template BOOST_FORCEINLINE bool operator==(const point2& p1, const point2& p2) { return (p1.x==p2.x && p1.y==p2.y); } /// \ingroup PointModel -template GIL_FORCEINLINE +template BOOST_FORCEINLINE bool operator!=(const point2& p1, const point2& p2) { return p1.x!=p2.x || p1.y!=p2.y; } /// \ingroup PointModel -template GIL_FORCEINLINE +template BOOST_FORCEINLINE point2 operator+(const point2& p1, const point2& p2) { return point2(p1.x+p2.x,p1.y+p2.y); } /// \ingroup PointModel -template GIL_FORCEINLINE +template BOOST_FORCEINLINE point2 operator-(const point2& p) { return point2(-p.x,-p.y); } /// \ingroup PointModel -template GIL_FORCEINLINE +template BOOST_FORCEINLINE point2 operator-(const point2& p1, const point2& p2) { return point2(p1.x-p2.x,p1.y-p2.y); } /// \ingroup PointModel -template GIL_FORCEINLINE +template BOOST_FORCEINLINE point2 operator/(const point2& p, double t) { return t==0 ? point2(0,0):point2(p.x/t,p.y/t); } /// \ingroup PointModel -template GIL_FORCEINLINE +template BOOST_FORCEINLINE point2 operator*(const point2& p, std::ptrdiff_t t) { return point2(p.x*t,p.y*t); } /// \ingroup PointModel -template GIL_FORCEINLINE +template BOOST_FORCEINLINE point2 operator*(std::ptrdiff_t t, const point2& p) { return point2(p.x*t,p.y*t); } /// \ingroup PointModel -template GIL_FORCEINLINE +template BOOST_FORCEINLINE const T& axis_value(const point2& p) { return p[K]; } /// \ingroup PointModel -template GIL_FORCEINLINE +template BOOST_FORCEINLINE T& axis_value( point2& p) { return p[K]; } //////////////////////////////////////////////////////////////////////////////////////// @@ -213,10 +213,10 @@ public: }; // reinterpret_cast is implementation-defined. Static cast is not. -template GIL_FORCEINLINE +template BOOST_FORCEINLINE OutPtr gil_reinterpret_cast( In* p) { return static_cast(static_cast(p)); } -template GIL_FORCEINLINE +template BOOST_FORCEINLINE const OutPtr gil_reinterpret_cast_c(const In* p) { return static_cast(static_cast(p)); } namespace detail {