Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "traster.h"
Toshihiro Shimizu 890ddd
#include "trastercm.h"
Toshihiro Shimizu 890ddd
#include "tpalette.h"
Toshihiro Shimizu 890ddd
#include "tcolorstyles.h"
Toshihiro Shimizu 890ddd
//#include "trop.h"
Toshihiro Shimizu 890ddd
#include "tropcm.h"
Toshihiro Shimizu 890ddd
#include "tpixelutils.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define TMIN(a, b) (a < b ? a : b)
Toshihiro Shimizu 890ddd
#define TMAX(a, b) (a > b ? a : b)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
namespace
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class class="" pixin="" pixout,=""></class>
Toshihiro Shimizu 890ddd
void doConvolve_row_9_i(PIXOUT *pixout, int n, PIXIN *pixarr[], long w[])
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	long w1, w2, w3, w4, w5, w6, w7, w8, w9;
Toshihiro Shimizu 890ddd
	PIXIN *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9;
Toshihiro Shimizu 890ddd
	w1 = w[0];
Toshihiro Shimizu 890ddd
	w2 = w[1];
Toshihiro Shimizu 890ddd
	w3 = w[2];
Toshihiro Shimizu 890ddd
	w4 = w[3];
Toshihiro Shimizu 890ddd
	w5 = w[4];
Toshihiro Shimizu 890ddd
	w6 = w[5];
Toshihiro Shimizu 890ddd
	w7 = w[6];
Toshihiro Shimizu 890ddd
	w8 = w[7];
Toshihiro Shimizu 890ddd
	w9 = w[8];
Toshihiro Shimizu 890ddd
	p1 = pixarr[0];
Toshihiro Shimizu 890ddd
	p2 = pixarr[1];
Toshihiro Shimizu 890ddd
	p3 = pixarr[2];
Toshihiro Shimizu 890ddd
	p4 = pixarr[3];
Toshihiro Shimizu 890ddd
	p5 = pixarr[4];
Toshihiro Shimizu 890ddd
	p6 = pixarr[5];
Toshihiro Shimizu 890ddd
	p7 = pixarr[6];
Toshihiro Shimizu 890ddd
	p8 = pixarr[7];
Toshihiro Shimizu 890ddd
	p9 = pixarr[8];
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int rightShift = 16 + ((int)sizeof(typename PIXIN::Channel) - (int)sizeof(typename PIXOUT::Channel)) * 8;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	while (n-- > 0) {
Toshihiro Shimizu 890ddd
		pixout->r = (typename PIXOUT::Channel)((p1->r * w1 + p2->r * w2 + p3->r * w3 +
Toshihiro Shimizu 890ddd
												p4->r * w4 + p5->r * w5 + p6->r * w6 +
Toshihiro Shimizu 890ddd
												p7->r * w7 + p8->r * w8 + p9->r * w9 + (1 << 15)) >>
Toshihiro Shimizu 890ddd
											   rightShift);
Toshihiro Shimizu 890ddd
		pixout->g = (typename PIXOUT::Channel)((p1->g * w1 + p2->g * w2 + p3->g * w3 +
Toshihiro Shimizu 890ddd
												p4->g * w4 + p5->g * w5 + p6->g * w6 +
Toshihiro Shimizu 890ddd
												p7->g * w7 + p8->g * w8 + p9->g * w9 + (1 << 15)) >>
Toshihiro Shimizu 890ddd
											   rightShift);
Toshihiro Shimizu 890ddd
		pixout->b = (typename PIXOUT::Channel)((p1->b * w1 + p2->b * w2 + p3->b * w3 +
Toshihiro Shimizu 890ddd
												p4->b * w4 + p5->b * w5 + p6->b * w6 +
Toshihiro Shimizu 890ddd
												p7->b * w7 + p8->b * w8 + p9->b * w9 + (1 << 15)) >>
Toshihiro Shimizu 890ddd
											   rightShift);
Toshihiro Shimizu 890ddd
		pixout->m = (typename PIXOUT::Channel)((p1->m * w1 + p2->m * w2 + p3->m * w3 +
Toshihiro Shimizu 890ddd
												p4->m * w4 + p5->m * w5 + p6->m * w6 +
Toshihiro Shimizu 890ddd
												p7->m * w7 + p8->m * w8 + p9->m * w9 + (1 << 15)) >>
Toshihiro Shimizu 890ddd
											   rightShift);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		p1++;
Toshihiro Shimizu 890ddd
		p2++;
Toshihiro Shimizu 890ddd
		p3++;
Toshihiro Shimizu 890ddd
		p4++;
Toshihiro Shimizu 890ddd
		p5++;
Toshihiro Shimizu 890ddd
		p6++;
Toshihiro Shimizu 890ddd
		p7++;
Toshihiro Shimizu 890ddd
		p8++;
Toshihiro Shimizu 890ddd
		p9++;
Toshihiro Shimizu 890ddd
		pixout++;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class pixout=""></class>
Toshihiro Shimizu 890ddd
void doConvolve_cm32_row_9_i(PIXOUT *pixout, int n,
Toshihiro Shimizu 890ddd
							 TPixelCM32 *pixarr[], long w[],
Shinya Kitaoka 3bfa54
							 const std::vector<tpixel32> &paints,</tpixel32>
Shinya Kitaoka 3bfa54
							 const std::vector<tpixel32> &inks)</tpixel32>
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	long w1, w2, w3, w4, w5, w6, w7, w8, w9;
Toshihiro Shimizu 890ddd
	TPixelCM32 *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9;
Toshihiro Shimizu 890ddd
	TPixel32 val[9];
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	w1 = w[0];
Toshihiro Shimizu 890ddd
	w2 = w[1];
Toshihiro Shimizu 890ddd
	w3 = w[2];
Toshihiro Shimizu 890ddd
	w4 = w[3];
Toshihiro Shimizu 890ddd
	w5 = w[4];
Toshihiro Shimizu 890ddd
	w6 = w[5];
Toshihiro Shimizu 890ddd
	w7 = w[6];
Toshihiro Shimizu 890ddd
	w8 = w[7];
Toshihiro Shimizu 890ddd
	w9 = w[8];
Toshihiro Shimizu 890ddd
	p1 = pixarr[0];
Toshihiro Shimizu 890ddd
	p2 = pixarr[1];
Toshihiro Shimizu 890ddd
	p3 = pixarr[2];
Toshihiro Shimizu 890ddd
	p4 = pixarr[3];
Toshihiro Shimizu 890ddd
	p5 = pixarr[4];
Toshihiro Shimizu 890ddd
	p6 = pixarr[5];
Toshihiro Shimizu 890ddd
	p7 = pixarr[6];
Toshihiro Shimizu 890ddd
	p8 = pixarr[7];
Toshihiro Shimizu 890ddd
	p9 = pixarr[8];
Toshihiro Shimizu 890ddd
	while (n-- > 0) {
Toshihiro Shimizu 890ddd
		for (int i = 0; i < 9; ++i) {
Toshihiro Shimizu 890ddd
			int tone = p1->getTone();
Toshihiro Shimizu 890ddd
			int paint = p1->getPaint();
Toshihiro Shimizu 890ddd
			int ink = p1->getInk();
Toshihiro Shimizu 890ddd
			if (tone == TPixelCM32::getMaxTone())
Toshihiro Shimizu 890ddd
				val[i] = paints[paint];
Toshihiro Shimizu 890ddd
			else if (tone == 0)
Toshihiro Shimizu 890ddd
				val[i] = inks[ink];
Toshihiro Shimizu 890ddd
			else
Toshihiro Shimizu 890ddd
				val[i] = blend(inks[ink], paints[paint], tone, TPixelCM32::getMaxTone());
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		pixout->r = (typename PIXOUT::Channel)((val[1].r * w1 + val[2].r * w2 + val[3].r * w3 +
Toshihiro Shimizu 890ddd
												val[4].r * w4 + val[5].r * w5 + val[6].r * w6 +
Toshihiro Shimizu 890ddd
												val[7].r * w7 + val[8].r * w8 + val[9].r * w9 + (1 << 15)) >>
Toshihiro Shimizu 890ddd
											   16);
Toshihiro Shimizu 890ddd
		pixout->g = (typename PIXOUT::Channel)((val[1].g * w1 + val[2].g * w2 + val[3].g * w3 +
Toshihiro Shimizu 890ddd
												val[4].g * w4 + val[5].g * w5 + val[6].g * w6 +
Toshihiro Shimizu 890ddd
												val[7].g * w7 + val[8].g * w8 + val[9].g * w9 + (1 << 15)) >>
Toshihiro Shimizu 890ddd
											   16);
Toshihiro Shimizu 890ddd
		pixout->b = (typename PIXOUT::Channel)((val[1].b * w1 + val[2].b * w2 + val[3].b * w3 +
Toshihiro Shimizu 890ddd
												val[4].b * w4 + val[5].b * w5 + val[6].b * w6 +
Toshihiro Shimizu 890ddd
												val[7].b * w7 + val[8].b * w8 + val[9].b * w9 + (1 << 15)) >>
Toshihiro Shimizu 890ddd
											   16);
Toshihiro Shimizu 890ddd
		pixout->m = (typename PIXOUT::Channel)((val[1].m * w1 + val[2].m * w2 + val[3].m * w3 +
Toshihiro Shimizu 890ddd
												val[4].m * w4 + val[5].m * w5 + val[6].m * w6 +
Toshihiro Shimizu 890ddd
												val[7].m * w7 + val[8].m * w8 + val[9].m * w9 + (1 << 15)) >>
Toshihiro Shimizu 890ddd
											   16);
Toshihiro Shimizu 890ddd
		p1++;
Toshihiro Shimizu 890ddd
		p2++;
Toshihiro Shimizu 890ddd
		p3++;
Toshihiro Shimizu 890ddd
		p4++;
Toshihiro Shimizu 890ddd
		p5++;
Toshihiro Shimizu 890ddd
		p6++;
Toshihiro Shimizu 890ddd
		p7++;
Toshihiro Shimizu 890ddd
		p8++;
Toshihiro Shimizu 890ddd
		p9++;
Toshihiro Shimizu 890ddd
		pixout++;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class class="" pixin="" pixout,=""></class>
Toshihiro Shimizu 890ddd
void doConvolve_row_i(PIXOUT *pixout, int n,
Toshihiro Shimizu 890ddd
					  PIXIN *pixarr[], long w[], int pixn)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	long ar, ag, ab, am;
Toshihiro Shimizu 890ddd
	int i;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int rightShift = 16 + ((int)sizeof(typename PIXIN::Channel) - (int)sizeof(typename PIXOUT::Channel)) * 8;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	while (n-- > 0) {
Toshihiro Shimizu 890ddd
		ar = ag = ab = am = 0;
Toshihiro Shimizu 890ddd
		for (i = 0; i < pixn; i++) {
Toshihiro Shimizu 890ddd
			ar += pixarr[i]->r * w[i];
Toshihiro Shimizu 890ddd
			ag += pixarr[i]->g * w[i];
Toshihiro Shimizu 890ddd
			ab += pixarr[i]->b * w[i];
Toshihiro Shimizu 890ddd
			am += pixarr[i]->m * w[i];
Toshihiro Shimizu 890ddd
			pixarr[i]++;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		pixout->r = (typename PIXOUT::Channel)((ar + (1 << 15)) >> rightShift);
Toshihiro Shimizu 890ddd
		pixout->g = (typename PIXOUT::Channel)((ag + (1 << 15)) >> rightShift);
Toshihiro Shimizu 890ddd
		pixout->b = (typename PIXOUT::Channel)((ab + (1 << 15)) >> rightShift);
Toshihiro Shimizu 890ddd
		pixout->m = (typename PIXOUT::Channel)((am + (1 << 15)) >> rightShift);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		pixout++;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class pixout=""></class>
Toshihiro Shimizu 890ddd
void doConvolve_cm32_row_i(PIXOUT *pixout, int n,
Toshihiro Shimizu 890ddd
						   TPixelCM32 *pixarr[], long w[], int pixn,
Shinya Kitaoka 3bfa54
						   const std::vector<tpixel32> &paints,</tpixel32>
Shinya Kitaoka 3bfa54
						   const std::vector<tpixel32> &inks)</tpixel32>
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	long ar, ag, ab, am;
Toshihiro Shimizu 890ddd
	int i;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	while (n-- > 0) {
Toshihiro Shimizu 890ddd
		ar = ag = ab = am = 0;
Toshihiro Shimizu 890ddd
		for (i = 0; i < pixn; i++) {
Toshihiro Shimizu 890ddd
			TPixel32 val;
Toshihiro Shimizu 890ddd
			int tone = pixarr[i]->getTone();
Toshihiro Shimizu 890ddd
			int paint = pixarr[i]->getPaint();
Toshihiro Shimizu 890ddd
			int ink = pixarr[i]->getInk();
Toshihiro Shimizu 890ddd
			if (tone == TPixelCM32::getMaxTone())
Toshihiro Shimizu 890ddd
				val = paints[paint];
Toshihiro Shimizu 890ddd
			else if (tone == 0)
Toshihiro Shimizu 890ddd
				val = inks[ink];
Toshihiro Shimizu 890ddd
			else
Toshihiro Shimizu 890ddd
				val = blend(inks[ink], paints[paint], tone, TPixelCM32::getMaxTone());
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
			ar += val.r * w[i];
Toshihiro Shimizu 890ddd
			ag += val.g * w[i];
Toshihiro Shimizu 890ddd
			ab += val.b * w[i];
Toshihiro Shimizu 890ddd
			am += val.m * w[i];
Toshihiro Shimizu 890ddd
			pixarr[i]++;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
		pixout->r = (typename PIXOUT::Channel)((ar + (1 << 15)) >> 16);
Toshihiro Shimizu 890ddd
		pixout->g = (typename PIXOUT::Channel)((ag + (1 << 15)) >> 16);
Toshihiro Shimizu 890ddd
		pixout->b = (typename PIXOUT::Channel)((ab + (1 << 15)) >> 16);
Toshihiro Shimizu 890ddd
		pixout->m = (typename PIXOUT::Channel)((am + (1 << 15)) >> 16);
Toshihiro Shimizu 890ddd
		pixout++;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class class="" pixin="" pixout,=""></class>
Toshihiro Shimizu 890ddd
void doConvolve_3_i(TRasterPT<pixout> rout,</pixout>
Toshihiro Shimizu 890ddd
					TRasterPT<pixin> rin,</pixin>
Toshihiro Shimizu 890ddd
					int dx, int dy,
Toshihiro Shimizu 890ddd
					double conv[])
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	PIXIN *bufferin;
Toshihiro Shimizu 890ddd
	PIXOUT *bufferout;
Toshihiro Shimizu 890ddd
	PIXIN *pixin;
Toshihiro Shimizu 890ddd
	PIXOUT *pixout;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	PIXIN *pixarr[9];
Toshihiro Shimizu 890ddd
	long w[9];
Toshihiro Shimizu 890ddd
	int pixn;
Toshihiro Shimizu 890ddd
	int wrapin, wrapout;
Toshihiro Shimizu 890ddd
	int x, y, n;
Toshihiro Shimizu 890ddd
	int x1, y1, x2, y2;
Toshihiro Shimizu 890ddd
	int fx1, fy1, fx2, fy2, fx, fy;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	rout->clear();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	wrapin = rin->getWrap();
Toshihiro Shimizu 890ddd
	wrapout = rout->getWrap();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* calcolo l'area di output interessata */
Toshihiro Shimizu 890ddd
	x1 = TMAX(0, -dx - 1);
Toshihiro Shimizu 890ddd
	y1 = TMAX(0, -dy - 1);
Toshihiro Shimizu 890ddd
	x2 = TMIN(rout->getLx() - 1, -dx + rin->getLx());
Toshihiro Shimizu 890ddd
	y2 = TMIN(rout->getLy() - 1, -dy + rin->getLy());
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	rin->lock();
Toshihiro Shimizu 890ddd
	rout->lock();
Toshihiro Shimizu 890ddd
	bufferin = rin->pixels();
Toshihiro Shimizu 890ddd
	bufferout = rout->pixels();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	for (y = y1; y <= y2; y++) {
Toshihiro Shimizu 890ddd
		fy1 = TMAX(-1, -dy - y);
Toshihiro Shimizu 890ddd
		fy2 = TMIN(1, -dy + rin->getLy() - 1 - y);
Toshihiro Shimizu 890ddd
		if (fy1 > fy2)
Toshihiro Shimizu 890ddd
			continue;
Toshihiro Shimizu 890ddd
		x = x1;
Toshihiro Shimizu 890ddd
		pixout = bufferout + wrapout * y + x;
Toshihiro Shimizu 890ddd
		pixin = bufferin + wrapin * (y + dy) + (x + dx);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		while (x <= x2) {
Toshihiro Shimizu 890ddd
			fx1 = TMAX(-1, -dx - x);
Toshihiro Shimizu 890ddd
			fx2 = TMIN(1, -dx + rin->getLx() - 1 - x);
Toshihiro Shimizu 890ddd
			if (x > -dx && x < -dx + rin->getLx() - 1)
Toshihiro Shimizu 890ddd
				n = tmin(-dx + rin->getLx() - 1 - x, x2 - x + 1);
Toshihiro Shimizu 890ddd
			else
Toshihiro Shimizu 890ddd
				n = 1;
Toshihiro Shimizu 890ddd
			if (n < 1)
Toshihiro Shimizu 890ddd
				break;
Toshihiro Shimizu 890ddd
			pixn = 0;
Toshihiro Shimizu 890ddd
			for (fy = fy1; fy <= fy2; fy++)
Toshihiro Shimizu 890ddd
				for (fx = fx1; fx <= fx2; fx++) {
Toshihiro Shimizu 890ddd
					pixarr[pixn] = pixin + fy * wrapin + fx;
Toshihiro Shimizu 890ddd
					w[pixn] = (long)(conv[(fy + 1) * 3 + fx + 1] * (1 << 16));
Toshihiro Shimizu 890ddd
					pixn++;
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
			if (pixn == 9)
Toshihiro Shimizu 890ddd
				doConvolve_row_9_i<pixout, pixin="">(pixout, n, pixarr, w);</pixout,>
Toshihiro Shimizu 890ddd
			else
Toshihiro Shimizu 890ddd
				doConvolve_row_i<pixout, pixin="">(pixout, n, pixarr, w, pixn);</pixout,>
Toshihiro Shimizu 890ddd
			x += n;
Toshihiro Shimizu 890ddd
			pixin += n;
Toshihiro Shimizu 890ddd
			pixout += n;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	rin->unlock();
Toshihiro Shimizu 890ddd
	rout->unlock();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class class="" pixin="" pixout,=""></class>
Toshihiro Shimizu 890ddd
void doConvolve_i(TRasterPT<pixout> rout,</pixout>
Toshihiro Shimizu 890ddd
				  TRasterPT<pixin> rin,</pixin>
Toshihiro Shimizu 890ddd
				  int dx, int dy,
Toshihiro Shimizu 890ddd
				  double conv[], int radius)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	PIXIN *bufferin;
Toshihiro Shimizu 890ddd
	PIXOUT *bufferout;
Toshihiro Shimizu 890ddd
	PIXIN *pixin;
Toshihiro Shimizu 890ddd
	PIXOUT *pixout;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int radiusSquare = sq(radius);
Shinya Kitaoka 42bfb6
	std::unique_ptr<pixin*[]> pixarr(new PIXIN *[radiusSquare]);</pixin*[]>
Shinya Kitaoka 42bfb6
	std::unique_ptr<long[]> w(new long[radiusSquare]);</long[]>
Toshihiro Shimizu 890ddd
	int pixn;
Toshihiro Shimizu 890ddd
	int wrapin, wrapout;
Toshihiro Shimizu 890ddd
	int x, y, n;
Toshihiro Shimizu 890ddd
	int x1, y1, x2, y2;
Toshihiro Shimizu 890ddd
	int fx1, fy1, fx2, fy2, fx, fy;
Toshihiro Shimizu 890ddd
	int radius1 = radius / 2;
Toshihiro Shimizu 890ddd
	int radius0 = radius1 - radius + 1;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	rout->clear();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	wrapin = rin->getWrap();
Toshihiro Shimizu 890ddd
	wrapout = rout->getWrap();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* calcolo l'area di output interessata */
Toshihiro Shimizu 890ddd
	x1 = TMAX(0, -dx - 1);
Toshihiro Shimizu 890ddd
	y1 = TMAX(0, -dy - 1);
Toshihiro Shimizu 890ddd
	x2 = TMIN(rout->getLx() - 1, -dx + rin->getLx());
Toshihiro Shimizu 890ddd
	y2 = TMIN(rout->getLy() - 1, -dy + rin->getLy());
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	rin->lock();
Toshihiro Shimizu 890ddd
	rout->lock();
Toshihiro Shimizu 890ddd
	bufferin = rin->pixels();
Toshihiro Shimizu 890ddd
	bufferout = rout->pixels();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	for (y = y1; y <= y2; y++) {
Toshihiro Shimizu 890ddd
		fy1 = TMAX(radius0, -dy - y);
Toshihiro Shimizu 890ddd
		fy2 = TMIN(radius1, -dy - y + rin->getLy() - 1);
Toshihiro Shimizu 890ddd
		if (fy1 > fy2)
Toshihiro Shimizu 890ddd
			continue;
Toshihiro Shimizu 890ddd
		x = x1;
Toshihiro Shimizu 890ddd
		pixout = bufferout + wrapout * y + x;
Toshihiro Shimizu 890ddd
		pixin = bufferin + wrapin * (y + dy) + (x + dx);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		while (x <= x2) {
Toshihiro Shimizu 890ddd
			fx1 = TMAX(radius0, -dx - x);
Toshihiro Shimizu 890ddd
			fx2 = TMIN(radius1, -dx - x + rin->getLx() - 1);
Toshihiro Shimizu 890ddd
			if (x > -dx && x < -dx + rin->getLx() - 1)
Toshihiro Shimizu 890ddd
				n = tmin(-dx + rin->getLx() - 1 - x, x2 - x + 1);
Toshihiro Shimizu 890ddd
			else
Toshihiro Shimizu 890ddd
				n = 1;
Toshihiro Shimizu 890ddd
			if (n < 1)
Toshihiro Shimizu 890ddd
				break;
Toshihiro Shimizu 890ddd
			pixn = 0;
Toshihiro Shimizu 890ddd
			for (fy = fy1; fy <= fy2; fy++)
Toshihiro Shimizu 890ddd
				for (fx = fx1; fx <= fx2; fx++) {
Toshihiro Shimizu 890ddd
					pixarr[pixn] = pixin + fy * wrapin + fx;
Toshihiro Shimizu 890ddd
					w[pixn] = (long)(conv[(fy - radius0) * radius + fx - radius0] * (1 << 16));
Toshihiro Shimizu 890ddd
					pixn++;
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 42bfb6
			doConvolve_row_i<pixout, pixin="">(pixout, n, pixarr.get(), w.get(), pixn);</pixout,>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
			x += n;
Toshihiro Shimizu 890ddd
			pixin += n;
Toshihiro Shimizu 890ddd
			pixout += n;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	rin->unlock();
Toshihiro Shimizu 890ddd
	rout->unlock();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class pixout=""></class>
Toshihiro Shimizu 890ddd
void doConvolve_cm32_3_i(TRasterPT<pixout> rout,</pixout>
Toshihiro Shimizu 890ddd
						 TRasterCM32P rin,
Toshihiro Shimizu 890ddd
						 const TPaletteP &palette,
Toshihiro Shimizu 890ddd
						 int dx, int dy,
Toshihiro Shimizu 890ddd
						 double conv[])
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TPixelCM32 *pixin;
Toshihiro Shimizu 890ddd
	PIXOUT *pixout;
Toshihiro Shimizu 890ddd
	TPixelCM32 *pixarr[9];
Toshihiro Shimizu 890ddd
	long w[9];
Toshihiro Shimizu 890ddd
	int pixn;
Toshihiro Shimizu 890ddd
	int wrapin, wrapout;
Toshihiro Shimizu 890ddd
	int x, y, n;
Toshihiro Shimizu 890ddd
	int x1, y1, x2, y2;
Toshihiro Shimizu 890ddd
	int fx1, fy1, fx2, fy2, fx, fy;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	rout->clear();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	wrapin = rin->getWrap();
Toshihiro Shimizu 890ddd
	wrapout = rout->getWrap();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* calcolo l'area di output interessata */
Toshihiro Shimizu 890ddd
	x1 = TMAX(0, -dx - 1);
Toshihiro Shimizu 890ddd
	y1 = TMAX(0, -dy - 1);
Toshihiro Shimizu 890ddd
	x2 = TMIN(rout->getLx() - 1, -dx + rin->getLx());
Toshihiro Shimizu 890ddd
	y2 = TMIN(rout->getLy() - 1, -dy + rin->getLy());
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int colorCount = palette->getStyleCount();
Toshihiro Shimizu 890ddd
	colorCount = tmax(colorCount, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint());
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	std::vector<tpixel32> paints(colorCount);</tpixel32>
Toshihiro Shimizu 890ddd
	std::vector<tpixel32> inks(colorCount);</tpixel32>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	rin->lock();
Toshihiro Shimizu 890ddd
	rout->lock();
Toshihiro Shimizu 890ddd
	TPixelCM32 *bufferin = rin->pixels();
Toshihiro Shimizu 890ddd
	PIXOUT *bufferout = rout->pixels();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	for (int i = 0; i < palette->getStyleCount(); i++)
Toshihiro Shimizu 890ddd
		paints[i] = inks[i] = palette->getStyle(i)->getAverageColor();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	for (y = y1; y <= y2; y++) {
Toshihiro Shimizu 890ddd
		fy1 = TMAX(-1, -dy - y);
Toshihiro Shimizu 890ddd
		fy2 = TMIN(1, -dy + rin->getLy() - 1 - y);
Toshihiro Shimizu 890ddd
		if (fy1 > fy2)
Toshihiro Shimizu 890ddd
			continue;
Toshihiro Shimizu 890ddd
		x = x1;
Toshihiro Shimizu 890ddd
		pixout = bufferout + wrapout * y + x;
Toshihiro Shimizu 890ddd
		pixin = bufferin + wrapin * (y + dy) + (x + dx);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		while (x <= x2) {
Toshihiro Shimizu 890ddd
			fx1 = TMAX(-1, -dx - x);
Toshihiro Shimizu 890ddd
			fx2 = TMIN(1, -dx + rin->getLx() - 1 - x);
Toshihiro Shimizu 890ddd
			if (x > -dx && x < -dx + rin->getLx() - 1)
Toshihiro Shimizu 890ddd
				n = TMIN(-dx + rin->getLx() - 1 - x, x2 - x + 1);
Toshihiro Shimizu 890ddd
			else
Toshihiro Shimizu 890ddd
				n = 1;
Toshihiro Shimizu 890ddd
			if (n < 1)
Toshihiro Shimizu 890ddd
				break;
Toshihiro Shimizu 890ddd
			pixn = 0;
Toshihiro Shimizu 890ddd
			for (fy = fy1; fy <= fy2; fy++)
Toshihiro Shimizu 890ddd
				for (fx = fx1; fx <= fx2; fx++) {
Toshihiro Shimizu 890ddd
					pixarr[pixn] = pixin + fy * wrapin + fx;
Toshihiro Shimizu 890ddd
					w[pixn] = (long)(conv[(fy + 1) * 3 + fx + 1] * (1 << 16));
Toshihiro Shimizu 890ddd
					pixn++;
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
			if (pixn == 9)
Toshihiro Shimizu 890ddd
				doConvolve_cm32_row_9_i<pixout>(pixout, n, pixarr, w, paints, inks);</pixout>
Toshihiro Shimizu 890ddd
			else
Toshihiro Shimizu 890ddd
				doConvolve_cm32_row_i<pixout>(pixout, n, pixarr, w, pixn, paints, inks);</pixout>
Toshihiro Shimizu 890ddd
			x += n;
Toshihiro Shimizu 890ddd
			pixin += n;
Toshihiro Shimizu 890ddd
			pixout += n;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
	rin->unlock();
Toshihiro Shimizu 890ddd
	rout->unlock();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
template <class pixout=""></class>
Toshihiro Shimizu 890ddd
void doConvolve_cm32_i(TRasterPT<pixout> rout,</pixout>
Toshihiro Shimizu 890ddd
					   TRasterCM32P rin,
Toshihiro Shimizu 890ddd
					   const TPaletteP &palette,
Toshihiro Shimizu 890ddd
					   int dx, int dy,
Toshihiro Shimizu 890ddd
					   double conv[], int radius)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TPixelCM32 *pixin;
Toshihiro Shimizu 890ddd
	PIXOUT *pixout;
Toshihiro Shimizu 890ddd
	int radiusSquare = sq(radius);
Shinya Kitaoka 42bfb6
	std::unique_ptr<tpixelcm32*[]> pixarr(new TPixelCM32*[radiusSquare]);</tpixelcm32*[]>
Shinya Kitaoka 42bfb6
	std::unique_ptr<long[]> w(new long[radiusSquare]);</long[]>
Toshihiro Shimizu 890ddd
	int pixn;
Toshihiro Shimizu 890ddd
	int wrapin, wrapout;
Toshihiro Shimizu 890ddd
	int x, y, n;
Toshihiro Shimizu 890ddd
	int x1, y1, x2, y2;
Toshihiro Shimizu 890ddd
	int fx1, fy1, fx2, fy2, fx, fy;
Toshihiro Shimizu 890ddd
	int radius1 = radius / 2;
Toshihiro Shimizu 890ddd
	int radius0 = radius1 - radius + 1;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	rout->clear();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	wrapin = rin->getWrap();
Toshihiro Shimizu 890ddd
	wrapout = rout->getWrap();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/* calcolo l'area di output interessata */
Toshihiro Shimizu 890ddd
	x1 = TMAX(0, -dx - 1);
Toshihiro Shimizu 890ddd
	y1 = TMAX(0, -dy - 1);
Toshihiro Shimizu 890ddd
	x2 = TMIN(rout->getLx() - 1, -dx + rin->getLx());
Toshihiro Shimizu 890ddd
	y2 = TMIN(rout->getLy() - 1, -dy + rin->getLy());
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int colorCount = palette->getStyleCount();
Toshihiro Shimizu 890ddd
	colorCount = tmax(colorCount, TPixelCM32::getMaxInk(), TPixelCM32::getMaxPaint());
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	std::vector<tpixel32> paints(colorCount);</tpixel32>
Toshihiro Shimizu 890ddd
	std::vector<tpixel32> inks(colorCount);</tpixel32>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	rin->lock();
Toshihiro Shimizu 890ddd
	rout->lock();
Toshihiro Shimizu 890ddd
	TPixelCM32 *bufferin = rin->pixels();
Toshihiro Shimizu 890ddd
	PIXOUT *bufferout = rout->pixels();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	for (int i = 0; i < palette->getStyleCount(); i++)
Toshihiro Shimizu 890ddd
		paints[i] = inks[i] = palette->getStyle(i)->getAverageColor();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	for (y = y1; y <= y2; y++) {
Toshihiro Shimizu 890ddd
		fy1 = TMAX(radius0, -dy - y);
Toshihiro Shimizu 890ddd
		fy2 = TMIN(radius1, -dy + rin->getLy() - 1 - y);
Toshihiro Shimizu 890ddd
		if (fy1 > fy2)
Toshihiro Shimizu 890ddd
			continue;
Toshihiro Shimizu 890ddd
		x = x1;
Toshihiro Shimizu 890ddd
		pixout = bufferout + wrapout * y + x;
Toshihiro Shimizu 890ddd
		pixin = bufferin + wrapin * (y + dy) + (x + dx);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		while (x <= x2) {
Toshihiro Shimizu 890ddd
			fx1 = TMAX(radius0, -dx - x);
Toshihiro Shimizu 890ddd
			fx2 = TMIN(radius1, -dx + rin->getLx() - 1 - x);
Toshihiro Shimizu 890ddd
			if (x > -dx && x < -dx + rin->getLx() - 1)
Toshihiro Shimizu 890ddd
				n = TMIN(-dx + rin->getLx() - 1 - x, x2 - x + 1);
Toshihiro Shimizu 890ddd
			else
Toshihiro Shimizu 890ddd
				n = 1;
Toshihiro Shimizu 890ddd
			if (n < 1)
Toshihiro Shimizu 890ddd
				break;
Toshihiro Shimizu 890ddd
			pixn = 0;
Toshihiro Shimizu 890ddd
			for (fy = fy1; fy <= fy2; fy++)
Toshihiro Shimizu 890ddd
				for (fx = fx1; fx <= fx2; fx++) {
Toshihiro Shimizu 890ddd
					pixarr[pixn] = pixin + fy * wrapin + fx;
Toshihiro Shimizu 890ddd
					w[pixn] = (long)(conv[(fy - radius0) * radius + fx - radius0] * (1 << 16));
Toshihiro Shimizu 890ddd
					pixn++;
Toshihiro Shimizu 890ddd
				}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 42bfb6
			doConvolve_cm32_row_i<pixout>(pixout, n, pixarr.get(), w.get(), pixn, paints, inks);</pixout>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
			x += n;
Toshihiro Shimizu 890ddd
			pixin += n;
Toshihiro Shimizu 890ddd
			pixout += n;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	rin->unlock();
Toshihiro Shimizu 890ddd
	rout->unlock();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
} // anonymous namespace
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void TRop::convolve_3_i(TRasterP rout, TRasterP rin, int dx, int dy, double conv[])
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TRaster32P rin32 = rin;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	if (rin32) {
Toshihiro Shimizu 890ddd
		TRaster32P rout32 = rout;
Toshihiro Shimizu 890ddd
		if (rout32) {
Toshihiro Shimizu 890ddd
			doConvolve_3_i<tpixel32, tpixel32="">(rout32, rin32, dx, dy, conv);</tpixel32,>
Toshihiro Shimizu 890ddd
			return;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		TRaster64P rout64 = rout;
Toshihiro Shimizu 890ddd
		if (rout64) {
Toshihiro Shimizu 890ddd
			doConvolve_3_i<tpixel64, tpixel32="">(rout64, rin32, dx, dy, conv);</tpixel64,>
Toshihiro Shimizu 890ddd
			return;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	} else {
Toshihiro Shimizu 890ddd
		TRaster64P rin64 = rin;
Toshihiro Shimizu 890ddd
		if (rin64) {
Toshihiro Shimizu 890ddd
			TRaster32P rout32 = rout;
Toshihiro Shimizu 890ddd
			if (rout32) {
Toshihiro Shimizu 890ddd
				doConvolve_3_i<tpixel32, tpixel64="">(rout32, rin64, dx, dy, conv);</tpixel32,>
Toshihiro Shimizu 890ddd
				return;
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
			TRaster64P rout64 = rout;
Toshihiro Shimizu 890ddd
			if (rout64) {
Toshihiro Shimizu 890ddd
				doConvolve_3_i<tpixel64, tpixel64="">(rout64, rin64, dx, dy, conv);</tpixel64,>
Toshihiro Shimizu 890ddd
				return;
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	throw TRopException("TRop::convolve_3_i: unsupported pixel type");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void TRop::convolve_3_i(TRasterP rout, TRasterCM32P rin, const TPaletteP &palette,
Toshihiro Shimizu 890ddd
						int dx, int dy, double conv[])
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TRaster32P rout32 = rout;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	if (rout32) {
Toshihiro Shimizu 890ddd
		doConvolve_cm32_3_i<tpixel32>(rout32, rin, palette, dx, dy, conv);</tpixel32>
Toshihiro Shimizu 890ddd
		return;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRaster64P rout64 = rout;
Toshihiro Shimizu 890ddd
	if (rout64) {
Toshihiro Shimizu 890ddd
		doConvolve_cm32_3_i<tpixel64>(rout64, rin, palette, dx, dy, conv);</tpixel64>
Toshihiro Shimizu 890ddd
		return;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	throw TRopException("TRop::convolve_3_i: unsupported pixel type");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void TRop::convolve_i(TRasterP rout, TRasterP rin, int dx, int dy, double conv[], int radius)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TRaster32P rin32 = rin;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	if (rin32) {
Toshihiro Shimizu 890ddd
		TRaster32P rout32 = rout;
Toshihiro Shimizu 890ddd
		if (rout32) {
Toshihiro Shimizu 890ddd
			doConvolve_i<tpixel32, tpixel32="">(rout32, rin32, dx, dy, conv, radius);</tpixel32,>
Toshihiro Shimizu 890ddd
			return;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
		TRaster64P rout64 = rout;
Toshihiro Shimizu 890ddd
		if (rout64) {
Toshihiro Shimizu 890ddd
			doConvolve_i<tpixel64, tpixel32="">(rout64, rin32, dx, dy, conv, radius);</tpixel64,>
Toshihiro Shimizu 890ddd
			return;
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	} else {
Toshihiro Shimizu 890ddd
		TRaster64P rin64 = rin;
Toshihiro Shimizu 890ddd
		if (rin64) {
Toshihiro Shimizu 890ddd
			TRaster32P rout32 = rout;
Toshihiro Shimizu 890ddd
			if (rout32) {
Toshihiro Shimizu 890ddd
				doConvolve_i<tpixel32, tpixel64="">(rout32, rin64, dx, dy, conv, radius);</tpixel32,>
Toshihiro Shimizu 890ddd
				return;
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
			TRaster64P rout64 = rout;
Toshihiro Shimizu 890ddd
			if (rout64) {
Toshihiro Shimizu 890ddd
				doConvolve_i<tpixel64, tpixel64="">(rout64, rin64, dx, dy, conv, radius);</tpixel64,>
Toshihiro Shimizu 890ddd
				return;
Toshihiro Shimizu 890ddd
			}
Toshihiro Shimizu 890ddd
		}
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	throw TRopException("TRop::convolve_i: unsupported pixel type");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void TRop::convolve_i(TRasterP rout, TRasterCM32P rin, const TPaletteP &palette,
Toshihiro Shimizu 890ddd
					  int dx, int dy, double conv[], int radius)
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
	TRaster32P rout32 = rout;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	if (rout32) {
Toshihiro Shimizu 890ddd
		doConvolve_cm32_i<tpixel32>(rout32, rin, palette, dx, dy, conv, radius);</tpixel32>
Toshihiro Shimizu 890ddd
		return;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRaster64P rout64 = rout;
Toshihiro Shimizu 890ddd
	if (rout64) {
Toshihiro Shimizu 890ddd
		doConvolve_cm32_i<tpixel64>(rout64, rin, palette, dx, dy, conv, radius);</tpixel64>
Toshihiro Shimizu 890ddd
		return;
Toshihiro Shimizu 890ddd
	}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	throw TRopException("TRop::convolve_i: unsupported pixel type");
Toshihiro Shimizu 890ddd
}