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 #include <boost/gil.hpp>
9 #include <boost/gil/extension/io/tiff.hpp>
10
11 #include <boost/core/lightweight_test.hpp>
12
13 #include <cstdint>
14 #include <string>
15
16 #include "tiff_tiled_read_macros.hpp"
17
18 namespace gil = boost::gil;
19
20 #ifdef BOOST_GIL_IO_USE_TIFF_GRAPHICSMAGICK_TEST_SUITE_IMAGES
21
22 // FIXME: The (rgb, planar) construct does not seem to work! ~mloskot
23 BOOST_PP_REPEAT_FROM_TO(21, 32, GENERATE_TILE_STRIP_COMPARISON_BIT_ALIGNED_RGB, (rgb, contig))
24
test_read_tile_and_compare_with_rgb_contig_strip_32()25 void test_read_tile_and_compare_with_rgb_contig_strip_32()
26 {
27 std::string filename_strip(tiff_in_GM + "tiger-rgb-strip-contig-32.tif");
28 std::string filename_tile(tiff_in_GM + "tiger-rgb-tile-contig-32.tif");
29
30 using rgb32_pixel_t = gil::pixel<unsigned int, gil::rgb_layout_t>;
31 gil::image<rgb32_pixel_t, false> img_strip, img_tile;
32
33 gil::read_image(filename_strip, img_strip, gil::tiff_tag());
34 gil::read_image(filename_tile, img_tile, gil::tiff_tag());
35
36 BOOST_TEST(gil::equal_pixels(gil::const_view(img_strip), gil::const_view(img_tile)));
37 }
38
test_read_tile_and_compare_with_rgb_contig_strip_64()39 void test_read_tile_and_compare_with_rgb_contig_strip_64()
40 {
41 std::string filename_strip(tiff_in_GM + "tiger-rgb-strip-contig-64.tif");
42 std::string filename_tile(tiff_in_GM + "tiger-rgb-tile-contig-64.tif");
43
44 using rgb64_pixel_t = gil::pixel<std::uint64_t, gil::rgb_layout_t>;
45 gil::image<rgb64_pixel_t, false> img_strip, img_tile;
46
47 gil::read_image(filename_strip, img_strip, gil::tiff_tag());
48 gil::read_image(filename_tile, img_tile, gil::tiff_tag());
49
50 BOOST_TEST(gil::equal_pixels(gil::const_view(img_strip), gil::const_view(img_tile)));
51 }
52
main()53 int main()
54 {
55 test_read_tile_and_compare_with_rgb_contig_strip_32();
56 test_read_tile_and_compare_with_rgb_contig_strip_64();
57
58 // TODO: Make sure generated test cases are executed. See tiff_subimage_test.cpp. ~mloskot
59
60 return boost::report_errors();
61 }
62
63 #else
main()64 int main() {}
65 #endif // BOOST_GIL_IO_USE_TIFF_GRAPHICSMAGICK_TEST_SUITE_IMAGES
66