[Hdrflow-svn] SF.net SVN: hdrflow: [352] trunk/lib/openlibraries
Status: Pre-Alpha
Brought to you by:
glslang
From: <gl...@us...> - 2007-10-09 21:45:26
|
Revision: 352 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=352&view=rev Author: glslang Date: 2007-10-09 14:21:59 -0700 (Tue, 09 Oct 2007) Log Message: ----------- + generalises flips and flops Modified Paths: -------------- trunk/lib/openlibraries/src/openimagelib/il/basic_image.hpp trunk/lib/openlibraries/src/openimagelib/il/float_traits.hpp trunk/lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp trunk/lib/openlibraries/test/openimagelib/GL/_2D_exr/_2D_exr.cpp Modified: trunk/lib/openlibraries/src/openimagelib/il/basic_image.hpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/il/basic_image.hpp 2007-10-08 21:33:45 UTC (rev 351) +++ trunk/lib/openlibraries/src/openimagelib/il/basic_image.hpp 2007-10-09 21:21:59 UTC (rev 352) @@ -233,7 +233,8 @@ // Flop scan which assumes block_size_ is known and <= 4 - associated plane is // the first argument, thus allowing a different block/sample size per plane - virtual void flop_scan_line( size_t, pointer dst, const_pointer src, size_type w ) const + template<typename pointer_, typename const_pointer_> + void flop_scan_line_( size_t, pointer_ dst, const_pointer_ src, size_type w ) const { src += block_size_ * ( w - 1 ); while( w -- ) @@ -249,6 +250,11 @@ } } + virtual void flop_scan_line( size_t p, pointer dst, const_pointer src, size_type w ) const + { + flop_scan_line_( p, dst, src, w ); + } + // Convenience method to assist image class virtual const planes &get_planes( ) { @@ -343,13 +349,16 @@ bool need_flop = is_flopped( ) != other.is_flopped( ); // Obtain the number of planes and iterate through each - size_t count = structure_->plane_count( ); + size_type count = structure_->plane_count( ); + size_type sfactor = structure_->bitdepth( ) / 8; - for ( size_t i = 0; i < count; i ++ ) + for ( size_type i = 0; i < count; i ++ ) { // We need the src and pitch of the cropped source plane const_pointer src = other.data( i ); size_type src_pitch = other.pitch( i ); + + src_pitch *= sfactor; // The destination plane, pitch and height pointer dst = data( i ); @@ -357,6 +366,9 @@ size_type dst_pitch = pitch( i ); size_type dst_scan = linesize( i ); size_type dst_height = height( i ); + + dst_scan *= sfactor; + dst_pitch *= sfactor; // We need to orient the dest correctly if ( need_flip ) Modified: trunk/lib/openlibraries/src/openimagelib/il/float_traits.hpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/il/float_traits.hpp 2007-10-08 21:33:45 UTC (rev 351) +++ trunk/lib/openlibraries/src/openimagelib/il/float_traits.hpp 2007-10-09 21:21:59 UTC (rev 352) @@ -211,6 +211,11 @@ virtual r32g32b32f* clone( size_type w, size_type h ) { return new r32g32b32f( *this, w, h ); } + + virtual void flop_scan_line( size_t p, pointer dst, const_pointer src, size_type w ) const + { + flop_scan_line_( p, ( float* ) dst, ( const float* ) src, w ); + } }; template<typename T = float, class storage = default_storage<T> > @@ -251,6 +256,11 @@ virtual r32g32b32a32f* clone( size_type w, size_type h ) { return new r32g32b32a32f( *this, w, h ); } + + virtual void flop_scan_line( size_t p, pointer dst, const_pointer src, size_type w ) const + { + flop_scan_line_( p, ( float* ) dst, ( const float* ) src, w ); + } }; } } } Modified: trunk/lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-10-08 21:33:45 UTC (rev 351) +++ trunk/lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-10-09 21:21:59 UTC (rev 352) @@ -15,6 +15,7 @@ #include <cstring> #include <new> #include <vector> +#include <limits> #include <ofxCore.h> #include <ofxImageEffect.h> Modified: trunk/lib/openlibraries/test/openimagelib/GL/_2D_exr/_2D_exr.cpp =================================================================== --- trunk/lib/openlibraries/test/openimagelib/GL/_2D_exr/_2D_exr.cpp 2007-10-08 21:33:45 UTC (rev 351) +++ trunk/lib/openlibraries/test/openimagelib/GL/_2D_exr/_2D_exr.cpp 2007-10-09 21:21:59 UTC (rev 352) @@ -77,6 +77,7 @@ il::image_type_ptr image = plug->load( path ); if( !image ) return 0; + image = il::conform( image, il::flipped | il::flopped ); image = il::tm_linear( image ); GLint internal_format; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |