]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/gil/test/extension/io/tiff_tiled_write_macros.hpp
bump version to 15.2.11-pve1
[ceph.git] / ceph / src / boost / libs / gil / test / extension / io / tiff_tiled_write_macros.hpp
1 //
2 // Copyright 2013 Christian Henning
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 #ifndef BOOST_GIL_TIFF_TILED_WRITE_MACROS_HPP
9 #define BOOST_GIL_TIFF_TILED_WRITE_MACROS_HPP
10
11 #include <boost/gil.hpp>
12 #include <boost/gil/extension/io/tiff.hpp>
13
14 #include <boost/preprocessor/cat.hpp>
15 #include <boost/preprocessor/stringize.hpp>
16 #include <boost/preprocessor/tuple/elem.hpp>
17 #include <boost/preprocessor/comparison/less.hpp>
18 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
19
20 #include "paths.hpp"
21
22 using tag_t = boost::gil::tiff_tag;
23
24 // TODO: Rename the macros to BOOST_GIL_*
25
26 #ifdef BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
27
28 #define GENERATE_WRITE_TILE_BIT_ALIGNED_RGB(z, n, data)\
29 BOOST_AUTO_TEST_CASE( BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(write_rgb_tile_and_compare_with_,data),_strip_),n), bit_bit_aligned) )\
30 { \
31 using namespace std; \
32 using namespace boost; \
33 using namespace gil; \
34 string filename( string( "tiger-" ) + BOOST_PP_STRINGIZE(data) + "-strip-contig-" ); \
35 string path( tiff_in_GM ); \
36 string padding(""); \
37 if(BOOST_PP_LESS(n, 10)==1) \
38 padding = "0"; \
39 filename += padding + BOOST_PP_STRINGIZE(n) + ".tif"; \
40 path += filename; \
41 bit_aligned_image3_type< n, n, n, rgb_layout_t >::type img_strip, img_saved; \
42 read_image( path, img_strip, tag_t() ); \
43 image_write_info<tag_t> info; \
44 info._is_tiled = true; \
45 info._tile_width = info._tile_length = 16; \
46 write_view( tiff_out + filename, view(img_strip), info ); \
47 read_image( tiff_out + filename, img_saved, tag_t() ); \
48 BOOST_CHECK_EQUAL( equal_pixels( const_view(img_strip), const_view(img_saved) ), true); \
49 } \
50
51 // Special case for minisblack images
52 #define GENERATE_WRITE_TILE_BIT_ALIGNED_MINISBLACK(z, n, data)\
53 BOOST_AUTO_TEST_CASE( BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(write_minisblack_tile_and_compare_with_,data),_strip_),n), bit_bit_aligned) )\
54 { \
55 using namespace std; \
56 using namespace boost; \
57 using namespace gil; \
58 string filename( string( "tiger-" ) + BOOST_PP_STRINGIZE(data) + "-strip-" ); \
59 string path( tiff_in_GM ); \
60 string padding(""); \
61 if(BOOST_PP_LESS(n, 10)==1) \
62 padding = "0"; \
63 filename = filename + padding + BOOST_PP_STRINGIZE(n) + ".tif"; \
64 path += filename; \
65 bit_aligned_image1_type< n, gray_layout_t >::type img_strip, img_saved; \
66 read_image( path, img_strip, tag_t() ); \
67 image_write_info<tag_t> info; \
68 info._is_tiled = true; \
69 info._tile_width = info._tile_length = 16; \
70 write_view( tiff_out + filename, view(img_strip), info ); \
71 read_image( tiff_out + filename, img_saved, tag_t() ); \
72 BOOST_CHECK_EQUAL( equal_pixels( const_view(img_strip), const_view(img_saved) ), true); \
73 } \
74
75 // Special case for palette images
76 #define GENERATE_WRITE_TILE_BIT_ALIGNED_PALETTE(z, n, data)\
77 BOOST_AUTO_TEST_CASE( BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(write_palette_tile_and_compare_with_,data),_strip_),n), bit) )\
78 { \
79 using namespace std; \
80 using namespace boost; \
81 using namespace gil; \
82 string filename( string( "tiger-" ) + BOOST_PP_STRINGIZE(data) + "-strip-" ); \
83 string path( tiff_in_GM ); \
84 string padding(""); \
85 if(BOOST_PP_LESS(n, 10)==1) \
86 padding = "0"; \
87 filename = filename + padding + BOOST_PP_STRINGIZE(n) + ".tif"; \
88 path += filename; \
89 rgb16_image_t img_strip, img_saved; \
90 read_image( path, img_strip, tag_t() ); \
91 image_write_info<tag_t> info; \
92 info._is_tiled = true; \
93 info._tile_width = info._tile_length = 16; \
94 write_view( tiff_out + filename, view(img_strip), info ); \
95 read_image( tiff_out + filename, img_saved, tag_t() ); \
96 BOOST_CHECK_EQUAL( equal_pixels( const_view(img_strip), const_view(img_saved) ), true); \
97 } \
98
99 #else
100
101 #define GENERATE_WRITE_TILE_BIT_ALIGNED_RGB(z, n, data)\
102 BOOST_AUTO_TEST_CASE( BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(write_rgb_tile_and_compare_with_,data),_strip_),n), bit_bit_aligned) )\
103 { \
104 using namespace std; \
105 using namespace boost; \
106 using namespace gil; \
107 string filename( string( "tiger-" ) + BOOST_PP_STRINGIZE(data) + "-strip-contig-" ); \
108 string path( tiff_in_GM ); \
109 string padding(""); \
110 if(BOOST_PP_LESS(n, 10)==1) \
111 padding = "0"; \
112 filename += padding + BOOST_PP_STRINGIZE(n) + ".tif"; \
113 path += filename; \
114 bit_aligned_image3_type< n, n, n, rgb_layout_t >::type img_strip, img_saved; \
115 read_image( path, img_strip, tag_t() ); \
116 image_write_info<tag_t> info; \
117 info._is_tiled = true; \
118 info._tile_width = info._tile_length = 16; \
119 } \
120
121 // Special case for minisblack images
122 #define GENERATE_WRITE_TILE_BIT_ALIGNED_MINISBLACK(z, n, data)\
123 BOOST_AUTO_TEST_CASE( BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(write_minisblack_tile_and_compare_with_,data),_strip_),n), bit_bit_aligned) )\
124 { \
125 using namespace std; \
126 using namespace boost; \
127 using namespace gil; \
128 string filename( string( "tiger-" ) + BOOST_PP_STRINGIZE(data) + "-strip-" ); \
129 string path( tiff_in_GM ); \
130 string padding(""); \
131 if(BOOST_PP_LESS(n, 10)==1) \
132 padding = "0"; \
133 filename = filename + padding + BOOST_PP_STRINGIZE(n) + ".tif"; \
134 path += filename; \
135 bit_aligned_image1_type< n, gray_layout_t >::type img_strip, img_saved; \
136 read_image( path, img_strip, tag_t() ); \
137 image_write_info<tag_t> info; \
138 info._is_tiled = true; \
139 info._tile_width = info._tile_length = 16; \
140 } \
141
142 // Special case for palette images
143 #define GENERATE_WRITE_TILE_BIT_ALIGNED_PALETTE(z, n, data)\
144 BOOST_AUTO_TEST_CASE( BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_CAT(write_palette_tile_and_compare_with_,data),_strip_),n), bit) )\
145 { \
146 using namespace std; \
147 using namespace boost; \
148 using namespace gil; \
149 string filename( string( "tiger-" ) + BOOST_PP_STRINGIZE(data) + "-strip-" ); \
150 string path( tiff_in_GM ); \
151 string padding(""); \
152 if(BOOST_PP_LESS(n, 10)==1) \
153 padding = "0"; \
154 filename = filename + padding + BOOST_PP_STRINGIZE(n) + ".tif"; \
155 path += filename; \
156 rgb16_image_t img_strip, img_saved; \
157 read_image( path, img_strip, tag_t() ); \
158 image_write_info<tag_t> info; \
159 info._is_tiled = true; \
160 info._tile_width = info._tile_length = 16; \
161 } \
162
163 #endif // BOOST_GIL_IO_TEST_ALLOW_WRITING_IMAGES
164
165 #endif // BOOST_GIL_TIFF_TILED_READ_MACROS_HPP