[Hdrflow-svn] SF.net SVN: hdrflow: [393] trunk/lib/openlibraries/src/openimagelib/il
Status: Pre-Alpha
Brought to you by:
glslang
|
From: <gl...@us...> - 2008-01-03 21:35:25
|
Revision: 393
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=393&view=rev
Author: glslang
Date: 2008-01-03 13:35:22 -0800 (Thu, 03 Jan 2008)
Log Message:
-----------
+ adds lut conversion of 16bpc fixed to float
Modified Paths:
--------------
trunk/lib/openlibraries/src/openimagelib/il/lut_converter.hpp
trunk/lib/openlibraries/src/openimagelib/il/utility.cpp
Modified: trunk/lib/openlibraries/src/openimagelib/il/lut_converter.hpp
===================================================================
--- trunk/lib/openlibraries/src/openimagelib/il/lut_converter.hpp 2008-01-02 23:02:01 UTC (rev 392)
+++ trunk/lib/openlibraries/src/openimagelib/il/lut_converter.hpp 2008-01-03 21:35:22 UTC (rev 393)
@@ -39,6 +39,12 @@
{ return static_cast<result_type>( openpluginlib::fast_floorf( v ) ); }
};
+struct fixed16_to_float : public std::unary_function<unsigned short, float>
+{
+ result_type operator( )( argument_type v ) const
+ { return static_cast<result_type>( static_cast<short>( v ) / 8192.0f ); }
+};
+
} } }
#endif
Modified: trunk/lib/openlibraries/src/openimagelib/il/utility.cpp
===================================================================
--- trunk/lib/openlibraries/src/openimagelib/il/utility.cpp 2008-01-02 23:02:01 UTC (rev 392)
+++ trunk/lib/openlibraries/src/openimagelib/il/utility.cpp 2008-01-03 21:35:22 UTC (rev 393)
@@ -1113,10 +1113,11 @@
{ L"a8b8g8r8", L"r8g8b8", 4, { 3, 2, 1, 0 }, 3, { 0, 1, 2, 0 } },
{ L"l8a8", L"b8g8r8a8", 2, { 0, 0, 0, 1 }, 4, { 2, 1, 0, 3 } },
{ L"l8a8", L"b8g8r8", 2, { 0, 0, 0, 1 }, 3, { 2, 1, 0, 0 } },
+ { L"r16g16b16fixed", L"r32g32b32a32f", 3, { 0, 1, 2, 0 }, 4, { 0, 1, 2, 3 } },
{ L"", L"", 0, { 0, 0, 0, 0 }, 0, { 0, 0, 0, 0 } }
};
-template<typename const_pointer, typename pointer, class LUT>
+template<typename T, typename U, class LUT>
image_type_ptr rgb_to_rgb( const image_type_ptr &src_img, const std::wstring &format )
{
size_type width = src_img->width( );
@@ -1128,13 +1129,13 @@
{
LUT lut;
- const_pointer src = src_img->data( );
+ T src = reinterpret_cast<T>( src_img->data( ) );
size_type src_pitch = src_img->pitch( );
- pointer dst = dst_img->data( );
+ U dst = reinterpret_cast<U>( dst_img->data( ) );
size_type dst_pitch = dst_img->pitch( );
- const_pointer sptr = src;
- pointer dptr = dst;
+ T sptr = src;
+ U dptr = dst;
size_type orig_width = width;
@@ -2090,6 +2091,11 @@
if( dst_pf == L"b8g8r8a8" )
return l10_l12_l16p_ushort_with_alpha_to_b8g8r8a8( src, dst_pf );
}
+ else if( src_pf == L"r16g16b16fixed" )
+ {
+ if( dst_pf == L"r32g32b32a32f" )
+ return rgb_to_rgb<const unsigned short*, float*, fixed16_to_float>( src, dst_pf );
+ }
#ifndef WIN32
fprintf( stderr, "Unknown %s to %s\n", opl::to_string( src_pf ).c_str( ), opl::to_string( dst_pf ).c_str( ) );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|