Beispiel #1
0
void FFTGrid3D<T>::Convolve(FFTGrid3D<T> &filter)
{
  DoFFT();
  filter.DoFFT();
  for(size_t i = 0; i < GetComplexNI()*GetComplexNJ()*GetComplexNK(); i++)
  {
    complex_data_[i] *= filter.complex_data_[i];
  }
  DoInverseFFT();
}
Beispiel #2
0
void FFTGrid3D<T>::ConvolveCovariance(FFTGrid3D<T> &filter)
{
  DoFFT();
  filter.DoFFT();
  for(size_t i = 0; i < GetComplexNI()*GetComplexNJ()*GetComplexNK(); i++)
  {
    complex_data_[i] *= std::sqrt(filter.complex_data_[i]);
  }
  DoInverseFFT();
}
Beispiel #3
0
//---------------------------------------------------------------------------
void DrawFFTGraph(const FFTGraphParam & param)
{
	GetVisBuffer(param.sb, 2048, 1, 0);
	DoFFT();

	tjs_int type = 0;
	static tjs_uint32 type_hint = 0;
	type = GetValueFromOptions(param.options, L"type", &type_hint, type);

	switch(type)
{
	case 0: // winamp, fire風
	  {
#if 1
		const static tjs_uint32 firecolors[16] =
			{
				0xff20ff00, 0xff40ff00, 0xff60ff00, 0xff80ff00,
				0xffa0ff00, 0xffc0ff00, 0xffe0ff00, 0xffffff00,
				0xffffe000, 0xffffc000, 0xffffa000, 0xffff8000,
				0xffff6000, 0xffff4000, 0xffff2000, 0xffffff00
			};
		const tjs_uint32 peak_color = 0xff808080;
#else
			/* あきさんモード */
		const static tjs_uint32 firecolors[16] =
			{
				0xff11DDFF, 0xff11CCEE, 0xff11BBDD, 0xff11AACC,
				0xff1199CC, 0xff1188BB, 0xff1177AA, 0xff0066AA,
				0xff005599, 0xff004499, 0xff004488, 0xff003388,
				0xff002277, 0xff001166, 0xff000066, 0xff000055
			};
		const tjs_uint32 peak_color = 0xff11eeff;
#endif


		GetBandSpectrum(param.width, 3.7, -70, param.height - 1,
			(param.height+15) / 16, 30, (param.height+31) / 32);

		tjs_uint8 *lbstart = param.laybuf +
			(param.top + param.height - 1) * param.laybufpitch +
			param.left * sizeof(tjs_uint32);

		for(int x = 0; x < param.width; x++)
		{
			tjs_uint8 *lb = lbstart + x * sizeof(tjs_uint32);

			int y;
			for(y = 0; y < BandData[x]; y ++)
			{
				int c = 15 - BandData[x] + y;
				*(tjs_uint32*)lb = c < 0 ? 0xff00ff00 : firecolors[c];
				lb -= param.laybufpitch;
			}
			for(; y < param.height; y++)
			{
				*(tjs_uint32*)lb = 0;
				lb -= param.laybufpitch;
			}

			*(tjs_uint32*)
				(lbstart + x * sizeof(tjs_uint32) - BandPeakData[x] * param.laybufpitch)
					= peak_color;
		}
	  }
	  break;
	case 1: // LCD 風
	  {
		tjs_int division = 16;
		tjs_int thick = 2;
		tjs_int oncolor = 0xff000000;
		tjs_int offcolor = 0xffb0b0b0;
		tjs_int bgcolor = 0xffc0c0c0;
		tjs_int peakcolor = 0xff707070;

		static tjs_uint32 hints[6];

		division = GetValueFromOptions(param.options, L"division", hints + 0, division);
		thick = GetValueFromOptions(param.options, L"thick", hints + 1, thick);
		oncolor = GetValueFromOptions(param.options, L"oncolor", hints + 2, oncolor);
		offcolor = GetValueFromOptions(param.options, L"offcolor", hints + 3, offcolor);
		bgcolor = GetValueFromOptions(param.options, L"bgcolor", hints + 4, bgcolor);
		peakcolor = GetValueFromOptions(param.options, L"peakcolor", hints + 5, peakcolor);

		DrawBarGraph(param, division, thick, oncolor, offcolor, bgcolor, peakcolor);
	  }
	  break;
	}
}