[Hdrflow-svn] SF.net SVN: hdrflow: [413] trunk/lib/extras/src/imf/mfn
Status: Pre-Alpha
Brought to you by:
glslang
From: <gl...@us...> - 2008-02-18 20:54:48
|
Revision: 413 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=413&view=rev Author: glslang Date: 2008-02-18 12:54:44 -0800 (Mon, 18 Feb 2008) Log Message: ----------- + convert hdrflow maya to ml Modified Paths: -------------- trunk/lib/extras/src/imf/mfn/mfn.cpp trunk/lib/extras/src/imf/mfn/readers_vc8.vcproj Modified: trunk/lib/extras/src/imf/mfn/mfn.cpp =================================================================== --- trunk/lib/extras/src/imf/mfn/mfn.cpp 2008-02-10 17:22:50 UTC (rev 412) +++ trunk/lib/extras/src/imf/mfn/mfn.cpp 2008-02-18 20:54:44 UTC (rev 413) @@ -21,39 +21,18 @@ #include <openpluginlib/pl/utf8_utils.hpp> #include <openpluginlib/pl/stream.hpp> -#include <openimagelib/il/openimagelib_plugin.hpp> +#include <openimagelib/il/il.hpp> +#include <openmedialib/ml/openmedialib_plugin.hpp> +#include <openmedialib/ml/utilities.hpp> #include <imf/mfn/config.hpp> namespace pl = olib::openpluginlib; namespace il = olib::openimagelib::il; +namespace ml = olib::openmedialib::ml; namespace hdrflow { namespace extras { namespace mfn { -namespace -{ - struct query_traits - { - query_traits( const pl::wstring& filename ) - : filename_( filename ) - { } - - pl::wstring libname( ) const - { return L"openimagelib"; } - - pl::wstring to_match( ) const - { return filename_; } - - pl::wstring type( ) const - { return L""; } - - int merit( ) const - { return 0; } - - pl::wstring filename_; - }; -} - class image_reader : public MPxImageFile { public: @@ -65,7 +44,7 @@ private: pl::string pathname_; - il::image_type_ptr im_; + ml::input_type_ptr input_; }; void* image_reader::creator( ) @@ -76,9 +55,44 @@ MStatus image_reader::open( MString pathname, MImageFileInfo* info ) { #ifndef NDEBUG - MGlobal::displayInfo( "HDRFlow: opening image..." ); + MGlobal::displayInfo( "HDRFlow: opening media stream..." ); #endif + input_ = ml::create_input( pl::to_wstring( pathname.asChar( ) ) ); + if( !input_ ) + return MS::kFailure; + +#ifndef NDEBUG + MGlobal::displayInfo( "HDRFlow: plugin found ..." ); +#endif + + ml::frame_type_ptr frame = input_->fetch( ); + if( !frame ) + return MS::kFailure; + +#ifndef NDEBUG + MGlobal::displayInfo( "HDRFlow: frame found ..." ); +#endif + + il::image_type_ptr im = frame->get_image( ); + if( !im ) + return MS::kFailure; + +#ifndef NDEBUG + MGlobal::displayInfo( "HDRFlow: image stream found ..." ); +#endif + + if( info ) + { + info->width( im->width( ) ); + info->height( im->height( ) ); + info->channels( 4 ); // always assumes alpha/matte exists + info->numberOfImages( input_->get_frames( ) ); + info->pixelType( MImage::kFloat ); // convert everything to float by default + } + + return MS::kSuccess; +/* typedef pl::discovery<query_traits> discovery; discovery plugins( query_traits( pl::to_wstring( pathname.asChar( ) ) ) ); @@ -128,7 +142,7 @@ MGlobal::displayInfo( "HDRFlow: failed to open." ); #endif - return MS::kFailure; + return MS::kFailure;*/ } MStatus image_reader::load( MImage& image, unsigned int idx ) @@ -137,10 +151,15 @@ MGlobal::displayInfo( "HDRFlow: loading image..." ); #endif - il::image_type_ptr im = il::convert( im_, L"r32g32b32a32f" ); + input_->seek( idx ); + ml::frame_type_ptr frame = input_->fetch( ); + if( !frame ) + return MS::kFailure; + + il::image_type_ptr im = il::convert( frame->get_image( ), L"r32g32b32a32f" ); if( !im ) { - im = il::convert( il::convert( im_, L"b8g8r8a8" ), L"r32g32b32a32f" ); + im = il::convert( il::convert( frame->get_image( ), L"b8g8r8a8" ), L"r32g32b32a32f" ); if( !im ) { #ifndef NDEBUG @@ -164,7 +183,7 @@ for( int i = 0; i < height; ++i ) { - memcpy( dst, src, im->linesize( ) * sizeof( float ) ); + memcpy( dst, src, linesize * sizeof( float ) ); src += pitch; dst += width * 4; @@ -183,7 +202,7 @@ MGlobal::displayInfo( "HDRFlow: closing..." ); #endif - im_.reset( ); + input_.reset( ); return MS::kSuccess; } Modified: trunk/lib/extras/src/imf/mfn/readers_vc8.vcproj =================================================================== --- trunk/lib/extras/src/imf/mfn/readers_vc8.vcproj 2008-02-10 17:22:50 UTC (rev 412) +++ trunk/lib/extras/src/imf/mfn/readers_vc8.vcproj 2008-02-18 20:54:44 UTC (rev 413) @@ -52,6 +52,7 @@ WarningLevel="4" Detect64BitPortabilityProblems="true" DebugInformationFormat="4" + DisableSpecificWarnings="4503" /> <Tool Name="VCManagedResourceCompilerTool" @@ -133,6 +134,7 @@ WarningLevel="4" Detect64BitPortabilityProblems="true" DebugInformationFormat="3" + DisableSpecificWarnings="4503" /> <Tool Name="VCManagedResourceCompilerTool" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |