TuttleOFX  1
BasicKeyerProcess.tcc
Go to the documentation of this file.
00001 #include <boost/numeric/conversion/cast.hpp>
00002 
00003 namespace tuttle {
00004 namespace plugin {
00005 namespace basicKeyer {
00006 
00007 template<class View>
00008 BasicKeyerProcess<View>::BasicKeyerProcess( BasicKeyerPlugin& instance )
00009         : Parent( instance, eImageOrientationIndependant )
00010         , _plugin( instance )
00011 {}
00012 
00013 template<class View>
00014 void BasicKeyerProcess<View>::setup( const OFX::RenderArguments& args )
00015 {
00016         using namespace boost::gil;
00017         Parent::setup( args );
00018 
00019         _params = _plugin.getProcessParams<View>();
00020 
00021 //      OfxRectD rod = _plugin._clipDst->getCanonicalRod( args.time );
00022         //      Point dims( rod.x2 - rod.x1, rod.y2 - rod.y1 );
00023         //      int yshift = boost::numeric_cast<int>(( dims.x - dims.y ) * 0.5);
00024 }
00025 
00026 /**
00027  * @brief Function called by rendering thread each time a process must be done.
00028  * @param[in] procWindowRoW  Processing window in RoW
00029  */
00030 template<class View>
00031 void BasicKeyerProcess<View>::multiThreadProcessImages( const OfxRectI& procWindowRoW )
00032 {
00033         using namespace boost::gil;
00034         OfxRectI procWindowOutput = this->translateRoWToOutputClipCoordinates( procWindowRoW );
00035         const OfxPointI procWindowSize = {
00036                 procWindowRoW.x2 - procWindowRoW.x1,
00037                 procWindowRoW.y2 - procWindowRoW.y1 };
00038 
00039         for( int y = procWindowOutput.y1;
00040              y < procWindowOutput.y2;
00041              ++y )
00042         {
00043                 typename View::x_iterator src_it = this->_srcView.x_at( procWindowOutput.x1, y );
00044                 typename View::x_iterator dst_it = this->_dstView.x_at( procWindowOutput.x1, y );
00045                 for( int x = procWindowOutput.x1;
00046                      x < procWindowOutput.x2;
00047                      ++x, ++src_it, ++dst_it )
00048                 {
00049                         *dst_it = *src_it;
00050                 }
00051                 if( this->progressForward( procWindowSize.x ) )
00052                         return;
00053         }
00054 }
00055 
00056 }
00057 }
00058 }