Example #1
0
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 );
		}
	}
}
Example #2
0
std::size_t MemoryPool::updateMemoryAuthorizedWithRAM()
{
	_memoryAuthorized = getUsedMemorySize() + getMemoryInfo()._totalRam;
	TUTTLE_TCOUT_X( 5, " - MEMORYPOOL::updateMemoryAuthorizedWithRAM - " );
	TUTTLE_TCOUT_VAR( _memoryAuthorized );
	return _memoryAuthorized;
}
Example #3
0
bool PngReaderPlugin::getRegionOfDefinition( const OFX::RegionOfDefinitionArguments& args, OfxRectD& rod )
{
	const std::string filename( getAbsoluteFilenameAt( args.time ) );
	if( ! boost::filesystem::exists( filename ) )
	{
		BOOST_THROW_EXCEPTION( exception::FileInSequenceNotExist()
			<< exception::user( "PNG: Unable to open file" )
			<< exception::filename( filename ) );
	}

	try
	{
		point2<ptrdiff_t> pngDims = png_read_dimensions( filename );
		rod.x1 = 0;
		rod.x2 = pngDims.x * this->_clipDst->getPixelAspectRatio();
		rod.y1 = 0;
		rod.y2 = pngDims.y;
		TUTTLE_TCOUT_VAR( rod );
	}
	catch( std::exception& e )
	{
		BOOST_THROW_EXCEPTION( exception::FileNotExist()
			<< exception::user( "PNG: Unable to open file" )
			<< exception::dev( e.what() )
			<< exception::filename( filename ) );
	}
	return true;
}
Example #4
0
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, "-" );
}