[Hdrflow-svn] SF.net SVN: hdrflow: [328] trunk/lib/openlibraries/src/openimagelib/il/ utility.cpp
Status: Pre-Alpha
Brought to you by:
glslang
|
From: <gl...@us...> - 2007-09-30 15:15:11
|
Revision: 328
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=328&view=rev
Author: glslang
Date: 2007-09-30 08:15:05 -0700 (Sun, 30 Sep 2007)
Log Message:
-----------
+ b8g8r8a8 to r32g32b32a32f conversion (all of this needs generalisation with swizzling support)
Modified Paths:
--------------
trunk/lib/openlibraries/src/openimagelib/il/utility.cpp
Modified: trunk/lib/openlibraries/src/openimagelib/il/utility.cpp
===================================================================
--- trunk/lib/openlibraries/src/openimagelib/il/utility.cpp 2007-09-30 14:57:49 UTC (rev 327)
+++ trunk/lib/openlibraries/src/openimagelib/il/utility.cpp 2007-09-30 15:15:05 UTC (rev 328)
@@ -1677,6 +1677,43 @@
return dst_img;
}
+static image_type_ptr b8g8r8a8_to_r32g32b32a32f( image_type_ptr src_img, const std::wstring &format )
+{
+ size_type width = src_img->width( );
+ size_type height = src_img->height( );
+
+ image_type_ptr dst_img = allocate( src_img, format );
+ if( dst_img != 0 )
+ {
+ image_type::const_pointer src = ( image_type::const_pointer ) src_img->data( );
+ size_type src_pitch = src_img->pitch( );
+ float* dst = ( float* ) dst_img->data( );
+ size_type dst_pitch = dst_img->pitch( );
+
+ image_type::const_pointer sptr = src;
+ float* dptr = dst;
+
+ size_type orig_width = width;
+
+ while( height-- )
+ {
+ while( width-- )
+ {
+ *dst++ = *( src + 2 );
+ *dst++ = *( src + 1 );
+ *dst++ = *( src + 0 );
+ *dst++ = *( src + 3 );
+ }
+
+ dst = dptr += dst_pitch;
+ src = sptr += src_pitch;
+ width = orig_width;
+ }
+ }
+
+ return dst_img;
+}
+
inline bool is_rgb_packed( const std::wstring &pf )
{
return pf == L"a8b8g8r8" || pf == L"a8r8g8b8" || pf == L"b8g8r8" || pf == L"b8g8r8a8" || pf == L"r8g8b8" || pf == L"r8g8b8a8";
@@ -1815,6 +1852,8 @@
return rgb_to_yuv422( src, dst_pf, 4, 2, 1, 0 );
else if ( dst_pf == L"yuv411" )
return rgb_to_yuv411( src, dst_pf, 4, 2, 1, 0 );
+ else if ( dst_pf == L"r32g32b32a32f" )
+ return b8g8r8a8_to_r32g32b32a32f( src, dst_pf );
}
else if ( src_pf == L"a8r8g8b8" )
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|