1 /*
2     Copyright 2005-2007 Adobe Systems Incorporated
3 
4     Use, modification and distribution are subject to the Boost Software License,
5     Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6     http://www.boost.org/LICENSE_1_0.txt).
7 
8     See http://opensource.adobe.com/gil for most recent version including documentation.
9 */
10 
11 /*************************************************************************************************/
12 
13 /// \file
14 /// \brief GIL performance test suite
15 /// \date 2007 \n Last updated on February 12, 2007
16 ///
17 /// Available tests:
18 ///    fill_pixels() on rgb8_image_t with rgb8_pixel_t
19 ///    fill_pixels() on rgb8_planar_image_t with rgb8_pixel_t
20 ///    fill_pixels() on rgb8_image_t with bgr8_pixel_t
21 ///    fill_pixels() on rgb8_planar_image_t with bgr8_pixel_t
22 ///    for_each_pixel() on rgb8_image_t
23 ///    for_each_pixel() on rgb8_planar_t
24 ///    copy_pixels() between rgb8_image_t and rgb8_image_t
25 ///    copy_pixels() between rgb8_image_t and bgr8_image_t
26 ///    copy_pixels() between rgb8_planar_image_t and rgb8_planar_image_t
27 ///    copy_pixels() between rgb8_image_t and rgb8_planar_image_t
28 ///    copy_pixels() between rgb8_planar_image_t and rgb8_image_t
29 ///    transform_pixels() between rgb8_image_t and rgb8_image_t
30 ///    transform_pixels() between rgb8_planar_image_t and rgb8_planar_image_t
31 ///    transform_pixels() between rgb8_planar_image_t and rgb8_image_t
32 ///    transform_pixels() between rgb8_image_t and rgb8_planar_image_t
33 
34 #include <cstddef>
35 #include <ctime>
36 #include <iostream>
37 #include <boost/gil/pixel.hpp>
38 #include <boost/gil/planar_pixel_iterator.hpp>
39 #include <boost/gil/planar_pixel_reference.hpp>
40 #include <boost/gil/iterator_from_2d.hpp>
41 #include <boost/gil/step_iterator.hpp>
42 #include <boost/gil/rgb.hpp>
43 #include <boost/gil/image_view.hpp>
44 #include <boost/gil/image.hpp>
45 #include <boost/gil/typedefs.hpp>
46 #include <boost/gil/algorithm.hpp>
47 
48 using namespace boost::gil;
49 
50 // returns time in milliseconds per call
51 template <typename Op>
measure_time(Op op,std::size_t num_loops)52 double measure_time(Op op, std::size_t num_loops) {
53     clock_t begin=clock();
54     for (std::size_t ii=0; ii<num_loops; ++ii) op();
55     return double(clock()-begin)/double(num_loops);
56 }
57 
58 // image dimension
59 std::size_t width=1000, height=400;
60 
61 // macros for standard GIL views
62 #define RGB_VIEW(T) image_view<memory_based_2d_locator<memory_based_step_iterator<pixel<T,rgb_layout_t>*> > >
63 #define BGR_VIEW(T) image_view<memory_based_2d_locator<memory_based_step_iterator<pixel<T,bgr_layout_t>*> > >
64 #define RGB_PLANAR_VIEW(T) image_view<memory_based_2d_locator<memory_based_step_iterator<planar_pixel_iterator<T*,rgb_t> > > >
65 
66 template <typename View, typename P>
67 struct fill_gil_t {
68     View _v;
69     P _p;
fill_gil_tfill_gil_t70     fill_gil_t(const View& v_in,const P& p_in) : _v(v_in), _p(p_in) {}
operator ()fill_gil_t71     void operator()() const {fill_pixels(_v,_p);}
72 };
73 template <typename View, typename P> struct fill_nongil_t;
74 template <typename T, typename P>
75 struct fill_nongil_t<RGB_VIEW(T), P> {
76     typedef RGB_VIEW(T) View;
77     View _v;
78     P _p;
fill_nongil_tfill_nongil_t79     fill_nongil_t(const View& v_in,const P& p_in) : _v(v_in), _p(p_in) {}
operator ()fill_nongil_t80     void operator()() const {
81         T* first=(T*)_v.row_begin(0);
82         T* last=first+_v.size()*3;
83         while(first!=last) {
84             first[0]=boost::gil::at_c<0>(_p);
85             first[1]=boost::gil::at_c<1>(_p);
86             first[2]=boost::gil::at_c<2>(_p);
87             first+=3;
88         }
89     }
90 };
91 template <typename T1, typename T2>
92 struct fill_nongil_t<RGB_VIEW(T1), pixel<T2,bgr_layout_t> > {
93     typedef RGB_VIEW(T1) View;
94     typedef pixel<T2,bgr_layout_t> P;
95     View _v;
96     P _p;
fill_nongil_tfill_nongil_t97     fill_nongil_t(const View& v_in,const P& p_in) : _v(v_in), _p(p_in) {}
operator ()fill_nongil_t98     void operator()() const {
99         T1* first=(T1*)_v.row_begin(0);
100         T1* last=first+_v.size()*3;
101         while(first!=last) {
102             first[0]=boost::gil::at_c<2>(_p);
103             first[1]=boost::gil::at_c<1>(_p);
104             first[2]=boost::gil::at_c<0>(_p);
105             first+=3;
106         }
107     }
108 };
109 template <typename T1, typename T2>
110 struct fill_nongil_t<RGB_PLANAR_VIEW(T1), pixel<T2,rgb_layout_t> > {
111     typedef RGB_PLANAR_VIEW(T1) View;
112     typedef pixel<T2,rgb_layout_t> P;
113     View _v;
114     P _p;
fill_nongil_tfill_nongil_t115     fill_nongil_t(const View& v_in,const P& p_in) : _v(v_in), _p(p_in) {}
operator ()fill_nongil_t116     void operator()() const {
117         std::size_t size=_v.size();
118         T1* first;
119         first=(T1*)boost::gil::at_c<0>(_v.row_begin(0));
120         std::fill(first,first+size,boost::gil::at_c<0>(_p));
121         first=(T1*)boost::gil::at_c<1>(_v.row_begin(0));
122         std::fill(first,first+size,boost::gil::at_c<1>(_p));
123         first=(T1*)boost::gil::at_c<2>(_v.row_begin(0));
124         std::fill(first,first+size,boost::gil::at_c<2>(_p));
125     }
126 };
127 
128 template <typename T1, typename T2>
129 struct fill_nongil_t<RGB_PLANAR_VIEW(T1), pixel<T2,bgr_layout_t> > {
130     typedef RGB_PLANAR_VIEW(T1) View;
131     typedef pixel<T2,bgr_layout_t> P;
132     View _v;
133     P _p;
fill_nongil_tfill_nongil_t134     fill_nongil_t(const View& v_in,const P& p_in) : _v(v_in), _p(p_in) {}
operator ()fill_nongil_t135     void operator()() const {
136         std::size_t size=_v.size();
137         T1* first;
138         first=(T1*)boost::gil::at_c<0>(_v.row_begin(0));
139         std::fill(first,first+size,boost::gil::at_c<2>(_p));
140         first=(T1*)boost::gil::at_c<1>(_v.row_begin(0));
141         std::fill(first,first+size,boost::gil::at_c<1>(_p));
142         first=(T1*)boost::gil::at_c<2>(_v.row_begin(0));
143         std::fill(first,first+size,boost::gil::at_c<1>(_p));
144     }
145 };
146 
147 template <typename View, typename P>
test_fill(std::size_t trials)148 void test_fill(std::size_t trials) {
149     image<typename View::value_type, is_planar<View>::value> im(width,height);
150     std::cout << "GIL: "<< measure_time(fill_gil_t<View,P>(view(im),P()),trials) << std::endl;
151     std::cout << "Non-GIL: "<< measure_time(fill_nongil_t<View,P>(view(im),P()),trials) << std::endl;
152 };
153 
154 template <typename T>
155 struct rgb_fr_t {
operator ()rgb_fr_t156     void operator()(pixel<T,rgb_layout_t>& p) const {p[0]=0;p[1]=1;p[2]=2;}
operator ()rgb_fr_t157     void operator()(const planar_pixel_reference<T&,rgb_t>& p) const {p[0]=0;p[1]=1;p[2]=2;}
158 };
159 template <typename View, typename F>
160 struct for_each_gil_t {
161     View _v;
162     F _f;
for_each_gil_tfor_each_gil_t163     for_each_gil_t(const View& v_in,const F& f_in) : _v(v_in), _f(f_in) {}
operator ()for_each_gil_t164     void operator()() const {for_each_pixel(_v,_f);}
165 };
166 template <typename View, typename F> struct for_each_nongil_t;
167 template <typename T, typename T2>
168 struct for_each_nongil_t<RGB_VIEW(T), rgb_fr_t<T2> > {
169     typedef RGB_VIEW(T) View;
170     typedef rgb_fr_t<T2> F;
171     View _v;
172     F _f;
for_each_nongil_tfor_each_nongil_t173     for_each_nongil_t(const View& v_in,const F& f_in) : _v(v_in), _f(f_in) {}
operator ()for_each_nongil_t174     void operator()() const {
175         T* first=(T*)_v.row_begin(0);
176         T* last=first+_v.size()*3;
177         while(first!=last) {
178             first[0]=0;
179             first[1]=1;
180             first[2]=2;
181             first+=3;
182         }
183     }
184 };
185 template <typename T1, typename T2>
186 struct for_each_nongil_t<RGB_PLANAR_VIEW(T1), rgb_fr_t<T2> > {
187     typedef RGB_PLANAR_VIEW(T1) View;
188     typedef rgb_fr_t<T2> F;
189     View _v;
190     F _f;
for_each_nongil_tfor_each_nongil_t191     for_each_nongil_t(const View& v_in,const F& f_in) : _v(v_in), _f(f_in) {}
operator ()for_each_nongil_t192     void operator()() const {
193         T1 *first0, *first1, *first2, *last0;
194         first0=(T1*)boost::gil::at_c<0>(_v.row_begin(0));
195         first1=(T1*)boost::gil::at_c<1>(_v.row_begin(0));
196         first2=(T1*)boost::gil::at_c<2>(_v.row_begin(0));
197         last0=first0+_v.size();
198         while(first0!=last0) {
199             *first0++=0;
200             *first1++=1;
201             *first2++=2;
202         }
203     }
204 };
205 
206 template <typename View, typename F>
test_for_each(std::size_t trials)207 void test_for_each(std::size_t trials) {
208     image<typename View::value_type, is_planar<View>::value> im(width,height);
209     std::cout << "GIL: "<<measure_time(for_each_gil_t<View,F>(view(im),F()),trials) << std::endl;
210     std::cout << "Non-GIL: "<<measure_time(for_each_nongil_t<View,F>(view(im),F()),trials) << std::endl;
211 }
212 
213 // copy
214 template <typename View1, typename View2>
215 struct copy_gil_t {
216     View1 _v1;
217     View2 _v2;
copy_gil_tcopy_gil_t218     copy_gil_t(const View1& v1_in,const View2& v2_in) : _v1(v1_in), _v2(v2_in) {}
operator ()copy_gil_t219     void operator()() const {copy_pixels(_v1,_v2);}
220 };
221 template <typename View1, typename View2> struct copy_nongil_t;
222 template <typename T1, typename T2>
223 struct copy_nongil_t<RGB_VIEW(T1),RGB_VIEW(T2)> {
224     typedef RGB_VIEW(T1) View1;
225     typedef RGB_VIEW(T2) View2;
226     View1 _v1;
227     View2 _v2;
copy_nongil_tcopy_nongil_t228     copy_nongil_t(const View1& v1_in,const View2& v2_in) : _v1(v1_in), _v2(v2_in) {}
operator ()copy_nongil_t229     void operator()() const {
230         T1* first1=(T1*)_v1.row_begin(0);
231         T1* last1=first1+_v1.size()*3;
232         T2* first2=(T2*)_v2.row_begin(0);
233         std::copy(first1,last1,first2);
234     }
235 };
236 template <typename T1, typename T2>
237 struct copy_nongil_t<RGB_VIEW(T1),BGR_VIEW(T2)> {
238     typedef RGB_VIEW(T1) View1;
239     typedef BGR_VIEW(T2) View2;
240     View1 _v1;
241     View2 _v2;
copy_nongil_tcopy_nongil_t242     copy_nongil_t(const View1& v1_in,const View2& v2_in) : _v1(v1_in), _v2(v2_in) {}
operator ()copy_nongil_t243     void operator()() const {
244         T1* first1=(T1*)_v1.row_begin(0);
245         T1* last1=first1+_v1.size()*3;
246         T2* first2=(T2*)_v2.row_begin(0);
247         while(first1!=last1) {
248             first2[2]=first1[0];
249             first2[1]=first1[1];
250             first2[0]=first1[2];
251             first1+=3; first2+=3;
252         }
253     }
254 };
255 template <typename T1, typename T2>
256 struct copy_nongil_t<RGB_PLANAR_VIEW(T1),RGB_PLANAR_VIEW(T2)> {
257     typedef RGB_PLANAR_VIEW(T1) View1;
258     typedef RGB_PLANAR_VIEW(T2) View2;
259     View1 _v1;
260     View2 _v2;
copy_nongil_tcopy_nongil_t261     copy_nongil_t(const View1& v1_in,const View2& v2_in) : _v1(v1_in), _v2(v2_in) {}
operator ()copy_nongil_t262     void operator()() const {
263         std::size_t size=_v1.size();
264         T1* first10=(T1*)boost::gil::at_c<0>(_v1.row_begin(0));
265         T1* first11=(T1*)boost::gil::at_c<1>(_v1.row_begin(0));
266         T1* first12=(T1*)boost::gil::at_c<2>(_v1.row_begin(0));
267         T2* first20=(T2*)boost::gil::at_c<0>(_v2.row_begin(0));
268         T2* first21=(T2*)boost::gil::at_c<1>(_v2.row_begin(0));
269         T2* first22=(T2*)boost::gil::at_c<2>(_v2.row_begin(0));
270         std::copy(first10,first10+size,first20);
271         std::copy(first11,first11+size,first21);
272         std::copy(first12,first12+size,first22);
273     }
274 };
275 template <typename T1, typename T2>
276 struct copy_nongil_t<RGB_VIEW(T1),RGB_PLANAR_VIEW(T2)> {
277     typedef RGB_VIEW(T1) View1;
278     typedef RGB_PLANAR_VIEW(T2) View2;
279     View1 _v1;
280     View2 _v2;
copy_nongil_tcopy_nongil_t281     copy_nongil_t(const View1& v1_in,const View2& v2_in) : _v1(v1_in), _v2(v2_in) {}
operator ()copy_nongil_t282     void operator()() const {
283         T1* first=(T1*)_v1.row_begin(0);
284         T1* last=first+_v1.size()*3;
285         T2* first0=(T2*)boost::gil::at_c<0>(_v2.row_begin(0));
286         T2* first1=(T2*)boost::gil::at_c<1>(_v2.row_begin(0));
287         T2* first2=(T2*)boost::gil::at_c<2>(_v2.row_begin(0));
288         while(first!=last) {
289             *first0++=first[0];
290             *first1++=first[1];
291             *first2++=first[2];
292             first+=3;
293         }
294     }
295 };
296 template <typename T1, typename T2>
297 struct copy_nongil_t<RGB_PLANAR_VIEW(T1),RGB_VIEW(T2)> {
298     typedef RGB_PLANAR_VIEW(T1) View1;
299     typedef RGB_VIEW(T2) View2;
300     View1 _v1;
301     View2 _v2;
copy_nongil_tcopy_nongil_t302     copy_nongil_t(const View1& v1_in,const View2& v2_in) : _v1(v1_in), _v2(v2_in) {}
operator ()copy_nongil_t303     void operator()() const {
304         T1* first=(T1*)_v2.row_begin(0);
305         T1* last=first+_v2.size()*3;
306         T2* first0=(T2*)boost::gil::at_c<0>(_v1.row_begin(0));
307         T2* first1=(T2*)boost::gil::at_c<1>(_v1.row_begin(0));
308         T2* first2=(T2*)boost::gil::at_c<2>(_v1.row_begin(0));
309         while(first!=last) {
310             first[0]=*first0++;
311             first[1]=*first1++;
312             first[2]=*first2++;
313             first+=3;
314         }
315     }
316 };
317 template <typename View1, typename View2>
test_copy(std::size_t trials)318 void test_copy(std::size_t trials) {
319     image<typename View1::value_type, is_planar<View1>::value> im1(width,height);
320     image<typename View2::value_type, is_planar<View2>::value> im2(width,height);
321     std::cout << "GIL: "    <<measure_time(copy_gil_t<View1,View2>(view(im1),view(im2)),trials) << std::endl;
322     std::cout << "Non-GIL: "<<measure_time(copy_nongil_t<View1,View2>(view(im1),view(im2)),trials) << std::endl;
323 }
324 
325 // transform()
326 template <typename T,typename Pixel>
327 struct bgr_to_rgb_t {
operator ()bgr_to_rgb_t328     pixel<T,rgb_layout_t> operator()(const Pixel& p) const {
329         return pixel<T,rgb_layout_t>(T(get_color(p,blue_t())*0.1f),
330                                      T(get_color(p,green_t())*0.2f),
331                                      T(get_color(p,red_t())*0.3f));
332     }
333 };
334 template <typename View1, typename View2, typename F>
335 struct transform_gil_t {
336     View1 _v1;
337     View2 _v2;
338     F _f;
transform_gil_ttransform_gil_t339     transform_gil_t(const View1& v1_in,const View2& v2_in,const F& f_in) : _v1(v1_in),_v2(v2_in),_f(f_in) {}
operator ()transform_gil_t340     void operator()() const {transform_pixels(_v1,_v2,_f);}
341 };
342 template <typename View1, typename View2, typename F> struct transform_nongil_t;
343 template <typename T1, typename T2, typename F>
344 struct transform_nongil_t<RGB_VIEW(T1),RGB_VIEW(T2),F> {
345     typedef RGB_VIEW(T1) View1;
346     typedef RGB_VIEW(T2) View2;
347     View1 _v1;
348     View2 _v2;
349     F _f;
transform_nongil_ttransform_nongil_t350     transform_nongil_t(const View1& v1_in,const View2& v2_in,const F& f_in) : _v1(v1_in),_v2(v2_in),_f(f_in) {}
operator ()transform_nongil_t351     void operator()() const {
352         T1* first1=(T1*)_v1.row_begin(0);
353         T2* first2=(T1*)_v2.row_begin(0);
354         T1* last1=first1+_v1.size()*3;
355         while(first1!=last1) {
356             first2[0]=T2(first1[2]*0.1f);
357             first2[1]=T2(first1[1]*0.2f);
358             first2[2]=T2(first1[0]*0.3f);
359             first1+=3; first2+=3;
360         }
361     }
362 };
363 template <typename T1, typename T2, typename F>
364 struct transform_nongil_t<RGB_PLANAR_VIEW(T1),RGB_PLANAR_VIEW(T2),F> {
365     typedef RGB_PLANAR_VIEW(T1) View1;
366     typedef RGB_PLANAR_VIEW(T2) View2;
367     View1 _v1;
368     View2 _v2;
369     F _f;
transform_nongil_ttransform_nongil_t370     transform_nongil_t(const View1& v1_in,const View2& v2_in,const F& f_in) : _v1(v1_in),_v2(v2_in),_f(f_in) {}
operator ()transform_nongil_t371     void operator()() const {
372         T1* first10=(T1*)boost::gil::at_c<0>(_v1.row_begin(0));
373         T1* first11=(T1*)boost::gil::at_c<1>(_v1.row_begin(0));
374         T1* first12=(T1*)boost::gil::at_c<2>(_v1.row_begin(0));
375         T1* first20=(T2*)boost::gil::at_c<0>(_v2.row_begin(0));
376         T1* first21=(T2*)boost::gil::at_c<1>(_v2.row_begin(0));
377         T1* first22=(T2*)boost::gil::at_c<2>(_v2.row_begin(0));
378         T1* last10=first10+_v1.size();
379         while(first10!=last10) {
380             *first20++=T2(*first12++*0.1f);
381             *first21++=T2(*first11++*0.2f);
382             *first22++=T2(*first10++*0.3f);
383         }
384     }
385 };
386 template <typename T1, typename T2, typename F>
387 struct transform_nongil_t<RGB_VIEW(T1),RGB_PLANAR_VIEW(T2),F> {
388     typedef RGB_VIEW(T1) View1;
389     typedef RGB_PLANAR_VIEW(T2) View2;
390     View1 _v1;
391     View2 _v2;
392     F _f;
transform_nongil_ttransform_nongil_t393     transform_nongil_t(const View1& v1_in,const View2& v2_in,const F& f_in) : _v1(v1_in),_v2(v2_in),_f(f_in) {}
operator ()transform_nongil_t394     void operator()() const {
395         T1* first1=(T1*)_v1.row_begin(0);
396         T1* last1=first1+_v1.size()*3;
397         T1* first20=(T2*)boost::gil::at_c<0>(_v2.row_begin(0));
398         T1* first21=(T2*)boost::gil::at_c<1>(_v2.row_begin(0));
399         T1* first22=(T2*)boost::gil::at_c<2>(_v2.row_begin(0));
400         while(first1!=last1) {
401             *first20++=T2(first1[2]*0.1f);
402             *first21++=T2(first1[1]*0.2f);
403             *first22++=T2(first1[0]*0.3f);
404             first1+=3;
405         }
406     }
407 };
408 template <typename T1, typename T2, typename F>
409 struct transform_nongil_t<RGB_PLANAR_VIEW(T1),RGB_VIEW(T2),F> {
410     typedef RGB_PLANAR_VIEW(T1) View1;
411     typedef RGB_VIEW(T2) View2;
412     View1 _v1;
413     View2 _v2;
414     F _f;
transform_nongil_ttransform_nongil_t415     transform_nongil_t(const View1& v1_in,const View2& v2_in,const F& f_in) : _v1(v1_in),_v2(v2_in),_f(f_in) {}
operator ()transform_nongil_t416     void operator()() const {
417         T1* first10=(T1*)boost::gil::at_c<0>(_v1.row_begin(0));
418         T1* first11=(T1*)boost::gil::at_c<1>(_v1.row_begin(0));
419         T1* first12=(T1*)boost::gil::at_c<2>(_v1.row_begin(0));
420         T2* first2=(T1*)_v2.row_begin(0);
421         T1* last2=first2+_v1.size()*3;
422         while(first2!=last2) {
423             first2[0]=T2(*first12++*0.1f);
424             first2[1]=T2(*first11++*0.2f);
425             first2[2]=T2(*first10++*0.3f);
426             first2+=3;
427         }
428     }
429 };
430 
431 template <typename View1, typename View2, typename F>
test_transform(std::size_t trials)432 void test_transform(std::size_t trials) {
433     image<typename View1::value_type, is_planar<View1>::value> im1(width,height);
434     image<typename View2::value_type, is_planar<View2>::value> im2(width,height);
435     std::cout << "GIL: "    <<measure_time(transform_gil_t<View1,View2,F>(view(im1),view(im2),F()),trials) << std::endl;
436     std::cout << "Non-GIL: "<<measure_time(transform_nongil_t<View1,View2,F>(view(im1),view(im2),F()),trials) << std::endl;
437 }
438 
main()439 int main() {
440 #ifdef NDEBUG
441     std::size_t num_trials=1000;
442 #else
443     std::size_t num_trials=1;
444 #endif
445 
446     // fill()
447     std::cout<<"test fill_pixels() on rgb8_image_t with rgb8_pixel_t"<<std::endl;
448     test_fill<rgb8_view_t,rgb8_pixel_t>(num_trials);
449     std::cout<<std::endl;
450 
451     std::cout<<"test fill_pixels() on rgb8_planar_image_t with rgb8_pixel_t"<<std::endl;
452     test_fill<rgb8_planar_view_t,rgb8_pixel_t>(num_trials);
453     std::cout<<std::endl;
454 
455     std::cout<<"test fill_pixels() on rgb8_image_t with bgr8_pixel_t"<<std::endl;
456     test_fill<rgb8_view_t,bgr8_pixel_t>(num_trials);
457     std::cout<<std::endl;
458 
459     std::cout<<"test fill_pixels() on rgb8_planar_image_t with bgr8_pixel_t"<<std::endl;
460     test_fill<rgb8_planar_view_t,bgr8_pixel_t>(num_trials);
461     std::cout<<std::endl;
462 
463     // for_each()
464     std::cout<<"test for_each_pixel() on rgb8_image_t"<<std::endl;
465     test_for_each<rgb8_view_t,rgb_fr_t<bits8> >(num_trials);
466     std::cout<<std::endl;
467 
468     std::cout<<"test for_each_pixel() on rgb8_planar_image_t"<<std::endl;
469     test_for_each<rgb8_planar_view_t,rgb_fr_t<bits8> >(num_trials);
470     std::cout<<std::endl;
471 
472     // copy()
473     std::cout<<"test copy_pixels() between rgb8_image_t and rgb8_image_t"<<std::endl;
474     test_copy<rgb8_view_t,rgb8_view_t>(num_trials);
475     std::cout<<std::endl;
476 
477     std::cout<<"test copy_pixels() between rgb8_image_t and bgr8_image_t"<<std::endl;
478     test_copy<rgb8_view_t,bgr8_view_t>(num_trials);
479     std::cout<<std::endl;
480 
481     std::cout<<"test copy_pixels() between rgb8_planar_image_t and rgb8_planar_image_t"<<std::endl;
482     test_copy<rgb8_planar_view_t,rgb8_planar_view_t>(num_trials);
483     std::cout<<std::endl;
484 
485     std::cout<<"test copy_pixels() between rgb8_image_t and rgb8_planar_image_t"<<std::endl;
486     test_copy<rgb8_view_t,rgb8_planar_view_t>(num_trials);
487     std::cout<<std::endl;
488 
489     std::cout<<"test copy_pixels() between rgb8_planar_image_t and rgb8_image_t"<<std::endl;
490     test_copy<rgb8_planar_view_t,rgb8_view_t>(num_trials);
491     std::cout<<std::endl;
492 
493     // transform()
494     std::cout<<"test transform_pixels() between rgb8_image_t and rgb8_image_t"<<std::endl;
495     test_transform<rgb8_view_t,rgb8_view_t,bgr_to_rgb_t<bits8,pixel<bits8,rgb_layout_t> > >(num_trials);
496     std::cout<<std::endl;
497 
498     std::cout<<"test transform_pixels() between rgb8_planar_image_t and rgb8_planar_image_t"<<std::endl;
499     test_transform<rgb8_planar_view_t,rgb8_planar_view_t,bgr_to_rgb_t<bits8,planar_pixel_reference<bits8,rgb_t> > >(num_trials);
500     std::cout<<std::endl;
501 
502     std::cout<<"test transform_pixels() between rgb8_image_t and rgb8_planar_image_t"<<std::endl;
503     test_transform<rgb8_view_t,rgb8_planar_view_t,bgr_to_rgb_t<bits8,pixel<bits8,rgb_layout_t> > >(num_trials);
504     std::cout<<std::endl;
505 
506     std::cout<<"test transform_pixels() between rgb8_planar_image_t and rgb8_image_t"<<std::endl;
507     test_transform<rgb8_planar_view_t,rgb8_view_t,bgr_to_rgb_t<bits8,planar_pixel_reference<bits8,rgb_t> > >(num_trials);
508     std::cout<<std::endl;
509 
510     return 0;
511 }
512