TuttleOFX
1
|
00001 #include "ConvolutionPlugin.hpp" 00002 00003 #include <terry/globals.hpp> 00004 #include <terry/filter/convolve.hpp> 00005 00006 #include <tuttle/plugin/exceptions.hpp> 00007 #include <tuttle/plugin/memory/OfxAllocator.hpp> 00008 00009 00010 namespace tuttle { 00011 namespace plugin { 00012 namespace convolution { 00013 00014 template<class View> 00015 ConvolutionProcess<View>::ConvolutionProcess( ConvolutionPlugin& instance ) 00016 : ImageGilFilterProcessor<View>( instance, eImageOrientationFromBottomToTop ) 00017 , _plugin( instance ) 00018 {} 00019 00020 template <class View> 00021 void ConvolutionProcess<View>::setup( const OFX::RenderArguments& args ) 00022 { 00023 ImageGilFilterProcessor<View>::setup( args ); 00024 _params = _plugin.getProcessParams(); 00025 } 00026 00027 /** 00028 * @brief Function called by rendering thread each time a process must be done. 00029 * @param[in] procWindowRoW Processing window 00030 */ 00031 template<class View> 00032 void ConvolutionProcess<View>::multiThreadProcessImages( const OfxRectI& procWindowRoW ) 00033 { 00034 using namespace boost::gil; 00035 using namespace terry::filter; 00036 OfxRectI procWindowOutput = this->translateRoWToOutputClipCoordinates( procWindowRoW ); 00037 OfxPointI procWindowSize = { 00038 procWindowRoW.x2 - procWindowRoW.x1, 00039 procWindowRoW.y2 - procWindowRoW.y1 00040 }; 00041 00042 View dst = subimage_view( this->_dstView, procWindowOutput.x1, procWindowOutput.y1, 00043 procWindowSize.x, procWindowSize.y ); 00044 00045 Point proc_tl( procWindowRoW.x1 - this->_srcPixelRod.x1, procWindowRoW.y1 - this->_srcPixelRod.y1 ); 00046 /* 00047 switch( _params._convType ) 00048 { 00049 case eConv1D: 00050 { 00051 */ 00052 if( _params._size.x == 0 ) 00053 correlate_cols_auto<Pixel>( this->_srcView, _params._convY, dst, proc_tl, _params._boundary_option ); 00054 else if( _params._size.y == 0 ) 00055 correlate_rows_auto<Pixel>( this->_srcView, _params._convX, dst, proc_tl, _params._boundary_option ); 00056 else 00057 correlate_rows_cols_auto<Pixel, OfxAllocator>( this->_srcView, _params._convX, _params._convY, dst, proc_tl, _params._boundary_option ); 00058 /* 00059 break; 00060 } 00061 case eConv2D: 00062 { 00063 // _params._convMatrix 00064 break; 00065 } 00066 } 00067 */ 00068 } 00069 00070 } 00071 } 00072 }