2020-09-16 09:49:57 +12:00
|
|
|
|
#pragma once
|
2017-03-16 19:29:47 +13:00
|
|
|
|
|
|
|
|
|
/*------------------------------------
|
|
|
|
|
Iwa_BokehFx
|
|
|
|
|
Apply an off-focus effect to the source image, using user input iris image.
|
|
|
|
|
It considers characteristics of films (which is known as Hurter–Driffield
|
|
|
|
|
curves)
|
|
|
|
|
or human eye's perception (which is known as Weber–Fechner law).
|
|
|
|
|
For filtering process I used KissFFT, an FFT library by Mark Borgerding,
|
|
|
|
|
distributed with a 3-clause BSD-style license.
|
|
|
|
|
------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#ifndef IWA_BOKEHFX_H
|
|
|
|
|
#define IWA_BOKEHFX_H
|
|
|
|
|
|
|
|
|
|
#include "stdfx.h"
|
|
|
|
|
#include "tfxparam.h"
|
|
|
|
|
#include "traster.h"
|
|
|
|
|
|
|
|
|
|
#include <QList>
|
|
|
|
|
#include <QThread>
|
|
|
|
|
|
|
|
|
|
#include "tools/kiss_fftnd.h"
|
2021-06-07 15:26:20 +12:00
|
|
|
|
#include "iwa_bokeh_util.h"
|
2017-03-16 19:29:47 +13:00
|
|
|
|
|
|
|
|
|
const int LAYER_NUM = 5;
|
|
|
|
|
|
2021-06-07 15:26:20 +12:00
|
|
|
|
class Iwa_BokehFx : public Iwa_BokehCommonFx {
|
2017-03-16 19:29:47 +13:00
|
|
|
|
FX_PLUGIN_DECLARATION(Iwa_BokehFx)
|
|
|
|
|
|
|
|
|
|
struct LAYERPARAM {
|
|
|
|
|
TRasterFxPort m_source;
|
|
|
|
|
TBoolParamP m_premultiply;
|
|
|
|
|
TDoubleParamP m_distance; // The layer distance from the camera (0-1)
|
|
|
|
|
TDoubleParamP m_bokehAdjustment; // Factor for adjusting distance (= focal
|
|
|
|
|
// distance - layer distance) (0-2.0)
|
|
|
|
|
} m_layerParams[LAYER_NUM];
|
|
|
|
|
|
|
|
|
|
// Sort source layers by distance
|
|
|
|
|
QList<int> getSortedSourceIndices(double frame);
|
|
|
|
|
// Compute the bokeh size for each layer. The source tile will be enlarged by
|
|
|
|
|
// the largest size of them.
|
2021-06-07 15:26:20 +12:00
|
|
|
|
QMap<int, double> getIrisSizes(const double frame,
|
|
|
|
|
const QList<int> sourceIndices,
|
|
|
|
|
const double bokehPixelAmount,
|
|
|
|
|
double &maxIrisSize);
|
2017-03-16 19:29:47 +13:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Iwa_BokehFx();
|
|
|
|
|
|
2020-09-16 09:49:57 +12:00
|
|
|
|
void doCompute(TTile &tile, double frame, const TRenderSettings &settings) override;
|
2017-03-16 19:29:47 +13:00
|
|
|
|
};
|
|
|
|
|
|
2020-09-16 09:49:57 +12:00
|
|
|
|
#endif
|