Thread: [Jahshaka-cvs] SF.net SVN: openlibraries:[1463] trunk/src/openimagelib/il/utility.cpp
Status: Beta
Brought to you by:
jahshaka
From: <tim...@us...> - 2009-02-12 16:15:28
|
Revision: 1463 http://openlibraries.svn.sourceforge.net/openlibraries/?rev=1463&view=rev Author: timdewhirst Date: 2009-02-12 16:15:16 +0000 (Thu, 12 Feb 2009) Log Message: ----------- olibs * cleanup log messages * switch to use log Modified Paths: -------------- trunk/src/openimagelib/il/utility.cpp Modified: trunk/src/openimagelib/il/utility.cpp =================================================================== --- trunk/src/openimagelib/il/utility.cpp 2009-02-10 09:24:30 UTC (rev 1462) +++ trunk/src/openimagelib/il/utility.cpp 2009-02-12 16:15:16 UTC (rev 1463) @@ -16,6 +16,7 @@ #include <openpluginlib/pl/fast_math.hpp> #include <openpluginlib/pl/utf8_utils.hpp> #include <openpluginlib/pl/discovery_traits.hpp> +#include <openpluginlib/pl/log.hpp> #include <openimagelib/il/il.hpp> #include <openimagelib/il/openimagelib_plugin.hpp> #include <openimagelib/il/lut_converter.hpp> @@ -2117,9 +2118,7 @@ return l10_l12_l16p_ushort_with_alpha_to_b8g8r8a8( 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( ) ); -#endif + WARNING_LOG << "Unknown conversion: " << opl::to_string( src_pf ) << " to " << opl::to_string( dst_pf ); return image_type_ptr( ); } @@ -2517,7 +2516,8 @@ else if ( is_yuv( im ) ) return convert( rescale( convert( im, im->pf() + L"p" ), new_w, new_h, new_d, filter ), im->pf() ); - std::wcerr << L"rescale: failed to scale image\n"; + WARNING_LOG << "failed to scale image"; + return im; } @@ -3026,13 +3026,12 @@ discovery plugins( query ); if ( plugins.size( ) == 0 ) { - std::wcerr << L"get_plug: failed to find a plugin for: " << resource << L", " << type << L"\n"; + WARNING_LOG << "failed to find a plugin for: " << pl::to_string( resource ) << ", " << pl::to_string( type ); return result; } discovery::const_iterator i = plugins.begin( ); opl::opl_ptr plugin( i->create_plugin( "" ) ); - // std::wcerr << L"created plugin: " << plugin.get() << L"\n"; return boost::shared_dynamic_cast<openimagelib_plugin>( plugin ); } @@ -3052,7 +3051,7 @@ openimagelib_plugin_ptr plug = get_plug( resource, L"" ); if ( !plug ) { - std::wcerr << L"store_image: failed to find a plugin\n"; + WARNING_LOG << "failed to find a plugin for resource: " << opl::to_string( resource ); return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-04-19 19:20:23
|
Revision: 1468 http://openlibraries.svn.sourceforge.net/openlibraries/?rev=1468&view=rev Author: timdewhirst Date: 2009-04-19 19:20:20 +0000 (Sun, 19 Apr 2009) Log Message: ----------- OIL * add direct conversions from yuv422 and yuv411 to yuv444 Modified Paths: -------------- trunk/src/openimagelib/il/utility.cpp Modified: trunk/src/openimagelib/il/utility.cpp =================================================================== --- trunk/src/openimagelib/il/utility.cpp 2009-04-18 18:28:35 UTC (rev 1467) +++ trunk/src/openimagelib/il/utility.cpp 2009-04-19 19:20:20 UTC (rev 1468) @@ -700,6 +700,76 @@ return dst_img; } +static image_type_ptr yuv422_to_yuv444( const image_type_ptr &src_img ) +{ + if ( !src_img ) + return image_type_ptr(); + + image_type_ptr dst_img = allocate( src_img, L"yuv444" ); + + const size_type height = src_img->height(); + const size_type width = src_img->width(); + + for ( size_type h=0; h<height; ++h ) + { + const_pointer in = src_img->data( ) + ( h * src_img->pitch( ) ); + pointer out = dst_img->data( ) + ( h * dst_img->pitch( ) ); + + for ( size_type w=0; w<width; w+=2 ) + { + // input pixel order should be Y1 U Y2 V + *out++ = in[w + 0]; + *out++ = in[w + 1]; + *out++ = in[w + 3]; + + *out++ = in[w + 2]; + *out++ = in[w + 1]; + *out++ = in[w + 3]; + } + } + + return dst_img; +} + +static image_type_ptr yuv411_to_yuv444( const image_type_ptr &src_img ) +{ + if ( !src_img ) + return image_type_ptr(); + + image_type_ptr dst_img = allocate( src_img, L"yuv444" ); + + const size_type height = src_img->height(); + const size_type width = src_img->width(); + + for ( size_type h=0; h<height; ++h ) + { + const_pointer in = src_img->data( ) + ( h * src_img->pitch( ) ); + pointer out = dst_img->data( ) + ( h * dst_img->pitch( ) ); + + for ( size_type w=0; w<width; w+=4 ) + { + // input pixel order should be Y1 Y2 U Y3 Y4 V + *out++ = in[w + 0]; + *out++ = in[w + 2]; + *out++ = in[w + 5]; + + *out++ = in[w + 1]; + *out++ = in[w + 2]; + *out++ = in[w + 5]; + + *out++ = in[w + 3]; + *out++ = in[w + 2]; + *out++ = in[w + 5]; + + *out++ = in[w + 4]; + *out++ = in[w + 2]; + *out++ = in[w + 5]; + } + } + + return dst_img; +} + static image_type_ptr yuv422_to_rgb( const image_type_ptr &src_img, const opl::wstring &format, int r, int g, int b, int a ) { size_type width = src_img->width( ); @@ -2076,6 +2146,8 @@ return yuv422_to_rgb( src, dst_pf, 0, 1, 2, 3 ); else if ( dst_pf == L"b8g8r8a8" ) return yuv422_to_rgb( src, dst_pf, 2, 1, 0, 3 ); + else if ( dst_pf == L"yuv444" ) + return yuv422_to_yuv444( src ); } else if ( src_pf == L"yuv411" ) { @@ -2087,6 +2159,8 @@ return yuv411_to_rgb( src, dst_pf, 0, 1, 2, 3 ); else if ( dst_pf == L"b8g8r8a8" ) return yuv411_to_rgb( src, dst_pf, 2, 1, 0, 3 ); + else if ( dst_pf == L"yuv444" ) + return yuv411_to_yuv444( src ); } else if( src_pf == L"l8a8" ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |