add boost on mac
This commit is contained in:
134
macx64/include/boost/gil/extension/io/raw/detail/device.hpp
Normal file
134
macx64/include/boost/gil/extension/io/raw/detail/device.hpp
Normal file
@@ -0,0 +1,134 @@
|
||||
//
|
||||
// Copyright 2012 Olivier Tournaire
|
||||
// Copyright 2007 Christian Henning
|
||||
//
|
||||
// Distributed under 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
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_IO_RAW_DETAIL_DEVICE_HPP
|
||||
#define BOOST_GIL_EXTENSION_IO_RAW_DETAIL_DEVICE_HPP
|
||||
|
||||
#include <boost/gil/extension/io/raw/tags.hpp>
|
||||
|
||||
#include <boost/gil/io/base.hpp>
|
||||
#include <boost/gil/io/device.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace boost { namespace gil { namespace detail {
|
||||
|
||||
class raw_device_base
|
||||
{
|
||||
public:
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
raw_device_base()
|
||||
: _processor_ptr( new LibRaw )
|
||||
{}
|
||||
|
||||
// iparams getters
|
||||
std::string get_camera_manufacturer() { return std::string(_processor_ptr.get()->imgdata.idata.make); }
|
||||
std::string get_camera_model() { return std::string(_processor_ptr.get()->imgdata.idata.model); }
|
||||
unsigned get_raw_count() { return _processor_ptr.get()->imgdata.idata.raw_count; }
|
||||
unsigned get_dng_version() { return _processor_ptr.get()->imgdata.idata.dng_version; }
|
||||
int get_colors() { return _processor_ptr.get()->imgdata.idata.colors; }
|
||||
unsigned get_filters() { return _processor_ptr.get()->imgdata.idata.filters; }
|
||||
std::string get_cdesc() { return std::string(_processor_ptr.get()->imgdata.idata.cdesc); }
|
||||
|
||||
// image_sizes getters
|
||||
unsigned short get_raw_width() { return _processor_ptr.get()->imgdata.sizes.raw_width; }
|
||||
unsigned short get_raw_height() { return _processor_ptr.get()->imgdata.sizes.raw_height; }
|
||||
unsigned short get_image_width() { return _processor_ptr.get()->imgdata.sizes.width; }
|
||||
unsigned short get_image_height() { return _processor_ptr.get()->imgdata.sizes.height; }
|
||||
unsigned short get_top_margin() { return _processor_ptr.get()->imgdata.sizes.top_margin; }
|
||||
unsigned short get_left_margin() { return _processor_ptr.get()->imgdata.sizes.left_margin; }
|
||||
unsigned short get_iwidth() { return _processor_ptr.get()->imgdata.sizes.iwidth; }
|
||||
unsigned short get_iheight() { return _processor_ptr.get()->imgdata.sizes.iheight; }
|
||||
double get_pixel_aspect() { return _processor_ptr.get()->imgdata.sizes.pixel_aspect; }
|
||||
int get_flip() { return _processor_ptr.get()->imgdata.sizes.flip; }
|
||||
|
||||
// colordata getters
|
||||
// TODO
|
||||
|
||||
// imgother getters
|
||||
float get_iso_speed() { return _processor_ptr.get()->imgdata.other.iso_speed; }
|
||||
float get_shutter() { return _processor_ptr.get()->imgdata.other.shutter; }
|
||||
float get_aperture() { return _processor_ptr.get()->imgdata.other.aperture; }
|
||||
float get_focal_len() { return _processor_ptr.get()->imgdata.other.focal_len; }
|
||||
time_t get_timestamp() { return _processor_ptr.get()->imgdata.other.timestamp; }
|
||||
unsigned int get_shot_order() { return _processor_ptr.get()->imgdata.other.shot_order; }
|
||||
unsigned* get_gpsdata() { return _processor_ptr.get()->imgdata.other.gpsdata; }
|
||||
std::string get_desc() { return std::string(_processor_ptr.get()->imgdata.other.desc); }
|
||||
std::string get_artist() { return std::string(_processor_ptr.get()->imgdata.other.artist); }
|
||||
|
||||
std::string get_version() { return std::string(_processor_ptr.get()->version()); }
|
||||
std::string get_unpack_function_name() { return std::string(_processor_ptr.get()->unpack_function_name()); }
|
||||
|
||||
void get_mem_image_format(int *widthp, int *heightp, int *colorsp, int *bpp) { _processor_ptr.get()->get_mem_image_format(widthp, heightp, colorsp, bpp); }
|
||||
|
||||
int unpack() { return _processor_ptr.get()->unpack(); }
|
||||
int dcraw_process() { return _processor_ptr.get()->dcraw_process(); }
|
||||
libraw_processed_image_t* dcraw_make_mem_image(int* error_code=nullptr) { return _processor_ptr.get()->dcraw_make_mem_image(error_code); }
|
||||
|
||||
protected:
|
||||
|
||||
using libraw_ptr_t = std::shared_ptr<LibRaw>;
|
||||
libraw_ptr_t _processor_ptr;
|
||||
};
|
||||
|
||||
/*!
|
||||
*
|
||||
* file_stream_device specialization for raw images
|
||||
*/
|
||||
template<>
|
||||
class file_stream_device< raw_tag > : public raw_device_base
|
||||
{
|
||||
public:
|
||||
|
||||
struct read_tag {};
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
file_stream_device( std::string const& file_name
|
||||
, read_tag = read_tag()
|
||||
)
|
||||
{
|
||||
io_error_if( _processor_ptr.get()->open_file( file_name.c_str() ) != LIBRAW_SUCCESS
|
||||
, "file_stream_device: failed to open file"
|
||||
);
|
||||
}
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
file_stream_device( const char* file_name
|
||||
, read_tag = read_tag()
|
||||
)
|
||||
{
|
||||
io_error_if( _processor_ptr.get()->open_file( file_name ) != LIBRAW_SUCCESS
|
||||
, "file_stream_device: failed to open file"
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
template< typename FormatTag >
|
||||
struct is_adaptable_input_device< FormatTag
|
||||
, LibRaw
|
||||
, void
|
||||
>
|
||||
: mpl::true_
|
||||
{
|
||||
using device_type = file_stream_device<FormatTag>;
|
||||
};
|
||||
|
||||
|
||||
} // namespace detail
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// Copyright 2009 Christian Henning
|
||||
//
|
||||
// Distributed under 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
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_IO_RAW_DETAIL_IS_ALLOWED_HPP
|
||||
#define BOOST_GIL_EXTENSION_IO_RAW_DETAIL_IS_ALLOWED_HPP
|
||||
|
||||
#include <boost/gil/extension/io/raw/tags.hpp>
|
||||
#include <boost/gil/io/base.hpp>
|
||||
|
||||
namespace boost { namespace gil { namespace detail {
|
||||
|
||||
template< typename View >
|
||||
bool is_allowed( const image_read_info< raw_tag >& info
|
||||
, mpl::true_ // is read_and_no_convert
|
||||
)
|
||||
{
|
||||
using pixel_t = typename get_pixel_type<View>::type;
|
||||
using num_channel_t = typename num_channels<pixel_t>::value_type;
|
||||
using channel_t = typename channel_traits<typename element_type<typename View::value_type>::type>::value_type;
|
||||
|
||||
const num_channel_t dst_samples_per_pixel = num_channels< pixel_t >::value;
|
||||
const unsigned int dst_bits_per_pixel = detail::unsigned_integral_num_bits< channel_t >::value;
|
||||
const bool is_type_signed = boost::is_signed< channel_t >::value;
|
||||
|
||||
return( dst_samples_per_pixel == info._samples_per_pixel &&
|
||||
dst_bits_per_pixel == static_cast<unsigned int>(info._bits_per_pixel) &&
|
||||
!is_type_signed );
|
||||
}
|
||||
|
||||
template< typename View >
|
||||
bool is_allowed( const image_read_info< raw_tag >& /* info */
|
||||
, mpl::false_ // is read_and_convert
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
243
macx64/include/boost/gil/extension/io/raw/detail/read.hpp
Normal file
243
macx64/include/boost/gil/extension/io/raw/detail/read.hpp
Normal file
@@ -0,0 +1,243 @@
|
||||
//
|
||||
// Copyright 2012 Olivier Tournaire, Christian Henning
|
||||
//
|
||||
// Distributed under 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
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_IO_RAW_DETAIL_READ_HPP
|
||||
#define BOOST_GIL_EXTENSION_IO_RAW_DETAIL_READ_HPP
|
||||
|
||||
#include <boost/gil/extension/io/raw/tags.hpp>
|
||||
#include <boost/gil/extension/io/raw/detail/device.hpp>
|
||||
#include <boost/gil/extension/io/raw/detail/is_allowed.hpp>
|
||||
#include <boost/gil/extension/io/raw/detail/reader_backend.hpp>
|
||||
|
||||
#include <boost/gil/io/base.hpp>
|
||||
#include <boost/gil/io/bit_operations.hpp>
|
||||
#include <boost/gil/io/conversion_policies.hpp>
|
||||
#include <boost/gil/io/device.hpp>
|
||||
#include <boost/gil/io/dynamic_io_new.hpp>
|
||||
#include <boost/gil/io/reader_base.hpp>
|
||||
#include <boost/gil/io/row_buffer_helper.hpp>
|
||||
#include <boost/gil/io/typedefs.hpp>
|
||||
|
||||
#include <cstdio>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4512) //assignment operator could not be generated
|
||||
#endif
|
||||
|
||||
#define BUILD_INTERLEAVED_VIEW(color_layout, bits_per_pixel) \
|
||||
{ \
|
||||
color_layout##bits_per_pixel##_view_t build = boost::gil::interleaved_view(processed_image->width, \
|
||||
processed_image->height, \
|
||||
(color_layout##bits_per_pixel##_pixel_t*)processed_image->data, \
|
||||
processed_image->colors*processed_image->width*processed_image->bits/8); \
|
||||
this->_cc_policy.read( build.begin(), build.end(), dst_view.begin() ); \
|
||||
} \
|
||||
|
||||
|
||||
template< typename Device
|
||||
, typename ConversionPolicy
|
||||
>
|
||||
class reader< Device
|
||||
, raw_tag
|
||||
, ConversionPolicy
|
||||
>
|
||||
: public reader_base< raw_tag
|
||||
, ConversionPolicy
|
||||
>
|
||||
, public reader_backend< Device
|
||||
, raw_tag
|
||||
>
|
||||
{
|
||||
private:
|
||||
|
||||
using this_t = reader<Device, raw_tag, ConversionPolicy>;
|
||||
using cc_t = typename ConversionPolicy::color_converter_type;
|
||||
|
||||
public:
|
||||
|
||||
using backend_t = reader_backend<Device, raw_tag>;
|
||||
|
||||
//
|
||||
// Constructor
|
||||
//
|
||||
reader( const Device& io_dev
|
||||
, const image_read_settings< raw_tag >& settings
|
||||
)
|
||||
: backend_t( io_dev
|
||||
, settings
|
||||
)
|
||||
{}
|
||||
|
||||
//
|
||||
// Constructor
|
||||
//
|
||||
reader( const Device& io_dev
|
||||
, const cc_t& cc
|
||||
, const image_read_settings< raw_tag >& settings
|
||||
)
|
||||
: reader_base< raw_tag
|
||||
, ConversionPolicy
|
||||
>( cc )
|
||||
, backend_t( io_dev
|
||||
, settings
|
||||
)
|
||||
{}
|
||||
|
||||
template< typename View >
|
||||
void apply( const View& dst_view )
|
||||
{
|
||||
if( this->_info._valid == false )
|
||||
{
|
||||
io_error( "Image header was not read." );
|
||||
}
|
||||
|
||||
using is_read_and_convert_t = typename is_same
|
||||
<
|
||||
ConversionPolicy,
|
||||
detail::read_and_no_convert
|
||||
>::type;
|
||||
|
||||
io_error_if( !detail::is_allowed< View >( this->_info
|
||||
, is_read_and_convert_t()
|
||||
)
|
||||
, "Image types aren't compatible."
|
||||
);
|
||||
|
||||
// TODO: better error handling based on return code
|
||||
int return_code = this->_io_dev.unpack();
|
||||
io_error_if( return_code != LIBRAW_SUCCESS, "Unable to unpack image" );
|
||||
this->_info._unpack_function_name = this->_io_dev.get_unpack_function_name();
|
||||
|
||||
return_code = this->_io_dev.dcraw_process();
|
||||
io_error_if( return_code != LIBRAW_SUCCESS, "Unable to emulate dcraw behavior to process image" );
|
||||
|
||||
libraw_processed_image_t* processed_image = this->_io_dev.dcraw_make_mem_image(&return_code);
|
||||
io_error_if( return_code != LIBRAW_SUCCESS, "Unable to dcraw_make_mem_image" );
|
||||
|
||||
if(processed_image->colors!=1 && processed_image->colors!=3)
|
||||
io_error( "Image is neither gray nor RGB" );
|
||||
|
||||
if(processed_image->bits!=8 && processed_image->bits!=16)
|
||||
io_error( "Image is neither 8bit nor 16bit" );
|
||||
|
||||
// TODO Olivier Tournaire
|
||||
// Here, we should use a metafunction to reduce code size and avoid a (compile time) macro
|
||||
if(processed_image->bits==8)
|
||||
{
|
||||
if(processed_image->colors==1){ BUILD_INTERLEAVED_VIEW(gray, 8); }
|
||||
else { BUILD_INTERLEAVED_VIEW(rgb, 8); }
|
||||
}
|
||||
else if(processed_image->bits==16)
|
||||
{
|
||||
if(processed_image->colors==1){ BUILD_INTERLEAVED_VIEW(gray, 16); }
|
||||
else { BUILD_INTERLEAVED_VIEW(rgb, 16); }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct raw_read_is_supported
|
||||
{
|
||||
template< typename View >
|
||||
struct apply : public is_read_supported< typename get_pixel_type< View >::type
|
||||
, raw_tag
|
||||
>
|
||||
{};
|
||||
};
|
||||
|
||||
struct raw_type_format_checker
|
||||
{
|
||||
raw_type_format_checker( const image_read_info< raw_tag >& info )
|
||||
: _info( info )
|
||||
{}
|
||||
|
||||
template< typename Image >
|
||||
bool apply()
|
||||
{
|
||||
using view_t = typename Image::view_t;
|
||||
|
||||
return is_allowed< view_t >( _info
|
||||
, mpl::true_()
|
||||
);
|
||||
}
|
||||
|
||||
private:
|
||||
///todo: do we need this here. Should be part of reader_backend
|
||||
const image_read_info< raw_tag >& _info;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
///
|
||||
/// RAW Dynamic Reader
|
||||
///
|
||||
template< typename Device >
|
||||
class dynamic_image_reader< Device
|
||||
, raw_tag
|
||||
>
|
||||
: public reader< Device
|
||||
, raw_tag
|
||||
, detail::read_and_no_convert
|
||||
>
|
||||
{
|
||||
using parent_t = reader<Device, raw_tag, detail::read_and_no_convert>;
|
||||
|
||||
public:
|
||||
|
||||
dynamic_image_reader( const Device& io_dev
|
||||
, const image_read_settings< raw_tag >& settings
|
||||
)
|
||||
: parent_t( io_dev
|
||||
, settings
|
||||
)
|
||||
{}
|
||||
|
||||
template< typename Images >
|
||||
void apply( any_image< Images >& images )
|
||||
{
|
||||
detail::raw_type_format_checker format_checker( this->_info );
|
||||
|
||||
if( !construct_matched( images
|
||||
, format_checker
|
||||
))
|
||||
{
|
||||
std::ostringstream error_message;
|
||||
error_message << "No matching image type between those of the given any_image and that of the file.\n";
|
||||
error_message << "Image type must be {gray||rgb}{8||16} unsigned for RAW image files.";
|
||||
io_error( error_message.str().c_str() );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !this->_info._valid )
|
||||
this->read_header();
|
||||
this->init_image(images, this->_settings);
|
||||
|
||||
detail::dynamic_io_fnobj< detail::raw_read_is_supported
|
||||
, parent_t
|
||||
> op( this );
|
||||
|
||||
apply_operation( view( images )
|
||||
, op
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
} // gil
|
||||
} // boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,140 @@
|
||||
//
|
||||
// Copyright 2012 Christian Henning
|
||||
//
|
||||
// Distributed under 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
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_IO_RAW_DETAIL_READER_BACKEND_HPP
|
||||
#define BOOST_GIL_EXTENSION_IO_RAW_DETAIL_READER_BACKEND_HPP
|
||||
|
||||
#include <boost/gil/extension/io/raw/tags.hpp>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4512) //assignment operator could not be generated
|
||||
#endif
|
||||
|
||||
///
|
||||
/// RAW Backend
|
||||
///
|
||||
template< typename Device >
|
||||
struct reader_backend< Device
|
||||
, raw_tag
|
||||
>
|
||||
{
|
||||
public:
|
||||
|
||||
using format_tag_t = raw_tag;
|
||||
|
||||
public:
|
||||
|
||||
reader_backend( const Device& io_dev
|
||||
, const image_read_settings< raw_tag >& settings
|
||||
)
|
||||
: _io_dev ( io_dev )
|
||||
, _settings( settings )
|
||||
, _info()
|
||||
, _scanline_length( 0 )
|
||||
{
|
||||
read_header();
|
||||
|
||||
if( _settings._dim.x == 0 )
|
||||
{
|
||||
_settings._dim.x = _info._width;
|
||||
}
|
||||
|
||||
if( _settings._dim.y == 0 )
|
||||
{
|
||||
_settings._dim.y = _info._height;
|
||||
}
|
||||
}
|
||||
|
||||
void read_header()
|
||||
{
|
||||
_io_dev.get_mem_image_format( &_info._width
|
||||
, &_info._height
|
||||
, &_info._samples_per_pixel
|
||||
, &_info._bits_per_pixel
|
||||
);
|
||||
|
||||
// iparams
|
||||
_info._camera_manufacturer = _io_dev.get_camera_manufacturer();
|
||||
_info._camera_model = _io_dev.get_camera_model();
|
||||
_info._raw_images_count = _io_dev.get_raw_count();
|
||||
_info._dng_version = _io_dev.get_dng_version();
|
||||
_info._number_colors = _io_dev.get_colors();
|
||||
//_io_dev.get_filters();
|
||||
_info._colors_description = _io_dev.get_cdesc();
|
||||
|
||||
// image_sizes
|
||||
_info._raw_width = _io_dev.get_raw_width();
|
||||
_info._raw_height = _io_dev.get_raw_height();
|
||||
_info._visible_width = _io_dev.get_image_width();
|
||||
_info._visible_height = _io_dev.get_image_height();
|
||||
_info._top_margin = _io_dev.get_top_margin();
|
||||
_info._left_margin = _io_dev.get_left_margin();
|
||||
_info._output_width = _io_dev.get_iwidth();
|
||||
_info._output_height = _io_dev.get_iheight();
|
||||
_info._pixel_aspect = _io_dev.get_pixel_aspect();
|
||||
_info._flip = _io_dev.get_flip();
|
||||
|
||||
// imgother
|
||||
_info._iso_speed = _io_dev.get_iso_speed();
|
||||
_info._shutter = _io_dev.get_shutter();
|
||||
_info._aperture = _io_dev.get_aperture();
|
||||
_info._focal_length = _io_dev.get_focal_len();
|
||||
_info._timestamp = _io_dev.get_timestamp();
|
||||
_info._shot_order = static_cast< uint16_t >( _io_dev.get_shot_order() );
|
||||
//_io_dev.get_gpsdata();
|
||||
_info._image_description = _io_dev.get_desc();
|
||||
_info._artist = _io_dev.get_artist();
|
||||
|
||||
_info._libraw_version = _io_dev.get_version();
|
||||
|
||||
_info._valid = true;
|
||||
}
|
||||
|
||||
/// Check if image is large enough.
|
||||
void check_image_size( const point_t& img_dim )
|
||||
{
|
||||
if( _settings._dim.x > 0 )
|
||||
{
|
||||
if( img_dim.x < _settings._dim.x ) { io_error( "Supplied image is too small" ); }
|
||||
}
|
||||
else
|
||||
{
|
||||
if( img_dim.x < _info._width ) { io_error( "Supplied image is too small" ); }
|
||||
}
|
||||
|
||||
|
||||
if( _settings._dim.y > 0 )
|
||||
{
|
||||
if( img_dim.y < _settings._dim.y ) { io_error( "Supplied image is too small" ); }
|
||||
}
|
||||
else
|
||||
{
|
||||
if( img_dim.y < _info._height ) { io_error( "Supplied image is too small" ); }
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Device _io_dev;
|
||||
|
||||
image_read_settings< raw_tag > _settings;
|
||||
image_read_info< raw_tag > _info;
|
||||
|
||||
std::size_t _scanline_length;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// Copyright 2008 Christian Henning
|
||||
//
|
||||
// Distributed under 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
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_IO_RAW_DETAIL_SUPPORTED_TYPES_HPP
|
||||
#define BOOST_GIL_EXTENSION_IO_RAW_DETAIL_SUPPORTED_TYPES_HPP
|
||||
|
||||
#include <boost/gil/extension/io/raw/tags.hpp>
|
||||
|
||||
#include <boost/gil/channel.hpp>
|
||||
#include <boost/gil/color_base.hpp>
|
||||
#include <boost/gil/io/base.hpp>
|
||||
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace gil { namespace detail {
|
||||
|
||||
// Read support
|
||||
|
||||
template< typename Channel
|
||||
, typename ColorSpace
|
||||
>
|
||||
struct raw_read_support : read_support_false {};
|
||||
|
||||
template<>
|
||||
struct raw_read_support<uint8_t
|
||||
, gray_t
|
||||
> : read_support_true {};
|
||||
|
||||
template<>
|
||||
struct raw_read_support<uint16_t
|
||||
, gray_t
|
||||
> : read_support_true {};
|
||||
|
||||
template<>
|
||||
struct raw_read_support<uint8_t
|
||||
, rgb_t
|
||||
> : read_support_true {};
|
||||
|
||||
template<>
|
||||
struct raw_read_support<uint16_t
|
||||
, rgb_t
|
||||
> : read_support_true {};
|
||||
|
||||
// Write support
|
||||
|
||||
struct raw_write_support : write_support_false {};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template< typename Pixel >
|
||||
struct is_read_supported< Pixel,
|
||||
raw_tag
|
||||
>
|
||||
: mpl::bool_< detail::raw_read_support< typename channel_type< Pixel >::type
|
||||
, typename color_space_type< Pixel >::type
|
||||
>::is_supported > {};
|
||||
|
||||
template< typename Pixel >
|
||||
struct is_write_supported< Pixel
|
||||
, raw_tag
|
||||
>
|
||||
: mpl::bool_< detail::raw_write_support::is_supported >
|
||||
{};
|
||||
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif
|
||||
28
macx64/include/boost/gil/extension/io/raw/read.hpp
Normal file
28
macx64/include/boost/gil/extension/io/raw/read.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Copyright 2013 Christian Henning
|
||||
// Copyright 2012 Olivier Tournaire
|
||||
//
|
||||
// Distributed under 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
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_IO_RAW_READ_HPP
|
||||
#define BOOST_GIL_EXTENSION_IO_RAW_READ_HPP
|
||||
|
||||
#include <boost/gil/extension/io/raw/tags.hpp>
|
||||
#include <boost/gil/extension/io/raw/detail/supported_types.hpp>
|
||||
#include <boost/gil/extension/io/raw/detail/read.hpp>
|
||||
|
||||
#include <boost/gil/io/get_reader.hpp>
|
||||
#include <boost/gil/io/make_backend.hpp>
|
||||
#include <boost/gil/io/make_dynamic_image_reader.hpp>
|
||||
#include <boost/gil/io/make_reader.hpp>
|
||||
#include <boost/gil/io/make_scanline_reader.hpp>
|
||||
#include <boost/gil/io/read_and_convert_image.hpp>
|
||||
#include <boost/gil/io/read_and_convert_view.hpp>
|
||||
#include <boost/gil/io/read_image.hpp>
|
||||
#include <boost/gil/io/read_image_info.hpp>
|
||||
#include <boost/gil/io/read_view.hpp>
|
||||
#include <boost/gil/io/scanline_read_iterator.hpp>
|
||||
|
||||
#endif
|
||||
196
macx64/include/boost/gil/extension/io/raw/tags.hpp
Normal file
196
macx64/include/boost/gil/extension/io/raw/tags.hpp
Normal file
@@ -0,0 +1,196 @@
|
||||
//
|
||||
// Copyright 2013 Christian Henning
|
||||
//
|
||||
// Distributed under 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
|
||||
//
|
||||
#ifndef BOOST_GIL_EXTENSION_IO_RAW_TAGS_HPP
|
||||
#define BOOST_GIL_EXTENSION_IO_RAW_TAGS_HPP
|
||||
|
||||
#include <boost/gil/io/base.hpp>
|
||||
|
||||
#include <libraw/libraw.h>
|
||||
|
||||
namespace boost { namespace gil {
|
||||
|
||||
/// Defines tiff tag.
|
||||
struct raw_tag : format_tag {};
|
||||
|
||||
/// Defines type for image width property.
|
||||
struct raw_image_width : property_base< int32_t > {};
|
||||
|
||||
/// Defines type for image height property.
|
||||
struct raw_image_height : property_base< int32_t > {};
|
||||
|
||||
/// Defines type for samples per pixel property.
|
||||
struct raw_samples_per_pixel : property_base< int32_t > {};
|
||||
|
||||
/// Defines type for bits per pixel property.
|
||||
struct raw_bits_per_pixel : property_base< int32_t > {};
|
||||
|
||||
/// Defines type for camera manufacturer.
|
||||
struct raw_camera_manufacturer : property_base< std::string > {};
|
||||
|
||||
/// Defines type for camera model.
|
||||
struct raw_camera_model : property_base< std::string > {};
|
||||
|
||||
/// Defines type for raw images count.
|
||||
struct raw_raw_images_count : property_base< unsigned > {};
|
||||
|
||||
/// Defines type for dng version.
|
||||
struct raw_dng_version : property_base< unsigned > {};
|
||||
|
||||
/// Defines type for number of colors.
|
||||
struct raw_number_colors : property_base< int32_t > {};
|
||||
|
||||
/// Defines type for colors description.
|
||||
struct raw_colors_description : property_base< std::string > {};
|
||||
|
||||
/// Defines type for raw height.
|
||||
struct raw_raw_height : property_base< uint16_t > {};
|
||||
|
||||
/// Defines type for raw width.
|
||||
struct raw_raw_width : property_base< uint16_t > {};
|
||||
|
||||
/// Defines type for visible height.
|
||||
struct raw_visible_height : property_base< uint16_t > {};
|
||||
|
||||
/// Defines type for visible width.
|
||||
struct raw_visible_width : property_base< uint16_t > {};
|
||||
|
||||
/// Defines type for top margin.
|
||||
struct raw_top_margin : property_base< uint16_t > {};
|
||||
|
||||
/// Defines type for left margin.
|
||||
struct raw_left_margin : property_base< uint16_t > {};
|
||||
|
||||
/// Defines type for output height.
|
||||
struct raw_output_height : property_base< uint16_t > {};
|
||||
|
||||
/// Defines type for output width.
|
||||
struct raw_output_width : property_base< uint16_t > {};
|
||||
|
||||
/// Defines type for pixel aspect.
|
||||
struct raw_pixel_aspect : property_base< double > {};
|
||||
|
||||
/// Defines type for image orientation.
|
||||
struct raw_flip : property_base< uint32_t > {};
|
||||
|
||||
/// Defines type for iso speed.
|
||||
struct raw_iso_speed : property_base< float > {};
|
||||
|
||||
/// Defines type for shutter.
|
||||
struct raw_shutter : property_base< float > {};
|
||||
|
||||
/// Defines type for aperture.
|
||||
struct raw_aperture : property_base< float > {};
|
||||
|
||||
/// Defines type for focal length.
|
||||
struct raw_focal_length : property_base< float > {};
|
||||
|
||||
/// Defines type for timestamp.
|
||||
struct raw_timestamp : property_base< time_t > {};
|
||||
|
||||
/// Defines type for shot order.
|
||||
struct raw_shot_order : property_base< uint16_t > {};
|
||||
|
||||
/// Defines type for image description.
|
||||
struct raw_image_description : property_base< std::string > {};
|
||||
|
||||
/// Defines type for artist.
|
||||
struct raw_artist : property_base< std::string > {};
|
||||
|
||||
/// Defines type for libraw version.
|
||||
struct raw_libraw_version : property_base< std::string > {};
|
||||
|
||||
/// Defines type for unpack function name.
|
||||
struct raw_unpack_function_name : property_base< std::string > {};
|
||||
|
||||
/// Read information for raw images.
|
||||
///
|
||||
/// The structure is returned when using read_image_info.
|
||||
template<>
|
||||
struct image_read_info< raw_tag >
|
||||
{
|
||||
/// Default contructor.
|
||||
image_read_info< raw_tag >()
|
||||
: _valid( false )
|
||||
{}
|
||||
|
||||
// Here, width and height of the image are the ones of the output height (ie after having been processed by dcraw emulator)
|
||||
raw_image_width::type _width;
|
||||
raw_image_height::type _height;
|
||||
raw_samples_per_pixel::type _samples_per_pixel;
|
||||
raw_bits_per_pixel::type _bits_per_pixel;
|
||||
|
||||
raw_camera_manufacturer::type _camera_manufacturer;
|
||||
raw_camera_model::type _camera_model;
|
||||
|
||||
raw_raw_images_count::type _raw_images_count;
|
||||
raw_dng_version::type _dng_version;
|
||||
raw_number_colors::type _number_colors;
|
||||
raw_colors_description::type _colors_description;
|
||||
|
||||
raw_raw_width::type _raw_width;
|
||||
raw_raw_height::type _raw_height;
|
||||
raw_visible_width::type _visible_width;
|
||||
raw_visible_height::type _visible_height;
|
||||
raw_top_margin::type _top_margin;
|
||||
raw_left_margin::type _left_margin;
|
||||
raw_output_width::type _output_width;
|
||||
raw_output_height::type _output_height;
|
||||
raw_pixel_aspect::type _pixel_aspect;
|
||||
raw_flip::type _flip;
|
||||
|
||||
raw_iso_speed::type _iso_speed;
|
||||
raw_shutter::type _shutter;
|
||||
raw_aperture::type _aperture;
|
||||
raw_focal_length::type _focal_length;
|
||||
raw_timestamp::type _timestamp;
|
||||
raw_shot_order::type _shot_order;
|
||||
raw_image_description::type _image_description;
|
||||
raw_artist::type _artist;
|
||||
|
||||
raw_libraw_version::type _libraw_version;
|
||||
raw_unpack_function_name::type _unpack_function_name;
|
||||
|
||||
/// Used internaly to identify if the header has been read.
|
||||
bool _valid;
|
||||
};
|
||||
|
||||
/// Read settings for raw images.
|
||||
///
|
||||
/// The structure can be used for all read_xxx functions, except read_image_info.
|
||||
template<>
|
||||
struct image_read_settings< raw_tag > : public image_read_settings_base
|
||||
{
|
||||
/// Default constructor
|
||||
image_read_settings()
|
||||
: image_read_settings_base()
|
||||
{}
|
||||
|
||||
/// Constructor
|
||||
/// \param top_left Top left coordinate for reading partial image.
|
||||
/// \param dim Dimensions for reading partial image.
|
||||
image_read_settings( const point_t& top_left
|
||||
, const point_t& dim
|
||||
)
|
||||
: image_read_settings_base( top_left
|
||||
, dim
|
||||
)
|
||||
{}
|
||||
};
|
||||
|
||||
/// Write information for raw images.
|
||||
///
|
||||
/// The structure can be used for write_view() function.
|
||||
template<>
|
||||
struct image_write_info< raw_tag >
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace gil
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user