Thread: [Hdrflow-svn] SF.net SVN: hdrflow: [272] trunk/lib/openlibraries/src/openimagelib/il/ utility.cpp
Status: Pre-Alpha
Brought to you by:
glslang
From: <gl...@us...> - 2007-08-26 11:13:46
|
Revision: 272 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=272&view=rev Author: glslang Date: 2007-08-26 02:48:17 -0700 (Sun, 26 Aug 2007) Log Message: ----------- + adds a8b8g8r8 to r8g8b8 conversion 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-08-25 21:14:22 UTC (rev 271) +++ trunk/lib/openlibraries/src/openimagelib/il/utility.cpp 2007-08-26 09:48:17 UTC (rev 272) @@ -1094,6 +1094,7 @@ { L"a8r8g8b8", L"b8g8r8a8", 4, { 1, 2, 3, 0 }, 4, { 2, 1, 0, 3 } }, { L"a8b8g8r8", L"b8g8r8a8", 4, { 3, 2, 1, 0 }, 4, { 2, 1, 0, 3 } }, { L"a8b8g8r8", L"r8g8b8a8", 4, { 3, 2, 1, 0 }, 4, { 0, 1, 2, 3 } }, + { 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"", L"", 0, { 0, 0, 0, 0 }, 0, { 0, 0, 0, 0 } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-08-26 11:13:53
|
Revision: 273 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=273&view=rev Author: glslang Date: 2007-08-26 02:55:17 -0700 (Sun, 26 Aug 2007) Log Message: ----------- + oops - a8b8g8r8 to r8g8b8 conversion 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-08-26 09:48:17 UTC (rev 272) +++ trunk/lib/openlibraries/src/openimagelib/il/utility.cpp 2007-08-26 09:55:17 UTC (rev 273) @@ -1799,6 +1799,8 @@ return rgb_to_rgb( src, dst_pf ); else if( dst_pf == L"r8g8b8a8" ) return rgb_to_rgb( src, dst_pf ); + else if( dst_pf == L"r8g8b8" ) + return rgb_to_rgb( src, dst_pf ); else if ( dst_pf == L"yuv444" ) return rgb_to_yuv444( src, dst_pf, 4, 3, 2, 1 ); else if ( dst_pf == L"yuv422" ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-08-27 17:40:54
|
Revision: 279 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=279&view=rev Author: glslang Date: 2007-08-26 07:14:16 -0700 (Sun, 26 Aug 2007) Log Message: ----------- + rgbe to r32g32b32a32f conversion 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-08-26 13:54:02 UTC (rev 278) +++ trunk/lib/openlibraries/src/openimagelib/il/utility.cpp 2007-08-26 14:14:16 UTC (rev 279) @@ -1565,7 +1565,7 @@ return dst_img; } -static image_type_ptr rgbe_to_r32g32b32f( image_type_ptr src_img, const std::wstring &format ) +static image_type_ptr rgbe_to_r32g32b32a32f( image_type_ptr src_img, const std::wstring &format ) { size_type width = src_img->width( ); size_type height = src_img->height( ); @@ -1588,8 +1588,9 @@ while( width-- ) { rgbe2float( src, *( dst + 0 ), *( dst + 1 ), *( dst + 2 ) ); + *( dst + 3 ) = 1.0f; - dst += 3; + dst += 4; src += 4; } @@ -1914,13 +1915,15 @@ return tm_linear( src ); else if( dst_pf == L"ldr8" ) // stub colour space for straight truncation to LDR data. return r32g32b32f_to_b8g8r8a8( src, L"b8g8r8a8" ); + else if( dst_pf == L"rgbe" ) + return r32g32b32f_to_rgbe( src, L"rgbe" ); } else if( src_pf == L"rgbe" ) { if( dst_pf == L"b8g8r8a8" ) - return tm_linear( rgbe_to_r32g32b32f( src, L"r32g32b32f" ) ); - else if( dst_pf == L"r32g32b32f" ) - return rgbe_to_r32g32b32f( src, L"r32g32b32f" ); + return tm_linear( rgbe_to_r32g32b32a32f( src, L"r32g32b32a32f" ) ); + else if( dst_pf == L"r32g32b32a32f" ) + return rgbe_to_r32g32b32a32f( src, L"r32g32b32a32f" ); } else if ( src_pf == L"yuv444" ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-09-02 15:39:07
|
Revision: 294 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=294&view=rev Author: glslang Date: 2007-09-02 08:23:18 -0700 (Sun, 02 Sep 2007) Log Message: ----------- + conversion from r32g32b32f to r32g32b32a32f (needs generalisation) 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-01 21:50:34 UTC (rev 293) +++ trunk/lib/openlibraries/src/openimagelib/il/utility.cpp 2007-09-02 15:23:18 UTC (rev 294) @@ -1640,6 +1640,43 @@ return dst_img; } +static image_type_ptr r32g32b32f_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 ) + { + const float* src = ( const float* ) src_img->data( ); + size_type src_pitch = src_img->pitch( ); + float* dst = ( float* ) dst_img->data( ); + size_type dst_pitch = dst_img->pitch( ); + + const float* sptr = src; + float* dptr = dst; + + size_type orig_width = width; + + while( height-- ) + { + while( width-- ) + { + *dst++ = *src++; + *dst++ = *src++; + *dst++ = *src++; + *dst++ = 1.0f; + } + + 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"; @@ -1917,6 +1954,8 @@ return r32g32b32f_to_b8g8r8a8( src, L"b8g8r8a8" ); else if( dst_pf == L"rgbe" ) return r32g32b32f_to_rgbe( src, L"rgbe" ); + else if( dst_pf == L"r32g32b32a32f" ) + return r32g32b32f_to_r32g32b32a32f( src, L"r32g32b32a32f" ); } else if( src_pf == L"rgbe" ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <gl...@us...> - 2007-09-30 16:10:44
|
Revision: 330 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=330&view=rev Author: glslang Date: 2007-09-30 09:10:39 -0700 (Sun, 30 Sep 2007) Log Message: ----------- + bug fix in b8g8r8a8 to r32g32b32a32f conversion 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 16:07:07 UTC (rev 329) +++ trunk/lib/openlibraries/src/openimagelib/il/utility.cpp 2007-09-30 16:10:39 UTC (rev 330) @@ -1703,6 +1703,8 @@ *dst++ = *( src + 1 ); *dst++ = *( src + 0 ); *dst++ = *( src + 3 ); + + src += 4; } dst = dptr += dst_pitch; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gl...@us...> - 2007-10-18 20:30:14
|
Revision: 360 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=360&view=rev Author: glslang Date: 2007-10-18 13:30:13 -0700 (Thu, 18 Oct 2007) Log Message: ----------- + merge from olibs cvs 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-10-14 14:46:13 UTC (rev 359) +++ trunk/lib/openlibraries/src/openimagelib/il/utility.cpp 2007-10-18 20:30:13 UTC (rev 360) @@ -576,25 +576,37 @@ pointer dst = dst_img->data( ); size_type dst_rem = dst_img->pitch( ) - dst_img->linesize( ); + size_type y_src_rem = src_img->pitch( ) - src_img->linesize( ); int uv_offset; + const_pointer pu = src_img->data( 1 ); + int ppu = src_img->pitch( 1 ); + const_pointer pv = src_img->data( 2 ); + int ppv = src_img->pitch( 2 ); + + const_pointer Y = src_img->data( 0 ); + const_pointer U, V; + + int mx = dst_width * x_factor; + int x = 0; + for ( int y = 0; y < dst_height; y ++ ) { - const_pointer Y = src_img->data( 0 ) + ( y * src_img->pitch( 0 ) ); - const_pointer U = src_img->data( 1 ) + ( ( y * y_factor ) >> 8 ) * src_img->pitch( 1 ); - const_pointer V = src_img->data( 2 ) + ( ( y * y_factor ) >> 8 ) * src_img->pitch( 2 ); + U = pu + ( ( y * y_factor ) >> 8 ) * ppu; + V = pv + ( ( y * y_factor ) >> 8 ) * ppv; - for ( int x = 0; x < dst_width; x ++ ) + for( x = 0; x < mx; x += x_factor ) { - uv_offset = ( x * x_factor ) >> 8; - *dst ++ = ( unsigned char )( *Y ++ ); - *dst ++ = ( unsigned char )( U[ uv_offset ] ); - *dst ++ = ( unsigned char )( *Y ++ ); - *dst ++ = ( unsigned char )( V[ uv_offset ] ); - } + uv_offset = x >> 8; + *dst ++ = *Y ++; + *dst ++ = U[ uv_offset ]; + *dst ++ = *Y ++; + *dst ++ = V[ uv_offset ]; + } dst += dst_rem; + Y += y_src_rem; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |