void WriterPlugin::render( const OFX::RenderArguments& args ) { _oneRender = false; TUTTLE_COUT( " --> " << getAbsoluteFilenameAt( args.time ) ); boost::scoped_ptr<OFX::Image> src( _clipSrc->fetchImage( args.time ) ); boost::scoped_ptr<OFX::Image> dst( _clipDst->fetchImage( args.time ) ); // Copy buffer const OfxRectI bounds = dst->getBounds(); TUTTLE_TCOUT_VAR( bounds ); if( src->isLinearBuffer() && dst->isLinearBuffer() ) { TUTTLE_TCOUT( "isLinearBuffer" ); const std::size_t imageDataBytes = dst->getBoundsImageDataBytes(); TUTTLE_TCOUT_VAR( imageDataBytes ); if( imageDataBytes ) { void* dataSrcPtr = src->getPixelAddress( bounds.x1, bounds.y1 ); void* dataDstPtr = dst->getPixelAddress( bounds.x1, bounds.y1 ); memcpy( dataDstPtr, dataSrcPtr, imageDataBytes ); } } else { const std::size_t rowBytesToCopy = dst->getBoundsRowDataBytes(); for( int y = bounds.y1; y < bounds.y2; ++y ) { void* dataSrcPtr = src->getPixelAddress( bounds.x1, y ); void* dataDstPtr = dst->getPixelAddress( bounds.x1, y ); memcpy( dataDstPtr, dataSrcPtr, rowBytesToCopy ); } } }
boost::intrusive_ptr<IPoolData> MemoryPool::allocate( const std::size_t size ) { TUTTLE_TCOUT( "MemoryPool::allocate: " << size ); PoolData* pData = NULL; { boost::mutex::scoped_lock locker( _mutex ); // checking within unused data pData = std::for_each( _dataUnused.begin(), _dataUnused.end(), DataFitSize( size ) ).bestMatch(); } if( pData != NULL ) { pData->_size = size; return pData; } const std::size_t availableSize = getAvailableMemorySize(); if( size > availableSize ) { std::stringstream s; s << "MemoryPool can't allocate size:" << size << " because memorySizeAvailable=" << availableSize; BOOST_THROW_EXCEPTION( std::length_error( s.str() ) ); } return new PoolData( *this, size ); }
void ProcessGraph::endSequenceRender( ProcessVertexData& procOptions ) { TUTTLE_TCOUT( "process end sequence" ); //--- END sequence render BOOST_FOREACH( NodeMap::value_type& p, _nodes ) { p.second->endSequence( procOptions ); // node option... or no option here ? }
void discover_vertex( VertexDescriptor v, Graph& g ) { Vertex& vertex = _graph.instance( v ); TUTTLE_TCOUT( "[Setup 2] discover_vertex " << vertex ); if( vertex.isFake() ) return; vertex.getProcessNode().setup2_reverse(); }
void finish_vertex( VertexDescriptor v, Graph& g ) { Vertex& vertex = _graph.instance( v ); TUTTLE_TCOUT( "[Setup] finish_vertex " << vertex ); if( vertex.isFake() ) return; vertex.getProcessNode().setup1(); }
inline void connectClips( TGraph& graph ) { BOOST_FOREACH( typename TGraph::edge_descriptor ed, graph.getEdges() ) { typename TGraph::Edge& edge = graph.instance( ed ); typename TGraph::Vertex& vertexSource = graph.sourceInstance( ed ); typename TGraph::Vertex& vertexDest = graph.targetInstance( ed ); TUTTLE_TCOUT( "[connectClips] " << edge ); TUTTLE_TCOUT( vertexSource << "->" << vertexDest ); if( ! vertexDest.isFake() && ! vertexSource.isFake() ) { INode& sourceNode = vertexSource.getProcessNode(); INode& targetNode = vertexDest.getProcessNode(); sourceNode.connect( targetNode, sourceNode.getAttribute( edge.getInAttrName() ) ); } } }
MemoryPool::~MemoryPool() { if( !_dataUsed.empty() ) { TUTTLE_COUT_ERROR( "Error inside memory pool. Some data always mark used at the destruction (nb elements:" << _dataUsed.size() << ")" ); } TUTTLE_TCOUT_X( 20, "-" ); TUTTLE_TCOUT( "~MemoryPool()" ); TUTTLE_TCOUT_VAR( _dataUsed.size() ); TUTTLE_TCOUT_VAR( _dataUnused.size() ); TUTTLE_TCOUT_VAR( _allDatas.size() ); TUTTLE_TCOUT_VAR( _memoryAuthorized ); TUTTLE_TCOUT( "" ); TUTTLE_TCOUT_VAR( getUsedMemorySize() ); TUTTLE_TCOUT_VAR( getAllocatedMemorySize() ); TUTTLE_TCOUT_VAR( getMaxMemorySize() ); TUTTLE_TCOUT_VAR( getAvailableMemorySize() ); TUTTLE_TCOUT_VAR( getWastedMemorySize() ); TUTTLE_TCOUT_X( 20, "-" ); }
void finish_vertex( VertexDescriptor v, Graph& g ) { Vertex& vertex = _graph.instance( v ); TUTTLE_TCOUT( "[TimeDomain] finish_vertex " << vertex ); if( vertex.isFake() ) return; vertex.getProcessNode().getTimeDomain( vertex.getProcessData()._timeDomain ); TUTTLE_TCOUT_VAR2( vertex.getProcessData()._timeDomain.min, vertex.getProcessData()._timeDomain.max ); }
inline void connectClips( TGraph& graph ) { BOOST_FOREACH( typename TGraph::edge_descriptor ed, graph.getEdges() ) { typename TGraph::Edge& edge = graph.instance( ed ); typename TGraph::Vertex& vertexOutput = graph.targetInstance( ed ); typename TGraph::Vertex& vertexInput = graph.sourceInstance( ed ); TUTTLE_TCOUT( "[connectClips] " << edge ); TUTTLE_TCOUT( vertexOutput << " -> " << vertexInput ); //TUTTLE_TCOUT_VAR( edge.getInAttrName() ); if( ! vertexOutput.isFake() && ! vertexInput.isFake() ) { INode& outputNode = vertexOutput.getProcessNode(); INode& inputNode = vertexInput.getProcessNode(); inputNode.connect( outputNode, inputNode.getAttribute( edge.getInAttrName() ) ); } } }
MotionType ParamRectangleFromCenterSize<TFrame, coord>::intersect( const OFX::PenArgs& args ) { // intersect center point MotionType m = _center.intersect( args ); if( m._mode != eMotionNone ) { TUTTLE_TCOUT( "intersect center." ); _selectType = eSelectTypeC; return m; } // intersect borders _selectType = selectType( args ); TUTTLE_TCOUT( "_selectType : " << mapESelectTypeToString( _selectType ) ); if( _selectType != eSelectTypeNone ) { m._mode = eMotionTranslate; m._axis = eAxisXY; return m; } m._mode = eMotionNone; m._axis = eAxisNone; return m; }
void finish_vertex( VertexDescriptor v, Graph& g ) { Vertex& vertex = _graph.instance( v ); TUTTLE_TCOUT( "[DEPLOY TIME] " << vertex ); if( vertex.isFake() ) { BOOST_FOREACH( const edge_descriptor& ed, _graph.getOutEdges( v ) ) { Edge& e = _graph.instance( ed ); e._timesNeeded[_time].insert( _time ); // TUTTLE_TCOUT( "--- insert edge: " << _time ); } vertex._data._times.insert( _time ); return; }
void OfxhPluginCache::scanDirectory( std::set<std::string>& foundBinFiles, const std::string& dir, bool recurse ) { #ifdef CACHE_DEBUG TUTTLE_TCOUT( "looking in " << dir << " for plugins" ); #endif #if defined ( WINDOWS ) WIN32_FIND_DATA findData; HANDLE findHandle; #else DIR* d = opendir( dir.c_str() ); if( !d ) { return; } #endif _pluginDirs.push_back( dir.c_str() ); #if defined ( UNIX ) while( dirent * de = readdir( d ) ) #elif defined ( WINDOWS ) findHandle = FindFirstFile( ( dir + "\\*" ).c_str(), &findData ); if( findHandle == INVALID_HANDLE_VALUE ) { return; } while( 1 ) #endif { #if defined ( UNIX ) std::string name = de->d_name; bool isdir = true; #else std::string name = findData.cFileName; bool isdir = ( findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) != 0; #endif if( name.find( ".ofx.bundle" ) != std::string::npos ) { std::string barename = name.substr( 0, name.length() - strlen( ".bundle" ) ); std::string bundlepath = dir + DIRSEP + name; std::string binpath = bundlepath + DIRSEP "Contents" DIRSEP + ARCHSTR + DIRSEP + barename; foundBinFiles.insert( binpath ); if( _knownBinFiles.find( binpath ) == _knownBinFiles.end() ) { #ifdef CACHE_DEBUG TUTTLE_TCOUT( "found non-cached binary " << binpath ); #endif setDirty(); try { // the binary was not in the cache OfxhPluginBinary* pb = new OfxhPluginBinary( binpath, bundlepath, this ); _binaries.push_back( pb ); _knownBinFiles.insert( binpath ); for( int j = 0; j < pb->getNPlugins(); ++j ) { OfxhPlugin& plug = pb->getPlugin( j ); APICache::OfxhPluginAPICacheI& api = plug.getApiHandler(); api.loadFromPlugin( plug ); } } catch(... ) { TUTTLE_COUT( tuttle::common::kColorError << "warning: can't load " << binpath << tuttle::common::kColorStd ); TUTTLE_COUT_CURRENT_EXCEPTION; } } else { #ifdef CACHE_DEBUG TUTTLE_TCOUT( "found cached binary " << binpath ); #endif } } else { if( isdir && ( recurse && name[0] != '@' && name != "." && name != ".." ) ) { scanDirectory( foundBinFiles, dir + DIRSEP + name, recurse ); } } #if defined( WINDOWS ) int rval = FindNextFile( findHandle, &findData ); if( rval == 0 ) { break; } #endif } #if defined( UNIX ) closedir( d ); #else FindClose( findHandle ); #endif }