Toshihiro Shimizu 890ddd
/*------------------------------------
Toshihiro Shimizu 890ddd
 Iwa_DirectionalBlurFx
Toshihiro Shimizu 890ddd
 ボケ足の伸ばし方を選択でき、参照画像を追加した DirectionalBlur
Toshihiro Shimizu 890ddd
//------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef IWA_DIRECTIONAL_BLUR_H
Toshihiro Shimizu 890ddd
#define IWA_DIRECTIONAL_BLUR_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tfxparam.h"
Toshihiro Shimizu 890ddd
#include "stdfx.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct float2 {
Toshihiro Shimizu 890ddd
	float x, y;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
struct float4 {
Toshihiro Shimizu 890ddd
	float x, y, z, w;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
struct int2 {
Toshihiro Shimizu 890ddd
	int x, y;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class Iwa_DirectionalBlurFx : public TStandardRasterFx
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	FX_PLUGIN_DECLARATION(Iwa_DirectionalBlurFx)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRasterFxPort m_input;
Toshihiro Shimizu 890ddd
	TRasterFxPort m_reference;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TDoubleParamP m_angle;
Toshihiro Shimizu 890ddd
	TDoubleParamP m_intensity;
Toshihiro Shimizu 890ddd
	TBoolParamP m_bidirectional;
Toshihiro Shimizu 890ddd
	/*- リニア/ガウシアン/平均化 -*/
Toshihiro Shimizu 890ddd
	TIntEnumParamP m_filterType;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*- 参照画像の輝度を0〜1に正規化してホストメモリに読み込む -*/
Toshihiro Shimizu 890ddd
	template <typename pixel="" raster,="" typename=""></typename>
Toshihiro Shimizu 890ddd
	void setReferenceRaster(const RASTER srcRas,
Toshihiro Shimizu 890ddd
							float *dstMem,
Toshihiro Shimizu 890ddd
							TDimensionI dim);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*- ソース画像を0〜1に正規化してホストメモリに読み込む -*/
Toshihiro Shimizu 890ddd
	template <typename pixel="" raster,="" typename=""></typename>
Toshihiro Shimizu 890ddd
	void setSourceRaster(const RASTER srcRas,
Toshihiro Shimizu 890ddd
						 float4 *dstMem,
Toshihiro Shimizu 890ddd
						 TDimensionI dim);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*- 出力結果をChannel値に変換して格納 -*/
Toshihiro Shimizu 890ddd
	template <typename pixel="" raster,="" typename=""></typename>
Toshihiro Shimizu 890ddd
	void setOutputRaster(float4 *srcMem,
Toshihiro Shimizu 890ddd
						 const RASTER dstRas,
Toshihiro Shimizu 890ddd
						 TDimensionI dim,
Toshihiro Shimizu 890ddd
						 int2 margin);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void doCompute_CPU(TTile &tile,
Toshihiro Shimizu 890ddd
					   double frame,
Toshihiro Shimizu 890ddd
					   const TRenderSettings &settings,
Toshihiro Shimizu 890ddd
					   TPointD &blur,
Toshihiro Shimizu 890ddd
					   bool bidirectional,
Toshihiro Shimizu 890ddd
					   int marginLeft, int marginRight,
Toshihiro Shimizu 890ddd
					   int marginTop, int marginBottom,
Toshihiro Shimizu 890ddd
					   TDimensionI &enlargedDimIn,
Toshihiro Shimizu 890ddd
					   TTile &enlarge_tile,
Toshihiro Shimizu 890ddd
					   TDimensionI &dimOut,
Toshihiro Shimizu 890ddd
					   TDimensionI &filterDim,
Toshihiro Shimizu 890ddd
					   float *reference_host);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void makeDirectionalBlurFilter_CPU(float *filter,
Toshihiro Shimizu 890ddd
									   TPointD &blur,
Toshihiro Shimizu 890ddd
									   bool bidirectional,
Toshihiro Shimizu 890ddd
									   int marginLeft, int marginRight,
Toshihiro Shimizu 890ddd
									   int marginTop, int marginBottom,
Toshihiro Shimizu 890ddd
									   TDimensionI &filterDim);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	Iwa_DirectionalBlurFx();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void doCompute(TTile &tile,
Toshihiro Shimizu 890ddd
				   double frame,
Toshihiro Shimizu 890ddd
				   const TRenderSettings &settings);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool doGetBBox(double frame,
Toshihiro Shimizu 890ddd
				   TRectD &bBox,
Toshihiro Shimizu 890ddd
				   const TRenderSettings &info);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool canHandle(const TRenderSettings &info,
Toshihiro Shimizu 890ddd
				   double frame);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	void getParamUIs(TParamUIConcept *&concepts,
Toshihiro Shimizu 890ddd
					 int &length);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif