TuttleOFX
1
|
00001 #ifndef _TERRY_NUMERIC_LOG_HPP_ 00002 #define _TERRY_NUMERIC_LOG_HPP_ 00003 00004 #include <terry/globals.hpp> 00005 00006 #include <cmath> 00007 00008 namespace terry { 00009 namespace numeric { 00010 00011 template <typename Channel, typename ChannelR> 00012 struct channel_log10_t : public std::unary_function<Channel, ChannelR> 00013 { 00014 GIL_FORCEINLINE 00015 ChannelR operator()( typename channel_traits<Channel>::const_reference ch ) const 00016 { 00017 typedef typename floating_channel_type_t<ChannelR>::type T; 00018 return std::log10( T( ch ) ); 00019 } 00020 }; 00021 00022 template <typename PixelRef, typename PixelR = PixelRef> // models pixel concept 00023 struct pixel_log10_t 00024 { 00025 GIL_FORCEINLINE 00026 PixelR operator()(const PixelRef & p ) const 00027 { 00028 PixelR result; 00029 boost::gil::static_transform( p, result, channel_log10_t<typename channel_type<PixelRef>::type, typename channel_type<PixelR>::type > ( ) ); 00030 return result; 00031 } 00032 }; 00033 00034 00035 } 00036 } 00037 00038 #endif