| #pragma once |
| |
| |
| |
| |
| |
| |
| |
| #ifndef IWA_MOTION_BLUR_COMP_H |
| #define IWA_MOTION_BLUR_COMP_H |
| |
| #include "tfxparam.h" |
| #include "stdfx.h" |
| |
| #include "motionawarebasefx.h" |
| |
| class TStageObjectId; |
| |
| struct float2 { |
| float x, y; |
| }; |
| struct float3 { |
| float x, y, z; |
| }; |
| struct float4 { |
| float x, y, z, w; |
| }; |
| struct int2 { |
| int x, y; |
| }; |
| |
| |
| enum PremultiTypes { |
| AUTO = 0, |
| SOURCE_IS_PREMULTIPLIED, |
| SOURCE_IS_NOT_PREMUTIPLIED |
| }; |
| |
| class Iwa_MotionBlurCompFx final : public MotionAwareBaseFx { |
| FX_PLUGIN_DECLARATION(Iwa_MotionBlurCompFx) |
| |
| protected: |
| TRasterFxPort m_input; |
| TRasterFxPort m_background; |
| |
| TDoubleParamP m_hardness; |
| |
| |
| TDoubleParamP m_startValue; |
| |
| TDoubleParamP m_startCurve; |
| TDoubleParamP m_endValue; |
| |
| TDoubleParamP m_endCurve; |
| |
| |
| TBoolParamP m_zanzoMode; |
| |
| TIntEnumParamP m_premultiType; |
| |
| |
| |
| |
| template <typename RASTER, typename PIXEL> |
| bool setSourceRaster(const RASTER srcRas, float4 *dstMem, TDimensionI dim, |
| PremultiTypes type = AUTO); |
| |
| template <typename RASTER, typename PIXEL> |
| void setOutputRaster(float4 *srcMem, const RASTER dstRas, TDimensionI dim, |
| int2 margin); |
| |
| |
| void makeMotionBlurFilter_CPU(float *filter_p, TDimensionI &filterDim, |
| int marginLeft, int marginBottom, |
| float4 *pointsTable, int pointAmount, |
| float startValue, float startCurve, |
| float endValue, float endCurve); |
| |
| |
| void makeZanzoFilter_CPU(float *filter_p, TDimensionI &filterDim, |
| int marginLeft, int marginBottom, |
| float4 *pointsTable, int pointAmount, |
| float startValue, float startCurve, float endValue, |
| float endCurve); |
| |
| |
| void convertRGBtoExposure_CPU(float4 *in_tile_p, TDimensionI &dim, |
| float hardness, bool sourceIsPremultiplied); |
| |
| |
| void applyBlurFilter_CPU(float4 *in_tile_p, float4 *out_tile_p, |
| TDimensionI &dim, float *filter_p, |
| TDimensionI &filterDim, int marginLeft, |
| int marginBottom, int marginRight, int marginTop, |
| TDimensionI &outDim); |
| |
| |
| void convertExposureToRGB_CPU(float4 *out_tile_p, TDimensionI &dim, |
| float hardness); |
| |
| |
| void composeWithNoMotion(TTile &tile, double frame, |
| const TRenderSettings &settings); |
| |
| |
| void composeBackgroundExposure_CPU(float4 *out_tile_p, |
| TDimensionI &enlargedDimIn, |
| int marginRight, int marginTop, |
| TTile &back_tile, TDimensionI &dimOut, |
| float hardness); |
| |
| public: |
| Iwa_MotionBlurCompFx(); |
| |
| void doCompute(TTile &tile, double frame, |
| const TRenderSettings &settings) override; |
| |
| void doCompute_CPU(TTile &tile, double frame, const TRenderSettings &settings, |
| float4 *pointsTable, int pointAmount, double hardness, |
| double shutterStart, double shutterEnd, |
| int traceResolution, float startValue, float startCurve, |
| float endValue, float endCurve, int marginLeft, |
| int marginRight, int marginTop, int marginBottom, |
| TDimensionI &enlargedDimIn, TTile &enlarge_tile, |
| TDimensionI &dimOut, TDimensionI &filterDim, |
| TTile &back_tile); |
| |
| bool doGetBBox(double frame, TRectD &bBox, |
| const TRenderSettings &info) override; |
| |
| bool canHandle(const TRenderSettings &info, double frame) override; |
| |
| |
| std::string getAlias(double frame, |
| const TRenderSettings &info) const override; |
| }; |
| |
| #endif |