|
shun-iwasawa |
25dc51 |
#pragma once
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
/*------------------------------------
|
|
shun-iwasawa |
25dc51 |
Iwa_GlareFx
|
|
shun-iwasawa |
25dc51 |
------------------------------------*/
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
#ifndef IWA_GLAREFX_H
|
|
shun-iwasawa |
25dc51 |
#define IWA_GLAREFX_H
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
#include "stdfx.h"
|
|
shun-iwasawa |
25dc51 |
#include "tfxparam.h"
|
|
shun-iwasawa |
25dc51 |
#include "traster.h"
|
|
shun-iwasawa |
25dc51 |
#include "tparamset.h"
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
#include <qlist></qlist>
|
|
shun-iwasawa |
25dc51 |
#include <qthread></qthread>
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
#include "tools/kiss_fftnd.h"
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
const int LAYER_NUM = 5;
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
struct double2 {
|
|
shun-iwasawa |
25dc51 |
double x, y;
|
|
shun-iwasawa |
25dc51 |
};
|
|
shun-iwasawa |
25dc51 |
struct int2 {
|
|
shun-iwasawa |
25dc51 |
int x, y;
|
|
shun-iwasawa |
25dc51 |
};
|
|
shun-iwasawa |
25dc51 |
struct double3 {
|
|
shun-iwasawa |
25dc51 |
double x, y, z;
|
|
shun-iwasawa |
25dc51 |
};
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
class Iwa_GlareFx : public TStandardRasterFx {
|
|
shun-iwasawa |
25dc51 |
FX_PLUGIN_DECLARATION(Iwa_GlareFx)
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
protected:
|
|
shun-iwasawa |
25dc51 |
TRasterFxPort m_source;
|
|
shun-iwasawa |
25dc51 |
TRasterFxPort m_iris;
|
|
shun-iwasawa |
25dc51 |
// rendering mode (filter preview / render)
|
|
shun-iwasawa |
25dc51 |
TIntEnumParamP m_renderMode;
|
|
shun-iwasawa |
25dc51 |
TDoubleParamP m_intensity;
|
|
shun-iwasawa |
25dc51 |
TDoubleParamP m_size;
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
TDoubleParamP m_rotation;
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
TDoubleParamP m_noise_factor;
|
|
shun-iwasawa |
25dc51 |
TDoubleParamP m_noise_size;
|
|
shun-iwasawa |
25dc51 |
TIntEnumParamP m_noise_octave;
|
|
shun-iwasawa |
25dc51 |
TDoubleParamP m_noise_evolution;
|
|
shun-iwasawa |
25dc51 |
TPointParamP m_noise_offset;
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
enum { RendeMode_FilterPreview = 0, RendeMode_Render };
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
double getSizePixelAmount(const double val, const TAffine affine);
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
// Resize / flip the iris image according to the size ratio.
|
|
shun-iwasawa |
25dc51 |
// Normalize the brightness of the iris image.
|
|
shun-iwasawa |
25dc51 |
// Enlarge the iris to the output size.
|
|
shun-iwasawa |
25dc51 |
void convertIris(kiss_fft_cpx *kissfft_comp_iris_before, const int &dimIris,
|
|
shun-iwasawa |
25dc51 |
const TRectD &irisBBox, const TTile &irisTile);
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
void powerSpectrum2GlarePattern(const double frame, const TAffine affine,
|
|
shun-iwasawa |
25dc51 |
kiss_fft_cpx *spectrum, double3 *glare,
|
|
shun-iwasawa |
25dc51 |
int dimIris, double intensity,
|
|
shun-iwasawa |
25dc51 |
double irisResizeFactor);
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
void distortGlarePattern(const double frame, const TAffine affine,
|
|
shun-iwasawa |
25dc51 |
double *glare, const int dimIris);
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
// filter preview mode
|
|
shun-iwasawa |
25dc51 |
template <typename pixel="" raster,="" typename=""></typename>
|
|
shun-iwasawa |
25dc51 |
void setFilterPreviewToResult(const RASTER ras, double3 *glare, int dimIris,
|
|
shun-iwasawa |
25dc51 |
int2 margin);
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
// put the source tile's brightness to fft buffer
|
|
shun-iwasawa |
25dc51 |
template <typename pixel="" raster,="" typename=""></typename>
|
|
shun-iwasawa |
25dc51 |
void setSourceTileToBuffer(const RASTER ras, kiss_fft_cpx *buf);
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
void setGlarePatternToBuffer(const double3 *glare, kiss_fft_cpx *buf,
|
|
shun-iwasawa |
25dc51 |
const int channel, const int dimIris,
|
|
shun-iwasawa |
25dc51 |
const TDimensionI &dimOut);
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
void multiplyFilter(kiss_fft_cpx *glare, const kiss_fft_cpx *source,
|
|
shun-iwasawa |
25dc51 |
const int count);
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
template <typename pixel="" raster,="" typename=""></typename>
|
|
shun-iwasawa |
25dc51 |
void setChannelToResult(const RASTER ras, kiss_fft_cpx *buf, int channel,
|
|
shun-iwasawa |
25dc51 |
const TDimensionI &dimOut);
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
public:
|
|
shun-iwasawa |
25dc51 |
Iwa_GlareFx();
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
void doCompute(TTile &tile, double frame, const TRenderSettings &settings);
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
bool doGetBBox(double frame, TRectD &bBox, const TRenderSettings &info);
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
bool canHandle(const TRenderSettings &info, double frame);
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
void getParamUIs(TParamUIConcept *&concepts, int &length) override;
|
|
shun-iwasawa |
25dc51 |
};
|
|
shun-iwasawa |
25dc51 |
|
|
shun-iwasawa |
25dc51 |
#endif
|