Пример #1
0
void ThreadEnv::runProcessFunc( ThreadEnv* threadEnv, Graph& graph, const std::list<std::string>& nodes )
{
	try
	{
		threadEnv->setResult( graph.compute( threadEnv->_imageCache, nodes, threadEnv->_options ) );
	}
	catch(...)
	{
		threadEnv->setResult( false );  // error during the process.
		TUTTLE_LOG_ERROR( "[Process render] Error.");
		TUTTLE_LOG_ERROR( boost::current_exception_diagnostic_information() );
		core().getMemoryCache().clearUnused();
	}
	threadEnv->setIsRunning(false);
	threadEnv->getSignalEnd()();
}
Пример #2
0
/*
 * Extend a geodesicForm using the selection
 */
void SelectionAverage::extendGeodesicForm(OFX::Clip* clipColor, const OfxPointD& renderScale, GeodesicForm& geodesicForm)
{
	// connection test
	if( ! clipColor->isConnected() )
	{	
		return;
	}

	boost::scoped_ptr<OFX::Image> src( clipColor->fetchImage(_time, clipColor->getCanonicalRod(_time, renderScale)) );	//scoped pointer of current source clip
	
	//TUTTLE_TLOG_VAR( TUTTLE_INFO, clipColor->getPixelRod(_time,renderScale)); 
	//TUTTLE_TLOG_VAR( TUTTLE_INFO, clipColor->getCanonicalRod(_time, renderScale));

	// Compatibility tests
	if( !src.get() ) // source isn't accessible
	{
		TUTTLE_LOG_ERROR( "src is not accessible (color clip)" );
		return;
	}

	if( src->getRowDistanceBytes() == 0 )//if source is wrong
	{
		BOOST_THROW_EXCEPTION( exception::WrongRowBytes() );
		return;
	}

	const OfxRectI srcPixelRod = clipColor->getPixelRod( _time, renderScale ); //get current RoD
	if( (clipColor->getPixelDepth() != OFX::eBitDepthFloat) ||
		(!clipColor->getPixelComponents()) )
	{
		BOOST_THROW_EXCEPTION( exception::Unsupported()	<< exception::user() + "Can't compute histogram data with the actual input clip format." );
		return;
	}

	if( srcPixelRod != src->getBounds() )// the host does bad things !
	{
		// remove overlay... but do not crash.
		TUTTLE_LOG_WARNING( "Image RoD and image bounds are not the same (rod=" << srcPixelRod << " , bounds:" << src->getBounds() << ")." );
		return;
	}

	// Compute if source is OK
	SView colorView = tuttle::plugin::getGilView<SView>( src.get(), srcPixelRod, eImageOrientationIndependant );		// get current view from color clip
	Pixel_extend_GeodesicForm funct(geodesicForm);	//functor declaration			//initialize functor
	terry::algorithm::transform_pixels(colorView, funct);									//with functor reference;
}