performance.cpp 19 KB

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