Shinya Kitaoka 810553
#pragma once
Shinya Kitaoka 810553
Toshihiro Shimizu 890ddd
/*------------------------------------------------
Toshihiro Shimizu 890ddd
  Iwa_AdjustExposureFx
Toshihiro Shimizu 890ddd
  明るさを露光値で調整するエフェクト
Toshihiro Shimizu 890ddd
------------------------------------------------*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef ADJUST_EXPOSURE_H
Toshihiro Shimizu 890ddd
#define ADJUST_EXPOSURE_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "stdfx.h"
Toshihiro Shimizu 890ddd
#include "tfxparam.h"
shun-iwasawa 481b59
#include "iwa_bokeh_util.h"  // ExposureConverter
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
struct float4 {
Shinya Kitaoka 120a6e
  float x, y, z, w;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class Iwa_AdjustExposureFx final : public TStandardRasterFx {
Shinya Kitaoka 120a6e
  FX_PLUGIN_DECLARATION(Iwa_AdjustExposureFx)
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TRasterFxPort m_source;
shun-iwasawa 481b59
  TDoubleParamP m_hardness;     // gamma (version 1)
shun-iwasawa 481b59
  TDoubleParamP m_gamma;        // gamma (version 2)
shun-iwasawa 481b59
  TDoubleParamP m_gammaAdjust;  // Gamma offset from the current color space
shun-iwasawa 481b59
                                // gamma (version 3)
shun-iwasawa 481b59
  TDoubleParamP m_scale;        /*- 明るさのスケール値 -*/
shun-iwasawa 481b59
  TDoubleParamP m_offset;       /*- 明るさのオフセット値 -*/
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /*- タイルの画像を0〜1に正規化してホストメモリに読み込む -*/
Shinya Kitaoka 120a6e
  template <typename pixel="" raster,="" typename=""></typename>
Shinya Kitaoka 120a6e
  void setSourceRaster(const RASTER srcRas, float4 *dstMem, TDimensionI dim);
shun-iwasawa 481b59
  void setSourceRasterF(const TRasterFP srcRas, float4 *dstMem,
shun-iwasawa 481b59
                        TDimensionI dim);
Shinya Kitaoka 120a6e
  /*- 出力結果をChannel値に変換して格納 -*/
Shinya Kitaoka 120a6e
  template <typename pixel="" raster,="" typename=""></typename>
Shinya Kitaoka 120a6e
  void setOutputRaster(float4 *srcMem, const RASTER dstRas, TDimensionI dim);
shun-iwasawa 481b59
  void setOutputRasterF(float4 *srcMem, const TRasterFP dstRas,
shun-iwasawa 481b59
                        TDimensionI dim);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  Iwa_AdjustExposureFx();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 38fd86
  void doCompute(TTile &tile, double frame,
Shinya Kitaoka 38fd86
                 const TRenderSettings &settings) override;
Toshihiro Shimizu 890ddd
shun-iwasawa 481b59
  void doCompute_CPU(double frame, TDimensionI &dim, float4 *tile_host,
shun-iwasawa 481b59
                     const ExposureConverter &conv);
shun-iwasawa 481b59
shun-iwasawa 481b59
  void doFloatCompute(const TRasterFP rasF, double frame, TDimensionI &dim,
shun-iwasawa 481b59
                      const ExposureConverter &conv);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 38fd86
  bool doGetBBox(double frame, TRectD &bBox,
Shinya Kitaoka 38fd86
                 const TRenderSettings &info) override;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  bool canHandle(const TRenderSettings &info, double frame) override;
shun-iwasawa 481b59
shun-iwasawa 481b59
  void onFxVersionSet() final override;
shun-iwasawa 481b59
shun-iwasawa 481b59
  bool toBeComputedInLinearColorSpace(bool settingsIsLinear,
shun-iwasawa 481b59
                                      bool tileIsLinear) const override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif