Toshihiro Shimizu 890ddd
#include <sstream> /* std::ostringstream */</sstream>
Toshihiro Shimizu 890ddd
/* Not use boost at toonz-6.1 */
Toshihiro Shimizu 890ddd
// #include <boost shared_array.hpp=""> /* boost::shared_array<> */</boost>
Toshihiro Shimizu 890ddd
#include "tfxparam.h"
Toshihiro Shimizu 890ddd
#include "stdfx.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "ino_common.h"
Toshihiro Shimizu 890ddd
//------------------------------------------------------------
Toshihiro Shimizu 890ddd
class ino_channel_selector : public TStandardRasterFx
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	FX_PLUGIN_DECLARATION(ino_channel_selector)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRasterFxPort m_source1;
Toshihiro Shimizu 890ddd
	TRasterFxPort m_source2;
Toshihiro Shimizu 890ddd
	TRasterFxPort m_source3;
Toshihiro Shimizu 890ddd
	TRasterFxPort m_source4;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TIntParamP m_red_source;
Toshihiro Shimizu 890ddd
	TIntParamP m_gre_source;
Toshihiro Shimizu 890ddd
	TIntParamP m_blu_source;
Toshihiro Shimizu 890ddd
	TIntParamP m_alp_source;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TIntEnumParamP m_red_channel;
Toshihiro Shimizu 890ddd
	TIntEnumParamP m_gre_channel;
Toshihiro Shimizu 890ddd
	TIntEnumParamP m_blu_channel;
Toshihiro Shimizu 890ddd
	TIntEnumParamP m_alp_channel;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	ino_channel_selector()
Toshihiro Shimizu 890ddd
		: m_red_source(1), m_gre_source(1), m_blu_source(1), m_alp_source(1)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_red_channel(new TIntEnumParam(0, "Red")), m_gre_channel(new TIntEnumParam(1, "Green")), m_blu_channel(new TIntEnumParam(2, "Blue")), m_alp_channel(new TIntEnumParam(3, "Alpha"))
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		addInputPort("Source1", this->m_source1);
Toshihiro Shimizu 890ddd
		addInputPort("Source2", this->m_source2);
Toshihiro Shimizu 890ddd
		addInputPort("Source3", this->m_source3);
Toshihiro Shimizu 890ddd
		addInputPort("Source4", this->m_source4);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		bindParam(this, "red_source", this->m_red_source);
Toshihiro Shimizu 890ddd
		bindParam(this, "green_source", this->m_gre_source);
Toshihiro Shimizu 890ddd
		bindParam(this, "blue_source", this->m_blu_source);
Toshihiro Shimizu 890ddd
		bindParam(this, "alpha_source", this->m_alp_source);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		bindParam(this, "red_channel", this->m_red_channel);
Toshihiro Shimizu 890ddd
		bindParam(this, "green_channel", this->m_gre_channel);
Toshihiro Shimizu 890ddd
		bindParam(this, "blue_channel", this->m_blu_channel);
Toshihiro Shimizu 890ddd
		bindParam(this, "alpha_channel", this->m_alp_channel);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		this->m_red_channel->addItem(1, "Green");
Toshihiro Shimizu 890ddd
		this->m_red_channel->addItem(2, "Blue");
Toshihiro Shimizu 890ddd
		this->m_red_channel->addItem(3, "Alpha");
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		this->m_gre_channel->addItem(0, "Red");
Toshihiro Shimizu 890ddd
		this->m_gre_channel->addItem(2, "Blue");
Toshihiro Shimizu 890ddd
		this->m_gre_channel->addItem(3, "Alpha");
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		this->m_blu_channel->addItem(0, "Red");
Toshihiro Shimizu 890ddd
		this->m_blu_channel->addItem(1, "Green");
Toshihiro Shimizu 890ddd
		this->m_blu_channel->addItem(3, "Alpha");
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		this->m_alp_channel->addItem(0, "Red");
Toshihiro Shimizu 890ddd
		this->m_alp_channel->addItem(1, "Green");
Toshihiro Shimizu 890ddd
		this->m_alp_channel->addItem(2, "Blue");
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	bool doGetBBox(
Toshihiro Shimizu 890ddd
		double frame, TRectD &bBox, const TRenderSettings &info)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		for (int ii = 0; ii < this->getInputPortCount(); ++ii) {
Shinya Kitaoka 3bfa54
			std::string nm = this->getInputPortName(ii);
Toshihiro Shimizu 890ddd
			TRasterFxPort *
Toshihiro Shimizu 890ddd
				tmp_port = (TRasterFxPort *)this->getInputPort(nm);
Toshihiro Shimizu 890ddd
			if (tmp_port->isConnected()) {
Toshihiro Shimizu 890ddd
				return (*tmp_port)->doGetBBox(frame, bBox, info);
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		bBox = TRectD();
Toshihiro Shimizu 890ddd
		return false;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	bool canHandle(const TRenderSettings &info, double frame)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
		return true;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	void doCompute(
Toshihiro Shimizu 890ddd
		TTile &tile, double frame, const TRenderSettings &ri);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
FX_PLUGIN_IDENTIFIER(ino_channel_selector, "inoChannelSelectorFx");
Toshihiro Shimizu 890ddd
//--------------------------------------------------------------------
Toshihiro Shimizu 890ddd
// #include "igs_channel_selector.h"
Toshihiro Shimizu 890ddd
namespace
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
template <typename in_pixel,="" out_pixel="" typename=""></typename>
Toshihiro Shimizu 890ddd
void fx_template(
Toshihiro Shimizu 890ddd
	const TRasterPT<in_pixel> in_ras, const int in_sel, const TRasterPT<out_pixel> out_ras, const int out_sel)</out_pixel></in_pixel>
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	for (int yy = 0; yy < out_ras->getLy(); ++yy) {
Toshihiro Shimizu 890ddd
		IN_PIXEL *sl_in = in_ras->pixels(yy);
Toshihiro Shimizu 890ddd
		OUT_PIXEL *sl_out = out_ras->pixels(yy);
Toshihiro Shimizu 890ddd
		for (int xx = 0; xx < out_ras->getLx(); ++xx, ++sl_in, ++sl_out) {
Toshihiro Shimizu 890ddd
			int val = 0;
Toshihiro Shimizu 890ddd
			switch (in_sel) {
Toshihiro Shimizu 890ddd
			case 0:
Toshihiro Shimizu 890ddd
				val = sl_in->r;
Toshihiro Shimizu 890ddd
				break;
Toshihiro Shimizu 890ddd
			case 1:
Toshihiro Shimizu 890ddd
				val = sl_in->g;
Toshihiro Shimizu 890ddd
				break;
Toshihiro Shimizu 890ddd
			case 2:
Toshihiro Shimizu 890ddd
				val = sl_in->b;
Toshihiro Shimizu 890ddd
				break;
Toshihiro Shimizu 890ddd
			case 3:
Toshihiro Shimizu 890ddd
				val = sl_in->m;
Toshihiro Shimizu 890ddd
				break;
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
			switch (out_sel) {
Toshihiro Shimizu 890ddd
			case 0:
Toshihiro Shimizu 890ddd
				sl_out->r = val;
Toshihiro Shimizu 890ddd
				break;
Toshihiro Shimizu 890ddd
			case 1:
Toshihiro Shimizu 890ddd
				sl_out->g = val;
Toshihiro Shimizu 890ddd
				break;
Toshihiro Shimizu 890ddd
			case 2:
Toshihiro Shimizu 890ddd
				sl_out->b = val;
Toshihiro Shimizu 890ddd
				break;
Toshihiro Shimizu 890ddd
			case 3:
Toshihiro Shimizu 890ddd
				sl_out->m = val;
Toshihiro Shimizu 890ddd
				break;
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
void fx_(
Toshihiro Shimizu 890ddd
	const TRasterP in_ras, const int in_sel, TRasterP out_ras, const int out_sel)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	if ((TRaster32P)in_ras && (TRaster32P)out_ras) {
Toshihiro Shimizu 890ddd
		fx_template<tpixel32, tpixel32="">(in_ras, in_sel, out_ras, out_sel);</tpixel32,>
Toshihiro Shimizu 890ddd
	} else if ((TRaster64P)in_ras && (TRaster64P)out_ras) {
Toshihiro Shimizu 890ddd
		fx_template<tpixel64, tpixel64="">(in_ras, in_sel, out_ras, out_sel);</tpixel64,>
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
//------------------------------------------------------------
Toshihiro Shimizu 890ddd
void ino_channel_selector::doCompute(
Toshihiro Shimizu 890ddd
	TTile &tile, double frame, const TRenderSettings &ri)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	/* ------ サポートしていないPixelタイプはエラーを投げる --- */
Toshihiro Shimizu 890ddd
	if (!((TRaster32P)tile.getRaster()) &&
Toshihiro Shimizu 890ddd
		!((TRaster64P)tile.getRaster())) {
Toshihiro Shimizu 890ddd
		throw TRopException("unsupported input pixel type");
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* ------ 動作パラメータを得る ---------------------------- */
Toshihiro Shimizu 890ddd
	const int red_source = this->m_red_source->getValue() - 1;
Toshihiro Shimizu 890ddd
	const int gre_source = this->m_gre_source->getValue() - 1;
Toshihiro Shimizu 890ddd
	const int blu_source = this->m_blu_source->getValue() - 1;
Toshihiro Shimizu 890ddd
	const int alp_source = this->m_alp_source->getValue() - 1;
Toshihiro Shimizu 890ddd
	const int red_channel = this->m_red_channel->getValue();
Toshihiro Shimizu 890ddd
	const int gre_channel = this->m_gre_channel->getValue();
Toshihiro Shimizu 890ddd
	const int blu_channel = this->m_blu_channel->getValue();
Toshihiro Shimizu 890ddd
	const int alp_channel = this->m_alp_channel->getValue();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* ------ 画像位置とサイズ -------------------------------- */
Toshihiro Shimizu 890ddd
	/***const TRectD rect = TRectD( tile.m_pos, TDimensionD(
Toshihiro Shimizu 890ddd
		  tile.getRaster()->getLx()
Toshihiro Shimizu 890ddd
		, tile.getRaster()->getLy()
Toshihiro Shimizu 890ddd
	));
Toshihiro Shimizu 890ddd
	const TPointD poin = TPointD(rect.getP00());
Toshihiro Shimizu 890ddd
	const TDimension dime = TDimension(
Toshihiro Shimizu 890ddd
		 (int)(rect.getLx()+0.5)
Toshihiro Shimizu 890ddd
		,(int)(rect.getLy()+0.5)
Toshihiro Shimizu 890ddd
	);***/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* ------ 塗りつぶしクリア -------------------------------- */
Toshihiro Shimizu 890ddd
	tile.getRaster()->clear();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* ------ 入力画像を接続していなければ処理しない ---------- */
Toshihiro Shimizu 890ddd
	if (this->getInputPortCount() <= 0) {
Toshihiro Shimizu 890ddd
		return;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* ------ 入力画像の参照を確保 ---------------------------- */
Toshihiro Shimizu 890ddd
	//TTile *source_tiles = new TTile[this->getInputPortCount()];
Toshihiro Shimizu 890ddd
	//int   *source_sw    = new int[this->getInputPortCount()];
Toshihiro Shimizu 890ddd
	//TRasterP *ras_a     = new TRasterP[this->getInputPortCount()];
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* Not use boost at toonz-6.1 */
Toshihiro Shimizu 890ddd
	/******
Toshihiro Shimizu 890ddd
	boost::shared_array<ttile></ttile>
Toshihiro Shimizu 890ddd
		source_tiles(new TTile[this->getInputPortCount()]);
Toshihiro Shimizu 890ddd
	boost::shared_array<int></int>
Toshihiro Shimizu 890ddd
		source_sw(new int[this->getInputPortCount()]);
Toshihiro Shimizu 890ddd
	boost::shared_array<trasterp></trasterp>
Toshihiro Shimizu 890ddd
		ras_a(new TRasterP[this->getInputPortCount()]);
Toshihiro Shimizu 890ddd
******/
Toshihiro Shimizu 890ddd
	/* Array item(TRasterFxPort) number is 4(fix) in this code */
Toshihiro Shimizu 890ddd
	TTile source_tiles[4];
Toshihiro Shimizu 890ddd
	int source_sw[4];
Toshihiro Shimizu 890ddd
	TRasterP ras_a[4];
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int ras_s = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* ------ 画像生成 ---------------------------------------- */
Toshihiro Shimizu 890ddd
	for (int ii = 0; ii < this->getInputPortCount(); ++ii) {
Shinya Kitaoka 3bfa54
		std::string nm = this->getInputPortName(ii);
Toshihiro Shimizu 890ddd
		TRasterFxPort *
Toshihiro Shimizu 890ddd
			tmp_port = (TRasterFxPort *)this->getInputPort(nm);
Toshihiro Shimizu 890ddd
		if (tmp_port->isConnected() && ((ii == red_source) || (ii == gre_source) ||
Toshihiro Shimizu 890ddd
										(ii == blu_source) || (ii == alp_source))) {
Toshihiro Shimizu 890ddd
			(*tmp_port)->allocateAndCompute(
Toshihiro Shimizu 890ddd
				source_tiles[ii]
Toshihiro Shimizu 890ddd
				//,poin,dime
Toshihiro Shimizu 890ddd
				,
Toshihiro Shimizu 890ddd
				tile.m_pos /* 位置 */
Toshihiro Shimizu 890ddd
				,
Toshihiro Shimizu 890ddd
				TDimension(/* サイズ */
Toshihiro Shimizu 890ddd
						   tile.getRaster()->getLx(), tile.getRaster()->getLy()),
Toshihiro Shimizu 890ddd
				tile.getRaster() /* sampling */
Toshihiro Shimizu 890ddd
				,
Toshihiro Shimizu 890ddd
				frame, ri);
Toshihiro Shimizu 890ddd
			source_sw[ii] = 1;
Toshihiro Shimizu 890ddd
			ras_a[ras_s++] = source_tiles[ii].getRaster();
Toshihiro Shimizu 890ddd
		} else
Toshihiro Shimizu 890ddd
			source_sw[ii] = 0;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRasterP red_ras = 0;
Toshihiro Shimizu 890ddd
	TRasterP gre_ras = 0;
Toshihiro Shimizu 890ddd
	TRasterP blu_ras = 0;
Toshihiro Shimizu 890ddd
	TRasterP alp_ras = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	if ((0 <= red_source) && (red_source < this->getInputPortCount()) && source_sw[red_source]) {
Toshihiro Shimizu 890ddd
		red_ras = source_tiles[red_source].getRaster();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	if ((0 <= gre_source) && (gre_source < this->getInputPortCount()) && source_sw[gre_source]) {
Toshihiro Shimizu 890ddd
		gre_ras = source_tiles[gre_source].getRaster();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	if ((0 <= blu_source) && (blu_source < this->getInputPortCount()) && source_sw[blu_source]) {
Toshihiro Shimizu 890ddd
		blu_ras = source_tiles[blu_source].getRaster();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	if ((0 <= alp_source) && (alp_source < this->getInputPortCount()) && source_sw[alp_source]) {
Toshihiro Shimizu 890ddd
		alp_ras = source_tiles[alp_source].getRaster();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* ------ (app_begin)log記憶 ------------------------------ */
Toshihiro Shimizu 890ddd
	const bool log_sw = ino::log_enable_sw();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	if (log_sw) {
Toshihiro Shimizu 890ddd
		std::ostringstream os;
Toshihiro Shimizu 890ddd
		os
Toshihiro Shimizu 890ddd
			<< "red"
Toshihiro Shimizu 890ddd
			<< "  s " << red_source << "  c " << red_channel
Toshihiro Shimizu 890ddd
			<< "   green"
Toshihiro Shimizu 890ddd
			<< "  s " << gre_source << "  c " << gre_channel
Toshihiro Shimizu 890ddd
			<< "   blue"
Toshihiro Shimizu 890ddd
			<< "  s " << blu_source << "  c " << blu_channel
Toshihiro Shimizu 890ddd
			<< "   alpha"
Toshihiro Shimizu 890ddd
			<< "  s " << alp_source << "  c " << alp_channel
Toshihiro Shimizu 890ddd
			<< "   tile w " << tile.getRaster()->getLx()
Toshihiro Shimizu 890ddd
			<< "  h " << tile.getRaster()->getLy()
Toshihiro Shimizu 890ddd
			<< "  b " << ino::pixel_bits(tile.getRaster());
Toshihiro Shimizu 890ddd
		os
Toshihiro Shimizu 890ddd
			<< "   s_count " << this->getInputPortCount();
Toshihiro Shimizu 890ddd
		for (int ii = 0; ii < this->getInputPortCount(); ++ii) {
Toshihiro Shimizu 890ddd
			if (source_sw[ii]) {
Toshihiro Shimizu 890ddd
				os
Toshihiro Shimizu 890ddd
					<< "   tile" << ii
Toshihiro Shimizu 890ddd
					<< "  w " << source_tiles[ii].getRaster()->getLx()
Toshihiro Shimizu 890ddd
					<< "  h " << source_tiles[ii].getRaster()->getLy()
Toshihiro Shimizu 890ddd
					<< "  b " << ino::pixel_bits(source_tiles[ii].getRaster());
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		os
Toshihiro Shimizu 890ddd
			<< "   frame " << frame;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	/* ------ 入力画像の参照開放 ------------------------------ */
Toshihiro Shimizu 890ddd
	//delete [] source_sw;
Toshihiro Shimizu 890ddd
	//delete [] source_tiles;
Toshihiro Shimizu 890ddd
	/* ------ fx処理 ------------------------------------------ */
Toshihiro Shimizu 890ddd
	try {
Toshihiro Shimizu 890ddd
		tile.getRaster()->lock();
Toshihiro Shimizu 890ddd
		for (int ii = 0; ii < ras_s; ++ii) {
Toshihiro Shimizu 890ddd
			ras_a[ii]->lock();
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		if (red_ras) {
Toshihiro Shimizu 890ddd
			fx_(red_ras, red_channel, tile.getRaster(), 0);
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		if (gre_ras) {
Toshihiro Shimizu 890ddd
			fx_(gre_ras, gre_channel, tile.getRaster(), 1);
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		if (blu_ras) {
Toshihiro Shimizu 890ddd
			fx_(blu_ras, blu_channel, tile.getRaster(), 2);
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		if (alp_ras) {
Toshihiro Shimizu 890ddd
			fx_(alp_ras, alp_channel, tile.getRaster(), 3);
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		for (int ii = ras_s - 1; 0 <= ii; --ii) {
Toshihiro Shimizu 890ddd
			ras_a[ii]->unlock();
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		tile.getRaster()->unlock();
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	/* ------ error処理 --------------------------------------- */
Toshihiro Shimizu 890ddd
	catch (std::bad_alloc &e) {
Toshihiro Shimizu 890ddd
		for (int ii = ras_s - 1; 0 <= ii; --ii) {
Toshihiro Shimizu 890ddd
			ras_a[ii]->unlock();
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		tile.getRaster()->unlock();
Toshihiro Shimizu 890ddd
		if (log_sw) {
Toshihiro Shimizu 890ddd
			std::string str("std::bad_alloc <");
Toshihiro Shimizu 890ddd
			str += e.what();
Toshihiro Shimizu 890ddd
			str += '>';
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		//delete [] ras_a;
Toshihiro Shimizu 890ddd
		throw;
Toshihiro Shimizu 890ddd
	} catch (std::exception &e) {
Toshihiro Shimizu 890ddd
		for (int ii = ras_s - 1; 0 <= ii; --ii) {
Toshihiro Shimizu 890ddd
			ras_a[ii]->unlock();
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		tile.getRaster()->unlock();
Toshihiro Shimizu 890ddd
		if (log_sw) {
Toshihiro Shimizu 890ddd
			std::string str("exception <");
Toshihiro Shimizu 890ddd
			str += e.what();
Toshihiro Shimizu 890ddd
			str += '>';
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		//delete [] ras_a;
Toshihiro Shimizu 890ddd
		throw;
Toshihiro Shimizu 890ddd
	} catch (...) {
Toshihiro Shimizu 890ddd
		for (int ii = ras_s - 1; 0 <= ii; --ii) {
Toshihiro Shimizu 890ddd
			ras_a[ii]->unlock();
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		tile.getRaster()->unlock();
Toshihiro Shimizu 890ddd
		if (log_sw) {
Toshihiro Shimizu 890ddd
			std::string str("other exception");
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		//delete [] ras_a;
Toshihiro Shimizu 890ddd
		throw;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	//delete [] ras_a;
Toshihiro Shimizu 890ddd
}