|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r83107 - in trunk: boost/gil libs/gil/example libs/gil/io/test libs/gil/test
From: chhenning_at_[hidden]
Date: 2013-02-23 13:58:01
Author: chhenning
Date: 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
New Revision: 83107
URL: http://svn.boost.org/trac/boost/changeset/83107
Log:
#4517
Text files modified:
trunk/boost/gil/algorithm.hpp | 174 ++++++++++++++++-----------------------
trunk/boost/gil/locator.hpp | 48 +++++-----
trunk/boost/gil/planar_pixel_iterator.hpp | 49 +++++-----
trunk/libs/gil/example/interleaved_ptr.hpp | 28 ++---
trunk/libs/gil/example/mandelbrot.cpp | 7
trunk/libs/gil/io/test/bmp_old_test.cpp | 2
trunk/libs/gil/io/test/jpeg_old_test.cpp | 2
trunk/libs/gil/io/test/mandel_view.hpp | 6
trunk/libs/gil/io/test/png_old_test.cpp | 2
trunk/libs/gil/io/test/pnm_old_test.cpp | 2
trunk/libs/gil/io/test/targa_old_test.cpp | 2
trunk/libs/gil/io/test/tiff_old_test.cpp | 2
trunk/libs/gil/test/image.cpp | 34 +-----
trunk/libs/gil/test/pixel_iterator.cpp | 36 ++-----
14 files changed, 162 insertions(+), 232 deletions(-)
Modified: trunk/boost/gil/algorithm.hpp
==============================================================================
--- trunk/boost/gil/algorithm.hpp (original)
+++ trunk/boost/gil/algorithm.hpp 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
@@ -1,6 +1,6 @@
/*
Copyright 2005-2007 Adobe Systems Incorporated
-
+
Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
@@ -8,7 +8,6 @@
See http://opensource.adobe.com/gil for most recent version including documentation.
*/
-
/*************************************************************************************************/
#ifndef GIL_ALGORITHM_HPP
@@ -34,7 +33,7 @@
#include "bit_aligned_pixel_iterator.hpp"
////////////////////////////////////////////////////////////////////////////////////////
-/// \file
+/// \file
/// \brief Some basic STL-style algorithms when applied to image views
/// \author Lubomir Bourdev and Hailin Jin \n
/// Adobe Systems Incorporated
@@ -48,7 +47,6 @@
//#endif
namespace boost { namespace gil {
-
//forward declarations
template <typename ChannelPtr, typename ColorSpace>
struct planar_pixel_iterator;
@@ -82,10 +80,9 @@
/// is overloaded to perform \p std::copy for each of the planes. \p std::copy over bitwise-copiable pixels results in
/// std::copy over unsigned char, which STL typically implements via \p memmove.
///
-/// As a result \p copy_pixels may result in a single call to \p memmove for interleaved 1D-traversable views,
+/// As a result \p copy_pixels may result in a single call to \p memmove for interleaved 1D-traversable views,
/// or one per each plane of planar 1D-traversable views, or one per each row of interleaved non-1D-traversable images, etc.
-
/// \defgroup STLOptimizations Performance overloads of STL algorithms
/// \ingroup ImageViewAlgorithm
/// \brief overloads of STL algorithms allowing more efficient implementation when used with GIL constructs
@@ -146,30 +143,29 @@
/// \brief std::copy for image views
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>*
-copy(boost::gil::pixel<T,Cs>* first, boost::gil::pixel<T,Cs>* last,
- boost::gil::pixel<T,Cs>* dst) {
+template<typename T, typename Cs>
+GIL_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);
}
/// \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>*
-copy(const boost::gil::pixel<T,Cs>* first, const boost::gil::pixel<T,Cs>* last,
- boost::gil::pixel<T,Cs>* dst) {
+template<typename T, typename Cs>
+GIL_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);
}
} // namespace std
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); }
+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); }
};
} // namespace detail
} } // namespace boost::gil
@@ -178,7 +174,7 @@
/// \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
-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::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>());
return dst+(last-first);
@@ -274,7 +270,6 @@
}
return dst+n;
}
-
} // namespace detail
} } // namespace boost::gil
@@ -285,16 +280,13 @@
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) {
return boost::gil::detail::copy_with_2d_iterators(first,last,dst);
}
-
} // namespace std
namespace boost { namespace gil {
-
-
/// \ingroup ImageViewSTLAlgorithmsCopyPixels
/// \brief std::copy for image views
template <typename View1, typename View2> GIL_FORCEINLINE
-void copy_pixels(const View1& src, const View2& dst) {
+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());
}
@@ -321,13 +313,13 @@
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> GIL_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> GIL_FORCEINLINE
result_type apply_compatible(const V1& src, const V2& dst) const {
copy_pixels(src,dst);
}
@@ -335,9 +327,9 @@
} // namespace detail
/// \ingroup ImageViewSTLAlgorithmsCopyAndConvertPixels
-template <typename V1, typename V2,typename CC>
-GIL_FORCEINLINE
-void copy_and_convert_pixels(const V1& src, const V2& dst,CC cc) {
+template <typename V1, typename V2,typename CC>
+GIL_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);
}
@@ -345,13 +337,12 @@
struct default_color_converter;
/// \ingroup ImageViewSTLAlgorithmsCopyAndConvertPixels
-template <typename View1, typename View2>
-GIL_FORCEINLINE
-void copy_and_convert_pixels(const View1& src, const View2& dst) {
+template <typename View1, typename View2>
+GIL_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);
}
-
} } // namespace boost::gil
//////////////////////////////////////////////////////////////////////////////////////
@@ -364,14 +355,13 @@
/// \ingroup ImageViewSTLAlgorithms
/// \brief std::fill for image views
-
namespace std {
/// \ingroup STLOptimizations
/// \brief std::fill(I,I,V) with I being a iterator_from_2d
///
/// Invoked when one calls std::fill(I,I,V) with I being a iterator_from_2d (which is
/// a 1D iterator over the pixels in an image). For contiguous images (i.e. images that have
-/// no alignment gap at the end of each row) it is more efficient to use the underlying
+/// no alignment gap at the end of each row) it is more efficient to use the underlying
/// pixel iterator that does not check for the end of rows. For non-contiguous images fill
/// resolves to fill of each row using the underlying pixel iterator, which is still faster
template <typename IL, typename V>
@@ -389,11 +379,10 @@
n-=numToDo;
}
}
-}
+}
} // namespace std
namespace boost { namespace gil {
-
namespace detail {
/// struct to do std::fill
struct std_fill_t {
@@ -404,13 +393,13 @@
};
/// std::fill for planar iterators
template <typename It, typename P>
-GIL_FORCEINLINE
+GIL_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
+GIL_FORCEINLINE
void fill_aux(It first, It last, const P& p,mpl::false_) {
std::fill(first,last,p);
}
@@ -418,10 +407,10 @@
/// \ingroup ImageViewSTLAlgorithmsFillPixels
/// \brief std::fill for image views
-template <typename View, typename Value> GIL_FORCEINLINE
+template <typename View, typename Value> GIL_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(),
+ detail::fill_aux(img_view.begin().x(), img_view.end().x(),
val,is_planar<View>());
else
for (std::ptrdiff_t y=0; y<img_view.height(); ++y)
@@ -439,9 +428,7 @@
/// \ingroup ImageViewSTLAlgorithms
/// \brief invokes the destructor on every pixel of an image view
-
namespace detail {
-
template <typename It> GIL_FORCEINLINE
void destruct_range_impl( It first
, It last
@@ -461,14 +448,13 @@
void destruct_range_impl( It
, It
, typename enable_if< mpl::or_< mpl::not_< is_pointer< It > >
- , boost::has_trivial_destructor< typename std::iterator_traits< It >::value_type >
+ , boost::has_trivial_destructor< typename std::iterator_traits< It >::value_type >
>
>::type* /* ptr */ = 0)
{}
template <typename It> GIL_FORCEINLINE
void destruct_range(It first, It last) {
-
destruct_range_impl( first
, last
);
@@ -480,25 +466,24 @@
/// destruct for planar iterators
template <typename It>
-GIL_FORCEINLINE
+GIL_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
+GIL_FORCEINLINE
void destruct_aux(It first, It last, mpl::false_) {
destruct_range(first,last);
}
-
} // namespace detail
/// \ingroup ImageViewSTLAlgorithmsDestructPixels
/// \brief Invokes the in-place destructor on every pixel of the view
-template <typename View> GIL_FORCEINLINE
+template <typename View> GIL_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(),
+ if (img_view.is_1d_traversable())
+ detail::destruct_aux(img_view.begin().x(), img_view.end().x(),
is_planar<View>());
else
for (std::ptrdiff_t y=0; y<img_view.height(); ++y)
@@ -516,20 +501,18 @@
/// \ingroup ImageViewSTLAlgorithms
/// \brief std::uninitialized_fill for image views
-
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
+GIL_FORCEINLINE
void uninitialized_fill_aux(It first, It last,
const P& p, mpl::true_) {
int channel=0;
try {
typedef typename std::iterator_traits<It>::value_type pixel_t;
while (channel < num_channels<pixel_t>::value) {
- std::uninitialized_fill(dynamic_at_c(first,channel), dynamic_at_c(last,channel),
+ std::uninitialized_fill(dynamic_at_c(first,channel), dynamic_at_c(last,channel),
dynamic_at_c(p,channel));
++channel;
}
@@ -543,22 +526,21 @@
/// 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
+GIL_FORCEINLINE
void uninitialized_fill_aux(It first, It last,
const P& p,mpl::false_) {
std::uninitialized_fill(first,last,p);
}
-
} // namespace detail
/// \ingroup ImageViewSTLAlgorithmsUninitializedFillPixels
/// \brief std::uninitialized_fill for image views.
/// Does not support planar heterogeneous views.
/// If an exception is thrown destructs any in-place copy-constructed pixels
-template <typename View, typename Value>
+template <typename View, typename Value>
void uninitialized_fill_pixels(const View& img_view, const Value& val) {
- if (img_view.is_1d_traversable())
- detail::uninitialized_fill_aux(img_view.begin().x(), img_view.end().x(),
+ if (img_view.is_1d_traversable())
+ detail::uninitialized_fill_aux(img_view.begin().x(), img_view.end().x(),
val,is_planar<View>());
else {
typename View::y_coord_t y;
@@ -585,8 +567,7 @@
/// \brief invokes the default constructor on every pixel of an image view
namespace detail {
-
-template <typename It> GIL_FORCEINLINE
+template <typename It> GIL_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;
@@ -601,15 +582,15 @@
}
}
-template <typename It> GIL_FORCEINLINE
+template <typename It> GIL_FORCEINLINE
void default_construct_range_impl(It, It, mpl::false_) {}
-template <typename It> GIL_FORCEINLINE
+template <typename It> GIL_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
+GIL_FORCEINLINE
void default_construct_aux(It first, It last, mpl::true_) {
int channel=0;
try {
@@ -627,7 +608,7 @@
/// uninitialized_default_construct for interleaved iterators
template <typename It>
-GIL_FORCEINLINE
+GIL_FORCEINLINE
void default_construct_aux(It first, It last, mpl::false_) {
default_construct_range(first,last);
}
@@ -636,11 +617,9 @@
struct has_trivial_pixel_constructor : public boost::has_trivial_constructor<typename View::value_type> {};
template <typename View>
struct has_trivial_pixel_constructor<View, true> : public boost::has_trivial_constructor<typename channel_type<View>::type> {};
-
} // namespace detail
namespace detail {
-
template< typename View, bool B > GIL_FORCEINLINE
void default_construct_pixels_impl( const View& img_view
, boost::enable_if< is_same< mpl::bool_< B >
@@ -649,7 +628,7 @@
>* /* ptr */ = 0
)
{
- if( img_view.is_1d_traversable() )
+ if( img_view.is_1d_traversable() )
{
detail::default_construct_aux( img_view.begin().x()
, img_view.end().x()
@@ -681,19 +660,15 @@
throw;
}
}
-
}
-
} // namespace detail
-
/// \ingroup ImageViewSTLAlgorithmsDefaultConstructPixels
/// \brief Invokes the in-place default constructor on every pixel of the (uninitialized) view.
/// Does not support planar heterogeneous views.
/// If an exception is thrown destructs any in-place default-constructed pixels
-template <typename View>
+template <typename View>
void default_construct_pixels(const View& img_view) {
-
detail::default_construct_pixels_impl< View
, detail::has_trivial_pixel_constructor< View
, is_planar< View >::value
@@ -701,7 +676,6 @@
>( img_view );
}
-
//////////////////////////////////////////////////////////////////////////////////////
///
/// uninitialized_copy_pixels
@@ -713,10 +687,9 @@
/// \brief std::uninitialized_copy for image views
namespace detail {
-
/// std::uninitialized_copy for pairs of planar iterators
template <typename It1, typename It2>
-GIL_FORCEINLINE
+GIL_FORCEINLINE
void uninitialized_copy_aux(It1 first1, It1 last1,
It2 first2, mpl::true_) {
int channel=0;
@@ -736,7 +709,7 @@
}
/// std::uninitialized_copy for interleaved or mixed iterators
template <typename It1, typename It2>
-GIL_FORCEINLINE
+GIL_FORCEINLINE
void uninitialized_copy_aux(It1 first1, It1 last1,
It2 first2,mpl::false_) {
std::uninitialized_copy(first1,last1,first2);
@@ -747,13 +720,13 @@
/// \brief std::uninitialized_copy for image views.
/// Does not support planar heterogeneous views.
/// If an exception is thrown destructs any in-place copy-constructed objects
-template <typename View1, typename View2>
+template <typename View1, typename View2>
void uninitialized_copy_pixels(const View1& view1, const View2& view2) {
- typedef mpl::bool_<is_planar<View1>::value && is_planar<View2>::value> is_planar;
+ typedef mpl::bool_<is_planar<View1>::value && is_planar<View2>::value> is_planar;
assert(view1.dimensions()==view2.dimensions());
if (view1.is_1d_traversable() && view2.is_1d_traversable())
- detail::uninitialized_copy_aux(view1.begin().x(), view1.end().x(),
- view2.begin().x(),
+ detail::uninitialized_copy_aux(view1.begin().x(), view1.end().x(),
+ view2.begin().x(),
is_planar());
else {
typename View1::y_coord_t y;
@@ -780,9 +753,9 @@
/// \ingroup ImageViewSTLAlgorithms
/// \brief std::for_each for image views
///
-/// For contiguous images (i.e. images that have no alignment gap at the end of each row) it is
-/// more efficient to use the underlying pixel iterator that does not check for the end of rows.
-/// For non-contiguous images for_each_pixel resolves to for_each of each row using the underlying
+/// For contiguous images (i.e. images that have no alignment gap at the end of each row) it is
+/// more efficient to use the underlying pixel iterator that does not check for the end of rows.
+/// For non-contiguous images for_each_pixel resolves to for_each of each row using the underlying
/// pixel iterator, which is still faster
/// \ingroup ImageViewSTLAlgorithmsForEachPixel
@@ -813,7 +786,6 @@
return fun;
}
-
//////////////////////////////////////////////////////////////////////////////////////
///
/// generate_pixels
@@ -849,17 +821,16 @@
template <typename I1, typename I2> GIL_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); }
};
-/// Equal when both ranges are interleaved and of the same type.
+/// 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 {
+ GIL_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;
}
};
@@ -871,8 +842,8 @@
/// 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 {
- ptrdiff_t numBytes=n*sizeof(typename std::iterator_traits<IC>::value_type);
+ GIL_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)
if (memcmp(dynamic_at_c(i1,i), dynamic_at_c(i2,i), numBytes)!=0)
@@ -881,7 +852,6 @@
}
};
-
/// 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> {
@@ -953,14 +923,14 @@
/// \brief std::equal(I1,I1,I2) with I1 and I2 being a iterator_from_2d
///
/// Invoked when one calls std::equal(I1,I1,I2) with I1 and I2 being a iterator_from_2d (which is
-/// a 1D iterator over the pixels in an image). Attempts to demote the source and destination
+/// a 1D iterator over the pixels in an image). Attempts to demote the source and destination
/// iterators to simpler/faster types if the corresponding range is contiguous.
/// For contiguous images (i.e. images that have
-/// no alignment gap at the end of each row) it is more efficient to use the underlying
+/// no alignment gap at the end of each row) it is more efficient to use the underlying
/// 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> GIL_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> >();
@@ -980,10 +950,9 @@
} // namespace std
namespace boost { namespace gil {
-
/// \ingroup ImageViewSTLAlgorithmsEqualPixels
/// \brief std::equal for image views
-template <typename View1, typename View2> GIL_FORCEINLINE
+template <typename View1, typename View2> GIL_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
@@ -1001,7 +970,7 @@
/// \ingroup ImageViewSTLAlgorithmsTransformPixels
/// \brief std::transform for image views
-template <typename View1, typename View2, typename F> GIL_FORCEINLINE
+template <typename View1, typename View2, typename F> GIL_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) {
@@ -1015,7 +984,7 @@
/// \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> GIL_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);
@@ -1029,11 +998,11 @@
/// \defgroup ImageViewSTLAlgorithmsTransformPixelPositions transform_pixel_positions
/// \ingroup ImageViewSTLAlgorithms
-/// \brief adobe::transform_positions for image views (passes locators, instead of pixel references, to the function object)
+/// \brief adobe::transform_positions for image views (passes locators, instead of pixel references, to the function object)
/// \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> GIL_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);
@@ -1048,7 +1017,7 @@
/// \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> GIL_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());
@@ -1063,11 +1032,10 @@
}
return fun;
}
-
} } // namespace boost::gil
//#ifdef _MSC_VER
//#pragma warning(pop)
//#endif
-#endif
+#endif
\ No newline at end of file
Modified: trunk/boost/gil/locator.hpp
==============================================================================
--- trunk/boost/gil/locator.hpp (original)
+++ trunk/boost/gil/locator.hpp 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
@@ -1,6 +1,6 @@
/*
Copyright 2005-2007 Adobe Systems Incorporated
-
+
Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
@@ -13,9 +13,8 @@
#ifndef GIL_LOCATOR_H
#define GIL_LOCATOR_H
-
////////////////////////////////////////////////////////////////////////////////////////
-/// \file
+/// \file
/// \brief pixel 2D locator
/// \author Lubomir Bourdev and Hailin Jin \n
/// Adobe Systems Incorporated
@@ -31,13 +30,11 @@
/// Pixel 2D LOCATOR
////////////////////////////////////////////////////////////////////////////////////////
-
namespace boost { namespace gil {
-
//forward declarations
-template <typename P> ptrdiff_t memunit_step(const P*);
-template <typename P> P* memunit_advanced(const P* p, ptrdiff_t diff);
-template <typename P> P& memunit_advanced_ref(P* p, ptrdiff_t diff);
+template <typename P> std::ptrdiff_t memunit_step(const P*);
+template <typename P> P* memunit_advanced(const P* p, std::ptrdiff_t diff);
+template <typename P> P& memunit_advanced_ref(P* p, std::ptrdiff_t diff);
template <typename Iterator, typename D> struct iterator_add_deref;
template <typename T> class point2;
namespace detail {
@@ -62,7 +59,7 @@
/// \brief base class for models of PixelLocatorConcept
/// \ingroup PixelLocatorModel PixelBasedModel
///
-/// Pixel locator is similar to a pixel iterator, but allows for 2D navigation of pixels within an image view.
+/// Pixel locator is similar to a pixel iterator, but allows for 2D navigation of pixels within an image view.
/// It has a 2D difference_type and supports random access operations like:
/// \code
/// difference_type offset2(2,3);
@@ -76,7 +73,7 @@
/// It is called a locator because it doesn't implement the complete interface of a random access iterator.
/// For example, increment and decrement operations don't make sense (no way to specify dimension).
/// Also 2D difference between two locators cannot be computed without knowledge of the X position within the image.
-///
+///
/// This base class provides most of the methods and typedefs needed to create a model of a locator. GIL provides two
/// locator models as subclasses of \p pixel_2d_locator_base. A memory-based locator, \p memory_based_2d_locator and a virtual
/// locator, \p virtual_2d_locator.
@@ -108,7 +105,7 @@
/// // return the vertical distance to another locator. Some models need the horizontal distance to compute it
/// y_coord_t y_distance_to(const my_locator& loc2, x_coord_t xDiff) const;
///
-/// // return true iff incrementing an x-iterator located at the last column will position it at the first
+/// // return true iff incrementing an x-iterator located at the last column will position it at the first
/// // column of the next row. Some models need the image width to determine that.
/// bool is_1d_traversable(x_coord_t width) const;
/// };
@@ -159,12 +156,12 @@
Loc& operator+=(const difference_type& d) { concrete().x()+=d.x; concrete().y()+=d.y; return concrete(); }
Loc& operator-=(const difference_type& d) { concrete().x()-=d.x; concrete().y()-=d.y; return concrete(); }
-
+
Loc operator+(const difference_type& d) const { return xy_at(d); }
Loc operator-(const difference_type& d) const { return xy_at(-d); }
// Some locators can cache 2D coordinates for faster subsequent access. By default there is no caching
- typedef difference_type cached_location_t;
+ typedef difference_type cached_location_t;
cached_location_t cache_location(const difference_type& d) const { return d; }
cached_location_t cache_location(x_coord_t dx, y_coord_t dy)const { return difference_type(dx,dy); }
@@ -177,7 +174,7 @@
// helper classes for each axis of pixel_2d_locator_base
namespace detail {
- template <typename Loc>
+ template <typename Loc>
class locator_axis<0,Loc> {
typedef typename Loc::point_t point_t;
public:
@@ -190,7 +187,7 @@
inline iterator operator()(const Loc& loc, const point_t& d) const { return loc.x_at(d); }
};
- template <typename Loc>
+ template <typename Loc>
class locator_axis<1,Loc> {
typedef typename Loc::point_t point_t;
public:
@@ -224,10 +221,10 @@
/// while its base iterator provides horizontal navigation.
///
/// Each instantiation is optimal in terms of size and efficiency.
-/// For example, xy locator over interleaved rgb image results in a step iterator consisting of
-/// one std::ptrdiff_t for the row size and one native pointer (8 bytes total). ++locator.x() resolves to pointer
-/// increment. At the other extreme, a 2D navigation of the even pixels of a planar CMYK image results in a step
-/// iterator consisting of one std::ptrdiff_t for the doubled row size, and one step iterator consisting of
+/// For example, xy locator over interleaved rgb image results in a step iterator consisting of
+/// one std::ptrdiff_t for the row size and one native pointer (8 bytes total). ++locator.x() resolves to pointer
+/// increment. At the other extreme, a 2D navigation of the even pixels of a planar CMYK image results in a step
+/// iterator consisting of one std::ptrdiff_t for the doubled row size, and one step iterator consisting of
/// one std::ptrdiff_t for the horizontal step of two and a CMYK planar_pixel_iterator consisting of 4 pointers (24 bytes).
/// In this case ++locator.x() results in four native pointer additions.
///
@@ -255,8 +252,8 @@
template <typename Deref> struct add_deref {
typedef memory_based_2d_locator<typename iterator_add_deref<StepIterator,Deref>::type> type;
- static type make(const memory_based_2d_locator<StepIterator>& loc, const Deref& nderef) {
- return type(iterator_add_deref<StepIterator,Deref>::make(loc.y(),nderef));
+ static type make(const memory_based_2d_locator<StepIterator>& loc, const Deref& nderef) {
+ return type(iterator_add_deref<StepIterator,Deref>::make(loc.y(),nderef));
}
};
@@ -278,8 +275,8 @@
x_iterator& x() { return _p.base(); }
y_iterator& y() { return _p; }
- // These are faster versions of functions already provided in the superclass
- x_iterator x_at (x_coord_t dx, y_coord_t dy) const { return memunit_advanced(x(), offset(dx,dy)); }
+ // These are faster versions of functions already provided in the superclass
+ x_iterator x_at (x_coord_t dx, y_coord_t dy) const { return memunit_advanced(x(), offset(dx,dy)); }
x_iterator x_at (const difference_type& d) const { return memunit_advanced(x(), offset(d.x,d.y)); }
this_t xy_at (x_coord_t dx, y_coord_t dy) const { return this_t(x_at( dx , dy ), row_size()); }
this_t xy_at (const difference_type& d) const { return this_t(x_at( d.x, d.y), row_size()); }
@@ -301,7 +298,7 @@
bool is_1d_traversable(x_coord_t width) const { return row_size()-pixel_size()*width==0; } // is there no gap at the end of each row?
// Returns the vertical distance (it2.y-it1.y) between two x_iterators given the difference of their x positions
- std::ptrdiff_t y_distance_to(const this_t& p2, x_coord_t xDiff) const {
+ std::ptrdiff_t y_distance_to(const this_t& p2, x_coord_t xDiff) const {
std::ptrdiff_t rowDiff=memunit_distance(x(),p2.x())-pixel_size()*xDiff;
assert(( rowDiff % row_size())==0);
return rowDiff / row_size();
@@ -356,7 +353,6 @@
struct dynamic_y_step_type<memory_based_2d_locator<SI> > {
typedef memory_based_2d_locator<SI> type;
};
-
} } // namespace boost::gil
-#endif
+#endif
\ No newline at end of file
Modified: trunk/boost/gil/planar_pixel_iterator.hpp
==============================================================================
--- trunk/boost/gil/planar_pixel_iterator.hpp (original)
+++ trunk/boost/gil/planar_pixel_iterator.hpp 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
@@ -1,6 +1,6 @@
/*
Copyright 2005-2007 Adobe Systems Incorporated
-
+
Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
@@ -14,7 +14,7 @@
#define GIL_PLANAR_PTR_H
////////////////////////////////////////////////////////////////////////////////////////
-/// \file
+/// \file
/// \brief planar pixel pointer class
/// \author Lubomir Bourdev and Hailin Jin \n
/// Adobe Systems Incorporated
@@ -30,12 +30,11 @@
#include "step_iterator.hpp"
namespace boost { namespace gil {
-
//forward declaration (as this file is included in planar_pixel_reference.hpp)
-template <typename ChannelReference, typename ColorSpace>
+template <typename ChannelReference, typename ColorSpace>
struct planar_pixel_reference;
-/// \defgroup ColorBaseModelPlanarPtr planar_pixel_iterator
+/// \defgroup ColorBaseModelPlanarPtr planar_pixel_iterator
/// \ingroup ColorBaseModel
/// \brief A homogeneous color base whose element is a channel iterator. Models HomogeneousColorBaseValueConcept
/// This class is used as an iterator to a planar pixel.
@@ -49,7 +48,7 @@
///
/// Planar pixels have channel data that is not consecutive in memory.
/// To abstract this we use classes to represent references and pointers to planar pixels.
-///
+///
/// \ingroup PixelIteratorModelPlanarPtr ColorBaseModelPlanarPtr PixelBasedModel
template <typename ChannelPtr, typename ColorSpace>
struct planar_pixel_iterator : public iterator_facade<planar_pixel_iterator<ChannelPtr,ColorSpace>,
@@ -69,7 +68,7 @@
typedef typename parent_t::reference reference;
typedef typename parent_t::difference_type difference_type;
- planar_pixel_iterator() : color_base_parent_t(0) {}
+ planar_pixel_iterator() : color_base_parent_t(0) {}
planar_pixel_iterator(bool) {} // constructor that does not fill with zero (for performance)
planar_pixel_iterator(const ChannelPtr& v0, const ChannelPtr& v1) : color_base_parent_t(v0,v1) {}
@@ -77,20 +76,19 @@
planar_pixel_iterator(const ChannelPtr& v0, const ChannelPtr& v1, const ChannelPtr& v2, const ChannelPtr& v3) : color_base_parent_t(v0,v1,v2,v3) {}
planar_pixel_iterator(const ChannelPtr& v0, const ChannelPtr& v1, const ChannelPtr& v2, const ChannelPtr& v3, const ChannelPtr& v4) : color_base_parent_t(v0,v1,v2,v3,v4) {}
- template <typename IC1,typename C1>
+ template <typename IC1,typename C1>
planar_pixel_iterator(const planar_pixel_iterator<IC1,C1>& ptr) : color_base_parent_t(ptr) {}
-
/// Copy constructor and operator= from pointers to compatible planar pixels or planar pixel references.
/// That allow constructs like pointer = &value or pointer = &reference
/// Since we should not override operator& that's the best we can do.
- template <typename P>
+ template <typename P>
planar_pixel_iterator(P* pix) : color_base_parent_t(pix, true) {
function_requires<PixelsCompatibleConcept<P,value_type> >();
}
struct address_of { template <typename T> T* operator()(T& t) { return &t; } };
- template <typename P>
+ template <typename P>
planar_pixel_iterator& operator=(P* pix) {
function_requires<PixelsCompatibleConcept<P,value_type> >();
static_transform(*pix,*this, address_of());
@@ -116,10 +114,10 @@
void increment() { static_transform(*this,*this,detail::inc<ChannelPtr>()); }
void decrement() { static_transform(*this,*this,detail::dec<ChannelPtr>()); }
- void advance(ptrdiff_t d) { static_transform(*this,*this,std::bind2nd(detail::plus_asymmetric<ChannelPtr,ptrdiff_t>(),d)); }
+ void advance(std::ptrdiff_t d) { static_transform(*this,*this,std::bind2nd(detail::plus_asymmetric<ChannelPtr,std::ptrdiff_t>(),d)); }
reference dereference() const { return this->template deref<reference>(); }
- ptrdiff_t distance_to(const planar_pixel_iterator& it) const { return gil::at_c<0>(it)-gil::at_c<0>(*this); }
+ std::ptrdiff_t distance_to(const planar_pixel_iterator& it) const { return gil::at_c<0>(it)-gil::at_c<0>(*this); }
bool equal(const planar_pixel_iterator& it) const { return gil::at_c<0>(*this)==gil::at_c<0>(it); }
};
@@ -128,31 +126,31 @@
template <typename T> struct channel_iterator_is_mutable<const T*> : public mpl::false_ {};
}
-template <typename IC, typename C>
-struct const_iterator_type<planar_pixel_iterator<IC,C> > {
+template <typename IC, typename C>
+struct const_iterator_type<planar_pixel_iterator<IC,C> > {
private:
typedef typename std::iterator_traits<IC>::value_type channel_t;
public:
- typedef planar_pixel_iterator<typename channel_traits<channel_t>::const_pointer,C> type;
+ typedef planar_pixel_iterator<typename channel_traits<channel_t>::const_pointer,C> type;
};
// The default implementation when the iterator is a C pointer is to use the standard constness semantics
-template <typename IC, typename C>
+template <typename IC, typename C>
struct iterator_is_mutable<planar_pixel_iterator<IC,C> > : public detail::channel_iterator_is_mutable<IC> {};
/////////////////////////////
// ColorBasedConcept
/////////////////////////////
-template <typename IC, typename C, int K>
+template <typename IC, typename C, int K>
struct kth_element_type<planar_pixel_iterator<IC,C>, K> {
typedef IC type;
};
-template <typename IC, typename C, int K>
+template <typename IC, typename C, int K>
struct kth_element_reference_type<planar_pixel_iterator<IC,C>, K> : public add_reference<IC> {};
-template <typename IC, typename C, int K>
+template <typename IC, typename C, int K>
struct kth_element_const_reference_type<planar_pixel_iterator<IC,C>, K> : public add_reference<typename add_const<IC>::type> {};
/////////////////////////////
@@ -183,8 +181,8 @@
inline std::ptrdiff_t memunit_step(const planar_pixel_iterator<IC,C>&) { return sizeof(typename std::iterator_traits<IC>::value_type); }
template <typename IC, typename C>
-inline std::ptrdiff_t memunit_distance(const planar_pixel_iterator<IC,C>& p1, const planar_pixel_iterator<IC,C>& p2) {
- return memunit_distance(gil::at_c<0>(p1),gil::at_c<0>(p2));
+inline std::ptrdiff_t memunit_distance(const planar_pixel_iterator<IC,C>& p1, const planar_pixel_iterator<IC,C>& p2) {
+ return memunit_distance(gil::at_c<0>(p1),gil::at_c<0>(p2));
}
template <typename IC>
@@ -196,7 +194,7 @@
};
template <typename IC, typename C>
-inline void memunit_advance(planar_pixel_iterator<IC,C>& p, std::ptrdiff_t diff) {
+inline void memunit_advance(planar_pixel_iterator<IC,C>& p, std::ptrdiff_t diff) {
static_transform(p, p, memunit_advance_fn<IC>(diff));
}
@@ -208,7 +206,7 @@
}
template <typename ChannelPtr, typename ColorSpace>
-inline planar_pixel_reference<typename std::iterator_traits<ChannelPtr>::reference,ColorSpace>
+inline planar_pixel_reference<typename std::iterator_traits<ChannelPtr>::reference,ColorSpace>
memunit_advanced_ref(const planar_pixel_iterator<ChannelPtr,ColorSpace>& ptr, std::ptrdiff_t diff) {
return planar_pixel_reference<typename std::iterator_traits<ChannelPtr>::reference,ColorSpace>(ptr, diff);
}
@@ -221,7 +219,6 @@
struct dynamic_x_step_type<planar_pixel_iterator<IC,C> > {
typedef memory_based_step_iterator<planar_pixel_iterator<IC,C> > type;
};
-
} } // namespace boost::gil
-#endif
+#endif
\ No newline at end of file
Modified: trunk/libs/gil/example/interleaved_ptr.hpp
==============================================================================
--- trunk/libs/gil/example/interleaved_ptr.hpp (original)
+++ trunk/libs/gil/example/interleaved_ptr.hpp 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
@@ -1,6 +1,6 @@
/*
Copyright 2005-2007 Adobe Systems Incorporated
-
+
Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
@@ -11,7 +11,7 @@
/*************************************************************************************************/
////////////////////////////////////////////////////////////////////////////////////////
-/// \file
+/// \file
/// \brief Example on how to create a pixel iterator
/// \author Lubomir Bourdev and Hailin Jin \n
/// Adobe Systems Incorporated
@@ -28,12 +28,11 @@
#include "interleaved_ref.hpp"
namespace boost { namespace gil {
-
/////////////////////////////////////////////////////////////////////////
///
/// A model of an interleaved pixel iterator. Contains an iterator to the first channel of the current pixel
///
-/// Models:
+/// Models:
/// MutablePixelIteratorConcept
/// PixelIteratorConcept
/// boost_concepts::RandomAccessTraversalConcept
@@ -82,7 +81,7 @@
// Channels accessor (not required by any concept)
const ChannelPtr& channels() const { return _channels; }
ChannelPtr& channels() { return _channels; }
-
+
// Not required by concepts but useful
static const std::size_t num_channels = mpl::size<typename Layout::color_space_t>::value;
private:
@@ -92,9 +91,9 @@
void increment() { _channels+=num_channels; }
void decrement() { _channels-=num_channels; }
- void advance(ptrdiff_t d) { _channels+=num_channels*d; }
+ void advance(std::ptrdiff_t d) { _channels+=num_channels*d; }
- ptrdiff_t distance_to(const interleaved_ptr& it) const { return (it._channels-_channels)/num_channels; }
+ std::ptrdiff_t distance_to(const interleaved_ptr& it) const { return (it._channels-_channels)/num_channels; }
bool equal(const interleaved_ptr& it) const { return _channels==it._channels; }
reference dereference() const { return reference(_channels); }
@@ -110,12 +109,12 @@
// GIL's planar reference and iterator ("planar_pixel_reference" and "planar_pixel_iterator") which share the class "pixel" as the value_type. The
// class "pixel" is also the value type for interleaved pixel references. Here we are dealing with channels, not pixels, but the principles still apply.
template <typename ChannelPtr, typename Layout>
-struct const_iterator_type<interleaved_ptr<ChannelPtr,Layout> > {
+struct const_iterator_type<interleaved_ptr<ChannelPtr,Layout> > {
private:
typedef typename std::iterator_traits<ChannelPtr>::reference channel_ref_t;
typedef typename channel_traits<channel_ref_t>::const_pointer channel_const_ptr_t;
public:
- typedef interleaved_ptr<channel_const_ptr_t,Layout> type;
+ typedef interleaved_ptr<channel_const_ptr_t,Layout> type;
};
template <typename ChannelPtr, typename Layout>
@@ -157,18 +156,18 @@
/////////////////////////////
template <typename ChannelPtr, typename Layout>
-inline std::ptrdiff_t memunit_step(const interleaved_ptr<ChannelPtr,Layout>&) {
+inline std::ptrdiff_t memunit_step(const interleaved_ptr<ChannelPtr,Layout>&) {
return sizeof(typename std::iterator_traits<ChannelPtr>::value_type)* // size of each channel in bytes
interleaved_ptr<ChannelPtr,Layout>::num_channels; // times the number of channels
}
template <typename ChannelPtr, typename Layout>
-inline std::ptrdiff_t memunit_distance(const interleaved_ptr<ChannelPtr,Layout>& p1, const interleaved_ptr<ChannelPtr,Layout>& p2) {
- return memunit_distance(p1.channels(),p2.channels());
+inline std::ptrdiff_t memunit_distance(const interleaved_ptr<ChannelPtr,Layout>& p1, const interleaved_ptr<ChannelPtr,Layout>& p2) {
+ return memunit_distance(p1.channels(),p2.channels());
}
template <typename ChannelPtr, typename Layout>
-inline void memunit_advance(interleaved_ptr<ChannelPtr,Layout>& p, std::ptrdiff_t diff) {
+inline void memunit_advance(interleaved_ptr<ChannelPtr,Layout>& p, std::ptrdiff_t diff) {
memunit_advance(p.channels(), diff);
}
@@ -194,7 +193,6 @@
struct dynamic_x_step_type<interleaved_ptr<ChannelPtr,Layout> > {
typedef memory_based_step_iterator<interleaved_ptr<ChannelPtr,Layout> > type;
};
-
} } // namespace boost::gil
-#endif
+#endif
\ No newline at end of file
Modified: trunk/libs/gil/example/mandelbrot.cpp
==============================================================================
--- trunk/libs/gil/example/mandelbrot.cpp (original)
+++ trunk/libs/gil/example/mandelbrot.cpp 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
@@ -1,6 +1,6 @@
/*
Copyright 2005-2007 Adobe Systems Incorporated
-
+
Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
@@ -24,7 +24,7 @@
// Models a Unary Function
template <typename P> // Models PixelValueConcept
struct mandelbrot_fn {
- typedef point2<ptrdiff_t> point_t;
+ typedef point2<std::ptrdiff_t> point_t;
typedef mandelbrot_fn const_t;
typedef P value_type;
@@ -79,5 +79,4 @@
jpeg_write_view("out-mandelbrot.jpg",mandel);
return 0;
-}
-
+}
\ No newline at end of file
Modified: trunk/libs/gil/io/test/bmp_old_test.cpp
==============================================================================
--- trunk/libs/gil/io/test/bmp_old_test.cpp (original)
+++ trunk/libs/gil/io/test/bmp_old_test.cpp 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
@@ -17,7 +17,7 @@
BOOST_AUTO_TEST_CASE( old_read_dimensions_test )
{
- point2< ptrdiff_t > dim = bmp_read_dimensions( bmp_filename );
+ point2< std::ptrdiff_t > dim = bmp_read_dimensions( bmp_filename );
BOOST_CHECK_EQUAL( dim.x, 1000 );
BOOST_CHECK_EQUAL( dim.y, 600 );
Modified: trunk/libs/gil/io/test/jpeg_old_test.cpp
==============================================================================
--- trunk/libs/gil/io/test/jpeg_old_test.cpp (original)
+++ trunk/libs/gil/io/test/jpeg_old_test.cpp 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
@@ -17,7 +17,7 @@
BOOST_AUTO_TEST_CASE( old_read_dimensions_test )
{
- point2< ptrdiff_t > dim = jpeg_read_dimensions( jpeg_filename );
+ point2< std::ptrdiff_t > dim = jpeg_read_dimensions( jpeg_filename );
BOOST_CHECK_EQUAL( dim.x, 1000 );
BOOST_CHECK_EQUAL( dim.y, 600 );
Modified: trunk/libs/gil/io/test/mandel_view.hpp
==============================================================================
--- trunk/libs/gil/io/test/mandel_view.hpp (original)
+++ trunk/libs/gil/io/test/mandel_view.hpp 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
@@ -10,7 +10,7 @@
// Models a Unary Function
template <typename P> // Models PixelValueConcept
struct mandelbrot_fn {
- typedef point2<ptrdiff_t> point_t;
+ typedef point2<std::ptrdiff_t> point_t;
typedef mandelbrot_fn const_t;
typedef P value_type;
@@ -27,8 +27,8 @@
mandelbrot_fn() {}
mandelbrot_fn(const point_t& sz, const value_type& in_color, const value_type& out_color) : _in_color(in_color), _out_color(out_color), _img_size(sz) {}
- ptrdiff_t width() { return _img_size.x; }
- ptrdiff_t height() { return _img_size.y; }
+ std::ptrdiff_t width() { return _img_size.x; }
+ std::ptrdiff_t height() { return _img_size.y; }
result_type operator()(const point_t& p) const {
// normalize the coords to (-2..1, -1.5..1.5)
Modified: trunk/libs/gil/io/test/png_old_test.cpp
==============================================================================
--- trunk/libs/gil/io/test/png_old_test.cpp (original)
+++ trunk/libs/gil/io/test/png_old_test.cpp 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
@@ -17,7 +17,7 @@
BOOST_AUTO_TEST_CASE( old_read_dimensions_test )
{
- point2< ptrdiff_t > dim = png_read_dimensions( png_filename );
+ point2< std::ptrdiff_t > dim = png_read_dimensions( png_filename );
BOOST_CHECK_EQUAL( dim.x, 1000 );
BOOST_CHECK_EQUAL( dim.y, 600 );
Modified: trunk/libs/gil/io/test/pnm_old_test.cpp
==============================================================================
--- trunk/libs/gil/io/test/pnm_old_test.cpp (original)
+++ trunk/libs/gil/io/test/pnm_old_test.cpp 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
@@ -17,7 +17,7 @@
BOOST_AUTO_TEST_CASE( old_read_dimensions_test )
{
{
- point2< ptrdiff_t > dim = pnm_read_dimensions( pnm_filename );
+ point2< std::ptrdiff_t > dim = pnm_read_dimensions( pnm_filename );
BOOST_CHECK_EQUAL( dim.x, 256 );
BOOST_CHECK_EQUAL( dim.y, 256 );
Modified: trunk/libs/gil/io/test/targa_old_test.cpp
==============================================================================
--- trunk/libs/gil/io/test/targa_old_test.cpp (original)
+++ trunk/libs/gil/io/test/targa_old_test.cpp 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
@@ -17,7 +17,7 @@
BOOST_AUTO_TEST_CASE( old_read_dimensions_test )
{
- point2< ptrdiff_t > dim = targa_read_dimensions( targa_filename );
+ point2< std::ptrdiff_t > dim = targa_read_dimensions( targa_filename );
BOOST_CHECK_EQUAL( dim.x, 124 );
BOOST_CHECK_EQUAL( dim.y, 124 );
Modified: trunk/libs/gil/io/test/tiff_old_test.cpp
==============================================================================
--- trunk/libs/gil/io/test/tiff_old_test.cpp (original)
+++ trunk/libs/gil/io/test/tiff_old_test.cpp 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
@@ -24,7 +24,7 @@
BOOST_AUTO_TEST_CASE( old_read_dimensions_test )
{
- point2< ptrdiff_t > dim = tiff_read_dimensions( tiff_filename );
+ point2< std::ptrdiff_t > dim = tiff_read_dimensions( tiff_filename );
BOOST_CHECK_EQUAL( dim.x, 1000 );
BOOST_CHECK_EQUAL( dim.y, 600 );
Modified: trunk/libs/gil/test/image.cpp
==============================================================================
--- trunk/libs/gil/test/image.cpp (original)
+++ trunk/libs/gil/test/image.cpp 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
@@ -1,13 +1,13 @@
/*
Copyright 2005-2007 Adobe Systems Incorporated
-
+
Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
See http://opensource.adobe.com/gil for most recent version including documentation.
*/
-// image_test.cpp :
+// image_test.cpp :
//
#ifdef _MSC_VER
@@ -34,7 +34,6 @@
extern rgb8c_planar_view_t sample_view;
void error_if(bool condition);
-
// When BOOST_GIL_GENERATE_REFERENCE_DATA is defined, the reference data is generated and saved.
// When it is undefined, regression tests are checked against it
//#define BOOST_GIL_GENERATE_REFERENCE_DATA
@@ -71,7 +70,7 @@
struct my_color_converter {
template <typename SrcP,typename DstP>
- void operator()(const SrcP& src,DstP& dst) const {
+ void operator()(const SrcP& src,DstP& dst) const {
typedef typename color_space_type<SrcP>::type src_cs_t;
typedef typename color_space_type<DstP>::type dst_cs_t;
my_color_converter_impl<src_cs_t,dst_cs_t>()(src,dst);
@@ -144,7 +143,6 @@
template <typename View>
struct view_is_homogeneous : public pixel_is_homogeneous<typename View::value_type> {};
-
////////////////////////////////////////////////////
///
/// Tests image view transformations and algorithms
@@ -177,7 +175,6 @@
template <typename Img> void image_all_test(const string& prefix);
};
-
// testing image iterators, clone, fill, locators, color convert
template <typename Img>
void image_test::basic_test(const string& prefix) {
@@ -246,7 +243,6 @@
check_view(hist_view,prefix+"histogram");
}
-
template <typename View>
void image_test::view_transformations_test(const View& img_view, const string& prefix) {
check_view(img_view,prefix+"original");
@@ -260,7 +256,7 @@
check_view(rotated90ccw_view(img_view),prefix+"90ccw");
check_view(flipped_up_down_view(img_view),prefix+"flipped_ud");
check_view(flipped_left_right_view(img_view),prefix+"flipped_lr");
- check_view(subsampled_view(img_view,typename View::point_t(2,1)),prefix+"subsampled");
+ check_view(subsampled_view(img_view,typename View::point_t(2,1)),prefix+"subsampled");
check_view(kth_channel_view<0>(img_view),prefix+"0th_k_channel");
homogeneous_view_transformations_test(img_view, prefix, view_is_homogeneous<View>());
}
@@ -270,7 +266,6 @@
check_view(nth_channel_view(img_view,0),prefix+"0th_n_channel");
}
-
void image_test::virtual_view_test() {
typedef mandelbrot_fn<rgb8_pixel_t> deref_t;
typedef deref_t::point_t point_t;
@@ -320,7 +315,7 @@
check_view(view(any_img), "dynamic_");
check_view(flipped_left_right_view(view(any_img)), "dynamic_fliplr");
check_view(flipped_up_down_view(view(any_img)), "dynamic_flipud");
-
+
any_image_t::view_t subimageView=subimage_view(view(any_img),0,0,10,15);
check_view(subimageView, "dynamic_subimage");
@@ -353,7 +348,7 @@
image_all_test<bgr121_image_t>("bgr121_");
// TODO: Remove?
- view_transformations_test(subsampled_view(sample_view,point2<ptrdiff_t>(1,2)),"subsampled_");
+ view_transformations_test(subsampled_view(sample_view,point2<std::ptrdiff_t>(1,2)),"subsampled_");
view_transformations_test(color_converted_view<gray8_pixel_t>(sample_view),"color_converted_");
virtual_view_test();
@@ -363,8 +358,6 @@
finalize();
}
-
-
////////////////////////////////////////////////////
///
/// Performs or generates image tests using checksums
@@ -394,7 +387,7 @@
// Load the checksums from the reference file and create the start image
void checksum_image_test::initialize() {
- string crc_name;
+ string crc_name;
boost::crc_32_type::value_type crc_result;
fstream checksum_ref(_filename,ios::in);
while (true) {
@@ -449,7 +442,6 @@
checksum_ref.close();
}
-
////////////////////////////////////////////////////
///
/// Performs or generates image tests using image I/O
@@ -499,13 +491,6 @@
};
#endif
-
-
-
-
-
-
-
void static_checks() {
gil_function_requires<ImageConcept<rgb8_image_t> >();
@@ -559,7 +544,6 @@
typedef image_test_t image_mgr_t;
#endif
-
void test_image(const char* ref_checksum) {
image_mgr_t mgr(ref_checksum);
@@ -568,7 +552,6 @@
}
int main(int argc, char* argv[]) {
-
const char* local_name = "gil_reference_checksums.txt";
const char* name_from_status = "../libs/gil/test/gil_reference_checksums.txt";
@@ -586,5 +569,4 @@
}
return 0;
-}
-
+}
\ No newline at end of file
Modified: trunk/libs/gil/test/pixel_iterator.cpp
==============================================================================
--- trunk/libs/gil/test/pixel_iterator.cpp (original)
+++ trunk/libs/gil/test/pixel_iterator.cpp 2013-02-23 13:58:00 EST (Sat, 23 Feb 2013)
@@ -1,6 +1,6 @@
/*
Copyright 2005-2007 Adobe Systems Incorporated
-
+
Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
@@ -55,8 +55,8 @@
boost::function_requires<HasDynamicXStepTypeConcept<bgr121_ptr_t> >();
// TEST dynamic_step_t
- BOOST_STATIC_ASSERT(( boost::is_same<cmyk16_step_ptr_t,dynamic_x_step_type<cmyk16_step_ptr_t>::type>::value ));
- BOOST_STATIC_ASSERT(( boost::is_same<cmyk16_planar_step_ptr_t,dynamic_x_step_type<cmyk16_planar_ptr_t>::type>::value ));
+ BOOST_STATIC_ASSERT(( boost::is_same<cmyk16_step_ptr_t,dynamic_x_step_type<cmyk16_step_ptr_t>::type>::value ));
+ BOOST_STATIC_ASSERT(( boost::is_same<cmyk16_planar_step_ptr_t,dynamic_x_step_type<cmyk16_planar_ptr_t>::type>::value ));
BOOST_STATIC_ASSERT(( boost::is_same<iterator_type<bits8,gray_layout_t,false,false,false>::type,gray8c_ptr_t>::value ));
@@ -76,7 +76,6 @@
typedef dynamic_x_step_type<rgb2gray_ptr>::type rgb2gray_step_ptr;
BOOST_STATIC_ASSERT(( boost::is_same< rgb2gray_step_ptr, dereference_iterator_adaptor<rgb8_step_ptr_t, ccv_rgb_g_fn> >::value));
-
make_step_iterator(rgb2gray_ptr(),2);
typedef dereference_iterator_adaptor<rgb8_step_ptr_t, ccv_rgb_g_fn> rgb2gray_step_ptr1;
@@ -97,13 +96,13 @@
typedef bit_aligned_pixel_iterator<bgr232_ref_t> bgr232_ptr_t;
// BGR232 pixel value. It is a packed_pixel of size 1 byte. (The last bit is unused)
- typedef std::iterator_traits<bgr232_ptr_t>::value_type bgr232_pixel_t;
+ typedef std::iterator_traits<bgr232_ptr_t>::value_type bgr232_pixel_t;
BOOST_STATIC_ASSERT((sizeof(bgr232_pixel_t)==1));
bgr232_pixel_t red(0,0,3); // = 0RRGGGBB, = 01100000
// a buffer of 7 bytes fits exactly 8 BGR232 pixels.
- unsigned char pix_buffer[7];
+ unsigned char pix_buffer[7];
std::fill(pix_buffer,pix_buffer+7,0);
bgr232_ptr_t pix_it(&pix_buffer[0],0); // start at bit 0 of the first pixel
for (int i=0; i<8; ++i) {
@@ -127,7 +126,7 @@
buf[2] = 219;
iterator_t it( &buf[0], 0 );
-
+
ref_t p1 = *it; it++;
ref_t p2 = *it; it++;
ref_t p3 = *it; it++;
@@ -168,7 +167,6 @@
template <typename T> inline void ignore_unused_variable_warning(const T&){}
void test_pixel_iterator() {
-
rgb8_pixel_t rgb8(1,2,3);
rgba8_pixel_t rgba8;
@@ -200,7 +198,7 @@
stepIt++;
rgb8_step_ptr_t stepIt2=stepIt+10;
stepIt2=stepIt;
-
+
rgb8_step_ptr_t stepIt3(&rgb8,5);
rgb8_pixel_t& ref1=stepIt3[5];
@@ -214,8 +212,7 @@
++rgb8StepIt;
rgb8_ref_t reff=*rgb8StepIt; ignore_unused_variable_warning(reff);
rgb8StepIt+=10;
- ptrdiff_t dst=rgb8StepIt2-rgb8StepIt; ignore_unused_variable_warning(dst);
-
+ std::ptrdiff_t dst=rgb8StepIt2-rgb8StepIt; ignore_unused_variable_warning(dst);
rgb8_pixel_t val1=ref1;
rgb8_ptr_t ptr=&ref1;
@@ -255,9 +252,7 @@
// *pix_img_it_c=rgb8_pixel_t(1,2,3); // error: assigning though const iterator
typedef iterator_from_2d<rgb8_loc_t>::difference_type dif_t;
dif_t dt=0;
- ptrdiff_t tdt=dt; ignore_unused_variable_warning(tdt);
-
-
+ std::ptrdiff_t tdt=dt; ignore_unused_variable_warning(tdt);
// memory_based_step_iterator<rgb8_pixel_t> stepIt3Err=stepIt+10; // error: non-const from const iterator
@@ -279,7 +274,6 @@
rgb8c_planar_ptr_t cp(&rgb8);
rgb8_planar_ptr_t p(&rgb8);
// get_color(p,red_t()) = get_color(cp,green_t()); // does not compile - cannot assign a non-const pointer to a const pointer. Otherwise you will be able to modify the value through it.
-
}
// xy_locator.y()++;
@@ -287,8 +281,8 @@
//
// values, references, pointers
// color spaces (rgb,cmyk,gray)
- // channel ordering (bgr vs rgb)
- // planar vs interleaved
+ // channel ordering (bgr vs rgb)
+ // planar vs interleaved
// Pixel POINTERS
// typedef const iterator_traits<rgb8_ptr_t>::pointer RGB8ConstPtr;
@@ -300,7 +294,6 @@
RGB8ConstPtr rgb8_const_ptr=NULL; ignore_unused_variable_warning(rgb8_const_ptr);
rgb8_ptr_t rgb8ptr=&rgb8;
-
rgb8=bgr8_pixel_t(30,20,10);
rgb8_planar_ptr_t rgb8_pptr=&rgb8;
++rgb8_pptr;
@@ -313,7 +306,6 @@
rgb8_pptr=&rgb8;
-
// rgb8_const_planar_ptr=&rgb16p; // error: incompatible bit depth
// iterator_traits<CMYK8>::pointer cmyk8_ptr_t=&rgb8; // error: incompatible pointer type
@@ -324,12 +316,11 @@
rgb8_ref_t rgb8ref_2=*rgb8ptr; ignore_unused_variable_warning(rgb8ref_2);
assert(rgb8ref_2==rgb8);
// RGB8Ref rgb8ref_2_err=*rgb8_const_planar_ptr; // error: non-const reference from const pointer
-
+
rgb8_planar_ref_t rgb8planarref_3=*rgb8_pptr; // planar reference from planar pointer
assert(rgb8planarref_3==rgb8);
// RGB8Ref rgb8ref_3=*rgb8_planar_ptr_t; // error: non-planar reference from planar pointer
-
const rgb8_pixel_t crgb8=rgb8;
*rgb8_pptr=rgb8;
*rgb8_pptr=crgb8;
@@ -342,5 +333,4 @@
int main(int argc, char* argv[]) {
test_pixel_iterator();
return 0;
-}
-
+}
\ No newline at end of file
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk