[Hdrflow-svn] SF.net SVN: hdrflow: [394] trunk/lib
Status: Pre-Alpha
Brought to you by:
glslang
From: <gl...@us...> - 2008-01-05 21:00:53
|
Revision: 394 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=394&view=rev Author: glslang Date: 2008-01-05 13:00:49 -0800 (Sat, 05 Jan 2008) Log Message: ----------- + some more lut related code Modified Paths: -------------- trunk/lib/extras/src/lut/lut.cpp trunk/lib/openlibraries/src/openimagelib/il/Makefile.am trunk/lib/openlibraries/src/openimagelib/il/il_vc8.vcproj Added Paths: ----------- trunk/lib/openlibraries/src/openimagelib/il/lut_functions.cpp trunk/lib/openlibraries/src/openimagelib/il/lut_functions.hpp Modified: trunk/lib/extras/src/lut/lut.cpp =================================================================== --- trunk/lib/extras/src/lut/lut.cpp 2008-01-03 21:35:22 UTC (rev 393) +++ trunk/lib/extras/src/lut/lut.cpp 2008-01-05 21:00:49 UTC (rev 394) @@ -23,34 +23,90 @@ namespace hdrflow { -class ML_PLUGIN_DECLSPEC gamma_input : public ml::input_type +class ML_PLUGIN_DECLSPEC lut_input : public ml::input_type { public: - explicit gamma_input( ) + explicit lut_input( ) : prop_colourspace_( pcos::key::from_string( "colourspace" ) ) , prop_width_( pcos::key::from_string( "width" ) ) , prop_height_( pcos::key::from_string( "height" ) ) + , prop_fps_num_( pcos::key::from_string( "fps_num" ) ) + , prop_fps_den_( pcos::key::from_string( "fps_den" ) ) + , prop_sar_num_( pcos::key::from_string( "sar_num" ) ) + , prop_sar_den_( pcos::key::from_string( "sar_den" ) ) + , prop_out_( pcos::key::from_string( "out" ) ) { - + properties( ).append( prop_colourspace_ = pl::wstring( L"r32g32b32f" ) ); + properties( ).append( prop_width_ = 512 ); + properties( ).append( prop_height_ = 512 ); + properties( ).append( prop_fps_num_ = 24 ); + properties( ).append( prop_fps_den_ = 1 ); + properties( ).append( prop_sar_num_ = 1 ); + properties( ).append( prop_sar_den_ = 1 ); + properties( ).append( prop_out_ = 24 ); } - virtual ~gamma_input( ) { } + virtual ~lut_input( ) { } - virtual pl::wstring get_uri( ) const { return L"gamma:"; } + virtual pl::wstring get_uri( ) const { return L"lut:"; } virtual pl::wstring get_mime_type( ) const { return L""; } + + virtual int get_frames( ) const { return prop_out_.value<int>( ); } + virtual bool is_seekable( ) const { return true; } + + virtual void get_fps( int& num, int& den ) const + { + num = prop_sar_num_.value<int>( ); + den = prop_sar_den_.value<int>( ); + } + virtual double fps( ) const + { + int num, den; + get_fps( num, den ); + return den != 0 ? double( num ) / double( den ) : 1; + } + + virtual void get_sar( int &num, int &den ) const + { + num = prop_sar_num_.value<int>( ); + den = prop_sar_den_.value<int>( ); + } + + virtual int get_video_streams( ) const { return 1; } + + virtual int get_width( ) const { return prop_width_.value<int>( ); } + virtual int get_height( ) const { return prop_height_.value<int>( ); } + + virtual int get_audio_streams( ) const { return 0; } + + virtual ml::frame_type_ptr fetch( ) + { + return ml::frame_type_ptr( ); + } + private: + void fill( il::image_type_ptr im ) + { + } + +private: pcos::property prop_colourspace_; pcos::property prop_width_; pcos::property prop_height_; + pcos::property prop_fps_num_; + pcos::property prop_fps_den_; + pcos::property prop_sar_num_; + pcos::property prop_sar_den_; + pcos::property prop_out_; }; class ML_PLUGIN_DECLSPEC lut_plugin : public ml::openmedialib_plugin { public: - virtual ml::input_type_ptr input( const pl::wstring& request ) + virtual ml::input_type_ptr input( const pl::wstring& ) { - return ml::input_type_ptr( ); + return ml::input_type_ptr( new lut_input( ) ); } }; Modified: trunk/lib/openlibraries/src/openimagelib/il/Makefile.am =================================================================== --- trunk/lib/openlibraries/src/openimagelib/il/Makefile.am 2008-01-03 21:35:22 UTC (rev 393) +++ trunk/lib/openlibraries/src/openimagelib/il/Makefile.am 2008-01-05 21:00:49 UTC (rev 394) @@ -14,6 +14,9 @@ float_traits.hpp \ il.hpp \ il.cpp \ + lut_converter.hpp \ + lut_functions.cpp \ + lut_functions.hpp \ openimagelib_plugin.hpp \ rgb_traits.hpp \ traits.hpp \ Modified: trunk/lib/openlibraries/src/openimagelib/il/il_vc8.vcproj =================================================================== --- trunk/lib/openlibraries/src/openimagelib/il/il_vc8.vcproj 2008-01-03 21:35:22 UTC (rev 393) +++ trunk/lib/openlibraries/src/openimagelib/il/il_vc8.vcproj 2008-01-05 21:00:49 UTC (rev 394) @@ -231,6 +231,10 @@ > </File> <File + RelativePath=".\lut_functions.hpp" + > + </File> + <File RelativePath=".\openimagelib_plugin.hpp" > </File> @@ -267,6 +271,10 @@ > </File> <File + RelativePath=".\lut_functions.cpp" + > + </File> + <File RelativePath=".\utility.cpp" > </File> Added: trunk/lib/openlibraries/src/openimagelib/il/lut_functions.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/il/lut_functions.cpp (rev 0) +++ trunk/lib/openlibraries/src/openimagelib/il/lut_functions.cpp 2008-01-05 21:00:49 UTC (rev 394) @@ -0,0 +1,25 @@ + +// il - An image library representation. + +// Copyright (C) 2007 Goncalo Nuno M. de Carvalho +// Released under the LGPL. +// For more information, see http://www.hdrflow.com. + +#ifdef WIN32 +#define _USE_MATH_DEFINES +#include <cmath> +#endif + +#include <openimagelib/il/lut_functions.hpp> + +namespace olib { namespace openimagelib { namespace il { + +float to_sRGB( float v ) +{ + if( v < ( 0.04045f / 12.92f ) ) + return v * 12.92f; + else + return 1.055f * powf( v, 1.0f / 2.4f ) - 0.055f; +} + +} } } Property changes on: trunk/lib/openlibraries/src/openimagelib/il/lut_functions.cpp ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/lib/openlibraries/src/openimagelib/il/lut_functions.hpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/il/lut_functions.hpp (rev 0) +++ trunk/lib/openlibraries/src/openimagelib/il/lut_functions.hpp 2008-01-05 21:00:49 UTC (rev 394) @@ -0,0 +1,17 @@ + +// il - An image library representation. + +// Copyright (C) 2007 Goncalo Nuno M. de Carvalho +// Released under the LGPL. +// For more information, see http://www.hdrflow.com. + +#ifndef LUT_FUNCTIONS_INC_ +#define LUT_FUNCTIONS_INC_ + +namespace olib { namespace openimagelib { namespace il { + +float to_sRGB( float v ); + +} } } + +#endif Property changes on: trunk/lib/openlibraries/src/openimagelib/il/lut_functions.hpp ___________________________________________________________________ Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |