tahoma2d/toonz/sources/stdfx/iwa_bokehreffx.h
2021-08-16 23:36:09 -04:00

61 lines
2 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
/*------------------------------------
Iwa_BokehRefFx
Apply an off-focus effect to a single source image.
The amount of bokeh is specified by user input reference image,
which represents the depth by brightness of pixels.
It considers characteristics of films (which is known as HurterDriffield
curves) or human eye's perception (which is known as WeberFechner law).
For filtering process I used KissFFT, an FFT library by Mark Borgerding,
distributed with a 3-clause BSD-style license.
------------------------------------*/
#ifndef IWA_BOKEH_REF_H
#define IWA_BOKEH_REF_H
#include "stdfx.h"
#include "tfxparam.h"
#include <QVector>
#include <QThread>
#include "tools/kiss_fftnd.h"
#include "iwa_bokeh_util.h"
//------------------------------------
class Iwa_BokehRefFx : public Iwa_BokehCommonFx {
FX_PLUGIN_DECLARATION(Iwa_BokehRefFx)
protected:
TRasterFxPort m_source; // source image
TRasterFxPort m_depth; // depth reference image
TIntParamP m_distancePrecision; // Separation of depth image
TBoolParamP m_fillGap; // Toggles whether to extend pixels behind the front
// layers in order to fill gap
// It should be ON for normal backgrounds and should be OFF for the layer
// which is
// "floating" from the lower layers such as dust, snowflake or spider-web.
TBoolParamP m_doMedian; // (Effective only when the Fill Gap option is ON)
// Toggles whether to use Median Filter for extending the pixels.
// normalize brightness of the depth reference image to unsigned char
// and store into dstMem
template <typename RASTER, typename PIXEL>
void setDepthRaster(const RASTER srcRas, unsigned char* dstMem,
TDimensionI dim);
template <typename RASTER, typename PIXEL>
void setDepthRasterGray(const RASTER srcRas, unsigned char* dstMem,
TDimensionI dim);
public:
Iwa_BokehRefFx();
void doCompute(TTile& tile, double frame,
const TRenderSettings& settings) override;
};
#endif